summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt8
-rw-r--r--korganizer/calendarview.cpp4
-rw-r--r--korganizer/koagendaitem.cpp2
-rw-r--r--korganizer/kodialogmanager.cpp2
-rw-r--r--korganizer/koprefs.cpp2
-rw-r--r--korganizer/koprefs.h2
-rw-r--r--korganizer/koprefsdialog.cpp13
-rw-r--r--korganizer/kotodoview.cpp78
-rw-r--r--korganizer/kotodoview.h7
-rw-r--r--korganizer/kotodoviewitem.cpp33
-rw-r--r--korganizer/koviewmanager.cpp1
-rw-r--r--version2
12 files changed, 124 insertions, 30 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index ec75fad..bfe87f0 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,649 +1,657 @@
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.16 ************
4
5KO/Pi:
6Fixed search dialog size on Z 6000 (480x640 display).
7Added setting to hide/show time in agenda items.
8Added setting to hide not running todos in todo view.
9Added columns for start date/time in todo view.
10
3********** VERSION 1.9.15 ************ 11********** VERSION 1.9.15 ************
4 12
5Usebilty enhancements in KO/Pi: 13Usebilty enhancements in KO/Pi:
6When clicking on the date in a month view cell, the day view is shown. 14When clicking on the date in a month view cell, the day view is shown.
7Old behaviour was, that the "new event" dialog popped up. 15Old behaviour was, that the "new event" dialog popped up.
8 16
9Added a one step "undo delete" in KO/Pi (Accessable in the "Action" menu). 17Added a one step "undo delete" in KO/Pi (Accessable in the "Action" menu).
10That means, you can restore the latest 18That means, you can restore the latest
11event/todo/journal you have deleted. 19event/todo/journal you have deleted.
12A journal is deleted, if you clear all the text of the journal. 20A journal is deleted, if you clear all the text of the journal.
13 21
14Fixed the bug of the editor dialogs in KO/Pi of version 1.9.14. 22Fixed the bug of the editor dialogs in KO/Pi of version 1.9.14.
15 23
16KA/Pi starting in 480x640 resolution: 24KA/Pi starting in 480x640 resolution:
17Hide the filter action in toolbar 25Hide the filter action in toolbar
18and added icons for undo/delete/redo in toolbar. 26and added icons for undo/delete/redo in toolbar.
19 27
20Change in OM/Pi ViewMail dialog: 28Change in OM/Pi ViewMail dialog:
21When clicking on the "delete" icon the mail is deleted after confirmation as usual. But the edit dialog is not closed as before, now the next mail in the folder is shown automatically (if there is any). 29When clicking on the "delete" icon the mail is deleted after confirmation as usual. But the edit dialog is not closed as before, now the next mail in the folder is shown automatically (if there is any).
22 30
23Fixed a crash when deleting mail-accounts in OM/Pi. 31Fixed a crash when deleting mail-accounts in OM/Pi.
24 32
25 33
26********** VERSION 1.9.14 ************ 34********** VERSION 1.9.14 ************
27 35
28Fixed some problems with the dialog sizes when switching 36Fixed some problems with the dialog sizes when switching
29portrait/landscape mode on 640x480 PDA display. 37portrait/landscape mode on 640x480 PDA display.
30 38
31Fixed some other small bugs in KA/Pi KO/Pi and OM/Pi and PwM/Pi. 39Fixed some other small bugs in KA/Pi KO/Pi and OM/Pi and PwM/Pi.
32 40
33Fixed an ugly bug in KOpieMail: 41Fixed an ugly bug in KOpieMail:
34KOpieMail was not able to write files (mails) to MSDOS file system, 42KOpieMail was not able to write files (mails) to MSDOS file system,
35like on an usual preformatted SD card. That should work now. 43like on an usual preformatted SD card. That should work now.
36To save your mail data on the Sd card do the following: 44To save your mail data on the Sd card do the following:
37Create a dir on the SD card: 45Create a dir on the SD card:
38mkdir /mnt/card/localmail 46mkdir /mnt/card/localmail
39Go to your home dir: 47Go to your home dir:
40cd 48cd
41Go to kopiemail data storage dir: 49Go to kopiemail data storage dir:
42cd kdepim/apps/kopiemail 50cd kdepim/apps/kopiemail
43Create a symlink to the SD card: 51Create a symlink to the SD card:
44ls -s /mnt/card/localmail 52ls -s /mnt/card/localmail
45Now KOpieMail will store all mails on the SD card. 53Now KOpieMail will store all mails on the SD card.
46 54
47KO/Pi Monthview: 55KO/Pi Monthview:
48Now "Go to Today" selects the current month from day 1-end, 56Now "Go to Today" selects the current month from day 1-end,
49not the current date + some days. 57not the current date + some days.
50I.e. "Go to Today" shows now always 58I.e. "Go to Today" shows now always
51the current month with first day of month in the first row. 59the current month with first day of month in the first row.
52 60
53Added missing German translation. 61Added missing German translation.
54 62
55Fixed icons of executeable on Wintendo. 63Fixed icons of executeable on Wintendo.
56 64
57Added a "Show next Mail" button to the OM/Pi 65Added a "Show next Mail" button to the OM/Pi
58mail viewer such that the mail below the current mail 66mail viewer such that the mail below the current mail
59in the mail list view of the current folder 67in the mail list view of the current folder
60can be read with a single click. 68can be read with a single click.
61 69
62 70
63********** VERSION 1.9.13 ************ 71********** VERSION 1.9.13 ************
64 72
65Fixed nasty PwM/Pi file reading bug, when 73Fixed nasty PwM/Pi file reading bug, when
66the used hash algo of file is different then the global 74the used hash algo of file is different then the global
67hash algo. 75hash algo.
68 76
69Added KA/Pi support for opie mailit mailapplication. 77Added KA/Pi support for opie mailit mailapplication.
70 78
71Fixed some bugs in OM/Pi. 79Fixed some bugs in OM/Pi.
72Now character conversion tables are available for the Zaurus 80Now character conversion tables are available for the Zaurus
73to make OM/Pi working properly. 81to make OM/Pi working properly.
74To get the character conversion in OM/Pi working, please download 82To get the character conversion in OM/Pi working, please download
75at the sourceforge project site the package 83at the sourceforge project site the package
76sr-character-conversion_SharpROM_arm.ipk.zip 84sr-character-conversion_SharpROM_arm.ipk.zip
77(or oz-character-conversion_OZ-gcc3xx_arm.ipk.zip for OZ roms) 85(or oz-character-conversion_OZ-gcc3xx_arm.ipk.zip for OZ roms)
78from the section "general files for KDE/Pim" 86from the section "general files for KDE/Pim"
79Instructions how to install this package are in a ReadMe in this file. 87Instructions how to install this package are in a ReadMe in this file.
80 88
81 89
82Fixed the orientation change problem in KA/Pi when switching 90Fixed the orientation change problem in KA/Pi when switching
83portrait/landscape mode. 91portrait/landscape mode.
84 92
85French translation available for KA/Pi and OM/Pi. 93French translation available for KA/Pi and OM/Pi.
86 94
87Fixed some problems with categories in KO/Pi in DTM sync. 95Fixed some problems with categories in KO/Pi in DTM sync.
88 96
89Added selection dialog for export to phone in KA/Pi. 97Added selection dialog for export to phone in KA/Pi.
90 98
91If in KO/Pi is an attendee selected to add to a meeting and this 99If in KO/Pi is an attendee selected to add to a meeting and this
92attendee is already in the list of attendees, this person is not added 100attendee is already in the list of attendees, this person is not added
93again. 101again.
94 102
95Some menu cleanup in KA/Pi. 103Some menu cleanup in KA/Pi.
96 104
97********** VERSION 1.9.12 ************ 105********** VERSION 1.9.12 ************
98 106
99Fix for the bug in KO/Pi What's Next view of version 1.9.11. 107Fix for the bug in KO/Pi What's Next view of version 1.9.11.
100 108
101Bugfix: Licence file is now shown again. 109Bugfix: Licence file is now shown again.
102 110
103OM/Pi now supports Unicode (utf8 charset). 111OM/Pi now supports Unicode (utf8 charset).
104Fixed some bugs in OM/Pi. 112Fixed some bugs in OM/Pi.
105 113
106KA/Pi has more German translation. 114KA/Pi has more German translation.
107 115
108 116
109********** VERSION 1.9.11 ************ 117********** VERSION 1.9.11 ************
110 118
111Fixed several problems in PWM/Pi, like 119Fixed several problems in PWM/Pi, like
112asking the user, if unsaved changed are pending 120asking the user, if unsaved changed are pending
113when closing the app. 121when closing the app.
114And PwM/Pi handles now different texts for the 122And PwM/Pi handles now different texts for the
115fields Description, Username, Password, configurable per category. 123fields Description, Username, Password, configurable per category.
116 124
117Fixed a crash in KO/Pi , when importing/loading vcs files 125Fixed a crash in KO/Pi , when importing/loading vcs files
118which have an entry with an attendee with state: 126which have an entry with an attendee with state:
119NEEDS ACTION 127NEEDS ACTION
120 128
121Fixed some problems in the German translation of OM/Pi, 129Fixed some problems in the German translation of OM/Pi,
122which makes some dialogs not fitting on the screen 130which makes some dialogs not fitting on the screen
123of the Z 5500. 131of the Z 5500.
124 132
125Fixed Qtopia crash, when disabling/deinstalling 133Fixed Qtopia crash, when disabling/deinstalling
126KO/Pi alarm applet. 134KO/Pi alarm applet.
127 135
128Implemented direct KDE<->KA/Pi sync for KA/Pi running 136Implemented direct KDE<->KA/Pi sync for KA/Pi running
129on Linux desktop. 137on Linux desktop.
130 138
131Added feature "remove sync info" to sync menu. 139Added feature "remove sync info" to sync menu.
132 140
133Tweaked the KO/Pi What's next view a bit, added 141Tweaked the KO/Pi What's next view a bit, added
134setting to hide events that are done. 142setting to hide events that are done.
135 143
136Disabled "beam receive enabled" on startup to 144Disabled "beam receive enabled" on startup to
137avoid problems if Fastload is enabled. 145avoid problems if Fastload is enabled.
138Please set "beam receive enabled", 146Please set "beam receive enabled",
139if you want to receive data via IR. 147if you want to receive data via IR.
140 148
141Fixed bug in direct KDE<->KO/Pi sync for KO/Pi running 149Fixed bug in direct KDE<->KO/Pi sync for KO/Pi running
142on Linux desktop. 150on Linux desktop.
143 151
144Made in KA/Pi scrolling possible, if details view is selected. 152Made in KA/Pi scrolling possible, if details view is selected.
145(The keyboard focus is set automatically to the search line) 153(The keyboard focus is set automatically to the search line)
146 154
147Fixed a bug in DMT sync, that a new entry in DTM was added 155Fixed a bug in DMT sync, that a new entry in DTM was added
148on every sync to Kx/Pi. 156on every sync to Kx/Pi.
149 157
150Fixed missing writing of KA/Pi categories to DMT entries when syncing. 158Fixed missing writing of KA/Pi categories to DMT entries when syncing.
151 159
152Fixed a bug in DMT sync with todos created in KO/Pi containing 160Fixed a bug in DMT sync with todos created in KO/Pi containing
153non-latin1 characters. 161non-latin1 characters.
154 162
155Rearranged package contents of Sharp-ipks and made all 163Rearranged package contents of Sharp-ipks and made all
156packages installable on SD again. 164packages installable on SD again.
157 165
158Fixed the writing of addressbook data in DTM sync. 166Fixed the writing of addressbook data in DTM sync.
159Empty fields in KA/Pi were not removed. 167Empty fields in KA/Pi were not removed.
160 168
161Added better category handling in KA/Pi: 169Added better category handling in KA/Pi:
162Added item 170Added item
163Edit Categories and 171Edit Categories and
164Manage new categories 172Manage new categories
165to the settings menu. 173to the settings menu.
166Possible to configure a view to display categories. 174Possible to configure a view to display categories.
167 175
168Added detailed "KDE Sync Howto" and "Multi Sync Howto" to Help menu. 176Added detailed "KDE Sync Howto" and "Multi Sync Howto" to Help menu.
169 177
170Fixed displaying of "free" days and time in KO Monthview and Agendaview. 178Fixed displaying of "free" days and time in KO Monthview and Agendaview.
171 179
172... and many other bugfixes. 180... and many other bugfixes.
173 181
174********** VERSION 1.9.10 ************ 182********** VERSION 1.9.10 ************
175 183
176Many internal small bugfixes. 184Many internal small bugfixes.
177And fix of the "big" bug in KO/Pi, 185And fix of the "big" bug in KO/Pi,
178that after Syncing the appointments had an offset by several hours. 186that after Syncing the appointments had an offset by several hours.
179That was a problem with the internal timezone setting, 187That was a problem with the internal timezone setting,
180introduced by the changed timezone configuration settings. 188introduced by the changed timezone configuration settings.
181 189
182German translation for OM/Pi is now available. 190German translation for OM/Pi is now available.
183 191
184 192
185********** VERSION 1.9.9 ************ 193********** VERSION 1.9.9 ************
186 194
187KDE-Pim/Pi has a new Member! 195KDE-Pim/Pi has a new Member!
188It is called PWM/Pi (Passwordmanager/platform-independent) 196It is called PWM/Pi (Passwordmanager/platform-independent)
189and it is available for the Zaurus. 197and it is available for the Zaurus.
190It is planned, that it will be available later for Windows. 198It is planned, that it will be available later for Windows.
191(And for Linux, of course). 199(And for Linux, of course).
192It is a port of the Passwordmanager of KDE. 200It is a port of the Passwordmanager of KDE.
193It will need the MicroKDElibs to run. 201It will need the MicroKDElibs to run.
194 202
195Made loading of addressbooks in KA/Pi up to 7 times faster! 203Made loading of addressbooks in KA/Pi up to 7 times faster!
196The bigger your addressbook file, the more starting speed 204The bigger your addressbook file, the more starting speed
197will you gain. (relatively) 205will you gain. (relatively)
198 206
199The Qtopia addressbook connector is now platform independend 207The Qtopia addressbook connector is now platform independend
200as well and should work on any platform for importing/exporting 208as well and should work on any platform for importing/exporting
201Qtopia and Opie XML files. 209Qtopia and Opie XML files.
202 210
203Added a +30min feature to the timezone settings to make 211Added a +30min feature to the timezone settings to make
204KDE-Pim/Pi useable in Australia and other parts on the 212KDE-Pim/Pi useable in Australia and other parts on the
205world with strange timezones ;-) 213world with strange timezones ;-)
206 214
207German "Umlaute" should now be sorted correctly on the Z in KA/Pi. 215German "Umlaute" should now be sorted correctly on the Z in KA/Pi.
208 216
209It is now possible to disable the 217It is now possible to disable the
210"receive data via infrared" feature, such that syncing with 218"receive data via infrared" feature, such that syncing with
211Outlook is now possible again with Kx/Pi runing. 219Outlook is now possible again with Kx/Pi runing.
212Please disable it, before syncing Sharp DTM with Outlook. 220Please disable it, before syncing Sharp DTM with Outlook.
213For your convenience, the "receive data via infrared" feature 221For your convenience, the "receive data via infrared" feature
214is disabled automatically, if you sync Kx/Pi with DTM. 222is disabled automatically, if you sync Kx/Pi with DTM.
215You have to enable it again manually after syncing. 223You have to enable it again manually after syncing.
216Enabling this feature makes it impossible to start the 224Enabling this feature makes it impossible to start the
217Sharp DTM apps. If this feature is enabled, you will only get the 225Sharp DTM apps. If this feature is enabled, you will only get the
218alarm notification from KO/Pi and not from the Sharp calendar. 226alarm notification from KO/Pi and not from the Sharp calendar.
219This is very useful if you sync KO/Pi with Sharp DTM, 227This is very useful if you sync KO/Pi with Sharp DTM,
220because after syncing you usually would get notified about 228because after syncing you usually would get notified about
221an alarm by KO/Pi and the Sharp Calendar. 229an alarm by KO/Pi and the Sharp Calendar.
222 230
223Together with the Linux desktop version of KO/Pi 231Together with the Linux desktop version of KO/Pi
224it is now possible to sync KO/Pi on the Zaurus 232it is now possible to sync KO/Pi on the Zaurus
225with the complete KDE-desktop (3.3 or later) 233with the complete KDE-desktop (3.3 or later)
226calendar data easily. 234calendar data easily.
227That makes it possible to sync the Z with one 235That makes it possible to sync the Z with one
228click of a mouse with the KDE-Desktop. 236click of a mouse with the KDE-Desktop.
229This feature it available for all Zaurus platforms KO/Pi 237This feature it available for all Zaurus platforms KO/Pi
230is running on. 238is running on.
231The only thing needed is a running KO/Pi on Linux and 239The only thing needed is a running KO/Pi on Linux and
232a compiled version of the small 240a compiled version of the small
233KDE-Pim/Pi<->KDE-Desktop access command line program, 241KDE-Pim/Pi<->KDE-Desktop access command line program,
234which is in the KDE-Pim/Pi sources available. 242which is in the KDE-Pim/Pi sources available.
235 243
236The "KDE-desktop" syncing feature for KA/Pi will follow 244The "KDE-desktop" syncing feature for KA/Pi will follow
237in the next releases. 245in the next releases.
238 246
239Fixed the vcard export bug, which had the version 1.9.8. 247Fixed the vcard export bug, which had the version 1.9.8.
240 248
241Added missing GERMAN translation to KO/Pi. 249Added missing GERMAN translation to KO/Pi.
242Hi PsionX, could you add the missing french translation?Thx! 250Hi PsionX, could you add the missing french translation?Thx!
243 251
244Translation files for KA/Pi are available as well. 252Translation files for KA/Pi are available as well.
245GERMAN translation will be available in the next release. 253GERMAN translation will be available in the next release.
246PsionX ( yres, you again ;-) ), could you start translating 254PsionX ( yres, you again ;-) ), could you start translating
247KA/Pi? Thx! 255KA/Pi? Thx!
248 256
249You can download the version 1.9.9 at 257You can download the version 1.9.9 at
250 258
251http://sourceforge.net/project/showfiles.php?group_id=104103&package_id=112604 259http://sourceforge.net/project/showfiles.php?group_id=104103&package_id=112604
252 260
253Note: 261Note:
254To run the mail program OM/Pi you need libopenssl. 262To run the mail program OM/Pi you need libopenssl.
255A link to a download loaction is available at 263A link to a download loaction is available at
256ZSI at www.killefiz.de 264ZSI at www.killefiz.de
257 265
258 266
259********** VERSION 1.9.8 ************ 267********** VERSION 1.9.8 ************
260 268
261Fixed character decoding in OM/Pi. 269Fixed character decoding in OM/Pi.
262(e.g. German "Umlaute" were not displayed properly.) 270(e.g. German "Umlaute" were not displayed properly.)
263 271
264Made is possible to reparent todos in KO/Pi. 272Made is possible to reparent todos in KO/Pi.
265Use contextmenu or keys (look at Help-Keys + Colors) for that. 273Use contextmenu or keys (look at Help-Keys + Colors) for that.
266 274
267Added the missing Sync-Howto and WhatsNew to the packages. 275Added the missing Sync-Howto and WhatsNew to the packages.
268 276
269KO/Pi on Linux desktop can now sync with KDE desktop. 277KO/Pi on Linux desktop can now sync with KDE desktop.
270That means: When using KO/Pi on Linux desktop for syncing with 278That means: When using KO/Pi on Linux desktop for syncing with
271KDE desktop and the Zaurus, the Zaurus can be synced now 279KDE desktop and the Zaurus, the Zaurus can be synced now
272with all KDE-Calendar resources, not only with one local file. 280with all KDE-Calendar resources, not only with one local file.
273(That makes it possible to sync the Zaurus with the 281(That makes it possible to sync the Zaurus with the
274calendar data on a Kolab server) 282calendar data on a Kolab server)
275 283
276KA/Pi syncing with KDE desktop will be available in the next version. 284KA/Pi syncing with KDE desktop will be available in the next version.
277 285
278 286
279********** VERSION 1.9.7 ************ 287********** VERSION 1.9.7 ************
280 288
281KO/Pi - KA/Pi on Windows: 289KO/Pi - KA/Pi on Windows:
282Now a directory can be defined by the user, where the 290Now a directory can be defined by the user, where the
283application/config data should be saved. 291application/config data should be saved.
284 Define your desired path in the evironment variable 292 Define your desired path in the evironment variable
285 MICROKDEHOME 293 MICROKDEHOME
286 before starting KO/Pi or KA/Pi. 294 before starting KO/Pi or KA/Pi.
287 295
288An easy Kx/Pi to Kx/Pi syncing is now possible 296An easy Kx/Pi to Kx/Pi syncing is now possible
289(it is called Pi-Sync) via network. 297(it is called Pi-Sync) via network.
290Please look at the Sync Howto. 298Please look at the Sync Howto.
291 299
292Exporting of calendar data and contacts to mobile phones is now possible. 300Exporting of calendar data and contacts to mobile phones is now possible.
293The SyncHowto is updated with information howto 301The SyncHowto is updated with information howto
294access/sync mobile phones. 302access/sync mobile phones.
295Please look at the Sync Howto. 303Please look at the Sync Howto.
296 304
297Now KO/Pi and KA/Pi on the Zaurus can receive data via infrared directly. 305Now KO/Pi and KA/Pi on the Zaurus can receive data via infrared directly.
298Please disable Fastload for the original contact/calendar applications 306Please disable Fastload for the original contact/calendar applications
299and close them. 307and close them.
300KO/Pi and KA/Pi must be running in order to receive the data. 308KO/Pi and KA/Pi must be running in order to receive the data.
301(KO/Pi and KA/Pi are always running if Fastload for them is enabled!) 309(KO/Pi and KA/Pi are always running if Fastload for them is enabled!)
302 310
303In the KA/Pi details view are now the preferred tel. numbers displayed on top 311In the KA/Pi details view are now the preferred tel. numbers displayed on top
304of the other data ( emails/tel.numbers/addresses) 312of the other data ( emails/tel.numbers/addresses)
305 313
306Fixed some syncing problems in KA/Pi. 314Fixed some syncing problems in KA/Pi.
307 315
308Added font settings for the KA/Pi details view. 316Added font settings for the KA/Pi details view.
309Added fields "children's name" and "gender" to KA/Pi. 317Added fields "children's name" and "gender" to KA/Pi.
310 318
311Made searching in KA/Pi better: 319Made searching in KA/Pi better:
312Now the first item in a view is selected after a search automatically and 320Now the first item in a view is selected after a search automatically and
313the views can be scrolled up/down when the search input field has the keyboard focus. 321the views can be scrolled up/down when the search input field has the keyboard focus.
314 322
315And, of course, fixed a bunch of reported bugs in KO/Pi and KA/Pi. 323And, of course, fixed a bunch of reported bugs in KO/Pi and KA/Pi.
316 324
317 325
318********** VERSION 1.9.6 ************ 326********** VERSION 1.9.6 ************
319 327
320Changes in the external application communication on the Zaurus 328Changes in the external application communication on the Zaurus
321in order to use less RAM when the apps are running. 329in order to use less RAM when the apps are running.
322First syncing of addressbooks (KA/Pi) is possible. 330First syncing of addressbooks (KA/Pi) is possible.
323 331
324 332
325********** VERSION 1.9.5a ************ 333********** VERSION 1.9.5a ************
326 334
327Fixed a bug in KO/Pi in the SharpDTM sync of version 1.9.5. 335Fixed a bug in KO/Pi in the SharpDTM sync of version 1.9.5.
328Fixed some small bugs. 336Fixed some small bugs.
329KA/Pi shows now the birthday in summary view. 337KA/Pi shows now the birthday in summary view.
330Now OM/Pi and KA/Pi are using the date format defined in KO/Pi 338Now OM/Pi and KA/Pi are using the date format defined in KO/Pi
331for displaying dates. 339for displaying dates.
332 340
333 341
334********** VERSION 1.9.5 ************ 342********** VERSION 1.9.5 ************
335 343
336There is still no Addressbook syncing! 344There is still no Addressbook syncing!
337 345
338New in 1.9.5: 346New in 1.9.5:
339 347
340Many bugfixes. 348Many bugfixes.
341Better searching in KA/Pi. 349Better searching in KA/Pi.
342You can configure in KA/Pi if you want to search only after 350You can configure in KA/Pi if you want to search only after
343<return> key pressed. 351<return> key pressed.
344 352
345Better mail downloading in OM/Pi. 353Better mail downloading in OM/Pi.
346 354
347First experimental alpha version of sync of KO/Pi with mobile phones. 355First experimental alpha version of sync of KO/Pi with mobile phones.
348See gammu documentation for supported phones. 356See gammu documentation for supported phones.
349You 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. 357You 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.
350Quick hint how to use: 358Quick hint how to use:
351NOTE: MOBILE PHONE SYNC IS EXPERIMENTAL! 359NOTE: MOBILE PHONE SYNC IS EXPERIMENTAL!
352Install kammu_1.9.5_arm.ipk , libbluetooth and libsdp. 360Install kammu_1.9.5_arm.ipk , libbluetooth and libsdp.
353Create syncprofile - mobile device 361Create syncprofile - mobile device
354Remove entry for model. (Leave empty ). 362Remove entry for model. (Leave empty ).
355Enable infrared on Zaurus and your Phone. 363Enable infrared on Zaurus and your Phone.
356Sync. 364Sync.
357To get a more detailed log, start kopi from konsole. 365To get a more detailed log, start kopi from konsole.
358 366
359********** VERSION 1.9.4 ************ 367********** VERSION 1.9.4 ************
360 368
361This is the version 1.9.4 of KDE-Pim/Pi for the Zaurus. 369This is the version 1.9.4 of KDE-Pim/Pi for the Zaurus.
362 370
363WARNING: 371WARNING:
364PLEASE BACKUP ALL YOUR DATA! 372PLEASE BACKUP ALL YOUR DATA!
365We have changed a lot and maybe there are some unknown problems. 373We have changed a lot and maybe there are some unknown problems.
366 374
367SYNC HANDLING HAS CHANGED! 375SYNC HANDLING HAS CHANGED!
368Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. 376Such that, if you sync now with an already synded device, you will duplicated entries after the first sync.
369(This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). 377(This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks).
370 378
371You need the kmicrokdelibs_1.9.4_arm.ipk as a base for the other programs. 379You need the kmicrokdelibs_1.9.4_arm.ipk as a base for the other programs.
372If 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. 380If 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.
373 381
374As programs are available: 382As programs are available:
375KO/Pi (korganizer ipk) - a calendar program. 383KO/Pi (korganizer ipk) - a calendar program.
376KA/Pi (kaddressbook ipk ) - an addressbook 384KA/Pi (kaddressbook ipk ) - an addressbook
377OM/Pi (kopiemail ipk ) an email program with pop/smtp and IMAP support. 385OM/Pi (kopiemail ipk ) an email program with pop/smtp and IMAP support.
378 386
379An alarm notification program ( korganizer-alarm ipk ) for KO/Pi that notifies you about alarms, even if the Zaurus is in suspend mode. 387An alarm notification program ( korganizer-alarm ipk ) for KO/Pi that notifies you about alarms, even if the Zaurus is in suspend mode.
380(If you do not see an icon in the taskbar after installing korganizer-alarm, please restart Qtopia) 388(If you do not see an icon in the taskbar after installing korganizer-alarm, please restart Qtopia)
381 389
382All the applications are installed in a "Pim" TAB. 390All the applications are installed in a "Pim" TAB.
383If 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 391If 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
384 392
385All the application are integrated. 393All the application are integrated.
386Such 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. 394Such 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.
387 395
388HINT: 396HINT:
389If you install KPhone/Pi 0.9.7, it will be called, if you click in KA/Pi on a phone number. 397If you install KPhone/Pi 0.9.7, it will be called, if you click in KA/Pi on a phone number.
390 398
391What's new? 399What's new?
392 400
393SYNC HANDLING HAS CHANGED! 401SYNC HANDLING HAS CHANGED!
394Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. 402Such that, if you sync now with an already synded device, you will duplicated entries after the first sync.
395(This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). 403(This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks).
396 404
397New in OM/Pi: 405New in OM/Pi:
398When 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. 406When 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.
399 407
400New in KO/Pi: 408New in KO/Pi:
401French is now available for KO/Pi. 409French is now available for KO/Pi.
402Choose menu:Actions - Configure:TAB locale 410Choose menu:Actions - Configure:TAB locale
403Syncing has changed. 411Syncing has changed.
404Phone sync available soon. 412Phone sync available soon.
405Not much changes, I cannot remember them ... 413Not much changes, I cannot remember them ...
406 414
407New in KA/Pi: 415New in KA/Pi:
408Beaming possible. 416Beaming possible.
409Sharp DTM readonly access possible( create a new DTM resource ); 417Sharp DTM readonly access possible( create a new DTM resource );
410Better searching possible. 418Better searching possible.
411Search is performed only after pressing the return key. 419Search is performed only after pressing the return key.
412Use wildcard * to specify parts of a name. 420Use wildcard * to specify parts of a name.
413 421
414Better 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 * . 422Better 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 * .
415 423
416A big improvement is the new management of the contact access. 424A big improvement is the new management of the contact access.
417In version 1.9.3, every application was using their own addressbook access data. 425In version 1.9.3, every application was using their own addressbook access data.
418That means, the addressbook was loaded up to three times in the memory, when accessed by KA/Pi, KO/Pi and OM/Pi. 426That means, the addressbook was loaded up to three times in the memory, when accessed by KA/Pi, KO/Pi and OM/Pi.
419That was wasting of memory, if you had several hundreds of contacts. 427That was wasting of memory, if you had several hundreds of contacts.
420 428
421Now only KA/Pi accesses the addressbook. 429Now only KA/Pi accesses the addressbook.
422If 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. 430If 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.
423If you click on an attendee in a meeting, its contact data is displayed in KA/Pi directly. 431If you click on an attendee in a meeting, its contact data is displayed in KA/Pi directly.
424That means, if KO/Pi or OM/Pi want to access contact data, KA/Pi is started first. 432That means, if KO/Pi or OM/Pi want to access contact data, KA/Pi is started first.
425 433
426New in the KO/Pi alarm applet: 434New in the KO/Pi alarm applet:
427Configure your own timer popup menu! 435Configure your own timer popup menu!
428(Text and minutes for timer countdown) 436(Text and minutes for timer countdown)
429Just edit the file 437Just edit the file
430(yourhomedir)/.kopialarmtimerrc 438(yourhomedir)/.kopialarmtimerrc
431and start/stop a timer to get a new menu with the data of this file. 439and start/stop a timer to get a new menu with the data of this file.
432 440
433********** VERSION 1.9.3 ************ 441********** VERSION 1.9.3 ************
4341) 4421)
435Now KO/Pi on Windows imports directly the calendar data of 443Now KO/Pi on Windows imports directly the calendar data of
436an installed Outlook. Should work with OL version >= 2000. 444an installed Outlook. Should work with OL version >= 2000.
437 445
438********** VERSION 1.9.2 ************ 446********** VERSION 1.9.2 ************
4391) 4471)
440KDE-Pim/Pi has got a new member: 448KDE-Pim/Pi has got a new member:
441KmicroMail (KM/Pi) is a mail program, 449KmicroMail (KM/Pi) is a mail program,
442which can handle IMAP and POP mail access. 450which can handle IMAP and POP mail access.
443It is based on Opie-Mail v3. 451It is based on Opie-Mail v3.
444All dependencies to the Opie libraries ar removed, 452All dependencies to the Opie libraries ar removed,
445such that no additional Opie lib is needed. 453such that no additional Opie lib is needed.
446It is already integrated in KO/Pi and KA/Pi. 454It is already integrated in KO/Pi and KA/Pi.
447It it now available for the Zaurus,probably it 455It it now available for the Zaurus,probably it
448will be available for other platforms later. 456will be available for other platforms later.
449Hint: 457Hint:
450Create your own contact (name + email) 458Create your own contact (name + email)
451in KA/Pi, select this contact and choose menu: 459in KA/Pi, select this contact and choose menu:
452Settings - Set Who Am I. 460Settings - Set Who Am I.
453Now the settings of this contact are used as 461Now the settings of this contact are used as
454the sender data in KM/Pi. 462the sender data in KM/Pi.
4552) 4632)
456KDE-Pim/Pi is split up in five different 464KDE-Pim/Pi is split up in five different
457packages now precompiled for Sharp Zaurus: 465packages now precompiled for Sharp Zaurus:
458--kmicrokdelibs_1.9.2_arm.ipk 466--kmicrokdelibs_1.9.2_arm.ipk
459The libs are needed for any 467The libs are needed for any
460of the following programs: 468of the following programs:
461--kaddressbook_1.9.2_arm.ipk 469--kaddressbook_1.9.2_arm.ipk
462--kmicromail_1.9.2_arm.ipk 470--kmicromail_1.9.2_arm.ipk
463--korganizer_1.9.2_arm.ipk 471--korganizer_1.9.2_arm.ipk
464Independ from that, there is the alarm applet 472Independ from that, there is the alarm applet
465available for KO/Pi, which also offers 473available for KO/Pi, which also offers
466quick access for a new mail or 474quick access for a new mail or
467showing the addressbook.: 475showing the addressbook.:
468--korganizer-alarm_1.9.2_arm.ipk 476--korganizer-alarm_1.9.2_arm.ipk
469Independend means, that the alarm applet 477Independend means, that the alarm applet
470does not need any of the libs or programs above to run. 478does not need any of the libs or programs above to run.
471But it would be quite useless without these programs. 479But it would be quite useless without these programs.
472NOTE: 480NOTE:
473If you get a 481If you get a
474"This application depends on other programs" 482"This application depends on other programs"
475during installation of 483during installation of
476--kmicrokdelibs_1.9.2_arm.ipk 484--kmicrokdelibs_1.9.2_arm.ipk
477you probably do not have to care about that. 485you probably do not have to care about that.
478kmicrokdelibs_1.9.2 will come with some 486kmicrokdelibs_1.9.2 will come with some
479resource plugins, which needs additional libraries. 487resource plugins, which needs additional libraries.
480(E.g. libopie1, if you want to use the 488(E.g. libopie1, if you want to use the
481opie resource connector in KA/Pi). 489opie resource connector in KA/Pi).
482If you do not have this libraries installed, 490If you do not have this libraries installed,
483you simply cannot use the resource. 491you simply cannot use the resource.
484To make it clear: 492To make it clear:
485If the libraries are missing, the applications 493If the libraries are missing, the applications
486using kmicrokdelibs will start, 494using kmicrokdelibs will start,
487because the resources are plugins. 495because the resources are plugins.
4883) 4963)
489KO/Pi and friends are now installable on SD-Card! 497KO/Pi and friends are now installable on SD-Card!
490It is recommended to install all libs and apps 498It is recommended to install all libs and apps
491on the SD card or all in the internal storage. 499on the SD card or all in the internal storage.
492There may be problems, if this is mixed. 500There may be problems, if this is mixed.
4934) 5014)
494Fixed two bugs in the alarm notification on Windows. 502Fixed two bugs in the alarm notification on Windows.
4955) 5035)
496Great improvement! 504Great improvement!
497KO/Pi uses now the latest version of libical. 505KO/Pi uses now the latest version of libical.
498Libical is the library which actually reads 506Libical is the library which actually reads
499the calendar files and extract the data from it. 507the calendar files and extract the data from it.
500With the old version, there were problems 508With the old version, there were problems
501(crashes or program hangs) when licical did read 509(crashes or program hangs) when licical did read
502files, which were not stored from KO/Pi. 510files, which were not stored from KO/Pi.
503I do not know, if the new libical works perfect, 511I do not know, if the new libical works perfect,
504but actually it works much better than 512but actually it works much better than
505the old version. 513the old version.
506There are no problems with compatibility with 514There are no problems with compatibility with
507old calendar files of KO/Pi, of course! 515old calendar files of KO/Pi, of course!
5086) 5166)
509New in KA/Pi: 517New in KA/Pi:
510Opie addressbook resource connector available! 518Opie addressbook resource connector available!
511You will need libopie1 and the opie addressbook, 519You will need libopie1 and the opie addressbook,
512of course. 520of course.
513With the Opie addressbook resource connector, 521With the Opie addressbook resource connector,
514you can access the Opie addressbook readonly in KA/Pi. 522you can access the Opie addressbook readonly in KA/Pi.
515If you want to edit or import the data into KA/Pi, 523If you want to edit or import the data into KA/Pi,
516do this: 524do this:
517a) Create an Opie resource. 525a) Create an Opie resource.
518 (Menu: Settings-Configure Resources). 526 (Menu: Settings-Configure Resources).
519After configuration and restarting KA/Pi you should see 527After configuration and restarting KA/Pi you should see
520the Opie contacts in KA/Pi. 528the Opie contacts in KA/Pi.
521b) Select some or all Opie contacts. 529b) Select some or all Opie contacts.
522(NOTE: +++++ 530(NOTE: +++++
523To know exactly, what contacts are Opie contacts, 531To know exactly, what contacts are Opie contacts,
524do this: Choose menu: 532do this: Choose menu:
525View-Modify View - TAB Fields. 533View-Modify View - TAB Fields.
526Select in the above list "Resource" and click 534Select in the above list "Resource" and click
527down arrow to add it to the "Selected fields". 535down arrow to add it to the "Selected fields".
528Click OK. 536Click OK.
529Now you have a new column "Resource" in your list, 537Now you have a new column "Resource" in your list,
530where you can see, what an Opie resource is. 538where you can see, what an Opie resource is.
531++++ NOTE end.) 539++++ NOTE end.)
532Ok, we do have now some Opie contacts seleted. 540Ok, we do have now some Opie contacts seleted.
533(Use SHIFT or CTRL key in order to multiple select). 541(Use SHIFT or CTRL key in order to multiple select).
534c) Choose menu: Edit-Copy. 542c) Choose menu: Edit-Copy.
535d) Choose menu: Edit-Paste. 543d) Choose menu: Edit-Paste.
536e) Select the resource, you want to add the contacts to. 544e) Select the resource, you want to add the contacts to.
537Congrats! Now you have read/write access to the copied 545Congrats! Now you have read/write access to the copied
538opie contacts as "real" KA/Pi contacts. 546opie contacts as "real" KA/Pi contacts.
539 547
540 548
541********** VERSION 1.9.1 ************ 549********** VERSION 1.9.1 ************
5421) 5501)
543 +++ IMPORTANT 1 +++ 551 +++ IMPORTANT 1 +++
544 552
545The storing place of the default calendar 553The storing place of the default calendar
546file has changed! 554file has changed!
547The default calendar file was 555The default calendar file was
548Applications/korganizer/mycalendar.ics 556Applications/korganizer/mycalendar.ics
549on Zaurus and 557on Zaurus and
550(yourHomeDir)/korganizer/mycalendar.ics 558(yourHomeDir)/korganizer/mycalendar.ics
551on Windows/Linux desktop. Now it is 559on Windows/Linux desktop. Now it is
552(yourHomeDir)/kdepim/korganizer/mycalendar.ics 560(yourHomeDir)/kdepim/korganizer/mycalendar.ics
553on Zaurus, Windows and Linux. 561on Zaurus, Windows and Linux.
554To load the old file, choose menu 562To load the old file, choose menu
555File-Load calendar backup. 563File-Load calendar backup.
556(It should be loaded automatically 564(It should be loaded automatically
557at startup with a warning message displayed). 565at startup with a warning message displayed).
558The place of the configuration file has changed too. 566The place of the configuration file has changed too.
559If you want to use your old KO/Pi config, 567If you want to use your old KO/Pi config,
560copy it to 568copy it to
561(yourHomeDir)/kdepim/config/korganizerrc 569(yourHomeDir)/kdepim/config/korganizerrc
562Please read VERSION 1.9.0 - topic 3) as well! 570Please read VERSION 1.9.0 - topic 3) as well!
563 571
564 +++ IMPORTANT 2 +++ 572 +++ IMPORTANT 2 +++
565 573
566Because of the new paths, you will need 574Because of the new paths, you will need
567a new version of the KO/Pi alarm applet 575a new version of the KO/Pi alarm applet
568for Zaurus. 576for Zaurus.
569Use version >= 1.9.1 577Use version >= 1.9.1
570 578
5712) 5792)
572Now the QWhat'sThis Icon works for items 580Now the QWhat'sThis Icon works for items
573in the month view as well. 581in the month view as well.
574(See VERSION 1.7.8 Topic 1) ). 582(See VERSION 1.7.8 Topic 1) ).
5753) 5833)
576You can import birtsdays/anniversaries 584You can import birtsdays/anniversaries
577from KA/Pi into KO/Pi. 585from KA/Pi into KO/Pi.
578Choose menu File-Import birthdays. 586Choose menu File-Import birthdays.
579If you import twice, already imported items 587If you import twice, already imported items
580will not be imported again, if they 588will not be imported again, if they
581have not been changed in KO/Pi. 589have not been changed in KO/Pi.
5824) 5904)
583When syncing with sharp DTM, now a progress 591When syncing with sharp DTM, now a progress
584is shown, when the data is written back. 592is shown, when the data is written back.
585If there is much data in KO/Pi and no data 593If there is much data in KO/Pi and no data
586in DTM, that can take a long time. 594in DTM, that can take a long time.
587(But only for the first time ). 595(But only for the first time ).
5885) 5965)
589In the search dialog, you can search 597In the search dialog, you can search
590now for the name/email of an attendee 598now for the name/email of an attendee
591of an event/todo. 599of an event/todo.
592To get more space for displaying 600To get more space for displaying
593search results, the buttons 601search results, the buttons
594for "search" and "close" on the 602for "search" and "close" on the
595bottom are removed in the PDA version. 603bottom are removed in the PDA version.
596You have to click OK in the top right 604You have to click OK in the top right
597corner to do a search. 605corner to do a search.
5986) 6066)
599Now it is possible to disable the displaying 607Now it is possible to disable the displaying
600of todo items in the Allday part of the Agenda. 608of todo items in the Allday part of the Agenda.
601Choose Menu Action-Configure, 609Choose Menu Action-Configure,
602TAB Todo View, checkbox 610TAB Todo View, checkbox
603"Allday Agenda view shows todos" 611"Allday Agenda view shows todos"
6047) 6127)
605If FastLoad is enabled, now the settings and the 613If FastLoad is enabled, now the settings and the
606calendar data are saved, when KO/Pi is closed. 614calendar data are saved, when KO/Pi is closed.
607(If no Fastload is enabled, KO/Pi saves 615(If no Fastload is enabled, KO/Pi saves
608the data as well, of course) 616the data as well, of course)
6098) 6178)
610The Agenda View has a minimize-splitter now, 618The Agenda View has a minimize-splitter now,
611such that the height of the allday part can be 619such that the height of the allday part can be
612changed quickly. 620changed quickly.
613 621
614********** VERSION 1.9.0 ************ 622********** VERSION 1.9.0 ************
6151) 6231)
616KO/Pi is now merged with the new microKDE from KA/Pi. 624KO/Pi is now merged with the new microKDE from KA/Pi.
617KO/Pi accesses now KA/Pi as the addressbook. 625KO/Pi accesses now KA/Pi as the addressbook.
618The other ddressbook-plugins are not working any longer. 626The other ddressbook-plugins are not working any longer.
619(It is planned, that later KA/Pi itself uses these plugins) 627(It is planned, that later KA/Pi itself uses these plugins)
620New versions of KO/Pi are only available 628New versions of KO/Pi are only available
621together with KA/Pi as the KDE-Pim/Pi package. 629together with KA/Pi as the KDE-Pim/Pi package.
6222) 6302)
623If you click on an attendee of a meeting in the 631If you click on an attendee of a meeting in the
624event viewer, a detailed summary of the 632event viewer, a detailed summary of the
625attendee is shown. 633attendee is shown.
6263) 6343)
627The place of the configuration file has changed. 635The place of the configuration file has changed.
628If you want to use your old KO/Pi config, copy 636If you want to use your old KO/Pi config, copy
629Applications/korganizer/config_korganizerrc 637Applications/korganizer/config_korganizerrc
630to 638to
631Applications/korganizer/config/korganizerrc 639Applications/korganizer/config/korganizerrc
632 640
633********** VERSION 1.7.8 ************ 641********** VERSION 1.7.8 ************
6341) 6421)
635Now the QWhat'sThis ist working. 643Now the QWhat'sThis ist working.
636Enable the QWhat'sThis icon in the toolbar. 644Enable the QWhat'sThis icon in the toolbar.
637(You have to restart to reload the changed toolbar config). 645(You have to restart to reload the changed toolbar config).
638Now click on the QWhat'sThis Icon 646Now click on the QWhat'sThis Icon
639in the top right corner of KO/Pi. 647in the top right corner of KO/Pi.
640Then click on an item in the Agenda View: 648Then click on an item in the Agenda View:
641You will get a detailed display of the items content. 649You will get a detailed display of the items content.
6422) 6502)
643Some other very minor changes. 651Some other very minor changes.
644But I have forgotten the details ... 652But I have forgotten the details ...
645For that reason I start this log here: 653For that reason I start this log here:
646To document my changes, when I am doing it. 654To document my changes, when I am doing it.
647 655
648********** VERSION 1.7.7 ************ 656********** VERSION 1.7.7 ************
649Stable Version of KO/Pi 657Stable Version of KO/Pi
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index a46cd87..7ddbe23 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1,3682 +1,3686 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 3
4 Requires the Qt and KDE widget libraries, available at no cost at 4 Requires the Qt and KDE widget libraries, available at no cost at
5 http://www.troll.no and http://www.kde.org respectively 5 http://www.troll.no and http://www.kde.org respectively
6 6
7 Copyright (c) 1997, 1998, 1999 7 Copyright (c) 1997, 1998, 1999
8 Preston Brown (preston.brown@yale.edu) 8 Preston Brown (preston.brown@yale.edu)
9 Fester Zigterman (F.J.F.ZigtermanRustenburg@student.utwente.nl) 9 Fester Zigterman (F.J.F.ZigtermanRustenburg@student.utwente.nl)
10 Ian Dawes (iadawes@globalserve.net) 10 Ian Dawes (iadawes@globalserve.net)
11 Laszlo Boloni (boloni@cs.purdue.edu) 11 Laszlo Boloni (boloni@cs.purdue.edu)
12 12
13 Copyright (c) 2000, 2001, 2002 13 Copyright (c) 2000, 2001, 2002
14 Cornelius Schumacher <schumacher@kde.org> 14 Cornelius Schumacher <schumacher@kde.org>
15 15
16 This program is free software; you can redistribute it and/or modify 16 This program is free software; you can redistribute it and/or modify
17 it under the terms of the GNU General Public License as published by 17 it under the terms of the GNU General Public License as published by
18 the Free Software Foundation; either version 2 of the License, or 18 the Free Software Foundation; either version 2 of the License, or
19 (at your option) any later version. 19 (at your option) any later version.
20 20
21 This program is distributed in the hope that it will be useful, 21 This program is distributed in the hope that it will be useful,
22 but WITHOUT ANY WARRANTY; without even the implied warranty of 22 but WITHOUT ANY WARRANTY; without even the implied warranty of
23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
24 GNU General Public License for more details. 24 GNU General Public License for more details.
25 25
26 You should have received a copy of the GNU General Public License 26 You should have received a copy of the GNU General Public License
27 along with this program; if not, write to the Free Software 27 along with this program; if not, write to the Free Software
28 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 28 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29*/ 29*/
30 30
31#include <stdlib.h> 31#include <stdlib.h>
32 32
33#include <qapplication.h> 33#include <qapplication.h>
34#include <qradiobutton.h> 34#include <qradiobutton.h>
35#include <qbuttongroup.h> 35#include <qbuttongroup.h>
36#include <qlayout.h> 36#include <qlayout.h>
37#include <qclipboard.h> 37#include <qclipboard.h>
38#include <qcursor.h> 38#include <qcursor.h>
39#include <qmessagebox.h> 39#include <qmessagebox.h>
40#include <qprogressbar.h> 40#include <qprogressbar.h>
41#include <qmultilineedit.h> 41#include <qmultilineedit.h>
42#include <qtimer.h> 42#include <qtimer.h>
43#include <qwidgetstack.h> 43#include <qwidgetstack.h>
44#include <qptrlist.h> 44#include <qptrlist.h>
45#include <qregexp.h> 45#include <qregexp.h>
46#include <qgroupbox.h> 46#include <qgroupbox.h>
47#include <qfile.h> 47#include <qfile.h>
48#include <qdir.h> 48#include <qdir.h>
49#ifndef KORG_NOSPLITTER 49#ifndef KORG_NOSPLITTER
50#include <qsplitter.h> 50#include <qsplitter.h>
51#endif 51#endif
52 52
53#include <kglobal.h> 53#include <kglobal.h>
54#include <kdebug.h> 54#include <kdebug.h>
55#include <kstandarddirs.h> 55#include <kstandarddirs.h>
56#include <kfiledialog.h> 56#include <kfiledialog.h>
57#include <kmessagebox.h> 57#include <kmessagebox.h>
58#include <knotifyclient.h> 58#include <knotifyclient.h>
59#include <kconfig.h> 59#include <kconfig.h>
60 60
61#include <libkdepim/ksyncprefsdialog.h> 61#include <libkdepim/ksyncprefsdialog.h>
62#include <krun.h> 62#include <krun.h>
63#include <kdirwatch.h> 63#include <kdirwatch.h>
64#include <libkdepim/kdatepicker.h> 64#include <libkdepim/kdatepicker.h>
65#include <libkdepim/ksyncprofile.h> 65#include <libkdepim/ksyncprofile.h>
66#include <libkdepim/kpimglobalprefs.h> 66#include <libkdepim/kpimglobalprefs.h>
67 67
68#include <libkcal/vcaldrag.h> 68#include <libkcal/vcaldrag.h>
69#include <libkcal/icaldrag.h> 69#include <libkcal/icaldrag.h>
70#include <libkcal/icalformat.h> 70#include <libkcal/icalformat.h>
71#include <libkcal/vcalformat.h> 71#include <libkcal/vcalformat.h>
72#include <libkcal/scheduler.h> 72#include <libkcal/scheduler.h>
73#include <libkcal/calendarlocal.h> 73#include <libkcal/calendarlocal.h>
74#include <libkcal/journal.h> 74#include <libkcal/journal.h>
75#include <libkcal/calfilter.h> 75#include <libkcal/calfilter.h>
76#include <libkcal/attendee.h> 76#include <libkcal/attendee.h>
77#include <libkcal/dndfactory.h> 77#include <libkcal/dndfactory.h>
78#include <libkcal/freebusy.h> 78#include <libkcal/freebusy.h>
79#include <libkcal/filestorage.h> 79#include <libkcal/filestorage.h>
80#include <libkcal/calendarresources.h> 80#include <libkcal/calendarresources.h>
81#include <libkcal/qtopiaformat.h> 81#include <libkcal/qtopiaformat.h>
82#include "../kalarmd/alarmdialog.h" 82#include "../kalarmd/alarmdialog.h"
83 83
84#ifndef DESKTOP_VERSION 84#ifndef DESKTOP_VERSION
85#include <libkcal/sharpformat.h> 85#include <libkcal/sharpformat.h>
86#include <externalapphandler.h> 86#include <externalapphandler.h>
87#endif 87#endif
88#include <libkcal/phoneformat.h> 88#include <libkcal/phoneformat.h>
89#ifndef KORG_NOMAIL 89#ifndef KORG_NOMAIL
90#include "komailclient.h" 90#include "komailclient.h"
91#endif 91#endif
92#ifndef KORG_NOPRINTER 92#ifndef KORG_NOPRINTER
93#include "calprinter.h" 93#include "calprinter.h"
94#endif 94#endif
95#ifndef KORG_NOPLUGINS 95#ifndef KORG_NOPLUGINS
96#include "kocore.h" 96#include "kocore.h"
97#endif 97#endif
98#include "koeventeditor.h" 98#include "koeventeditor.h"
99#include "kotodoeditor.h" 99#include "kotodoeditor.h"
100#include "koprefs.h" 100#include "koprefs.h"
101#include "koeventviewerdialog.h" 101#include "koeventviewerdialog.h"
102#include "publishdialog.h" 102#include "publishdialog.h"
103#include "kofilterview.h" 103#include "kofilterview.h"
104#include "koglobals.h" 104#include "koglobals.h"
105#include "koviewmanager.h" 105#include "koviewmanager.h"
106#include "koagendaview.h" 106#include "koagendaview.h"
107#include "kodialogmanager.h" 107#include "kodialogmanager.h"
108#include "outgoingdialog.h" 108#include "outgoingdialog.h"
109#include "incomingdialog.h" 109#include "incomingdialog.h"
110#include "statusdialog.h" 110#include "statusdialog.h"
111#include "kdatenavigator.h" 111#include "kdatenavigator.h"
112#include "kotodoview.h" 112#include "kotodoview.h"
113#include "datenavigator.h" 113#include "datenavigator.h"
114#include "resourceview.h" 114#include "resourceview.h"
115#include "navigatorbar.h" 115#include "navigatorbar.h"
116#include "searchdialog.h" 116#include "searchdialog.h"
117#include "mainwindow.h" 117#include "mainwindow.h"
118 118
119#include "calendarview.h" 119#include "calendarview.h"
120#ifndef DESKTOP_VERSION 120#ifndef DESKTOP_VERSION
121#include <qtopia/alarmserver.h> 121#include <qtopia/alarmserver.h>
122#endif 122#endif
123#ifndef _WIN32_ 123#ifndef _WIN32_
124#include <stdlib.h> 124#include <stdlib.h>
125#include <stdio.h> 125#include <stdio.h>
126#include <unistd.h> 126#include <unistd.h>
127#else 127#else
128#include <qprocess.h> 128#include <qprocess.h>
129#endif 129#endif
130 130
131#ifdef DESKTOP_VERSION 131#ifdef DESKTOP_VERSION
132#include <kabc/stdaddressbook.h> 132#include <kabc/stdaddressbook.h>
133#endif 133#endif
134using namespace KOrg; 134using namespace KOrg;
135using namespace KCal; 135using namespace KCal;
136extern int globalFlagBlockAgenda; 136extern int globalFlagBlockAgenda;
137extern int globalFlagBlockStartup; 137extern int globalFlagBlockStartup;
138 138
139 139
140 140
141class KOBeamPrefs : public QDialog 141class KOBeamPrefs : public QDialog
142{ 142{
143 public: 143 public:
144 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : 144 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) :
145 QDialog( parent, name, true ) 145 QDialog( parent, name, true )
146 { 146 {
147 setCaption( i18n("Beam Options") ); 147 setCaption( i18n("Beam Options") );
148 QVBoxLayout* lay = new QVBoxLayout( this ); 148 QVBoxLayout* lay = new QVBoxLayout( this );
149 lay->setSpacing( 3 ); 149 lay->setSpacing( 3 );
150 lay->setMargin( 3 ); 150 lay->setMargin( 3 );
151 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); 151 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this );
152 lay->addWidget( format ); 152 lay->addWidget( format );
153 format->setExclusive ( true ) ; 153 format->setExclusive ( true ) ;
154 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); 154 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this );
155 lay->addWidget( time ); time->setExclusive ( true ) ; 155 lay->addWidget( time ); time->setExclusive ( true ) ;
156 vcal = new QRadioButton(" vCalendar ", format ); 156 vcal = new QRadioButton(" vCalendar ", format );
157 ical = new QRadioButton(" iCalendar ", format ); 157 ical = new QRadioButton(" iCalendar ", format );
158 vcal->setChecked( true ); 158 vcal->setChecked( true );
159 tz = new QRadioButton(i18n(" With timezone "), time ); 159 tz = new QRadioButton(i18n(" With timezone "), time );
160 local = new QRadioButton(i18n(" Local time "), time ); 160 local = new QRadioButton(i18n(" Local time "), time );
161 tz->setChecked( true ); 161 tz->setChecked( true );
162 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); 162 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this );
163 lay->addWidget( ok ); 163 lay->addWidget( ok );
164 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 164 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
165 lay->addWidget( cancel ); 165 lay->addWidget( cancel );
166 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 166 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
167 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 167 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
168 resize( 200, 200 ); 168 resize( 200, 200 );
169 } 169 }
170 170
171 bool beamVcal() { return vcal->isChecked(); } 171 bool beamVcal() { return vcal->isChecked(); }
172 bool beamLocal() { return local->isChecked(); } 172 bool beamLocal() { return local->isChecked(); }
173private: 173private:
174 QRadioButton* vcal, *ical, *local, *tz; 174 QRadioButton* vcal, *ical, *local, *tz;
175}; 175};
176class KOCatPrefs : public QDialog 176class KOCatPrefs : public QDialog
177{ 177{
178 public: 178 public:
179 KOCatPrefs( QWidget *parent=0, const char *name=0 ) : 179 KOCatPrefs( QWidget *parent=0, const char *name=0 ) :
180 QDialog( parent, name, true ) 180 QDialog( parent, name, true )
181 { 181 {
182 setCaption( i18n("Manage new Categories") ); 182 setCaption( i18n("Manage new Categories") );
183 QVBoxLayout* lay = new QVBoxLayout( this ); 183 QVBoxLayout* lay = new QVBoxLayout( this );
184 lay->setSpacing( 3 ); 184 lay->setSpacing( 3 );
185 lay->setMargin( 3 ); 185 lay->setMargin( 3 );
186 QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); 186 QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this );
187 lay->addWidget( lab ); 187 lay->addWidget( lab );
188 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); 188 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this );
189 lay->addWidget( format ); 189 lay->addWidget( format );
190 format->setExclusive ( true ) ; 190 format->setExclusive ( true ) ;
191 addCatBut = new QRadioButton(i18n("Add to category list"), format ); 191 addCatBut = new QRadioButton(i18n("Add to category list"), format );
192 new QRadioButton(i18n("Remove from Events/Todos"), format ); 192 new QRadioButton(i18n("Remove from Events/Todos"), format );
193 addCatBut->setChecked( true ); 193 addCatBut->setChecked( true );
194 QPushButton * ok = new QPushButton( i18n("OK"), this ); 194 QPushButton * ok = new QPushButton( i18n("OK"), this );
195 lay->addWidget( ok ); 195 lay->addWidget( ok );
196 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 196 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
197 lay->addWidget( cancel ); 197 lay->addWidget( cancel );
198 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 198 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
199 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 199 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
200 resize( 200, 200 ); 200 resize( 200, 200 );
201 } 201 }
202 202
203 bool addCat() { return addCatBut->isChecked(); } 203 bool addCat() { return addCatBut->isChecked(); }
204private: 204private:
205 QRadioButton* addCatBut; 205 QRadioButton* addCatBut;
206}; 206};
207 207
208 208
209 209
210CalendarView::CalendarView( CalendarResources *calendar, 210CalendarView::CalendarView( CalendarResources *calendar,
211 QWidget *parent, const char *name ) 211 QWidget *parent, const char *name )
212 : CalendarViewBase( parent, name ), 212 : CalendarViewBase( parent, name ),
213 mCalendar( calendar ), 213 mCalendar( calendar ),
214 mResourceManager( calendar->resourceManager() ) 214 mResourceManager( calendar->resourceManager() )
215{ 215{
216 216
217 mEventEditor = 0; 217 mEventEditor = 0;
218 mTodoEditor = 0; 218 mTodoEditor = 0;
219 219
220 init(); 220 init();
221} 221}
222 222
223CalendarView::CalendarView( Calendar *calendar, 223CalendarView::CalendarView( Calendar *calendar,
224 QWidget *parent, const char *name ) 224 QWidget *parent, const char *name )
225 : CalendarViewBase( parent, name ), 225 : CalendarViewBase( parent, name ),
226 mCalendar( calendar ), 226 mCalendar( calendar ),
227 mResourceManager( 0 ) 227 mResourceManager( 0 )
228{ 228{
229 229
230 mEventEditor = 0; 230 mEventEditor = 0;
231 mTodoEditor = 0; 231 mTodoEditor = 0;
232 init();} 232 init();}
233 233
234void CalendarView::init() 234void CalendarView::init()
235{ 235{
236 beamDialog = new KOBeamPrefs(); 236 beamDialog = new KOBeamPrefs();
237 mDatePickerMode = 0; 237 mDatePickerMode = 0;
238 mCurrentSyncDevice = ""; 238 mCurrentSyncDevice = "";
239 writeLocale(); 239 writeLocale();
240 mViewManager = new KOViewManager( this ); 240 mViewManager = new KOViewManager( this );
241 mDialogManager = new KODialogManager( this ); 241 mDialogManager = new KODialogManager( this );
242 mEventViewerDialog = 0; 242 mEventViewerDialog = 0;
243 mModified = false; 243 mModified = false;
244 mReadOnly = false; 244 mReadOnly = false;
245 mSelectedIncidence = 0; 245 mSelectedIncidence = 0;
246 mCalPrinter = 0; 246 mCalPrinter = 0;
247 mFilters.setAutoDelete(true); 247 mFilters.setAutoDelete(true);
248 248
249 mCalendar->registerObserver( this ); 249 mCalendar->registerObserver( this );
250 // TODO: Make sure that view is updated, when calendar is changed. 250 // TODO: Make sure that view is updated, when calendar is changed.
251 251
252 mStorage = new FileStorage( mCalendar ); 252 mStorage = new FileStorage( mCalendar );
253 mNavigator = new DateNavigator( this, "datevav", mViewManager ); 253 mNavigator = new DateNavigator( this, "datevav", mViewManager );
254 254
255 QBoxLayout *topLayout = (QBoxLayout*)layout(); 255 QBoxLayout *topLayout = (QBoxLayout*)layout();
256#ifndef KORG_NOSPLITTER 256#ifndef KORG_NOSPLITTER
257 // create the main layout frames. 257 // create the main layout frames.
258 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); 258 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner");
259 topLayout->addWidget(mPanner); 259 topLayout->addWidget(mPanner);
260 260
261 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, 261 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner,
262 "CalendarView::LeftFrame"); 262 "CalendarView::LeftFrame");
263 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); 263 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize);
264 264
265 mDateNavigator = new KDateNavigator(mLeftSplitter, mCalendar, TRUE, 265 mDateNavigator = new KDateNavigator(mLeftSplitter, mCalendar, TRUE,
266 "CalendarView::DateNavigator", QDate::currentDate() ); 266 "CalendarView::DateNavigator", QDate::currentDate() );
267 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); 267 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize);
268 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); 268 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2");
269 mTodoList->setNavigator( mNavigator );
269 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); 270 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView");
270 271
271#ifdef KORG_NORESOURCEVIEW 272#ifdef KORG_NORESOURCEVIEW
272 mResourceView = 0; 273 mResourceView = 0;
273#else 274#else
274 if ( mResourceManager ) { 275 if ( mResourceManager ) {
275 mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); 276 mResourceView = new ResourceView( mResourceManager, mLeftSplitter );
276 mResourceView->updateView(); 277 mResourceView->updateView();
277 connect( mResourceView, SIGNAL( resourcesChanged() ), 278 connect( mResourceView, SIGNAL( resourcesChanged() ),
278 SLOT( updateView() ) ); 279 SLOT( updateView() ) );
279 } else { 280 } else {
280 mResourceView = 0; 281 mResourceView = 0;
281 } 282 }
282#endif 283#endif
283 QWidget *rightBox = new QWidget( mPanner ); 284 QWidget *rightBox = new QWidget( mPanner );
284 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 285 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
285 286
286 mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); 287 mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" );
287 rightLayout->addWidget( mNavigatorBar ); 288 rightLayout->addWidget( mNavigatorBar );
288 289
289 mRightFrame = new QWidgetStack( rightBox ); 290 mRightFrame = new QWidgetStack( rightBox );
290 rightLayout->addWidget( mRightFrame, 1 ); 291 rightLayout->addWidget( mRightFrame, 1 );
291 292
292 mLeftFrame = mLeftSplitter; 293 mLeftFrame = mLeftSplitter;
293#else 294#else
294 QWidget *mainBox = new QWidget( this ); 295 QWidget *mainBox = new QWidget( this );
295 QWidget *leftFrame = new QWidget( mainBox ); 296 QWidget *leftFrame = new QWidget( mainBox );
296 297
297 QBoxLayout * mainBoxLayout; 298 QBoxLayout * mainBoxLayout;
298 QBoxLayout * leftFrameLayout; 299 QBoxLayout * leftFrameLayout;
299 if ( KOPrefs::instance()->mVerticalScreen ) { 300 if ( KOPrefs::instance()->mVerticalScreen ) {
300 mainBoxLayout = new QVBoxLayout(mainBox); 301 mainBoxLayout = new QVBoxLayout(mainBox);
301 leftFrameLayout = new QHBoxLayout(leftFrame ); 302 leftFrameLayout = new QHBoxLayout(leftFrame );
302 } else { 303 } else {
303 mainBoxLayout = new QHBoxLayout(mainBox); 304 mainBoxLayout = new QHBoxLayout(mainBox);
304 leftFrameLayout = new QVBoxLayout(leftFrame ); 305 leftFrameLayout = new QVBoxLayout(leftFrame );
305 } 306 }
306 topLayout->addWidget( mainBox ); 307 topLayout->addWidget( mainBox );
307 mainBoxLayout->addWidget (leftFrame); 308 mainBoxLayout->addWidget (leftFrame);
308 mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE, 309 mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE,
309 "CalendarView::DateNavigator", QDate::currentDate()); 310 "CalendarView::DateNavigator", QDate::currentDate());
310 // mDateNavigator->blockSignals( true ); 311 // mDateNavigator->blockSignals( true );
311 leftFrameLayout->addWidget( mDateNavigator ); 312 leftFrameLayout->addWidget( mDateNavigator );
312 mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView"); 313 mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView");
313 mTodoList = new KOTodoView(mCalendar, leftFrame, "todolistsmall"); 314 mTodoList = new KOTodoView(mCalendar, leftFrame, "todolistsmall");
315 mTodoList->setNavigator( mNavigator );
314 316
315 if ( QApplication::desktop()->width() < 480 ) { 317 if ( QApplication::desktop()->width() < 480 ) {
316 leftFrameLayout->addWidget(mFilterView); 318 leftFrameLayout->addWidget(mFilterView);
317 leftFrameLayout->addWidget(mTodoList, 2 ); 319 leftFrameLayout->addWidget(mTodoList, 2 );
318 320
319 } else { 321 } else {
320 leftFrameLayout->addWidget(mTodoList,2 ); 322 leftFrameLayout->addWidget(mTodoList,2 );
321 leftFrameLayout->addWidget(mFilterView ); 323 leftFrameLayout->addWidget(mFilterView );
322 } 324 }
323 mFilterView->hide(); 325 mFilterView->hide();
324 QWidget *rightBox = new QWidget( mainBox ); 326 QWidget *rightBox = new QWidget( mainBox );
325 mainBoxLayout->addWidget ( rightBox, 10 ); 327 mainBoxLayout->addWidget ( rightBox, 10 );
326 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 328 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
327 mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); 329 mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" );
328 mRightFrame = new QWidgetStack( rightBox ); 330 mRightFrame = new QWidgetStack( rightBox );
329 rightLayout->addWidget( mNavigatorBar ); 331 rightLayout->addWidget( mNavigatorBar );
330 rightLayout->addWidget( mRightFrame, 10 ); 332 rightLayout->addWidget( mRightFrame, 10 );
331 333
332 mLeftFrame = leftFrame; 334 mLeftFrame = leftFrame;
333 if ( KOPrefs::instance()->mVerticalScreen ) { 335 if ( KOPrefs::instance()->mVerticalScreen ) {
334 mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); 336 mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() );
335 leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); 337 leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() );
336 } else { 338 } else {
337 mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); 339 mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() );
338 leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); 340 leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() );
339 } 341 }
340 342
341 //qDebug("Calendarview Size %d %d ", width(), height()); 343 //qDebug("Calendarview Size %d %d ", width(), height());
342#endif 344#endif
343 345
344 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 346 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
345 SLOT( showDates( const KCal::DateList & ) ) ); 347 SLOT( showDates( const KCal::DateList & ) ) );
346 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 348 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
347 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 349 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
348 350
349 connect( mNavigatorBar, SIGNAL( goPrevYear() ), 351 connect( mNavigatorBar, SIGNAL( goPrevYear() ),
350 mNavigator, SLOT( selectPreviousYear() ) ); 352 mNavigator, SLOT( selectPreviousYear() ) );
351 connect( mNavigatorBar, SIGNAL( goNextYear() ), 353 connect( mNavigatorBar, SIGNAL( goNextYear() ),
352 mNavigator, SLOT( selectNextYear() ) ); 354 mNavigator, SLOT( selectNextYear() ) );
353 connect( mNavigatorBar, SIGNAL( goPrevMonth() ), 355 connect( mNavigatorBar, SIGNAL( goPrevMonth() ),
354 mNavigator, SLOT( selectPreviousMonth() ) ); 356 mNavigator, SLOT( selectPreviousMonth() ) );
355 connect( mNavigatorBar, SIGNAL( goNextMonth() ), 357 connect( mNavigatorBar, SIGNAL( goNextMonth() ),
356 mNavigator, SLOT( selectNextMonth() ) ); 358 mNavigator, SLOT( selectNextMonth() ) );
357 359
358 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 360 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
359 mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) ); 361 mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) );
360 362
361 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), 363 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ),
362 mNavigator, SLOT( selectWeek( const QDate & ) ) ); 364 mNavigator, SLOT( selectWeek( const QDate & ) ) );
363 365
364 connect( mDateNavigator, SIGNAL( goPrevYear() ), 366 connect( mDateNavigator, SIGNAL( goPrevYear() ),
365 mNavigator, SLOT( selectPreviousYear() ) ); 367 mNavigator, SLOT( selectPreviousYear() ) );
366 connect( mDateNavigator, SIGNAL( goNextYear() ), 368 connect( mDateNavigator, SIGNAL( goNextYear() ),
367 mNavigator, SLOT( selectNextYear() ) ); 369 mNavigator, SLOT( selectNextYear() ) );
368 connect( mDateNavigator, SIGNAL( goPrevMonth() ), 370 connect( mDateNavigator, SIGNAL( goPrevMonth() ),
369 mNavigator, SLOT( selectPreviousMonth() ) ); 371 mNavigator, SLOT( selectPreviousMonth() ) );
370 connect( mDateNavigator, SIGNAL( goNextMonth() ), 372 connect( mDateNavigator, SIGNAL( goNextMonth() ),
371 mNavigator, SLOT( selectNextMonth() ) ); 373 mNavigator, SLOT( selectNextMonth() ) );
372 374
373 connect( mDateNavigator, SIGNAL( goPrevious() ), 375 connect( mDateNavigator, SIGNAL( goPrevious() ),
374 mNavigator, SLOT( selectPrevious() ) ); 376 mNavigator, SLOT( selectPrevious() ) );
375 connect( mDateNavigator, SIGNAL( goNext() ), 377 connect( mDateNavigator, SIGNAL( goNext() ),
376 mNavigator, SLOT( selectNext() ) ); 378 mNavigator, SLOT( selectNext() ) );
377 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), 379 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ),
378 mNavigator, SLOT( slotMonthSelect( int ) ) ); 380 mNavigator, SLOT( slotMonthSelect( int ) ) );
379 connect( mNavigatorBar, SIGNAL( monthSelected ( int ) ), 381 connect( mNavigatorBar, SIGNAL( monthSelected ( int ) ),
380 mNavigator, SLOT( slotMonthSelect( int ) ) ); 382 mNavigator, SLOT( slotMonthSelect( int ) ) );
381 383
382 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 384 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
383 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 385 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
384 386
385 connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ), 387 connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ),
386 SLOT( eventAdded( Event *) ) ); 388 SLOT( eventAdded( Event *) ) );
387 389
388 connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); 390 connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView()));
389 391
390 connect( this, SIGNAL( configChanged() ), 392 connect( this, SIGNAL( configChanged() ),
391 mDateNavigator, SLOT( updateConfig() ) ); 393 mDateNavigator, SLOT( updateConfig() ) );
392 394
393 connect( mTodoList, SIGNAL( newTodoSignal() ), 395 connect( mTodoList, SIGNAL( newTodoSignal() ),
394 SLOT( newTodo() ) ); 396 SLOT( newTodo() ) );
395 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), 397 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ),
396 SLOT( newSubTodo( Todo * ) ) ); 398 SLOT( newSubTodo( Todo * ) ) );
397 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), 399 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ),
398 SLOT( editTodo( Todo * ) ) ); 400 SLOT( editTodo( Todo * ) ) );
399 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), 401 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ),
400 SLOT( showTodo( Todo *) ) ); 402 SLOT( showTodo( Todo *) ) );
401 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), 403 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ),
402 SLOT( deleteTodo( Todo *) ) ); 404 SLOT( deleteTodo( Todo *) ) );
403 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); 405 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) );
404 connect( mTodoList, SIGNAL( purgeCompletedSignal() ), 406 connect( mTodoList, SIGNAL( purgeCompletedSignal() ),
405 SLOT( purgeCompleted() ) ); 407 SLOT( purgeCompleted() ) );
406 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), 408 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ),
407 SIGNAL( todoModified( Todo *, int ) ) ); 409 SIGNAL( todoModified( Todo *, int ) ) );
408 410
409 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), 411 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ),
410 this, SLOT ( cloneIncidence( Incidence * ) ) ); 412 this, SLOT ( cloneIncidence( Incidence * ) ) );
411 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), 413 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ),
412 this, SLOT (cancelIncidence( Incidence * ) ) ); 414 this, SLOT (cancelIncidence( Incidence * ) ) );
413 415
414 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), 416 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ),
415 this, SLOT ( moveIncidence( Incidence * ) ) ); 417 this, SLOT ( moveIncidence( Incidence * ) ) );
416 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), 418 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ),
417 this, SLOT ( beamIncidence( Incidence * ) ) ); 419 this, SLOT ( beamIncidence( Incidence * ) ) );
418 420
419 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), 421 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ),
420 this, SLOT ( todo_unsub( Todo * ) ) ); 422 this, SLOT ( todo_unsub( Todo * ) ) );
421 423
422 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), 424 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
423 this, SLOT ( todo_resub( Todo *,Todo * ) ) ); 425 this, SLOT ( todo_resub( Todo *,Todo * ) ) );
424 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, 426 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList,
425 SLOT( updateTodo( Todo *, int ) ) ); 427 SLOT( updateTodo( Todo *, int ) ) );
426 connect( this, SIGNAL( todoModified( Todo *, int )), this, 428 connect( this, SIGNAL( todoModified( Todo *, int )), this,
427 SLOT( changeTodoDisplay( Todo *, int ) ) ); 429 SLOT( changeTodoDisplay( Todo *, int ) ) );
428 430
429 431
430 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); 432 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) );
431 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); 433 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) );
432 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); 434 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) );
433 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); 435 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) );
434 436
435 437
436 438
437 439
438 440
439 connect(QApplication::clipboard(),SIGNAL(dataChanged()), 441 connect(QApplication::clipboard(),SIGNAL(dataChanged()),
440 SLOT(checkClipboard())); 442 SLOT(checkClipboard()));
441 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), 443 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ),
442 SLOT( processTodoListSelection( Incidence * ) ) ); 444 SLOT( processTodoListSelection( Incidence * ) ) );
443 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); 445 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool)));
444 446
445 // kdDebug() << "CalendarView::CalendarView() done" << endl; 447 // kdDebug() << "CalendarView::CalendarView() done" << endl;
446 448
447 mDateFrame = new QVBox(0,0,WType_Popup); 449 mDateFrame = new QVBox(0,0,WType_Popup);
448 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); 450 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
449 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); 451 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised );
450 mDateFrame->setLineWidth(3); 452 mDateFrame->setLineWidth(3);
451 mDateFrame->hide(); 453 mDateFrame->hide();
452 mDateFrame->setCaption( i18n( "Pick a date to display")); 454 mDateFrame->setCaption( i18n( "Pick a date to display"));
453 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); 455 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() );
454 456
455 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); 457 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate)));
456 458
457 mEventEditor = mDialogManager->getEventEditor(); 459 mEventEditor = mDialogManager->getEventEditor();
458 mTodoEditor = mDialogManager->getTodoEditor(); 460 mTodoEditor = mDialogManager->getTodoEditor();
459 461
460 mFlagEditDescription = false; 462 mFlagEditDescription = false;
461 463
462 mSuspendTimer = new QTimer( this ); 464 mSuspendTimer = new QTimer( this );
463 mAlarmTimer = new QTimer( this ); 465 mAlarmTimer = new QTimer( this );
464 mRecheckAlarmTimer = new QTimer( this ); 466 mRecheckAlarmTimer = new QTimer( this );
465 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); 467 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) );
466 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); 468 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) );
467 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); 469 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) );
468 mAlarmDialog = new AlarmDialog( this ); 470 mAlarmDialog = new AlarmDialog( this );
469 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); 471 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) );
470 mAlarmDialog->setServerNotification( false ); 472 mAlarmDialog->setServerNotification( false );
471 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); 473 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime );
472 474
473 475
474#ifndef DESKTOP_VERSION 476#ifndef DESKTOP_VERSION
475//US listen for arriving address resultsets 477//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&)), 478 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&))); 479 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
478#endif 480#endif
479 481
480} 482}
481 483
482 484
483CalendarView::~CalendarView() 485CalendarView::~CalendarView()
484{ 486{
485 // kdDebug() << "~CalendarView()" << endl; 487 // kdDebug() << "~CalendarView()" << endl;
486 //qDebug("CalendarView::~CalendarView() "); 488 //qDebug("CalendarView::~CalendarView() ");
487 delete mDialogManager; 489 delete mDialogManager;
488 delete mViewManager; 490 delete mViewManager;
489 delete mStorage; 491 delete mStorage;
490 delete mDateFrame ; 492 delete mDateFrame ;
491 delete beamDialog; 493 delete beamDialog;
492 //kdDebug() << "~CalendarView() done" << endl; 494 //kdDebug() << "~CalendarView() done" << endl;
493} 495}
494 496
495void CalendarView::showDay( QDate d ) 497void CalendarView::showDay( QDate d )
496{ 498{
497 dateNavigator()->selectDate( d ); 499 dateNavigator()->selectDate( d );
498 mViewManager->showWeekView(); 500 mViewManager->showWeekView();
499 dateNavigator()->selectDate( d ); 501 dateNavigator()->selectDate( d );
500} 502}
501void CalendarView::timerAlarm() 503void CalendarView::timerAlarm()
502{ 504{
503 //qDebug("CalendarView::timerAlarm() "); 505 //qDebug("CalendarView::timerAlarm() ");
504 computeAlarm(mAlarmNotification ); 506 computeAlarm(mAlarmNotification );
505} 507}
506 508
507void CalendarView::suspendAlarm() 509void CalendarView::suspendAlarm()
508{ 510{
509 //qDebug(" CalendarView::suspendAlarm() "); 511 //qDebug(" CalendarView::suspendAlarm() ");
510 computeAlarm(mSuspendAlarmNotification ); 512 computeAlarm(mSuspendAlarmNotification );
511 513
512} 514}
513 515
514void CalendarView::startAlarm( QString mess , QString filename) 516void CalendarView::startAlarm( QString mess , QString filename)
515{ 517{
516 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); 518 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount );
517 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); 519 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) );
518 520
519} 521}
520 522
521void CalendarView::checkNextTimerAlarm() 523void CalendarView::checkNextTimerAlarm()
522{ 524{
523 mCalendar->checkAlarmForIncidence( 0, true ); 525 mCalendar->checkAlarmForIncidence( 0, true );
524} 526}
525 527
526void CalendarView::computeAlarm( QString msg ) 528void CalendarView::computeAlarm( QString msg )
527{ 529{
528 530
529 QString mess = msg; 531 QString mess = msg;
530 QString mAlarmMessage = mess.mid( 9 ); 532 QString mAlarmMessage = mess.mid( 9 );
531 QString filename = MainWindow::resourcePath(); 533 QString filename = MainWindow::resourcePath();
532 filename += "koalarm.wav"; 534 filename += "koalarm.wav";
533 QString tempfilename; 535 QString tempfilename;
534 if ( mess.left( 13 ) == "suspend_alarm") { 536 if ( mess.left( 13 ) == "suspend_alarm") {
535 bool error = false; 537 bool error = false;
536 int len = mess.mid( 13 ).find("+++"); 538 int len = mess.mid( 13 ).find("+++");
537 if ( len < 2 ) 539 if ( len < 2 )
538 error = true; 540 error = true;
539 else { 541 else {
540 tempfilename = mess.mid( 13, len ); 542 tempfilename = mess.mid( 13, len );
541 if ( !QFile::exists( tempfilename ) ) 543 if ( !QFile::exists( tempfilename ) )
542 error = true; 544 error = true;
543 } 545 }
544 if ( ! error ) { 546 if ( ! error ) {
545 filename = tempfilename; 547 filename = tempfilename;
546 } 548 }
547 mAlarmMessage = mess.mid( 13+len+3 ); 549 mAlarmMessage = mess.mid( 13+len+3 );
548 //qDebug("suspend file %s ",tempfilename.latin1() ); 550 //qDebug("suspend file %s ",tempfilename.latin1() );
549 startAlarm( mAlarmMessage, filename); 551 startAlarm( mAlarmMessage, filename);
550 return; 552 return;
551 } 553 }
552 if ( mess.left( 11 ) == "timer_alarm") { 554 if ( mess.left( 11 ) == "timer_alarm") {
553 //mTimerTime = 0; 555 //mTimerTime = 0;
554 startAlarm( mess.mid( 11 ), filename ); 556 startAlarm( mess.mid( 11 ), filename );
555 return; 557 return;
556 } 558 }
557 if ( mess.left( 10 ) == "proc_alarm") { 559 if ( mess.left( 10 ) == "proc_alarm") {
558 bool error = false; 560 bool error = false;
559 int len = mess.mid( 10 ).find("+++"); 561 int len = mess.mid( 10 ).find("+++");
560 if ( len < 2 ) 562 if ( len < 2 )
561 error = true; 563 error = true;
562 else { 564 else {
563 tempfilename = mess.mid( 10, len ); 565 tempfilename = mess.mid( 10, len );
564 if ( !QFile::exists( tempfilename ) ) 566 if ( !QFile::exists( tempfilename ) )
565 error = true; 567 error = true;
566 } 568 }
567 if ( error ) { 569 if ( error ) {
568 mAlarmMessage = "Procedure Alarm\nError - File not found\n"; 570 mAlarmMessage = "Procedure Alarm\nError - File not found\n";
569 mAlarmMessage += mess.mid( 10+len+3+9 ); 571 mAlarmMessage += mess.mid( 10+len+3+9 );
570 } else { 572 } else {
571 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); 573 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent");
572 //qDebug("-----system command %s ",tempfilename.latin1() ); 574 //qDebug("-----system command %s ",tempfilename.latin1() );
573#ifndef _WIN32_ 575#ifndef _WIN32_
574 if ( vfork () == 0 ) { 576 if ( vfork () == 0 ) {
575 execl ( tempfilename.latin1(), 0 ); 577 execl ( tempfilename.latin1(), 0 );
576 return; 578 return;
577 } 579 }
578#else 580#else
579 QProcess* p = new QProcess(); 581 QProcess* p = new QProcess();
580 p->addArgument( tempfilename.latin1() ); 582 p->addArgument( tempfilename.latin1() );
581 p->start(); 583 p->start();
582 return; 584 return;
583#endif 585#endif
584 586
585 return; 587 return;
586 } 588 }
587 589
588 //qDebug("+++++++system command %s ",tempfilename.latin1() ); 590 //qDebug("+++++++system command %s ",tempfilename.latin1() );
589 } 591 }
590 if ( mess.left( 11 ) == "audio_alarm") { 592 if ( mess.left( 11 ) == "audio_alarm") {
591 bool error = false; 593 bool error = false;
592 int len = mess.mid( 11 ).find("+++"); 594 int len = mess.mid( 11 ).find("+++");
593 if ( len < 2 ) 595 if ( len < 2 )
594 error = true; 596 error = true;
595 else { 597 else {
596 tempfilename = mess.mid( 11, len ); 598 tempfilename = mess.mid( 11, len );
597 if ( !QFile::exists( tempfilename ) ) 599 if ( !QFile::exists( tempfilename ) )
598 error = true; 600 error = true;
599 } 601 }
600 if ( ! error ) { 602 if ( ! error ) {
601 filename = tempfilename; 603 filename = tempfilename;
602 } 604 }
603 mAlarmMessage = mess.mid( 11+len+3+9 ); 605 mAlarmMessage = mess.mid( 11+len+3+9 );
604 //qDebug("audio file command %s ",tempfilename.latin1() ); 606 //qDebug("audio file command %s ",tempfilename.latin1() );
605 } 607 }
606 if ( mess.left( 9 ) == "cal_alarm") { 608 if ( mess.left( 9 ) == "cal_alarm") {
607 mAlarmMessage = mess.mid( 9 ) ; 609 mAlarmMessage = mess.mid( 9 ) ;
608 } 610 }
609 611
610 startAlarm( mAlarmMessage, filename ); 612 startAlarm( mAlarmMessage, filename );
611 613
612 614
613} 615}
614 616
615void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti ) 617void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti )
616{ 618{
617 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 619 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
618 620
619 mSuspendAlarmNotification = noti; 621 mSuspendAlarmNotification = noti;
620 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; 622 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000;
621 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); 623 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000);
622 mSuspendTimer->start( ms , true ); 624 mSuspendTimer->start( ms , true );
623 625
624} 626}
625 627
626void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti ) 628void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti )
627{ 629{
628 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 630 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
629 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 631 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
630#ifndef DESKTOP_VERSION 632#ifndef DESKTOP_VERSION
631 AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() ); 633 AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() );
632#endif 634#endif
633 return; 635 return;
634 } 636 }
635 int maxSec; 637 int maxSec;
636 //maxSec = 5; //testing only 638 //maxSec = 5; //testing only
637 maxSec = 86400+3600; // one day+1hour 639 maxSec = 86400+3600; // one day+1hour
638 mAlarmNotification = noti; 640 mAlarmNotification = noti;
639 int sec = QDateTime::currentDateTime().secsTo( qdt ); 641 int sec = QDateTime::currentDateTime().secsTo( qdt );
640 if ( sec > maxSec ) { 642 if ( sec > maxSec ) {
641 mRecheckAlarmTimer->start( maxSec * 1000 ); 643 mRecheckAlarmTimer->start( maxSec * 1000 );
642 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); 644 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec );
643 return; 645 return;
644 } else { 646 } else {
645 mRecheckAlarmTimer->stop(); 647 mRecheckAlarmTimer->stop();
646 } 648 }
647 //qDebug("Alarm timer started with secs: %d ", sec); 649 //qDebug("Alarm timer started with secs: %d ", sec);
648 mAlarmTimer->start( sec *1000 , true ); 650 mAlarmTimer->start( sec *1000 , true );
649 651
650} 652}
651// called by mRecheckAlarmTimer to get next alarm 653// called by mRecheckAlarmTimer to get next alarm
652// we need this, because a QTimer has only a max range of 25 days 654// we need this, because a QTimer has only a max range of 25 days
653void CalendarView::recheckTimerAlarm() 655void CalendarView::recheckTimerAlarm()
654{ 656{
655 mAlarmTimer->stop(); 657 mAlarmTimer->stop();
656 mRecheckAlarmTimer->stop(); 658 mRecheckAlarmTimer->stop();
657 mCalendar->checkAlarmForIncidence( 0, true ); 659 mCalendar->checkAlarmForIncidence( 0, true );
658} 660}
659void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti ) 661void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti )
660{ 662{
661 //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 663 //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
662 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 664 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
663#ifndef DESKTOP_VERSION 665#ifndef DESKTOP_VERSION
664 AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); 666 AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() );
665#endif 667#endif
666 return; 668 return;
667 } 669 }
668 mAlarmTimer->stop(); 670 mAlarmTimer->stop();
669} 671}
670void CalendarView::selectWeekNum ( int num ) 672void CalendarView::selectWeekNum ( int num )
671{ 673{
672 dateNavigator()->selectWeek( num ); 674 dateNavigator()->selectWeek( num );
673 mViewManager->showWeekView(); 675 mViewManager->showWeekView();
674} 676}
675KOViewManager *CalendarView::viewManager() 677KOViewManager *CalendarView::viewManager()
676{ 678{
677 return mViewManager; 679 return mViewManager;
678} 680}
679 681
680KODialogManager *CalendarView::dialogManager() 682KODialogManager *CalendarView::dialogManager()
681{ 683{
682 return mDialogManager; 684 return mDialogManager;
683} 685}
684 686
685QDate CalendarView::startDate() 687QDate CalendarView::startDate()
686{ 688{
687 DateList dates = mNavigator->selectedDates(); 689 DateList dates = mNavigator->selectedDates();
688 690
689 return dates.first(); 691 return dates.first();
690} 692}
691 693
692QDate CalendarView::endDate() 694QDate CalendarView::endDate()
693{ 695{
694 DateList dates = mNavigator->selectedDates(); 696 DateList dates = mNavigator->selectedDates();
695 697
696 return dates.last(); 698 return dates.last();
697} 699}
698 700
699 701
700void CalendarView::createPrinter() 702void CalendarView::createPrinter()
701{ 703{
702#ifndef KORG_NOPRINTER 704#ifndef KORG_NOPRINTER
703 if (!mCalPrinter) { 705 if (!mCalPrinter) {
704 mCalPrinter = new CalPrinter(this, mCalendar); 706 mCalPrinter = new CalPrinter(this, mCalendar);
705 connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); 707 connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig()));
706 } 708 }
707#endif 709#endif
708} 710}
709 711
710 712
711//KOPrefs::instance()->mWriteBackFile 713//KOPrefs::instance()->mWriteBackFile
712//KOPrefs::instance()->mWriteBackExistingOnly 714//KOPrefs::instance()->mWriteBackExistingOnly
713 715
714// 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); 716// 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict"));
715// 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); 717// 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict"));
716// 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); 718// 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict"));
717// 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); 719// 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict"));
718// 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); 720// 4 syncPrefsGroup->addRadio(i18n("Force take local entry always"));
719// 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); 721// 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always"));
720 722
721int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) 723int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full )
722{ 724{
723 725
724 // 0 equal 726 // 0 equal
725 // 1 take local 727 // 1 take local
726 // 2 take remote 728 // 2 take remote
727 // 3 cancel 729 // 3 cancel
728 QDateTime lastSync = mLastCalendarSync; 730 QDateTime lastSync = mLastCalendarSync;
729 QDateTime localMod = local->lastModified(); 731 QDateTime localMod = local->lastModified();
730 QDateTime remoteMod = remote->lastModified(); 732 QDateTime remoteMod = remote->lastModified();
731 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 733 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
732 bool remCh, locCh; 734 bool remCh, locCh;
733 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); 735 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) );
734 //if ( remCh ) 736 //if ( remCh )
735 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); 737 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() );
736 locCh = ( localMod > mLastCalendarSync ); 738 locCh = ( localMod > mLastCalendarSync );
737 if ( !remCh && ! locCh ) { 739 if ( !remCh && ! locCh ) {
738 //qDebug("both not changed "); 740 //qDebug("both not changed ");
739 lastSync = localMod.addDays(1); 741 lastSync = localMod.addDays(1);
740 if ( mode <= SYNC_PREF_ASK ) 742 if ( mode <= SYNC_PREF_ASK )
741 return 0; 743 return 0;
742 } else { 744 } else {
743 if ( locCh ) { 745 if ( locCh ) {
744 //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1()); 746 //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1());
745 lastSync = localMod.addDays( -1 ); 747 lastSync = localMod.addDays( -1 );
746 if ( !remCh ) 748 if ( !remCh )
747 remoteMod = ( lastSync.addDays( -1 ) ); 749 remoteMod = ( lastSync.addDays( -1 ) );
748 } else { 750 } else {
749 //qDebug(" not loc changed "); 751 //qDebug(" not loc changed ");
750 lastSync = localMod.addDays( 1 ); 752 lastSync = localMod.addDays( 1 );
751 if ( remCh ) 753 if ( remCh )
752 remoteMod =( lastSync.addDays( 1 ) ); 754 remoteMod =( lastSync.addDays( 1 ) );
753 755
754 } 756 }
755 } 757 }
756 full = true; 758 full = true;
757 if ( mode < SYNC_PREF_ASK ) 759 if ( mode < SYNC_PREF_ASK )
758 mode = SYNC_PREF_ASK; 760 mode = SYNC_PREF_ASK;
759 } else { 761 } else {
760 if ( localMod == remoteMod ) 762 if ( localMod == remoteMod )
761 // if ( local->revision() == remote->revision() ) 763 // if ( local->revision() == remote->revision() )
762 return 0; 764 return 0;
763 765
764 } 766 }
765 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); 767 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() );
766 768
767 //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision()); 769 //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision());
768 //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() ); 770 //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() );
769 //full = true; //debug only 771 //full = true; //debug only
770 if ( full ) { 772 if ( full ) {
771 bool equ = false; 773 bool equ = false;
772 if ( local->type() == "Event" ) { 774 if ( local->type() == "Event" ) {
773 equ = (*((Event*) local) == *((Event*) remote)); 775 equ = (*((Event*) local) == *((Event*) remote));
774 } 776 }
775 else if ( local->type() =="Todo" ) 777 else if ( local->type() =="Todo" )
776 equ = (*((Todo*) local) == (*(Todo*) remote)); 778 equ = (*((Todo*) local) == (*(Todo*) remote));
777 else if ( local->type() =="Journal" ) 779 else if ( local->type() =="Journal" )
778 equ = (*((Journal*) local) == *((Journal*) remote)); 780 equ = (*((Journal*) local) == *((Journal*) remote));
779 if ( equ ) { 781 if ( equ ) {
780 //qDebug("equal "); 782 //qDebug("equal ");
781 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 783 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
782 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); 784 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) );
783 } 785 }
784 if ( mode < SYNC_PREF_FORCE_LOCAL ) 786 if ( mode < SYNC_PREF_FORCE_LOCAL )
785 return 0; 787 return 0;
786 788
787 }//else //debug only 789 }//else //debug only
788 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); 790 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1());
789 } 791 }
790 int result; 792 int result;
791 bool localIsNew; 793 bool localIsNew;
792 //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() ); 794 //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() );
793 795
794 if ( full && mode < SYNC_PREF_NEWEST ) 796 if ( full && mode < SYNC_PREF_NEWEST )
795 mode = SYNC_PREF_ASK; 797 mode = SYNC_PREF_ASK;
796 798
797 switch( mode ) { 799 switch( mode ) {
798 case SYNC_PREF_LOCAL: 800 case SYNC_PREF_LOCAL:
799 if ( lastSync > remoteMod ) 801 if ( lastSync > remoteMod )
800 return 1; 802 return 1;
801 if ( lastSync > localMod ) 803 if ( lastSync > localMod )
802 return 2; 804 return 2;
803 return 1; 805 return 1;
804 break; 806 break;
805 case SYNC_PREF_REMOTE: 807 case SYNC_PREF_REMOTE:
806 if ( lastSync > remoteMod ) 808 if ( lastSync > remoteMod )
807 return 1; 809 return 1;
808 if ( lastSync > localMod ) 810 if ( lastSync > localMod )
809 return 2; 811 return 2;
810 return 2; 812 return 2;
811 break; 813 break;
812 case SYNC_PREF_NEWEST: 814 case SYNC_PREF_NEWEST:
813 if ( localMod > remoteMod ) 815 if ( localMod > remoteMod )
814 return 1; 816 return 1;
815 else 817 else
816 return 2; 818 return 2;
817 break; 819 break;
818 case SYNC_PREF_ASK: 820 case SYNC_PREF_ASK:
819 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); 821 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
820 if ( lastSync > remoteMod ) 822 if ( lastSync > remoteMod )
821 return 1; 823 return 1;
822 if ( lastSync > localMod ) 824 if ( lastSync > localMod )
823 return 2; 825 return 2;
824 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); 826 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
825 localIsNew = localMod >= remoteMod; 827 localIsNew = localMod >= remoteMod;
826 if ( localIsNew ) 828 if ( localIsNew )
827 getEventViewerDialog()->setColorMode( 1 ); 829 getEventViewerDialog()->setColorMode( 1 );
828 else 830 else
829 getEventViewerDialog()->setColorMode( 2 ); 831 getEventViewerDialog()->setColorMode( 2 );
830 getEventViewerDialog()->setIncidence(local); 832 getEventViewerDialog()->setIncidence(local);
831 if ( localIsNew ) 833 if ( localIsNew )
832 getEventViewerDialog()->setColorMode( 2 ); 834 getEventViewerDialog()->setColorMode( 2 );
833 else 835 else
834 getEventViewerDialog()->setColorMode( 1 ); 836 getEventViewerDialog()->setColorMode( 1 );
835 getEventViewerDialog()->addIncidence(remote); 837 getEventViewerDialog()->addIncidence(remote);
836 getEventViewerDialog()->setColorMode( 0 ); 838 getEventViewerDialog()->setColorMode( 0 );
837 //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); 839 //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() );
838 getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); 840 getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!"));
839 getEventViewerDialog()->showMe(); 841 getEventViewerDialog()->showMe();
840 result = getEventViewerDialog()->executeS( localIsNew ); 842 result = getEventViewerDialog()->executeS( localIsNew );
841 return result; 843 return result;
842 844
843 break; 845 break;
844 case SYNC_PREF_FORCE_LOCAL: 846 case SYNC_PREF_FORCE_LOCAL:
845 return 1; 847 return 1;
846 break; 848 break;
847 case SYNC_PREF_FORCE_REMOTE: 849 case SYNC_PREF_FORCE_REMOTE:
848 return 2; 850 return 2;
849 break; 851 break;
850 852
851 default: 853 default:
852 // SYNC_PREF_TAKE_BOTH not implemented 854 // SYNC_PREF_TAKE_BOTH not implemented
853 break; 855 break;
854 } 856 }
855 return 0; 857 return 0;
856} 858}
857Event* CalendarView::getLastSyncEvent() 859Event* CalendarView::getLastSyncEvent()
858{ 860{
859 Event* lse; 861 Event* lse;
860 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); 862 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() );
861 lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); 863 lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice );
862 if (!lse) { 864 if (!lse) {
863 lse = new Event(); 865 lse = new Event();
864 lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); 866 lse->setUid( "last-syncEvent-"+mCurrentSyncDevice );
865 QString sum = ""; 867 QString sum = "";
866 if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) 868 if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) )
867 sum = "E: "; 869 sum = "E: ";
868 lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); 870 lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event"));
869 lse->setDtStart( mLastCalendarSync ); 871 lse->setDtStart( mLastCalendarSync );
870 lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); 872 lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
871 lse->setCategories( i18n("SyncEvent") ); 873 lse->setCategories( i18n("SyncEvent") );
872 lse->setReadOnly( true ); 874 lse->setReadOnly( true );
873 mCalendar->addEvent( lse ); 875 mCalendar->addEvent( lse );
874 } 876 }
875 877
876 return lse; 878 return lse;
877 879
878} 880}
879 881
880// we check, if the to delete event has a id for a profile 882// we check, if the to delete event has a id for a profile
881// if yes, we set this id in the profile to delete 883// if yes, we set this id in the profile to delete
882void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) 884void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete )
883{ 885{
884 if ( lastSync.count() == 0 ) { 886 if ( lastSync.count() == 0 ) {
885 //qDebug(" lastSync.count() == 0"); 887 //qDebug(" lastSync.count() == 0");
886 return; 888 return;
887 } 889 }
888 if ( toDelete->type() == "Journal" ) 890 if ( toDelete->type() == "Journal" )
889 return; 891 return;
890 892
891 Event* eve = lastSync.first(); 893 Event* eve = lastSync.first();
892 894
893 while ( eve ) { 895 while ( eve ) {
894 QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name 896 QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name
895 if ( !id.isEmpty() ) { 897 if ( !id.isEmpty() ) {
896 QString des = eve->description(); 898 QString des = eve->description();
897 QString pref = "e"; 899 QString pref = "e";
898 if ( toDelete->type() == "Todo" ) 900 if ( toDelete->type() == "Todo" )
899 pref = "t"; 901 pref = "t";
900 des += pref+ id + ","; 902 des += pref+ id + ",";
901 eve->setReadOnly( false ); 903 eve->setReadOnly( false );
902 eve->setDescription( des ); 904 eve->setDescription( des );
903 //qDebug("setdes %s ", des.latin1()); 905 //qDebug("setdes %s ", des.latin1());
904 eve->setReadOnly( true ); 906 eve->setReadOnly( true );
905 } 907 }
906 eve = lastSync.next(); 908 eve = lastSync.next();
907 } 909 }
908 910
909} 911}
910void CalendarView::checkExternalId( Incidence * inc ) 912void CalendarView::checkExternalId( Incidence * inc )
911{ 913{
912 QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; 914 QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ;
913 checkExternSyncEvent( lastSync, inc ); 915 checkExternSyncEvent( lastSync, inc );
914 916
915} 917}
916bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) 918bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode )
917{ 919{
918 bool syncOK = true; 920 bool syncOK = true;
919 int addedEvent = 0; 921 int addedEvent = 0;
920 int addedEventR = 0; 922 int addedEventR = 0;
921 int deletedEventR = 0; 923 int deletedEventR = 0;
922 int deletedEventL = 0; 924 int deletedEventL = 0;
923 int changedLocal = 0; 925 int changedLocal = 0;
924 int changedRemote = 0; 926 int changedRemote = 0;
925 //QPtrList<Event> el = local->rawEvents(); 927 //QPtrList<Event> el = local->rawEvents();
926 Event* eventR; 928 Event* eventR;
927 QString uid; 929 QString uid;
928 int take; 930 int take;
929 Event* eventL; 931 Event* eventL;
930 Event* eventRSync; 932 Event* eventRSync;
931 Event* eventLSync; 933 Event* eventLSync;
932 QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); 934 QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents();
933 QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); 935 QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents();
934 bool fullDateRange = false; 936 bool fullDateRange = false;
935 local->resetTempSyncStat(); 937 local->resetTempSyncStat();
936 mLastCalendarSync = QDateTime::currentDateTime(); 938 mLastCalendarSync = QDateTime::currentDateTime();
937 if ( mSyncManager->syncWithDesktop() ) { 939 if ( mSyncManager->syncWithDesktop() ) {
938 remote->resetPilotStat(1); 940 remote->resetPilotStat(1);
939 if ( KSyncManager::mRequestedSyncEvent.isValid() ) { 941 if ( KSyncManager::mRequestedSyncEvent.isValid() ) {
940 mLastCalendarSync = KSyncManager::mRequestedSyncEvent; 942 mLastCalendarSync = KSyncManager::mRequestedSyncEvent;
941 qDebug("using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() ); 943 qDebug("using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() );
942 } else { 944 } else {
943 qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime "); 945 qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime ");
944 } 946 }
945 } 947 }
946 QDateTime modifiedCalendar = mLastCalendarSync; 948 QDateTime modifiedCalendar = mLastCalendarSync;
947 eventLSync = getLastSyncEvent(); 949 eventLSync = getLastSyncEvent();
948 eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); 950 eventR = remote->event("last-syncEvent-"+mCurrentSyncName );
949 if ( eventR ) { 951 if ( eventR ) {
950 eventRSync = (Event*) eventR->clone(); 952 eventRSync = (Event*) eventR->clone();
951 remote->deleteEvent(eventR ); 953 remote->deleteEvent(eventR );
952 954
953 } else { 955 } else {
954 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) { 956 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) {
955 eventRSync = (Event*)eventLSync->clone(); 957 eventRSync = (Event*)eventLSync->clone();
956 } else { 958 } else {
957 fullDateRange = true; 959 fullDateRange = true;
958 eventRSync = new Event(); 960 eventRSync = new Event();
959 eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); 961 eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event"));
960 eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); 962 eventRSync->setUid("last-syncEvent-"+mCurrentSyncName );
961 eventRSync->setDtStart( mLastCalendarSync ); 963 eventRSync->setDtStart( mLastCalendarSync );
962 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); 964 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
963 eventRSync->setCategories( i18n("SyncEvent") ); 965 eventRSync->setCategories( i18n("SyncEvent") );
964 } 966 }
965 } 967 }
966 if ( eventLSync->dtStart() == mLastCalendarSync ) 968 if ( eventLSync->dtStart() == mLastCalendarSync )
967 fullDateRange = true; 969 fullDateRange = true;
968 970
969 if ( ! fullDateRange ) { 971 if ( ! fullDateRange ) {
970 if ( eventLSync->dtStart() != eventRSync->dtStart() ) { 972 if ( eventLSync->dtStart() != eventRSync->dtStart() ) {
971 973
972 // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); 974 // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() );
973 //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); 975 //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec());
974 fullDateRange = true; 976 fullDateRange = true;
975 } 977 }
976 } 978 }
977 if ( mSyncManager->syncWithDesktop() ) { 979 if ( mSyncManager->syncWithDesktop() ) {
978 fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync ); 980 fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync );
979 } 981 }
980 if ( fullDateRange ) 982 if ( fullDateRange )
981 mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); 983 mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365);
982 else 984 else
983 mLastCalendarSync = eventLSync->dtStart(); 985 mLastCalendarSync = eventLSync->dtStart();
984 // for resyncing if own file has changed 986 // for resyncing if own file has changed
985 if ( mCurrentSyncDevice == "deleteaftersync" ) { 987 if ( mCurrentSyncDevice == "deleteaftersync" ) {
986 mLastCalendarSync = loadedFileVersion; 988 mLastCalendarSync = loadedFileVersion;
987 //qDebug("setting mLastCalendarSync "); 989 //qDebug("setting mLastCalendarSync ");
988 } 990 }
989 //qDebug("*************************** "); 991 //qDebug("*************************** ");
990 qDebug("mLastCalendarSync %s full: %d",mLastCalendarSync.toString().latin1(), fullDateRange); 992 qDebug("mLastCalendarSync %s full: %d",mLastCalendarSync.toString().latin1(), fullDateRange);
991 QPtrList<Incidence> er = remote->rawIncidences(); 993 QPtrList<Incidence> er = remote->rawIncidences();
992 Incidence* inR = er.first(); 994 Incidence* inR = er.first();
993 Incidence* inL; 995 Incidence* inL;
994 QProgressBar bar( er.count(),0 ); 996 QProgressBar bar( er.count(),0 );
995 bar.setCaption (i18n("Syncing - close to abort!") ); 997 bar.setCaption (i18n("Syncing - close to abort!") );
996 998
997 int w = 300; 999 int w = 300;
998 if ( QApplication::desktop()->width() < 320 ) 1000 if ( QApplication::desktop()->width() < 320 )
999 w = 220; 1001 w = 220;
1000 int h = bar.sizeHint().height() ; 1002 int h = bar.sizeHint().height() ;
1001 int dw = QApplication::desktop()->width(); 1003 int dw = QApplication::desktop()->width();
1002 int dh = QApplication::desktop()->height(); 1004 int dh = QApplication::desktop()->height();
1003 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1005 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1004 bar.show(); 1006 bar.show();
1005 int modulo = (er.count()/10)+1; 1007 int modulo = (er.count()/10)+1;
1006 int incCounter = 0; 1008 int incCounter = 0;
1007 while ( inR ) { 1009 while ( inR ) {
1008 if ( ! bar.isVisible() ) 1010 if ( ! bar.isVisible() )
1009 return false; 1011 return false;
1010 if ( incCounter % modulo == 0 ) 1012 if ( incCounter % modulo == 0 )
1011 bar.setProgress( incCounter ); 1013 bar.setProgress( incCounter );
1012 ++incCounter; 1014 ++incCounter;
1013 uid = inR->uid(); 1015 uid = inR->uid();
1014 bool skipIncidence = false; 1016 bool skipIncidence = false;
1015 if ( uid.left(15) == QString("last-syncEvent-") ) 1017 if ( uid.left(15) == QString("last-syncEvent-") )
1016 skipIncidence = true; 1018 skipIncidence = true;
1017 QString idS; 1019 QString idS;
1018 qApp->processEvents(); 1020 qApp->processEvents();
1019 if ( !skipIncidence ) { 1021 if ( !skipIncidence ) {
1020 inL = local->incidence( uid ); 1022 inL = local->incidence( uid );
1021 if ( inL ) { // maybe conflict - same uid in both calendars 1023 if ( inL ) { // maybe conflict - same uid in both calendars
1022 if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { 1024 if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) {
1023 //qDebug("take %d %s ", take, inL->summary().latin1()); 1025 //qDebug("take %d %s ", take, inL->summary().latin1());
1024 if ( take == 3 ) 1026 if ( take == 3 )
1025 return false; 1027 return false;
1026 if ( take == 1 ) {// take local ********************** 1028 if ( take == 1 ) {// take local **********************
1027 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) 1029 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL )
1028 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1030 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1029 else 1031 else
1030 idS = inR->IDStr(); 1032 idS = inR->IDStr();
1031 remote->deleteIncidence( inR ); 1033 remote->deleteIncidence( inR );
1032 inR = inL->clone(); 1034 inR = inL->clone();
1033 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 1035 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
1034 if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) 1036 if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL )
1035 inR->setIDStr( idS ); 1037 inR->setIDStr( idS );
1036 remote->addIncidence( inR ); 1038 remote->addIncidence( inR );
1037 if ( mSyncManager->syncWithDesktop() ) 1039 if ( mSyncManager->syncWithDesktop() )
1038 inR->setPilotId( 2 ); 1040 inR->setPilotId( 2 );
1039 ++changedRemote; 1041 ++changedRemote;
1040 } else {// take remote ********************** 1042 } else {// take remote **********************
1041 idS = inL->IDStr(); 1043 idS = inL->IDStr();
1042 int pid = inL->pilotId(); 1044 int pid = inL->pilotId();
1043 local->deleteIncidence( inL ); 1045 local->deleteIncidence( inL );
1044 inL = inR->clone(); 1046 inL = inR->clone();
1045 if ( mSyncManager->syncWithDesktop() ) 1047 if ( mSyncManager->syncWithDesktop() )
1046 inL->setPilotId( pid ); 1048 inL->setPilotId( pid );
1047 inL->setIDStr( idS ); 1049 inL->setIDStr( idS );
1048 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1050 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1049 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1051 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1050 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); 1052 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) );
1051 } 1053 }
1052 local->addIncidence( inL ); 1054 local->addIncidence( inL );
1053 ++changedLocal; 1055 ++changedLocal;
1054 } 1056 }
1055 } 1057 }
1056 } else { // no conflict ********** add or delete remote 1058 } else { // no conflict ********** add or delete remote
1057 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1059 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1058 QString des = eventLSync->description(); 1060 QString des = eventLSync->description();
1059 QString pref = "e"; 1061 QString pref = "e";
1060 if ( inR->type() == "Todo" ) 1062 if ( inR->type() == "Todo" )
1061 pref = "t"; 1063 pref = "t";
1062 if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it 1064 if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it
1063 inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); 1065 inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE );
1064 //remote->deleteIncidence( inR ); 1066 //remote->deleteIncidence( inR );
1065 ++deletedEventR; 1067 ++deletedEventR;
1066 } else { 1068 } else {
1067 inR->setLastModified( modifiedCalendar ); 1069 inR->setLastModified( modifiedCalendar );
1068 inL = inR->clone(); 1070 inL = inR->clone();
1069 inL->setIDStr( ":" ); 1071 inL->setIDStr( ":" );
1070 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); 1072 inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
1071 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); 1073 inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) );
1072 local->addIncidence( inL ); 1074 local->addIncidence( inL );
1073 ++addedEvent; 1075 ++addedEvent;
1074 } 1076 }
1075 } else { 1077 } else {
1076 if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { 1078 if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) {
1077 inR->setLastModified( modifiedCalendar ); 1079 inR->setLastModified( modifiedCalendar );
1078 inL = inR->clone(); 1080 inL = inR->clone();
1079 inL->setIDStr( ":" ); 1081 inL->setIDStr( ":" );
1080 local->addIncidence( inL ); 1082 local->addIncidence( inL );
1081 ++addedEvent; 1083 ++addedEvent;
1082 } else { 1084 } else {
1083 checkExternSyncEvent(eventRSyncSharp, inR); 1085 checkExternSyncEvent(eventRSyncSharp, inR);
1084 remote->deleteIncidence( inR ); 1086 remote->deleteIncidence( inR );
1085 ++deletedEventR; 1087 ++deletedEventR;
1086 } 1088 }
1087 } 1089 }
1088 } 1090 }
1089 } 1091 }
1090 inR = er.next(); 1092 inR = er.next();
1091 } 1093 }
1092 QPtrList<Incidence> el = local->rawIncidences(); 1094 QPtrList<Incidence> el = local->rawIncidences();
1093 inL = el.first(); 1095 inL = el.first();
1094 modulo = (el.count()/10)+1; 1096 modulo = (el.count()/10)+1;
1095 bar.setCaption (i18n("Add / remove events") ); 1097 bar.setCaption (i18n("Add / remove events") );
1096 bar.setTotalSteps ( el.count() ) ; 1098 bar.setTotalSteps ( el.count() ) ;
1097 bar.show(); 1099 bar.show();
1098 incCounter = 0; 1100 incCounter = 0;
1099 1101
1100 while ( inL ) { 1102 while ( inL ) {
1101 1103
1102 qApp->processEvents(); 1104 qApp->processEvents();
1103 if ( ! bar.isVisible() ) 1105 if ( ! bar.isVisible() )
1104 return false; 1106 return false;
1105 if ( incCounter % modulo == 0 ) 1107 if ( incCounter % modulo == 0 )
1106 bar.setProgress( incCounter ); 1108 bar.setProgress( incCounter );
1107 ++incCounter; 1109 ++incCounter;
1108 uid = inL->uid(); 1110 uid = inL->uid();
1109 bool skipIncidence = false; 1111 bool skipIncidence = false;
1110 if ( uid.left(15) == QString("last-syncEvent-") ) 1112 if ( uid.left(15) == QString("last-syncEvent-") )
1111 skipIncidence = true; 1113 skipIncidence = true;
1112 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) 1114 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" )
1113 skipIncidence = true; 1115 skipIncidence = true;
1114 if ( !skipIncidence ) { 1116 if ( !skipIncidence ) {
1115 inR = remote->incidence( uid ); 1117 inR = remote->incidence( uid );
1116 if ( ! inR ) { // no conflict ********** add or delete local 1118 if ( ! inR ) { // no conflict ********** add or delete local
1117 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1119 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1118 if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { 1120 if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) {
1119 checkExternSyncEvent(eventLSyncSharp, inL); 1121 checkExternSyncEvent(eventLSyncSharp, inL);
1120 local->deleteIncidence( inL ); 1122 local->deleteIncidence( inL );
1121 ++deletedEventL; 1123 ++deletedEventL;
1122 } else { 1124 } else {
1123 if ( ! mSyncManager->mWriteBackExistingOnly ) { 1125 if ( ! mSyncManager->mWriteBackExistingOnly ) {
1124 inL->removeID(mCurrentSyncDevice ); 1126 inL->removeID(mCurrentSyncDevice );
1125 ++addedEventR; 1127 ++addedEventR;
1126 //qDebug("remote added Incidence %s ", inL->summary().latin1()); 1128 //qDebug("remote added Incidence %s ", inL->summary().latin1());
1127 inL->setLastModified( modifiedCalendar ); 1129 inL->setLastModified( modifiedCalendar );
1128 inR = inL->clone(); 1130 inR = inL->clone();
1129 inR->setIDStr( ":" ); 1131 inR->setIDStr( ":" );
1130 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 1132 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
1131 remote->addIncidence( inR ); 1133 remote->addIncidence( inR );
1132 } 1134 }
1133 } 1135 }
1134 } else { 1136 } else {
1135 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { 1137 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) {
1136 checkExternSyncEvent(eventLSyncSharp, inL); 1138 checkExternSyncEvent(eventLSyncSharp, inL);
1137 local->deleteIncidence( inL ); 1139 local->deleteIncidence( inL );
1138 ++deletedEventL; 1140 ++deletedEventL;
1139 } else { 1141 } else {
1140 if ( ! mSyncManager->mWriteBackExistingOnly ) { 1142 if ( ! mSyncManager->mWriteBackExistingOnly ) {
1141 ++addedEventR; 1143 ++addedEventR;
1142 inL->setLastModified( modifiedCalendar ); 1144 inL->setLastModified( modifiedCalendar );
1143 inR = inL->clone(); 1145 inR = inL->clone();
1144 inR->setIDStr( ":" ); 1146 inR->setIDStr( ":" );
1145 remote->addIncidence( inR ); 1147 remote->addIncidence( inR );
1146 } 1148 }
1147 } 1149 }
1148 } 1150 }
1149 } 1151 }
1150 } 1152 }
1151 inL = el.next(); 1153 inL = el.next();
1152 } 1154 }
1153 int delFut = 0; 1155 int delFut = 0;
1154 int remRem = 0; 1156 int remRem = 0;
1155 if ( mSyncManager->mWriteBackInFuture ) { 1157 if ( mSyncManager->mWriteBackInFuture ) {
1156 er = remote->rawIncidences(); 1158 er = remote->rawIncidences();
1157 remRem = er.count(); 1159 remRem = er.count();
1158 inR = er.first(); 1160 inR = er.first();
1159 QDateTime dt; 1161 QDateTime dt;
1160 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1162 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1161 QDateTime end = cur.addDays( (mSyncManager->mWriteBackInFuture +1 ) *7 ); 1163 QDateTime end = cur.addDays( (mSyncManager->mWriteBackInFuture +1 ) *7 );
1162 while ( inR ) { 1164 while ( inR ) {
1163 if ( inR->type() == "Todo" ) { 1165 if ( inR->type() == "Todo" ) {
1164 Todo * t = (Todo*)inR; 1166 Todo * t = (Todo*)inR;
1165 if ( t->hasDueDate() ) 1167 if ( t->hasDueDate() )
1166 dt = t->dtDue(); 1168 dt = t->dtDue();
1167 else 1169 else
1168 dt = cur.addSecs( 62 ); 1170 dt = cur.addSecs( 62 );
1169 } 1171 }
1170 else if (inR->type() == "Event" ) { 1172 else if (inR->type() == "Event" ) {
1171 bool ok; 1173 bool ok;
1172 dt = inR->getNextOccurence( cur, &ok ); 1174 dt = inR->getNextOccurence( cur, &ok );
1173 if ( !ok ) 1175 if ( !ok )
1174 dt = cur.addSecs( -62 ); 1176 dt = cur.addSecs( -62 );
1175 } 1177 }
1176 else 1178 else
1177 dt = inR->dtStart(); 1179 dt = inR->dtStart();
1178 if ( dt < cur || dt > end ) { 1180 if ( dt < cur || dt > end ) {
1179 remote->deleteIncidence( inR ); 1181 remote->deleteIncidence( inR );
1180 ++delFut; 1182 ++delFut;
1181 } 1183 }
1182 inR = er.next(); 1184 inR = er.next();
1183 } 1185 }
1184 } 1186 }
1185 bar.hide(); 1187 bar.hide();
1186 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); 1188 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 );
1187 eventLSync->setReadOnly( false ); 1189 eventLSync->setReadOnly( false );
1188 eventLSync->setDtStart( mLastCalendarSync ); 1190 eventLSync->setDtStart( mLastCalendarSync );
1189 eventRSync->setDtStart( mLastCalendarSync ); 1191 eventRSync->setDtStart( mLastCalendarSync );
1190 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1192 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1191 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1193 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1192 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; 1194 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ;
1193 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); 1195 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName );
1194 eventLSync->setReadOnly( true ); 1196 eventLSync->setReadOnly( true );
1195 qDebug("********** %d %d ", mGlobalSyncMode == SYNC_MODE_NORMAL, mSyncManager->syncWithDesktop() ); 1197 qDebug("********** %d %d ", mGlobalSyncMode == SYNC_MODE_NORMAL, mSyncManager->syncWithDesktop() );
1196 if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal... 1198 if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal...
1197 remote->addEvent( eventRSync ); 1199 remote->addEvent( eventRSync );
1198 else 1200 else
1199 delete eventRSync; 1201 delete eventRSync;
1200 QString mes; 1202 QString mes;
1201 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 ); 1203 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 );
1202 QString delmess; 1204 QString delmess;
1203 if ( delFut ) { 1205 if ( delFut ) {
1204 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); 1206 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);
1205 mes += delmess; 1207 mes += delmess;
1206 } 1208 }
1207 mes = i18n("Local calendar changed!\n") +mes; 1209 mes = i18n("Local calendar changed!\n") +mes;
1208 mCalendar->checkAlarmForIncidence( 0, true ); 1210 mCalendar->checkAlarmForIncidence( 0, true );
1209 qDebug( mes ); 1211 qDebug( mes );
1210 if ( mSyncManager->mShowSyncSummary ) { 1212 if ( mSyncManager->mShowSyncSummary ) {
1211 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, 1213 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes,
1212 i18n("KO/Pi Synchronization"),i18n("Write back"))) { 1214 i18n("KO/Pi Synchronization"),i18n("Write back"))) {
1213 qDebug("cancelled "); 1215 qDebug("cancelled ");
1214 return false; 1216 return false;
1215 } 1217 }
1216 } 1218 }
1217 return syncOK; 1219 return syncOK;
1218} 1220}
1219 1221
1220void CalendarView::setSyncDevice( QString s ) 1222void CalendarView::setSyncDevice( QString s )
1221{ 1223{
1222 mCurrentSyncDevice= s; 1224 mCurrentSyncDevice= s;
1223} 1225}
1224void CalendarView::setSyncName( QString s ) 1226void CalendarView::setSyncName( QString s )
1225{ 1227{
1226 mCurrentSyncName= s; 1228 mCurrentSyncName= s;
1227} 1229}
1228bool CalendarView::syncCalendar(QString filename, int mode) 1230bool CalendarView::syncCalendar(QString filename, int mode)
1229{ 1231{
1230 //qDebug("syncCalendar %s ", filename.latin1()); 1232 //qDebug("syncCalendar %s ", filename.latin1());
1231 mGlobalSyncMode = SYNC_MODE_NORMAL; 1233 mGlobalSyncMode = SYNC_MODE_NORMAL;
1232 CalendarLocal* calendar = new CalendarLocal(); 1234 CalendarLocal* calendar = new CalendarLocal();
1233 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 1235 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
1234 FileStorage* storage = new FileStorage( calendar ); 1236 FileStorage* storage = new FileStorage( calendar );
1235 bool syncOK = false; 1237 bool syncOK = false;
1236 storage->setFileName( filename ); 1238 storage->setFileName( filename );
1237 // qDebug("loading ... "); 1239 // qDebug("loading ... ");
1238 if ( storage->load() ) { 1240 if ( storage->load() ) {
1239 getEventViewerDialog()->setSyncMode( true ); 1241 getEventViewerDialog()->setSyncMode( true );
1240 syncOK = synchronizeCalendar( mCalendar, calendar, mode ); 1242 syncOK = synchronizeCalendar( mCalendar, calendar, mode );
1241 getEventViewerDialog()->setSyncMode( false ); 1243 getEventViewerDialog()->setSyncMode( false );
1242 if ( syncOK ) { 1244 if ( syncOK ) {
1243 if ( mSyncManager->mWriteBackFile ) 1245 if ( mSyncManager->mWriteBackFile )
1244 { 1246 {
1245 storage->setSaveFormat( new ICalFormat() ); 1247 storage->setSaveFormat( new ICalFormat() );
1246 storage->save(); 1248 storage->save();
1247 } 1249 }
1248 } 1250 }
1249 setModified( true ); 1251 setModified( true );
1250 } 1252 }
1251 delete storage; 1253 delete storage;
1252 delete calendar; 1254 delete calendar;
1253 if ( syncOK ) 1255 if ( syncOK )
1254 updateView(); 1256 updateView();
1255 return syncOK; 1257 return syncOK;
1256} 1258}
1257 1259
1258void CalendarView::syncExternal( int mode ) 1260void CalendarView::syncExternal( int mode )
1259{ 1261{
1260 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 1262 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
1261 1263
1262 qApp->processEvents(); 1264 qApp->processEvents();
1263 CalendarLocal* calendar = new CalendarLocal(); 1265 CalendarLocal* calendar = new CalendarLocal();
1264 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 1266 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
1265 bool syncOK = false; 1267 bool syncOK = false;
1266 bool loadSuccess = false; 1268 bool loadSuccess = false;
1267 PhoneFormat* phoneFormat = 0; 1269 PhoneFormat* phoneFormat = 0;
1268 emit tempDisableBR(true); 1270 emit tempDisableBR(true);
1269#ifndef DESKTOP_VERSION 1271#ifndef DESKTOP_VERSION
1270 SharpFormat* sharpFormat = 0; 1272 SharpFormat* sharpFormat = 0;
1271 if ( mode == 0 ) { // sharp 1273 if ( mode == 0 ) { // sharp
1272 sharpFormat = new SharpFormat () ; 1274 sharpFormat = new SharpFormat () ;
1273 loadSuccess = sharpFormat->load( calendar, mCalendar ); 1275 loadSuccess = sharpFormat->load( calendar, mCalendar );
1274 1276
1275 } else 1277 } else
1276#endif 1278#endif
1277 if ( mode == 1 ) { // phone 1279 if ( mode == 1 ) { // phone
1278 phoneFormat = new PhoneFormat (mCurrentSyncDevice, 1280 phoneFormat = new PhoneFormat (mCurrentSyncDevice,
1279 mSyncManager->mPhoneDevice, 1281 mSyncManager->mPhoneDevice,
1280 mSyncManager->mPhoneConnection, 1282 mSyncManager->mPhoneConnection,
1281 mSyncManager->mPhoneModel); 1283 mSyncManager->mPhoneModel);
1282 loadSuccess = phoneFormat->load( calendar,mCalendar); 1284 loadSuccess = phoneFormat->load( calendar,mCalendar);
1283 1285
1284 } else { 1286 } else {
1285 emit tempDisableBR(false); 1287 emit tempDisableBR(false);
1286 return; 1288 return;
1287 } 1289 }
1288 if ( loadSuccess ) { 1290 if ( loadSuccess ) {
1289 getEventViewerDialog()->setSyncMode( true ); 1291 getEventViewerDialog()->setSyncMode( true );
1290 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); 1292 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs );
1291 getEventViewerDialog()->setSyncMode( false ); 1293 getEventViewerDialog()->setSyncMode( false );
1292 qApp->processEvents(); 1294 qApp->processEvents();
1293 if ( syncOK ) { 1295 if ( syncOK ) {
1294 if ( mSyncManager->mWriteBackFile ) 1296 if ( mSyncManager->mWriteBackFile )
1295 { 1297 {
1296 QPtrList<Incidence> iL = mCalendar->rawIncidences(); 1298 QPtrList<Incidence> iL = mCalendar->rawIncidences();
1297 Incidence* inc = iL.first(); 1299 Incidence* inc = iL.first();
1298 if ( phoneFormat ) { 1300 if ( phoneFormat ) {
1299 while ( inc ) { 1301 while ( inc ) {
1300 inc->removeID(mCurrentSyncDevice); 1302 inc->removeID(mCurrentSyncDevice);
1301 inc = iL.next(); 1303 inc = iL.next();
1302 } 1304 }
1303 } 1305 }
1304#ifndef DESKTOP_VERSION 1306#ifndef DESKTOP_VERSION
1305 if ( sharpFormat ) 1307 if ( sharpFormat )
1306 sharpFormat->save(calendar); 1308 sharpFormat->save(calendar);
1307#endif 1309#endif
1308 if ( phoneFormat ) 1310 if ( phoneFormat )
1309 phoneFormat->save(calendar); 1311 phoneFormat->save(calendar);
1310 iL = calendar->rawIncidences(); 1312 iL = calendar->rawIncidences();
1311 inc = iL.first(); 1313 inc = iL.first();
1312 Incidence* loc; 1314 Incidence* loc;
1313 while ( inc ) { 1315 while ( inc ) {
1314 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { 1316 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) {
1315 loc = mCalendar->incidence(inc->uid() ); 1317 loc = mCalendar->incidence(inc->uid() );
1316 if ( loc ) { 1318 if ( loc ) {
1317 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); 1319 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) );
1318 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); 1320 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) );
1319 } 1321 }
1320 } 1322 }
1321 inc = iL.next(); 1323 inc = iL.next();
1322 } 1324 }
1323 Incidence* lse = getLastSyncEvent(); 1325 Incidence* lse = getLastSyncEvent();
1324 if ( lse ) { 1326 if ( lse ) {
1325 lse->setReadOnly( false ); 1327 lse->setReadOnly( false );
1326 lse->setDescription( "" ); 1328 lse->setDescription( "" );
1327 lse->setReadOnly( true ); 1329 lse->setReadOnly( true );
1328 } 1330 }
1329 } 1331 }
1330 } else { 1332 } else {
1331 topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); 1333 topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") );
1332 } 1334 }
1333 setModified( true ); 1335 setModified( true );
1334 } else { 1336 } else {
1335 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; 1337 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ;
1336 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), 1338 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"),
1337 question, i18n("Ok")) ; 1339 question, i18n("Ok")) ;
1338 1340
1339 } 1341 }
1340 delete calendar; 1342 delete calendar;
1341 updateView(); 1343 updateView();
1342 emit tempDisableBR(false); 1344 emit tempDisableBR(false);
1343 return ;//syncOK; 1345 return ;//syncOK;
1344 1346
1345} 1347}
1346 1348
1347bool CalendarView::importBday() 1349bool CalendarView::importBday()
1348{ 1350{
1349#ifndef KORG_NOKABC 1351#ifndef KORG_NOKABC
1350 1352
1351#ifdef DESKTOP_VERSION 1353#ifdef DESKTOP_VERSION
1352 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); 1354 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
1353 KABC::AddressBook::Iterator it; 1355 KABC::AddressBook::Iterator it;
1354 int count = 0; 1356 int count = 0;
1355 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 1357 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
1356 ++count; 1358 ++count;
1357 } 1359 }
1358 QProgressBar bar(count,0 ); 1360 QProgressBar bar(count,0 );
1359 int w = 300; 1361 int w = 300;
1360 if ( QApplication::desktop()->width() < 320 ) 1362 if ( QApplication::desktop()->width() < 320 )
1361 w = 220; 1363 w = 220;
1362 int h = bar.sizeHint().height() ; 1364 int h = bar.sizeHint().height() ;
1363 int dw = QApplication::desktop()->width(); 1365 int dw = QApplication::desktop()->width();
1364 int dh = QApplication::desktop()->height(); 1366 int dh = QApplication::desktop()->height();
1365 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1367 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1366 bar.show(); 1368 bar.show();
1367 bar.setCaption (i18n("Reading addressbook - close to abort!") ); 1369 bar.setCaption (i18n("Reading addressbook - close to abort!") );
1368 qApp->processEvents(); 1370 qApp->processEvents();
1369 count = 0; 1371 count = 0;
1370 int addCount = 0; 1372 int addCount = 0;
1371 KCal::Attendee* a = 0; 1373 KCal::Attendee* a = 0;
1372 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 1374 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
1373 if ( ! bar.isVisible() ) 1375 if ( ! bar.isVisible() )
1374 return false; 1376 return false;
1375 bar.setProgress( count++ ); 1377 bar.setProgress( count++ );
1376 qApp->processEvents(); 1378 qApp->processEvents();
1377 //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); 1379 //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() );
1378 if ( (*it).birthday().date().isValid() ){ 1380 if ( (*it).birthday().date().isValid() ){
1379 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 1381 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
1380 if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) 1382 if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) )
1381 ++addCount; 1383 ++addCount;
1382 } 1384 }
1383 QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); 1385 QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d");
1384 if ( anni.isValid() ){ 1386 if ( anni.isValid() ){
1385 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 1387 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
1386 if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) 1388 if ( addAnniversary( anni, (*it).assembledName(), a, false ) )
1387 ++addCount; 1389 ++addCount;
1388 } 1390 }
1389 } 1391 }
1390 updateView(); 1392 updateView();
1391 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); 1393 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!"));
1392#else //DESKTOP_VERSION 1394#else //DESKTOP_VERSION
1393 1395
1394 ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); 1396 ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/);
1395 // the result should now arrive through method insertBirthdays 1397 // the result should now arrive through method insertBirthdays
1396 1398
1397#endif //DESKTOP_VERSION 1399#endif //DESKTOP_VERSION
1398 1400
1399#endif //KORG_NOKABC 1401#endif //KORG_NOKABC
1400 1402
1401 1403
1402 return true; 1404 return true;
1403} 1405}
1404 1406
1405// This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI 1407// This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI
1406void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList, 1408void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList,
1407 const QStringList& anniversaryList, const QStringList& realNameList, 1409 const QStringList& anniversaryList, const QStringList& realNameList,
1408 const QStringList& emailList, const QStringList& assembledNameList, 1410 const QStringList& emailList, const QStringList& assembledNameList,
1409 const QStringList& uidList) 1411 const QStringList& uidList)
1410{ 1412{
1411 qDebug("CalendarView::insertBirthdays"); 1413 qDebug("CalendarView::insertBirthdays");
1412 if (uid == this->name()) 1414 if (uid == this->name())
1413 { 1415 {
1414 int count = birthdayList.count(); 1416 int count = birthdayList.count();
1415 int addCount = 0; 1417 int addCount = 0;
1416 KCal::Attendee* a = 0; 1418 KCal::Attendee* a = 0;
1417 1419
1418 qDebug("CalView 1 %i", count); 1420 qDebug("CalView 1 %i", count);
1419 1421
1420 QProgressBar bar(count,0 ); 1422 QProgressBar bar(count,0 );
1421 int w = 300; 1423 int w = 300;
1422 if ( QApplication::desktop()->width() < 320 ) 1424 if ( QApplication::desktop()->width() < 320 )
1423 w = 220; 1425 w = 220;
1424 int h = bar.sizeHint().height() ; 1426 int h = bar.sizeHint().height() ;
1425 int dw = QApplication::desktop()->width(); 1427 int dw = QApplication::desktop()->width();
1426 int dh = QApplication::desktop()->height(); 1428 int dh = QApplication::desktop()->height();
1427 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1429 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1428 bar.show(); 1430 bar.show();
1429 bar.setCaption (i18n("inserting birthdays - close to abort!") ); 1431 bar.setCaption (i18n("inserting birthdays - close to abort!") );
1430 qApp->processEvents(); 1432 qApp->processEvents();
1431 1433
1432 QDate birthday; 1434 QDate birthday;
1433 QDate anniversary; 1435 QDate anniversary;
1434 QString realName; 1436 QString realName;
1435 QString email; 1437 QString email;
1436 QString assembledName; 1438 QString assembledName;
1437 QString uid; 1439 QString uid;
1438 bool ok = true; 1440 bool ok = true;
1439 for ( int i = 0; i < count; i++) 1441 for ( int i = 0; i < count; i++)
1440 { 1442 {
1441 if ( ! bar.isVisible() ) 1443 if ( ! bar.isVisible() )
1442 return; 1444 return;
1443 bar.setProgress( i ); 1445 bar.setProgress( i );
1444 qApp->processEvents(); 1446 qApp->processEvents();
1445 1447
1446 birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok); 1448 birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok);
1447 if (!ok) { 1449 if (!ok) {
1448 ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1()); 1450 ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1());
1449 } 1451 }
1450 1452
1451 anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok); 1453 anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok);
1452 if (!ok) { 1454 if (!ok) {
1453 ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1()); 1455 ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1());
1454 } 1456 }
1455 realName = realNameList[i]; 1457 realName = realNameList[i];
1456 email = emailList[i]; 1458 email = emailList[i];
1457 assembledName = assembledNameList[i]; 1459 assembledName = assembledNameList[i];
1458 uid = uidList[i]; 1460 uid = uidList[i];
1459 //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() ); 1461 //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() );
1460 1462
1461 if ( birthday.isValid() ){ 1463 if ( birthday.isValid() ){
1462 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, 1464 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction,
1463 KCal::Attendee::ReqParticipant,uid) ; 1465 KCal::Attendee::ReqParticipant,uid) ;
1464 if ( addAnniversary( birthday, assembledName, a, true ) ) 1466 if ( addAnniversary( birthday, assembledName, a, true ) )
1465 ++addCount; 1467 ++addCount;
1466 } 1468 }
1467 1469
1468 if ( anniversary.isValid() ){ 1470 if ( anniversary.isValid() ){
1469 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, 1471 a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction,
1470 KCal::Attendee::ReqParticipant,uid) ; 1472 KCal::Attendee::ReqParticipant,uid) ;
1471 if ( addAnniversary( anniversary, assembledName, a, false ) ) 1473 if ( addAnniversary( anniversary, assembledName, a, false ) )
1472 ++addCount; 1474 ++addCount;
1473 } 1475 }
1474 } 1476 }
1475 1477
1476 updateView(); 1478 updateView();
1477 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); 1479 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!"));
1478 1480
1479 } 1481 }
1480 1482
1481} 1483}
1482 1484
1483 1485
1484 1486
1485bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) 1487bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday)
1486{ 1488{
1487 //qDebug("addAnni "); 1489 //qDebug("addAnni ");
1488 Event * ev = new Event(); 1490 Event * ev = new Event();
1489 if ( a ) { 1491 if ( a ) {
1490 ev->addAttendee( a ); 1492 ev->addAttendee( a );
1491 } 1493 }
1492 QString kind; 1494 QString kind;
1493 if ( birthday ) 1495 if ( birthday )
1494 kind = i18n( "Birthday" ); 1496 kind = i18n( "Birthday" );
1495 else 1497 else
1496 kind = i18n( "Anniversary" ); 1498 kind = i18n( "Anniversary" );
1497 ev->setSummary( name + " - " + kind ); 1499 ev->setSummary( name + " - " + kind );
1498 ev->setOrganizer(a->email()); 1500 ev->setOrganizer(a->email());
1499 ev->setCategories( kind ); 1501 ev->setCategories( kind );
1500 ev->setDtStart( QDateTime(date) ); 1502 ev->setDtStart( QDateTime(date) );
1501 ev->setDtEnd( QDateTime(date) ); 1503 ev->setDtEnd( QDateTime(date) );
1502 ev->setFloats( true ); 1504 ev->setFloats( true );
1503 Recurrence * rec = ev->recurrence(); 1505 Recurrence * rec = ev->recurrence();
1504 rec->setYearly(Recurrence::rYearlyMonth,1,-1); 1506 rec->setYearly(Recurrence::rYearlyMonth,1,-1);
1505 rec->addYearlyNum( date.month() ); 1507 rec->addYearlyNum( date.month() );
1506 if ( !mCalendar->addAnniversaryNoDup( ev ) ) { 1508 if ( !mCalendar->addAnniversaryNoDup( ev ) ) {
1507 delete ev; 1509 delete ev;
1508 return false; 1510 return false;
1509 } 1511 }
1510 return true; 1512 return true;
1511 1513
1512} 1514}
1513bool CalendarView::importQtopia( const QString &categories, 1515bool CalendarView::importQtopia( const QString &categories,
1514 const QString &datebook, 1516 const QString &datebook,
1515 const QString &todolist ) 1517 const QString &todolist )
1516{ 1518{
1517 1519
1518 QtopiaFormat qtopiaFormat; 1520 QtopiaFormat qtopiaFormat;
1519 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); 1521 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories));
1520 if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); 1522 if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories );
1521 if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); 1523 if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook );
1522 if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); 1524 if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist );
1523 1525
1524 updateView(); 1526 updateView();
1525 return true; 1527 return true;
1526 1528
1527#if 0 1529#if 0
1528 mGlobalSyncMode = SYNC_MODE_QTOPIA; 1530 mGlobalSyncMode = SYNC_MODE_QTOPIA;
1529 mCurrentSyncDevice = "qtopia-XML"; 1531 mCurrentSyncDevice = "qtopia-XML";
1530 if ( mSyncManager->mAskForPreferences ) 1532 if ( mSyncManager->mAskForPreferences )
1531 edit_sync_options(); 1533 edit_sync_options();
1532 qApp->processEvents(); 1534 qApp->processEvents();
1533 CalendarLocal* calendar = new CalendarLocal(); 1535 CalendarLocal* calendar = new CalendarLocal();
1534 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 1536 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
1535 bool syncOK = false; 1537 bool syncOK = false;
1536 QtopiaFormat qtopiaFormat; 1538 QtopiaFormat qtopiaFormat;
1537 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); 1539 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories));
1538 bool loadOk = true; 1540 bool loadOk = true;
1539 if ( !categories.isEmpty() ) 1541 if ( !categories.isEmpty() )
1540 loadOk = qtopiaFormat.load( calendar, categories ); 1542 loadOk = qtopiaFormat.load( calendar, categories );
1541 if ( loadOk && !datebook.isEmpty() ) 1543 if ( loadOk && !datebook.isEmpty() )
1542 loadOk = qtopiaFormat.load( calendar, datebook ); 1544 loadOk = qtopiaFormat.load( calendar, datebook );
1543 if ( loadOk && !todolist.isEmpty() ) 1545 if ( loadOk && !todolist.isEmpty() )
1544 loadOk = qtopiaFormat.load( calendar, todolist ); 1546 loadOk = qtopiaFormat.load( calendar, todolist );
1545 1547
1546 if ( loadOk ) { 1548 if ( loadOk ) {
1547 getEventViewerDialog()->setSyncMode( true ); 1549 getEventViewerDialog()->setSyncMode( true );
1548 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); 1550 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs );
1549 getEventViewerDialog()->setSyncMode( false ); 1551 getEventViewerDialog()->setSyncMode( false );
1550 qApp->processEvents(); 1552 qApp->processEvents();
1551 if ( syncOK ) { 1553 if ( syncOK ) {
1552 if ( mSyncManager->mWriteBackFile ) 1554 if ( mSyncManager->mWriteBackFile )
1553 { 1555 {
1554 // write back XML file 1556 // write back XML file
1555 1557
1556 } 1558 }
1557 setModified( true ); 1559 setModified( true );
1558 } 1560 }
1559 } else { 1561 } else {
1560 QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; 1562 QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ;
1561 QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), 1563 QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"),
1562 question, i18n("Ok")) ; 1564 question, i18n("Ok")) ;
1563 } 1565 }
1564 delete calendar; 1566 delete calendar;
1565 updateView(); 1567 updateView();
1566 return syncOK; 1568 return syncOK;
1567 1569
1568 1570
1569#endif 1571#endif
1570 1572
1571} 1573}
1572 1574
1573void CalendarView::setSyncEventsReadOnly() 1575void CalendarView::setSyncEventsReadOnly()
1574{ 1576{
1575 Event * ev; 1577 Event * ev;
1576 QPtrList<Event> eL = mCalendar->rawEvents(); 1578 QPtrList<Event> eL = mCalendar->rawEvents();
1577 ev = eL.first(); 1579 ev = eL.first();
1578 while ( ev ) { 1580 while ( ev ) {
1579 if ( ev->uid().left(15) == QString("last-syncEvent-") ) 1581 if ( ev->uid().left(15) == QString("last-syncEvent-") )
1580 ev->setReadOnly( true ); 1582 ev->setReadOnly( true );
1581 ev = eL.next(); 1583 ev = eL.next();
1582 } 1584 }
1583} 1585}
1584bool CalendarView::openCalendar(QString filename, bool merge) 1586bool CalendarView::openCalendar(QString filename, bool merge)
1585{ 1587{
1586 1588
1587 if (filename.isEmpty()) { 1589 if (filename.isEmpty()) {
1588 return false; 1590 return false;
1589 } 1591 }
1590 1592
1591 if (!QFile::exists(filename)) { 1593 if (!QFile::exists(filename)) {
1592 KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); 1594 KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename));
1593 return false; 1595 return false;
1594 } 1596 }
1595 1597
1596 globalFlagBlockAgenda = 1; 1598 globalFlagBlockAgenda = 1;
1597 if (!merge) mCalendar->close(); 1599 if (!merge) mCalendar->close();
1598 1600
1599 mStorage->setFileName( filename ); 1601 mStorage->setFileName( filename );
1600 1602
1601 if ( mStorage->load() ) { 1603 if ( mStorage->load() ) {
1602 if ( merge ) ;//setModified( true ); 1604 if ( merge ) ;//setModified( true );
1603 else { 1605 else {
1604 //setModified( true ); 1606 //setModified( true );
1605 mViewManager->setDocumentId( filename ); 1607 mViewManager->setDocumentId( filename );
1606 mDialogManager->setDocumentId( filename ); 1608 mDialogManager->setDocumentId( filename );
1607 mTodoList->setDocumentId( filename ); 1609 mTodoList->setDocumentId( filename );
1608 } 1610 }
1609 globalFlagBlockAgenda = 2; 1611 globalFlagBlockAgenda = 2;
1610 // if ( getLastSyncEvent() ) 1612 // if ( getLastSyncEvent() )
1611 // getLastSyncEvent()->setReadOnly( true ); 1613 // getLastSyncEvent()->setReadOnly( true );
1612 mCalendar->reInitAlarmSettings(); 1614 mCalendar->reInitAlarmSettings();
1613 setSyncEventsReadOnly(); 1615 setSyncEventsReadOnly();
1614 updateUnmanagedViews(); 1616 updateUnmanagedViews();
1615 updateView(); 1617 updateView();
1616 if ( filename != MainWindow::defaultFileName() ) { 1618 if ( filename != MainWindow::defaultFileName() ) {
1617 saveCalendar( MainWindow::defaultFileName() ); 1619 saveCalendar( MainWindow::defaultFileName() );
1618 } else { 1620 } else {
1619 QFileInfo finf ( MainWindow::defaultFileName()); 1621 QFileInfo finf ( MainWindow::defaultFileName());
1620 if ( finf.exists() ) { 1622 if ( finf.exists() ) {
1621 setLoadedFileVersion( finf.lastModified () ); 1623 setLoadedFileVersion( finf.lastModified () );
1622 } 1624 }
1623 } 1625 }
1624 return true; 1626 return true;
1625 } else { 1627 } else {
1626 // while failing to load, the calendar object could 1628 // while failing to load, the calendar object could
1627 // have become partially populated. Clear it out. 1629 // have become partially populated. Clear it out.
1628 if ( !merge ) { 1630 if ( !merge ) {
1629 mCalendar->close(); 1631 mCalendar->close();
1630 mViewManager->setDocumentId( filename ); 1632 mViewManager->setDocumentId( filename );
1631 mDialogManager->setDocumentId( filename ); 1633 mDialogManager->setDocumentId( filename );
1632 mTodoList->setDocumentId( filename ); 1634 mTodoList->setDocumentId( filename );
1633 } 1635 }
1634 1636
1635 //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); 1637 //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename));
1636 1638
1637 QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); 1639 QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) );
1638 globalFlagBlockAgenda = 2; 1640 globalFlagBlockAgenda = 2;
1639 mCalendar->reInitAlarmSettings(); 1641 mCalendar->reInitAlarmSettings();
1640 setSyncEventsReadOnly(); 1642 setSyncEventsReadOnly();
1641 updateUnmanagedViews(); 1643 updateUnmanagedViews();
1642 updateView(); 1644 updateView();
1643 } 1645 }
1644 return false; 1646 return false;
1645} 1647}
1646void CalendarView::showOpenError() 1648void CalendarView::showOpenError()
1647{ 1649{
1648 KMessageBox::error(this,i18n("Couldn't load calendar\n.")); 1650 KMessageBox::error(this,i18n("Couldn't load calendar\n."));
1649} 1651}
1650void CalendarView::setLoadedFileVersion(QDateTime dt) 1652void CalendarView::setLoadedFileVersion(QDateTime dt)
1651{ 1653{
1652 loadedFileVersion = dt; 1654 loadedFileVersion = dt;
1653} 1655}
1654bool CalendarView::checkFileChanged(QString fn) 1656bool CalendarView::checkFileChanged(QString fn)
1655{ 1657{
1656 QFileInfo finf ( fn ); 1658 QFileInfo finf ( fn );
1657 if ( !finf.exists() ) 1659 if ( !finf.exists() )
1658 return true; 1660 return true;
1659 QDateTime dt = finf.lastModified (); 1661 QDateTime dt = finf.lastModified ();
1660 if ( dt <= loadedFileVersion ) 1662 if ( dt <= loadedFileVersion )
1661 return false; 1663 return false;
1662 return true; 1664 return true;
1663 1665
1664} 1666}
1665void CalendarView::watchSavedFile() 1667void CalendarView::watchSavedFile()
1666{ 1668{
1667 QFileInfo finf ( MainWindow::defaultFileName()); 1669 QFileInfo finf ( MainWindow::defaultFileName());
1668 if ( !finf.exists() ) 1670 if ( !finf.exists() )
1669 return; 1671 return;
1670 QDateTime dt = finf.lastModified (); 1672 QDateTime dt = finf.lastModified ();
1671 if ( dt < loadedFileVersion ) { 1673 if ( dt < loadedFileVersion ) {
1672 //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); 1674 //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1());
1673 QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); 1675 QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) );
1674 return; 1676 return;
1675 } 1677 }
1676 loadedFileVersion = dt; 1678 loadedFileVersion = dt;
1677} 1679}
1678 1680
1679bool CalendarView::checkFileVersion(QString fn) 1681bool CalendarView::checkFileVersion(QString fn)
1680{ 1682{
1681 QFileInfo finf ( fn ); 1683 QFileInfo finf ( fn );
1682 if ( !finf.exists() ) 1684 if ( !finf.exists() )
1683 return true; 1685 return true;
1684 QDateTime dt = finf.lastModified (); 1686 QDateTime dt = finf.lastModified ();
1685 //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); 1687 //qDebug("loaded file version %s",loadedFileVersion.toString().latin1());
1686 //qDebug("file on disk version %s",dt.toString().latin1()); 1688 //qDebug("file on disk version %s",dt.toString().latin1());
1687 if ( dt <= loadedFileVersion ) 1689 if ( dt <= loadedFileVersion )
1688 return true; 1690 return true;
1689 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)) , 1691 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)) ,
1690 i18n("KO/Pi Warning"),i18n("Overwrite"), 1692 i18n("KO/Pi Warning"),i18n("Overwrite"),
1691 i18n("Sync+save")); 1693 i18n("Sync+save"));
1692 1694
1693 if ( km == KMessageBox::Cancel ) 1695 if ( km == KMessageBox::Cancel )
1694 return false; 1696 return false;
1695 if ( km == KMessageBox::Yes ) 1697 if ( km == KMessageBox::Yes )
1696 return true; 1698 return true;
1697 1699
1698 setSyncDevice("deleteaftersync" ); 1700 setSyncDevice("deleteaftersync" );
1699 mSyncManager->mAskForPreferences = true; 1701 mSyncManager->mAskForPreferences = true;
1700 mSyncManager->mSyncAlgoPrefs = 3; 1702 mSyncManager->mSyncAlgoPrefs = 3;
1701 mSyncManager->mWriteBackFile = false; 1703 mSyncManager->mWriteBackFile = false;
1702 mSyncManager->mWriteBackExistingOnly = false; 1704 mSyncManager->mWriteBackExistingOnly = false;
1703 mSyncManager->mShowSyncSummary = false; 1705 mSyncManager->mShowSyncSummary = false;
1704 syncCalendar( fn, 3 ); 1706 syncCalendar( fn, 3 );
1705 Event * e = getLastSyncEvent(); 1707 Event * e = getLastSyncEvent();
1706 mCalendar->deleteEvent ( e ); 1708 mCalendar->deleteEvent ( e );
1707 updateView(); 1709 updateView();
1708 return true; 1710 return true;
1709} 1711}
1710 1712
1711bool CalendarView::saveCalendar( QString filename ) 1713bool CalendarView::saveCalendar( QString filename )
1712{ 1714{
1713 1715
1714 // Store back all unsaved data into calendar object 1716 // Store back all unsaved data into calendar object
1715 // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); 1717 // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() );
1716 if ( mViewManager->currentView() ) 1718 if ( mViewManager->currentView() )
1717 mViewManager->currentView()->flushView(); 1719 mViewManager->currentView()->flushView();
1718 1720
1719 1721
1720 QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); 1722 QDateTime lfv = QDateTime::currentDateTime().addSecs( -2);
1721 mStorage->setSaveFormat( new ICalFormat() ); 1723 mStorage->setSaveFormat( new ICalFormat() );
1722 mStorage->setFileName( filename ); 1724 mStorage->setFileName( filename );
1723 bool success; 1725 bool success;
1724 success = mStorage->save(); 1726 success = mStorage->save();
1725 if ( !success ) { 1727 if ( !success ) {
1726 return false; 1728 return false;
1727 } 1729 }
1728 if ( filename == MainWindow::defaultFileName() ) { 1730 if ( filename == MainWindow::defaultFileName() ) {
1729 setLoadedFileVersion( lfv ); 1731 setLoadedFileVersion( lfv );
1730 watchSavedFile(); 1732 watchSavedFile();
1731 } 1733 }
1732 return true; 1734 return true;
1733} 1735}
1734 1736
1735void CalendarView::closeCalendar() 1737void CalendarView::closeCalendar()
1736{ 1738{
1737 1739
1738 // child windows no longer valid 1740 // child windows no longer valid
1739 emit closingDown(); 1741 emit closingDown();
1740 1742
1741 mCalendar->close(); 1743 mCalendar->close();
1742 setModified(false); 1744 setModified(false);
1743 updateView(); 1745 updateView();
1744} 1746}
1745 1747
1746void CalendarView::archiveCalendar() 1748void CalendarView::archiveCalendar()
1747{ 1749{
1748 mDialogManager->showArchiveDialog(); 1750 mDialogManager->showArchiveDialog();
1749} 1751}
1750 1752
1751 1753
1752void CalendarView::readSettings() 1754void CalendarView::readSettings()
1753{ 1755{
1754 1756
1755 1757
1756 // mViewManager->showAgendaView(); 1758 // mViewManager->showAgendaView();
1757 QString str; 1759 QString str;
1758 //qDebug("CalendarView::readSettings() "); 1760 //qDebug("CalendarView::readSettings() ");
1759 // read settings from the KConfig, supplying reasonable 1761 // read settings from the KConfig, supplying reasonable
1760 // defaults where none are to be found 1762 // defaults where none are to be found
1761 KConfig *config = KOGlobals::config(); 1763 KConfig *config = KOGlobals::config();
1762#ifndef KORG_NOSPLITTER 1764#ifndef KORG_NOSPLITTER
1763 config->setGroup("KOrganizer Geometry"); 1765 config->setGroup("KOrganizer Geometry");
1764 1766
1765 QValueList<int> sizes = config->readIntListEntry("Separator1"); 1767 QValueList<int> sizes = config->readIntListEntry("Separator1");
1766 if (sizes.count() != 2) { 1768 if (sizes.count() != 2) {
1767 sizes << mDateNavigator->minimumSizeHint().width(); 1769 sizes << mDateNavigator->minimumSizeHint().width();
1768 sizes << 300; 1770 sizes << 300;
1769 } 1771 }
1770 mPanner->setSizes(sizes); 1772 mPanner->setSizes(sizes);
1771 1773
1772 sizes = config->readIntListEntry("Separator2"); 1774 sizes = config->readIntListEntry("Separator2");
1773 if ( ( mResourceView && sizes.count() == 4 ) || 1775 if ( ( mResourceView && sizes.count() == 4 ) ||
1774 ( !mResourceView && sizes.count() == 3 ) ) { 1776 ( !mResourceView && sizes.count() == 3 ) ) {
1775 mLeftSplitter->setSizes(sizes); 1777 mLeftSplitter->setSizes(sizes);
1776 } 1778 }
1777#endif 1779#endif
1778 globalFlagBlockAgenda = 1; 1780 globalFlagBlockAgenda = 1;
1779 mViewManager->showAgendaView(); 1781 mViewManager->showAgendaView();
1780 //mViewManager->readSettings( config ); 1782 //mViewManager->readSettings( config );
1781 mTodoList->restoreLayout(config,QString("Todo Layout")); 1783 mTodoList->restoreLayout(config,QString("Todo Layout"));
1782 readFilterSettings(config); 1784 readFilterSettings(config);
1783 config->setGroup( "Views" ); 1785 config->setGroup( "Views" );
1784 int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); 1786 int dateCount = config->readNumEntry( "ShownDatesCount", 7 );
1785 if ( dateCount == 5 ) mNavigator->selectWorkWeek(); 1787 if ( dateCount == 5 ) mNavigator->selectWorkWeek();
1786 else if ( dateCount == 7 ) mNavigator->selectWeek(); 1788 else if ( dateCount == 7 ) mNavigator->selectWeek();
1787 else mNavigator->selectDates( dateCount ); 1789 else mNavigator->selectDates( dateCount );
1788 // mViewManager->readSettings( config ); 1790 // mViewManager->readSettings( config );
1789 updateConfig(); 1791 updateConfig();
1790 globalFlagBlockAgenda = 2; 1792 globalFlagBlockAgenda = 2;
1791 mViewManager->readSettings( config ); 1793 mViewManager->readSettings( config );
1792#ifdef DESKTOP_VERSION 1794#ifdef DESKTOP_VERSION
1793 config->setGroup("WidgetLayout"); 1795 config->setGroup("WidgetLayout");
1794 QStringList list; 1796 QStringList list;
1795 list = config->readListEntry("MainLayout"); 1797 list = config->readListEntry("MainLayout");
1796 int x,y,w,h; 1798 int x,y,w,h;
1797 if ( ! list.isEmpty() ) { 1799 if ( ! list.isEmpty() ) {
1798 x = list[0].toInt(); 1800 x = list[0].toInt();
1799 y = list[1].toInt(); 1801 y = list[1].toInt();
1800 w = list[2].toInt(); 1802 w = list[2].toInt();
1801 h = list[3].toInt(); 1803 h = list[3].toInt();
1802 topLevelWidget()->setGeometry(x,y,w,h); 1804 topLevelWidget()->setGeometry(x,y,w,h);
1803 1805
1804 } else { 1806 } else {
1805 topLevelWidget()->setGeometry( 40 ,40 , 640, 440); 1807 topLevelWidget()->setGeometry( 40 ,40 , 640, 440);
1806 } 1808 }
1807 list = config->readListEntry("EditEventLayout"); 1809 list = config->readListEntry("EditEventLayout");
1808 if ( ! list.isEmpty() ) { 1810 if ( ! list.isEmpty() ) {
1809 x = list[0].toInt(); 1811 x = list[0].toInt();
1810 y = list[1].toInt(); 1812 y = list[1].toInt();
1811 w = list[2].toInt(); 1813 w = list[2].toInt();
1812 h = list[3].toInt(); 1814 h = list[3].toInt();
1813 mEventEditor->setGeometry(x,y,w,h); 1815 mEventEditor->setGeometry(x,y,w,h);
1814 1816
1815 } 1817 }
1816 list = config->readListEntry("EditTodoLayout"); 1818 list = config->readListEntry("EditTodoLayout");
1817 if ( ! list.isEmpty() ) { 1819 if ( ! list.isEmpty() ) {
1818 x = list[0].toInt(); 1820 x = list[0].toInt();
1819 y = list[1].toInt(); 1821 y = list[1].toInt();
1820 w = list[2].toInt(); 1822 w = list[2].toInt();
1821 h = list[3].toInt(); 1823 h = list[3].toInt();
1822 mTodoEditor->setGeometry(x,y,w,h); 1824 mTodoEditor->setGeometry(x,y,w,h);
1823 1825
1824 } 1826 }
1825 list = config->readListEntry("ViewerLayout"); 1827 list = config->readListEntry("ViewerLayout");
1826 if ( ! list.isEmpty() ) { 1828 if ( ! list.isEmpty() ) {
1827 x = list[0].toInt(); 1829 x = list[0].toInt();
1828 y = list[1].toInt(); 1830 y = list[1].toInt();
1829 w = list[2].toInt(); 1831 w = list[2].toInt();
1830 h = list[3].toInt(); 1832 h = list[3].toInt();
1831 getEventViewerDialog()->setGeometry(x,y,w,h); 1833 getEventViewerDialog()->setGeometry(x,y,w,h);
1832 } 1834 }
1833#endif 1835#endif
1834 1836
1835} 1837}
1836 1838
1837 1839
1838void CalendarView::writeSettings() 1840void CalendarView::writeSettings()
1839{ 1841{
1840 // kdDebug() << "CalendarView::writeSettings" << endl; 1842 // kdDebug() << "CalendarView::writeSettings" << endl;
1841 1843
1842 KConfig *config = KOGlobals::config(); 1844 KConfig *config = KOGlobals::config();
1843 1845
1844#ifndef KORG_NOSPLITTER 1846#ifndef KORG_NOSPLITTER
1845 config->setGroup("KOrganizer Geometry"); 1847 config->setGroup("KOrganizer Geometry");
1846 1848
1847 QValueList<int> list = mPanner->sizes(); 1849 QValueList<int> list = mPanner->sizes();
1848 config->writeEntry("Separator1",list); 1850 config->writeEntry("Separator1",list);
1849 1851
1850 list = mLeftSplitter->sizes(); 1852 list = mLeftSplitter->sizes();
1851 config->writeEntry("Separator2",list); 1853 config->writeEntry("Separator2",list);
1852#endif 1854#endif
1853 1855
1854 mViewManager->writeSettings( config ); 1856 mViewManager->writeSettings( config );
1855 mTodoList->saveLayout(config,QString("Todo Layout")); 1857 mTodoList->saveLayout(config,QString("Todo Layout"));
1856 mDialogManager->writeSettings( config ); 1858 mDialogManager->writeSettings( config );
1857 //KOPrefs::instance()->usrWriteConfig(); 1859 //KOPrefs::instance()->usrWriteConfig();
1858 KOPrefs::instance()->writeConfig(); 1860 KOPrefs::instance()->writeConfig();
1859 1861
1860 writeFilterSettings(config); 1862 writeFilterSettings(config);
1861 1863
1862 config->setGroup( "Views" ); 1864 config->setGroup( "Views" );
1863 config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); 1865 config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() );
1864 1866
1865#ifdef DESKTOP_VERSION 1867#ifdef DESKTOP_VERSION
1866 config->setGroup("WidgetLayout"); 1868 config->setGroup("WidgetLayout");
1867 QStringList list ;//= config->readListEntry("MainLayout"); 1869 QStringList list ;//= config->readListEntry("MainLayout");
1868 int x,y,w,h; 1870 int x,y,w,h;
1869 QWidget* wid; 1871 QWidget* wid;
1870 wid = topLevelWidget(); 1872 wid = topLevelWidget();
1871 x = wid->geometry().x(); 1873 x = wid->geometry().x();
1872 y = wid->geometry().y(); 1874 y = wid->geometry().y();
1873 w = wid->width(); 1875 w = wid->width();
1874 h = wid->height(); 1876 h = wid->height();
1875 list.clear(); 1877 list.clear();
1876 list << QString::number( x ); 1878 list << QString::number( x );
1877 list << QString::number( y ); 1879 list << QString::number( y );
1878 list << QString::number( w ); 1880 list << QString::number( w );
1879 list << QString::number( h ); 1881 list << QString::number( h );
1880 config->writeEntry("MainLayout",list ); 1882 config->writeEntry("MainLayout",list );
1881 1883
1882 wid = mEventEditor; 1884 wid = mEventEditor;
1883 x = wid->geometry().x(); 1885 x = wid->geometry().x();
1884 y = wid->geometry().y(); 1886 y = wid->geometry().y();
1885 w = wid->width(); 1887 w = wid->width();
1886 h = wid->height(); 1888 h = wid->height();
1887 list.clear(); 1889 list.clear();
1888 list << QString::number( x ); 1890 list << QString::number( x );
1889 list << QString::number( y ); 1891 list << QString::number( y );
1890 list << QString::number( w ); 1892 list << QString::number( w );
1891 list << QString::number( h ); 1893 list << QString::number( h );
1892 config->writeEntry("EditEventLayout",list ); 1894 config->writeEntry("EditEventLayout",list );
1893 1895
1894 wid = mTodoEditor; 1896 wid = mTodoEditor;
1895 x = wid->geometry().x(); 1897 x = wid->geometry().x();
1896 y = wid->geometry().y(); 1898 y = wid->geometry().y();
1897 w = wid->width(); 1899 w = wid->width();
1898 h = wid->height(); 1900 h = wid->height();
1899 list.clear(); 1901 list.clear();
1900 list << QString::number( x ); 1902 list << QString::number( x );
1901 list << QString::number( y ); 1903 list << QString::number( y );
1902 list << QString::number( w ); 1904 list << QString::number( w );
1903 list << QString::number( h ); 1905 list << QString::number( h );
1904 config->writeEntry("EditTodoLayout",list ); 1906 config->writeEntry("EditTodoLayout",list );
1905 wid = getEventViewerDialog(); 1907 wid = getEventViewerDialog();
1906 x = wid->geometry().x(); 1908 x = wid->geometry().x();
1907 y = wid->geometry().y(); 1909 y = wid->geometry().y();
1908 w = wid->width(); 1910 w = wid->width();
1909 h = wid->height(); 1911 h = wid->height();
1910 list.clear(); 1912 list.clear();
1911 list << QString::number( x ); 1913 list << QString::number( x );
1912 list << QString::number( y ); 1914 list << QString::number( y );
1913 list << QString::number( w ); 1915 list << QString::number( w );
1914 list << QString::number( h ); 1916 list << QString::number( h );
1915 config->writeEntry("ViewerLayout",list ); 1917 config->writeEntry("ViewerLayout",list );
1916 wid = mDialogManager->getSearchDialog(); 1918 wid = mDialogManager->getSearchDialog();
1917 if ( wid ) { 1919 if ( wid ) {
1918 x = wid->geometry().x(); 1920 x = wid->geometry().x();
1919 y = wid->geometry().y(); 1921 y = wid->geometry().y();
1920 w = wid->width(); 1922 w = wid->width();
1921 h = wid->height(); 1923 h = wid->height();
1922 list.clear(); 1924 list.clear();
1923 list << QString::number( x ); 1925 list << QString::number( x );
1924 list << QString::number( y ); 1926 list << QString::number( y );
1925 list << QString::number( w ); 1927 list << QString::number( w );
1926 list << QString::number( h ); 1928 list << QString::number( h );
1927 config->writeEntry("SearchLayout",list ); 1929 config->writeEntry("SearchLayout",list );
1928 } 1930 }
1929#endif 1931#endif
1930 1932
1931 1933
1932 config->sync(); 1934 config->sync();
1933} 1935}
1934 1936
1935void CalendarView::readFilterSettings(KConfig *config) 1937void CalendarView::readFilterSettings(KConfig *config)
1936{ 1938{
1937 // kdDebug() << "CalendarView::readFilterSettings()" << endl; 1939 // kdDebug() << "CalendarView::readFilterSettings()" << endl;
1938 1940
1939 mFilters.clear(); 1941 mFilters.clear();
1940 1942
1941 config->setGroup("General"); 1943 config->setGroup("General");
1942 QStringList filterList = config->readListEntry("CalendarFilters"); 1944 QStringList filterList = config->readListEntry("CalendarFilters");
1943 1945
1944 QStringList::ConstIterator it = filterList.begin(); 1946 QStringList::ConstIterator it = filterList.begin();
1945 QStringList::ConstIterator end = filterList.end(); 1947 QStringList::ConstIterator end = filterList.end();
1946 while(it != end) { 1948 while(it != end) {
1947 // kdDebug() << " filter: " << (*it) << endl; 1949 // kdDebug() << " filter: " << (*it) << endl;
1948 1950
1949 CalFilter *filter; 1951 CalFilter *filter;
1950 filter = new CalFilter(*it); 1952 filter = new CalFilter(*it);
1951 config->setGroup("Filter_" + (*it)); 1953 config->setGroup("Filter_" + (*it));
1952 //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); 1954 //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) );
1953 filter->setCriteria(config->readNumEntry("Criteria",0)); 1955 filter->setCriteria(config->readNumEntry("Criteria",0));
1954 filter->setCategoryList(config->readListEntry("CategoryList")); 1956 filter->setCategoryList(config->readListEntry("CategoryList"));
1955 mFilters.append(filter); 1957 mFilters.append(filter);
1956 1958
1957 ++it; 1959 ++it;
1958 } 1960 }
1959 1961
1960 if (mFilters.count() == 0) { 1962 if (mFilters.count() == 0) {
1961 CalFilter *filter = new CalFilter(i18n("Default")); 1963 CalFilter *filter = new CalFilter(i18n("Default"));
1962 mFilters.append(filter); 1964 mFilters.append(filter);
1963 } 1965 }
1964 mFilterView->updateFilters(); 1966 mFilterView->updateFilters();
1965 config->setGroup("FilterView"); 1967 config->setGroup("FilterView");
1966 1968
1967 mFilterView->blockSignals(true); 1969 mFilterView->blockSignals(true);
1968 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); 1970 mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled"));
1969 mFilterView->setSelectedFilter(config->readEntry("Current Filter")); 1971 mFilterView->setSelectedFilter(config->readEntry("Current Filter"));
1970 mFilterView->blockSignals(false); 1972 mFilterView->blockSignals(false);
1971 // We do it manually to avoid it being done twice by the above calls 1973 // We do it manually to avoid it being done twice by the above calls
1972 updateFilter(); 1974 updateFilter();
1973} 1975}
1974 1976
1975void CalendarView::writeFilterSettings(KConfig *config) 1977void CalendarView::writeFilterSettings(KConfig *config)
1976{ 1978{
1977 // kdDebug() << "CalendarView::writeFilterSettings()" << endl; 1979 // kdDebug() << "CalendarView::writeFilterSettings()" << endl;
1978 1980
1979 QStringList filterList; 1981 QStringList filterList;
1980 1982
1981 CalFilter *filter = mFilters.first(); 1983 CalFilter *filter = mFilters.first();
1982 while(filter) { 1984 while(filter) {
1983 // kdDebug() << " fn: " << filter->name() << endl; 1985 // kdDebug() << " fn: " << filter->name() << endl;
1984 filterList << filter->name(); 1986 filterList << filter->name();
1985 config->setGroup("Filter_" + filter->name()); 1987 config->setGroup("Filter_" + filter->name());
1986 config->writeEntry("Criteria",filter->criteria()); 1988 config->writeEntry("Criteria",filter->criteria());
1987 config->writeEntry("CategoryList",filter->categoryList()); 1989 config->writeEntry("CategoryList",filter->categoryList());
1988 filter = mFilters.next(); 1990 filter = mFilters.next();
1989 } 1991 }
1990 config->setGroup("General"); 1992 config->setGroup("General");
1991 config->writeEntry("CalendarFilters",filterList); 1993 config->writeEntry("CalendarFilters",filterList);
1992 1994
1993 config->setGroup("FilterView"); 1995 config->setGroup("FilterView");
1994 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); 1996 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled());
1995 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); 1997 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name());
1996} 1998}
1997 1999
1998 2000
1999void CalendarView::goToday() 2001void CalendarView::goToday()
2000{ 2002{
2001 if ( mViewManager->currentView()->isMonthView() ) 2003 if ( mViewManager->currentView()->isMonthView() )
2002 mNavigator->selectTodayMonth(); 2004 mNavigator->selectTodayMonth();
2003 else 2005 else
2004 mNavigator->selectToday(); 2006 mNavigator->selectToday();
2005} 2007}
2006 2008
2007void CalendarView::goNext() 2009void CalendarView::goNext()
2008{ 2010{
2009 mNavigator->selectNext(); 2011 mNavigator->selectNext();
2010} 2012}
2011 2013
2012void CalendarView::goPrevious() 2014void CalendarView::goPrevious()
2013{ 2015{
2014 mNavigator->selectPrevious(); 2016 mNavigator->selectPrevious();
2015} 2017}
2016void CalendarView::goNextMonth() 2018void CalendarView::goNextMonth()
2017{ 2019{
2018 mNavigator->selectNextMonth(); 2020 mNavigator->selectNextMonth();
2019} 2021}
2020 2022
2021void CalendarView::goPreviousMonth() 2023void CalendarView::goPreviousMonth()
2022{ 2024{
2023 mNavigator->selectPreviousMonth(); 2025 mNavigator->selectPreviousMonth();
2024} 2026}
2025void CalendarView::writeLocale() 2027void CalendarView::writeLocale()
2026{ 2028{
2027 //KPimGlobalPrefs::instance()->setGlobalConfig(); 2029 //KPimGlobalPrefs::instance()->setGlobalConfig();
2028#if 0 2030#if 0
2029 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); 2031 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime );
2030 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); 2032 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday );
2031 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); 2033 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate );
2032 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); 2034 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage );
2033 QString dummy = KOPrefs::instance()->mUserDateFormatLong; 2035 QString dummy = KOPrefs::instance()->mUserDateFormatLong;
2034 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); 2036 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
2035 dummy = KOPrefs::instance()->mUserDateFormatShort; 2037 dummy = KOPrefs::instance()->mUserDateFormatShort;
2036 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); 2038 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
2037 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, 2039 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving,
2038 KOPrefs::instance()->mDaylightsavingStart, 2040 KOPrefs::instance()->mDaylightsavingStart,
2039 KOPrefs::instance()->mDaylightsavingEnd ); 2041 KOPrefs::instance()->mDaylightsavingEnd );
2040 KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId ); 2042 KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId );
2041#endif 2043#endif
2042} 2044}
2043void CalendarView::updateConfig() 2045void CalendarView::updateConfig()
2044{ 2046{
2045 writeLocale(); 2047 writeLocale();
2046 if ( KOPrefs::instance()->mUseAppColors ) 2048 if ( KOPrefs::instance()->mUseAppColors )
2047 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 2049 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
2048 emit configChanged(); 2050 emit configChanged();
2049 mTodoList->updateConfig(); 2051 mTodoList->updateConfig();
2050 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); 2052 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont);
2051 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2053 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2052 // To make the "fill window" configurations work 2054 // To make the "fill window" configurations work
2053 //mViewManager->raiseCurrentView(); 2055 //mViewManager->raiseCurrentView();
2054} 2056}
2055 2057
2056 2058
2057void CalendarView::eventChanged(Event *event) 2059void CalendarView::eventChanged(Event *event)
2058{ 2060{
2059 changeEventDisplay(event,KOGlobals::EVENTEDITED); 2061 changeEventDisplay(event,KOGlobals::EVENTEDITED);
2060 //updateUnmanagedViews(); 2062 //updateUnmanagedViews();
2061} 2063}
2062 2064
2063void CalendarView::eventAdded(Event *event) 2065void CalendarView::eventAdded(Event *event)
2064{ 2066{
2065 changeEventDisplay(event,KOGlobals::EVENTADDED); 2067 changeEventDisplay(event,KOGlobals::EVENTADDED);
2066} 2068}
2067 2069
2068void CalendarView::eventToBeDeleted(Event *) 2070void CalendarView::eventToBeDeleted(Event *)
2069{ 2071{
2070 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; 2072 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl;
2071} 2073}
2072 2074
2073void CalendarView::eventDeleted() 2075void CalendarView::eventDeleted()
2074{ 2076{
2075 changeEventDisplay(0,KOGlobals::EVENTDELETED); 2077 changeEventDisplay(0,KOGlobals::EVENTDELETED);
2076} 2078}
2077void CalendarView::changeTodoDisplay(Todo *which, int action) 2079void CalendarView::changeTodoDisplay(Todo *which, int action)
2078{ 2080{
2079 changeIncidenceDisplay((Incidence *)which, action); 2081 changeIncidenceDisplay((Incidence *)which, action);
2080 mDateNavigator->updateView(); //LR 2082 mDateNavigator->updateView(); //LR
2081 //mDialogManager->updateSearchDialog(); 2083 //mDialogManager->updateSearchDialog();
2082 2084
2083 if (which) { 2085 if (which) {
2084 mViewManager->updateWNview(); 2086 mViewManager->updateWNview();
2085 //mTodoList->updateView(); 2087 //mTodoList->updateView();
2086 } 2088 }
2087 2089
2088} 2090}
2089 2091
2090void CalendarView::changeIncidenceDisplay(Incidence *which, int action) 2092void CalendarView::changeIncidenceDisplay(Incidence *which, int action)
2091{ 2093{
2092 updateUnmanagedViews(); 2094 updateUnmanagedViews();
2093 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); 2095 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action );
2094 if ( action == KOGlobals::EVENTDELETED ) { //delete 2096 if ( action == KOGlobals::EVENTDELETED ) { //delete
2095 mCalendar->checkAlarmForIncidence( 0, true ); 2097 mCalendar->checkAlarmForIncidence( 0, true );
2096 if ( mEventViewerDialog ) 2098 if ( mEventViewerDialog )
2097 mEventViewerDialog->hide(); 2099 mEventViewerDialog->hide();
2098 } 2100 }
2099 else 2101 else
2100 mCalendar->checkAlarmForIncidence( which , false ); 2102 mCalendar->checkAlarmForIncidence( which , false );
2101} 2103}
2102 2104
2103// most of the changeEventDisplays() right now just call the view's 2105// most of the changeEventDisplays() right now just call the view's
2104// total update mode, but they SHOULD be recoded to be more refresh-efficient. 2106// total update mode, but they SHOULD be recoded to be more refresh-efficient.
2105void CalendarView::changeEventDisplay(Event *which, int action) 2107void CalendarView::changeEventDisplay(Event *which, int action)
2106{ 2108{
2107 // kdDebug() << "CalendarView::changeEventDisplay" << endl; 2109 // kdDebug() << "CalendarView::changeEventDisplay" << endl;
2108 changeIncidenceDisplay((Incidence *)which, action); 2110 changeIncidenceDisplay((Incidence *)which, action);
2109 mDateNavigator->updateView(); 2111 mDateNavigator->updateView();
2110 //mDialogManager->updateSearchDialog(); 2112 //mDialogManager->updateSearchDialog();
2111 2113
2112 if (which) { 2114 if (which) {
2113 // If there is an event view visible update the display 2115 // If there is an event view visible update the display
2114 mViewManager->currentView()->changeEventDisplay(which,action); 2116 mViewManager->currentView()->changeEventDisplay(which,action);
2115 // TODO: check, if update needed 2117 // TODO: check, if update needed
2116 // if (which->getTodoStatus()) { 2118 // if (which->getTodoStatus()) {
2117 mTodoList->updateView(); 2119 mTodoList->updateView();
2118 // } 2120 // }
2119 } else { 2121 } else {
2120 mViewManager->currentView()->updateView(); 2122 mViewManager->currentView()->updateView();
2121 } 2123 }
2122} 2124}
2123 2125
2124 2126
2125void CalendarView::updateTodoViews() 2127void CalendarView::updateTodoViews()
2126{ 2128{
2127 2129
2128 mTodoList->updateView(); 2130 mTodoList->updateView();
2129 mViewManager->currentView()->updateView(); 2131 mViewManager->currentView()->updateView();
2130 2132
2131} 2133}
2132 2134
2133 2135
2134void CalendarView::updateView(const QDate &start, const QDate &end) 2136void CalendarView::updateView(const QDate &start, const QDate &end)
2135{ 2137{
2136 mTodoList->updateView(); 2138 mTodoList->updateView();
2137 mViewManager->updateView(start, end); 2139 mViewManager->updateView(start, end);
2138 //mDateNavigator->updateView(); 2140 //mDateNavigator->updateView();
2139} 2141}
2140 2142
2141void CalendarView::updateView() 2143void CalendarView::updateView()
2142{ 2144{
2143 DateList tmpList = mNavigator->selectedDates(); 2145 DateList tmpList = mNavigator->selectedDates();
2144 2146
2145 // We assume that the navigator only selects consecutive days. 2147 // We assume that the navigator only selects consecutive days.
2146 updateView( tmpList.first(), tmpList.last() ); 2148 updateView( tmpList.first(), tmpList.last() );
2149 if ( KOPrefs::instance()->mHideNonStartedTodos )
2150 mTodoList->updateView();
2147} 2151}
2148 2152
2149void CalendarView::updateUnmanagedViews() 2153void CalendarView::updateUnmanagedViews()
2150{ 2154{
2151 mDateNavigator->updateDayMatrix(); 2155 mDateNavigator->updateDayMatrix();
2152} 2156}
2153 2157
2154int CalendarView::msgItemDelete() 2158int CalendarView::msgItemDelete()
2155{ 2159{
2156 return KMessageBox::warningContinueCancel(this, 2160 return KMessageBox::warningContinueCancel(this,
2157 i18n("This item will be\npermanently deleted."), 2161 i18n("This item will be\npermanently deleted."),
2158 i18n("KO/Pi Confirmation"),i18n("Delete")); 2162 i18n("KO/Pi Confirmation"),i18n("Delete"));
2159} 2163}
2160 2164
2161 2165
2162void CalendarView::edit_cut() 2166void CalendarView::edit_cut()
2163{ 2167{
2164 Event *anEvent=0; 2168 Event *anEvent=0;
2165 2169
2166 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2170 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2167 2171
2168 if (mViewManager->currentView()->isEventView()) { 2172 if (mViewManager->currentView()->isEventView()) {
2169 if ( incidence && incidence->type() == "Event" ) { 2173 if ( incidence && incidence->type() == "Event" ) {
2170 anEvent = static_cast<Event *>(incidence); 2174 anEvent = static_cast<Event *>(incidence);
2171 } 2175 }
2172 } 2176 }
2173 2177
2174 if (!anEvent) { 2178 if (!anEvent) {
2175 KNotifyClient::beep(); 2179 KNotifyClient::beep();
2176 return; 2180 return;
2177 } 2181 }
2178 DndFactory factory( mCalendar ); 2182 DndFactory factory( mCalendar );
2179 factory.cutEvent(anEvent); 2183 factory.cutEvent(anEvent);
2180 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 2184 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
2181} 2185}
2182 2186
2183void CalendarView::edit_copy() 2187void CalendarView::edit_copy()
2184{ 2188{
2185 Event *anEvent=0; 2189 Event *anEvent=0;
2186 2190
2187 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2191 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2188 2192
2189 if (mViewManager->currentView()->isEventView()) { 2193 if (mViewManager->currentView()->isEventView()) {
2190 if ( incidence && incidence->type() == "Event" ) { 2194 if ( incidence && incidence->type() == "Event" ) {
2191 anEvent = static_cast<Event *>(incidence); 2195 anEvent = static_cast<Event *>(incidence);
2192 } 2196 }
2193 } 2197 }
2194 2198
2195 if (!anEvent) { 2199 if (!anEvent) {
2196 KNotifyClient::beep(); 2200 KNotifyClient::beep();
2197 return; 2201 return;
2198 } 2202 }
2199 DndFactory factory( mCalendar ); 2203 DndFactory factory( mCalendar );
2200 factory.copyEvent(anEvent); 2204 factory.copyEvent(anEvent);
2201} 2205}
2202 2206
2203void CalendarView::edit_paste() 2207void CalendarView::edit_paste()
2204{ 2208{
2205 QDate date = mNavigator->selectedDates().first(); 2209 QDate date = mNavigator->selectedDates().first();
2206 2210
2207 DndFactory factory( mCalendar ); 2211 DndFactory factory( mCalendar );
2208 Event *pastedEvent = factory.pasteEvent( date ); 2212 Event *pastedEvent = factory.pasteEvent( date );
2209 2213
2210 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); 2214 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED );
2211} 2215}
2212 2216
2213void CalendarView::edit_options() 2217void CalendarView::edit_options()
2214{ 2218{
2215 mDialogManager->showOptionsDialog(); 2219 mDialogManager->showOptionsDialog();
2216 //writeSettings(); 2220 //writeSettings();
2217} 2221}
2218 2222
2219 2223
2220void CalendarView::slotSelectPickerDate( QDate d) 2224void CalendarView::slotSelectPickerDate( QDate d)
2221{ 2225{
2222 mDateFrame->hide(); 2226 mDateFrame->hide();
2223 if ( mDatePickerMode == 1 ) { 2227 if ( mDatePickerMode == 1 ) {
2224 mNavigator->slotDaySelect( d ); 2228 mNavigator->slotDaySelect( d );
2225 } else if ( mDatePickerMode == 2 ) { 2229 } else if ( mDatePickerMode == 2 ) {
2226 if ( mMoveIncidence->type() == "Todo" ) { 2230 if ( mMoveIncidence->type() == "Todo" ) {
2227 Todo * to = (Todo *) mMoveIncidence; 2231 Todo * to = (Todo *) mMoveIncidence;
2228 QTime tim; 2232 QTime tim;
2229 if ( to->hasDueDate() ) 2233 if ( to->hasDueDate() )
2230 tim = to->dtDue().time(); 2234 tim = to->dtDue().time();
2231 else { 2235 else {
2232 tim = QTime ( 0,0,0 ); 2236 tim = QTime ( 0,0,0 );
2233 to->setFloats( true ); 2237 to->setFloats( true );
2234 to->setHasDueDate( true ); 2238 to->setHasDueDate( true );
2235 } 2239 }
2236 QDateTime dt ( d,tim ); 2240 QDateTime dt ( d,tim );
2237 to->setDtDue( dt ); 2241 to->setDtDue( dt );
2238 todoChanged( to ); 2242 todoChanged( to );
2239 } else { 2243 } else {
2240 if ( mMoveIncidence->doesRecur() ) { 2244 if ( mMoveIncidence->doesRecur() ) {
2241#if 0 2245#if 0
2242 // PENDING implement this 2246 // PENDING implement this
2243 Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); 2247 Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate );
2244 mCalendar()->addIncidence( newInc ); 2248 mCalendar()->addIncidence( newInc );
2245 if ( mMoveIncidence->type() == "Todo" ) 2249 if ( mMoveIncidence->type() == "Todo" )
2246 emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); 2250 emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED );
2247 else 2251 else
2248 emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); 2252 emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED);
2249 mMoveIncidence = newInc; 2253 mMoveIncidence = newInc;
2250 2254
2251#endif 2255#endif
2252 } 2256 }
2253 QTime tim = mMoveIncidence->dtStart().time(); 2257 QTime tim = mMoveIncidence->dtStart().time();
2254 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); 2258 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd());
2255 QDateTime dt ( d,tim ); 2259 QDateTime dt ( d,tim );
2256 mMoveIncidence->setDtStart( dt ); 2260 mMoveIncidence->setDtStart( dt );
2257 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); 2261 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) );
2258 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); 2262 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED);
2259 } 2263 }
2260 2264
2261 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); 2265 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 );
2262 } 2266 }
2263} 2267}
2264 2268
2265void CalendarView::removeCategories() 2269void CalendarView::removeCategories()
2266{ 2270{
2267 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2271 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2268 QStringList catList = KOPrefs::instance()->mCustomCategories; 2272 QStringList catList = KOPrefs::instance()->mCustomCategories;
2269 QStringList catIncList; 2273 QStringList catIncList;
2270 QStringList newCatList; 2274 QStringList newCatList;
2271 Incidence* inc = incList.first(); 2275 Incidence* inc = incList.first();
2272 int i; 2276 int i;
2273 int count = 0; 2277 int count = 0;
2274 while ( inc ) { 2278 while ( inc ) {
2275 newCatList.clear(); 2279 newCatList.clear();
2276 catIncList = inc->categories() ; 2280 catIncList = inc->categories() ;
2277 for( i = 0; i< catIncList.count(); ++i ) { 2281 for( i = 0; i< catIncList.count(); ++i ) {
2278 if ( catList.contains (catIncList[i])) 2282 if ( catList.contains (catIncList[i]))
2279 newCatList.append( catIncList[i] ); 2283 newCatList.append( catIncList[i] );
2280 } 2284 }
2281 newCatList.sort(); 2285 newCatList.sort();
2282 inc->setCategories( newCatList.join(",") ); 2286 inc->setCategories( newCatList.join(",") );
2283 inc = incList.next(); 2287 inc = incList.next();
2284 } 2288 }
2285} 2289}
2286 2290
2287int CalendarView::addCategories() 2291int CalendarView::addCategories()
2288{ 2292{
2289 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2293 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2290 QStringList catList = KOPrefs::instance()->mCustomCategories; 2294 QStringList catList = KOPrefs::instance()->mCustomCategories;
2291 QStringList catIncList; 2295 QStringList catIncList;
2292 Incidence* inc = incList.first(); 2296 Incidence* inc = incList.first();
2293 int i; 2297 int i;
2294 int count = 0; 2298 int count = 0;
2295 while ( inc ) { 2299 while ( inc ) {
2296 catIncList = inc->categories() ; 2300 catIncList = inc->categories() ;
2297 for( i = 0; i< catIncList.count(); ++i ) { 2301 for( i = 0; i< catIncList.count(); ++i ) {
2298 if ( !catList.contains (catIncList[i])) { 2302 if ( !catList.contains (catIncList[i])) {
2299 catList.append( catIncList[i] ); 2303 catList.append( catIncList[i] );
2300 //qDebug("add cat %s ", catIncList[i].latin1()); 2304 //qDebug("add cat %s ", catIncList[i].latin1());
2301 ++count; 2305 ++count;
2302 } 2306 }
2303 } 2307 }
2304 inc = incList.next(); 2308 inc = incList.next();
2305 } 2309 }
2306 catList.sort(); 2310 catList.sort();
2307 KOPrefs::instance()->mCustomCategories = catList; 2311 KOPrefs::instance()->mCustomCategories = catList;
2308 return count; 2312 return count;
2309} 2313}
2310 2314
2311void CalendarView::manageCategories() 2315void CalendarView::manageCategories()
2312{ 2316{
2313 KOCatPrefs* cp = new KOCatPrefs(); 2317 KOCatPrefs* cp = new KOCatPrefs();
2314 cp->show(); 2318 cp->show();
2315 int w =cp->sizeHint().width() ; 2319 int w =cp->sizeHint().width() ;
2316 int h = cp->sizeHint().height() ; 2320 int h = cp->sizeHint().height() ;
2317 int dw = QApplication::desktop()->width(); 2321 int dw = QApplication::desktop()->width();
2318 int dh = QApplication::desktop()->height(); 2322 int dh = QApplication::desktop()->height();
2319 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2323 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2320 if ( !cp->exec() ) { 2324 if ( !cp->exec() ) {
2321 delete cp; 2325 delete cp;
2322 return; 2326 return;
2323 } 2327 }
2324 int count = 0; 2328 int count = 0;
2325 if ( cp->addCat() ) { 2329 if ( cp->addCat() ) {
2326 count = addCategories(); 2330 count = addCategories();
2327 if ( count ) { 2331 if ( count ) {
2328 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); 2332 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! "));
2329 writeSettings(); 2333 writeSettings();
2330 } else 2334 } else
2331 topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! ")); 2335 topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! "));
2332 } else { 2336 } else {
2333 removeCategories(); 2337 removeCategories();
2334 updateView(); 2338 updateView();
2335 } 2339 }
2336 delete cp; 2340 delete cp;
2337} 2341}
2338 2342
2339void CalendarView::beamIncidence(Incidence * Inc) 2343void CalendarView::beamIncidence(Incidence * Inc)
2340{ 2344{
2341 QPtrList<Incidence> delSel ; 2345 QPtrList<Incidence> delSel ;
2342 delSel.append(Inc); 2346 delSel.append(Inc);
2343 beamIncidenceList( delSel ); 2347 beamIncidenceList( delSel );
2344} 2348}
2345void CalendarView::beamCalendar() 2349void CalendarView::beamCalendar()
2346{ 2350{
2347 QPtrList<Incidence> delSel = mCalendar->rawIncidences(); 2351 QPtrList<Incidence> delSel = mCalendar->rawIncidences();
2348 //qDebug("beamCalendar() "); 2352 //qDebug("beamCalendar() ");
2349 beamIncidenceList( delSel ); 2353 beamIncidenceList( delSel );
2350} 2354}
2351void CalendarView::beamFilteredCalendar() 2355void CalendarView::beamFilteredCalendar()
2352{ 2356{
2353 QPtrList<Incidence> delSel = mCalendar->incidences(); 2357 QPtrList<Incidence> delSel = mCalendar->incidences();
2354 //qDebug("beamFilteredCalendar() "); 2358 //qDebug("beamFilteredCalendar() ");
2355 beamIncidenceList( delSel ); 2359 beamIncidenceList( delSel );
2356} 2360}
2357void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) 2361void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel )
2358{ 2362{
2359 if ( beamDialog->exec () == QDialog::Rejected ) 2363 if ( beamDialog->exec () == QDialog::Rejected )
2360 return; 2364 return;
2361#ifdef DESKTOP_VERSION 2365#ifdef DESKTOP_VERSION
2362 QString fn = locateLocal( "tmp", "kopibeamfile" ); 2366 QString fn = locateLocal( "tmp", "kopibeamfile" );
2363#else 2367#else
2364 QString fn = "/tmp/kopibeamfile"; 2368 QString fn = "/tmp/kopibeamfile";
2365#endif 2369#endif
2366 QString mes; 2370 QString mes;
2367 bool createbup = true; 2371 bool createbup = true;
2368 if ( createbup ) { 2372 if ( createbup ) {
2369 QString description = "\n"; 2373 QString description = "\n";
2370 CalendarLocal* cal = new CalendarLocal(); 2374 CalendarLocal* cal = new CalendarLocal();
2371 if ( beamDialog->beamLocal() ) 2375 if ( beamDialog->beamLocal() )
2372 cal->setLocalTime(); 2376 cal->setLocalTime();
2373 else 2377 else
2374 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2378 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2375 Incidence *incidence = delSel.first(); 2379 Incidence *incidence = delSel.first();
2376 bool addText = false; 2380 bool addText = false;
2377 if ( delSel.count() < 10 ) 2381 if ( delSel.count() < 10 )
2378 addText = true; 2382 addText = true;
2379 else { 2383 else {
2380 description.sprintf(i18n(" %d items?"),delSel.count() ); 2384 description.sprintf(i18n(" %d items?"),delSel.count() );
2381 } 2385 }
2382 while ( incidence ) { 2386 while ( incidence ) {
2383 Incidence *in = incidence->clone(); 2387 Incidence *in = incidence->clone();
2384 if ( ! in->summary().isEmpty() ) { 2388 if ( ! in->summary().isEmpty() ) {
2385 in->setDescription(""); 2389 in->setDescription("");
2386 } else { 2390 } else {
2387 in->setSummary( in->description().left(20)); 2391 in->setSummary( in->description().left(20));
2388 in->setDescription(""); 2392 in->setDescription("");
2389 } 2393 }
2390 if ( addText ) 2394 if ( addText )
2391 description += in->summary() + "\n"; 2395 description += in->summary() + "\n";
2392 cal->addIncidence( in ); 2396 cal->addIncidence( in );
2393 incidence = delSel.next(); 2397 incidence = delSel.next();
2394 } 2398 }
2395 if ( beamDialog->beamVcal() ) { 2399 if ( beamDialog->beamVcal() ) {
2396 fn += ".vcs"; 2400 fn += ".vcs";
2397 FileStorage storage( cal, fn, new VCalFormat ); 2401 FileStorage storage( cal, fn, new VCalFormat );
2398 storage.save(); 2402 storage.save();
2399 } else { 2403 } else {
2400 fn += ".ics"; 2404 fn += ".ics";
2401 FileStorage storage( cal, fn, new ICalFormat( ) ); 2405 FileStorage storage( cal, fn, new ICalFormat( ) );
2402 storage.save(); 2406 storage.save();
2403 } 2407 }
2404 delete cal; 2408 delete cal;
2405 mes = i18n("KO/Pi: Ready for beaming"); 2409 mes = i18n("KO/Pi: Ready for beaming");
2406 topLevelWidget()->setCaption(mes); 2410 topLevelWidget()->setCaption(mes);
2407 KApplication::convert2latin1( fn ); 2411 KApplication::convert2latin1( fn );
2408#ifndef DESKTOP_VERSION 2412#ifndef DESKTOP_VERSION
2409 Ir *ir = new Ir( this ); 2413 Ir *ir = new Ir( this );
2410 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 2414 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
2411 ir->send( fn, description, "text/x-vCalendar" ); 2415 ir->send( fn, description, "text/x-vCalendar" );
2412#endif 2416#endif
2413 } 2417 }
2414} 2418}
2415void CalendarView::beamDone( Ir *ir ) 2419void CalendarView::beamDone( Ir *ir )
2416{ 2420{
2417#ifndef DESKTOP_VERSION 2421#ifndef DESKTOP_VERSION
2418 delete ir; 2422 delete ir;
2419#endif 2423#endif
2420 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); 2424 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") );
2421 topLevelWidget()->raise(); 2425 topLevelWidget()->raise();
2422} 2426}
2423 2427
2424void CalendarView::moveIncidence(Incidence * inc ) 2428void CalendarView::moveIncidence(Incidence * inc )
2425{ 2429{
2426 if ( !inc ) return; 2430 if ( !inc ) return;
2427 // qDebug("showDatePickerForIncidence( ) "); 2431 // qDebug("showDatePickerForIncidence( ) ");
2428 if ( mDateFrame->isVisible() ) 2432 if ( mDateFrame->isVisible() )
2429 mDateFrame->hide(); 2433 mDateFrame->hide();
2430 else { 2434 else {
2431 int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ; 2435 int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ;
2432 int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ; 2436 int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ;
2433 int dw = QApplication::desktop()->width(); 2437 int dw = QApplication::desktop()->width();
2434 int dh = QApplication::desktop()->height(); 2438 int dh = QApplication::desktop()->height();
2435 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2439 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2436 mDateFrame->show(); 2440 mDateFrame->show();
2437 } 2441 }
2438 mDatePickerMode = 2; 2442 mDatePickerMode = 2;
2439 mMoveIncidence = inc ; 2443 mMoveIncidence = inc ;
2440 QDate da; 2444 QDate da;
2441 if ( mMoveIncidence->type() == "Todo" ) { 2445 if ( mMoveIncidence->type() == "Todo" ) {
2442 Todo * to = (Todo *) mMoveIncidence; 2446 Todo * to = (Todo *) mMoveIncidence;
2443 if ( to->hasDueDate() ) 2447 if ( to->hasDueDate() )
2444 da = to->dtDue().date(); 2448 da = to->dtDue().date();
2445 else 2449 else
2446 da = QDate::currentDate(); 2450 da = QDate::currentDate();
2447 } else { 2451 } else {
2448 da = mMoveIncidence->dtStart().date(); 2452 da = mMoveIncidence->dtStart().date();
2449 } 2453 }
2450 //PENDING set date for recurring incidence to date of recurrence 2454 //PENDING set date for recurring incidence to date of recurrence
2451 //mMoveIncidenceOldDate; 2455 //mMoveIncidenceOldDate;
2452 mDatePicker->setDate( da ); 2456 mDatePicker->setDate( da );
2453} 2457}
2454void CalendarView::showDatePicker( ) 2458void CalendarView::showDatePicker( )
2455{ 2459{
2456 //qDebug("CalendarView::showDatePicker( ) "); 2460 //qDebug("CalendarView::showDatePicker( ) ");
2457 if ( mDateFrame->isVisible() ) 2461 if ( mDateFrame->isVisible() )
2458 mDateFrame->hide(); 2462 mDateFrame->hide();
2459 else { 2463 else {
2460 int w =mDatePicker->sizeHint().width() ; 2464 int w =mDatePicker->sizeHint().width() ;
2461 int h = mDatePicker->sizeHint().height() ; 2465 int h = mDatePicker->sizeHint().height() ;
2462 int dw = QApplication::desktop()->width(); 2466 int dw = QApplication::desktop()->width();
2463 int dh = QApplication::desktop()->height(); 2467 int dh = QApplication::desktop()->height();
2464 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2468 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2465 mDateFrame->show(); 2469 mDateFrame->show();
2466 } 2470 }
2467 mDatePickerMode = 1; 2471 mDatePickerMode = 1;
2468 mDatePicker->setDate( mNavigator->selectedDates().first() ); 2472 mDatePicker->setDate( mNavigator->selectedDates().first() );
2469} 2473}
2470 2474
2471void CalendarView::showEventEditor() 2475void CalendarView::showEventEditor()
2472{ 2476{
2473#ifdef DESKTOP_VERSION 2477#ifdef DESKTOP_VERSION
2474 mEventEditor->show(); 2478 mEventEditor->show();
2475#else 2479#else
2476 if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) { 2480 if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) {
2477 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); 2481 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") );
2478 qDebug("CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() ); 2482 qDebug("CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() );
2479 delete mEventEditor; 2483 delete mEventEditor;
2480 mEventEditor = mDialogManager->getEventEditor(); 2484 mEventEditor = mDialogManager->getEventEditor();
2481 } 2485 }
2482 mEventEditor->showMaximized(); 2486 mEventEditor->showMaximized();
2483#endif 2487#endif
2484} 2488}
2485void CalendarView::showTodoEditor() 2489void CalendarView::showTodoEditor()
2486{ 2490{
2487#ifdef DESKTOP_VERSION 2491#ifdef DESKTOP_VERSION
2488 mTodoEditor->show(); 2492 mTodoEditor->show();
2489#else 2493#else
2490 if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) { 2494 if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) {
2491 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); 2495 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") );
2492 qDebug("CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() ); 2496 qDebug("CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() );
2493 delete mTodoEditor; 2497 delete mTodoEditor;
2494 mTodoEditor = mDialogManager->getTodoEditor(); 2498 mTodoEditor = mDialogManager->getTodoEditor();
2495 } 2499 }
2496 mTodoEditor->showMaximized(); 2500 mTodoEditor->showMaximized();
2497#endif 2501#endif
2498} 2502}
2499 2503
2500void CalendarView::cloneIncidence() 2504void CalendarView::cloneIncidence()
2501{ 2505{
2502 Incidence *incidence = currentSelection(); 2506 Incidence *incidence = currentSelection();
2503 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2507 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2504 if ( incidence ) { 2508 if ( incidence ) {
2505 cloneIncidence(incidence); 2509 cloneIncidence(incidence);
2506 } 2510 }
2507} 2511}
2508void CalendarView::moveIncidence() 2512void CalendarView::moveIncidence()
2509{ 2513{
2510 Incidence *incidence = currentSelection(); 2514 Incidence *incidence = currentSelection();
2511 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2515 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2512 if ( incidence ) { 2516 if ( incidence ) {
2513 moveIncidence(incidence); 2517 moveIncidence(incidence);
2514 } 2518 }
2515} 2519}
2516void CalendarView::beamIncidence() 2520void CalendarView::beamIncidence()
2517{ 2521{
2518 Incidence *incidence = currentSelection(); 2522 Incidence *incidence = currentSelection();
2519 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2523 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2520 if ( incidence ) { 2524 if ( incidence ) {
2521 beamIncidence(incidence); 2525 beamIncidence(incidence);
2522 } 2526 }
2523} 2527}
2524void CalendarView::toggleCancelIncidence() 2528void CalendarView::toggleCancelIncidence()
2525{ 2529{
2526 Incidence *incidence = currentSelection(); 2530 Incidence *incidence = currentSelection();
2527 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2531 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2528 if ( incidence ) { 2532 if ( incidence ) {
2529 cancelIncidence(incidence); 2533 cancelIncidence(incidence);
2530 } 2534 }
2531} 2535}
2532 2536
2533 2537
2534void CalendarView::cancelIncidence(Incidence * inc ) 2538void CalendarView::cancelIncidence(Incidence * inc )
2535{ 2539{
2536 inc->setCancelled( ! inc->cancelled() ); 2540 inc->setCancelled( ! inc->cancelled() );
2537 changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); 2541 changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED );
2538 updateView(); 2542 updateView();
2539} 2543}
2540void CalendarView::cloneIncidence(Incidence * orgInc ) 2544void CalendarView::cloneIncidence(Incidence * orgInc )
2541{ 2545{
2542 Incidence * newInc = orgInc->clone(); 2546 Incidence * newInc = orgInc->clone();
2543 newInc->recreate(); 2547 newInc->recreate();
2544 2548
2545 if ( newInc->type() == "Todo" ) { 2549 if ( newInc->type() == "Todo" ) {
2546 Todo* t = (Todo*) newInc; 2550 Todo* t = (Todo*) newInc;
2547 showTodoEditor(); 2551 showTodoEditor();
2548 mTodoEditor->editTodo( t ); 2552 mTodoEditor->editTodo( t );
2549 if ( mTodoEditor->exec() ) { 2553 if ( mTodoEditor->exec() ) {
2550 mCalendar->addTodo( t ); 2554 mCalendar->addTodo( t );
2551 updateView(); 2555 updateView();
2552 } else { 2556 } else {
2553 delete t; 2557 delete t;
2554 } 2558 }
2555 } 2559 }
2556 else { 2560 else {
2557 Event* e = (Event*) newInc; 2561 Event* e = (Event*) newInc;
2558 showEventEditor(); 2562 showEventEditor();
2559 mEventEditor->editEvent( e ); 2563 mEventEditor->editEvent( e );
2560 if ( mEventEditor->exec() ) { 2564 if ( mEventEditor->exec() ) {
2561 mCalendar->addEvent( e ); 2565 mCalendar->addEvent( e );
2562 updateView(); 2566 updateView();
2563 } else { 2567 } else {
2564 delete e; 2568 delete e;
2565 } 2569 }
2566 } 2570 }
2567} 2571}
2568 2572
2569void CalendarView::newEvent() 2573void CalendarView::newEvent()
2570{ 2574{
2571 // TODO: Replace this code by a common eventDurationHint of KOBaseView. 2575 // TODO: Replace this code by a common eventDurationHint of KOBaseView.
2572 KOAgendaView *aView = mViewManager->agendaView(); 2576 KOAgendaView *aView = mViewManager->agendaView();
2573 if (aView) { 2577 if (aView) {
2574 if (aView->selectionStart().isValid()) { 2578 if (aView->selectionStart().isValid()) {
2575 if (aView->selectedIsAllDay()) { 2579 if (aView->selectedIsAllDay()) {
2576 newEvent(aView->selectionStart(),aView->selectionEnd(),true); 2580 newEvent(aView->selectionStart(),aView->selectionEnd(),true);
2577 } else { 2581 } else {
2578 newEvent(aView->selectionStart(),aView->selectionEnd()); 2582 newEvent(aView->selectionStart(),aView->selectionEnd());
2579 } 2583 }
2580 return; 2584 return;
2581 } 2585 }
2582 } 2586 }
2583 2587
2584 QDate date = mNavigator->selectedDates().first(); 2588 QDate date = mNavigator->selectedDates().first();
2585 QDateTime current = QDateTime::currentDateTime(); 2589 QDateTime current = QDateTime::currentDateTime();
2586 if ( date <= current.date() ) { 2590 if ( date <= current.date() ) {
2587 int hour = current.time().hour() +1; 2591 int hour = current.time().hour() +1;
2588 newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), 2592 newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ),
2589 QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); 2593 QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) );
2590 } else 2594 } else
2591 newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), 2595 newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ),
2592 QDateTime( date, QTime( KOPrefs::instance()->mStartTime + 2596 QDateTime( date, QTime( KOPrefs::instance()->mStartTime +
2593 KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); 2597 KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) );
2594} 2598}
2595 2599
2596void CalendarView::newEvent(QDateTime fh) 2600void CalendarView::newEvent(QDateTime fh)
2597{ 2601{
2598 newEvent(fh, 2602 newEvent(fh,
2599 QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); 2603 QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration)));
2600} 2604}
2601 2605
2602void CalendarView::newEvent(QDate dt) 2606void CalendarView::newEvent(QDate dt)
2603{ 2607{
2604 newEvent(QDateTime(dt, QTime(0,0,0)), 2608 newEvent(QDateTime(dt, QTime(0,0,0)),
2605 QDateTime(dt, QTime(0,0,0)), true); 2609 QDateTime(dt, QTime(0,0,0)), true);
2606} 2610}
2607 2611
2608void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) 2612void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay)
2609{ 2613{
2610 2614
2611 showEventEditor(); 2615 showEventEditor();
2612 mEventEditor->newEvent(fromHint,toHint,allDay); 2616 mEventEditor->newEvent(fromHint,toHint,allDay);
2613 if ( mFilterView->filtersEnabled() ) { 2617 if ( mFilterView->filtersEnabled() ) {
2614 CalFilter *filter = mFilterView->selectedFilter(); 2618 CalFilter *filter = mFilterView->selectedFilter();
2615 if (filter && filter->showCategories()) { 2619 if (filter && filter->showCategories()) {
2616 mEventEditor->setCategories(filter->categoryList().join(",") ); 2620 mEventEditor->setCategories(filter->categoryList().join(",") );
2617 } 2621 }
2618 if ( filter ) 2622 if ( filter )
2619 mEventEditor->setSecrecy( filter->getSecrecy() ); 2623 mEventEditor->setSecrecy( filter->getSecrecy() );
2620 } 2624 }
2621} 2625}
2622void CalendarView::todoAdded(Todo * t) 2626void CalendarView::todoAdded(Todo * t)
2623{ 2627{
2624 2628
2625 changeTodoDisplay ( t ,KOGlobals::EVENTADDED); 2629 changeTodoDisplay ( t ,KOGlobals::EVENTADDED);
2626 updateTodoViews(); 2630 updateTodoViews();
2627} 2631}
2628void CalendarView::todoChanged(Todo * t) 2632void CalendarView::todoChanged(Todo * t)
2629{ 2633{
2630 emit todoModified( t, 4 ); 2634 emit todoModified( t, 4 );
2631 // updateTodoViews(); 2635 // updateTodoViews();
2632} 2636}
2633void CalendarView::todoToBeDeleted(Todo *) 2637void CalendarView::todoToBeDeleted(Todo *)
2634{ 2638{
2635 //qDebug("todoToBeDeleted(Todo *) "); 2639 //qDebug("todoToBeDeleted(Todo *) ");
2636 updateTodoViews(); 2640 updateTodoViews();
2637} 2641}
2638void CalendarView::todoDeleted() 2642void CalendarView::todoDeleted()
2639{ 2643{
2640 //qDebug(" todoDeleted()"); 2644 //qDebug(" todoDeleted()");
2641 updateTodoViews(); 2645 updateTodoViews();
2642} 2646}
2643 2647
2644 2648
2645 2649
2646void CalendarView::newTodo() 2650void CalendarView::newTodo()
2647{ 2651{
2648 2652
2649 showTodoEditor(); 2653 showTodoEditor();
2650 mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),0,true); 2654 mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),0,true);
2651 if ( mFilterView->filtersEnabled() ) { 2655 if ( mFilterView->filtersEnabled() ) {
2652 CalFilter *filter = mFilterView->selectedFilter(); 2656 CalFilter *filter = mFilterView->selectedFilter();
2653 if (filter && filter->showCategories()) { 2657 if (filter && filter->showCategories()) {
2654 mTodoEditor->setCategories(filter->categoryList().join(",") ); 2658 mTodoEditor->setCategories(filter->categoryList().join(",") );
2655 } 2659 }
2656 if ( filter ) 2660 if ( filter )
2657 mTodoEditor->setSecrecy( filter->getSecrecy() ); 2661 mTodoEditor->setSecrecy( filter->getSecrecy() );
2658 } 2662 }
2659} 2663}
2660 2664
2661void CalendarView::newSubTodo() 2665void CalendarView::newSubTodo()
2662{ 2666{
2663 Todo *todo = selectedTodo(); 2667 Todo *todo = selectedTodo();
2664 if ( todo ) newSubTodo( todo ); 2668 if ( todo ) newSubTodo( todo );
2665} 2669}
2666 2670
2667void CalendarView::newSubTodo(Todo *parentEvent) 2671void CalendarView::newSubTodo(Todo *parentEvent)
2668{ 2672{
2669 2673
2670 showTodoEditor(); 2674 showTodoEditor();
2671 mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),parentEvent,true); 2675 mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),parentEvent,true);
2672} 2676}
2673 2677
2674void CalendarView::newFloatingEvent() 2678void CalendarView::newFloatingEvent()
2675{ 2679{
2676 DateList tmpList = mNavigator->selectedDates(); 2680 DateList tmpList = mNavigator->selectedDates();
2677 QDate date = tmpList.first(); 2681 QDate date = tmpList.first();
2678 2682
2679 newEvent( QDateTime( date, QTime( 12, 0, 0 ) ), 2683 newEvent( QDateTime( date, QTime( 12, 0, 0 ) ),
2680 QDateTime( date, QTime( 12, 0, 0 ) ), true ); 2684 QDateTime( date, QTime( 12, 0, 0 ) ), true );
2681} 2685}
2682 2686
2683 2687
2684void CalendarView::editEvent( Event *event ) 2688void CalendarView::editEvent( Event *event )
2685{ 2689{
2686 2690
2687 if ( !event ) return; 2691 if ( !event ) return;
2688 if ( event->isReadOnly() ) { 2692 if ( event->isReadOnly() ) {
2689 showEvent( event ); 2693 showEvent( event );
2690 return; 2694 return;
2691 } 2695 }
2692 showEventEditor(); 2696 showEventEditor();
2693 mEventEditor->editEvent( event , mFlagEditDescription); 2697 mEventEditor->editEvent( event , mFlagEditDescription);
2694} 2698}
2695void CalendarView::editJournal( Journal *jour ) 2699void CalendarView::editJournal( Journal *jour )
2696{ 2700{
2697 if ( !jour ) return; 2701 if ( !jour ) return;
2698 mDialogManager->hideSearchDialog(); 2702 mDialogManager->hideSearchDialog();
2699 mViewManager->showJournalView(); 2703 mViewManager->showJournalView();
2700 mNavigator->slotDaySelect( jour->dtStart().date() ); 2704 mNavigator->slotDaySelect( jour->dtStart().date() );
2701} 2705}
2702void CalendarView::editTodo( Todo *todo ) 2706void CalendarView::editTodo( Todo *todo )
2703{ 2707{
2704 if ( !todo ) return; 2708 if ( !todo ) return;
2705 2709
2706 if ( todo->isReadOnly() ) { 2710 if ( todo->isReadOnly() ) {
2707 showTodo( todo ); 2711 showTodo( todo );
2708 return; 2712 return;
2709 } 2713 }
2710 showTodoEditor(); 2714 showTodoEditor();
2711 mTodoEditor->editTodo( todo ,mFlagEditDescription); 2715 mTodoEditor->editTodo( todo ,mFlagEditDescription);
2712 2716
2713} 2717}
2714 2718
2715KOEventViewerDialog* CalendarView::getEventViewerDialog() 2719KOEventViewerDialog* CalendarView::getEventViewerDialog()
2716{ 2720{
2717 if ( !mEventViewerDialog ) { 2721 if ( !mEventViewerDialog ) {
2718 mEventViewerDialog = new KOEventViewerDialog(this); 2722 mEventViewerDialog = new KOEventViewerDialog(this);
2719 connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); 2723 connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) );
2720 connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); 2724 connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig()));
2721 connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), 2725 connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)),
2722 dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); 2726 dateNavigator(), SLOT( selectWeek( const QDate & ) ) );
2723 connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), 2727 connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ),
2724 viewManager(), SLOT( showAgendaView( bool ) ) ); 2728 viewManager(), SLOT( showAgendaView( bool ) ) );
2725 mEventViewerDialog->resize( 640, 480 ); 2729 mEventViewerDialog->resize( 640, 480 );
2726 2730
2727 } 2731 }
2728 return mEventViewerDialog; 2732 return mEventViewerDialog;
2729} 2733}
2730void CalendarView::showEvent(Event *event) 2734void CalendarView::showEvent(Event *event)
2731{ 2735{
2732 getEventViewerDialog()->setEvent(event); 2736 getEventViewerDialog()->setEvent(event);
2733 getEventViewerDialog()->showMe(); 2737 getEventViewerDialog()->showMe();
2734} 2738}
2735 2739
2736void CalendarView::showTodo(Todo *event) 2740void CalendarView::showTodo(Todo *event)
2737{ 2741{
2738 getEventViewerDialog()->setTodo(event); 2742 getEventViewerDialog()->setTodo(event);
2739 getEventViewerDialog()->showMe(); 2743 getEventViewerDialog()->showMe();
2740} 2744}
2741void CalendarView::showJournal( Journal *jour ) 2745void CalendarView::showJournal( Journal *jour )
2742{ 2746{
2743 getEventViewerDialog()->setJournal(jour); 2747 getEventViewerDialog()->setJournal(jour);
2744 getEventViewerDialog()->showMe(); 2748 getEventViewerDialog()->showMe();
2745 2749
2746} 2750}
2747// void CalendarView::todoModified (Todo *event, int changed) 2751// void CalendarView::todoModified (Todo *event, int changed)
2748// { 2752// {
2749// // if (mDialogList.find (event) != mDialogList.end ()) { 2753// // if (mDialogList.find (event) != mDialogList.end ()) {
2750// // kdDebug() << "Todo modified and open" << endl; 2754// // kdDebug() << "Todo modified and open" << endl;
2751// // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; 2755// // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event];
2752// // temp->modified (changed); 2756// // temp->modified (changed);
2753 2757
2754// // } 2758// // }
2755 2759
2756// mViewManager->updateView(); 2760// mViewManager->updateView();
2757// } 2761// }
2758 2762
2759void CalendarView::appointment_show() 2763void CalendarView::appointment_show()
2760{ 2764{
2761 Event *anEvent = 0; 2765 Event *anEvent = 0;
2762 2766
2763 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2767 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2764 2768
2765 if (mViewManager->currentView()->isEventView()) { 2769 if (mViewManager->currentView()->isEventView()) {
2766 if ( incidence && incidence->type() == "Event" ) { 2770 if ( incidence && incidence->type() == "Event" ) {
2767 anEvent = static_cast<Event *>(incidence); 2771 anEvent = static_cast<Event *>(incidence);
2768 } 2772 }
2769 } 2773 }
2770 2774
2771 if (!anEvent) { 2775 if (!anEvent) {
2772 KNotifyClient::beep(); 2776 KNotifyClient::beep();
2773 return; 2777 return;
2774 } 2778 }
2775 2779
2776 showEvent(anEvent); 2780 showEvent(anEvent);
2777} 2781}
2778 2782
2779void CalendarView::appointment_edit() 2783void CalendarView::appointment_edit()
2780{ 2784{
2781 Event *anEvent = 0; 2785 Event *anEvent = 0;
2782 2786
2783 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2787 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2784 2788
2785 if (mViewManager->currentView()->isEventView()) { 2789 if (mViewManager->currentView()->isEventView()) {
2786 if ( incidence && incidence->type() == "Event" ) { 2790 if ( incidence && incidence->type() == "Event" ) {
2787 anEvent = static_cast<Event *>(incidence); 2791 anEvent = static_cast<Event *>(incidence);
2788 } 2792 }
2789 } 2793 }
2790 2794
2791 if (!anEvent) { 2795 if (!anEvent) {
2792 KNotifyClient::beep(); 2796 KNotifyClient::beep();
2793 return; 2797 return;
2794 } 2798 }
2795 2799
2796 editEvent(anEvent); 2800 editEvent(anEvent);
2797} 2801}
2798 2802
2799void CalendarView::appointment_delete() 2803void CalendarView::appointment_delete()
2800{ 2804{
2801 Event *anEvent = 0; 2805 Event *anEvent = 0;
2802 2806
2803 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2807 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2804 2808
2805 if (mViewManager->currentView()->isEventView()) { 2809 if (mViewManager->currentView()->isEventView()) {
2806 if ( incidence && incidence->type() == "Event" ) { 2810 if ( incidence && incidence->type() == "Event" ) {
2807 anEvent = static_cast<Event *>(incidence); 2811 anEvent = static_cast<Event *>(incidence);
2808 } 2812 }
2809 } 2813 }
2810 2814
2811 if (!anEvent) { 2815 if (!anEvent) {
2812 KNotifyClient::beep(); 2816 KNotifyClient::beep();
2813 return; 2817 return;
2814 } 2818 }
2815 2819
2816 deleteEvent(anEvent); 2820 deleteEvent(anEvent);
2817} 2821}
2818 2822
2819void CalendarView::todo_resub( Todo * parent, Todo * sub ) 2823void CalendarView::todo_resub( Todo * parent, Todo * sub )
2820{ 2824{
2821 if (!sub) return; 2825 if (!sub) return;
2822 if (!parent) return; 2826 if (!parent) return;
2823 if ( sub->relatedTo() ) 2827 if ( sub->relatedTo() )
2824 sub->relatedTo()->removeRelation(sub); 2828 sub->relatedTo()->removeRelation(sub);
2825 sub->setRelatedTo(parent); 2829 sub->setRelatedTo(parent);
2826 sub->setRelatedToUid(parent->uid()); 2830 sub->setRelatedToUid(parent->uid());
2827 parent->addRelation(sub); 2831 parent->addRelation(sub);
2828 sub->updated(); 2832 sub->updated();
2829 parent->updated(); 2833 parent->updated();
2830 setModified(true); 2834 setModified(true);
2831 updateView(); 2835 updateView();
2832} 2836}
2833void CalendarView::todo_unsub(Todo *anTodo ) 2837void CalendarView::todo_unsub(Todo *anTodo )
2834{ 2838{
2835 // Todo *anTodo = selectedTodo(); 2839 // Todo *anTodo = selectedTodo();
2836 if (!anTodo) return; 2840 if (!anTodo) return;
2837 if (!anTodo->relatedTo()) return; 2841 if (!anTodo->relatedTo()) return;
2838 anTodo->relatedTo()->removeRelation(anTodo); 2842 anTodo->relatedTo()->removeRelation(anTodo);
2839 anTodo->setRelatedTo(0); 2843 anTodo->setRelatedTo(0);
2840 anTodo->updated(); 2844 anTodo->updated();
2841 anTodo->setRelatedToUid(""); 2845 anTodo->setRelatedToUid("");
2842 setModified(true); 2846 setModified(true);
2843 updateView(); 2847 updateView();
2844} 2848}
2845 2849
2846void CalendarView::deleteTodo(Todo *todo) 2850void CalendarView::deleteTodo(Todo *todo)
2847{ 2851{
2848 if (!todo) { 2852 if (!todo) {
2849 KNotifyClient::beep(); 2853 KNotifyClient::beep();
2850 return; 2854 return;
2851 } 2855 }
2852 if (KOPrefs::instance()->mConfirm) { 2856 if (KOPrefs::instance()->mConfirm) {
2853 switch (msgItemDelete()) { 2857 switch (msgItemDelete()) {
2854 case KMessageBox::Continue: // OK 2858 case KMessageBox::Continue: // OK
2855 if (!todo->relations().isEmpty()) { 2859 if (!todo->relations().isEmpty()) {
2856 KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."), 2860 KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."),
2857 i18n("Delete To-Do")); 2861 i18n("Delete To-Do"));
2858 } else { 2862 } else {
2859 checkExternalId( todo ); 2863 checkExternalId( todo );
2860 calendar()->deleteTodo(todo); 2864 calendar()->deleteTodo(todo);
2861 changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); 2865 changeTodoDisplay( todo,KOGlobals::EVENTDELETED );
2862 updateView(); 2866 updateView();
2863 } 2867 }
2864 break; 2868 break;
2865 } // switch 2869 } // switch
2866 } else { 2870 } else {
2867 if (!todo->relations().isEmpty()) { 2871 if (!todo->relations().isEmpty()) {
2868 KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."), 2872 KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."),
2869 i18n("Delete To-Do")); 2873 i18n("Delete To-Do"));
2870 } else { 2874 } else {
2871 checkExternalId( todo ); 2875 checkExternalId( todo );
2872 mCalendar->deleteTodo(todo); 2876 mCalendar->deleteTodo(todo);
2873 changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); 2877 changeTodoDisplay( todo,KOGlobals::EVENTDELETED );
2874 updateView(); 2878 updateView();
2875 } 2879 }
2876 } 2880 }
2877 emit updateSearchDialog(); 2881 emit updateSearchDialog();
2878} 2882}
2879void CalendarView::deleteJournal(Journal *jour) 2883void CalendarView::deleteJournal(Journal *jour)
2880{ 2884{
2881 if (!jour) { 2885 if (!jour) {
2882 KNotifyClient::beep(); 2886 KNotifyClient::beep();
2883 return; 2887 return;
2884 } 2888 }
2885 if (KOPrefs::instance()->mConfirm) { 2889 if (KOPrefs::instance()->mConfirm) {
2886 switch (msgItemDelete()) { 2890 switch (msgItemDelete()) {
2887 case KMessageBox::Continue: // OK 2891 case KMessageBox::Continue: // OK
2888 calendar()->deleteJournal(jour); 2892 calendar()->deleteJournal(jour);
2889 updateView(); 2893 updateView();
2890 break; 2894 break;
2891 } // switch 2895 } // switch
2892 } else { 2896 } else {
2893 calendar()->deleteJournal(jour);; 2897 calendar()->deleteJournal(jour);;
2894 updateView(); 2898 updateView();
2895 } 2899 }
2896 emit updateSearchDialog(); 2900 emit updateSearchDialog();
2897} 2901}
2898 2902
2899void CalendarView::deleteEvent(Event *anEvent) 2903void CalendarView::deleteEvent(Event *anEvent)
2900{ 2904{
2901 if (!anEvent) { 2905 if (!anEvent) {
2902 KNotifyClient::beep(); 2906 KNotifyClient::beep();
2903 return; 2907 return;
2904 } 2908 }
2905 2909
2906 if (anEvent->recurrence()->doesRecur()) { 2910 if (anEvent->recurrence()->doesRecur()) {
2907 QDate itemDate = mViewManager->currentSelectionDate(); 2911 QDate itemDate = mViewManager->currentSelectionDate();
2908 int km; 2912 int km;
2909 if (!itemDate.isValid()) { 2913 if (!itemDate.isValid()) {
2910 //kdDebug() << "Date Not Valid" << endl; 2914 //kdDebug() << "Date Not Valid" << endl;
2911 if (KOPrefs::instance()->mConfirm) { 2915 if (KOPrefs::instance()->mConfirm) {
2912 km = KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) + 2916 km = KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) +
2913 i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"), 2917 i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"),
2914 i18n("KO/Pi Confirmation"),i18n("Delete All")); 2918 i18n("KO/Pi Confirmation"),i18n("Delete All"));
2915 if ( km == KMessageBox::Continue ) 2919 if ( km == KMessageBox::Continue )
2916 km = KMessageBox::No; // No = all below 2920 km = KMessageBox::No; // No = all below
2917 } else 2921 } else
2918 km = KMessageBox::No; 2922 km = KMessageBox::No;
2919 } else { 2923 } else {
2920 km = KMessageBox::warningYesNoCancel(this,anEvent->summary().left(25) + 2924 km = KMessageBox::warningYesNoCancel(this,anEvent->summary().left(25) +
2921 i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+ 2925 i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+
2922 KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"), 2926 KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"),
2923 i18n("KO/Pi Confirmation"),i18n("Current"), 2927 i18n("KO/Pi Confirmation"),i18n("Current"),
2924 i18n("All")); 2928 i18n("All"));
2925 } 2929 }
2926 switch(km) { 2930 switch(km) {
2927 2931
2928 case KMessageBox::No: // Continue // all 2932 case KMessageBox::No: // Continue // all
2929 //qDebug("KMessageBox::No "); 2933 //qDebug("KMessageBox::No ");
2930 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) 2934 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0)
2931 schedule(Scheduler::Cancel,anEvent); 2935 schedule(Scheduler::Cancel,anEvent);
2932 2936
2933 checkExternalId( anEvent); 2937 checkExternalId( anEvent);
2934 mCalendar->deleteEvent(anEvent); 2938 mCalendar->deleteEvent(anEvent);
2935 changeEventDisplay(anEvent,KOGlobals::EVENTDELETED); 2939 changeEventDisplay(anEvent,KOGlobals::EVENTDELETED);
2936 break; 2940 break;
2937 2941
2938 // Disabled because it does not work 2942 // Disabled because it does not work
2939 //#if 0 2943 //#if 0
2940 case KMessageBox::Yes: // just this one 2944 case KMessageBox::Yes: // just this one
2941 //QDate qd = mNavigator->selectedDates().first(); 2945 //QDate qd = mNavigator->selectedDates().first();
2942 //if (!qd.isValid()) { 2946 //if (!qd.isValid()) {
2943 // kdDebug() << "no date selected, or invalid date" << endl; 2947 // kdDebug() << "no date selected, or invalid date" << endl;
2944 // KNotifyClient::beep(); 2948 // KNotifyClient::beep();
2945 // return; 2949 // return;
2946 //} 2950 //}
2947 //while (!anEvent->recursOn(qd)) qd = qd.addDays(1); 2951 //while (!anEvent->recursOn(qd)) qd = qd.addDays(1);
2948 if (itemDate!=QDate(1,1,1) || itemDate.isValid()) { 2952 if (itemDate!=QDate(1,1,1) || itemDate.isValid()) {
2949 anEvent->addExDate(itemDate); 2953 anEvent->addExDate(itemDate);
2950 int duration = anEvent->recurrence()->duration(); 2954 int duration = anEvent->recurrence()->duration();
2951 if ( duration > 0 ) { 2955 if ( duration > 0 ) {
2952 anEvent->recurrence()->setDuration( duration - 1 ); 2956 anEvent->recurrence()->setDuration( duration - 1 );
2953 } 2957 }
2954 changeEventDisplay(anEvent, KOGlobals::EVENTEDITED); 2958 changeEventDisplay(anEvent, KOGlobals::EVENTEDITED);
2955 } 2959 }
2956 break; 2960 break;
2957 //#endif 2961 //#endif
2958 } // switch 2962 } // switch
2959 } else { 2963 } else {
2960 if (KOPrefs::instance()->mConfirm) { 2964 if (KOPrefs::instance()->mConfirm) {
2961 switch (KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) + 2965 switch (KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) +
2962 i18n("\nAre you sure you want\nto delete this event?"), 2966 i18n("\nAre you sure you want\nto delete this event?"),
2963 i18n("KO/Pi Confirmation"),i18n("Delete"))) { 2967 i18n("KO/Pi Confirmation"),i18n("Delete"))) {
2964 case KMessageBox::Continue: // OK 2968 case KMessageBox::Continue: // OK
2965 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) 2969 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0)
2966 schedule(Scheduler::Cancel,anEvent); 2970 schedule(Scheduler::Cancel,anEvent);
2967 checkExternalId( anEvent); 2971 checkExternalId( anEvent);
2968 mCalendar->deleteEvent(anEvent); 2972 mCalendar->deleteEvent(anEvent);
2969 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 2973 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
2970 break; 2974 break;
2971 } // switch 2975 } // switch
2972 } else { 2976 } else {
2973 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) 2977 if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0)
2974 schedule(Scheduler::Cancel,anEvent); 2978 schedule(Scheduler::Cancel,anEvent);
2975 checkExternalId( anEvent); 2979 checkExternalId( anEvent);
2976 mCalendar->deleteEvent(anEvent); 2980 mCalendar->deleteEvent(anEvent);
2977 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 2981 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
2978 } 2982 }
2979 } // if-else 2983 } // if-else
2980 emit updateSearchDialog(); 2984 emit updateSearchDialog();
2981} 2985}
2982 2986
2983bool CalendarView::deleteEvent(const QString &uid) 2987bool CalendarView::deleteEvent(const QString &uid)
2984{ 2988{
2985 Event *ev = mCalendar->event(uid); 2989 Event *ev = mCalendar->event(uid);
2986 if (ev) { 2990 if (ev) {
2987 deleteEvent(ev); 2991 deleteEvent(ev);
2988 return true; 2992 return true;
2989 } else { 2993 } else {
2990 return false; 2994 return false;
2991 } 2995 }
2992} 2996}
2993 2997
2994/*****************************************************************************/ 2998/*****************************************************************************/
2995 2999
2996void CalendarView::action_mail() 3000void CalendarView::action_mail()
2997{ 3001{
2998#ifndef KORG_NOMAIL 3002#ifndef KORG_NOMAIL
2999 KOMailClient mailClient; 3003 KOMailClient mailClient;
3000 3004
3001 Incidence *incidence = currentSelection(); 3005 Incidence *incidence = currentSelection();
3002 3006
3003 if (!incidence) { 3007 if (!incidence) {
3004 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); 3008 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected."));
3005 return; 3009 return;
3006 } 3010 }
3007 if(incidence->attendeeCount() == 0 ) { 3011 if(incidence->attendeeCount() == 0 ) {
3008 KMessageBox::sorry(this, 3012 KMessageBox::sorry(this,
3009 i18n("Can't generate mail:\nNo attendees defined.\n")); 3013 i18n("Can't generate mail:\nNo attendees defined.\n"));
3010 return; 3014 return;
3011 } 3015 }
3012 3016
3013 CalendarLocal cal_tmp; 3017 CalendarLocal cal_tmp;
3014 Event *event = 0; 3018 Event *event = 0;
3015 Event *ev = 0; 3019 Event *ev = 0;
3016 if ( incidence && incidence->type() == "Event" ) { 3020 if ( incidence && incidence->type() == "Event" ) {
3017 event = static_cast<Event *>(incidence); 3021 event = static_cast<Event *>(incidence);
3018 ev = new Event(*event); 3022 ev = new Event(*event);
3019 cal_tmp.addEvent(ev); 3023 cal_tmp.addEvent(ev);
3020 } 3024 }
3021 ICalFormat mForm(); 3025 ICalFormat mForm();
3022 QString attachment = mForm.toString( &cal_tmp ); 3026 QString attachment = mForm.toString( &cal_tmp );
3023 if (ev) delete(ev); 3027 if (ev) delete(ev);
3024 3028
3025 mailClient.mailAttendees(currentSelection(), attachment); 3029 mailClient.mailAttendees(currentSelection(), attachment);
3026 3030
3027#endif 3031#endif
3028 3032
3029#if 0 3033#if 0
3030 Event *anEvent = 0; 3034 Event *anEvent = 0;
3031 if (mViewManager->currentView()->isEventView()) { 3035 if (mViewManager->currentView()->isEventView()) {
3032 anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first()); 3036 anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first());
3033 } 3037 }
3034 3038
3035 if (!anEvent) { 3039 if (!anEvent) {
3036 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); 3040 KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected."));
3037 return; 3041 return;
3038 } 3042 }
3039 if(anEvent->attendeeCount() == 0 ) { 3043 if(anEvent->attendeeCount() == 0 ) {
3040 KMessageBox::sorry(this, 3044 KMessageBox::sorry(this,
3041 i18n("Can't generate mail:\nNo attendees defined.\n")); 3045 i18n("Can't generate mail:\nNo attendees defined.\n"));
3042 return; 3046 return;
3043 } 3047 }
3044 3048
3045 mailobject.emailEvent(anEvent); 3049 mailobject.emailEvent(anEvent);
3046#endif 3050#endif
3047} 3051}
3048 3052
3049 3053
3050void CalendarView::schedule_publish(Incidence *incidence) 3054void CalendarView::schedule_publish(Incidence *incidence)
3051{ 3055{
3052 Event *event = 0; 3056 Event *event = 0;
3053 Todo *todo = 0; 3057 Todo *todo = 0;
3054 3058
3055 if (incidence == 0) { 3059 if (incidence == 0) {
3056 incidence = mViewManager->currentView()->selectedIncidences().first(); 3060 incidence = mViewManager->currentView()->selectedIncidences().first();
3057 if (incidence == 0) { 3061 if (incidence == 0) {
3058 incidence = mTodoList->selectedIncidences().first(); 3062 incidence = mTodoList->selectedIncidences().first();
3059 } 3063 }
3060 } 3064 }
3061 if ( incidence && incidence->type() == "Event" ) { 3065 if ( incidence && incidence->type() == "Event" ) {
3062 event = static_cast<Event *>(incidence); 3066 event = static_cast<Event *>(incidence);
3063 } else { 3067 } else {
3064 if ( incidence && incidence->type() == "Todo" ) { 3068 if ( incidence && incidence->type() == "Todo" ) {
3065 todo = static_cast<Todo *>(incidence); 3069 todo = static_cast<Todo *>(incidence);
3066 } 3070 }
3067 } 3071 }
3068 3072
3069 if (!event && !todo) { 3073 if (!event && !todo) {
3070 KMessageBox::sorry(this,i18n("No event selected.")); 3074 KMessageBox::sorry(this,i18n("No event selected."));
3071 return; 3075 return;
3072 } 3076 }
3073 3077
3074 PublishDialog *publishdlg = new PublishDialog(); 3078 PublishDialog *publishdlg = new PublishDialog();
3075 if (incidence->attendeeCount()>0) { 3079 if (incidence->attendeeCount()>0) {
3076 QPtrList<Attendee> attendees = incidence->attendees(); 3080 QPtrList<Attendee> attendees = incidence->attendees();
3077 attendees.first(); 3081 attendees.first();
3078 while ( attendees.current()!=0 ) { 3082 while ( attendees.current()!=0 ) {
3079 publishdlg->addAttendee(attendees.current()); 3083 publishdlg->addAttendee(attendees.current());
3080 attendees.next(); 3084 attendees.next();
3081 } 3085 }
3082 } 3086 }
3083 bool send = true; 3087 bool send = true;
3084 if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) { 3088 if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) {
3085 if ( publishdlg->exec() != QDialog::Accepted ) 3089 if ( publishdlg->exec() != QDialog::Accepted )
3086 send = false; 3090 send = false;
3087 } 3091 }
3088 if ( send ) { 3092 if ( send ) {
3089 OutgoingDialog *dlg = mDialogManager->outgoingDialog(); 3093 OutgoingDialog *dlg = mDialogManager->outgoingDialog();
3090 if ( event ) { 3094 if ( event ) {
3091 Event *ev = new Event(*event); 3095 Event *ev = new Event(*event);
3092 ev->registerObserver(0); 3096 ev->registerObserver(0);
3093 ev->clearAttendees(); 3097 ev->clearAttendees();
3094 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { 3098 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) {
3095 delete(ev); 3099 delete(ev);
3096 } 3100 }
3097 } else { 3101 } else {
3098 if ( todo ) { 3102 if ( todo ) {
3099 Todo *ev = new Todo(*todo); 3103 Todo *ev = new Todo(*todo);
3100 ev->registerObserver(0); 3104 ev->registerObserver(0);
3101 ev->clearAttendees(); 3105 ev->clearAttendees();
3102 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { 3106 if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) {
3103 delete(ev); 3107 delete(ev);
3104 } 3108 }
3105 } 3109 }
3106 } 3110 }
3107 } 3111 }
3108 delete publishdlg; 3112 delete publishdlg;
3109} 3113}
3110 3114
3111void CalendarView::schedule_request(Incidence *incidence) 3115void CalendarView::schedule_request(Incidence *incidence)
3112{ 3116{
3113 schedule(Scheduler::Request,incidence); 3117 schedule(Scheduler::Request,incidence);
3114} 3118}
3115 3119
3116void CalendarView::schedule_refresh(Incidence *incidence) 3120void CalendarView::schedule_refresh(Incidence *incidence)
3117{ 3121{
3118 schedule(Scheduler::Refresh,incidence); 3122 schedule(Scheduler::Refresh,incidence);
3119} 3123}
3120 3124
3121void CalendarView::schedule_cancel(Incidence *incidence) 3125void CalendarView::schedule_cancel(Incidence *incidence)
3122{ 3126{
3123 schedule(Scheduler::Cancel,incidence); 3127 schedule(Scheduler::Cancel,incidence);
3124} 3128}
3125 3129
3126void CalendarView::schedule_add(Incidence *incidence) 3130void CalendarView::schedule_add(Incidence *incidence)
3127{ 3131{
3128 schedule(Scheduler::Add,incidence); 3132 schedule(Scheduler::Add,incidence);
3129} 3133}
3130 3134
3131void CalendarView::schedule_reply(Incidence *incidence) 3135void CalendarView::schedule_reply(Incidence *incidence)
3132{ 3136{
3133 schedule(Scheduler::Reply,incidence); 3137 schedule(Scheduler::Reply,incidence);
3134} 3138}
3135 3139
3136void CalendarView::schedule_counter(Incidence *incidence) 3140void CalendarView::schedule_counter(Incidence *incidence)
3137{ 3141{
3138 schedule(Scheduler::Counter,incidence); 3142 schedule(Scheduler::Counter,incidence);
3139} 3143}
3140 3144
3141void CalendarView::schedule_declinecounter(Incidence *incidence) 3145void CalendarView::schedule_declinecounter(Incidence *incidence)
3142{ 3146{
3143 schedule(Scheduler::Declinecounter,incidence); 3147 schedule(Scheduler::Declinecounter,incidence);
3144} 3148}
3145 3149
3146void CalendarView::schedule_publish_freebusy(int daysToPublish) 3150void CalendarView::schedule_publish_freebusy(int daysToPublish)
3147{ 3151{
3148 QDateTime start = QDateTime::currentDateTime(); 3152 QDateTime start = QDateTime::currentDateTime();
3149 QDateTime end = start.addDays(daysToPublish); 3153 QDateTime end = start.addDays(daysToPublish);
3150 3154
3151 FreeBusy *freebusy = new FreeBusy(mCalendar, start, end); 3155 FreeBusy *freebusy = new FreeBusy(mCalendar, start, end);
3152 freebusy->setOrganizer(KOPrefs::instance()->email()); 3156 freebusy->setOrganizer(KOPrefs::instance()->email());
3153 3157
3154 3158
3155 PublishDialog *publishdlg = new PublishDialog(); 3159 PublishDialog *publishdlg = new PublishDialog();
3156 if ( publishdlg->exec() == QDialog::Accepted ) { 3160 if ( publishdlg->exec() == QDialog::Accepted ) {
3157 OutgoingDialog *dlg = mDialogManager->outgoingDialog(); 3161 OutgoingDialog *dlg = mDialogManager->outgoingDialog();
3158 if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) { 3162 if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) {
3159 delete(freebusy); 3163 delete(freebusy);
3160 } 3164 }
3161 } 3165 }
3162 delete publishdlg; 3166 delete publishdlg;
3163} 3167}
3164 3168
3165void CalendarView::schedule(Scheduler::Method method, Incidence *incidence) 3169void CalendarView::schedule(Scheduler::Method method, Incidence *incidence)
3166{ 3170{
3167 Event *event = 0; 3171 Event *event = 0;
3168 Todo *todo = 0; 3172 Todo *todo = 0;
3169 3173
3170 if (incidence == 0) { 3174 if (incidence == 0) {
3171 incidence = mViewManager->currentView()->selectedIncidences().first(); 3175 incidence = mViewManager->currentView()->selectedIncidences().first();
3172 if (incidence == 0) { 3176 if (incidence == 0) {
3173 incidence = mTodoList->selectedIncidences().first(); 3177 incidence = mTodoList->selectedIncidences().first();
3174 } 3178 }
3175 } 3179 }
3176 if ( incidence && incidence->type() == "Event" ) { 3180 if ( incidence && incidence->type() == "Event" ) {
3177 event = static_cast<Event *>(incidence); 3181 event = static_cast<Event *>(incidence);
3178 } 3182 }
3179 if ( incidence && incidence->type() == "Todo" ) { 3183 if ( incidence && incidence->type() == "Todo" ) {
3180 todo = static_cast<Todo *>(incidence); 3184 todo = static_cast<Todo *>(incidence);
3181 } 3185 }
3182 3186
3183 if (!event && !todo) { 3187 if (!event && !todo) {
3184 KMessageBox::sorry(this,i18n("No event selected.")); 3188 KMessageBox::sorry(this,i18n("No event selected."));
3185 return; 3189 return;
3186 } 3190 }
3187 3191
3188 if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) { 3192 if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) {
3189 KMessageBox::sorry(this,i18n("The event has no attendees.")); 3193 KMessageBox::sorry(this,i18n("The event has no attendees."));
3190 return; 3194 return;
3191 } 3195 }
3192 3196
3193 Event *ev = 0; 3197 Event *ev = 0;
3194 if (event) ev = new Event(*event); 3198 if (event) ev = new Event(*event);
3195 Todo *to = 0; 3199 Todo *to = 0;
3196 if (todo) to = new Todo(*todo); 3200 if (todo) to = new Todo(*todo);
3197 3201
3198 if (method == Scheduler::Reply || method == Scheduler::Refresh) { 3202 if (method == Scheduler::Reply || method == Scheduler::Refresh) {
3199 Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); 3203 Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
3200 if (!me) { 3204 if (!me) {
3201 KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails.")); 3205 KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails."));
3202 return; 3206 return;
3203 } 3207 }
3204 if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) { 3208 if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) {
3205 StatusDialog *statdlg = new StatusDialog(this); 3209 StatusDialog *statdlg = new StatusDialog(this);
3206 if (!statdlg->exec()==QDialog::Accepted) return; 3210 if (!statdlg->exec()==QDialog::Accepted) return;
3207 me->setStatus( statdlg->status() ); 3211 me->setStatus( statdlg->status() );
3208 delete(statdlg); 3212 delete(statdlg);
3209 } 3213 }
3210 Attendee *menew = new Attendee(*me); 3214 Attendee *menew = new Attendee(*me);
3211 if (ev) { 3215 if (ev) {
3212 ev->clearAttendees(); 3216 ev->clearAttendees();
3213 ev->addAttendee(menew,false); 3217 ev->addAttendee(menew,false);
3214 } else { 3218 } else {
3215 if (to) { 3219 if (to) {
3216 todo->clearAttendees(); 3220 todo->clearAttendees();
3217 todo->addAttendee(menew,false); 3221 todo->addAttendee(menew,false);
3218 } 3222 }
3219 } 3223 }
3220 } 3224 }
3221 3225
3222 OutgoingDialog *dlg = mDialogManager->outgoingDialog(); 3226 OutgoingDialog *dlg = mDialogManager->outgoingDialog();
3223 if (ev) { 3227 if (ev) {
3224 if ( !dlg->addMessage(ev,method) ) delete(ev); 3228 if ( !dlg->addMessage(ev,method) ) delete(ev);
3225 } else { 3229 } else {
3226 if (to) { 3230 if (to) {
3227 if ( !dlg->addMessage(to,method) ) delete(to); 3231 if ( !dlg->addMessage(to,method) ) delete(to);
3228 } 3232 }
3229 } 3233 }
3230} 3234}
3231 3235
3232void CalendarView::openAddressbook() 3236void CalendarView::openAddressbook()
3233{ 3237{
3234 KRun::runCommand("kaddressbook"); 3238 KRun::runCommand("kaddressbook");
3235} 3239}
3236 3240
3237void CalendarView::setModified(bool modified) 3241void CalendarView::setModified(bool modified)
3238{ 3242{
3239 if ( modified ) 3243 if ( modified )
3240 emit signalmodified(); 3244 emit signalmodified();
3241 if (mModified != modified) { 3245 if (mModified != modified) {
3242 mModified = modified; 3246 mModified = modified;
3243 emit modifiedChanged(mModified); 3247 emit modifiedChanged(mModified);
3244 } 3248 }
3245} 3249}
3246 3250
3247bool CalendarView::isReadOnly() 3251bool CalendarView::isReadOnly()
3248{ 3252{
3249 return mReadOnly; 3253 return mReadOnly;
3250} 3254}
3251 3255
3252void CalendarView::setReadOnly(bool readOnly) 3256void CalendarView::setReadOnly(bool readOnly)
3253{ 3257{
3254 if (mReadOnly != readOnly) { 3258 if (mReadOnly != readOnly) {
3255 mReadOnly = readOnly; 3259 mReadOnly = readOnly;
3256 emit readOnlyChanged(mReadOnly); 3260 emit readOnlyChanged(mReadOnly);
3257 } 3261 }
3258} 3262}
3259 3263
3260bool CalendarView::isModified() 3264bool CalendarView::isModified()
3261{ 3265{
3262 return mModified; 3266 return mModified;
3263} 3267}
3264 3268
3265void CalendarView::printSetup() 3269void CalendarView::printSetup()
3266{ 3270{
3267#ifndef KORG_NOPRINTER 3271#ifndef KORG_NOPRINTER
3268 createPrinter(); 3272 createPrinter();
3269 3273
3270 mCalPrinter->setupPrinter(); 3274 mCalPrinter->setupPrinter();
3271#endif 3275#endif
3272} 3276}
3273 3277
3274void CalendarView::print() 3278void CalendarView::print()
3275{ 3279{
3276#ifndef KORG_NOPRINTER 3280#ifndef KORG_NOPRINTER
3277 createPrinter(); 3281 createPrinter();
3278 3282
3279 DateList tmpDateList = mNavigator->selectedDates(); 3283 DateList tmpDateList = mNavigator->selectedDates();
3280 mCalPrinter->print(CalPrinter::Month, 3284 mCalPrinter->print(CalPrinter::Month,
3281 tmpDateList.first(), tmpDateList.last()); 3285 tmpDateList.first(), tmpDateList.last());
3282#endif 3286#endif
3283} 3287}
3284 3288
3285void CalendarView::printPreview() 3289void CalendarView::printPreview()
3286{ 3290{
3287#ifndef KORG_NOPRINTER 3291#ifndef KORG_NOPRINTER
3288 kdDebug() << "CalendarView::printPreview()" << endl; 3292 kdDebug() << "CalendarView::printPreview()" << endl;
3289 3293
3290 createPrinter(); 3294 createPrinter();
3291 3295
3292 DateList tmpDateList = mNavigator->selectedDates(); 3296 DateList tmpDateList = mNavigator->selectedDates();
3293 3297
3294 mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(), 3298 mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(),
3295 tmpDateList.last()); 3299 tmpDateList.last());
3296#endif 3300#endif
3297} 3301}
3298 3302
3299void CalendarView::exportICalendar() 3303void CalendarView::exportICalendar()
3300{ 3304{
3301 QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this); 3305 QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this);
3302 3306
3303 // Force correct extension 3307 // Force correct extension
3304 if (filename.right(4) != ".ics") filename += ".ics"; 3308 if (filename.right(4) != ".ics") filename += ".ics";
3305 3309
3306 FileStorage storage( mCalendar, filename, new ICalFormat() ); 3310 FileStorage storage( mCalendar, filename, new ICalFormat() );
3307 storage.save(); 3311 storage.save();
3308} 3312}
3309 3313
3310bool CalendarView::exportVCalendar( QString filename ) 3314bool CalendarView::exportVCalendar( QString filename )
3311{ 3315{
3312 if (mCalendar->journals().count() > 0) { 3316 if (mCalendar->journals().count() > 0) {
3313 int result = KMessageBox::warningContinueCancel(this, 3317 int result = KMessageBox::warningContinueCancel(this,
3314 i18n("The journal entries can not be\nexported to a vCalendar file."), 3318 i18n("The journal entries can not be\nexported to a vCalendar file."),
3315 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), 3319 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"),
3316 true); 3320 true);
3317 if (result != KMessageBox::Continue) return false; 3321 if (result != KMessageBox::Continue) return false;
3318 } 3322 }
3319 3323
3320 //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this); 3324 //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this);
3321 3325
3322 // Force correct extension 3326 // Force correct extension
3323 if (filename.right(4) != ".vcs") filename += ".vcs"; 3327 if (filename.right(4) != ".vcs") filename += ".vcs";
3324 3328
3325 FileStorage storage( mCalendar, filename, new VCalFormat ); 3329 FileStorage storage( mCalendar, filename, new VCalFormat );
3326 return storage.save(); 3330 return storage.save();
3327 3331
3328} 3332}
3329 3333
3330void CalendarView::eventUpdated(Incidence *) 3334void CalendarView::eventUpdated(Incidence *)
3331{ 3335{
3332 setModified(); 3336 setModified();
3333 // Don't call updateView here. The code, which has caused the update of the 3337 // Don't call updateView here. The code, which has caused the update of the
3334 // event is responsible for updating the view. 3338 // event is responsible for updating the view.
3335 // updateView(); 3339 // updateView();
3336} 3340}
3337 3341
3338void CalendarView::adaptNavigationUnits() 3342void CalendarView::adaptNavigationUnits()
3339{ 3343{
3340 if (mViewManager->currentView()->isEventView()) { 3344 if (mViewManager->currentView()->isEventView()) {
3341 int days = mViewManager->currentView()->currentDateCount(); 3345 int days = mViewManager->currentView()->currentDateCount();
3342 if (days == 1) { 3346 if (days == 1) {
3343 emit changeNavStringPrev(i18n("&Previous Day")); 3347 emit changeNavStringPrev(i18n("&Previous Day"));
3344 emit changeNavStringNext(i18n("&Next Day")); 3348 emit changeNavStringNext(i18n("&Next Day"));
3345 } else { 3349 } else {
3346 emit changeNavStringPrev(i18n("&Previous Week")); 3350 emit changeNavStringPrev(i18n("&Previous Week"));
3347 emit changeNavStringNext(i18n("&Next Week")); 3351 emit changeNavStringNext(i18n("&Next Week"));
3348 } 3352 }
3349 } 3353 }
3350} 3354}
3351 3355
3352void CalendarView::processMainViewSelection( Incidence *incidence ) 3356void CalendarView::processMainViewSelection( Incidence *incidence )
3353{ 3357{
3354 if ( incidence ) mTodoList->clearSelection(); 3358 if ( incidence ) mTodoList->clearSelection();
3355 processIncidenceSelection( incidence ); 3359 processIncidenceSelection( incidence );
3356} 3360}
3357 3361
3358void CalendarView::processTodoListSelection( Incidence *incidence ) 3362void CalendarView::processTodoListSelection( Incidence *incidence )
3359{ 3363{
3360 if ( incidence && mViewManager->currentView() ) { 3364 if ( incidence && mViewManager->currentView() ) {
3361 mViewManager->currentView()->clearSelection(); 3365 mViewManager->currentView()->clearSelection();
3362 } 3366 }
3363 processIncidenceSelection( incidence ); 3367 processIncidenceSelection( incidence );
3364} 3368}
3365 3369
3366void CalendarView::processIncidenceSelection( Incidence *incidence ) 3370void CalendarView::processIncidenceSelection( Incidence *incidence )
3367{ 3371{
3368 if ( incidence == mSelectedIncidence ) return; 3372 if ( incidence == mSelectedIncidence ) return;
3369 3373
3370 mSelectedIncidence = incidence; 3374 mSelectedIncidence = incidence;
3371 3375
3372 emit incidenceSelected( mSelectedIncidence ); 3376 emit incidenceSelected( mSelectedIncidence );
3373 3377
3374 if ( incidence && incidence->type() == "Event" ) { 3378 if ( incidence && incidence->type() == "Event" ) {
3375 Event *event = static_cast<Event *>( incidence ); 3379 Event *event = static_cast<Event *>( incidence );
3376 if ( event->organizer() == KOPrefs::instance()->email() ) { 3380 if ( event->organizer() == KOPrefs::instance()->email() ) {
3377 emit organizerEventsSelected( true ); 3381 emit organizerEventsSelected( true );
3378 } else { 3382 } else {
3379 emit organizerEventsSelected(false); 3383 emit organizerEventsSelected(false);
3380 } 3384 }
3381 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, 3385 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails,
3382 KOPrefs::instance()->email() ) ) { 3386 KOPrefs::instance()->email() ) ) {
3383 emit groupEventsSelected( true ); 3387 emit groupEventsSelected( true );
3384 } else { 3388 } else {
3385 emit groupEventsSelected(false); 3389 emit groupEventsSelected(false);
3386 } 3390 }
3387 return; 3391 return;
3388 } else { 3392 } else {
3389 if ( incidence && incidence->type() == "Todo" ) { 3393 if ( incidence && incidence->type() == "Todo" ) {
3390 emit todoSelected( true ); 3394 emit todoSelected( true );
3391 Todo *event = static_cast<Todo *>( incidence ); 3395 Todo *event = static_cast<Todo *>( incidence );
3392 if ( event->organizer() == KOPrefs::instance()->email() ) { 3396 if ( event->organizer() == KOPrefs::instance()->email() ) {
3393 emit organizerEventsSelected( true ); 3397 emit organizerEventsSelected( true );
3394 } else { 3398 } else {
3395 emit organizerEventsSelected(false); 3399 emit organizerEventsSelected(false);
3396 } 3400 }
3397 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, 3401 if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails,
3398 KOPrefs::instance()->email() ) ) { 3402 KOPrefs::instance()->email() ) ) {
3399 emit groupEventsSelected( true ); 3403 emit groupEventsSelected( true );
3400 } else { 3404 } else {
3401 emit groupEventsSelected(false); 3405 emit groupEventsSelected(false);
3402 } 3406 }
3403 return; 3407 return;
3404 } else { 3408 } else {
3405 emit todoSelected( false ); 3409 emit todoSelected( false );
3406 emit organizerEventsSelected(false); 3410 emit organizerEventsSelected(false);
3407 emit groupEventsSelected(false); 3411 emit groupEventsSelected(false);
3408 } 3412 }
3409 return; 3413 return;
3410 } 3414 }
3411 3415
3412 /* if ( incidence && incidence->type() == "Todo" ) { 3416 /* if ( incidence && incidence->type() == "Todo" ) {
3413 emit todoSelected( true ); 3417 emit todoSelected( true );
3414 } else { 3418 } else {
3415 emit todoSelected( false ); 3419 emit todoSelected( false );
3416 }*/ 3420 }*/
3417} 3421}
3418 3422
3419 3423
3420void CalendarView::checkClipboard() 3424void CalendarView::checkClipboard()
3421{ 3425{
3422#ifndef KORG_NODND 3426#ifndef KORG_NODND
3423 if (ICalDrag::canDecode(QApplication::clipboard()->data())) { 3427 if (ICalDrag::canDecode(QApplication::clipboard()->data())) {
3424 emit pasteEnabled(true); 3428 emit pasteEnabled(true);
3425 } else { 3429 } else {
3426 emit pasteEnabled(false); 3430 emit pasteEnabled(false);
3427 } 3431 }
3428#endif 3432#endif
3429} 3433}
3430 3434
3431void CalendarView::showDates(const DateList &selectedDates) 3435void CalendarView::showDates(const DateList &selectedDates)
3432{ 3436{
3433 // kdDebug() << "CalendarView::selectDates()" << endl; 3437 // kdDebug() << "CalendarView::selectDates()" << endl;
3434 3438
3435 if ( mViewManager->currentView() ) { 3439 if ( mViewManager->currentView() ) {
3436 updateView( selectedDates.first(), selectedDates.last() ); 3440 updateView( selectedDates.first(), selectedDates.last() );
3437 } else { 3441 } else {
3438 mViewManager->showAgendaView(); 3442 mViewManager->showAgendaView();
3439 } 3443 }
3440 3444
3441 QString selDates; 3445 QString selDates;
3442 selDates = KGlobal::locale()->formatDate( selectedDates.first(), true); 3446 selDates = KGlobal::locale()->formatDate( selectedDates.first(), true);
3443 if (selectedDates.first() < selectedDates.last() ) 3447 if (selectedDates.first() < selectedDates.last() )
3444 selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); 3448 selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true);
3445 topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); 3449 topLevelWidget()->setCaption( i18n("Dates: ") + selDates );
3446 3450
3447} 3451}
3448 3452
3449QPtrList<CalFilter> CalendarView::filters() 3453QPtrList<CalFilter> CalendarView::filters()
3450{ 3454{
3451 return mFilters; 3455 return mFilters;
3452 3456
3453} 3457}
3454void CalendarView::editFilters() 3458void CalendarView::editFilters()
3455{ 3459{
3456 // kdDebug() << "CalendarView::editFilters()" << endl; 3460 // kdDebug() << "CalendarView::editFilters()" << endl;
3457 3461
3458 CalFilter *filter = mFilters.first(); 3462 CalFilter *filter = mFilters.first();
3459 while(filter) { 3463 while(filter) {
3460 kdDebug() << " Filter: " << filter->name() << endl; 3464 kdDebug() << " Filter: " << filter->name() << endl;
3461 filter = mFilters.next(); 3465 filter = mFilters.next();
3462 } 3466 }
3463 3467
3464 mDialogManager->showFilterEditDialog(&mFilters); 3468 mDialogManager->showFilterEditDialog(&mFilters);
3465} 3469}
3466void CalendarView::toggleFilter() 3470void CalendarView::toggleFilter()
3467{ 3471{
3468 showFilter(! mFilterView->isVisible()); 3472 showFilter(! mFilterView->isVisible());
3469} 3473}
3470 3474
3471KOFilterView *CalendarView::filterView() 3475KOFilterView *CalendarView::filterView()
3472{ 3476{
3473 return mFilterView; 3477 return mFilterView;
3474} 3478}
3475void CalendarView::selectFilter( int fil ) 3479void CalendarView::selectFilter( int fil )
3476{ 3480{
3477 mFilterView->setSelectedFilter( fil ); 3481 mFilterView->setSelectedFilter( fil );
3478} 3482}
3479void CalendarView::showFilter(bool visible) 3483void CalendarView::showFilter(bool visible)
3480{ 3484{
3481 if (visible) mFilterView->show(); 3485 if (visible) mFilterView->show();
3482 else mFilterView->hide(); 3486 else mFilterView->hide();
3483} 3487}
3484void CalendarView::toggleFilerEnabled( ) 3488void CalendarView::toggleFilerEnabled( )
3485{ 3489{
3486 mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); 3490 mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() );
3487 if ( !mFilterView->filtersEnabled() ) 3491 if ( !mFilterView->filtersEnabled() )
3488 topLevelWidget()->setCaption( i18n("Filter disabled ") ); 3492 topLevelWidget()->setCaption( i18n("Filter disabled ") );
3489 3493
3490} 3494}
3491void CalendarView::updateFilter() 3495void CalendarView::updateFilter()
3492{ 3496{
3493 CalFilter *filter = mFilterView->selectedFilter(); 3497 CalFilter *filter = mFilterView->selectedFilter();
3494 if (filter) { 3498 if (filter) {
3495 if (mFilterView->filtersEnabled()) { 3499 if (mFilterView->filtersEnabled()) {
3496 topLevelWidget()->setCaption( i18n("Filter selected: ")+filter->name() ); 3500 topLevelWidget()->setCaption( i18n("Filter selected: ")+filter->name() );
3497 filter->setEnabled(true); 3501 filter->setEnabled(true);
3498 } 3502 }
3499 else filter->setEnabled(false); 3503 else filter->setEnabled(false);
3500 mCalendar->setFilter(filter); 3504 mCalendar->setFilter(filter);
3501 updateView(); 3505 updateView();
3502 } 3506 }
3503} 3507}
3504 3508
3505void CalendarView::filterEdited() 3509void CalendarView::filterEdited()
3506{ 3510{
3507 mFilterView->updateFilters(); 3511 mFilterView->updateFilters();
3508 updateFilter(); 3512 updateFilter();
3509 writeSettings(); 3513 writeSettings();
3510} 3514}
3511 3515
3512 3516
3513void CalendarView::takeOverEvent() 3517void CalendarView::takeOverEvent()
3514{ 3518{
3515 Incidence *incidence = currentSelection(); 3519 Incidence *incidence = currentSelection();
3516 3520
3517 if (!incidence) return; 3521 if (!incidence) return;
3518 3522
3519 incidence->setOrganizer(KOPrefs::instance()->email()); 3523 incidence->setOrganizer(KOPrefs::instance()->email());
3520 incidence->recreate(); 3524 incidence->recreate();
3521 incidence->setReadOnly(false); 3525 incidence->setReadOnly(false);
3522 3526
3523 updateView(); 3527 updateView();
3524} 3528}
3525 3529
3526void CalendarView::takeOverCalendar() 3530void CalendarView::takeOverCalendar()
3527{ 3531{
3528 // TODO: Create Calendar::allIncidences() function and use it here 3532 // TODO: Create Calendar::allIncidences() function and use it here
3529 3533
3530 QPtrList<Event> events = mCalendar->events(); 3534 QPtrList<Event> events = mCalendar->events();
3531 for(uint i=0; i<events.count(); ++i) { 3535 for(uint i=0; i<events.count(); ++i) {
3532 events.at(i)->setOrganizer(KOPrefs::instance()->email()); 3536 events.at(i)->setOrganizer(KOPrefs::instance()->email());
3533 events.at(i)->recreate(); 3537 events.at(i)->recreate();
3534 events.at(i)->setReadOnly(false); 3538 events.at(i)->setReadOnly(false);
3535 } 3539 }
3536 3540
3537 QPtrList<Todo> todos = mCalendar->todos(); 3541 QPtrList<Todo> todos = mCalendar->todos();
3538 for(uint i=0; i<todos.count(); ++i) { 3542 for(uint i=0; i<todos.count(); ++i) {
3539 todos.at(i)->setOrganizer(KOPrefs::instance()->email()); 3543 todos.at(i)->setOrganizer(KOPrefs::instance()->email());
3540 todos.at(i)->recreate(); 3544 todos.at(i)->recreate();
3541 todos.at(i)->setReadOnly(false); 3545 todos.at(i)->setReadOnly(false);
3542 } 3546 }
3543 3547
3544 QPtrList<Journal> journals = mCalendar->journals(); 3548 QPtrList<Journal> journals = mCalendar->journals();
3545 for(uint i=0; i<journals.count(); ++i) { 3549 for(uint i=0; i<journals.count(); ++i) {
3546 journals.at(i)->setOrganizer(KOPrefs::instance()->email()); 3550 journals.at(i)->setOrganizer(KOPrefs::instance()->email());
3547 journals.at(i)->recreate(); 3551 journals.at(i)->recreate();
3548 journals.at(i)->setReadOnly(false); 3552 journals.at(i)->setReadOnly(false);
3549 } 3553 }
3550 3554
3551 updateView(); 3555 updateView();
3552} 3556}
3553 3557
3554void CalendarView::showIntro() 3558void CalendarView::showIntro()
3555{ 3559{
3556 kdDebug() << "To be implemented." << endl; 3560 kdDebug() << "To be implemented." << endl;
3557} 3561}
3558 3562
3559QWidgetStack *CalendarView::viewStack() 3563QWidgetStack *CalendarView::viewStack()
3560{ 3564{
3561 return mRightFrame; 3565 return mRightFrame;
3562} 3566}
3563 3567
3564QWidget *CalendarView::leftFrame() 3568QWidget *CalendarView::leftFrame()
3565{ 3569{
3566 return mLeftFrame; 3570 return mLeftFrame;
3567} 3571}
3568 3572
3569DateNavigator *CalendarView::dateNavigator() 3573DateNavigator *CalendarView::dateNavigator()
3570{ 3574{
3571 return mNavigator; 3575 return mNavigator;
3572} 3576}
3573 3577
3574KDateNavigator* CalendarView::dateNavigatorWidget() 3578KDateNavigator* CalendarView::dateNavigatorWidget()
3575{ 3579{
3576 return mDateNavigator; 3580 return mDateNavigator;
3577} 3581}
3578void CalendarView::toggleDateNavigatorWidget() 3582void CalendarView::toggleDateNavigatorWidget()
3579{ 3583{
3580 if (mDateNavigator->isVisible()) 3584 if (mDateNavigator->isVisible())
3581 mDateNavigator->hide(); 3585 mDateNavigator->hide();
3582 else 3586 else
3583 mDateNavigator->show(); 3587 mDateNavigator->show();
3584} 3588}
3585void CalendarView::addView(KOrg::BaseView *view) 3589void CalendarView::addView(KOrg::BaseView *view)
3586{ 3590{
3587 mViewManager->addView(view); 3591 mViewManager->addView(view);
3588} 3592}
3589 3593
3590void CalendarView::showView(KOrg::BaseView *view) 3594void CalendarView::showView(KOrg::BaseView *view)
3591{ 3595{
3592 mViewManager->showView(view, mLeftFrame->isVisible()); 3596 mViewManager->showView(view, mLeftFrame->isVisible());
3593} 3597}
3594 3598
3595Incidence *CalendarView::currentSelection() 3599Incidence *CalendarView::currentSelection()
3596{ 3600{
3597 return mViewManager->currentSelection(); 3601 return mViewManager->currentSelection();
3598} 3602}
3599void CalendarView::toggleAllDaySize() 3603void CalendarView::toggleAllDaySize()
3600{ 3604{
3601 /* 3605 /*
3602 if ( KOPrefs::instance()->mAllDaySize > 47 ) 3606 if ( KOPrefs::instance()->mAllDaySize > 47 )
3603 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; 3607 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2;
3604 else 3608 else
3605 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; 3609 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2;
3606 */ 3610 */
3607 viewManager()->agendaView()->toggleAllDay(); 3611 viewManager()->agendaView()->toggleAllDay();
3608} 3612}
3609void CalendarView::toggleExpand() 3613void CalendarView::toggleExpand()
3610{ 3614{
3611 // if ( mLeftFrame->isHidden() ) { 3615 // if ( mLeftFrame->isHidden() ) {
3612 // mLeftFrame->show(); 3616 // mLeftFrame->show();
3613 // emit calendarViewExpanded( false ); 3617 // emit calendarViewExpanded( false );
3614 // } else { 3618 // } else {
3615 // mLeftFrame->hide(); 3619 // mLeftFrame->hide();
3616 // emit calendarViewExpanded( true ); 3620 // emit calendarViewExpanded( true );
3617 // } 3621 // }
3618 3622
3619 globalFlagBlockAgenda = 1; 3623 globalFlagBlockAgenda = 1;
3620 emit calendarViewExpanded( !mLeftFrame->isHidden() ); 3624 emit calendarViewExpanded( !mLeftFrame->isHidden() );
3621 globalFlagBlockAgenda = 5; 3625 globalFlagBlockAgenda = 5;
3622 mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); 3626 mViewManager->raiseCurrentView( !mLeftFrame->isHidden() );
3623 //mViewManager->showView( 0, true ); 3627 //mViewManager->showView( 0, true );
3624} 3628}
3625 3629
3626void CalendarView::calendarModified( bool modified, Calendar * ) 3630void CalendarView::calendarModified( bool modified, Calendar * )
3627{ 3631{
3628 setModified( modified ); 3632 setModified( modified );
3629} 3633}
3630 3634
3631Todo *CalendarView::selectedTodo() 3635Todo *CalendarView::selectedTodo()
3632{ 3636{
3633 Incidence *incidence = currentSelection(); 3637 Incidence *incidence = currentSelection();
3634 if ( incidence && incidence->type() == "Todo" ) { 3638 if ( incidence && incidence->type() == "Todo" ) {
3635 return static_cast<Todo *>( incidence ); 3639 return static_cast<Todo *>( incidence );
3636 } 3640 }
3637 3641
3638 incidence = mTodoList->selectedIncidences().first(); 3642 incidence = mTodoList->selectedIncidences().first();
3639 if ( incidence && incidence->type() == "Todo" ) { 3643 if ( incidence && incidence->type() == "Todo" ) {
3640 return static_cast<Todo *>( incidence ); 3644 return static_cast<Todo *>( incidence );
3641 } 3645 }
3642 3646
3643 return 0; 3647 return 0;
3644} 3648}
3645 3649
3646void CalendarView::dialogClosing(Incidence *in) 3650void CalendarView::dialogClosing(Incidence *in)
3647{ 3651{
3648 // mDialogList.remove(in); 3652 // mDialogList.remove(in);
3649} 3653}
3650 3654
3651void CalendarView::showIncidence() 3655void CalendarView::showIncidence()
3652{ 3656{
3653 Incidence *incidence = currentSelection(); 3657 Incidence *incidence = currentSelection();
3654 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 3658 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
3655 if ( incidence ) { 3659 if ( incidence ) {
3656 ShowIncidenceVisitor v; 3660 ShowIncidenceVisitor v;
3657 v.act( incidence, this ); 3661 v.act( incidence, this );
3658 } 3662 }
3659} 3663}
3660void CalendarView::editIncidenceDescription() 3664void CalendarView::editIncidenceDescription()
3661{ 3665{
3662 mFlagEditDescription = true; 3666 mFlagEditDescription = true;
3663 editIncidence(); 3667 editIncidence();
3664 mFlagEditDescription = false; 3668 mFlagEditDescription = false;
3665} 3669}
3666void CalendarView::editIncidence() 3670void CalendarView::editIncidence()
3667{ 3671{
3668 // qDebug("editIncidence() "); 3672 // qDebug("editIncidence() ");
3669 Incidence *incidence = currentSelection(); 3673 Incidence *incidence = currentSelection();
3670 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 3674 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
3671 if ( incidence ) { 3675 if ( incidence ) {
3672 EditIncidenceVisitor v; 3676 EditIncidenceVisitor v;
3673 v.act( incidence, this ); 3677 v.act( incidence, this );
3674 } 3678 }
3675} 3679}
3676 3680
3677void CalendarView::deleteIncidence() 3681void CalendarView::deleteIncidence()
3678{ 3682{
3679 Incidence *incidence = currentSelection(); 3683 Incidence *incidence = currentSelection();
3680 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 3684 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
3681 if ( incidence ) { 3685 if ( incidence ) {
3682 deleteIncidence(incidence); 3686 deleteIncidence(incidence);
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index 46184ac..6965ba7 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -1,722 +1,722 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#include <qlabel.h> 20#include <qlabel.h>
21#include <qlayout.h> 21#include <qlayout.h>
22#include <qhbox.h> 22#include <qhbox.h>
23#include <qvbox.h> 23#include <qvbox.h>
24#include <qtooltip.h> 24#include <qtooltip.h>
25#include <qwhatsthis.h> 25#include <qwhatsthis.h>
26#include <qdragobject.h> 26#include <qdragobject.h>
27#include <qdrawutil.h> 27#include <qdrawutil.h>
28#include <qpainter.h> 28#include <qpainter.h>
29 29
30#include <kiconloader.h> 30#include <kiconloader.h>
31#include <kdebug.h> 31#include <kdebug.h>
32#include <kglobal.h> 32#include <kglobal.h>
33#include <klocale.h> 33#include <klocale.h>
34#ifndef DESKTOP_VERSION 34#ifndef DESKTOP_VERSION
35#include <qpe/qpeapplication.h> 35#include <qpe/qpeapplication.h>
36#define AGENDA_ICON_SIZE 5 36#define AGENDA_ICON_SIZE 5
37#else 37#else
38#define AGENDA_ICON_SIZE 7 38#define AGENDA_ICON_SIZE 7
39#endif 39#endif
40#include <libkcal/icaldrag.h> 40#include <libkcal/icaldrag.h>
41#include <libkcal/vcaldrag.h> 41#include <libkcal/vcaldrag.h>
42#include <libkcal/kincidenceformatter.h> 42#include <libkcal/kincidenceformatter.h>
43extern int globalFlagBlockAgenda; 43extern int globalFlagBlockAgenda;
44extern int globalFlagBlockAgendaItemPaint; 44extern int globalFlagBlockAgendaItemPaint;
45extern int globalFlagBlockAgendaItemUpdate; 45extern int globalFlagBlockAgendaItemUpdate;
46 46
47#include "koprefs.h" 47#include "koprefs.h"
48 48
49#include "koagendaitem.h" 49#include "koagendaitem.h"
50//#include "koagendaitem.moc" 50//#include "koagendaitem.moc"
51 51
52 52
53//-------------------------------------------------------------------------- 53//--------------------------------------------------------------------------
54 54
55QToolTipGroup *KOAgendaItem::mToolTipGroup = 0; 55QToolTipGroup *KOAgendaItem::mToolTipGroup = 0;
56 56
57//-------------------------------------------------------------------------- 57//--------------------------------------------------------------------------
58 58
59KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, 59KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday,
60 const char *name,WFlags) : 60 const char *name,WFlags) :
61 QWidget(parent, name), mIncidence(incidence), mDate(qd) 61 QWidget(parent, name), mIncidence(incidence), mDate(qd)
62{ 62{
63#ifndef DESKTOP_VERSION 63#ifndef DESKTOP_VERSION
64 QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); 64 QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold );
65#endif 65#endif
66 int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase 66 int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase
67 setWFlags ( wflags); 67 setWFlags ( wflags);
68 mAllDay = allday; 68 mAllDay = allday;
69 init ( incidence, qd ); 69 init ( incidence, qd );
70 setMouseTracking(true); 70 setMouseTracking(true);
71 //setAcceptDrops(true); 71 //setAcceptDrops(true);
72 xPaintCoord = -1; 72 xPaintCoord = -1;
73 yPaintCoord = -1; 73 yPaintCoord = -1;
74} 74}
75 75
76void KOAgendaItem::init ( Incidence *incidence, QDate qd ) 76void KOAgendaItem::init ( Incidence *incidence, QDate qd )
77{ 77{
78 mIncidence = incidence; 78 mIncidence = incidence;
79 mDate = qd; 79 mDate = qd;
80 mFirstMultiItem = 0; 80 mFirstMultiItem = 0;
81 mNextMultiItem = 0; 81 mNextMultiItem = 0;
82 mLastMultiItem = 0; 82 mLastMultiItem = 0;
83 computeText(); 83 computeText();
84 84
85 if ( (incidence->type() == "Todo") && 85 if ( (incidence->type() == "Todo") &&
86 ( !((static_cast<Todo*>(incidence))->isCompleted()) && 86 ( !((static_cast<Todo*>(incidence))->isCompleted()) &&
87 ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) { 87 ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) {
88 if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date()) 88 if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date())
89 mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; 89 mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ;
90 else 90 else
91 mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; 91 mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor;
92 } 92 }
93 else { 93 else {
94 QStringList categories = mIncidence->categories(); 94 QStringList categories = mIncidence->categories();
95 QString cat = categories.first(); 95 QString cat = categories.first();
96 if (cat.isEmpty()) { 96 if (cat.isEmpty()) {
97 mBackgroundColor =KOPrefs::instance()->mEventColor; 97 mBackgroundColor =KOPrefs::instance()->mEventColor;
98 } else { 98 } else {
99 mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); 99 mBackgroundColor = *KOPrefs::instance()->categoryColor(cat);
100 } 100 }
101 } 101 }
102 mColorGroup = QColorGroup( mBackgroundColor.light(), 102 mColorGroup = QColorGroup( mBackgroundColor.light(),
103 mBackgroundColor.dark(),mBackgroundColor.light(), 103 mBackgroundColor.dark(),mBackgroundColor.light(),
104 mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ; 104 mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ;
105 setBackgroundColor( mBackgroundColor ); 105 setBackgroundColor( mBackgroundColor );
106 106
107 setCellXY(0,0,1); 107 setCellXY(0,0,1);
108 setCellXWidth(0); 108 setCellXWidth(0);
109 setSubCell(0); 109 setSubCell(0);
110 setSubCells(1); 110 setSubCells(1);
111 setMultiItem(0,0,0); 111 setMultiItem(0,0,0);
112 startMove(); 112 startMove();
113 mSelected = true; 113 mSelected = true;
114 select(false); 114 select(false);
115 QString tipText = mIncidence->summary(); 115 QString tipText = mIncidence->summary();
116 // QToolTip::add(this,tipText); 116 // QToolTip::add(this,tipText);
117 QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); 117 QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence ));
118 if ( !mIncidence->doesFloat() ) 118 if ( !mIncidence->doesFloat() )
119 if ( mIncidence->type() == "Event" ) { 119 if ( mIncidence->type() == "Event" ) {
120 if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) { 120 if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) {
121 tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr(); 121 tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr();
122 tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr(); 122 tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr();
123 } 123 }
124 else { 124 else {
125 tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr(); 125 tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr();
126 tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr(); 126 tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr();
127 } 127 }
128 } 128 }
129 else if ( mIncidence->type() == "Todo" ) { 129 else if ( mIncidence->type() == "Todo" ) {
130 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueTimeStr(); 130 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueTimeStr();
131 } 131 }
132 132
133 if (!mIncidence->location().isEmpty()) { 133 if (!mIncidence->location().isEmpty()) {
134 tipText += "\n"+i18n("Location: ")+mIncidence->location(); 134 tipText += "\n"+i18n("Location: ")+mIncidence->location();
135 } 135 }
136 QToolTip::add(this,tipText,toolTipGroup(),""); 136 QToolTip::add(this,tipText,toolTipGroup(),"");
137 QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); 137 QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont);
138 mFontPixelSize = fontinf.height();; 138 mFontPixelSize = fontinf.height();;
139 hide(); 139 hide();
140 xPaintCoord = -1; 140 xPaintCoord = -1;
141 yPaintCoord = -1; 141 yPaintCoord = -1;
142} 142}
143 143
144 144
145KOAgendaItem::~KOAgendaItem() 145KOAgendaItem::~KOAgendaItem()
146{ 146{
147 // qDebug("deleteKOAgendaItem::~KOAgendaItem( "); 147 // qDebug("deleteKOAgendaItem::~KOAgendaItem( ");
148 148
149} 149}
150 150
151void KOAgendaItem::recreateIncidence() 151void KOAgendaItem::recreateIncidence()
152{ 152{
153#if 0 153#if 0
154 Incidence* newInc = mIncidence->clone(); 154 Incidence* newInc = mIncidence->clone();
155 newInc->recreate(); 155 newInc->recreate();
156 if ( mIncidence->doesRecur() ) { 156 if ( mIncidence->doesRecur() ) {
157 mIncidence->addExDate( mDate ); 157 mIncidence->addExDate( mDate );
158 newInc->recurrence()->unsetRecurs(); 158 newInc->recurrence()->unsetRecurs();
159 int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); 159 int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd());
160 QTime tim = mIncidence->dtStart().time(); 160 QTime tim = mIncidence->dtStart().time();
161 newInc->setDtStart( QDateTime(mDate, tim) ); 161 newInc->setDtStart( QDateTime(mDate, tim) );
162 ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); 162 ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) );
163 } 163 }
164#endif 164#endif
165 mIncidence = mIncidence->recreateCloneException( mDate ); 165 mIncidence = mIncidence->recreateCloneException( mDate );
166} 166}
167bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) 167bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout)
168{ 168{
169 int size = AGENDA_ICON_SIZE; 169 int size = AGENDA_ICON_SIZE;
170 170
171 int yOff = 0; 171 int yOff = 0;
172 int xOff = 0; 172 int xOff = 0;
173 int x = pos().x() +3; 173 int x = pos().x() +3;
174 int y; 174 int y;
175 if ( mAllDay ) 175 if ( mAllDay )
176 y = pos().y()+3; 176 y = pos().y()+3;
177 else 177 else
178 y = mCellYTop * ( height() / cellHeight() ) +3; 178 y = mCellYTop * ( height() / cellHeight() ) +3;
179 if (mIncidence->cancelled()) { 179 if (mIncidence->cancelled()) {
180 int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x; 180 int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x;
181 int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y; 181 int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y;
182 p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 ); 182 p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 );
183 p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos ); 183 p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos );
184 if ( horLayout ) 184 if ( horLayout )
185 ++xOff; 185 ++xOff;
186 else 186 else
187 ++yOff; 187 ++yOff;
188 } 188 }
189 if (mIncidence->isAlarmEnabled()) { 189 if (mIncidence->isAlarmEnabled()) {
190 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red ); 190 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red );
191 if ( horLayout ) 191 if ( horLayout )
192 ++xOff; 192 ++xOff;
193 else 193 else
194 ++yOff; 194 ++yOff;
195 } 195 }
196 if (mIncidence->recurrence()->doesRecur()) { 196 if (mIncidence->recurrence()->doesRecur()) {
197 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue ); 197 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue );
198 if ( horLayout ) 198 if ( horLayout )
199 ++xOff; 199 ++xOff;
200 else 200 else
201 ++yOff; 201 ++yOff;
202 } 202 }
203 if (mIncidence->description().length() > 0) { 203 if (mIncidence->description().length() > 0) {
204 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen ); 204 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen );
205 if ( horLayout ) 205 if ( horLayout )
206 ++xOff; 206 ++xOff;
207 else 207 else
208 ++yOff; 208 ++yOff;
209 } 209 }
210 if (mIncidence->isReadOnly()) { 210 if (mIncidence->isReadOnly()) {
211 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white ); 211 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white );
212 if ( horLayout ) 212 if ( horLayout )
213 ++xOff; 213 ++xOff;
214 else 214 else
215 ++yOff; 215 ++yOff;
216 } 216 }
217 217
218 if (mIncidence->attendeeCount()>0) { 218 if (mIncidence->attendeeCount()>0) {
219 219
220 if (mIncidence->organizer() == KOPrefs::instance()->email()) { 220 if (mIncidence->organizer() == KOPrefs::instance()->email()) {
221 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black ); 221 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black );
222 if ( horLayout ) 222 if ( horLayout )
223 ++xOff; 223 ++xOff;
224 else 224 else
225 ++yOff; 225 ++yOff;
226 } else { 226 } else {
227 Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); 227 Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
228 if (me!=0) { 228 if (me!=0) {
229 229
230 230
231 } else { 231 } else {
232 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow ); 232 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow );
233 if ( horLayout ) 233 if ( horLayout )
234 ++xOff; 234 ++xOff;
235 else 235 else
236 ++yOff; 236 ++yOff;
237 237
238 } 238 }
239 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow ); 239 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow );
240 if ( horLayout ) 240 if ( horLayout )
241 ++xOff; 241 ++xOff;
242 else 242 else
243 ++yOff; 243 ++yOff;
244 244
245 } 245 }
246 246
247 } 247 }
248 return ( yOff || xOff ); 248 return ( yOff || xOff );
249} 249}
250 250
251 251
252void KOAgendaItem::select(bool selected) 252void KOAgendaItem::select(bool selected)
253{ 253{
254 //qDebug("select %d %d",firstMultiItem(), nextMultiItem() ); 254 //qDebug("select %d %d",firstMultiItem(), nextMultiItem() );
255 if (mSelected == selected) return; 255 if (mSelected == selected) return;
256 mSelected = selected; 256 mSelected = selected;
257 if ( ! isVisible() ) 257 if ( ! isVisible() )
258 return; 258 return;
259 if ( firstMultiItem() ) 259 if ( firstMultiItem() )
260 firstMultiItem()->select( selected ); 260 firstMultiItem()->select( selected );
261 if ( !firstMultiItem() && nextMultiItem() ) { 261 if ( !firstMultiItem() && nextMultiItem() ) {
262 KOAgendaItem * placeItem = nextMultiItem(); 262 KOAgendaItem * placeItem = nextMultiItem();
263 while ( placeItem ) { 263 while ( placeItem ) {
264 placeItem->select( selected ); 264 placeItem->select( selected );
265 placeItem = placeItem->nextMultiItem(); 265 placeItem = placeItem->nextMultiItem();
266 } 266 }
267 } 267 }
268 globalFlagBlockAgendaItemUpdate = 0; 268 globalFlagBlockAgendaItemUpdate = 0;
269 paintMe( selected ); 269 paintMe( selected );
270 globalFlagBlockAgendaItemUpdate = 1; 270 globalFlagBlockAgendaItemUpdate = 1;
271 repaint( false ); 271 repaint( false );
272} 272}
273 273
274 274
275/* 275/*
276 The eventFilter has to filter the mouse events of the agenda item childs. The 276 The eventFilter has to filter the mouse events of the agenda item childs. The
277 events are fed into the event handling method of KOAgendaItem. This allows the 277 events are fed into the event handling method of KOAgendaItem. This allows the
278 KOAgenda to handle the KOAgendaItems by using an eventFilter. 278 KOAgenda to handle the KOAgendaItems by using an eventFilter.
279*/ 279*/
280bool KOAgendaItem::eventFilter ( QObject *object, QEvent *e ) 280bool KOAgendaItem::eventFilter ( QObject *object, QEvent *e )
281{ 281{
282 if (e->type() == QEvent::MouseButtonPress || 282 if (e->type() == QEvent::MouseButtonPress ||
283 e->type() == QEvent::MouseButtonDblClick || 283 e->type() == QEvent::MouseButtonDblClick ||
284 e->type() == QEvent::MouseButtonRelease || 284 e->type() == QEvent::MouseButtonRelease ||
285 e->type() == QEvent::MouseMove) { 285 e->type() == QEvent::MouseMove) {
286 QMouseEvent *me = (QMouseEvent *)e; 286 QMouseEvent *me = (QMouseEvent *)e;
287 QPoint itemPos = this->mapFromGlobal(((QWidget *)object)-> 287 QPoint itemPos = this->mapFromGlobal(((QWidget *)object)->
288 mapToGlobal(me->pos())); 288 mapToGlobal(me->pos()));
289 QMouseEvent returnEvent (e->type(),itemPos,me->button(),me->state()); 289 QMouseEvent returnEvent (e->type(),itemPos,me->button(),me->state());
290 return event(&returnEvent); 290 return event(&returnEvent);
291 } else { 291 } else {
292 return false; 292 return false;
293 } 293 }
294} 294}
295void KOAgendaItem::repaintMe( ) 295void KOAgendaItem::repaintMe( )
296{ 296{
297 paintMe ( mSelected ); 297 paintMe ( mSelected );
298} 298}
299void KOAgendaItem::paintMe( bool selected, QPainter* paint ) 299void KOAgendaItem::paintMe( bool selected, QPainter* paint )
300{ 300{
301 if ( globalFlagBlockAgendaItemUpdate && ! selected) 301 if ( globalFlagBlockAgendaItemUpdate && ! selected)
302 return; 302 return;
303 QPainter pa; 303 QPainter pa;
304 304
305 if ( mSelected ) { 305 if ( mSelected ) {
306 pa.begin( paintPixSel() ); 306 pa.begin( paintPixSel() );
307 } else { 307 } else {
308 if ( mAllDay ) 308 if ( mAllDay )
309 pa.begin( paintPixAllday() ); 309 pa.begin( paintPixAllday() );
310 else 310 else
311 pa.begin( paintPix() ); 311 pa.begin( paintPix() );
312 } 312 }
313 int x, yy, w, h; 313 int x, yy, w, h;
314 float nfh; 314 float nfh;
315 x = pos().x(); w = width(); h = height (); 315 x = pos().x(); w = width(); h = height ();
316 if ( mAllDay ) 316 if ( mAllDay )
317 yy = y(); 317 yy = y();
318 else 318 else
319 yy = mCellYTop * ( height() / cellHeight() ); 319 yy = mCellYTop * ( height() / cellHeight() );
320 xPaintCoord= x; 320 xPaintCoord= x;
321 yPaintCoord = yy; 321 yPaintCoord = yy;
322 wPaintCoord = width(); 322 wPaintCoord = width();
323 hPaintCoord = height(); 323 hPaintCoord = height();
324 //qDebug("paintMe %s %d %d %d %d",incidence()->summary().latin1(), x, yy, width(), height()); 324 //qDebug("paintMe %s %d %d %d %d",incidence()->summary().latin1(), x, yy, width(), height());
325 if ( paint == 0 ) 325 if ( paint == 0 )
326 paint = &pa; 326 paint = &pa;
327 bool horLayout = ( w < h ); 327 bool horLayout = ( w < h );
328 int maxhei = mFontPixelSize+4; 328 int maxhei = mFontPixelSize+4;
329 if ( horLayout ) 329 if ( horLayout )
330 maxhei += AGENDA_ICON_SIZE -4; 330 maxhei += AGENDA_ICON_SIZE -4;
331 bool small = ( h < maxhei ); 331 bool small = ( h < maxhei );
332 if ( ! small ) 332 if ( ! small )
333 paint->setFont(KOPrefs::instance()->mAgendaViewFont); 333 paint->setFont(KOPrefs::instance()->mAgendaViewFont);
334 else { 334 else {
335 QFont f = KOPrefs::instance()->mAgendaViewFont; 335 QFont f = KOPrefs::instance()->mAgendaViewFont;
336 f.setBold( false ); 336 f.setBold( false );
337 int fh = f.pointSize(); 337 int fh = f.pointSize();
338 nfh = (((float)height())/(float)(mFontPixelSize+4))*fh; 338 nfh = (((float)height())/(float)(mFontPixelSize+4))*fh;
339 if ( nfh < 6 ) 339 if ( nfh < 6 )
340 nfh = 6; 340 nfh = 6;
341 f.setPointSize( nfh ); 341 f.setPointSize( nfh );
342 paint->setFont(f); 342 paint->setFont(f);
343 } 343 }
344 paint->fillRect ( x, yy, w, h, mBackgroundColor ); 344 paint->fillRect ( x, yy, w, h, mBackgroundColor );
345 static const QPixmap completedPxmp = SmallIcon("greenhook16"); 345 static const QPixmap completedPxmp = SmallIcon("greenhook16");
346 static const QPixmap overduePxmp = SmallIcon("redcross16"); 346 static const QPixmap overduePxmp = SmallIcon("redcross16");
347 if ( mIncidence->type() == "Todo" ) { 347 if ( mIncidence->type() == "Todo" ) {
348 Todo* tempTodo = static_cast<Todo*>(mIncidence); 348 Todo* tempTodo = static_cast<Todo*>(mIncidence);
349 int xx = pos().x()+(width()-completedPxmp.width()-3 ); 349 int xx = pos().x()+(width()-completedPxmp.width()-3 );
350 int yyy = yy+3; 350 int yyy = yy+3;
351 if ( tempTodo->isCompleted() ) 351 if ( tempTodo->isCompleted() )
352 paint->drawPixmap ( xx, yyy, completedPxmp ); 352 paint->drawPixmap ( xx, yyy, completedPxmp );
353 else { 353 else {
354 paint->drawPixmap ( xx, yyy, overduePxmp ); 354 paint->drawPixmap ( xx, yyy, overduePxmp );
355 355
356 } 356 }
357 } 357 }
358 bool addIcon = false; 358 bool addIcon = false;
359 if ( ! small || w > 3 * h || h > 3* w ) 359 if ( ! small || w > 3 * h || h > 3* w )
360 addIcon = updateIcons( paint, horLayout ); 360 addIcon = updateIcons( paint, horLayout );
361 361
362 qDrawShadePanel (paint, x, yy, w, h, mColorGroup, selected , 2, 0); 362 qDrawShadePanel (paint, x, yy, w, h, mColorGroup, selected , 2, 0);
363 //qDebug("draw rect %d %d %d %d ",x, yy, w, h ); 363 //qDebug("draw rect %d %d %d %d ",x, yy, w, h );
364 if ( ! small ) { 364 if ( ! small ) {
365 x += 3; yy += 3;w -= 6; h-= 5; 365 x += 3; yy += 3;w -= 6; h-= 5;
366 } else { 366 } else {
367 x += 2; yy += 1;w -= 4; h-= 4; 367 x += 2; yy += 1;w -= 4; h-= 4;
368 if ( nfh < 6.01 ) { 368 if ( nfh < 6.01 ) {
369 yy -= 2; 369 yy -= 2;
370 h += 4; 370 h += 4;
371 } 371 }
372 else 372 else
373 if ( nfh < h -2 ) 373 if ( nfh < h -2 )
374 ++yy; 374 ++yy;
375 } 375 }
376 int align; 376 int align;
377#ifndef DESKTOP_VERSION 377#ifndef DESKTOP_VERSION
378 align = ( AlignLeft|WordBreak|AlignTop); 378 align = ( AlignLeft|WordBreak|AlignTop);
379#else 379#else
380 align = ( AlignLeft|BreakAnywhere|WordBreak|AlignTop); 380 align = ( AlignLeft|BreakAnywhere|WordBreak|AlignTop);
381#endif 381#endif
382 if ( addIcon ) { 382 if ( addIcon ) {
383 if ( ! horLayout ) { 383 if ( ! horLayout ) {
384 x += AGENDA_ICON_SIZE+3; 384 x += AGENDA_ICON_SIZE+3;
385 w -= (AGENDA_ICON_SIZE+3); 385 w -= (AGENDA_ICON_SIZE+3);
386 } 386 }
387 else { 387 else {
388 yy+= AGENDA_ICON_SIZE+2; 388 yy+= AGENDA_ICON_SIZE+2;
389 h -=(AGENDA_ICON_SIZE+3); 389 h -=(AGENDA_ICON_SIZE+3);
390 } 390 }
391 } 391 }
392 int colsum = mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue(); 392 int colsum = mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue();
393 if ( colsum < 250 ) 393 if ( colsum < 250 )
394 paint->setPen ( white); 394 paint->setPen ( white);
395 if ( x < 0 ) { 395 if ( x < 0 ) {
396 w = w+x-3; 396 w = w+x-3;
397 x = 3; 397 x = 3;
398 if ( w > parentWidget()->width() ){ 398 if ( w > parentWidget()->width() ){
399 w = parentWidget()->width() - 6; 399 w = parentWidget()->width() - 6;
400#ifndef DESKTOP_VERSION 400#ifndef DESKTOP_VERSION
401 align = ( AlignCenter|WordBreak); 401 align = ( AlignCenter|WordBreak);
402#else 402#else
403 align = ( AlignCenter|BreakAnywhere|WordBreak); 403 align = ( AlignCenter|BreakAnywhere|WordBreak);
404#endif 404#endif
405 405
406 } 406 }
407 } 407 }
408 QRect dr; 408 QRect dr;
409 paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr ); 409 paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr );
410 if ( mIncidence->cancelled() ){ 410 if ( mIncidence->cancelled() ){
411 if ( ! small ) { 411 if ( ! small ) {
412 QFontMetrics fm ( paint->font() ); 412 QFontMetrics fm ( paint->font() );
413 paint->drawLine(dr.left(), yy+fm.height()/2, dr.right()-2, yy+fm.height()/2); 413 paint->drawLine(dr.left(), yy+fm.height()/2, dr.right()-2, yy+fm.height()/2);
414 } 414 }
415 415
416 } 416 }
417 pa.end(); 417 pa.end();
418 418
419} 419}
420void KOAgendaItem::resizePixmap( int w , int h ) 420void KOAgendaItem::resizePixmap( int w , int h )
421{ 421{
422 paintPix()->resize( w, h ); 422 paintPix()->resize( w, h );
423 paintPixSel()->resize( w, h ); 423 paintPixSel()->resize( w, h );
424 424
425} 425}
426QPixmap * KOAgendaItem::paintPix() 426QPixmap * KOAgendaItem::paintPix()
427{ 427{
428 static QPixmap* mPaintPix = 0; 428 static QPixmap* mPaintPix = 0;
429 if ( ! mPaintPix ) 429 if ( ! mPaintPix )
430 mPaintPix = new QPixmap(); 430 mPaintPix = new QPixmap();
431 return mPaintPix ; 431 return mPaintPix ;
432} 432}
433QPixmap * KOAgendaItem::paintPixAllday() 433QPixmap * KOAgendaItem::paintPixAllday()
434{ 434{
435 static QPixmap* mPaintPixA = 0; 435 static QPixmap* mPaintPixA = 0;
436 if ( ! mPaintPixA ) 436 if ( ! mPaintPixA )
437 mPaintPixA = new QPixmap(); 437 mPaintPixA = new QPixmap();
438 return mPaintPixA ; 438 return mPaintPixA ;
439} 439}
440QPixmap * KOAgendaItem::paintPixSel() 440QPixmap * KOAgendaItem::paintPixSel()
441{ 441{
442 static QPixmap* mPaintPixSel = 0; 442 static QPixmap* mPaintPixSel = 0;
443 if ( ! mPaintPixSel ) 443 if ( ! mPaintPixSel )
444 mPaintPixSel = new QPixmap(); 444 mPaintPixSel = new QPixmap();
445 return mPaintPixSel ; 445 return mPaintPixSel ;
446} 446}
447void KOAgendaItem::paintEvent ( QPaintEvent *e ) 447void KOAgendaItem::paintEvent ( QPaintEvent *e )
448{ 448{
449 449
450 if ( globalFlagBlockAgendaItemPaint ) 450 if ( globalFlagBlockAgendaItemPaint )
451 return; 451 return;
452 if ( globalFlagBlockAgenda > 0 && globalFlagBlockAgenda < 5 ) 452 if ( globalFlagBlockAgenda > 0 && globalFlagBlockAgenda < 5 )
453 return; 453 return;
454 int yy; 454 int yy;
455 if ( mAllDay ) 455 if ( mAllDay )
456 yy = y(); 456 yy = y();
457 else 457 else
458 yy = mCellYTop * ( height() / cellHeight() ); 458 yy = mCellYTop * ( height() / cellHeight() );
459 int xx = x(); 459 int xx = x();
460 if ( xPaintCoord != xx || yPaintCoord != yy || 460 if ( xPaintCoord != xx || yPaintCoord != yy ||
461 wPaintCoord != width() || hPaintCoord != height()) { 461 wPaintCoord != width() || hPaintCoord != height()) {
462 xPaintCoord= xx; 462 xPaintCoord= xx;
463 yPaintCoord = yy; 463 yPaintCoord = yy;
464 wPaintCoord = width(); 464 wPaintCoord = width();
465 hPaintCoord = height(); 465 hPaintCoord = height();
466 globalFlagBlockAgendaItemUpdate = 0; 466 globalFlagBlockAgendaItemUpdate = 0;
467 paintMe( mSelected ); 467 paintMe( mSelected );
468 //qDebug("calling paintMe "); 468 //qDebug("calling paintMe ");
469 globalFlagBlockAgendaItemUpdate = 1; 469 globalFlagBlockAgendaItemUpdate = 1;
470 } 470 }
471 int rx, ry, rw, rh; 471 int rx, ry, rw, rh;
472 rx = e->rect().x(); 472 rx = e->rect().x();
473 ry = e->rect().y(); 473 ry = e->rect().y();
474 rw = e->rect().width(); 474 rw = e->rect().width();
475 rh = e->rect().height(); 475 rh = e->rect().height();
476 //qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height()); 476 //qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height());
477 477
478 QPixmap* paintFrom ; 478 QPixmap* paintFrom ;
479 if ( mSelected ) { 479 if ( mSelected ) {
480 paintFrom = paintPixSel(); 480 paintFrom = paintPixSel();
481 } else { 481 } else {
482 if ( mAllDay ) 482 if ( mAllDay )
483 paintFrom = paintPixAllday(); 483 paintFrom = paintPixAllday();
484 else 484 else
485 paintFrom = paintPix(); 485 paintFrom = paintPix();
486 } 486 }
487 bitBlt (this, rx, ry, paintFrom, x()+rx ,yPaintCoord+ry, rw, rh ,CopyROP); 487 bitBlt (this, rx, ry, paintFrom, x()+rx ,yPaintCoord+ry, rw, rh ,CopyROP);
488} 488}
489void KOAgendaItem::computeText() 489void KOAgendaItem::computeText()
490{ 490{
491 mDisplayedText = mIncidence->summary(); 491 mDisplayedText = mIncidence->summary();
492 if ( (mIncidence->type() == "Todo") ) { 492 if ( (mIncidence->type() == "Todo") ) {
493 if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() ) 493 if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() )
494 mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")"; 494 mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")";
495 else if ( !(mIncidence->doesFloat())) 495 else if ( !(mIncidence->doesFloat()))
496 mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")"; 496 mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")";
497 497
498 498
499 499
500 } else { 500 } else {
501 if ( !(mIncidence->doesFloat())) 501 if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda)
502 mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + "-" + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ; 502 mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + "-" + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ;
503 503
504 if ( mAllDay ) { 504 if ( mAllDay ) {
505 if ( mIncidence->dtStart().date().addDays(3) < mIncidence->dtEnd().date() ) { 505 if ( mIncidence->dtStart().date().addDays(3) < mIncidence->dtEnd().date() ) {
506 mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtEnd().date(), true) ; 506 mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtEnd().date(), true) ;
507 } 507 }
508 } 508 }
509 509
510 } 510 }
511 511
512 if ( !mIncidence->location().isEmpty() ) { 512 if ( !mIncidence->location().isEmpty() ) {
513 if ( mAllDay ) 513 if ( mAllDay )
514 mDisplayedText += " ("; 514 mDisplayedText += " (";
515 else 515 else
516 mDisplayedText += "\n("; 516 mDisplayedText += "\n(";
517 mDisplayedText += mIncidence->location() +")"; 517 mDisplayedText += mIncidence->location() +")";
518 } 518 }
519} 519}
520void KOAgendaItem::updateItem() 520void KOAgendaItem::updateItem()
521{ 521{
522 computeText(); 522 computeText();
523 523
524 //qDebug("KOAgendaItem:: updateItem() %s %d %d ",incidence()->summary().latin1(), x(), y()); 524 //qDebug("KOAgendaItem:: updateItem() %s %d %d ",incidence()->summary().latin1(), x(), y());
525 paintMe( mSelected ); 525 paintMe( mSelected );
526 repaint( false); 526 repaint( false);
527} 527}
528 528
529void KOAgendaItem::resizeEvent ( QResizeEvent *ev ) 529void KOAgendaItem::resizeEvent ( QResizeEvent *ev )
530{ 530{
531 //qDebug("KOAgendaItem::resizeEvent %s ", mIncidence->summary().latin1()); 531 //qDebug("KOAgendaItem::resizeEvent %s ", mIncidence->summary().latin1());
532 paintMe( mSelected ); 532 paintMe( mSelected );
533 repaint( false ); 533 repaint( false );
534} 534}
535 535
536/* 536/*
537 Return height of item in units of agenda cells 537 Return height of item in units of agenda cells
538*/ 538*/
539int KOAgendaItem::cellHeight() 539int KOAgendaItem::cellHeight()
540{ 540{
541 int ret = mCellYBottom - mCellYTop + 1; 541 int ret = mCellYBottom - mCellYTop + 1;
542 if ( ret <= 0 ) { 542 if ( ret <= 0 ) {
543 ret = 1; 543 ret = 1;
544 mCellYBottom = 0; 544 mCellYBottom = 0;
545 mCellYTop = 0; 545 mCellYTop = 0;
546 } 546 }
547 return ret; 547 return ret;
548} 548}
549 549
550/* 550/*
551 Return height of item in units of agenda cells 551 Return height of item in units of agenda cells
552*/ 552*/
553int KOAgendaItem::cellWidth() 553int KOAgendaItem::cellWidth()
554{ 554{
555 return mCellXWidth - mCellX + 1; 555 return mCellXWidth - mCellX + 1;
556} 556}
557 557
558void KOAgendaItem::setItemDate(QDate qd) 558void KOAgendaItem::setItemDate(QDate qd)
559{ 559{
560 mDate = qd; 560 mDate = qd;
561} 561}
562 562
563void KOAgendaItem::setCellXY(int X, int YTop, int YBottom) 563void KOAgendaItem::setCellXY(int X, int YTop, int YBottom)
564{ 564{
565 mCellX = X; 565 mCellX = X;
566 mCellYTop = YTop; 566 mCellYTop = YTop;
567 mCellYBottom = YBottom; 567 mCellYBottom = YBottom;
568} 568}
569 569
570void KOAgendaItem::setCellXWidth(int xwidth) 570void KOAgendaItem::setCellXWidth(int xwidth)
571{ 571{
572 mCellXWidth = xwidth; 572 mCellXWidth = xwidth;
573} 573}
574 574
575void KOAgendaItem::setCellX(int XLeft, int XRight) 575void KOAgendaItem::setCellX(int XLeft, int XRight)
576{ 576{
577 mCellX = XLeft; 577 mCellX = XLeft;
578 mCellXWidth = XRight; 578 mCellXWidth = XRight;
579} 579}
580 580
581void KOAgendaItem::setCellY(int YTop, int YBottom) 581void KOAgendaItem::setCellY(int YTop, int YBottom)
582{ 582{
583 mCellYTop = YTop; 583 mCellYTop = YTop;
584 mCellYBottom = YBottom; 584 mCellYBottom = YBottom;
585} 585}
586 586
587void KOAgendaItem::setSubCell(int subCell) 587void KOAgendaItem::setSubCell(int subCell)
588{ 588{
589 mSubCell = subCell; 589 mSubCell = subCell;
590} 590}
591 591
592void KOAgendaItem::setSubCells(int subCells) 592void KOAgendaItem::setSubCells(int subCells)
593{ 593{
594 mSubCells = subCells; 594 mSubCells = subCells;
595} 595}
596 596
597void KOAgendaItem::setMultiItem(KOAgendaItem *first,KOAgendaItem *next, 597void KOAgendaItem::setMultiItem(KOAgendaItem *first,KOAgendaItem *next,
598 KOAgendaItem *last) 598 KOAgendaItem *last)
599{ 599{
600 mFirstMultiItem = first; 600 mFirstMultiItem = first;
601 mNextMultiItem = next; 601 mNextMultiItem = next;
602 mLastMultiItem = last; 602 mLastMultiItem = last;
603} 603}
604 604
605void KOAgendaItem::startMove() 605void KOAgendaItem::startMove()
606{ 606{
607 mStartCellX = mCellX; 607 mStartCellX = mCellX;
608 mStartCellXWidth = mCellXWidth; 608 mStartCellXWidth = mCellXWidth;
609 mStartCellYTop = mCellYTop; 609 mStartCellYTop = mCellYTop;
610 mStartCellYBottom = mCellYBottom; 610 mStartCellYBottom = mCellYBottom;
611} 611}
612 612
613void KOAgendaItem::resetMove() 613void KOAgendaItem::resetMove()
614{ 614{
615 mCellX = mStartCellX; 615 mCellX = mStartCellX;
616 mCellXWidth = mStartCellXWidth; 616 mCellXWidth = mStartCellXWidth;
617 mCellYTop = mStartCellYTop; 617 mCellYTop = mStartCellYTop;
618 mCellYBottom = mStartCellYBottom; 618 mCellYBottom = mStartCellYBottom;
619} 619}
620 620
621void KOAgendaItem::moveRelative(int dx, int dy) 621void KOAgendaItem::moveRelative(int dx, int dy)
622{ 622{
623 int newX = cellX() + dx; 623 int newX = cellX() + dx;
624 int newXWidth = cellXWidth() + dx; 624 int newXWidth = cellXWidth() + dx;
625 int newYTop = cellYTop() + dy; 625 int newYTop = cellYTop() + dy;
626 int newYBottom = cellYBottom() + dy; 626 int newYBottom = cellYBottom() + dy;
627 setCellXY(newX,newYTop,newYBottom); 627 setCellXY(newX,newYTop,newYBottom);
628 setCellXWidth(newXWidth); 628 setCellXWidth(newXWidth);
629} 629}
630 630
631void KOAgendaItem::expandTop(int dy) 631void KOAgendaItem::expandTop(int dy)
632{ 632{
633 int newYTop = cellYTop() + dy; 633 int newYTop = cellYTop() + dy;
634 int newYBottom = cellYBottom(); 634 int newYBottom = cellYBottom();
635 if (newYTop > newYBottom) newYTop = newYBottom; 635 if (newYTop > newYBottom) newYTop = newYBottom;
636 setCellY(newYTop, newYBottom); 636 setCellY(newYTop, newYBottom);
637} 637}
638 638
639void KOAgendaItem::expandBottom(int dy) 639void KOAgendaItem::expandBottom(int dy)
640{ 640{
641 int newYTop = cellYTop(); 641 int newYTop = cellYTop();
642 int newYBottom = cellYBottom() + dy; 642 int newYBottom = cellYBottom() + dy;
643 if (newYBottom < newYTop) newYBottom = newYTop; 643 if (newYBottom < newYTop) newYBottom = newYTop;
644 setCellY(newYTop, newYBottom); 644 setCellY(newYTop, newYBottom);
645} 645}
646 646
647void KOAgendaItem::expandLeft(int dx) 647void KOAgendaItem::expandLeft(int dx)
648{ 648{
649 int newX = cellX() + dx; 649 int newX = cellX() + dx;
650 int newXWidth = cellXWidth(); 650 int newXWidth = cellXWidth();
651 if (newX > newXWidth) newX = newXWidth; 651 if (newX > newXWidth) newX = newXWidth;
652 setCellX(newX,newXWidth); 652 setCellX(newX,newXWidth);
653} 653}
654 654
655void KOAgendaItem::expandRight(int dx) 655void KOAgendaItem::expandRight(int dx)
656{ 656{
657 int newX = cellX(); 657 int newX = cellX();
658 int newXWidth = cellXWidth() + dx; 658 int newXWidth = cellXWidth() + dx;
659 if (newXWidth < newX) newXWidth = newX; 659 if (newXWidth < newX) newXWidth = newX;
660 setCellX(newX,newXWidth); 660 setCellX(newX,newXWidth);
661} 661}
662 662
663QToolTipGroup *KOAgendaItem::toolTipGroup() 663QToolTipGroup *KOAgendaItem::toolTipGroup()
664{ 664{
665 if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); 665 if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0);
666 return mToolTipGroup; 666 return mToolTipGroup;
667} 667}
668 668
669void KOAgendaItem::dragEnterEvent( QDragEnterEvent *e ) 669void KOAgendaItem::dragEnterEvent( QDragEnterEvent *e )
670{ 670{
671#ifndef KORG_NODND 671#ifndef KORG_NODND
672 if ( ICalDrag::canDecode( e ) || VCalDrag::canDecode( e ) || 672 if ( ICalDrag::canDecode( e ) || VCalDrag::canDecode( e ) ||
673 !QTextDrag::canDecode( e ) ) { 673 !QTextDrag::canDecode( e ) ) {
674 e->ignore(); 674 e->ignore();
675 return; 675 return;
676 } 676 }
677 e->accept(); 677 e->accept();
678#endif 678#endif
679} 679}
680 680
681void KOAgendaItem::dropEvent( QDropEvent *e ) 681void KOAgendaItem::dropEvent( QDropEvent *e )
682{ 682{
683#ifndef KORG_NODND 683#ifndef KORG_NODND
684 QString text; 684 QString text;
685 if(QTextDrag::decode(e,text)) 685 if(QTextDrag::decode(e,text))
686 { 686 {
687 kdDebug() << "Dropped : " << text << endl; 687 kdDebug() << "Dropped : " << text << endl;
688 QStringList emails = QStringList::split(",",text); 688 QStringList emails = QStringList::split(",",text);
689 for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { 689 for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) {
690 kdDebug() << " Email: " << (*it) << endl; 690 kdDebug() << " Email: " << (*it) << endl;
691 int pos = (*it).find("<"); 691 int pos = (*it).find("<");
692 QString name = (*it).left(pos); 692 QString name = (*it).left(pos);
693 QString email = (*it).mid(pos); 693 QString email = (*it).mid(pos);
694 if (!email.isEmpty()) { 694 if (!email.isEmpty()) {
695 mIncidence->addAttendee(new Attendee(name,email)); 695 mIncidence->addAttendee(new Attendee(name,email));
696 } 696 }
697 } 697 }
698 } 698 }
699#endif 699#endif
700} 700}
701 701
702 702
703QPtrList<KOAgendaItem> KOAgendaItem::conflictItems() 703QPtrList<KOAgendaItem> KOAgendaItem::conflictItems()
704{ 704{
705 return mConflictItems; 705 return mConflictItems;
706} 706}
707 707
708void KOAgendaItem::setConflictItems(QPtrList<KOAgendaItem> ci) 708void KOAgendaItem::setConflictItems(QPtrList<KOAgendaItem> ci)
709{ 709{
710 mConflictItems = ci; 710 mConflictItems = ci;
711 KOAgendaItem *item; 711 KOAgendaItem *item;
712 for ( item=mConflictItems.first(); item != 0; 712 for ( item=mConflictItems.first(); item != 0;
713 item=mConflictItems.next() ) { 713 item=mConflictItems.next() ) {
714 item->addConflictItem(this); 714 item->addConflictItem(this);
715 } 715 }
716} 716}
717 717
718void KOAgendaItem::addConflictItem(KOAgendaItem *ci) 718void KOAgendaItem::addConflictItem(KOAgendaItem *ci)
719{ 719{
720 if (mConflictItems.find(ci)<0) 720 if (mConflictItems.find(ci)<0)
721 mConflictItems.append(ci); 721 mConflictItems.append(ci);
722} 722}
diff --git a/korganizer/kodialogmanager.cpp b/korganizer/kodialogmanager.cpp
index db7c3f2..c99c0cb 100644
--- a/korganizer/kodialogmanager.cpp
+++ b/korganizer/kodialogmanager.cpp
@@ -1,341 +1,341 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 3
4 Copyright (c) 2001 4 Copyright (c) 2001
5 Cornelius Schumacher <schumacher@kde.org> 5 Cornelius Schumacher <schumacher@kde.org>
6 6
7 This program is free software; you can redistribute it and/or modify 7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or 9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version. 10 (at your option) any later version.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software 18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20*/ 20*/
21 21
22#include <libkdepim/categoryeditdialog.h> 22#include <libkdepim/categoryeditdialog.h>
23 23
24#include "calendarview.h" 24#include "calendarview.h"
25#include "incomingdialog.h" 25#include "incomingdialog.h"
26#include "outgoingdialog.h" 26#include "outgoingdialog.h"
27#include "koprefsdialog.h" 27#include "koprefsdialog.h"
28#include "koeventeditor.h" 28#include "koeventeditor.h"
29#include "koprefs.h" 29#include "koprefs.h"
30#include "datenavigator.h" 30#include "datenavigator.h"
31#include "kotodoeditor.h" 31#include "kotodoeditor.h"
32#include "searchdialog.h" 32#include "searchdialog.h"
33#include "filtereditdialog.h" 33#include "filtereditdialog.h"
34#ifndef KORG_NOPLUGINS 34#ifndef KORG_NOPLUGINS
35#include "plugindialog.h" 35#include "plugindialog.h"
36#endif 36#endif
37#ifndef KORG_NOARCHIVE 37#ifndef KORG_NOARCHIVE
38#include "archivedialog.h" 38#include "archivedialog.h"
39#endif 39#endif
40 40
41#include "kconfig.h" 41#include "kconfig.h"
42#include "kodialogmanager.h" 42#include "kodialogmanager.h"
43 43
44KODialogManager::KODialogManager( CalendarView *mainView ) : 44KODialogManager::KODialogManager( CalendarView *mainView ) :
45 QObject(), mMainView( mainView ) 45 QObject(), mMainView( mainView )
46{ 46{
47 mOutgoingDialog = 0; 47 mOutgoingDialog = 0;
48 mIncomingDialog = 0; 48 mIncomingDialog = 0;
49 mOptionsDialog = 0; 49 mOptionsDialog = 0;
50 mSearchDialog = 0; 50 mSearchDialog = 0;
51 mArchiveDialog = 0; 51 mArchiveDialog = 0;
52 mFilterEditDialog = 0; 52 mFilterEditDialog = 0;
53 mPluginDialog = 0; 53 mPluginDialog = 0;
54 54
55 // mCategoryEditDialog = new KPIM::CategoryEditDialog(KOPrefs::instance(),mMainView); 55 // mCategoryEditDialog = new KPIM::CategoryEditDialog(KOPrefs::instance(),mMainView);
56 //KOGlobals::fitDialogToScreen( mCategoryEditDialog ); 56 //KOGlobals::fitDialogToScreen( mCategoryEditDialog );
57} 57}
58 58
59KODialogManager::~KODialogManager() 59KODialogManager::~KODialogManager()
60{ 60{
61 delete mOutgoingDialog; 61 delete mOutgoingDialog;
62 delete mIncomingDialog; 62 delete mIncomingDialog;
63 delete mOptionsDialog; 63 delete mOptionsDialog;
64 delete mSearchDialog; 64 delete mSearchDialog;
65#ifndef KORG_NOARCHIVE 65#ifndef KORG_NOARCHIVE
66 delete mArchiveDialog; 66 delete mArchiveDialog;
67#endif 67#endif
68 delete mFilterEditDialog; 68 delete mFilterEditDialog;
69#ifndef KORG_NOPLUGINS 69#ifndef KORG_NOPLUGINS
70 delete mPluginDialog; 70 delete mPluginDialog;
71#endif 71#endif
72} 72}
73 73
74OutgoingDialog *KODialogManager::outgoingDialog() 74OutgoingDialog *KODialogManager::outgoingDialog()
75{ 75{
76 createOutgoingDialog(); 76 createOutgoingDialog();
77 return mOutgoingDialog; 77 return mOutgoingDialog;
78} 78}
79 79
80void KODialogManager::createOutgoingDialog() 80void KODialogManager::createOutgoingDialog()
81{ 81{
82 if (!mOutgoingDialog) { 82 if (!mOutgoingDialog) {
83 mOutgoingDialog = new OutgoingDialog(mMainView->calendar(),mMainView); 83 mOutgoingDialog = new OutgoingDialog(mMainView->calendar(),mMainView);
84 if (mIncomingDialog) mIncomingDialog->setOutgoingDialog(mOutgoingDialog); 84 if (mIncomingDialog) mIncomingDialog->setOutgoingDialog(mOutgoingDialog);
85 connect(mOutgoingDialog,SIGNAL(numMessagesChanged(int)), 85 connect(mOutgoingDialog,SIGNAL(numMessagesChanged(int)),
86 mMainView,SIGNAL(numOutgoingChanged(int))); 86 mMainView,SIGNAL(numOutgoingChanged(int)));
87 } 87 }
88} 88}
89 89
90void KODialogManager::showOptionsDialog( bool showSync ) 90void KODialogManager::showOptionsDialog( bool showSync )
91{ 91{
92 92
93 if (!mOptionsDialog) { 93 if (!mOptionsDialog) {
94 mOptionsDialog = new KOPrefsDialog(mMainView); 94 mOptionsDialog = new KOPrefsDialog(mMainView);
95 //mOptionsDialog->readConfig(); 95 //mOptionsDialog->readConfig();
96 connect(mOptionsDialog,SIGNAL(configChanged()), 96 connect(mOptionsDialog,SIGNAL(configChanged()),
97 mMainView,SLOT(updateConfig())); 97 mMainView,SLOT(updateConfig()));
98 //connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()), 98 //connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()),
99 // mOptionsDialog,SLOT(updateCategories())); 99 // mOptionsDialog,SLOT(updateCategories()));
100 100
101 } 101 }
102 mOptionsDialog->readConfig(); 102 mOptionsDialog->readConfig();
103#ifndef DESKTOP_VERSION 103#ifndef DESKTOP_VERSION
104 mOptionsDialog->showMaximized(); 104 mOptionsDialog->showMaximized();
105#else 105#else
106 mOptionsDialog->show(); 106 mOptionsDialog->show();
107#endif 107#endif
108 if ( showSync ) 108 if ( showSync )
109 mOptionsDialog->showSyncPage(); 109 mOptionsDialog->showSyncPage();
110 mOptionsDialog->exec(); 110 mOptionsDialog->exec();
111 111
112} 112}
113void KODialogManager::showSyncOptions() 113void KODialogManager::showSyncOptions()
114{ 114{
115 showOptionsDialog( true ); 115 showOptionsDialog( true );
116 116
117} 117}
118void KODialogManager::showOutgoingDialog() 118void KODialogManager::showOutgoingDialog()
119{ 119{
120 createOutgoingDialog(); 120 createOutgoingDialog();
121 mOutgoingDialog->show(); 121 mOutgoingDialog->show();
122 mOutgoingDialog->raise(); 122 mOutgoingDialog->raise();
123} 123}
124 124
125IncomingDialog *KODialogManager::incomingDialog() 125IncomingDialog *KODialogManager::incomingDialog()
126{ 126{
127 createOutgoingDialog(); 127 createOutgoingDialog();
128 if (!mIncomingDialog) { 128 if (!mIncomingDialog) {
129 mIncomingDialog = new IncomingDialog(mMainView->calendar(),mOutgoingDialog,mMainView); 129 mIncomingDialog = new IncomingDialog(mMainView->calendar(),mOutgoingDialog,mMainView);
130 connect(mIncomingDialog,SIGNAL(numMessagesChanged(int)), 130 connect(mIncomingDialog,SIGNAL(numMessagesChanged(int)),
131 mMainView,SIGNAL(numIncomingChanged(int))); 131 mMainView,SIGNAL(numIncomingChanged(int)));
132 connect(mIncomingDialog,SIGNAL(calendarUpdated()), 132 connect(mIncomingDialog,SIGNAL(calendarUpdated()),
133 mMainView,SLOT(updateView())); 133 mMainView,SLOT(updateView()));
134 } 134 }
135 return mIncomingDialog; 135 return mIncomingDialog;
136} 136}
137 137
138void KODialogManager::createIncomingDialog() 138void KODialogManager::createIncomingDialog()
139{ 139{
140 createOutgoingDialog(); 140 createOutgoingDialog();
141 if (!mIncomingDialog) { 141 if (!mIncomingDialog) {
142 mIncomingDialog = new IncomingDialog(mMainView->calendar(),mOutgoingDialog,mMainView); 142 mIncomingDialog = new IncomingDialog(mMainView->calendar(),mOutgoingDialog,mMainView);
143 connect(mIncomingDialog,SIGNAL(numMessagesChanged(int)), 143 connect(mIncomingDialog,SIGNAL(numMessagesChanged(int)),
144 mMainView,SIGNAL(numIncomingChanged(int))); 144 mMainView,SIGNAL(numIncomingChanged(int)));
145 connect(mIncomingDialog,SIGNAL(calendarUpdated()), 145 connect(mIncomingDialog,SIGNAL(calendarUpdated()),
146 mMainView,SLOT(updateView())); 146 mMainView,SLOT(updateView()));
147 } 147 }
148} 148}
149 149
150void KODialogManager::showIncomingDialog() 150void KODialogManager::showIncomingDialog()
151{ 151{
152 createIncomingDialog(); 152 createIncomingDialog();
153 mIncomingDialog->show(); 153 mIncomingDialog->show();
154 mIncomingDialog->raise(); 154 mIncomingDialog->raise();
155} 155}
156/* 156/*
157void KODialogManager::showCategoryEditDialog() 157void KODialogManager::showCategoryEditDialog()
158{ 158{
159 mCategoryEditDialog->show(); 159 mCategoryEditDialog->show();
160} 160}
161*/ 161*/
162void KODialogManager::hideSearchDialog() 162void KODialogManager::hideSearchDialog()
163{ 163{
164 if (mSearchDialog) 164 if (mSearchDialog)
165 mSearchDialog->hide(); 165 mSearchDialog->hide();
166} 166}
167 167
168void KODialogManager::showSearchDialog() 168void KODialogManager::showSearchDialog()
169{ 169{
170 if (!mSearchDialog) { 170 if (!mSearchDialog) {
171 mSearchDialog = new SearchDialog(mMainView->calendar(),mMainView); 171 mSearchDialog = new SearchDialog(mMainView->calendar(),mMainView);
172 KOListView * lview = mSearchDialog->listview(); 172 KOListView * lview = mSearchDialog->listview();
173 173
174 connect(lview, SIGNAL(showIncidenceSignal(Incidence *)), 174 connect(lview, SIGNAL(showIncidenceSignal(Incidence *)),
175 mMainView, SLOT(showIncidence(Incidence *))); 175 mMainView, SLOT(showIncidence(Incidence *)));
176 connect(lview, SIGNAL(editIncidenceSignal(Incidence *)), 176 connect(lview, SIGNAL(editIncidenceSignal(Incidence *)),
177 mMainView, SLOT(editIncidence(Incidence *))); 177 mMainView, SLOT(editIncidence(Incidence *)));
178 connect(lview, SIGNAL(deleteIncidenceSignal(Incidence *)), 178 connect(lview, SIGNAL(deleteIncidenceSignal(Incidence *)),
179 mMainView, SLOT(deleteIncidence(Incidence *))); 179 mMainView, SLOT(deleteIncidence(Incidence *)));
180 connect(lview, SIGNAL(cloneIncidenceSignal(Incidence *)), 180 connect(lview, SIGNAL(cloneIncidenceSignal(Incidence *)),
181 mMainView, SLOT(cloneIncidence(Incidence *))); 181 mMainView, SLOT(cloneIncidence(Incidence *)));
182 connect(lview, SIGNAL(beamIncidenceSignal(Incidence *)), 182 connect(lview, SIGNAL(beamIncidenceSignal(Incidence *)),
183 mMainView, SLOT(beamIncidence(Incidence *))); 183 mMainView, SLOT(beamIncidence(Incidence *)));
184 connect(lview, SIGNAL(moveIncidenceSignal(Incidence *)), 184 connect(lview, SIGNAL(moveIncidenceSignal(Incidence *)),
185 mMainView, SLOT(moveIncidence(Incidence *))); 185 mMainView, SLOT(moveIncidence(Incidence *)));
186 connect(lview, SIGNAL(beamIncidenceList(QPtrList<Incidence> )), 186 connect(lview, SIGNAL(beamIncidenceList(QPtrList<Incidence> )),
187 mMainView, SLOT(beamIncidenceList(QPtrList<Incidence> ))); 187 mMainView, SLOT(beamIncidenceList(QPtrList<Incidence> )));
188 188
189 connect(mMainView, SIGNAL(configChanged()), mSearchDialog, SLOT(updateConfig())); 189 connect(mMainView, SIGNAL(configChanged()), mSearchDialog, SLOT(updateConfig()));
190 connect(mMainView, SIGNAL(updateSearchDialog()), mSearchDialog, SLOT(updateList())); 190 connect(mMainView, SIGNAL(updateSearchDialog()), mSearchDialog, SLOT(updateList()));
191 // connect( lview, SIGNAL( incidenceSelected( Incidence * ) ), 191 // connect( lview, SIGNAL( incidenceSelected( Incidence * ) ),
192 // mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 192 // mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
193#ifndef DESKTOP_VERSION 193#ifndef DESKTOP_VERSION
194 mSearchDialog->setMaximumSize( 640, 480 ); 194 mSearchDialog->setMaximumSize( QApplication::desktop()->size());
195 //mSearchDialog->setGeometry( 40,40, 400, 300); 195 //mSearchDialog->setGeometry( 40,40, 400, 300);
196 mSearchDialog->showMaximized(); 196 mSearchDialog->showMaximized();
197#else 197#else
198 KConfig *config = KOGlobals::config(); 198 KConfig *config = KOGlobals::config();
199 config->setGroup("WidgetLayout"); 199 config->setGroup("WidgetLayout");
200 QStringList list; 200 QStringList list;
201 list = config->readListEntry("SearchLayout"); 201 list = config->readListEntry("SearchLayout");
202 int x,y,w,h; 202 int x,y,w,h;
203 if ( ! list.isEmpty() ) { 203 if ( ! list.isEmpty() ) {
204 x = list[0].toInt(); 204 x = list[0].toInt();
205 y = list[1].toInt(); 205 y = list[1].toInt();
206 w = list[2].toInt(); 206 w = list[2].toInt();
207 h = list[3].toInt(); 207 h = list[3].toInt();
208 mSearchDialog->setGeometry(x,y,w,h); 208 mSearchDialog->setGeometry(x,y,w,h);
209 209
210 } 210 }
211 211
212#endif 212#endif
213 } 213 }
214 // make sure the widget is on top again 214 // make sure the widget is on top again
215 mSearchDialog->show(); 215 mSearchDialog->show();
216 mSearchDialog->raise(); 216 mSearchDialog->raise();
217} 217}
218 218
219SearchDialog * KODialogManager::getSearchDialog() 219SearchDialog * KODialogManager::getSearchDialog()
220{ 220{
221 return mSearchDialog; 221 return mSearchDialog;
222} 222}
223void KODialogManager::showArchiveDialog() 223void KODialogManager::showArchiveDialog()
224{ 224{
225#ifndef KORG_NOARCHIVE 225#ifndef KORG_NOARCHIVE
226 if (!mArchiveDialog) { 226 if (!mArchiveDialog) {
227 mArchiveDialog = new ArchiveDialog(mMainView->calendar(),mMainView); 227 mArchiveDialog = new ArchiveDialog(mMainView->calendar(),mMainView);
228 connect(mArchiveDialog,SIGNAL(eventsDeleted()), 228 connect(mArchiveDialog,SIGNAL(eventsDeleted()),
229 mMainView,SLOT(updateView())); 229 mMainView,SLOT(updateView()));
230 } 230 }
231 mArchiveDialog->show(); 231 mArchiveDialog->show();
232 mArchiveDialog->raise(); 232 mArchiveDialog->raise();
233 233
234 // Workaround. 234 // Workaround.
235 QApplication::restoreOverrideCursor(); 235 QApplication::restoreOverrideCursor();
236#endif 236#endif
237} 237}
238 238
239void KODialogManager::showFilterEditDialog(QPtrList<CalFilter> *filters) 239void KODialogManager::showFilterEditDialog(QPtrList<CalFilter> *filters)
240{ 240{
241 if (!mFilterEditDialog) { 241 if (!mFilterEditDialog) {
242 mFilterEditDialog = new FilterEditDialog(filters,mMainView); 242 mFilterEditDialog = new FilterEditDialog(filters,mMainView);
243 connect(mFilterEditDialog,SIGNAL(filterChanged()), 243 connect(mFilterEditDialog,SIGNAL(filterChanged()),
244 mMainView,SLOT(filterEdited())); 244 mMainView,SLOT(filterEdited()));
245 245
246 } 246 }
247 247
248#ifndef DESKTOP_VERSION 248#ifndef DESKTOP_VERSION
249 mFilterEditDialog->showMaximized(); 249 mFilterEditDialog->showMaximized();
250#else 250#else
251 mFilterEditDialog->show(); 251 mFilterEditDialog->show();
252#endif 252#endif
253 mFilterEditDialog->raise(); 253 mFilterEditDialog->raise();
254} 254}
255 255
256void KODialogManager::showPluginDialog() 256void KODialogManager::showPluginDialog()
257{ 257{
258#ifndef KORG_NOPLUGINS 258#ifndef KORG_NOPLUGINS
259 if (!mPluginDialog) { 259 if (!mPluginDialog) {
260 mPluginDialog = new PluginDialog(mMainView); 260 mPluginDialog = new PluginDialog(mMainView);
261 connect(mPluginDialog,SIGNAL(configChanged()), 261 connect(mPluginDialog,SIGNAL(configChanged()),
262 mMainView,SLOT(updateConfig())); 262 mMainView,SLOT(updateConfig()));
263 } 263 }
264 mPluginDialog->show(); 264 mPluginDialog->show();
265 mPluginDialog->raise(); 265 mPluginDialog->raise();
266#endif 266#endif
267} 267}
268 268
269KOEventEditor *KODialogManager::getEventEditor() 269KOEventEditor *KODialogManager::getEventEditor()
270{ 270{
271 KOEventEditor *eventEditor = new KOEventEditor( mMainView->calendar(), 271 KOEventEditor *eventEditor = new KOEventEditor( mMainView->calendar(),
272 mMainView ); 272 mMainView );
273 273
274 connect(eventEditor,SIGNAL(eventAdded(Event *)), 274 connect(eventEditor,SIGNAL(eventAdded(Event *)),
275 mMainView,SLOT(eventAdded(Event *))); 275 mMainView,SLOT(eventAdded(Event *)));
276 connect(eventEditor,SIGNAL(eventChanged(Event *)), 276 connect(eventEditor,SIGNAL(eventChanged(Event *)),
277 mMainView,SLOT(eventChanged(Event *))); 277 mMainView,SLOT(eventChanged(Event *)));
278 connect(eventEditor,SIGNAL(eventDeleted()), 278 connect(eventEditor,SIGNAL(eventDeleted()),
279 mMainView,SLOT(eventDeleted())); 279 mMainView,SLOT(eventDeleted()));
280 connect(eventEditor,SIGNAL(deleteAttendee(Incidence *)), 280 connect(eventEditor,SIGNAL(deleteAttendee(Incidence *)),
281 mMainView,SLOT(schedule_cancel(Incidence *))); 281 mMainView,SLOT(schedule_cancel(Incidence *)));
282 connect( eventEditor, SIGNAL(jumpToTime( const QDate &)), 282 connect( eventEditor, SIGNAL(jumpToTime( const QDate &)),
283 mMainView->dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); 283 mMainView->dateNavigator(), SLOT( selectWeek( const QDate & ) ) );
284 connect( eventEditor, SIGNAL( showAgendaView( bool)), 284 connect( eventEditor, SIGNAL( showAgendaView( bool)),
285 mMainView->viewManager(), SLOT( showAgendaView( bool) ) ); 285 mMainView->viewManager(), SLOT( showAgendaView( bool) ) );
286 286
287 // connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()), 287 // connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()),
288 // eventEditor,SLOT(updateCategoryConfig())); 288 // eventEditor,SLOT(updateCategoryConfig()));
289 // connect(eventEditor,SIGNAL(editCategories()), 289 // connect(eventEditor,SIGNAL(editCategories()),
290 // mCategoryEditDialog,SLOT(show())); 290 // mCategoryEditDialog,SLOT(show()));
291 connect(eventEditor,SIGNAL(dialogClose(Incidence*)), 291 connect(eventEditor,SIGNAL(dialogClose(Incidence*)),
292 mMainView,SLOT(dialogClosing(Incidence*))); 292 mMainView,SLOT(dialogClosing(Incidence*)));
293 293
294 //connect(mMainView,SIGNAL(closingDown()),eventEditor,SLOT(reject())); 294 //connect(mMainView,SIGNAL(closingDown()),eventEditor,SLOT(reject()));
295 295
296 return eventEditor; 296 return eventEditor;
297} 297}
298 298
299KOTodoEditor *KODialogManager::getTodoEditor() 299KOTodoEditor *KODialogManager::getTodoEditor()
300{ 300{
301 KOTodoEditor *todoEditor = new KOTodoEditor( mMainView->calendar(), 301 KOTodoEditor *todoEditor = new KOTodoEditor( mMainView->calendar(),
302 mMainView ); 302 mMainView );
303 303
304 // connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()), 304 // connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()),
305 // todoEditor,SLOT(updateCategoryConfig())); 305 // todoEditor,SLOT(updateCategoryConfig()));
306 // connect(todoEditor,SIGNAL(editCategories()),mCategoryEditDialog,SLOT(show())); 306 // connect(todoEditor,SIGNAL(editCategories()),mCategoryEditDialog,SLOT(show()));
307 307
308 connect(todoEditor,SIGNAL(todoAdded(Todo *)), 308 connect(todoEditor,SIGNAL(todoAdded(Todo *)),
309 mMainView,SLOT(todoAdded(Todo *))); 309 mMainView,SLOT(todoAdded(Todo *)));
310 connect(todoEditor,SIGNAL(todoChanged(Todo *)), 310 connect(todoEditor,SIGNAL(todoChanged(Todo *)),
311 mMainView,SLOT(todoChanged(Todo *))); 311 mMainView,SLOT(todoChanged(Todo *)));
312 connect(todoEditor,SIGNAL(todoDeleted()), 312 connect(todoEditor,SIGNAL(todoDeleted()),
313 mMainView,SLOT(todoDeleted())); 313 mMainView,SLOT(todoDeleted()));
314 connect(todoEditor,SIGNAL(dialogClose(Incidence*)), 314 connect(todoEditor,SIGNAL(dialogClose(Incidence*)),
315 mMainView,SLOT(dialogClosing(Incidence*))); 315 mMainView,SLOT(dialogClosing(Incidence*)));
316 connect( todoEditor, SIGNAL(jumpToTime( const QDate &)), 316 connect( todoEditor, SIGNAL(jumpToTime( const QDate &)),
317 mMainView->dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); 317 mMainView->dateNavigator(), SLOT( selectWeek( const QDate & ) ) );
318 connect( todoEditor, SIGNAL( showAgendaView( bool)), 318 connect( todoEditor, SIGNAL( showAgendaView( bool)),
319 mMainView->viewManager(), SLOT( showAgendaView( bool) ) ); 319 mMainView->viewManager(), SLOT( showAgendaView( bool) ) );
320 // connect(todoEditor,SIGNAL(deleteAttendee(Incidence *)), 320 // connect(todoEditor,SIGNAL(deleteAttendee(Incidence *)),
321 // mMainView,SLOT(schedule_cancel(Incidence *))); 321 // mMainView,SLOT(schedule_cancel(Incidence *)));
322 //connect(mMainView,SIGNAL(closingDown()),todoEditor,SLOT(reject())); 322 //connect(mMainView,SIGNAL(closingDown()),todoEditor,SLOT(reject()));
323 323
324 return todoEditor; 324 return todoEditor;
325} 325}
326 326
327void KODialogManager::updateSearchDialog() 327void KODialogManager::updateSearchDialog()
328{ 328{
329 if (mSearchDialog) mSearchDialog->updateView(); 329 if (mSearchDialog) mSearchDialog->updateView();
330} 330}
331 331
332void KODialogManager::setDocumentId( const QString &id ) 332void KODialogManager::setDocumentId( const QString &id )
333{ 333{
334 if (mOutgoingDialog) mOutgoingDialog->setDocumentId( id ); 334 if (mOutgoingDialog) mOutgoingDialog->setDocumentId( id );
335} 335}
336 336
337void KODialogManager::writeSettings( KConfig *config ) 337void KODialogManager::writeSettings( KConfig *config )
338{ 338{
339 if (mSearchDialog) 339 if (mSearchDialog)
340 mSearchDialog->listview()->writeSettings(config,"SearchListView Layout"); 340 mSearchDialog->listview()->writeSettings(config,"SearchListView Layout");
341} 341}
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 1cdb2fb..aae4692 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -1,468 +1,470 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <time.h> 24#include <time.h>
25#ifndef _WIN32_ 25#ifndef _WIN32_
26#include <unistd.h> 26#include <unistd.h>
27#endif 27#endif
28#include <qdir.h> 28#include <qdir.h>
29#include <qtextstream.h> 29#include <qtextstream.h>
30#include <qtextcodec.h> 30#include <qtextcodec.h>
31#include <qstring.h> 31#include <qstring.h>
32#include <qregexp.h> 32#include <qregexp.h>
33#include <qfont.h> 33#include <qfont.h>
34#include <qcolor.h> 34#include <qcolor.h>
35#include <qstringlist.h> 35#include <qstringlist.h>
36#include <stdlib.h> 36#include <stdlib.h>
37 37
38#include <kglobal.h> 38#include <kglobal.h>
39#include <kconfig.h> 39#include <kconfig.h>
40#include <klocale.h> 40#include <klocale.h>
41#include <kdebug.h> 41#include <kdebug.h>
42#include <kemailsettings.h> 42#include <kemailsettings.h>
43#include <kstaticdeleter.h> 43#include <kstaticdeleter.h>
44#include <libkdepim/kpimglobalprefs.h> 44#include <libkdepim/kpimglobalprefs.h>
45 45
46#include "koprefs.h" 46#include "koprefs.h"
47#include "mainwindow.h" 47#include "mainwindow.h"
48 48
49KOPrefs *KOPrefs::mInstance = 0; 49KOPrefs *KOPrefs::mInstance = 0;
50static KStaticDeleter<KOPrefs> insd; 50static KStaticDeleter<KOPrefs> insd;
51 51
52KOPrefs::KOPrefs() : 52KOPrefs::KOPrefs() :
53 KPimPrefs("korganizerrc") 53 KPimPrefs("korganizerrc")
54{ 54{
55 mCategoryColors.setAutoDelete(true); 55 mCategoryColors.setAutoDelete(true);
56 fillMailDefaults(); 56 fillMailDefaults();
57 mDefaultCategoryColor = QColor(175,210,255);//196,196,196); 57 mDefaultCategoryColor = QColor(175,210,255);//196,196,196);
58 QColor defaultHolidayColor = QColor(255,0,0); 58 QColor defaultHolidayColor = QColor(255,0,0);
59 QColor defaultHighlightColor = QColor(129,112,255);//64,64,255); 59 QColor defaultHighlightColor = QColor(129,112,255);//64,64,255);
60 QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128); 60 QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128);
61 QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160); 61 QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160);
62 QColor defaultTodoDueTodayColor = QColor(255,220,100); 62 QColor defaultTodoDueTodayColor = QColor(255,220,100);
63 QColor defaultTodoOverdueColor = QColor(255,153,125); 63 QColor defaultTodoOverdueColor = QColor(255,153,125);
64 64
65 mTimeBarFont = QFont("helvetica",10);//,QFont::Bold); 65 mTimeBarFont = QFont("helvetica",10);//,QFont::Bold);
66 mDefaultViewFont = QFont("helvetica",10); 66 mDefaultViewFont = QFont("helvetica",10);
67 mDefaultMonthViewFont = QFont("helvetica",8); 67 mDefaultMonthViewFont = QFont("helvetica",8);
68 mMarcusBainsFont= QFont("helvetica",10); 68 mMarcusBainsFont= QFont("helvetica",10);
69 mDateNavigatorFont= QFont("helvetica",10, QFont::Bold); 69 mDateNavigatorFont= QFont("helvetica",10, QFont::Bold);
70 mEditBoxFont = QFont("helvetica",12); 70 mEditBoxFont = QFont("helvetica",12);
71 mJornalViewFont = QFont("helvetica",12); 71 mJornalViewFont = QFont("helvetica",12);
72 72
73 KPrefs::setCurrentGroup("General"); 73 KPrefs::setCurrentGroup("General");
74 74
75 75
76 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); 76 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
77 77
78 addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); 78 addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true);
79 addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); 79 addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true);
80 addItemBool("ShowIconSearch",&mShowIconSearch,true); 80 addItemBool("ShowIconSearch",&mShowIconSearch,true);
81 addItemBool("ShowIconList",&mShowIconList,true); 81 addItemBool("ShowIconList",&mShowIconList,true);
82 addItemBool("ShowIconDay1",&mShowIconDay1,true); 82 addItemBool("ShowIconDay1",&mShowIconDay1,true);
83 addItemBool("ShowIconDay5",&mShowIconDay5,true); 83 addItemBool("ShowIconDay5",&mShowIconDay5,true);
84 addItemBool("ShowIconDay7",&mShowIconDay7,true); 84 addItemBool("ShowIconDay7",&mShowIconDay7,true);
85 addItemBool("ShowIconMonth",&mShowIconMonth,true); 85 addItemBool("ShowIconMonth",&mShowIconMonth,true);
86 addItemBool("ShowIconTodoview",&mShowIconTodoview,true); 86 addItemBool("ShowIconTodoview",&mShowIconTodoview,true);
87 addItemBool("ShowIconBackFast",&mShowIconBackFast,true); 87 addItemBool("ShowIconBackFast",&mShowIconBackFast,true);
88 addItemBool("ShowIconBack",&mShowIconBack,true); 88 addItemBool("ShowIconBack",&mShowIconBack,true);
89 addItemBool("ShowIconToday",&mShowIconToday,true); 89 addItemBool("ShowIconToday",&mShowIconToday,true);
90 addItemBool("ShowIconForward",&mShowIconForward,true); 90 addItemBool("ShowIconForward",&mShowIconForward,true);
91 addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); 91 addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true);
92 addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,false); 92 addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,false);
93 addItemBool("ShowIconNextDays",&mShowIconNextDays,true); 93 addItemBool("ShowIconNextDays",&mShowIconNextDays,true);
94 addItemBool("ShowIconNext",&mShowIconNext,true); 94 addItemBool("ShowIconNext",&mShowIconNext,true);
95 addItemBool("ShowIconJournal",&mShowIconJournal,true); 95 addItemBool("ShowIconJournal",&mShowIconJournal,true);
96 addItemBool("ShowIconStretch",&mShowIconStretch,true); 96 addItemBool("ShowIconStretch",&mShowIconStretch,true);
97 addItemInt("LastLoadedLanguage",&mOldLanguage,0); 97 addItemInt("LastLoadedLanguage",&mOldLanguage,0);
98 98
99 addItemBool("AskForQuit",&mAskForQuit,false); 99 addItemBool("AskForQuit",&mAskForQuit,false);
100 100
101#ifndef DESKTOP_VERSION 101#ifndef DESKTOP_VERSION
102 addItemBool("ShowFullMenu",&mShowFullMenu,false); 102 addItemBool("ShowFullMenu",&mShowFullMenu,false);
103#else 103#else
104 addItemBool("ShowFullMenu",&mShowFullMenu,true); 104 addItemBool("ShowFullMenu",&mShowFullMenu,true);
105#endif 105#endif
106 addItemBool("ToolBarHor",&mToolBarHor, true ); 106 addItemBool("ToolBarHor",&mToolBarHor, true );
107 addItemBool("ToolBarUp",&mToolBarUp, false ); 107 addItemBool("ToolBarUp",&mToolBarUp, false );
108 addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); 108 addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false );
109 addItemInt("Whats Next Days",&mWhatsNextDays,3); 109 addItemInt("Whats Next Days",&mWhatsNextDays,3);
110 addItemInt("Whats Next Prios",&mWhatsNextPrios,1); 110 addItemInt("Whats Next Prios",&mWhatsNextPrios,1);
111 111
112 addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); 112 addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true);
113 addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true);
114 addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false);
113 addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); 115 addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true);
114 addItemInt("AllDay Size",&mAllDaySize,28); 116 addItemInt("AllDay Size",&mAllDaySize,28);
115 QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; 117 QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav";
116 addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); 118 addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm );
117 119
118 addItemStringList("LocationDefaults",&mLocationDefaults ); 120 addItemStringList("LocationDefaults",&mLocationDefaults );
119 addItemStringList("EventSummary User",&mEventSummaryUser); 121 addItemStringList("EventSummary User",&mEventSummaryUser);
120 addItemStringList("TodoSummary User",&mTodoSummaryUser); 122 addItemStringList("TodoSummary User",&mTodoSummaryUser);
121 123
122 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); 124 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
123 addItemBool("Enable Project View",&mEnableProjectView,false); 125 addItemBool("Enable Project View",&mEnableProjectView,false);
124 addItemBool("Auto Save",&mAutoSave,false); 126 addItemBool("Auto Save",&mAutoSave,false);
125 addItemInt("Auto Save Interval",&mAutoSaveInterval,3); 127 addItemInt("Auto Save Interval",&mAutoSaveInterval,3);
126 addItemBool("Confirm Deletes",&mConfirm,true); 128 addItemBool("Confirm Deletes",&mConfirm,true);
127 addItemString("Archive File",&mArchiveFile); 129 addItemString("Archive File",&mArchiveFile);
128 addItemString("Html Export File",&mHtmlExportFile, 130 addItemString("Html Export File",&mHtmlExportFile,
129 QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); 131 QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html"));
130 addItemBool("Html With Save",&mHtmlWithSave,false); 132 addItemBool("Html With Save",&mHtmlWithSave,false);
131 133
132 KPrefs::setCurrentGroup("Personal Settings"); 134 KPrefs::setCurrentGroup("Personal Settings");
133 135
134 addItemInt("Mail Client",&mMailClient,MailClientKMail); 136 addItemInt("Mail Client",&mMailClient,MailClientKMail);
135 addItemBool("Use Control Center Email",&mEmailControlCenter,false); 137 addItemBool("Use Control Center Email",&mEmailControlCenter,false);
136 addItemBool("Bcc",&mBcc,false); 138 addItemBool("Bcc",&mBcc,false);
137 139
138 KPrefs::setCurrentGroup("Time & Date"); 140 KPrefs::setCurrentGroup("Time & Date");
139 141
140 142
141 addItemInt("Default Start Time",&mStartTime,10); 143 addItemInt("Default Start Time",&mStartTime,10);
142 addItemInt("Default Duration",&mDefaultDuration,2); 144 addItemInt("Default Duration",&mDefaultDuration,2);
143 addItemInt("Default Alarm Time",&mAlarmTime,3); 145 addItemInt("Default Alarm Time",&mAlarmTime,3);
144 KPrefs::setCurrentGroup("AlarmSettings"); 146 KPrefs::setCurrentGroup("AlarmSettings");
145 addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); 147 addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20);
146 addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); 148 addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7);
147 addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); 149 addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5);
148 addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); 150 addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3);
149 151
150 152
151 KPrefs::setCurrentGroup("Calendar"); 153 KPrefs::setCurrentGroup("Calendar");
152 154
153 addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); 155 addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar);
154 156
155 KPrefs::setCurrentGroup("Fonts"); 157 KPrefs::setCurrentGroup("Fonts");
156 // qDebug(" KPrefs::setCurrentGroup(Fonts); "); 158 // qDebug(" KPrefs::setCurrentGroup(Fonts); ");
157 addItemFont("TimeBar Font",&mTimeBarFont); 159 addItemFont("TimeBar Font",&mTimeBarFont);
158 addItemFont("MonthView Font",&mMonthViewFont); 160 addItemFont("MonthView Font",&mMonthViewFont);
159 addItemFont("AgendaView Font",&mAgendaViewFont); 161 addItemFont("AgendaView Font",&mAgendaViewFont);
160 addItemFont("MarcusBains Font",&mMarcusBainsFont); 162 addItemFont("MarcusBains Font",&mMarcusBainsFont);
161 addItemFont("TimeLabels Font",&mTimeLabelsFont); 163 addItemFont("TimeLabels Font",&mTimeLabelsFont);
162 addItemFont("TodoView Font",&mTodoViewFont); 164 addItemFont("TodoView Font",&mTodoViewFont);
163 addItemFont("ListView Font",&mListViewFont); 165 addItemFont("ListView Font",&mListViewFont);
164 addItemFont("DateNavigator Font",&mDateNavigatorFont); 166 addItemFont("DateNavigator Font",&mDateNavigatorFont);
165 addItemFont("EditBox Font",&mEditBoxFont); 167 addItemFont("EditBox Font",&mEditBoxFont);
166 addItemFont("JournalView Font",&mJornalViewFont); 168 addItemFont("JournalView Font",&mJornalViewFont);
167 addItemFont("WhatsNextView Font",&mWhatsNextFont); 169 addItemFont("WhatsNextView Font",&mWhatsNextFont);
168 addItemFont("EventView Font",&mEventViewFont); 170 addItemFont("EventView Font",&mEventViewFont);
169 171
170 KPrefs::setCurrentGroup("RemoteSyncing"); 172 KPrefs::setCurrentGroup("RemoteSyncing");
171 addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); 173 addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" );
172 addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); 174 addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" );
173 addItemBool("ShowSyncEvents",&mShowSyncEvents,false); 175 addItemBool("ShowSyncEvents",&mShowSyncEvents,false);
174 addItemInt("LastSyncTime",&mLastSyncTime,0); 176 addItemInt("LastSyncTime",&mLastSyncTime,0);
175 177
176#ifdef _WIN32_ 178#ifdef _WIN32_
177 QString hdp= locateLocal("data","korganizer")+"\\\\"; 179 QString hdp= locateLocal("data","korganizer")+"\\\\";
178#else 180#else
179 QString hdp= locateLocal("data","korganizer")+"/"; 181 QString hdp= locateLocal("data","korganizer")+"/";
180#endif 182#endif
181 183
182 KPrefs::setCurrentGroup("LoadSaveFileNames"); 184 KPrefs::setCurrentGroup("LoadSaveFileNames");
183 185
184 addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); 186 addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" );
185 addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); 187 addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" );
186 addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); 188 addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" );
187 addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); 189 addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" );
188 190
189 191
190 KPrefs::setCurrentGroup("Locale"); 192 KPrefs::setCurrentGroup("Locale");
191 addItemBool("ShortDateInViewer",&mShortDateInViewer,false); 193 addItemBool("ShortDateInViewer",&mShortDateInViewer,false);
192 194
193 195
194 KPrefs::setCurrentGroup("Colors"); 196 KPrefs::setCurrentGroup("Colors");
195 addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); 197 addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor);
196 addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); 198 addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor);
197 addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); 199 addItemColor("Event Color",&mEventColor,mDefaultCategoryColor);
198 addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); 200 addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor);
199 addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); 201 addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor);
200 addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); 202 addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor);
201 addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); 203 addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor);
202 addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); 204 addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 ));
203 addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); 205 addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 ));
204 addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); 206 addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 ));
205 addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); 207 addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true);
206 addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); 208 addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true);
207 addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); 209 addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false);
208 addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); 210 addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 ));
209 addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); 211 addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 ));
210 addItemBool("UseAppColors",&mUseAppColors,false); 212 addItemBool("UseAppColors",&mUseAppColors,false);
211 213
212 214
213 215
214 KPrefs::setCurrentGroup("Views"); 216 KPrefs::setCurrentGroup("Views");
215 addItemInt("Hour Size",&mHourSize,8); 217 addItemInt("Hour Size",&mHourSize,8);
216 addItemBool("Show Daily Recurrences",&mDailyRecur,true); 218 addItemBool("Show Daily Recurrences",&mDailyRecur,true);
217 addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); 219 addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true);
218 addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); 220 addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true);
219 addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); 221 addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true);
220 addItemBool("ShowShortMonthName",&mMonthShowShort,false); 222 addItemBool("ShowShortMonthName",&mMonthShowShort,false);
221 addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); 223 addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true);
222 addItemBool("Enable ToolTips",&mEnableToolTips,false); 224 addItemBool("Enable ToolTips",&mEnableToolTips,false);
223 addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); 225 addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false);
224 addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); 226 addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false);
225 addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); 227 addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true);
226 addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); 228 addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true);
227 addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,false); 229 addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,false);
228 addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); 230 addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false);
229 addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); 231 addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false);
230 addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); 232 addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true);
231 addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); 233 addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true);
232 addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);; 234 addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);;
233 addItemBool("WNViewShowsPast",&mWNViewShowsPast,true); 235 addItemBool("WNViewShowsPast",&mWNViewShowsPast,true);
234 addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); 236 addItemBool("WNViewShowLocation",&mWNViewShowLocation,false);
235 addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); 237 addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false);
236 addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); 238 addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true);
237 addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); 239 addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false);
238 addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); 240 addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false);
239 addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,false); 241 addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,false);
240 addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); 242 addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false);
241 addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); 243 addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false);
242#ifdef DESKTOP_VERSION 244#ifdef DESKTOP_VERSION
243 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); 245 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true);
244#else 246#else
245 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); 247 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false);
246#endif 248#endif
247 addItemInt("Day Begins",&mDayBegins,7); 249 addItemInt("Day Begins",&mDayBegins,7);
248 addItemInt("Working Hours Start",&mWorkingHoursStart,8); 250 addItemInt("Working Hours Start",&mWorkingHoursStart,8);
249 addItemInt("Working Hours End",&mWorkingHoursEnd,17); 251 addItemInt("Working Hours End",&mWorkingHoursEnd,17);
250 addItemBool("Exclude Holidays",&mExcludeHolidays,true); 252 addItemBool("Exclude Holidays",&mExcludeHolidays,true);
251 addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); 253 addItemBool("Exclude Saturdays",&mExcludeSaturdays,true);
252 254
253 addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); 255 addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false);
254 addItemBool("Full View Month",&mFullViewMonth,true); 256 addItemBool("Full View Month",&mFullViewMonth,true);
255 addItemBool("Full View Todo",&mFullViewTodo,true); 257 addItemBool("Full View Todo",&mFullViewTodo,true);
256 addItemBool("Quick Todo",&mEnableQuickTodo,false); 258 addItemBool("Quick Todo",&mEnableQuickTodo,false);
257 259
258 addItemInt("Next X Days",&mNextXDays,3); 260 addItemInt("Next X Days",&mNextXDays,3);
259 261
260 KPrefs::setCurrentGroup("Printer"); 262 KPrefs::setCurrentGroup("Printer");
261 263
262 KPrefs::setCurrentGroup("Layout"); 264 KPrefs::setCurrentGroup("Layout");
263 265
264 addItemBool("CompactDialogs",&mCompactDialogs,false); 266 addItemBool("CompactDialogs",&mCompactDialogs,false);
265 addItemBool("VerticalScreen",&mVerticalScreen,true); 267 addItemBool("VerticalScreen",&mVerticalScreen,true);
266 268
267 KPrefs::setCurrentGroup("KOrganizer Plugins"); 269 KPrefs::setCurrentGroup("KOrganizer Plugins");
268 270
269 addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); 271 addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays");
270 272
271 KPrefs::setCurrentGroup("Group Scheduling"); 273 KPrefs::setCurrentGroup("Group Scheduling");
272 274
273 addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); 275 addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail);
274 addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); 276 addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend);
275 addItemStringList("AdditionalMails",&mAdditionalMails,""); 277 addItemStringList("AdditionalMails",&mAdditionalMails,"");
276 addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); 278 addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto);
277 addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); 279 addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto);
278 addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); 280 addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto);
279 addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); 281 addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto);
280 addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); 282 addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto);
281 283
282 KPrefs::setCurrentGroup( "Editors" ); 284 KPrefs::setCurrentGroup( "Editors" );
283 285
284 addItemStringList( "EventTemplates", &mEventTemplates ); 286 addItemStringList( "EventTemplates", &mEventTemplates );
285 addItemStringList( "TodoTemplates", &mTodoTemplates ); 287 addItemStringList( "TodoTemplates", &mTodoTemplates );
286 288
287 addItemInt("DestinationPolicy",&mDestination,standardDestination); 289 addItemInt("DestinationPolicy",&mDestination,standardDestination);
288 290
289 291
290 292
291} 293}
292 294
293 295
294KOPrefs::~KOPrefs() 296KOPrefs::~KOPrefs()
295{ 297{
296 if (mInstance == this) 298 if (mInstance == this)
297 mInstance = insd.setObject(0); 299 mInstance = insd.setObject(0);
298 300
299 //qDebug("KOPrefs::~KOPrefs() "); 301 //qDebug("KOPrefs::~KOPrefs() ");
300} 302}
301 303
302 304
303KOPrefs *KOPrefs::instance() 305KOPrefs *KOPrefs::instance()
304{ 306{
305 if (!mInstance) { 307 if (!mInstance) {
306 mInstance = insd.setObject(new KOPrefs()); 308 mInstance = insd.setObject(new KOPrefs());
307 mInstance->readConfig(); 309 mInstance->readConfig();
308 } 310 }
309 311
310 return mInstance; 312 return mInstance;
311} 313}
312 314
313void KOPrefs::usrSetDefaults() 315void KOPrefs::usrSetDefaults()
314{ 316{
315 317
316} 318}
317 319
318void KOPrefs::fillMailDefaults() 320void KOPrefs::fillMailDefaults()
319{ 321{
320 if (mName.isEmpty()) mName = i18n("Anonymous"); 322 if (mName.isEmpty()) mName = i18n("Anonymous");
321 if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); 323 if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere");
322} 324}
323 325
324void KOPrefs::setTimeZoneIdDefault() 326void KOPrefs::setTimeZoneIdDefault()
325{ 327{
326 ; 328 ;
327} 329}
328 330
329void KOPrefs::setCategoryDefaults() 331void KOPrefs::setCategoryDefaults()
330{ 332{
331 mCustomCategories.clear(); 333 mCustomCategories.clear();
332 mCustomCategories = getDefaultList(); 334 mCustomCategories = getDefaultList();
333 335
334 QStringList::Iterator it; 336 QStringList::Iterator it;
335 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { 337 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) {
336 setCategoryColor(*it,mDefaultCategoryColor); 338 setCategoryColor(*it,mDefaultCategoryColor);
337 } 339 }
338} 340}
339 341
340QStringList KOPrefs::getDefaultList() 342QStringList KOPrefs::getDefaultList()
341{ 343{
342 QStringList retval ; 344 QStringList retval ;
343 retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") 345 retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer")
344 << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") 346 << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner")
345 << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") 347 << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts")
346 << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") 348 << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids")
347 << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") 349 << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel")
348 << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") 350 << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping")
349 << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") 351 << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University")
350 << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; 352 << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ;
351 retval.sort(); 353 retval.sort();
352 return retval; 354 return retval;
353} 355}
354 356
355void KOPrefs::usrReadConfig() 357void KOPrefs::usrReadConfig()
356{ 358{
357 config()->setGroup("General"); 359 config()->setGroup("General");
358 360
359 mCustomCategories = config()->readListEntry("Custom Categories"); 361 mCustomCategories = config()->readListEntry("Custom Categories");
360 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != mOldLanguage ) { 362 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != mOldLanguage ) {
361 mLocationDefaults.clear(); 363 mLocationDefaults.clear();
362 mEventSummaryUser.clear(); 364 mEventSummaryUser.clear();
363 mTodoSummaryUser.clear(); 365 mTodoSummaryUser.clear();
364 } 366 }
365 mOldLoadedLanguage = mOldLanguage ; 367 mOldLoadedLanguage = mOldLanguage ;
366 mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; 368 mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage;
367 if (mLocationDefaults.isEmpty()) { 369 if (mLocationDefaults.isEmpty()) {
368 mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") 370 mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach")
369 << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") 371 << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten")
370 << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; 372 << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ;
371 // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") 373 // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("")
372 mLocationDefaults.sort(); 374 mLocationDefaults.sort();
373 } 375 }
374 376
375 if (mEventSummaryUser.isEmpty()) { 377 if (mEventSummaryUser.isEmpty()) {
376 mEventSummaryUser = getDefaultList() ; 378 mEventSummaryUser = getDefaultList() ;
377 } 379 }
378 if (mTodoSummaryUser.isEmpty()) { 380 if (mTodoSummaryUser.isEmpty()) {
379 mTodoSummaryUser = getDefaultList() ; 381 mTodoSummaryUser = getDefaultList() ;
380 } 382 }
381 383
382 if (mCustomCategories.isEmpty()) setCategoryDefaults(); 384 if (mCustomCategories.isEmpty()) setCategoryDefaults();
383 385
384 config()->setGroup("Personal Settings"); 386 config()->setGroup("Personal Settings");
385 mName = config()->readEntry("user_name",""); 387 mName = config()->readEntry("user_name","");
386 mEmail = config()->readEntry("user_email",""); 388 mEmail = config()->readEntry("user_email","");
387 fillMailDefaults(); 389 fillMailDefaults();
388 390
389 config()->setGroup("Category Colors"); 391 config()->setGroup("Category Colors");
390 QStringList::Iterator it; 392 QStringList::Iterator it;
391 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { 393 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) {
392 setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); 394 setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor));
393 395
394 } 396 }
395 397
396 KPimPrefs::usrReadConfig(); 398 KPimPrefs::usrReadConfig();
397} 399}
398 400
399 401
400void KOPrefs::usrWriteConfig() 402void KOPrefs::usrWriteConfig()
401{ 403{
402 config()->setGroup("General"); 404 config()->setGroup("General");
403 config()->writeEntry("Custom Categories",mCustomCategories); 405 config()->writeEntry("Custom Categories",mCustomCategories);
404 406
405 config()->setGroup("Personal Settings"); 407 config()->setGroup("Personal Settings");
406 config()->writeEntry("user_name",mName); 408 config()->writeEntry("user_name",mName);
407 config()->writeEntry("user_email",mEmail); 409 config()->writeEntry("user_email",mEmail);
408 410
409 config()->setGroup("Category Colors"); 411 config()->setGroup("Category Colors");
410 QDictIterator<QColor> it(mCategoryColors); 412 QDictIterator<QColor> it(mCategoryColors);
411 while (it.current()) { 413 while (it.current()) {
412 config()->writeEntry(it.currentKey(),*(it.current())); 414 config()->writeEntry(it.currentKey(),*(it.current()));
413 ++it; 415 ++it;
414 } 416 }
415 417
416 418
417 KPimPrefs::usrWriteConfig(); 419 KPimPrefs::usrWriteConfig();
418} 420}
419 421
420void KOPrefs::setCategoryColor(QString cat,const QColor & color) 422void KOPrefs::setCategoryColor(QString cat,const QColor & color)
421{ 423{
422 mCategoryColors.replace(cat,new QColor(color)); 424 mCategoryColors.replace(cat,new QColor(color));
423} 425}
424 426
425QColor *KOPrefs::categoryColor(QString cat) 427QColor *KOPrefs::categoryColor(QString cat)
426{ 428{
427 QColor *color = 0; 429 QColor *color = 0;
428 430
429 if (!cat.isEmpty()) color = mCategoryColors[cat]; 431 if (!cat.isEmpty()) color = mCategoryColors[cat];
430 432
431 if (color) return color; 433 if (color) return color;
432 else return &mDefaultCategoryColor; 434 else return &mDefaultCategoryColor;
433} 435}
434 436
435void KOPrefs::setFullName(const QString &name) 437void KOPrefs::setFullName(const QString &name)
436{ 438{
437 mName = name; 439 mName = name;
438} 440}
439 441
440void KOPrefs::setEmail(const QString &email) 442void KOPrefs::setEmail(const QString &email)
441{ 443{
442 //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() ); 444 //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() );
443 mEmail = email; 445 mEmail = email;
444} 446}
445 447
446QString KOPrefs::fullName() 448QString KOPrefs::fullName()
447{ 449{
448 if (mEmailControlCenter) { 450 if (mEmailControlCenter) {
449 KEMailSettings settings; 451 KEMailSettings settings;
450 return settings.getSetting(KEMailSettings::RealName); 452 return settings.getSetting(KEMailSettings::RealName);
451 } else { 453 } else {
452 return mName; 454 return mName;
453 } 455 }
454} 456}
455 457
456QString KOPrefs::email() 458QString KOPrefs::email()
457{ 459{
458 if (mEmailControlCenter) { 460 if (mEmailControlCenter) {
459 KEMailSettings settings; 461 KEMailSettings settings;
460 return settings.getSetting(KEMailSettings::EmailAddress); 462 return settings.getSetting(KEMailSettings::EmailAddress);
461 } else { 463 } else {
462 return mEmail; 464 return mEmail;
463 } 465 }
464} 466}
465KConfig* KOPrefs::getConfig() 467KConfig* KOPrefs::getConfig()
466{ 468{
467 return config(); 469 return config();
468} 470}
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index f2fe77a..69722a1 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -1,274 +1,276 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef KOPREFS_H 23#ifndef KOPREFS_H
24#define KOPREFS_H 24#define KOPREFS_H
25 25
26 26
27#include <libkdepim/kpimprefs.h> 27#include <libkdepim/kpimprefs.h>
28#include <qdict.h> 28#include <qdict.h>
29 29
30class KConfig; 30class KConfig;
31class QFont; 31class QFont;
32class QColor; 32class QColor;
33class QStringList; 33class QStringList;
34 34
35class KOPrefs : public KPimPrefs 35class KOPrefs : public KPimPrefs
36{ 36{
37 public: 37 public:
38 enum { FormatVCalendar, FormatICalendar }; 38 enum { FormatVCalendar, FormatICalendar };
39 enum { MailClientKMail, MailClientSendmail }; 39 enum { MailClientKMail, MailClientSendmail };
40 enum { IMIPDummy, IMIPKMail }; 40 enum { IMIPDummy, IMIPKMail };
41 enum { IMIPOutbox, IMIPdirectsend }; 41 enum { IMIPOutbox, IMIPdirectsend };
42 enum { neverAuto, addressbookAuto, selectedAuto }; 42 enum { neverAuto, addressbookAuto, selectedAuto };
43 enum { standardDestination, askDestination }; 43 enum { standardDestination, askDestination };
44 44
45 virtual ~KOPrefs(); 45 virtual ~KOPrefs();
46 46
47 /** Get instance of KOPrefs. It is made sure that there is only one 47 /** Get instance of KOPrefs. It is made sure that there is only one
48 instance. */ 48 instance. */
49 static KOPrefs *instance(); 49 static KOPrefs *instance();
50 50
51 /** Set preferences to default values */ 51 /** Set preferences to default values */
52 void usrSetDefaults(); 52 void usrSetDefaults();
53 53
54 /** Read preferences from config file */ 54 /** Read preferences from config file */
55 void usrReadConfig(); 55 void usrReadConfig();
56 56
57 /** Write preferences to config file */ 57 /** Write preferences to config file */
58 void usrWriteConfig(); 58 void usrWriteConfig();
59 void setCategoryDefaults(); 59 void setCategoryDefaults();
60 60
61 protected: 61 protected:
62 void setTimeZoneIdDefault(); 62 void setTimeZoneIdDefault();
63 63
64 /** Fill empty mail fields with default values. */ 64 /** Fill empty mail fields with default values. */
65 void fillMailDefaults(); 65 void fillMailDefaults();
66 66
67 private: 67 private:
68 /** Constructor disabled for public. Use instance() to create a KOPrefs 68 /** Constructor disabled for public. Use instance() to create a KOPrefs
69 object. */ 69 object. */
70 KOPrefs(); 70 KOPrefs();
71 71
72 static KOPrefs *mInstance; 72 static KOPrefs *mInstance;
73 QStringList getDefaultList(); 73 QStringList getDefaultList();
74 public: 74 public:
75 // preferences data 75 // preferences data
76 KConfig* getConfig(); 76 KConfig* getConfig();
77 void setFullName(const QString &); 77 void setFullName(const QString &);
78 QString fullName(); 78 QString fullName();
79 void setEmail(const QString &); 79 void setEmail(const QString &);
80 QString email(); 80 QString email();
81 81
82 QString mAdditional; 82 QString mAdditional;
83 83
84 bool mEmailControlCenter; 84 bool mEmailControlCenter;
85 85
86 bool mBcc; 86 bool mBcc;
87 bool mAutoSave; 87 bool mAutoSave;
88 int mAutoSaveInterval; 88 int mAutoSaveInterval;
89 bool mConfirm; 89 bool mConfirm;
90 90
91 bool mEnableGroupScheduling; 91 bool mEnableGroupScheduling;
92 bool mEnableProjectView; 92 bool mEnableProjectView;
93 93
94 int mDefaultFormat; 94 int mDefaultFormat;
95 int mMailClient; 95 int mMailClient;
96 96
97 int mStartTime; 97 int mStartTime;
98 int mDefaultDuration; 98 int mDefaultDuration;
99 int mAlarmTime; 99 int mAlarmTime;
100 100
101 int mWorkingHoursStart; 101 int mWorkingHoursStart;
102 int mWorkingHoursEnd; 102 int mWorkingHoursEnd;
103 bool mExcludeHolidays; 103 bool mExcludeHolidays;
104 bool mExcludeSaturdays; 104 bool mExcludeSaturdays;
105 bool mMarcusBainsShowSeconds; 105 bool mMarcusBainsShowSeconds;
106 106
107 QFont mTimeBarFont; 107 QFont mTimeBarFont;
108 QFont mMonthViewFont; 108 QFont mMonthViewFont;
109 QFont mAgendaViewFont; 109 QFont mAgendaViewFont;
110 QFont mMarcusBainsFont; 110 QFont mMarcusBainsFont;
111 QFont mTimeLabelsFont; 111 QFont mTimeLabelsFont;
112 QFont mTodoViewFont; 112 QFont mTodoViewFont;
113 QFont mListViewFont; 113 QFont mListViewFont;
114 QFont mDateNavigatorFont; 114 QFont mDateNavigatorFont;
115 QFont mEditBoxFont; 115 QFont mEditBoxFont;
116 QFont mJornalViewFont; 116 QFont mJornalViewFont;
117 QFont mWhatsNextFont; 117 QFont mWhatsNextFont;
118 QFont mEventViewFont; 118 QFont mEventViewFont;
119 119
120 120
121 121
122 122
123 QColor mHolidayColor; 123 QColor mHolidayColor;
124 QColor mHighlightColor; 124 QColor mHighlightColor;
125 QColor mEventColor; 125 QColor mEventColor;
126 QColor mAgendaBgColor; 126 QColor mAgendaBgColor;
127 QColor mWorkingHoursColor; 127 QColor mWorkingHoursColor;
128 QColor mTodoDueTodayColor; 128 QColor mTodoDueTodayColor;
129 QColor mTodoOverdueColor; 129 QColor mTodoOverdueColor;
130 QColor mMonthViewEvenColor; 130 QColor mMonthViewEvenColor;
131 QColor mMonthViewOddColor; 131 QColor mMonthViewOddColor;
132 QColor mMonthViewHolidayColor; 132 QColor mMonthViewHolidayColor;
133 bool mMonthViewUsesDayColors; 133 bool mMonthViewUsesDayColors;
134 bool mMonthViewSatSunTog; 134 bool mMonthViewSatSunTog;
135 QColor mAppColor1; 135 QColor mAppColor1;
136 QColor mAppColor2; 136 QColor mAppColor2;
137 bool mUseAppColors; 137 bool mUseAppColors;
138 138
139 int mDayBegins; 139 int mDayBegins;
140 int mHourSize; 140 int mHourSize;
141 int mAllDaySize; 141 int mAllDaySize;
142 bool mShowFullMenu; 142 bool mShowFullMenu;
143 bool mDailyRecur; 143 bool mDailyRecur;
144 bool mWeeklyRecur; 144 bool mWeeklyRecur;
145 bool mMonthDailyRecur; 145 bool mMonthDailyRecur;
146 bool mMonthWeeklyRecur; 146 bool mMonthWeeklyRecur;
147 bool mMonthShowIcons; 147 bool mMonthShowIcons;
148 bool mMonthShowShort; 148 bool mMonthShowShort;
149 bool mEnableToolTips; 149 bool mEnableToolTips;
150 bool mEnableMonthScroll; 150 bool mEnableMonthScroll;
151 bool mFullViewMonth; 151 bool mFullViewMonth;
152 bool mMonthViewUsesCategoryColor; 152 bool mMonthViewUsesCategoryColor;
153 bool mFullViewTodo; 153 bool mFullViewTodo;
154 bool mShowCompletedTodo; 154 bool mShowCompletedTodo;
155 bool mMarcusBainsEnabled; 155 bool mMarcusBainsEnabled;
156 int mNextXDays; 156 int mNextXDays;
157 int mWhatsNextDays; 157 int mWhatsNextDays;
158 int mWhatsNextPrios; 158 int mWhatsNextPrios;
159 bool mEnableQuickTodo; 159 bool mEnableQuickTodo;
160 160
161 bool mCompactDialogs; 161 bool mCompactDialogs;
162 bool mVerticalScreen; 162 bool mVerticalScreen;
163 163
164 bool mShowIconNewTodo; 164 bool mShowIconNewTodo;
165 bool mShowIconNewEvent; 165 bool mShowIconNewEvent;
166 bool mShowIconSearch; 166 bool mShowIconSearch;
167 bool mShowIconList; 167 bool mShowIconList;
168 bool mShowIconDay1; 168 bool mShowIconDay1;
169 bool mShowIconDay5; 169 bool mShowIconDay5;
170 bool mShowIconDay7; 170 bool mShowIconDay7;
171 bool mShowIconMonth; 171 bool mShowIconMonth;
172 bool mShowIconTodoview; 172 bool mShowIconTodoview;
173 bool mShowIconBackFast; 173 bool mShowIconBackFast;
174 bool mShowIconBack; 174 bool mShowIconBack;
175 bool mShowIconToday; 175 bool mShowIconToday;
176 bool mShowIconForward; 176 bool mShowIconForward;
177 bool mShowIconForwardFast; 177 bool mShowIconForwardFast;
178 bool mShowIconWhatsThis; 178 bool mShowIconWhatsThis;
179 bool mShowIconNextDays; 179 bool mShowIconNextDays;
180 bool mShowIconNext; 180 bool mShowIconNext;
181 bool mShowIconJournal; 181 bool mShowIconJournal;
182 182
183 bool mShowIconStretch; 183 bool mShowIconStretch;
184 184
185 bool mToolBarHor; 185 bool mToolBarHor;
186 bool mToolBarUp; 186 bool mToolBarUp;
187 bool mToolBarMiniIcons; 187 bool mToolBarMiniIcons;
188 188
189 bool mAskForQuit; 189 bool mAskForQuit;
190 bool mUsePassWd; 190 bool mUsePassWd;
191 bool mShowSyncEvents; 191 bool mShowSyncEvents;
192 bool mShowTodoInAgenda; 192 bool mShowTodoInAgenda;
193 bool mShowTimeInAgenda;
194 bool mHideNonStartedTodos;
193 195
194 int mLastSyncTime; 196 int mLastSyncTime;
195 void setCategoryColor(QString cat,const QColor & color); 197 void setCategoryColor(QString cat,const QColor & color);
196 QColor *categoryColor(QString cat); 198 QColor *categoryColor(QString cat);
197 199
198 QString mArchiveFile; 200 QString mArchiveFile;
199 QString mHtmlExportFile; 201 QString mHtmlExportFile;
200 bool mHtmlWithSave; 202 bool mHtmlWithSave;
201 203
202 QStringList mSelectedPlugins; 204 QStringList mSelectedPlugins;
203 205
204 QString mLastImportFile; 206 QString mLastImportFile;
205 QString mLastVcalFile; 207 QString mLastVcalFile;
206 QString mLastSaveFile; 208 QString mLastSaveFile;
207 QString mLastLoadFile; 209 QString mLastLoadFile;
208 210
209 211
210 QString mDefaultAlarmFile; 212 QString mDefaultAlarmFile;
211 int mIMIPScheduler; 213 int mIMIPScheduler;
212 int mIMIPSend; 214 int mIMIPSend;
213 QStringList mAdditionalMails; 215 QStringList mAdditionalMails;
214 int mIMIPAutoRefresh; 216 int mIMIPAutoRefresh;
215 int mIMIPAutoInsertReply; 217 int mIMIPAutoInsertReply;
216 int mIMIPAutoInsertRequest; 218 int mIMIPAutoInsertRequest;
217 int mIMIPAutoFreeBusy; 219 int mIMIPAutoFreeBusy;
218 int mIMIPAutoFreeBusyReply; 220 int mIMIPAutoFreeBusyReply;
219 221
220 QStringList mTodoTemplates; 222 QStringList mTodoTemplates;
221 QStringList mEventTemplates; 223 QStringList mEventTemplates;
222 224
223 int mDestination; 225 int mDestination;
224 226
225 227
226 bool mEditOnDoubleClick; 228 bool mEditOnDoubleClick;
227 bool mViewChangeHoldFullscreen; 229 bool mViewChangeHoldFullscreen;
228 bool mViewChangeHoldNonFullscreen; 230 bool mViewChangeHoldNonFullscreen;
229 bool mCenterOnCurrentTime; 231 bool mCenterOnCurrentTime;
230 bool mSetTimeToDayStartAt; 232 bool mSetTimeToDayStartAt;
231 bool mHighlightCurrentDay; 233 bool mHighlightCurrentDay;
232 bool mUseHighlightLightColor; 234 bool mUseHighlightLightColor;
233 bool mListViewMonthTimespan; 235 bool mListViewMonthTimespan;
234 bool mWNViewShowsParents; 236 bool mWNViewShowsParents;
235 bool mWNViewShowsPast; 237 bool mWNViewShowsPast;
236 bool mWNViewShowLocation; 238 bool mWNViewShowLocation;
237 bool mTodoViewShowsPercentage; 239 bool mTodoViewShowsPercentage;
238 bool mTodoViewUsesCatColors; 240 bool mTodoViewUsesCatColors;
239 bool mTodoViewUsesSmallFont; 241 bool mTodoViewUsesSmallFont;
240 bool mTodoViewUsesForegroundColor; 242 bool mTodoViewUsesForegroundColor;
241 bool mMonthViewUsesForegroundColor; 243 bool mMonthViewUsesForegroundColor;
242 244
243 bool mHightlightDateTimeEdit; 245 bool mHightlightDateTimeEdit;
244 bool mShortDateInViewer; 246 bool mShortDateInViewer;
245 247
246 QStringList mLocationDefaults; 248 QStringList mLocationDefaults;
247 QStringList mEventSummaryUser; 249 QStringList mEventSummaryUser;
248 QStringList mTodoSummaryUser; 250 QStringList mTodoSummaryUser;
249 251
250 bool mUseInternalAlarmNotification; 252 bool mUseInternalAlarmNotification;
251 int mAlarmPlayBeeps; 253 int mAlarmPlayBeeps;
252 int mAlarmSuspendTime; 254 int mAlarmSuspendTime;
253 int mAlarmSuspendCount; 255 int mAlarmSuspendCount;
254 int mAlarmBeepInterval; 256 int mAlarmBeepInterval;
255 int mOldLanguage; 257 int mOldLanguage;
256 int mOldLoadedLanguage; 258 int mOldLoadedLanguage;
257 259
258 260
259 QString mActiveSyncPort; 261 QString mActiveSyncPort;
260 QString mActiveSyncIP; 262 QString mActiveSyncIP;
261 263
262 private: 264 private:
263 QDict<QColor> mCategoryColors; 265 QDict<QColor> mCategoryColors;
264 QColor mDefaultCategoryColor; 266 QColor mDefaultCategoryColor;
265 267
266 QFont mDefaultTimeBarFont; 268 QFont mDefaultTimeBarFont;
267 QFont mDefaultViewFont; 269 QFont mDefaultViewFont;
268 QFont mDefaultMonthViewFont; 270 QFont mDefaultMonthViewFont;
269 271
270 QString mName; 272 QString mName;
271 QString mEmail; 273 QString mEmail;
272}; 274};
273 275
274#endif 276#endif
diff --git a/korganizer/koprefsdialog.cpp b/korganizer/koprefsdialog.cpp
index 578c0e9..8aa24ee 100644
--- a/korganizer/koprefsdialog.cpp
+++ b/korganizer/koprefsdialog.cpp
@@ -1,1646 +1,1659 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qlayout.h> 24#include <qlayout.h>
25#include <qlabel.h> 25#include <qlabel.h>
26#include <qgroupbox.h> 26#include <qgroupbox.h>
27#include <qbuttongroup.h> 27#include <qbuttongroup.h>
28#include <qlineedit.h> 28#include <qlineedit.h>
29#include <qfont.h> 29#include <qfont.h>
30#include <qslider.h> 30#include <qslider.h>
31#include <qfile.h> 31#include <qfile.h>
32#include <qtextstream.h> 32#include <qtextstream.h>
33#include <qcombobox.h> 33#include <qcombobox.h>
34#include <qvbox.h> 34#include <qvbox.h>
35#include <qhbox.h> 35#include <qhbox.h>
36#include <qregexp.h> 36#include <qregexp.h>
37#include <qspinbox.h> 37#include <qspinbox.h>
38#include <qdatetime.h> 38#include <qdatetime.h>
39#include <qcheckbox.h> 39#include <qcheckbox.h>
40#include <qradiobutton.h> 40#include <qradiobutton.h>
41#include <qpushbutton.h> 41#include <qpushbutton.h>
42#include <qstrlist.h> 42#include <qstrlist.h>
43#include <qapplication.h> 43#include <qapplication.h>
44 44
45#include <kcolorbutton.h> 45#include <kcolorbutton.h>
46#include <kdebug.h> 46#include <kdebug.h>
47#include <klocale.h> 47#include <klocale.h>
48#include <kglobal.h> 48#include <kglobal.h>
49#include <kfontdialog.h> 49#include <kfontdialog.h>
50#include <kfiledialog.h> 50#include <kfiledialog.h>
51#include <kmessagebox.h> 51#include <kmessagebox.h>
52#include <kcolordialog.h> 52#include <kcolordialog.h>
53#include <kiconloader.h> 53#include <kiconloader.h>
54#include <kemailsettings.h> 54#include <kemailsettings.h>
55#include <kstandarddirs.h> 55#include <kstandarddirs.h>
56 56
57#include <kurlrequester.h> 57#include <kurlrequester.h>
58#include <klineedit.h> 58#include <klineedit.h>
59 59
60#if defined(USE_SOLARIS) 60#if defined(USE_SOLARIS)
61#include <sys/param.h> 61#include <sys/param.h>
62 62
63#define ZONEINFODIR "/usr/share/lib/zoneinfo" 63#define ZONEINFODIR "/usr/share/lib/zoneinfo"
64#define INITFILE "/etc/default/init" 64#define INITFILE "/etc/default/init"
65#endif 65#endif
66 66
67#include "koprefs.h" 67#include "koprefs.h"
68 68
69#include "koprefsdialog.h" 69#include "koprefsdialog.h"
70#include "kpimglobalprefs.h" 70#include "kpimglobalprefs.h"
71 71
72 72
73KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) : 73KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) :
74 KPrefsDialog(KOPrefs::instance(),parent,name,true) 74 KPrefsDialog(KOPrefs::instance(),parent,name,true)
75{ 75{
76 76
77 setCaption( i18n("Preferences - some settings need a restart (nr)")); 77 setCaption( i18n("Preferences - some settings need a restart (nr)"));
78 mCategoryDict.setAutoDelete(true); 78 mCategoryDict.setAutoDelete(true);
79 79
80 KGlobal::locale()->insertCatalogue("timezones"); 80 KGlobal::locale()->insertCatalogue("timezones");
81 81
82 setupGlobalTab(); 82 setupGlobalTab();
83 setupMainTab(); 83 setupMainTab();
84 // setupLocaleTab(); 84 // setupLocaleTab();
85 //setupTimeZoneTab(); 85 //setupTimeZoneTab();
86 setupTimeTab(); 86 setupTimeTab();
87 //setupLocaleDateTab(); 87 //setupLocaleDateTab();
88 setupFontsTab(); 88 setupFontsTab();
89 setupColorsTab(); 89 setupColorsTab();
90 setupViewsTab(); 90 setupViewsTab();
91 //setupSyncTab(); 91 //setupSyncTab();
92 //setupSyncAlgTab(); 92 //setupSyncAlgTab();
93 //setupPrinterTab(); 93 //setupPrinterTab();
94 //setupGroupSchedulingTab(); 94 //setupGroupSchedulingTab();
95 //setupGroupAutomationTab(); 95 //setupGroupAutomationTab();
96
97 if ( QApplication::desktop()->height() == 480 )
98 hideButtons();
96} 99}
97 100
98 101
99KOPrefsDialog::~KOPrefsDialog() 102KOPrefsDialog::~KOPrefsDialog()
100{ 103{
101} 104}
102void KOPrefsDialog::setupGlobalTab() 105void KOPrefsDialog::setupGlobalTab()
103{ 106{
104 QFrame *topFrame = addPage(i18n("Global"),0,0); 107 QFrame *topFrame = addPage(i18n("Global"),0,0);
105 kdelibcfg = new KDEPIMConfigWidget( KPimGlobalPrefs::instance(), topFrame, "KCMKdeLibConfig" ); 108 kdelibcfg = new KDEPIMConfigWidget( KPimGlobalPrefs::instance(), topFrame, "KCMKdeLibConfig" );
106 QVBoxLayout *topLayout = new QVBoxLayout(topFrame); 109 QVBoxLayout *topLayout = new QVBoxLayout(topFrame);
107 topLayout->addWidget( kdelibcfg ); 110 topLayout->addWidget( kdelibcfg );
108 111
109 112
110} 113}
111void KOPrefsDialog::setupLocaleDateTab() 114void KOPrefsDialog::setupLocaleDateTab()
112{ 115{
113#if 0 116#if 0
114QFrame *topFrame = addPage(i18n("Date Format"),0,0); 117QFrame *topFrame = addPage(i18n("Date Format"),0,0);
115 QGridLayout *topLayout = new QGridLayout(topFrame,3,2); 118 QGridLayout *topLayout = new QGridLayout(topFrame,3,2);
116 topLayout->setSpacing(spacingHint()); 119 topLayout->setSpacing(spacingHint());
117 topLayout->setMargin(marginHint()); 120 topLayout->setMargin(marginHint());
118 int iii = 0; 121 int iii = 0;
119 122
120 123
121 KPrefsDialogWidRadios *syncPrefsGroup = 124 KPrefsDialogWidRadios *syncPrefsGroup =
122 addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame); 125 addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame);
123 QString format; 126 QString format;
124 if ( QApplication::desktop()->width() < 480 ) 127 if ( QApplication::desktop()->width() < 480 )
125 format = "(%d.%m.%Y)"; 128 format = "(%d.%m.%Y)";
126 else 129 else
127 format = "(%d.%m.%Y|%A %d %B %Y)"; 130 format = "(%d.%m.%Y|%A %d %B %Y)";
128 syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); 131 syncPrefsGroup->addRadio(i18n("24.03.2004 "+format));
129 if ( QApplication::desktop()->width() < 480 ) 132 if ( QApplication::desktop()->width() < 480 )
130 format = "(%m.%d.%Y)"; 133 format = "(%m.%d.%Y)";
131 else 134 else
132 format = "(%m.%d.%Y|%A %B %d %Y)"; 135 format = "(%m.%d.%Y|%A %B %d %Y)";
133 syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); 136 syncPrefsGroup->addRadio(i18n("03.24.2004 "+format));
134 if ( QApplication::desktop()->width() < 480 ) 137 if ( QApplication::desktop()->width() < 480 )
135 format = "(%Y-%m-%d)"; 138 format = "(%Y-%m-%d)";
136 else 139 else
137 format = "(%Y-%m-%d|%A %Y %B %d)"; 140 format = "(%Y-%m-%d|%A %Y %B %d)";
138 syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); 141 syncPrefsGroup->addRadio(i18n("2004-03-24 "+format));
139 syncPrefsGroup->addRadio(i18n("User defined")); 142 syncPrefsGroup->addRadio(i18n("User defined"));
140 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 143 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
141 ++iii; 144 ++iii;
142 ++iii; 145 ++iii;
143 QLabel * lab; 146 QLabel * lab;
144 mUserDateFormatLong = new QLineEdit(topFrame); 147 mUserDateFormatLong = new QLineEdit(topFrame);
145 lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); 148 lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame);
146 topLayout->addWidget(lab ,iii,0); 149 topLayout->addWidget(lab ,iii,0);
147 topLayout->addWidget(mUserDateFormatLong,iii,1); 150 topLayout->addWidget(mUserDateFormatLong,iii,1);
148 ++iii; 151 ++iii;
149 mUserDateFormatShort = new QLineEdit(topFrame); 152 mUserDateFormatShort = new QLineEdit(topFrame);
150 lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); 153 lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame);
151 topLayout->addWidget(lab ,iii,0); 154 topLayout->addWidget(lab ,iii,0);
152 topLayout->addWidget(mUserDateFormatShort,iii,1); 155 topLayout->addWidget(mUserDateFormatShort,iii,1);
153 ++iii; 156 ++iii;
154 lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); 157 lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame);
155 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 158 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
156 ++iii; 159 ++iii;
157 lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); 160 lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame);
158 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 161 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
159 ++iii; 162 ++iii;
160 lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); 163 lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame);
161 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 164 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
162 ++iii; 165 ++iii;
163#endif 166#endif
164 167
165} 168}
166 169
167void KOPrefsDialog::setupLocaleTab() 170void KOPrefsDialog::setupLocaleTab()
168{ 171{
169#if 0 172#if 0
170 QFrame *topFrame = addPage(i18n("Locale"),0,0); 173 QFrame *topFrame = addPage(i18n("Locale"),0,0);
171 QGridLayout *topLayout = new QGridLayout(topFrame,4,2); 174 QGridLayout *topLayout = new QGridLayout(topFrame,4,2);
172 topLayout->setSpacing(spacingHint()); 175 topLayout->setSpacing(spacingHint());
173 topLayout->setMargin(marginHint()); 176 topLayout->setMargin(marginHint());
174 int iii = 0; 177 int iii = 0;
175 KPrefsDialogWidRadios *syncPrefsGroup = 178 KPrefsDialogWidRadios *syncPrefsGroup =
176 addWidRadios(i18n("Language:(needs restart)"),&(KOPrefs::instance()->mPreferredLanguage),topFrame); 179 addWidRadios(i18n("Language:(needs restart)"),&(KOPrefs::instance()->mPreferredLanguage),topFrame);
177 syncPrefsGroup->addRadio(i18n("English")); 180 syncPrefsGroup->addRadio(i18n("English"));
178 syncPrefsGroup->addRadio(i18n("German")); 181 syncPrefsGroup->addRadio(i18n("German"));
179 syncPrefsGroup->addRadio(i18n("French")); 182 syncPrefsGroup->addRadio(i18n("French"));
180 syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); 183 syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)"));
181 if ( QApplication::desktop()->width() < 300 ) 184 if ( QApplication::desktop()->width() < 300 )
182 ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); 185 ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical);
183 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 186 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
184 ++iii; 187 ++iii;
185 188
186 syncPrefsGroup = 189 syncPrefsGroup =
187 addWidRadios(i18n("Time Format(nr):"),&(KOPrefs::instance()->mPreferredTime),topFrame); 190 addWidRadios(i18n("Time Format(nr):"),&(KOPrefs::instance()->mPreferredTime),topFrame);
188 if ( QApplication::desktop()->width() > 300 ) 191 if ( QApplication::desktop()->width() > 300 )
189 syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); 192 syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical);
190 syncPrefsGroup->addRadio(i18n("24:00")); 193 syncPrefsGroup->addRadio(i18n("24:00"));
191 syncPrefsGroup->addRadio(i18n("12:00am")); 194 syncPrefsGroup->addRadio(i18n("12:00am"));
192 syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); 195 syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical);
193 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 196 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
194 ++iii; 197 ++iii;
195 KPrefsDialogWidBool *sb; 198 KPrefsDialogWidBool *sb;
196 if ( QApplication::desktop()->width() < 300 ) { 199 if ( QApplication::desktop()->width() < 300 ) {
197 sb = 200 sb =
198 addWidBool(i18n("Week starts on Sunday"), 201 addWidBool(i18n("Week starts on Sunday"),
199 &(KOPrefs::instance()->mWeekStartsOnSunday),topFrame); 202 &(KOPrefs::instance()->mWeekStartsOnSunday),topFrame);
200 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 203 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
201 ++iii; 204 ++iii;
202 sb = 205 sb =
203 addWidBool(i18n("Use short date in (WN/E) view"), 206 addWidBool(i18n("Use short date in (WN/E) view"),
204 &(KOPrefs::instance()->mShortDateInViewer),topFrame); 207 &(KOPrefs::instance()->mShortDateInViewer),topFrame);
205 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 208 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
206 } 209 }
207 else { 210 else {
208 QWidget * hb = new QWidget( topFrame ); 211 QWidget * hb = new QWidget( topFrame );
209 QHBoxLayout *hbLayout = new QHBoxLayout(hb); 212 QHBoxLayout *hbLayout = new QHBoxLayout(hb);
210 sb = 213 sb =
211 addWidBool(i18n("Week starts on Sunday"), 214 addWidBool(i18n("Week starts on Sunday"),
212 &(KOPrefs::instance()->mWeekStartsOnSunday),hb); 215 &(KOPrefs::instance()->mWeekStartsOnSunday),hb);
213 hbLayout->addWidget(sb->checkBox() ); 216 hbLayout->addWidget(sb->checkBox() );
214 sb = 217 sb =
215 addWidBool(i18n("Use short date in (WN/E) view"), 218 addWidBool(i18n("Use short date in (WN/E) view"),
216 &(KOPrefs::instance()->mShortDateInViewer),hb); 219 &(KOPrefs::instance()->mShortDateInViewer),hb);
217 hbLayout->addWidget(sb->checkBox() ); 220 hbLayout->addWidget(sb->checkBox() );
218 topLayout->addMultiCellWidget(hb, iii,iii,0,1); 221 topLayout->addMultiCellWidget(hb, iii,iii,0,1);
219 222
220 } 223 }
221 // KPrefsDialogWidBool *sb; //#ifndef DESKTOP_VERSION 224 // KPrefsDialogWidBool *sb; //#ifndef DESKTOP_VERSION
222#if 0 225#if 0
223 ++iii; 226 ++iii;
224 sb = 227 sb =
225 addWidBool(i18n("Quick load/save (w/o Unicode)"), 228 addWidBool(i18n("Quick load/save (w/o Unicode)"),
226 &(KOPrefs::instance()->mUseQuicksave),topFrame); 229 &(KOPrefs::instance()->mUseQuicksave),topFrame);
227 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 230 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
228#endif 231#endif
229#endif 232#endif
230} 233}
231void KOPrefsDialog::showSyncPage() 234void KOPrefsDialog::showSyncPage()
232{ 235{
233 showPage ( 0 ) ; 236 showPage ( 0 ) ;
234 kdelibcfg->showTimeZoneTab() ; 237 kdelibcfg->showTimeZoneTab() ;
235 238
236} 239}
237void KOPrefsDialog::setupSyncAlgTab() 240void KOPrefsDialog::setupSyncAlgTab()
238{ 241{
239#if 0 242#if 0
240 QLabel * lab; 243 QLabel * lab;
241 QFrame *topFrame = addPage(i18n("Sync Prefs"),0,0); 244 QFrame *topFrame = addPage(i18n("Sync Prefs"),0,0);
242 mSetupSyncAlgTab = topFrame; 245 mSetupSyncAlgTab = topFrame;
243 QGridLayout *topLayout = new QGridLayout(topFrame,6,2); 246 QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
244 topLayout->setSpacing(spacingHint()); 247 topLayout->setSpacing(spacingHint());
245 topLayout->setMargin(marginHint()); 248 topLayout->setMargin(marginHint());
246 int iii = 0; 249 int iii = 0;
247 250
248 KPrefsDialogWidBool *sb = 251 KPrefsDialogWidBool *sb =
249 addWidBool(i18n("Ask for preferences before syncing"), 252 addWidBool(i18n("Ask for preferences before syncing"),
250 &(KOPrefs::instance()->mAskForPreferences),topFrame); 253 &(KOPrefs::instance()->mAskForPreferences),topFrame);
251 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 254 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
252 255
253 ++iii; 256 ++iii;
254 257
255 KPrefsDialogWidRadios *syncPrefsGroup = 258 KPrefsDialogWidRadios *syncPrefsGroup =
256 addWidRadios(i18n("Sync preferences:"),&(KOPrefs::instance()->mSyncAlgoPrefs), 259 addWidRadios(i18n("Sync preferences:"),&(KOPrefs::instance()->mSyncAlgoPrefs),
257 topFrame); 260 topFrame);
258 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); 261 syncPrefsGroup->addRadio(i18n("Take local entry on conflict"));
259 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); 262 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict"));
260 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); 263 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict"));
261 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); 264 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict"));
262 syncPrefsGroup->addRadio(i18n("Force take local entry always")); 265 syncPrefsGroup->addRadio(i18n("Force take local entry always"));
263 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); 266 syncPrefsGroup->addRadio(i18n("Force take remote entry always"));
264 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 267 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
265 ++iii; 268 ++iii;
266 sb = 269 sb =
267 addWidBool(i18n("Show summary after syncing"), 270 addWidBool(i18n("Show summary after syncing"),
268 &(KOPrefs::instance()->mShowSyncSummary),topFrame); 271 &(KOPrefs::instance()->mShowSyncSummary),topFrame);
269 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 272 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
270 273
271 ++iii; 274 ++iii;
272#endif 275#endif
273 276
274 277
275 278
276} 279}
277 280
278 281
279void KOPrefsDialog::setupSyncTab() 282void KOPrefsDialog::setupSyncTab()
280{ 283{
281#if 0 284#if 0
282 QLabel * lab; 285 QLabel * lab;
283 QFrame *topFrame = addPage(i18n("Sync Network"),0,0); 286 QFrame *topFrame = addPage(i18n("Sync Network"),0,0);
284 QGridLayout *topLayout = new QGridLayout(topFrame,6,2); 287 QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
285 topLayout->setSpacing(spacingHint()); 288 topLayout->setSpacing(spacingHint());
286 topLayout->setMargin(marginHint()); 289 topLayout->setMargin(marginHint());
287 lab = new QLabel(i18n("Remote syncing (via ssh/scp)\nnetwork settings "), topFrame); 290 lab = new QLabel(i18n("Remote syncing (via ssh/scp)\nnetwork settings "), topFrame);
288 int iii = 0; 291 int iii = 0;
289 topLayout->addMultiCellWidget(lab , iii,iii,0,1); 292 topLayout->addMultiCellWidget(lab , iii,iii,0,1);
290 ++iii; 293 ++iii;
291 294
292 mRemoteIPEdit = new QLineEdit(topFrame); 295 mRemoteIPEdit = new QLineEdit(topFrame);
293 lab = new QLabel(mRemoteIPEdit, i18n("Remote IP:"), topFrame); 296 lab = new QLabel(mRemoteIPEdit, i18n("Remote IP:"), topFrame);
294 topLayout->addWidget(lab ,iii,0); 297 topLayout->addWidget(lab ,iii,0);
295 topLayout->addWidget(mRemoteIPEdit,iii,1); 298 topLayout->addWidget(mRemoteIPEdit,iii,1);
296 ++iii; 299 ++iii;
297 mRemoteUser = new QLineEdit(topFrame); 300 mRemoteUser = new QLineEdit(topFrame);
298 lab = new QLabel(mRemoteUser, i18n("Remote user:"), topFrame); 301 lab = new QLabel(mRemoteUser, i18n("Remote user:"), topFrame);
299 topLayout->addWidget(lab ,iii,0); 302 topLayout->addWidget(lab ,iii,0);
300 topLayout->addWidget(mRemoteUser, iii,1); 303 topLayout->addWidget(mRemoteUser, iii,1);
301 ++iii; 304 ++iii;
302 305
303 mRemoteFile = new QLineEdit(topFrame); 306 mRemoteFile = new QLineEdit(topFrame);
304 lab = new QLabel(mRemoteFile, i18n("Remote file:"), topFrame); 307 lab = new QLabel(mRemoteFile, i18n("Remote file:"), topFrame);
305 topLayout->addWidget(lab ,iii,0); 308 topLayout->addWidget(lab ,iii,0);
306 topLayout->addWidget(mRemoteFile,iii,1); 309 topLayout->addWidget(mRemoteFile,iii,1);
307 ++iii; 310 ++iii;
308 311
309 mLocalTempFile = new QLineEdit(topFrame); 312 mLocalTempFile = new QLineEdit(topFrame);
310 lab = new QLabel(mLocalTempFile, i18n("Local temp file:"), topFrame); 313 lab = new QLabel(mLocalTempFile, i18n("Local temp file:"), topFrame);
311 topLayout->addWidget(lab ,iii,0); 314 topLayout->addWidget(lab ,iii,0);
312 topLayout->addWidget(mLocalTempFile,iii,1); 315 topLayout->addWidget(mLocalTempFile,iii,1);
313 ++iii; 316 ++iii;
314 317
315 KPrefsDialogWidBool *wb = 318 KPrefsDialogWidBool *wb =
316 addWidBool(i18n("Write back synced file"), 319 addWidBool(i18n("Write back synced file"),
317 &(KOPrefs::instance()->mWriteBackFile),topFrame); 320 &(KOPrefs::instance()->mWriteBackFile),topFrame);
318 topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); 321 topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1);
319 ++iii; 322 ++iii;
320 wb = 323 wb =
321 addWidBool(i18n("Write back existing entries only"), 324 addWidBool(i18n("Write back existing entries only"),
322 &(KOPrefs::instance()->mWriteBackExistingOnly),topFrame); 325 &(KOPrefs::instance()->mWriteBackExistingOnly),topFrame);
323 topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); 326 topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1);
324 ++iii; 327 ++iii;
325 328
326#endif 329#endif
327} 330}
328 331
329void KOPrefsDialog::setupMainTab() 332void KOPrefsDialog::setupMainTab()
330{ 333{
331 QFrame *topFrame = addPage(i18n("General"),0,0); 334 QFrame *topFrame = addPage(i18n("General"),0,0);
332 // DesktopIcon("identity",KIcon::SizeMedium)); 335 // DesktopIcon("identity",KIcon::SizeMedium));
333 336
334 QGridLayout *topLayout = new QGridLayout(topFrame,6,2); 337 QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
335 topLayout->setSpacing(spacingHint()); 338 topLayout->setSpacing(spacingHint());
336 topLayout->setMargin(marginHint()); 339 topLayout->setMargin(marginHint());
337 340
338 // KPrefsDialogWidBool *emailControlCenter = 341 // KPrefsDialogWidBool *emailControlCenter =
339// addWidBool(i18n("&Use email settings from Control Center"), 342// addWidBool(i18n("&Use email settings from Control Center"),
340// &(KOPrefs::instance()->mEmailControlCenter),topFrame); 343// &(KOPrefs::instance()->mEmailControlCenter),topFrame);
341// topLayout->addMultiCellWidget(emailControlCenter->checkBox(),0,0,0,1); 344// topLayout->addMultiCellWidget(emailControlCenter->checkBox(),0,0,0,1);
342 // connect(emailControlCenter->checkBox(),SIGNAL(toggled(bool)), 345 // connect(emailControlCenter->checkBox(),SIGNAL(toggled(bool)),
343 // SLOT(toggleEmailSettings(bool))); 346 // SLOT(toggleEmailSettings(bool)));
344 347
345 mNameEdit = new QLineEdit(topFrame); 348 mNameEdit = new QLineEdit(topFrame);
346 mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame); 349 mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame);
347 topLayout->addWidget(mNameLabel,0,0); 350 topLayout->addWidget(mNameLabel,0,0);
348 topLayout->addWidget(mNameEdit,0,1); 351 topLayout->addWidget(mNameEdit,0,1);
349 352
350 mEmailEdit = new QLineEdit(topFrame); 353 mEmailEdit = new QLineEdit(topFrame);
351 mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame); 354 mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame);
352 topLayout->addWidget(mEmailLabel,1,0); 355 topLayout->addWidget(mEmailLabel,1,0);
353 topLayout->addWidget(mEmailEdit,1,1); 356 topLayout->addWidget(mEmailEdit,1,1);
354 KPrefsDialogWidBool *wb; 357 KPrefsDialogWidBool *wb;
355 QHBox *dummy; 358 QHBox *dummy;
356 if ( QApplication::desktop()->width() > 480 ) { 359 if ( QApplication::desktop()->width() > 480 ) {
357 dummy = new QHBox(topFrame); 360 dummy = new QHBox(topFrame);
358 } else { 361 } else {
359 dummy = new QVBox(topFrame); 362 dummy = new QVBox(topFrame);
360 } 363 }
361 364
362 topLayout->addMultiCellWidget(dummy, 2,2,0,1); 365 topLayout->addMultiCellWidget(dummy, 2,2,0,1);
363 addWidBool(i18n("Full menu bar(nr)"), 366 addWidBool(i18n("Full menu bar(nr)"),
364 &(KOPrefs::instance()->mShowFullMenu),dummy); 367 &(KOPrefs::instance()->mShowFullMenu),dummy);
365 368
366 369
367 addWidBool(i18n("Mini icons in toolbar(nr)"), 370 addWidBool(i18n("Mini icons in toolbar(nr)"),
368 &(KOPrefs::instance()->mToolBarMiniIcons),dummy); 371 &(KOPrefs::instance()->mToolBarMiniIcons),dummy);
369 372
370 373
371 dummy = new QHBox(topFrame); 374 dummy = new QHBox(topFrame);
372 new QLabel(i18n("Days in What's Next:"),dummy); 375 new QLabel(i18n("Days in What's Next:"),dummy);
373 mWhatsNextSpin = new QSpinBox(1,14,1,dummy); 376 mWhatsNextSpin = new QSpinBox(1,14,1,dummy);
374 377
375 topLayout->addMultiCellWidget(dummy,3,3,0,1); 378 topLayout->addMultiCellWidget(dummy,3,3,0,1);
376 379
377 380
378 381
379 dummy = new QHBox(topFrame); 382 dummy = new QHBox(topFrame);
380 new QLabel(i18n("Days in Next-X-Days:"),dummy); 383 new QLabel(i18n("Days in Next-X-Days:"),dummy);
381 mNextXDaysSpin = new QSpinBox(2,14,1,dummy); 384 mNextXDaysSpin = new QSpinBox(2,14,1,dummy);
382 385
383 topLayout->addMultiCellWidget(dummy,4,4,0,1); 386 topLayout->addMultiCellWidget(dummy,4,4,0,1);
384 387
385 QHBox *prioBox = new QHBox(topFrame); 388 QHBox *prioBox = new QHBox(topFrame);
386 // intervalBox->setSpacing(spacingHint()); 389 // intervalBox->setSpacing(spacingHint());
387 topLayout->addMultiCellWidget(prioBox,5,5,0,1); 390 topLayout->addMultiCellWidget(prioBox,5,5,0,1);
388 QString messa = i18n("Show topmost todo prios in What's Next:"); 391 QString messa = i18n("Show topmost todo prios in What's Next:");
389 392
390 if ( QApplication::desktop()->width() < 300 ) 393 if ( QApplication::desktop()->width() < 300 )
391 messa = i18n("Show topmost todo prios in What's N.:"); 394 messa = i18n("Show topmost todo prios in What's N.:");
392 QLabel *prioLabel = new QLabel(messa, prioBox); 395 QLabel *prioLabel = new QLabel(messa, prioBox);
393 mPrioSpin = new QSpinBox(0,5,1,prioBox); 396 mPrioSpin = new QSpinBox(0,5,1,prioBox);
394 if ( QApplication::desktop()->width() < 300 ) 397 if ( QApplication::desktop()->width() < 300 )
395 mPrioSpin->setFixedWidth( 40 ); 398 mPrioSpin->setFixedWidth( 40 );
396 399
397 // KPrefsDialogWidBool *bcc = 400 // KPrefsDialogWidBool *bcc =
398// addWidBool(i18n("Send copy to owner when mailing events"), 401// addWidBool(i18n("Send copy to owner when mailing events"),
399// &(KOPrefs::instance()->mBcc),topFrame); 402// &(KOPrefs::instance()->mBcc),topFrame);
400// topLayout->addMultiCellWidget(bcc->checkBox(),4,4,0,1); 403// topLayout->addMultiCellWidget(bcc->checkBox(),4,4,0,1);
401 404
402 405
403 // QGroupBox *autoSaveGroup = new QGroupBox(1,Horizontal,i18n("Auto-Save"), topFrame); 406 // QGroupBox *autoSaveGroup = new QGroupBox(1,Horizontal,i18n("Auto-Save"), topFrame);
404 //topLayout->addMultiCellWidget(autoSaveGroup,6,6,0,1); 407 //topLayout->addMultiCellWidget(autoSaveGroup,6,6,0,1);
405 408
406 // addWidBool(i18n("Enable automatic saving of calendar"), 409 // addWidBool(i18n("Enable automatic saving of calendar"),
407 // &(KOPrefs::instance()->mAutoSave),autoSaveGroup); 410 // &(KOPrefs::instance()->mAutoSave),autoSaveGroup);
408 411
409 QHBox *intervalBox = new QHBox(topFrame); 412 QHBox *intervalBox = new QHBox(topFrame);
410 // intervalBox->setSpacing(spacingHint()); 413 // intervalBox->setSpacing(spacingHint());
411 topLayout->addMultiCellWidget(intervalBox,6,6,0,1); 414 topLayout->addMultiCellWidget(intervalBox,6,6,0,1);
412 QLabel *autoSaveIntervalLabel = new QLabel(i18n("Auto save delay in minutes:"),intervalBox); 415 QLabel *autoSaveIntervalLabel = new QLabel(i18n("Auto save delay in minutes:"),intervalBox);
413 mAutoSaveIntervalSpin = new QSpinBox(0,500,1,intervalBox); 416 mAutoSaveIntervalSpin = new QSpinBox(0,500,1,intervalBox);
414 autoSaveIntervalLabel->setBuddy(mAutoSaveIntervalSpin); 417 autoSaveIntervalLabel->setBuddy(mAutoSaveIntervalSpin);
415 /* 418 /*
416 QHBox * agendasize = new QHBox ( topFrame ); 419 QHBox * agendasize = new QHBox ( topFrame );
417 420
418 new QLabel (i18n("AllDayAgenda Height:"), agendasize ); 421 new QLabel (i18n("AllDayAgenda Height:"), agendasize );
419 422
420 423
421 mHourSizeSlider = new QSlider(24,47,1,24,Horizontal,agendasize); 424 mHourSizeSlider = new QSlider(24,47,1,24,Horizontal,agendasize);
422 topLayout->addMultiCellWidget(agendasize,7,7,0,1); 425 topLayout->addMultiCellWidget(agendasize,7,7,0,1);
423 */ 426 */
424 KPrefsDialogWidBool *verticalScreen = 427 KPrefsDialogWidBool *verticalScreen =
425 addWidBool(i18n("Show vertical screen (Needs restart)"), 428 addWidBool(i18n("Show vertical screen (Needs restart)"),
426 &(KOPrefs::instance()->mVerticalScreen),topFrame); 429 &(KOPrefs::instance()->mVerticalScreen),topFrame);
427 //topLayout->addWidget(verticalScreen->checkBox(),ii++,0); 430 //topLayout->addWidget(verticalScreen->checkBox(),ii++,0);
428 topLayout->addMultiCellWidget(verticalScreen->checkBox(),7,7,0,1); 431 topLayout->addMultiCellWidget(verticalScreen->checkBox(),7,7,0,1);
429 432
430 KPrefsDialogWidBool *ask = 433 KPrefsDialogWidBool *ask =
431 addWidBool(i18n("Ask for quit when closing KO/Pi"), 434 addWidBool(i18n("Ask for quit when closing KO/Pi"),
432 &(KOPrefs::instance()->mAskForQuit),topFrame); 435 &(KOPrefs::instance()->mAskForQuit),topFrame);
433 topLayout->addMultiCellWidget(ask->checkBox(),8,8,0,1); 436 topLayout->addMultiCellWidget(ask->checkBox(),8,8,0,1);
434 437
435 438
436 /* 439 /*
437 KPrefsDialogWidBool *confirmCheck = 440 KPrefsDialogWidBool *confirmCheck =
438 addWidBool(i18n("Confirm &deletes"),&(KOPrefs::instance()->mConfirm), 441 addWidBool(i18n("Confirm &deletes"),&(KOPrefs::instance()->mConfirm),
439 topFrame); 442 topFrame);
440 topLayout->addMultiCellWidget(confirmCheck->checkBox(),7,7,0,1); 443 topLayout->addMultiCellWidget(confirmCheck->checkBox(),7,7,0,1);
441 444
442 445
443 mEnableGroupScheduling = 446 mEnableGroupScheduling =
444 addWidBool(i18n("Enable group scheduling"), 447 addWidBool(i18n("Enable group scheduling"),
445 &(KOPrefs::instance()->mEnableGroupScheduling),topFrame); 448 &(KOPrefs::instance()->mEnableGroupScheduling),topFrame);
446 topLayout->addWidget(mEnableGroupScheduling->checkBox(),8,0); 449 topLayout->addWidget(mEnableGroupScheduling->checkBox(),8,0);
447 connect(mEnableGroupScheduling->checkBox(),SIGNAL(clicked()), 450 connect(mEnableGroupScheduling->checkBox(),SIGNAL(clicked()),
448 SLOT(warningGroupScheduling())); 451 SLOT(warningGroupScheduling()));
449 452
450 mEnableProjectView = 453 mEnableProjectView =
451 addWidBool(i18n("Enable project view"), 454 addWidBool(i18n("Enable project view"),
452 &(KOPrefs::instance()->mEnableProjectView),topFrame); 455 &(KOPrefs::instance()->mEnableProjectView),topFrame);
453 topLayout->addWidget(mEnableProjectView->checkBox(),9,0); 456 topLayout->addWidget(mEnableProjectView->checkBox(),9,0);
454 connect(mEnableProjectView->checkBox(),SIGNAL(clicked()), 457 connect(mEnableProjectView->checkBox(),SIGNAL(clicked()),
455 SLOT(warningProjectView())); 458 SLOT(warningProjectView()));
456 459
457 // Can't be disabled anymore 460 // Can't be disabled anymore
458 mEnableGroupScheduling->checkBox()->hide(); 461 mEnableGroupScheduling->checkBox()->hide();
459 462
460 // Disable setting, because this feature now becomes stable 463 // Disable setting, because this feature now becomes stable
461 mEnableProjectView->checkBox()->hide(); 464 mEnableProjectView->checkBox()->hide();
462 465
463 KPrefsDialogWidRadios *defaultFormatGroup = 466 KPrefsDialogWidRadios *defaultFormatGroup =
464 addWidRadios(i18n("Default Calendar Format"), 467 addWidRadios(i18n("Default Calendar Format"),
465 &(KOPrefs::instance()->mDefaultFormat),topFrame); 468 &(KOPrefs::instance()->mDefaultFormat),topFrame);
466 defaultFormatGroup->addRadio(i18n("vCalendar")); 469 defaultFormatGroup->addRadio(i18n("vCalendar"));
467 defaultFormatGroup->addRadio(i18n("iCalendar")); 470 defaultFormatGroup->addRadio(i18n("iCalendar"));
468 471
469 topLayout->addMultiCellWidget(defaultFormatGroup->groupBox(),10,10,0,1); 472 topLayout->addMultiCellWidget(defaultFormatGroup->groupBox(),10,10,0,1);
470 473
471 // Default format unconditionally is iCalendar 474 // Default format unconditionally is iCalendar
472 defaultFormatGroup->groupBox()->hide(); 475 defaultFormatGroup->groupBox()->hide();
473 476
474 KPrefsDialogWidRadios *mailClientGroup = 477 KPrefsDialogWidRadios *mailClientGroup =
475 addWidRadios(i18n("Mail Client"),&(KOPrefs::instance()->mMailClient), 478 addWidRadios(i18n("Mail Client"),&(KOPrefs::instance()->mMailClient),
476 topFrame); 479 topFrame);
477 mailClientGroup->addRadio(i18n("KMail")); 480 mailClientGroup->addRadio(i18n("KMail"));
478 mailClientGroup->addRadio(i18n("Sendmail")); 481 mailClientGroup->addRadio(i18n("Sendmail"));
479 topLayout->addMultiCellWidget(mailClientGroup->groupBox(),11,11,0,1); 482 topLayout->addMultiCellWidget(mailClientGroup->groupBox(),11,11,0,1);
480 483
481 KPrefsDialogWidBool *htmlsave = 484 KPrefsDialogWidBool *htmlsave =
482 addWidBool(i18n("Export to HTML with every save"),&(KOPrefs::instance()->mHtmlWithSave), 485 addWidBool(i18n("Export to HTML with every save"),&(KOPrefs::instance()->mHtmlWithSave),
483 topFrame); 486 topFrame);
484 topLayout->addMultiCellWidget(htmlsave->checkBox(),12,12,0,1); 487 topLayout->addMultiCellWidget(htmlsave->checkBox(),12,12,0,1);
485 488
486 KPrefsDialogWidRadios *destinationGroup = 489 KPrefsDialogWidRadios *destinationGroup =
487 addWidRadios(i18n("New Events/Todos should"),&(KOPrefs::instance()->mDestination), 490 addWidRadios(i18n("New Events/Todos should"),&(KOPrefs::instance()->mDestination),
488 topFrame); 491 topFrame);
489 destinationGroup->addRadio(i18n("be added to the standard resource")); 492 destinationGroup->addRadio(i18n("be added to the standard resource"));
490 destinationGroup->addRadio(i18n("be asked which resource to use")); 493 destinationGroup->addRadio(i18n("be asked which resource to use"));
491 topLayout->addMultiCellWidget(destinationGroup->groupBox(),13,13,0,1); 494 topLayout->addMultiCellWidget(destinationGroup->groupBox(),13,13,0,1);
492 495
493 topLayout->setRowStretch(14,1); 496 topLayout->setRowStretch(14,1);
494 */ 497 */
495} 498}
496 499
497 500
498void KOPrefsDialog::setupTimeTab() 501void KOPrefsDialog::setupTimeTab()
499{ 502{
500 QFrame *topFrame = addPage(i18n("Time"),0,0); 503 QFrame *topFrame = addPage(i18n("Time"),0,0);
501 // DesktopIcon("clock",KIcon::SizeMedium)); 504 // DesktopIcon("clock",KIcon::SizeMedium));
502 505
503 QGridLayout *topLayout = new QGridLayout(topFrame,4,2); 506 QGridLayout *topLayout = new QGridLayout(topFrame,4,2);
504 topLayout->setSpacing(spacingHint()); 507 topLayout->setSpacing(spacingHint());
505 topLayout->setMargin(marginHint()); 508 topLayout->setMargin(marginHint());
506 509
507 QHBox *dummy = new QHBox(topFrame); 510 QHBox *dummy = new QHBox(topFrame);
508 KPrefsDialogWidTime *dayBegins = 511 KPrefsDialogWidTime *dayBegins =
509 addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), 512 addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins),
510 dummy); 513 dummy);
511 //topLayout->addWidget(dayBegins->label(),2,0); 514 //topLayout->addWidget(dayBegins->label(),2,0);
512 515
513 //topLayout->addWidget(dayBegins->spinBox(),2,1); 516 //topLayout->addWidget(dayBegins->spinBox(),2,1);
514 topLayout->addMultiCellWidget(dummy,0,0,0,1); 517 topLayout->addMultiCellWidget(dummy,0,0,0,1);
515 518
516 topLayout->addWidget(new QLabel(i18n("Default appointment time:"), 519 topLayout->addWidget(new QLabel(i18n("Default appointment time:"),
517 topFrame),1,0); 520 topFrame),1,0);
518 mStartTimeSpin = new QSpinBox(0,23,1,topFrame); 521 mStartTimeSpin = new QSpinBox(0,23,1,topFrame);
519 mStartTimeSpin->setSuffix(":00"); 522 mStartTimeSpin->setSuffix(":00");
520 topLayout->addWidget(mStartTimeSpin,1,1); 523 topLayout->addWidget(mStartTimeSpin,1,1);
521 524
522 topLayout->addWidget(new QLabel(i18n("Def. duration of new app.:"), 525 topLayout->addWidget(new QLabel(i18n("Def. duration of new app.:"),
523 topFrame),2,0); 526 topFrame),2,0);
524 mDefaultDurationSpin = new QSpinBox(0,23,1,topFrame); 527 mDefaultDurationSpin = new QSpinBox(0,23,1,topFrame);
525 mDefaultDurationSpin->setSuffix(":00"); 528 mDefaultDurationSpin->setSuffix(":00");
526 topLayout->addWidget(mDefaultDurationSpin,2,1); 529 topLayout->addWidget(mDefaultDurationSpin,2,1);
527 530
528 QStringList alarmList; 531 QStringList alarmList;
529 alarmList << i18n("1 minute") << i18n("5 minutes") << i18n("10 minutes") 532 alarmList << i18n("1 minute") << i18n("5 minutes") << i18n("10 minutes")
530 << i18n("15 minutes") << i18n("30 minutes")<< i18n("1 hour")<< i18n("3 hours") << i18n("24 hours") ; 533 << i18n("15 minutes") << i18n("30 minutes")<< i18n("1 hour")<< i18n("3 hours") << i18n("24 hours") ;
531 topLayout->addWidget(new QLabel(i18n("Default alarm time:"),topFrame), 534 topLayout->addWidget(new QLabel(i18n("Default alarm time:"),topFrame),
532 3,0); 535 3,0);
533 mAlarmTimeCombo = new QComboBox(topFrame); 536 mAlarmTimeCombo = new QComboBox(topFrame);
534 mAlarmTimeCombo->insertStringList(alarmList); 537 mAlarmTimeCombo->insertStringList(alarmList);
535 topLayout->addWidget(mAlarmTimeCombo,3,1); 538 topLayout->addWidget(mAlarmTimeCombo,3,1);
536 539
537 540
538 QGroupBox *workingHoursGroup = new QGroupBox(1,Horizontal, 541 QGroupBox *workingHoursGroup = new QGroupBox(1,Horizontal,
539 i18n("Working Hours"), 542 i18n("Working Hours"),
540 topFrame); 543 topFrame);
541 topLayout->addMultiCellWidget(workingHoursGroup,4,4,0,1); 544 topLayout->addMultiCellWidget(workingHoursGroup,4,4,0,1);
542 workingHoursGroup->layout()->setSpacing( 0 ); 545 workingHoursGroup->layout()->setSpacing( 0 );
543 workingHoursGroup->layout()->setMargin( 4 ); 546 workingHoursGroup->layout()->setMargin( 4 );
544 QHBox *workStartBox = new QHBox(workingHoursGroup); 547 QHBox *workStartBox = new QHBox(workingHoursGroup);
545 // workStartBox->setMargin( 0 ); 548 // workStartBox->setMargin( 0 );
546 addWidTime(i18n("Daily starting hour:"), 549 addWidTime(i18n("Daily starting hour:"),
547 &(KOPrefs::instance()->mWorkingHoursStart),workStartBox); 550 &(KOPrefs::instance()->mWorkingHoursStart),workStartBox);
548 551
549 QHBox *workEndBox = new QHBox(workingHoursGroup); 552 QHBox *workEndBox = new QHBox(workingHoursGroup);
550 //workEndBox->setMargin( 0 ); 553 //workEndBox->setMargin( 0 );
551 addWidTime(i18n("Daily ending hour:"), 554 addWidTime(i18n("Daily ending hour:"),
552 &(KOPrefs::instance()->mWorkingHoursEnd),workEndBox); 555 &(KOPrefs::instance()->mWorkingHoursEnd),workEndBox);
553 QVBox *excludeBox = new QVBox(workingHoursGroup); 556 QVBox *excludeBox = new QVBox(workingHoursGroup);
554 //excludeBox->setMargin( 0 ); 557 //excludeBox->setMargin( 0 );
555 addWidBool(i18n("Exclude holidays"), 558 addWidBool(i18n("Exclude holidays"),
556 &(KOPrefs::instance()->mExcludeHolidays),excludeBox); 559 &(KOPrefs::instance()->mExcludeHolidays),excludeBox);
557 560
558 addWidBool(i18n("Exclude Saturdays"), 561 addWidBool(i18n("Exclude Saturdays"),
559 &(KOPrefs::instance()->mExcludeSaturdays),excludeBox); 562 &(KOPrefs::instance()->mExcludeSaturdays),excludeBox);
560 563
561// KPrefsDialogWidBool *marcusBainsShowSeconds = addWidBool(i18n("Show seconds on Marcus Bains line"), 564// KPrefsDialogWidBool *marcusBainsShowSeconds = addWidBool(i18n("Show seconds on Marcus Bains line"),
562 // &(KOPrefs::instance()->mMarcusBainsShowSeconds), 565 // &(KOPrefs::instance()->mMarcusBainsShowSeconds),
563 // topFrame); 566 // topFrame);
564// topLayout->addWidget(marcusBainsShowSeconds->checkBox(),5,0); 567// topLayout->addWidget(marcusBainsShowSeconds->checkBox(),5,0);
565 568
566 // topLayout->setRowStretch(6,1); 569 // topLayout->setRowStretch(6,1);
567} 570}
568 571
569 572
570void KOPrefsDialog::setupViewsTab() 573void KOPrefsDialog::setupViewsTab()
571{ 574{
572 575
573 QFrame *topFrame = addPage(i18n("Views"),0,0); 576 QFrame *topFrame = addPage(i18n("Views"),0,0);
574 // DesktopIcon("viewmag",KIcon::SizeMedium)); 577 // DesktopIcon("viewmag",KIcon::SizeMedium));
575 578
576 QGridLayout *topLayout = new QGridLayout(topFrame,6,1); 579 QGridLayout *topLayout = new QGridLayout(topFrame,6,1);
577 topLayout->setSpacing(spacingHint()); 580 topLayout->setSpacing(spacingHint());
578 topLayout->setMargin(marginHint()); 581 topLayout->setMargin(marginHint());
579 582
580// QBoxLayout *dayBeginsLayout = new QHBoxLayout; 583// QBoxLayout *dayBeginsLayout = new QHBoxLayout;
581// topLayout->addLayout(dayBeginsLayout,0,0); 584// topLayout->addLayout(dayBeginsLayout,0,0);
582 585
583// KPrefsDialogWidTime *dayBegins = 586// KPrefsDialogWidTime *dayBegins =
584// addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), 587// addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins),
585// topFrame); 588// topFrame);
586// dayBeginsLayout->addWidget(dayBegins->label()); 589// dayBeginsLayout->addWidget(dayBegins->label());
587// dayBeginsLayout->addStretch(1); 590// dayBeginsLayout->addStretch(1);
588// dayBeginsLayout->addWidget(dayBegins->spinBox()); 591// dayBeginsLayout->addWidget(dayBegins->spinBox());
589 592
590// QBoxLayout *nextDaysLayout = new QHBoxLayout; 593// QBoxLayout *nextDaysLayout = new QHBoxLayout;
591// topLayout->addLayout(nextDaysLayout,1,0); 594// topLayout->addLayout(nextDaysLayout,1,0);
592// nextDaysLayout->addWidget(new QLabel(i18n("Days to show in Next-X-Days view:"),topFrame)); 595// nextDaysLayout->addWidget(new QLabel(i18n("Days to show in Next-X-Days view:"),topFrame));
593// mNextXDaysSpin = new QSpinBox(2,14,1,topFrame); 596// mNextXDaysSpin = new QSpinBox(2,14,1,topFrame);
594// nextDaysLayout->addStretch(1); 597// nextDaysLayout->addStretch(1);
595// nextDaysLayout->addWidget(mNextXDaysSpin); 598// nextDaysLayout->addWidget(mNextXDaysSpin);
596 599
597 600
598 int ii = 0; 601 int ii = 0;
599 KPrefsDialogWidBool *dummy = 602 KPrefsDialogWidBool *dummy =
600 addWidBool(i18n("Edit item on doubleclick (if not, show)"), 603 addWidBool(i18n("Edit item on doubleclick (if not, show)"),
601 &(KOPrefs::instance()->mEditOnDoubleClick),topFrame); 604 &(KOPrefs::instance()->mEditOnDoubleClick),topFrame);
602 topLayout->addWidget(dummy->checkBox(),ii++,0); 605 topLayout->addWidget(dummy->checkBox(),ii++,0);
606
607 dummy =
608 addWidBool(i18n("Show time in agenda items"),
609 &(KOPrefs::instance()->mShowTimeInAgenda),topFrame);
610 topLayout->addWidget(dummy->checkBox(),ii++,0);
603 611
604 dummy = 612 dummy =
605 addWidBool(i18n("Highlight current day in agenda"), 613 addWidBool(i18n("Highlight current day in agenda"),
606 &(KOPrefs::instance()->mHighlightCurrentDay),topFrame); 614 &(KOPrefs::instance()->mHighlightCurrentDay),topFrame);
607 topLayout->addWidget(dummy->checkBox(),ii++,0); 615 topLayout->addWidget(dummy->checkBox(),ii++,0);
608 616
609 dummy = 617 dummy =
610 addWidBool(i18n("Use light color for highlight current day"), 618 addWidBool(i18n("Use light color for highlight current day"),
611 &(KOPrefs::instance()->mUseHighlightLightColor),topFrame); 619 &(KOPrefs::instance()->mUseHighlightLightColor),topFrame);
612 topLayout->addWidget(dummy->checkBox(),ii++,0); 620 topLayout->addWidget(dummy->checkBox(),ii++,0);
613 621
614 KPrefsDialogWidBool *dailyRecur = 622 KPrefsDialogWidBool *dailyRecur =
615 addWidBool(i18n("Show events that recur daily in date nav."), 623 addWidBool(i18n("Show events that recur daily in date nav."),
616 &(KOPrefs::instance()->mDailyRecur),topFrame); 624 &(KOPrefs::instance()->mDailyRecur),topFrame);
617 topLayout->addWidget(dailyRecur->checkBox(),ii++,0); 625 topLayout->addWidget(dailyRecur->checkBox(),ii++,0);
618 626
619 KPrefsDialogWidBool *weeklyRecur = 627 KPrefsDialogWidBool *weeklyRecur =
620 addWidBool(i18n("Show ev. that recur weekly in date nav."), 628 addWidBool(i18n("Show ev. that recur weekly in date nav."),
621 &(KOPrefs::instance()->mWeeklyRecur),topFrame); 629 &(KOPrefs::instance()->mWeeklyRecur),topFrame);
622 topLayout->addWidget(weeklyRecur->checkBox(),ii++,0); 630 topLayout->addWidget(weeklyRecur->checkBox(),ii++,0);
623 if ( QApplication::desktop()->width() > 640 ) { 631 if ( QApplication::desktop()->width() > 640 ) {
624 632
625 KPrefsDialogWidBool *enableToolTips = 633 KPrefsDialogWidBool *enableToolTips =
626 addWidBool(i18n("Enable tooltips displaying summary of ev."), 634 addWidBool(i18n("Enable tooltips displaying summary of ev."),
627 &(KOPrefs::instance()->mEnableToolTips),topFrame); 635 &(KOPrefs::instance()->mEnableToolTips),topFrame);
628 topLayout->addWidget(enableToolTips->checkBox(),ii++,0); 636 topLayout->addWidget(enableToolTips->checkBox(),ii++,0);
629 637
630 } 638 }
631 639
632 KPrefsDialogWidBool *marcusBainsEnabled = 640 KPrefsDialogWidBool *marcusBainsEnabled =
633 addWidBool(i18n("Show Marcus Bains line"), 641 addWidBool(i18n("Show Marcus Bains line"),
634 &(KOPrefs::instance()->mMarcusBainsEnabled),topFrame); 642 &(KOPrefs::instance()->mMarcusBainsEnabled),topFrame);
635 topLayout->addWidget(marcusBainsEnabled->checkBox(),ii++,0); 643 topLayout->addWidget(marcusBainsEnabled->checkBox(),ii++,0);
636 644
637 645
638 // topLayout->addWidget(hourSizeGroup,ii++,0); 646 // topLayout->addWidget(hourSizeGroup,ii++,0);
639 // topLayout->addMultiCellWidget(hourSizeGroup,ii,ii,0,0); 647 // topLayout->addMultiCellWidget(hourSizeGroup,ii,ii,0,0);
640 //topLayout->setRowStretch(11,1); 648 //topLayout->setRowStretch(11,1);
641 649
642 650
643 651
644 652
645 653
646 654
647 topFrame = addPage(i18n("ViewChange"),0,0); 655 topFrame = addPage(i18n("ViewChange"),0,0);
648 // DesktopIcon("viewmag",KIcon::SizeMedium)); 656 // DesktopIcon("viewmag",KIcon::SizeMedium));
649 657
650 topLayout = new QGridLayout(topFrame,6,1); 658 topLayout = new QGridLayout(topFrame,6,1);
651 topLayout->setSpacing(spacingHint()); 659 topLayout->setSpacing(spacingHint());
652 topLayout->setMargin(marginHint()); 660 topLayout->setMargin(marginHint());
653 ii = 0; 661 ii = 0;
654 662
655 663
656 dummy = 664 dummy =
657 addWidBool(i18n("Hold fullscreen on view change"), 665 addWidBool(i18n("Hold fullscreen on view change"),
658 &(KOPrefs::instance()->mViewChangeHoldFullscreen),topFrame); 666 &(KOPrefs::instance()->mViewChangeHoldFullscreen),topFrame);
659 topLayout->addWidget(dummy->checkBox(),ii++,0); 667 topLayout->addWidget(dummy->checkBox(),ii++,0);
660 668
661 dummy = 669 dummy =
662 addWidBool(i18n("Hold non-fullscreen on view change"), 670 addWidBool(i18n("Hold non-fullscreen on view change"),
663 &(KOPrefs::instance()->mViewChangeHoldNonFullscreen),topFrame); 671 &(KOPrefs::instance()->mViewChangeHoldNonFullscreen),topFrame);
664 topLayout->addWidget(dummy->checkBox(),ii++,0); 672 topLayout->addWidget(dummy->checkBox(),ii++,0);
665 673
666 674
667 KPrefsDialogWidBool *fullViewTodo = 675 KPrefsDialogWidBool *fullViewTodo =
668 addWidBool(i18n("Event list view uses full window"), 676 addWidBool(i18n("Event list view uses full window"),
669 &(KOPrefs::instance()->mFullViewTodo),topFrame); 677 &(KOPrefs::instance()->mFullViewTodo),topFrame);
670 topLayout->addWidget(fullViewTodo->checkBox(),ii++,0); 678 topLayout->addWidget(fullViewTodo->checkBox(),ii++,0);
671 679
672 KPrefsDialogWidBool *fullViewMonth = 680 KPrefsDialogWidBool *fullViewMonth =
673 addWidBool(i18n("Next days view uses full window"), 681 addWidBool(i18n("Next days view uses full window"),
674 &(KOPrefs::instance()->mFullViewMonth),topFrame); 682 &(KOPrefs::instance()->mFullViewMonth),topFrame);
675 topLayout->addWidget(fullViewMonth->checkBox(),ii++,0); 683 topLayout->addWidget(fullViewMonth->checkBox(),ii++,0);
676 684
677 dummy = 685 dummy =
678 addWidBool(i18n("Set agenda to DayBeginsAt on change"), 686 addWidBool(i18n("Set agenda to DayBeginsAt on change"),
679 &(KOPrefs::instance()->mSetTimeToDayStartAt),topFrame); 687 &(KOPrefs::instance()->mSetTimeToDayStartAt),topFrame);
680 topLayout->addWidget(dummy->checkBox(),ii++,0); 688 topLayout->addWidget(dummy->checkBox(),ii++,0);
681 689
682 dummy = 690 dummy =
683 addWidBool(i18n("Set agenda to current time on change"), 691 addWidBool(i18n("Set agenda to current time on change"),
684 &(KOPrefs::instance()->mCenterOnCurrentTime),topFrame); 692 &(KOPrefs::instance()->mCenterOnCurrentTime),topFrame);
685 topLayout->addWidget(dummy->checkBox(),ii++,0); 693 topLayout->addWidget(dummy->checkBox(),ii++,0);
686 694
687 dummy = 695 dummy =
688 addWidBool(i18n("Listview uses monthly timespan"), 696 addWidBool(i18n("Listview uses monthly timespan"),
689 &(KOPrefs::instance()->mListViewMonthTimespan),topFrame); 697 &(KOPrefs::instance()->mListViewMonthTimespan),topFrame);
690 topLayout->addWidget(dummy->checkBox(),ii++,0); 698 topLayout->addWidget(dummy->checkBox(),ii++,0);
691 dummy = 699 dummy =
692 addWidBool(i18n("Highlight selection in Time Edit"), 700 addWidBool(i18n("Highlight selection in Time Edit"),
693 &(KOPrefs::instance()->mHightlightDateTimeEdit),topFrame); 701 &(KOPrefs::instance()->mHightlightDateTimeEdit),topFrame);
694 topLayout->addWidget( dummy->checkBox(), ii++,0); 702 topLayout->addWidget( dummy->checkBox(), ii++,0);
695 703
696 704
697 705
698 706
699 707
700 topFrame = addPage(i18n("Month View"),0,0); 708 topFrame = addPage(i18n("Month View"),0,0);
701 // DesktopIcon("viewmag",KIcon::SizeMedium)); 709 // DesktopIcon("viewmag",KIcon::SizeMedium));
702 710
703 topLayout = new QGridLayout(topFrame,5,1); 711 topLayout = new QGridLayout(topFrame,5,1);
704 topLayout->setSpacing(spacingHint()); 712 topLayout->setSpacing(spacingHint());
705 topLayout->setMargin(marginHint()); 713 topLayout->setMargin(marginHint());
706 ii = 0; 714 ii = 0;
707 QLabel *lab; 715 QLabel *lab;
708 QHBox *habo = new QHBox( topFrame ); 716 QHBox *habo = new QHBox( topFrame );
709 if ( QApplication::desktop()->width() < 320 ) { 717 if ( QApplication::desktop()->width() < 320 ) {
710 lab = new QLabel ( i18n("Show events that recur "), topFrame ); 718 lab = new QLabel ( i18n("Show events that recur "), topFrame );
711 topLayout->addMultiCellWidget(lab,ii, ii,0,1); 719 topLayout->addMultiCellWidget(lab,ii, ii,0,1);
712 ii++; 720 ii++;
713 721
714 } else { 722 } else {
715 new QLabel ( i18n("Show events that recur "), habo ); 723 new QLabel ( i18n("Show events that recur "), habo );
716 724
717 } 725 }
718 dailyRecur = 726 dailyRecur =
719 addWidBool(i18n("daily"), 727 addWidBool(i18n("daily"),
720 &(KOPrefs::instance()->mMonthDailyRecur),habo); 728 &(KOPrefs::instance()->mMonthDailyRecur),habo);
721 // topLayout->addWidget(dailyRecur->checkBox(),ii++,0); 729 // topLayout->addWidget(dailyRecur->checkBox(),ii++,0);
722 730
723 weeklyRecur = 731 weeklyRecur =
724 addWidBool(i18n("weekly"), 732 addWidBool(i18n("weekly"),
725 &(KOPrefs::instance()->mMonthWeeklyRecur),habo); 733 &(KOPrefs::instance()->mMonthWeeklyRecur),habo);
726 topLayout->addMultiCellWidget(habo,ii, ii,0,1); 734 topLayout->addMultiCellWidget(habo,ii, ii,0,1);
727 ii++; 735 ii++;
728 736
729 737
730 habo = new QHBox( topFrame ); 738 habo = new QHBox( topFrame );
731 if ( QApplication::desktop()->width() < 320 ) { 739 if ( QApplication::desktop()->width() < 320 ) {
732 lab = new QLabel (i18n("Show in every cell ") , topFrame ); 740 lab = new QLabel (i18n("Show in every cell ") , topFrame );
733 topLayout->addMultiCellWidget(lab,ii, ii,0,1); 741 topLayout->addMultiCellWidget(lab,ii, ii,0,1);
734 ii++; 742 ii++;
735 743
736 } else { 744 } else {
737 new QLabel ( i18n("Show in every cell "), habo ); 745 new QLabel ( i18n("Show in every cell "), habo );
738 } 746 }
739 weeklyRecur = 747 weeklyRecur =
740 addWidBool(i18n("short month"), 748 addWidBool(i18n("short month"),
741 &(KOPrefs::instance()->mMonthShowShort),habo); 749 &(KOPrefs::instance()->mMonthShowShort),habo);
742 weeklyRecur = 750 weeklyRecur =
743 addWidBool(i18n("icons"), 751 addWidBool(i18n("icons"),
744 &(KOPrefs::instance()->mMonthShowIcons),habo); 752 &(KOPrefs::instance()->mMonthShowIcons),habo);
745 753
746 topLayout->addMultiCellWidget(habo,ii, ii,0,1); 754 topLayout->addMultiCellWidget(habo,ii, ii,0,1);
747 ii++; 755 ii++;
748#ifdef DESKTOP_VERSION 756#ifdef DESKTOP_VERSION
749 KPrefsDialogWidBool *enableMonthScroll = 757 KPrefsDialogWidBool *enableMonthScroll =
750 addWidBool(i18n("Enable scrollbars in month view cells"), 758 addWidBool(i18n("Enable scrollbars in month view cells"),
751 &(KOPrefs::instance()->mEnableMonthScroll),topFrame); 759 &(KOPrefs::instance()->mEnableMonthScroll),topFrame);
752 topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0); 760 topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0);
753#endif 761#endif
754 762
755 dummy = 763 dummy =
756 addWidBool(i18n("Show Sat/Sun together"), 764 addWidBool(i18n("Show Sat/Sun together"),
757 &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame); 765 &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame);
758 topLayout->addWidget(dummy->checkBox(),ii++,0); 766 topLayout->addWidget(dummy->checkBox(),ii++,0);
759 767
760 KPrefsDialogWidBool *coloredCategoriesInMonthView = 768 KPrefsDialogWidBool *coloredCategoriesInMonthView =
761 addWidBool(i18n("Month view uses category colors"), 769 addWidBool(i18n("Month view uses category colors"),
762 &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame); 770 &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame);
763 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); 771 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0);
764 772
765 dummy = 773 dummy =
766 addWidBool(i18n("Categorie colors are applied to text"), 774 addWidBool(i18n("Categorie colors are applied to text"),
767 &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame); 775 &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame);
768 topLayout->addWidget(dummy->checkBox(),ii++,0); 776 topLayout->addWidget(dummy->checkBox(),ii++,0);
769 coloredCategoriesInMonthView = 777 coloredCategoriesInMonthView =
770 addWidBool(i18n("Month view uses day colors"), 778 addWidBool(i18n("Month view uses day colors"),
771 &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame); 779 &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame);
772 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); 780 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0);
773 781
774 KPrefsDialogWidColor *holidayColor = 782 KPrefsDialogWidColor *holidayColor =
775 addWidColor(i18n("Day color odd months"), 783 addWidColor(i18n("Day color odd months"),
776 &(KOPrefs::instance()->mMonthViewOddColor),topFrame); 784 &(KOPrefs::instance()->mMonthViewOddColor),topFrame);
777 topLayout->addWidget(holidayColor->label(),ii,0); 785 topLayout->addWidget(holidayColor->label(),ii,0);
778 topLayout->addWidget(holidayColor->button(),ii++,1); 786 topLayout->addWidget(holidayColor->button(),ii++,1);
779 787
780 holidayColor = 788 holidayColor =
781 addWidColor(i18n("Day color even months"), 789 addWidColor(i18n("Day color even months"),
782 &(KOPrefs::instance()->mMonthViewEvenColor),topFrame); 790 &(KOPrefs::instance()->mMonthViewEvenColor),topFrame);
783 topLayout->addWidget(holidayColor->label(),ii,0); 791 topLayout->addWidget(holidayColor->label(),ii,0);
784 topLayout->addWidget(holidayColor->button(),ii++,1); 792 topLayout->addWidget(holidayColor->button(),ii++,1);
785 793
786 794
787 holidayColor = 795 holidayColor =
788 addWidColor(i18n("Color for Sundays + category \"Holiday\""), 796 addWidColor(i18n("Color for Sundays + category \"Holiday\""),
789 &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame); 797 &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame);
790 topLayout->addWidget(holidayColor->label(),ii,0); 798 topLayout->addWidget(holidayColor->label(),ii,0);
791 topLayout->addWidget(holidayColor->button(),ii++,1); 799 topLayout->addWidget(holidayColor->button(),ii++,1);
792 // *********************** What'sNext View 800 // *********************** What'sNext View
793 topFrame = addPage(i18n("What's Next View"),0,0); 801 topFrame = addPage(i18n("What's Next View"),0,0);
794 // DesktopIcon("viewmag",KIcon::SizeMedium)); 802 // DesktopIcon("viewmag",KIcon::SizeMedium));
795 803
796 topLayout = new QGridLayout(topFrame,4,1); 804 topLayout = new QGridLayout(topFrame,4,1);
797 topLayout->setSpacing(spacingHint()); 805 topLayout->setSpacing(spacingHint());
798 topLayout->setMargin(marginHint()); 806 topLayout->setMargin(marginHint());
799 ii = 0; 807 ii = 0;
800 KPrefsDialogWidBool *passwdk = 808 KPrefsDialogWidBool *passwdk =
801 809
802 addWidBool(i18n("Show events, that are done in \nWhat's Next view"), 810 addWidBool(i18n("Show events, that are done in \nWhat's Next view"),
803 &(KOPrefs::instance()->mWNViewShowsPast),topFrame); 811 &(KOPrefs::instance()->mWNViewShowsPast),topFrame);
804 topLayout->addWidget(passwdk->checkBox(), ii++,0); 812 topLayout->addWidget(passwdk->checkBox(), ii++,0);
805 passwdk = 813 passwdk =
806 addWidBool(i18n("Show parent To-Do's in What's Next view"), 814 addWidBool(i18n("Show parent To-Do's in What's Next view"),
807 &(KOPrefs::instance()->mWNViewShowsParents),topFrame); 815 &(KOPrefs::instance()->mWNViewShowsParents),topFrame);
808 topLayout->addWidget(passwdk->checkBox(), ii++,0); 816 topLayout->addWidget(passwdk->checkBox(), ii++,0);
809 817
810 passwdk = 818 passwdk =
811 addWidBool(i18n("Show location in What's Next view"), 819 addWidBool(i18n("Show location in What's Next view"),
812 &(KOPrefs::instance()->mWNViewShowLocation),topFrame); 820 &(KOPrefs::instance()->mWNViewShowLocation),topFrame);
813 topLayout->addWidget(passwdk->checkBox(), ii++,0); 821 topLayout->addWidget(passwdk->checkBox(), ii++,0);
814 822
815 passwdk = 823 passwdk =
816 addWidBool(i18n("Show Sync Events in \nWhat's Next/Agenda view"), 824 addWidBool(i18n("Show Sync Events in \nWhat's Next/Agenda view"),
817 &(KOPrefs::instance()->mShowSyncEvents),topFrame); 825 &(KOPrefs::instance()->mShowSyncEvents),topFrame);
818 topLayout->addWidget(passwdk->checkBox(), ii++,0); 826 topLayout->addWidget(passwdk->checkBox(), ii++,0);
819 passwdk = 827 passwdk =
820 addWidBool(i18n("Use short date in \nWhat's Next/Event view"), 828 addWidBool(i18n("Use short date in \nWhat's Next/Event view"),
821 &(KOPrefs::instance()->mShortDateInViewer),topFrame); 829 &(KOPrefs::instance()->mShortDateInViewer),topFrame);
822 topLayout->addWidget(passwdk->checkBox(), ii++,0); 830 topLayout->addWidget(passwdk->checkBox(), ii++,0);
823 831
824 832
825 833
826 834
827 // *********************** Todo View 835 // *********************** Todo View
828 836
829 topFrame = addPage(i18n("Todo View"),0,0); 837 topFrame = addPage(i18n("Todo View"),0,0);
830 // DesktopIcon("viewmag",KIcon::SizeMedium)); 838 // DesktopIcon("viewmag",KIcon::SizeMedium));
831 839
832 topLayout = new QGridLayout(topFrame,4,1); 840 topLayout = new QGridLayout(topFrame,4,1);
833 topLayout->setSpacing(spacingHint()); 841 topLayout->setSpacing(spacingHint());
834 topLayout->setMargin(marginHint()); 842 topLayout->setMargin(marginHint());
835 ii = 0; 843 ii = 0;
844dummy =
845 addWidBool(i18n("Hide not running Todos in To-do view"),
846 &(KOPrefs::instance()->mHideNonStartedTodos),topFrame);
847 topLayout->addWidget(dummy->checkBox(),ii++,0);
848
836 849
837 KPrefsDialogWidBool *showCompletedTodo = 850 KPrefsDialogWidBool *showCompletedTodo =
838 addWidBool(i18n("To-do view shows completed Todos"), 851 addWidBool(i18n("To-do view shows completed Todos"),
839 &(KOPrefs::instance()->mShowCompletedTodo),topFrame); 852 &(KOPrefs::instance()->mShowCompletedTodo),topFrame);
840 topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0); 853 topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0);
841 dummy = 854 dummy =
842 addWidBool(i18n("To-do view shows complete as 'xx %'"), 855 addWidBool(i18n("To-do view shows complete as 'xx %'"),
843 &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame); 856 &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame);
844 topLayout->addWidget(dummy->checkBox(),ii++,0); 857 topLayout->addWidget(dummy->checkBox(),ii++,0);
845 858
846 dummy = 859 dummy =
847 addWidBool(i18n("Small To-do view uses smaller font"), 860 addWidBool(i18n("Small To-do view uses smaller font"),
848 &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame); 861 &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame);
849 topLayout->addWidget(dummy->checkBox(),ii++,0); 862 topLayout->addWidget(dummy->checkBox(),ii++,0);
850 863
851 864
852 865
853 dummy = 866 dummy =
854 addWidBool(i18n("Todo view uses category colors"), 867 addWidBool(i18n("Todo view uses category colors"),
855 &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame); 868 &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame);
856 topLayout->addWidget(dummy->checkBox(),ii++,0); 869 topLayout->addWidget(dummy->checkBox(),ii++,0);
857 870
858 871
859 QWidget* wid = new QWidget( topFrame ); 872 QWidget* wid = new QWidget( topFrame );
860 // Todo due today color 873 // Todo due today color
861 KPrefsDialogWidColor *todoDueTodayColor = 874 KPrefsDialogWidColor *todoDueTodayColor =
862 addWidColor(i18n("Todo due today color:"), 875 addWidColor(i18n("Todo due today color:"),
863 &(KOPrefs::instance()->mTodoDueTodayColor),wid); 876 &(KOPrefs::instance()->mTodoDueTodayColor),wid);
864 QHBoxLayout *widLayout = new QHBoxLayout(wid); 877 QHBoxLayout *widLayout = new QHBoxLayout(wid);
865 widLayout->addWidget( todoDueTodayColor->label() ); 878 widLayout->addWidget( todoDueTodayColor->label() );
866 widLayout->addWidget( todoDueTodayColor->button() ); 879 widLayout->addWidget( todoDueTodayColor->button() );
867 topLayout->addWidget(wid,ii++,0); 880 topLayout->addWidget(wid,ii++,0);
868 //topLayout->addWidget(todoDueTodayColor->button(),ii++,1); 881 //topLayout->addWidget(todoDueTodayColor->button(),ii++,1);
869 882
870 // Todo overdue color 883 // Todo overdue color
871 wid = new QWidget( topFrame ); 884 wid = new QWidget( topFrame );
872 widLayout = new QHBoxLayout(wid); 885 widLayout = new QHBoxLayout(wid);
873 KPrefsDialogWidColor *todoOverdueColor = 886 KPrefsDialogWidColor *todoOverdueColor =
874 addWidColor(i18n("Todo overdue color:"), 887 addWidColor(i18n("Todo overdue color:"),
875 &(KOPrefs::instance()->mTodoOverdueColor),wid); 888 &(KOPrefs::instance()->mTodoOverdueColor),wid);
876 widLayout->addWidget(todoOverdueColor->label()); 889 widLayout->addWidget(todoOverdueColor->label());
877 widLayout->addWidget(todoOverdueColor->button()); 890 widLayout->addWidget(todoOverdueColor->button());
878 topLayout->addWidget(wid,ii++,0); 891 topLayout->addWidget(wid,ii++,0);
879 892
880 dummy = 893 dummy =
881 addWidBool(i18n("Colors are applied to text"), 894 addWidBool(i18n("Colors are applied to text"),
882 &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame); 895 &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame);
883 topLayout->addWidget(dummy->checkBox(),ii++,0); 896 topLayout->addWidget(dummy->checkBox(),ii++,0);
884 897
885 dummy = 898 dummy =
886 addWidBool(i18n("Allday Agenda view shows todos"), 899 addWidBool(i18n("Allday Agenda view shows todos"),
887 &(KOPrefs::instance()->mShowTodoInAgenda),topFrame); 900 &(KOPrefs::instance()->mShowTodoInAgenda),topFrame);
888 topLayout->addWidget(dummy->checkBox(),ii++,0); 901 topLayout->addWidget(dummy->checkBox(),ii++,0);
889 902
890 903
891 904
892 905
893 topFrame = addPage(i18n("Alarm"),0,0); 906 topFrame = addPage(i18n("Alarm"),0,0);
894 // DesktopIcon("viewmag",KIcon::SizeMedium)); 907 // DesktopIcon("viewmag",KIcon::SizeMedium));
895 908
896 topLayout = new QGridLayout(topFrame,2,1); 909 topLayout = new QGridLayout(topFrame,2,1);
897 topLayout->setSpacing(spacingHint()); 910 topLayout->setSpacing(spacingHint());
898 topLayout->setMargin(marginHint()); 911 topLayout->setMargin(marginHint());
899 int iii = 0; 912 int iii = 0;
900 913
901 dummy = 914 dummy =
902 addWidBool(i18n("Use internal alarm notification"), 915 addWidBool(i18n("Use internal alarm notification"),
903 &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame); 916 &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame);
904 topLayout->addWidget(dummy->checkBox(),iii++,0); 917 topLayout->addWidget(dummy->checkBox(),iii++,0);
905 lab = new QLabel( i18n("Note: KO/Pi must be running to notify you about an alarm. Recommended for use on Zaurus: Disable this option and install KO/Pi alarm applet.\n"), topFrame); 918 lab = new QLabel( i18n("Note: KO/Pi must be running to notify you about an alarm. Recommended for use on Zaurus: Disable this option and install KO/Pi alarm applet.\n"), topFrame);
906 919
907 topLayout->addWidget(lab ,iii++,0); 920 topLayout->addWidget(lab ,iii++,0);
908#ifndef DESKTOP_VERSION 921#ifndef DESKTOP_VERSION
909 lab->setAlignment( AlignLeft|WordBreak|AlignTop); 922 lab->setAlignment( AlignLeft|WordBreak|AlignTop);
910#else 923#else
911 lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); 924 lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop);
912 lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); 925 lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) );
913#endif 926#endif
914 927
915 QHBox* dummyBox = new QHBox(topFrame); 928 QHBox* dummyBox = new QHBox(topFrame);
916 new QLabel(i18n("Play beeps count:"),dummyBox); 929 new QLabel(i18n("Play beeps count:"),dummyBox);
917 mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox); 930 mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox);
918 topLayout->addWidget(dummyBox,iii++,0); 931 topLayout->addWidget(dummyBox,iii++,0);
919 932
920 dummyBox = new QHBox(topFrame); 933 dummyBox = new QHBox(topFrame);
921 new QLabel(i18n("Beeps interval in sec:"),dummyBox); 934 new QLabel(i18n("Beeps interval in sec:"),dummyBox);
922 mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox); 935 mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox);
923 topLayout->addWidget(dummyBox,iii++,0); 936 topLayout->addWidget(dummyBox,iii++,0);
924 937
925 dummyBox = new QHBox(topFrame); 938 dummyBox = new QHBox(topFrame);
926 new QLabel(i18n("Default suspend time in min:"),dummyBox); 939 new QLabel(i18n("Default suspend time in min:"),dummyBox);
927 mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox); 940 mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox);
928 topLayout->addWidget(dummyBox,iii++,0); 941 topLayout->addWidget(dummyBox,iii++,0);
929 942
930 dummyBox = new QHBox(topFrame); 943 dummyBox = new QHBox(topFrame);
931 new QLabel(i18n("Auto suspend count:"),dummyBox); 944 new QLabel(i18n("Auto suspend count:"),dummyBox);
932 mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox); 945 mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox);
933 topLayout->addWidget(dummyBox,iii++,0); 946 topLayout->addWidget(dummyBox,iii++,0);
934 947
935 948
936 949
937 950
938 951
939 952
940 953
941 QHBox* hbo = new QHBox ( topFrame ); 954 QHBox* hbo = new QHBox ( topFrame );
942 mDefaultAlarmFile = new QLineEdit(hbo); 955 mDefaultAlarmFile = new QLineEdit(hbo);
943 QPushButton * loadTemplate = new QPushButton(hbo); 956 QPushButton * loadTemplate = new QPushButton(hbo);
944 QPixmap icon; 957 QPixmap icon;
945 if ( QApplication::desktop()->width() < 321 ) 958 if ( QApplication::desktop()->width() < 321 )
946 icon = SmallIcon("fileimport16"); 959 icon = SmallIcon("fileimport16");
947 else 960 else
948 icon = SmallIcon("fileimport"); 961 icon = SmallIcon("fileimport");
949 loadTemplate->setIconSet (icon ) ; 962 loadTemplate->setIconSet (icon ) ;
950 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) ); 963 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) );
951 int size = loadTemplate->sizeHint().height(); 964 int size = loadTemplate->sizeHint().height();
952 loadTemplate->setFixedSize( size, size ); 965 loadTemplate->setFixedSize( size, size );
953 //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame); 966 //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame);
954 // topLayout->addWidget(lab ,iii++,0); 967 // topLayout->addWidget(lab ,iii++,0);
955 lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame); 968 lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame);
956 topLayout->addWidget(lab ,iii++,0); 969 topLayout->addWidget(lab ,iii++,0);
957 topLayout->addWidget(hbo,iii++,0); 970 topLayout->addWidget(hbo,iii++,0);
958 // lab = new QLabel( i18n("Note: This does not mean, that for every alarm this file is replayed. This file here is associated with a newly created alarm."), topFrame); 971 // lab = new QLabel( i18n("Note: This does not mean, that for every alarm this file is replayed. This file here is associated with a newly created alarm."), topFrame);
959 972
960// topLayout->addWidget(lab ,iii++,0); 973// topLayout->addWidget(lab ,iii++,0);
961// #ifndef DESKTOP_VERSION 974// #ifndef DESKTOP_VERSION
962// lab->setAlignment( AlignLeft|WordBreak|AlignTop); 975// lab->setAlignment( AlignLeft|WordBreak|AlignTop);
963// #else 976// #else
964// lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); 977// lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop);
965// lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); 978// lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) );
966// #endif 979// #endif
967 980
968 981
969} 982}
970 983
971void KOPrefsDialog::selectSoundFile() 984void KOPrefsDialog::selectSoundFile()
972{ 985{
973 QString fileName = mDefaultAlarmFile->text(); 986 QString fileName = mDefaultAlarmFile->text();
974 fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this ); 987 fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this );
975 if ( fileName.length() > 0 ) 988 if ( fileName.length() > 0 )
976 mDefaultAlarmFile->setText( fileName ); 989 mDefaultAlarmFile->setText( fileName );
977} 990}
978void KOPrefsDialog::setupFontsTab() 991void KOPrefsDialog::setupFontsTab()
979{ 992{
980 993
981 QFrame *topFrame = addPage(i18n("Fonts"),0,0); 994 QFrame *topFrame = addPage(i18n("Fonts"),0,0);
982 // DesktopIcon("fonts",KIcon::SizeMedium)); 995 // DesktopIcon("fonts",KIcon::SizeMedium));
983 996
984 QGridLayout *topLayout = new QGridLayout(topFrame,7,3); 997 QGridLayout *topLayout = new QGridLayout(topFrame,7,3);
985 topLayout->setSpacing(1); 998 topLayout->setSpacing(1);
986 topLayout->setMargin(3); 999 topLayout->setMargin(3);
987 KPrefsDialogWidFont * tVFont; 1000 KPrefsDialogWidFont * tVFont;
988 int i = 0; 1001 int i = 0;
989 KPrefsDialogWidFont *timeLabelsFont = 1002 KPrefsDialogWidFont *timeLabelsFont =
990 addWidFont(i18n("23"),i18n("DateNavigator:(nr)"), 1003 addWidFont(i18n("23"),i18n("DateNavigator:(nr)"),
991 &(KOPrefs::instance()->mDateNavigatorFont),topFrame); 1004 &(KOPrefs::instance()->mDateNavigatorFont),topFrame);
992 topLayout->addWidget(timeLabelsFont->label(),i,0); 1005 topLayout->addWidget(timeLabelsFont->label(),i,0);
993 topLayout->addWidget(timeLabelsFont->preview(),i,1); 1006 topLayout->addWidget(timeLabelsFont->preview(),i,1);
994 topLayout->addWidget(timeLabelsFont->button(),i,2); 1007 topLayout->addWidget(timeLabelsFont->button(),i,2);
995 ++i; 1008 ++i;
996 1009
997 1010
998 timeLabelsFont = 1011 timeLabelsFont =
999 addWidFont(i18n("Mon 15"),i18n("Date Labels:"), 1012 addWidFont(i18n("Mon 15"),i18n("Date Labels:"),
1000 &(KOPrefs::instance()->mTimeLabelsFont),topFrame); 1013 &(KOPrefs::instance()->mTimeLabelsFont),topFrame);
1001 topLayout->addWidget(timeLabelsFont->label(),i,0); 1014 topLayout->addWidget(timeLabelsFont->label(),i,0);
1002 topLayout->addWidget(timeLabelsFont->preview(),i,1); 1015 topLayout->addWidget(timeLabelsFont->preview(),i,1);
1003 topLayout->addWidget(timeLabelsFont->button(),i,2); 1016 topLayout->addWidget(timeLabelsFont->button(),i,2);
1004 ++i; 1017 ++i;
1005 1018
1006 KPrefsDialogWidFont *timeBarFont = 1019 KPrefsDialogWidFont *timeBarFont =
1007 addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"), 1020 addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"),
1008 &(KOPrefs::instance()->mTimeBarFont),topFrame); 1021 &(KOPrefs::instance()->mTimeBarFont),topFrame);
1009 topLayout->addWidget(timeBarFont->label(),i,0); 1022 topLayout->addWidget(timeBarFont->label(),i,0);
1010 topLayout->addWidget(timeBarFont->preview(),i,1); 1023 topLayout->addWidget(timeBarFont->preview(),i,1);
1011 topLayout->addWidget(timeBarFont->button(),i,2); 1024 topLayout->addWidget(timeBarFont->button(),i,2);
1012 ++i; 1025 ++i;
1013 1026
1014 1027
1015 KPrefsDialogWidFont *marcusBainsFont = 1028 KPrefsDialogWidFont *marcusBainsFont =
1016 addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"), 1029 addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"),
1017 &(KOPrefs::instance()->mMarcusBainsFont),topFrame); 1030 &(KOPrefs::instance()->mMarcusBainsFont),topFrame);
1018 topLayout->addWidget(marcusBainsFont->label(),i,0); 1031 topLayout->addWidget(marcusBainsFont->label(),i,0);
1019 topLayout->addWidget(marcusBainsFont->preview(),i,1); 1032 topLayout->addWidget(marcusBainsFont->preview(),i,1);
1020 topLayout->addWidget(marcusBainsFont->button(),i,2); 1033 topLayout->addWidget(marcusBainsFont->button(),i,2);
1021 ++i; 1034 ++i;
1022 1035
1023 tVFont = 1036 tVFont =
1024 addWidFont(i18n("Summary"),i18n("Event Viewer:"), 1037 addWidFont(i18n("Summary"),i18n("Event Viewer:"),
1025 &(KOPrefs::instance()->mEventViewFont),topFrame); 1038 &(KOPrefs::instance()->mEventViewFont),topFrame);
1026 topLayout->addWidget(tVFont->label(),i,0); 1039 topLayout->addWidget(tVFont->label(),i,0);
1027 topLayout->addWidget(tVFont->preview(),i,1); 1040 topLayout->addWidget(tVFont->preview(),i,1);
1028 topLayout->addWidget(tVFont->button(),i,2); 1041 topLayout->addWidget(tVFont->button(),i,2);
1029 ++i; 1042 ++i;
1030 1043
1031 1044
1032 1045
1033 tVFont = 1046 tVFont =
1034 addWidFont(i18n("Details"),i18n("EditorBox:"), 1047 addWidFont(i18n("Details"),i18n("EditorBox:"),
1035 &(KOPrefs::instance()->mEditBoxFont),topFrame); 1048 &(KOPrefs::instance()->mEditBoxFont),topFrame);
1036 topLayout->addWidget(tVFont->label(),i,0); 1049 topLayout->addWidget(tVFont->label(),i,0);
1037 topLayout->addWidget(tVFont->preview(),i,1); 1050 topLayout->addWidget(tVFont->preview(),i,1);
1038 topLayout->addWidget(tVFont->button(),i,2); 1051 topLayout->addWidget(tVFont->button(),i,2);
1039 ++i; 1052 ++i;
1040 1053
1041 1054
1042 1055
1043 topLayout->setColStretch(1,1); 1056 topLayout->setColStretch(1,1);
1044 topLayout->setRowStretch(4,1); 1057 topLayout->setRowStretch(4,1);
1045 1058
1046 1059
1047 i = 0; 1060 i = 0;
1048 topFrame = addPage(i18n("View Fonts"),0, 1061 topFrame = addPage(i18n("View Fonts"),0,
1049 DesktopIcon("fonts",KIcon::SizeMedium)); 1062 DesktopIcon("fonts",KIcon::SizeMedium));
1050 1063
1051 topLayout = new QGridLayout(topFrame,7,3); 1064 topLayout = new QGridLayout(topFrame,7,3);
1052 topLayout->setSpacing(1); 1065 topLayout->setSpacing(1);
1053 topLayout->setMargin(3); 1066 topLayout->setMargin(3);
1054 1067
1055 tVFont = 1068 tVFont =
1056 addWidFont(i18n("Configure KO"),i18n("What's Next View:"), 1069 addWidFont(i18n("Configure KO"),i18n("What's Next View:"),
1057 &(KOPrefs::instance()->mWhatsNextFont),topFrame); 1070 &(KOPrefs::instance()->mWhatsNextFont),topFrame);
1058 topLayout->addWidget(tVFont->label(),i,0); 1071 topLayout->addWidget(tVFont->label(),i,0);
1059 topLayout->addWidget(tVFont->preview(),i,1); 1072 topLayout->addWidget(tVFont->preview(),i,1);
1060 topLayout->addWidget(tVFont->button(),i,2); 1073 topLayout->addWidget(tVFont->button(),i,2);
1061 ++i; 1074 ++i;
1062 KPrefsDialogWidFont *agendaViewFont = 1075 KPrefsDialogWidFont *agendaViewFont =
1063 addWidFont(i18n("Event text"),i18n("Agenda view:"), 1076 addWidFont(i18n("Event text"),i18n("Agenda view:"),
1064 &(KOPrefs::instance()->mAgendaViewFont),topFrame); 1077 &(KOPrefs::instance()->mAgendaViewFont),topFrame);
1065 topLayout->addWidget(agendaViewFont->label(),i,0); 1078 topLayout->addWidget(agendaViewFont->label(),i,0);
1066 topLayout->addWidget(agendaViewFont->preview(),i,1); 1079 topLayout->addWidget(agendaViewFont->preview(),i,1);
1067 topLayout->addWidget(agendaViewFont->button(),i,2); 1080 topLayout->addWidget(agendaViewFont->button(),i,2);
1068 ++i; 1081 ++i;
1069 1082
1070 1083
1071 KPrefsDialogWidFont *monthViewFont = 1084 KPrefsDialogWidFont *monthViewFont =
1072 addWidFont(KGlobal::locale()->formatTime(QTime(12,34)) + " " + i18n("Event"), 1085 addWidFont(KGlobal::locale()->formatTime(QTime(12,34)) + " " + i18n("Event"),
1073 i18n("Month view:"),&(KOPrefs::instance()->mMonthViewFont),topFrame); 1086 i18n("Month view:"),&(KOPrefs::instance()->mMonthViewFont),topFrame);
1074 topLayout->addWidget(monthViewFont->label(),i,0); 1087 topLayout->addWidget(monthViewFont->label(),i,0);
1075 topLayout->addWidget(monthViewFont->preview(),i,1); 1088 topLayout->addWidget(monthViewFont->preview(),i,1);
1076 topLayout->addWidget(monthViewFont->button(),i,2); 1089 topLayout->addWidget(monthViewFont->button(),i,2);
1077 ++i; 1090 ++i;
1078 1091
1079 1092
1080 KPrefsDialogWidFont *lVFont = 1093 KPrefsDialogWidFont *lVFont =
1081 addWidFont(i18n("Event"),i18n("List View:"), 1094 addWidFont(i18n("Event"),i18n("List View:"),
1082 &(KOPrefs::instance()->mListViewFont),topFrame); 1095 &(KOPrefs::instance()->mListViewFont),topFrame);
1083 topLayout->addWidget(lVFont->label(),i,0); 1096 topLayout->addWidget(lVFont->label(),i,0);
1084 topLayout->addWidget(lVFont->preview(),i,1); 1097 topLayout->addWidget(lVFont->preview(),i,1);
1085 topLayout->addWidget(lVFont->button(),i,2); 1098 topLayout->addWidget(lVFont->button(),i,2);
1086 ++i; 1099 ++i;
1087 1100
1088 1101
1089 tVFont = 1102 tVFont =
1090 addWidFont(i18n("ToDo"),i18n("ToDoView:"), 1103 addWidFont(i18n("ToDo"),i18n("ToDoView:"),
1091 &(KOPrefs::instance()->mTodoViewFont),topFrame); 1104 &(KOPrefs::instance()->mTodoViewFont),topFrame);
1092 topLayout->addWidget(tVFont->label(),i,0); 1105 topLayout->addWidget(tVFont->label(),i,0);
1093 topLayout->addWidget(tVFont->preview(),i,1); 1106 topLayout->addWidget(tVFont->preview(),i,1);
1094 topLayout->addWidget(tVFont->button(),i,2); 1107 topLayout->addWidget(tVFont->button(),i,2);
1095 ++i; 1108 ++i;
1096 1109
1097 1110
1098 tVFont = 1111 tVFont =
1099 addWidFont(i18n("Today"),i18n("JournalView:"), 1112 addWidFont(i18n("Today"),i18n("JournalView:"),
1100 &(KOPrefs::instance()->mJornalViewFont),topFrame); 1113 &(KOPrefs::instance()->mJornalViewFont),topFrame);
1101 topLayout->addWidget(tVFont->label(),i,0); 1114 topLayout->addWidget(tVFont->label(),i,0);
1102 topLayout->addWidget(tVFont->preview(),i,1); 1115 topLayout->addWidget(tVFont->preview(),i,1);
1103 topLayout->addWidget(tVFont->button(),i,2); 1116 topLayout->addWidget(tVFont->button(),i,2);
1104 ++i; 1117 ++i;
1105 1118
1106 1119
1107 1120
1108 1121
1109 topLayout->setColStretch(1,1); 1122 topLayout->setColStretch(1,1);
1110 topLayout->setRowStretch(4,1); 1123 topLayout->setRowStretch(4,1);
1111 1124
1112 1125
1113 1126
1114 1127
1115} 1128}
1116 1129
1117void KOPrefsDialog::setupColorsTab() 1130void KOPrefsDialog::setupColorsTab()
1118{ 1131{
1119 QFrame *topFrame = addPage(i18n("Colors"),0,0); 1132 QFrame *topFrame = addPage(i18n("Colors"),0,0);
1120 // DesktopIcon("colorize",KIcon::SizeMedium)); 1133 // DesktopIcon("colorize",KIcon::SizeMedium));
1121 1134
1122 QGridLayout *topLayout = new QGridLayout(topFrame,5,2); 1135 QGridLayout *topLayout = new QGridLayout(topFrame,5,2);
1123 // topLayout->setSpacing(spacingHint()); 1136 // topLayout->setSpacing(spacingHint());
1124 // topLayout->setMargin(marginHint()); 1137 // topLayout->setMargin(marginHint());
1125 1138
1126 topLayout->setSpacing(2); 1139 topLayout->setSpacing(2);
1127 topLayout->setMargin(3); 1140 topLayout->setMargin(3);
1128 1141
1129 int ii = 1; 1142 int ii = 1;
1130 QGroupBox *categoryGroup ; 1143 QGroupBox *categoryGroup ;
1131 1144
1132 categoryGroup = new QGroupBox(1,Vertical,i18n("Categories"), 1145 categoryGroup = new QGroupBox(1,Vertical,i18n("Categories"),
1133 topFrame); 1146 topFrame);
1134 topLayout->addMultiCellWidget(categoryGroup,0,0,0,1); 1147 topLayout->addMultiCellWidget(categoryGroup,0,0,0,1);
1135 1148
1136 mCategoryCombo = new QComboBox(categoryGroup); 1149 mCategoryCombo = new QComboBox(categoryGroup);
1137 mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); 1150 mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories);
1138 connect(mCategoryCombo,SIGNAL(activated(int)),SLOT(updateCategoryColor())); 1151 connect(mCategoryCombo,SIGNAL(activated(int)),SLOT(updateCategoryColor()));
1139 1152
1140 mCategoryButton = new KColorButton(categoryGroup); 1153 mCategoryButton = new KColorButton(categoryGroup);
1141 connect(mCategoryButton,SIGNAL(changed(const QColor &)),SLOT(setCategoryColor())); 1154 connect(mCategoryButton,SIGNAL(changed(const QColor &)),SLOT(setCategoryColor()));
1142 updateCategoryColor(); 1155 updateCategoryColor();
1143 1156
1144 1157
1145 // Holiday Color 1158 // Holiday Color
1146 1159
1147 KPrefsDialogWidColor *holidayColor = 1160 KPrefsDialogWidColor *holidayColor =
1148 addWidColor(i18n("Holiday color:"), 1161 addWidColor(i18n("Holiday color:"),
1149 &(KOPrefs::instance()->mHolidayColor),topFrame); 1162 &(KOPrefs::instance()->mHolidayColor),topFrame);
1150 topLayout->addWidget(holidayColor->label(),ii,0); 1163 topLayout->addWidget(holidayColor->label(),ii,0);
1151 topLayout->addWidget(holidayColor->button(),ii++,1); 1164 topLayout->addWidget(holidayColor->button(),ii++,1);
1152 1165
1153 // Highlight Color 1166 // Highlight Color
1154 KPrefsDialogWidColor *highlightColor = 1167 KPrefsDialogWidColor *highlightColor =
1155 addWidColor(i18n("Highlight color:"), 1168 addWidColor(i18n("Highlight color:"),
1156 &(KOPrefs::instance()->mHighlightColor),topFrame); 1169 &(KOPrefs::instance()->mHighlightColor),topFrame);
1157 topLayout->addWidget(highlightColor->label(),ii,0); 1170 topLayout->addWidget(highlightColor->label(),ii,0);
1158 topLayout->addWidget(highlightColor->button(),ii++,1); 1171 topLayout->addWidget(highlightColor->button(),ii++,1);
1159 1172
1160 // Event color 1173 // Event color
1161 KPrefsDialogWidColor *eventColor = 1174 KPrefsDialogWidColor *eventColor =
1162 addWidColor(i18n("Default event color:"), 1175 addWidColor(i18n("Default event color:"),
1163 &(KOPrefs::instance()->mEventColor),topFrame); 1176 &(KOPrefs::instance()->mEventColor),topFrame);
1164 topLayout->addWidget(eventColor->label(),ii,0); 1177 topLayout->addWidget(eventColor->label(),ii,0);
1165 topLayout->addWidget(eventColor->button(),ii++,1); 1178 topLayout->addWidget(eventColor->button(),ii++,1);
1166 1179
1167 // agenda view background color 1180 // agenda view background color
1168 KPrefsDialogWidColor *agendaBgColor = 1181 KPrefsDialogWidColor *agendaBgColor =
1169 addWidColor(i18n("Agenda view background color:"), 1182 addWidColor(i18n("Agenda view background color:"),
1170 &(KOPrefs::instance()->mAgendaBgColor),topFrame); 1183 &(KOPrefs::instance()->mAgendaBgColor),topFrame);
1171 topLayout->addWidget(agendaBgColor->label(),ii,0); 1184 topLayout->addWidget(agendaBgColor->label(),ii,0);
1172 topLayout->addWidget(agendaBgColor->button(),ii++,1); 1185 topLayout->addWidget(agendaBgColor->button(),ii++,1);
1173 1186
1174 // working hours color 1187 // working hours color
1175 KPrefsDialogWidColor *workingHoursColor = 1188 KPrefsDialogWidColor *workingHoursColor =
1176 addWidColor(i18n("Working hours color:"), 1189 addWidColor(i18n("Working hours color:"),
1177 &(KOPrefs::instance()->mWorkingHoursColor),topFrame); 1190 &(KOPrefs::instance()->mWorkingHoursColor),topFrame);
1178 topLayout->addWidget(workingHoursColor->label(),ii,0); 1191 topLayout->addWidget(workingHoursColor->label(),ii,0);
1179 topLayout->addWidget(workingHoursColor->button(),ii++,1); 1192 topLayout->addWidget(workingHoursColor->button(),ii++,1);
1180 1193
1181 KPrefsDialogWidBool *sb = 1194 KPrefsDialogWidBool *sb =
1182 addWidBool(i18n("Use colors for application:"), 1195 addWidBool(i18n("Use colors for application:"),
1183 &(KOPrefs::instance()->mUseAppColors),topFrame); 1196 &(KOPrefs::instance()->mUseAppColors),topFrame);
1184 topLayout->addMultiCellWidget(sb->checkBox(), ii, ii, 0,1 ); 1197 topLayout->addMultiCellWidget(sb->checkBox(), ii, ii, 0,1 );
1185 1198
1186 ii++; 1199 ii++;
1187 KPrefsDialogWidColor * workingHoursColor1 = 1200 KPrefsDialogWidColor * workingHoursColor1 =
1188 addWidColor(i18n("Buttons, menus, etc.:"), 1201 addWidColor(i18n("Buttons, menus, etc.:"),
1189 &(KOPrefs::instance()->mAppColor1),topFrame); 1202 &(KOPrefs::instance()->mAppColor1),topFrame);
1190 topLayout->addWidget(workingHoursColor1->label(),ii,0); 1203 topLayout->addWidget(workingHoursColor1->label(),ii,0);
1191 topLayout->addWidget(workingHoursColor1->button(),ii++,1); 1204 topLayout->addWidget(workingHoursColor1->button(),ii++,1);
1192 1205
1193 KPrefsDialogWidColor * workingHoursColor2 = 1206 KPrefsDialogWidColor * workingHoursColor2 =
1194 addWidColor(i18n("Frames, labels, etc.:"), 1207 addWidColor(i18n("Frames, labels, etc.:"),
1195 &(KOPrefs::instance()->mAppColor2),topFrame); 1208 &(KOPrefs::instance()->mAppColor2),topFrame);
1196 topLayout->addWidget(workingHoursColor2->label(),ii,0); 1209 topLayout->addWidget(workingHoursColor2->label(),ii,0);
1197 topLayout->addWidget(workingHoursColor2->button(),ii++,1); 1210 topLayout->addWidget(workingHoursColor2->button(),ii++,1);
1198 1211
1199 1212
1200 1213
1201} 1214}
1202 1215
1203void KOPrefsDialog::setCategoryColor() 1216void KOPrefsDialog::setCategoryColor()
1204{ 1217{
1205 mCategoryDict.replace(mCategoryCombo->currentText(), new QColor(mCategoryButton->color())); 1218 mCategoryDict.replace(mCategoryCombo->currentText(), new QColor(mCategoryButton->color()));
1206} 1219}
1207 1220
1208void KOPrefsDialog::updateCategoryColor() 1221void KOPrefsDialog::updateCategoryColor()
1209{ 1222{
1210 QString cat = mCategoryCombo->currentText(); 1223 QString cat = mCategoryCombo->currentText();
1211 QColor *color = mCategoryDict.find(cat); 1224 QColor *color = mCategoryDict.find(cat);
1212 if (!color) { 1225 if (!color) {
1213 color = KOPrefs::instance()->categoryColor(cat); 1226 color = KOPrefs::instance()->categoryColor(cat);
1214 } 1227 }
1215 if (color) { 1228 if (color) {
1216 mCategoryButton->setColor(*color); 1229 mCategoryButton->setColor(*color);
1217 } 1230 }
1218} 1231}
1219 1232
1220void KOPrefsDialog::setupPrinterTab() 1233void KOPrefsDialog::setupPrinterTab()
1221{ 1234{
1222 mPrinterTab = addPage(i18n("Printing"),0, 1235 mPrinterTab = addPage(i18n("Printing"),0,
1223 DesktopIcon("fileprint",KIcon::SizeMedium)); 1236 DesktopIcon("fileprint",KIcon::SizeMedium));
1224 1237
1225 QGridLayout *topLayout = new QGridLayout(mPrinterTab,5,2); 1238 QGridLayout *topLayout = new QGridLayout(mPrinterTab,5,2);
1226 topLayout->setSpacing(spacingHint()); 1239 topLayout->setSpacing(spacingHint());
1227 topLayout->setMargin(marginHint()); 1240 topLayout->setMargin(marginHint());
1228 1241
1229 topLayout->setRowStretch(4,1); 1242 topLayout->setRowStretch(4,1);
1230} 1243}
1231 1244
1232void KOPrefsDialog::setupGroupSchedulingTab() 1245void KOPrefsDialog::setupGroupSchedulingTab()
1233{ 1246{
1234#if 0 1247#if 0
1235 QFrame *topFrame = addPage(i18n("Group Scheduling"),0, 1248 QFrame *topFrame = addPage(i18n("Group Scheduling"),0,
1236 DesktopIcon("personal",KIcon::SizeMedium)); 1249 DesktopIcon("personal",KIcon::SizeMedium));
1237 1250
1238 QGridLayout *topLayout = new QGridLayout(topFrame,6,2); 1251 QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
1239 topLayout->setSpacing(spacingHint()); 1252 topLayout->setSpacing(spacingHint());
1240 topLayout->setMargin(marginHint()); 1253 topLayout->setMargin(marginHint());
1241 1254
1242#if 0 1255#if 0
1243 KPrefsDialogWidRadios *schedulerGroup = 1256 KPrefsDialogWidRadios *schedulerGroup =
1244 addWidRadios(i18n("Scheduler Mail Client"),&(KOPrefs::instance()->mIMIPScheduler), 1257 addWidRadios(i18n("Scheduler Mail Client"),&(KOPrefs::instance()->mIMIPScheduler),
1245 topFrame); 1258 topFrame);
1246 schedulerGroup->addRadio("Dummy"); // Only for debugging 1259 schedulerGroup->addRadio("Dummy"); // Only for debugging
1247 schedulerGroup->addRadio(i18n("Mail client")); 1260 schedulerGroup->addRadio(i18n("Mail client"));
1248 1261
1249 topLayout->addMultiCellWidget(schedulerGroup->groupBox(),0,0,0,1); 1262 topLayout->addMultiCellWidget(schedulerGroup->groupBox(),0,0,0,1);
1250#endif 1263#endif
1251 1264
1252 KPrefsDialogWidRadios *sendGroup = 1265 KPrefsDialogWidRadios *sendGroup =
1253 addWidRadios(i18n("Scheduler Mails Should Be"),&(KOPrefs::instance()->mIMIPSend), 1266 addWidRadios(i18n("Scheduler Mails Should Be"),&(KOPrefs::instance()->mIMIPSend),
1254 topFrame); 1267 topFrame);
1255 sendGroup->addRadio(i18n("Send to outbox")); 1268 sendGroup->addRadio(i18n("Send to outbox"));
1256 sendGroup->addRadio(i18n("Send directly")); 1269 sendGroup->addRadio(i18n("Send directly"));
1257 1270
1258 topLayout->addMultiCellWidget(sendGroup->groupBox(),1,1,0,1); 1271 topLayout->addMultiCellWidget(sendGroup->groupBox(),1,1,0,1);
1259 1272
1260 topLayout->addMultiCellWidget(new QLabel(i18n("Additional email addresses:"),topFrame),2,2,0,1); 1273 topLayout->addMultiCellWidget(new QLabel(i18n("Additional email addresses:"),topFrame),2,2,0,1);
1261 mAMails = new QListView(topFrame); 1274 mAMails = new QListView(topFrame);
1262 mAMails->addColumn(i18n("Email"),300); 1275 mAMails->addColumn(i18n("Email"),300);
1263 topLayout->addMultiCellWidget(mAMails,3,3,0,1); 1276 topLayout->addMultiCellWidget(mAMails,3,3,0,1);
1264 1277
1265 topLayout->addWidget(new QLabel(i18n("Additional email address:"),topFrame),4,0); 1278 topLayout->addWidget(new QLabel(i18n("Additional email address:"),topFrame),4,0);
1266 aEmailsEdit = new QLineEdit(topFrame); 1279 aEmailsEdit = new QLineEdit(topFrame);
1267 aEmailsEdit->setEnabled(false); 1280 aEmailsEdit->setEnabled(false);
1268 topLayout->addWidget(aEmailsEdit,4,1); 1281 topLayout->addWidget(aEmailsEdit,4,1);
1269 1282
1270 QPushButton *add = new QPushButton(i18n("New"),topFrame,"new"); 1283 QPushButton *add = new QPushButton(i18n("New"),topFrame,"new");
1271 topLayout->addWidget(add,5,0); 1284 topLayout->addWidget(add,5,0);
1272 QPushButton *del = new QPushButton(i18n("Remove"),topFrame,"remove"); 1285 QPushButton *del = new QPushButton(i18n("Remove"),topFrame,"remove");
1273 topLayout->addWidget(del,5,1); 1286 topLayout->addWidget(del,5,1);
1274 1287
1275 //topLayout->setRowStretch(2,1); 1288 //topLayout->setRowStretch(2,1);
1276 connect(add, SIGNAL( clicked() ), this, SLOT(addItem()) ); 1289 connect(add, SIGNAL( clicked() ), this, SLOT(addItem()) );
1277 connect(del, SIGNAL( clicked() ), this, SLOT(removeItem()) ); 1290 connect(del, SIGNAL( clicked() ), this, SLOT(removeItem()) );
1278 connect(aEmailsEdit,SIGNAL( textChanged(const QString&) ), this,SLOT(updateItem())); 1291 connect(aEmailsEdit,SIGNAL( textChanged(const QString&) ), this,SLOT(updateItem()));
1279 connect(mAMails,SIGNAL(selectionChanged(QListViewItem *)),SLOT(updateInput())); 1292 connect(mAMails,SIGNAL(selectionChanged(QListViewItem *)),SLOT(updateInput()));
1280#endif 1293#endif
1281} 1294}
1282 1295
1283void KOPrefsDialog::setupGroupAutomationTab() 1296void KOPrefsDialog::setupGroupAutomationTab()
1284{ 1297{
1285 return; 1298 return;
1286 QFrame *topFrame = addPage(i18n("Group Automation"),0, 1299 QFrame *topFrame = addPage(i18n("Group Automation"),0,
1287 DesktopIcon("personal",KIcon::SizeMedium)); 1300 DesktopIcon("personal",KIcon::SizeMedium));
1288 1301
1289 QGridLayout *topLayout = new QGridLayout(topFrame,5,1); 1302 QGridLayout *topLayout = new QGridLayout(topFrame,5,1);
1290 topLayout->setSpacing(spacingHint()); 1303 topLayout->setSpacing(spacingHint());
1291 topLayout->setMargin(marginHint()); 1304 topLayout->setMargin(marginHint());
1292 1305
1293 KPrefsDialogWidRadios *autoRefreshGroup = 1306 KPrefsDialogWidRadios *autoRefreshGroup =
1294 addWidRadios(i18n("Auto Send Refresh"), 1307 addWidRadios(i18n("Auto Send Refresh"),
1295 &(KOPrefs::instance()->mIMIPAutoRefresh),topFrame); 1308 &(KOPrefs::instance()->mIMIPAutoRefresh),topFrame);
1296 autoRefreshGroup->addRadio(i18n("Never")); 1309 autoRefreshGroup->addRadio(i18n("Never"));
1297 autoRefreshGroup->addRadio(i18n("If attendee is in addressbook")); 1310 autoRefreshGroup->addRadio(i18n("If attendee is in addressbook"));
1298 //autoRefreshGroup->addRadio(i18n("selected emails")); 1311 //autoRefreshGroup->addRadio(i18n("selected emails"));
1299 topLayout->addMultiCellWidget(autoRefreshGroup->groupBox(),0,0,0,0); 1312 topLayout->addMultiCellWidget(autoRefreshGroup->groupBox(),0,0,0,0);
1300 1313
1301 KPrefsDialogWidRadios *autoInsertGroup = 1314 KPrefsDialogWidRadios *autoInsertGroup =
1302 addWidRadios(i18n("Auto Insert IMIP Replies"), 1315 addWidRadios(i18n("Auto Insert IMIP Replies"),
1303 &(KOPrefs::instance()->mIMIPAutoInsertReply),topFrame); 1316 &(KOPrefs::instance()->mIMIPAutoInsertReply),topFrame);
1304 autoInsertGroup->addRadio(i18n("Never")); 1317 autoInsertGroup->addRadio(i18n("Never"));
1305 autoInsertGroup->addRadio(i18n("If attendee is in addressbook")); 1318 autoInsertGroup->addRadio(i18n("If attendee is in addressbook"));
1306 //autoInsertGroup->addRadio(i18n("selected emails")); 1319 //autoInsertGroup->addRadio(i18n("selected emails"));
1307 topLayout->addMultiCellWidget(autoInsertGroup->groupBox(),1,1,0,0); 1320 topLayout->addMultiCellWidget(autoInsertGroup->groupBox(),1,1,0,0);
1308 1321
1309 KPrefsDialogWidRadios *autoRequestGroup = 1322 KPrefsDialogWidRadios *autoRequestGroup =
1310 addWidRadios(i18n("Auto Insert IMIP Requests"), 1323 addWidRadios(i18n("Auto Insert IMIP Requests"),
1311 &(KOPrefs::instance()->mIMIPAutoInsertRequest),topFrame); 1324 &(KOPrefs::instance()->mIMIPAutoInsertRequest),topFrame);
1312 autoRequestGroup->addRadio(i18n("Never")); 1325 autoRequestGroup->addRadio(i18n("Never"));
1313 autoRequestGroup->addRadio(i18n("If organizer is in addressbook")); 1326 autoRequestGroup->addRadio(i18n("If organizer is in addressbook"));
1314 //autoInsertGroup->addRadio(i18n("selected emails")); 1327 //autoInsertGroup->addRadio(i18n("selected emails"));
1315 topLayout->addMultiCellWidget(autoRequestGroup->groupBox(),2,2,0,0); 1328 topLayout->addMultiCellWidget(autoRequestGroup->groupBox(),2,2,0,0);
1316 1329
1317 KPrefsDialogWidRadios *autoFreeBusyGroup = 1330 KPrefsDialogWidRadios *autoFreeBusyGroup =
1318 addWidRadios(i18n("Auto Send FreeBusy Information"), 1331 addWidRadios(i18n("Auto Send FreeBusy Information"),
1319 &(KOPrefs::instance()->mIMIPAutoFreeBusy),topFrame); 1332 &(KOPrefs::instance()->mIMIPAutoFreeBusy),topFrame);
1320 autoFreeBusyGroup->addRadio(i18n("Never")); 1333 autoFreeBusyGroup->addRadio(i18n("Never"));
1321 autoFreeBusyGroup->addRadio(i18n("If requested from an email in addressbook")); 1334 autoFreeBusyGroup->addRadio(i18n("If requested from an email in addressbook"));
1322 //autoFreeBusyGroup->addRadio(i18n("selected emails")); 1335 //autoFreeBusyGroup->addRadio(i18n("selected emails"));
1323 topLayout->addMultiCellWidget(autoFreeBusyGroup->groupBox(),3,3,0,0); 1336 topLayout->addMultiCellWidget(autoFreeBusyGroup->groupBox(),3,3,0,0);
1324 1337
1325 KPrefsDialogWidRadios *autoFreeBusyReplyGroup = 1338 KPrefsDialogWidRadios *autoFreeBusyReplyGroup =
1326 addWidRadios(i18n("Auto Save FreeBusy Replies"), 1339 addWidRadios(i18n("Auto Save FreeBusy Replies"),
1327 &(KOPrefs::instance()->mIMIPAutoFreeBusyReply),topFrame); 1340 &(KOPrefs::instance()->mIMIPAutoFreeBusyReply),topFrame);
1328 autoFreeBusyReplyGroup->addRadio(i18n("Never")); 1341 autoFreeBusyReplyGroup->addRadio(i18n("Never"));
1329 autoFreeBusyReplyGroup->addRadio(i18n("If attendee is in addressbook")); 1342 autoFreeBusyReplyGroup->addRadio(i18n("If attendee is in addressbook"));
1330 //autoFreeBusyGroup->addRadio(i18n("selected emails")); 1343 //autoFreeBusyGroup->addRadio(i18n("selected emails"));
1331 topLayout->addMultiCellWidget(autoFreeBusyReplyGroup->groupBox(),4,4,0,0); 1344 topLayout->addMultiCellWidget(autoFreeBusyReplyGroup->groupBox(),4,4,0,0);
1332} 1345}
1333 1346
1334void KOPrefsDialog::showPrinterTab() 1347void KOPrefsDialog::showPrinterTab()
1335{ 1348{
1336 showPage(pageIndex(mPrinterTab)); 1349 showPage(pageIndex(mPrinterTab));
1337} 1350}
1338 1351
1339 1352
1340void KOPrefsDialog::setCombo(QComboBox *combo, const QString & text, 1353void KOPrefsDialog::setCombo(QComboBox *combo, const QString & text,
1341 const QStringList *tags) 1354 const QStringList *tags)
1342{ 1355{
1343 if (tags) { 1356 if (tags) {
1344 int i = tags->findIndex(text); 1357 int i = tags->findIndex(text);
1345 if (i > 0) combo->setCurrentItem(i); 1358 if (i > 0) combo->setCurrentItem(i);
1346 } else { 1359 } else {
1347 for(int i=0;i<combo->count();++i) { 1360 for(int i=0;i<combo->count();++i) {
1348 if (combo->text(i) == text) { 1361 if (combo->text(i) == text) {
1349 combo->setCurrentItem(i); 1362 combo->setCurrentItem(i);
1350 break; 1363 break;
1351 } 1364 }
1352 } 1365 }
1353 } 1366 }
1354} 1367}
1355 1368
1356void KOPrefsDialog::usrReadConfig() 1369void KOPrefsDialog::usrReadConfig()
1357{ 1370{
1358 kdelibcfg->readConfig(); 1371 kdelibcfg->readConfig();
1359 mNameEdit->setText(KOPrefs::instance()->fullName()); 1372 mNameEdit->setText(KOPrefs::instance()->fullName());
1360 mEmailEdit->setText(KOPrefs::instance()->email()); 1373 mEmailEdit->setText(KOPrefs::instance()->email());
1361 1374
1362 mAutoSaveIntervalSpin->setValue(KOPrefs::instance()->mAutoSaveInterval); 1375 mAutoSaveIntervalSpin->setValue(KOPrefs::instance()->mAutoSaveInterval);
1363 // QDate current ( 2001, 1,1); 1376 // QDate current ( 2001, 1,1);
1364 //mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1)); 1377 //mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1));
1365 //mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1)); 1378 //mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1));
1366 //setCombo(mTimeZoneCombo,i18n(KOPrefs::instance()->mTimeZoneId)); 1379 //setCombo(mTimeZoneCombo,i18n(KOPrefs::instance()->mTimeZoneId));
1367 //mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset); 1380 //mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset);
1368 mStartTimeSpin->setValue(KOPrefs::instance()->mStartTime); 1381 mStartTimeSpin->setValue(KOPrefs::instance()->mStartTime);
1369 mDefaultDurationSpin->setValue(KOPrefs::instance()->mDefaultDuration); 1382 mDefaultDurationSpin->setValue(KOPrefs::instance()->mDefaultDuration);
1370 mAlarmTimeCombo->setCurrentItem(KOPrefs::instance()->mAlarmTime); 1383 mAlarmTimeCombo->setCurrentItem(KOPrefs::instance()->mAlarmTime);
1371 // if (KOPrefs::instance()->mAllDaySize > 47 ) 1384 // if (KOPrefs::instance()->mAllDaySize > 47 )
1372 // KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize/2; 1385 // KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize/2;
1373 //mHourSizeSlider->setValue(KOPrefs::instance()->mAllDaySize); 1386 //mHourSizeSlider->setValue(KOPrefs::instance()->mAllDaySize);
1374 1387
1375 mNextXDaysSpin->setValue(KOPrefs::instance()->mNextXDays); 1388 mNextXDaysSpin->setValue(KOPrefs::instance()->mNextXDays);
1376 mWhatsNextSpin->setValue(KOPrefs::instance()->mWhatsNextDays); 1389 mWhatsNextSpin->setValue(KOPrefs::instance()->mWhatsNextDays);
1377 mPrioSpin->setValue(KOPrefs::instance()->mWhatsNextPrios); 1390 mPrioSpin->setValue(KOPrefs::instance()->mWhatsNextPrios);
1378 // mAMails->clear(); 1391 // mAMails->clear();
1379 // for ( QStringList::Iterator it = KOPrefs::instance()->mAdditionalMails.begin(); 1392 // for ( QStringList::Iterator it = KOPrefs::instance()->mAdditionalMails.begin();
1380// it != KOPrefs::instance()->mAdditionalMails.end(); ++it ) { 1393// it != KOPrefs::instance()->mAdditionalMails.end(); ++it ) {
1381// QListViewItem *item = new QListViewItem(mAMails); 1394// QListViewItem *item = new QListViewItem(mAMails);
1382// item->setText(0,*it); 1395// item->setText(0,*it);
1383// mAMails->insertItem(item); 1396// mAMails->insertItem(item);
1384// } 1397// }
1385 1398
1386 // mRemoteIPEdit->setText(KOPrefs::instance()->mRemoteIP); 1399 // mRemoteIPEdit->setText(KOPrefs::instance()->mRemoteIP);
1387 //mRemoteUser->setText(KOPrefs::instance()->mRemoteUser); 1400 //mRemoteUser->setText(KOPrefs::instance()->mRemoteUser);
1388 //mRemotePassWd->setText(KOPrefs::instance()->mRemotePassWd); 1401 //mRemotePassWd->setText(KOPrefs::instance()->mRemotePassWd);
1389 //mRemoteFile->setText(KOPrefs::instance()->mRemoteFile); 1402 //mRemoteFile->setText(KOPrefs::instance()->mRemoteFile);
1390 1403
1391 //that soundmLocalTempFile->setText(KOPrefs::instance()->mLocalTempFile); 1404 //that soundmLocalTempFile->setText(KOPrefs::instance()->mLocalTempFile);
1392 mDefaultAlarmFile->setText(KOPrefs::instance()->mDefaultAlarmFile); 1405 mDefaultAlarmFile->setText(KOPrefs::instance()->mDefaultAlarmFile);
1393 //QString dummy = KOPrefs::instance()->mUserDateFormatLong; 1406 //QString dummy = KOPrefs::instance()->mUserDateFormatLong;
1394 //mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") )); 1407 //mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") ));
1395 //dummy = KOPrefs::instance()->mUserDateFormatShort; 1408 //dummy = KOPrefs::instance()->mUserDateFormatShort;
1396 //mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") )); 1409 //mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") ));
1397 updateCategories(); 1410 updateCategories();
1398 mAlarmPlayBeeps->setValue(KOPrefs::instance()->mAlarmPlayBeeps ); 1411 mAlarmPlayBeeps->setValue(KOPrefs::instance()->mAlarmPlayBeeps );
1399 mAlarmSuspendTime->setValue(KOPrefs::instance()->mAlarmSuspendTime ); 1412 mAlarmSuspendTime->setValue(KOPrefs::instance()->mAlarmSuspendTime );
1400 mAlarmSuspendCount->setValue(KOPrefs::instance()->mAlarmSuspendCount ); 1413 mAlarmSuspendCount->setValue(KOPrefs::instance()->mAlarmSuspendCount );
1401 mAlarmBeepInterval->setValue(KOPrefs::instance()->mAlarmBeepInterval ); 1414 mAlarmBeepInterval->setValue(KOPrefs::instance()->mAlarmBeepInterval );
1402} 1415}
1403 1416
1404 1417
1405void KOPrefsDialog::usrWriteConfig() 1418void KOPrefsDialog::usrWriteConfig()
1406{ 1419{
1407 1420
1408 kdelibcfg->writeConfig(); 1421 kdelibcfg->writeConfig();
1409 // KOPrefs::instance()->mRemoteIP = mRemoteIPEdit->text(); 1422 // KOPrefs::instance()->mRemoteIP = mRemoteIPEdit->text();
1410 //KOPrefs::instance()->mRemoteUser = mRemoteUser->text(); 1423 //KOPrefs::instance()->mRemoteUser = mRemoteUser->text();
1411 //KOPrefs::instance()->mRemotePassWd = mRemotePassWd->text(); 1424 //KOPrefs::instance()->mRemotePassWd = mRemotePassWd->text();
1412 //KOPrefs::instance()->mRemoteFile= mRemoteFile->text(); 1425 //KOPrefs::instance()->mRemoteFile= mRemoteFile->text();
1413 //KOPrefs::instance()->mLocalTempFile =mLocalTempFile->text(); 1426 //KOPrefs::instance()->mLocalTempFile =mLocalTempFile->text();
1414 KOPrefs::instance()->mDefaultAlarmFile =mDefaultAlarmFile->text(); 1427 KOPrefs::instance()->mDefaultAlarmFile =mDefaultAlarmFile->text();
1415 1428
1416 //KOPrefs::instance()->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") ); 1429 //KOPrefs::instance()->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") );
1417 //KOPrefs::instance()->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") ); 1430 //KOPrefs::instance()->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") );
1418 KOPrefs::instance()->setFullName(mNameEdit->text()); 1431 KOPrefs::instance()->setFullName(mNameEdit->text());
1419 KOPrefs::instance()->setEmail(mEmailEdit->text()); 1432 KOPrefs::instance()->setEmail(mEmailEdit->text());
1420 1433
1421 KOPrefs::instance()->mAutoSaveInterval = mAutoSaveIntervalSpin->value(); 1434 KOPrefs::instance()->mAutoSaveInterval = mAutoSaveIntervalSpin->value();
1422 1435
1423 // KOPrefs::instance()->mTimeZoneId = mTimeZoneCombo->currentText(); 1436 // KOPrefs::instance()->mTimeZoneId = mTimeZoneCombo->currentText();
1424 //QDate date; 1437 //QDate date;
1425 //date = mStartDateSavingEdit->date(); 1438 //date = mStartDateSavingEdit->date();
1426 //int sub = 0; 1439 //int sub = 0;
1427 //if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) 1440 //if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 )
1428 // sub = 1; 1441 // sub = 1;
1429// KOPrefs::instance()->mDaylightsavingStart = date.dayOfYear()-sub; 1442// KOPrefs::instance()->mDaylightsavingStart = date.dayOfYear()-sub;
1430// date = mEndDateSavingEdit->date(); 1443// date = mEndDateSavingEdit->date();
1431// if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) 1444// if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 )
1432// sub = 1; 1445// sub = 1;
1433// else 1446// else
1434// sub = 0; 1447// sub = 0;
1435// KOPrefs::instance()->mDaylightsavingEnd = date.dayOfYear()-sub; 1448// KOPrefs::instance()->mDaylightsavingEnd = date.dayOfYear()-sub;
1436// // KOPrefs::instance()->mTimeZoneOffset = mTimezoneOffsetSpin->value(); 1449// // KOPrefs::instance()->mTimeZoneOffset = mTimezoneOffsetSpin->value();
1437 1450
1438 KOPrefs::instance()->mStartTime = mStartTimeSpin->value(); 1451 KOPrefs::instance()->mStartTime = mStartTimeSpin->value();
1439 KOPrefs::instance()->mDefaultDuration = mDefaultDurationSpin->value(); 1452 KOPrefs::instance()->mDefaultDuration = mDefaultDurationSpin->value();
1440 KOPrefs::instance()->mAlarmTime = mAlarmTimeCombo->currentItem(); 1453 KOPrefs::instance()->mAlarmTime = mAlarmTimeCombo->currentItem();
1441 1454
1442 //KOPrefs::instance()->mAllDaySize = mHourSizeSlider->value(); 1455 //KOPrefs::instance()->mAllDaySize = mHourSizeSlider->value();
1443 1456
1444 QDictIterator<QColor> it(mCategoryDict); 1457 QDictIterator<QColor> it(mCategoryDict);
1445 while (it.current()) { 1458 while (it.current()) {
1446 KOPrefs::instance()->setCategoryColor(it.currentKey(),*it.current()); 1459 KOPrefs::instance()->setCategoryColor(it.currentKey(),*it.current());
1447 ++it; 1460 ++it;
1448 } 1461 }
1449 1462
1450 KOPrefs::instance()->mNextXDays = mNextXDaysSpin->value(); 1463 KOPrefs::instance()->mNextXDays = mNextXDaysSpin->value();
1451 KOPrefs::instance()->mWhatsNextDays = mWhatsNextSpin->value(); 1464 KOPrefs::instance()->mWhatsNextDays = mWhatsNextSpin->value();
1452 KOPrefs::instance()->mWhatsNextPrios = mPrioSpin->value(); 1465 KOPrefs::instance()->mWhatsNextPrios = mPrioSpin->value();
1453 1466
1454 KOPrefs::instance()->mAdditionalMails.clear(); 1467 KOPrefs::instance()->mAdditionalMails.clear();
1455 // QListViewItem *item; 1468 // QListViewItem *item;
1456 // item = mAMails->firstChild(); 1469 // item = mAMails->firstChild();
1457 // while (item) 1470 // while (item)
1458 // { 1471 // {
1459 // KOPrefs::instance()->mAdditionalMails.append( item->text(0) ); 1472 // KOPrefs::instance()->mAdditionalMails.append( item->text(0) );
1460 // item = item->nextSibling(); 1473 // item = item->nextSibling();
1461 // } 1474 // }
1462 KOPrefs::instance()->mAlarmPlayBeeps = mAlarmPlayBeeps->value(); 1475 KOPrefs::instance()->mAlarmPlayBeeps = mAlarmPlayBeeps->value();
1463 KOPrefs::instance()->mAlarmSuspendTime = mAlarmSuspendTime->value() ; 1476 KOPrefs::instance()->mAlarmSuspendTime = mAlarmSuspendTime->value() ;
1464 KOPrefs::instance()->mAlarmSuspendCount= mAlarmSuspendCount->value() ; 1477 KOPrefs::instance()->mAlarmSuspendCount= mAlarmSuspendCount->value() ;
1465 KOPrefs::instance()->mAlarmBeepInterval= mAlarmBeepInterval->value() ; 1478 KOPrefs::instance()->mAlarmBeepInterval= mAlarmBeepInterval->value() ;
1466 1479
1467} 1480}
1468 1481
1469void KOPrefsDialog::updateCategories() 1482void KOPrefsDialog::updateCategories()
1470{ 1483{
1471 mCategoryCombo->clear(); 1484 mCategoryCombo->clear();
1472 mCategoryDict.clear(); 1485 mCategoryDict.clear();
1473 mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); 1486 mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories);
1474 updateCategoryColor(); 1487 updateCategoryColor();
1475} 1488}
1476 1489
1477void KOPrefsDialog::warningGroupScheduling() 1490void KOPrefsDialog::warningGroupScheduling()
1478{ 1491{
1479 warningExperimental(mEnableGroupScheduling->checkBox()->isChecked()); 1492 warningExperimental(mEnableGroupScheduling->checkBox()->isChecked());
1480} 1493}
1481 1494
1482void KOPrefsDialog::warningProjectView() 1495void KOPrefsDialog::warningProjectView()
1483{ 1496{
1484 warningExperimental(mEnableProjectView->checkBox()->isChecked()); 1497 warningExperimental(mEnableProjectView->checkBox()->isChecked());
1485} 1498}
1486 1499
1487void KOPrefsDialog::warningExperimental(bool on) 1500void KOPrefsDialog::warningExperimental(bool on)
1488{ 1501{
1489 if (on) { 1502 if (on) {
1490 KMessageBox::information(this,i18n("This is an experimental feature. " 1503 KMessageBox::information(this,i18n("This is an experimental feature. "
1491 "It may not work, it may do nothing useful and it may cause data loss. " 1504 "It may not work, it may do nothing useful and it may cause data loss. "
1492 "Use with care.\n" 1505 "Use with care.\n"
1493 "You have to restart KOrganizer for this setting to take effect.")); 1506 "You have to restart KOrganizer for this setting to take effect."));
1494 } else { 1507 } else {
1495 KMessageBox::information(this, 1508 KMessageBox::information(this,
1496 i18n("You have to restart KOrganizer for this setting to take effect.")); 1509 i18n("You have to restart KOrganizer for this setting to take effect."));
1497 } 1510 }
1498} 1511}
1499 1512
1500void KOPrefsDialog::toggleEmailSettings(bool on) 1513void KOPrefsDialog::toggleEmailSettings(bool on)
1501{ 1514{
1502 if (on) { 1515 if (on) {
1503 mEmailEdit->setEnabled(false); 1516 mEmailEdit->setEnabled(false);
1504 mNameEdit->setEnabled(false); 1517 mNameEdit->setEnabled(false);
1505 mEmailLabel->setEnabled(false); 1518 mEmailLabel->setEnabled(false);
1506 mNameLabel->setEnabled(false); 1519 mNameLabel->setEnabled(false);
1507 1520
1508 KEMailSettings settings; 1521 KEMailSettings settings;
1509 mNameEdit->setText(settings.getSetting(KEMailSettings::RealName)); 1522 mNameEdit->setText(settings.getSetting(KEMailSettings::RealName));
1510 mEmailEdit->setText(settings.getSetting(KEMailSettings::EmailAddress)); 1523 mEmailEdit->setText(settings.getSetting(KEMailSettings::EmailAddress));
1511 } else { 1524 } else {
1512 mEmailEdit->setEnabled(true); 1525 mEmailEdit->setEnabled(true);
1513 mNameEdit->setEnabled(true); 1526 mNameEdit->setEnabled(true);
1514 mEmailLabel->setEnabled(true); 1527 mEmailLabel->setEnabled(true);
1515 mNameLabel->setEnabled(true); 1528 mNameLabel->setEnabled(true);
1516 } 1529 }
1517} 1530}
1518 1531
1519void KOPrefsDialog::addItem() 1532void KOPrefsDialog::addItem()
1520{ 1533{
1521 // aEmailsEdit->setEnabled(true); 1534 // aEmailsEdit->setEnabled(true);
1522// QListViewItem *item = new QListViewItem(mAMails); 1535// QListViewItem *item = new QListViewItem(mAMails);
1523// mAMails->insertItem(item); 1536// mAMails->insertItem(item);
1524// mAMails->setSelected(item,true); 1537// mAMails->setSelected(item,true);
1525// aEmailsEdit->setText(i18n("(EmptyEmail)")); 1538// aEmailsEdit->setText(i18n("(EmptyEmail)"));
1526} 1539}
1527 1540
1528void KOPrefsDialog::removeItem() 1541void KOPrefsDialog::removeItem()
1529{ 1542{
1530// QListViewItem *item; 1543// QListViewItem *item;
1531// item = mAMails->selectedItem(); 1544// item = mAMails->selectedItem();
1532// if (!item) return; 1545// if (!item) return;
1533// mAMails->takeItem(item); 1546// mAMails->takeItem(item);
1534// item = mAMails->selectedItem(); 1547// item = mAMails->selectedItem();
1535// if (!item) { 1548// if (!item) {
1536// aEmailsEdit->setText(""); 1549// aEmailsEdit->setText("");
1537// aEmailsEdit->setEnabled(false); 1550// aEmailsEdit->setEnabled(false);
1538// } 1551// }
1539// if (mAMails->childCount() == 0) { 1552// if (mAMails->childCount() == 0) {
1540// aEmailsEdit->setEnabled(false); 1553// aEmailsEdit->setEnabled(false);
1541// } 1554// }
1542} 1555}
1543 1556
1544void KOPrefsDialog::updateItem() 1557void KOPrefsDialog::updateItem()
1545{ 1558{
1546 // QListViewItem *item; 1559 // QListViewItem *item;
1547// item = mAMails->selectedItem(); 1560// item = mAMails->selectedItem();
1548// if (!item) return; 1561// if (!item) return;
1549// item->setText(0,aEmailsEdit->text()); 1562// item->setText(0,aEmailsEdit->text());
1550} 1563}
1551 1564
1552void KOPrefsDialog::updateInput() 1565void KOPrefsDialog::updateInput()
1553{ 1566{
1554// QListViewItem *item; 1567// QListViewItem *item;
1555// item = mAMails->selectedItem(); 1568// item = mAMails->selectedItem();
1556// if (!item) return; 1569// if (!item) return;
1557// aEmailsEdit->setEnabled(true); 1570// aEmailsEdit->setEnabled(true);
1558// aEmailsEdit->setText(item->text(0)); 1571// aEmailsEdit->setText(item->text(0));
1559} 1572}
1560void KOPrefsDialog::updateTimezoneOffset( int index ) 1573void KOPrefsDialog::updateTimezoneOffset( int index )
1561{ 1574{
1562 /* 1575 /*
1563 qDebug("updateTimezoneOffset %d ", index); 1576 qDebug("updateTimezoneOffset %d ", index);
1564 if ( index < 24 ) { 1577 if ( index < 24 ) {
1565 mTimezoneOffsetSpin->setEnabled ( false ); 1578 mTimezoneOffsetSpin->setEnabled ( false );
1566 mTimezoneOffsetSpin->setValue( ( index-11 ) * 60 ); 1579 mTimezoneOffsetSpin->setValue( ( index-11 ) * 60 );
1567 1580
1568 1581
1569 } else { 1582 } else {
1570 if ( index == 24 ) { 1583 if ( index == 24 ) {
1571 mTimezoneOffsetSpin->setEnabled ( true ); 1584 mTimezoneOffsetSpin->setEnabled ( true );
1572 mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset); 1585 mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset);
1573 1586
1574 } else { 1587 } else {
1575 mTimezoneOffsetSpin->setEnabled ( false ); 1588 mTimezoneOffsetSpin->setEnabled ( false );
1576 mTimezoneOffsetSpin->setValue( 0 ); 1589 mTimezoneOffsetSpin->setValue( 0 );
1577 } 1590 }
1578 } 1591 }
1579 */ 1592 */
1580} 1593}
1581 1594
1582void KOPrefsDialog::setupTimeZoneTab() 1595void KOPrefsDialog::setupTimeZoneTab()
1583{ 1596{
1584#if 0 1597#if 0
1585 QFrame *topFrame = addPage(i18n("Time Zone"),0,0); 1598 QFrame *topFrame = addPage(i18n("Time Zone"),0,0);
1586 // DesktopIcon("clock",KIcon::SizeMedium)); 1599 // DesktopIcon("clock",KIcon::SizeMedium));
1587 1600
1588 QGridLayout *topLayout = new QGridLayout(topFrame,5,2); 1601 QGridLayout *topLayout = new QGridLayout(topFrame,5,2);
1589 topLayout->setSpacing(spacingHint()); 1602 topLayout->setSpacing(spacingHint());
1590 topLayout->setMargin(marginHint()); 1603 topLayout->setMargin(marginHint());
1591 1604
1592 QHBox *timeZoneBox = new QHBox( topFrame ); 1605 QHBox *timeZoneBox = new QHBox( topFrame );
1593 topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 ); 1606 topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 );
1594 1607
1595 new QLabel( i18n("Timezone:"), timeZoneBox ); 1608 new QLabel( i18n("Timezone:"), timeZoneBox );
1596 mTimeZoneCombo = new QComboBox( timeZoneBox ); 1609 mTimeZoneCombo = new QComboBox( timeZoneBox );
1597 if ( QApplication::desktop()->width() < 300 ) { 1610 if ( QApplication::desktop()->width() < 300 ) {
1598 mTimeZoneCombo->setMaximumWidth(150); 1611 mTimeZoneCombo->setMaximumWidth(150);
1599 } 1612 }
1600 1613
1601 QStringList list; 1614 QStringList list;
1602 list = KGlobal::locale()->timeZoneList(); 1615 list = KGlobal::locale()->timeZoneList();
1603 mTimeZoneCombo->insertStringList(list); 1616 mTimeZoneCombo->insertStringList(list);
1604 1617
1605 // find the currently set time zone and select it 1618 // find the currently set time zone and select it
1606 QString sCurrentlySet = KOPrefs::instance()->mTimeZoneId; 1619 QString sCurrentlySet = KOPrefs::instance()->mTimeZoneId;
1607 int nCurrentlySet = 11; 1620 int nCurrentlySet = 11;
1608 for (int i = 0; i < mTimeZoneCombo->count(); i++) 1621 for (int i = 0; i < mTimeZoneCombo->count(); i++)
1609 { 1622 {
1610 if (mTimeZoneCombo->text(i) == sCurrentlySet) 1623 if (mTimeZoneCombo->text(i) == sCurrentlySet)
1611 { 1624 {
1612 nCurrentlySet = i; 1625 nCurrentlySet = i;
1613 break; 1626 break;
1614 } 1627 }
1615 } 1628 }
1616 mTimeZoneCombo->setCurrentItem(nCurrentlySet); 1629 mTimeZoneCombo->setCurrentItem(nCurrentlySet);
1617 int iii = 1; 1630 int iii = 1;
1618 KPrefsDialogWidBool *sb = 1631 KPrefsDialogWidBool *sb =
1619 addWidBool(i18n("Timezone has daylight saving"), 1632 addWidBool(i18n("Timezone has daylight saving"),
1620 &(KOPrefs::instance()->mUseDaylightsaving),topFrame); 1633 &(KOPrefs::instance()->mUseDaylightsaving),topFrame);
1621 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 1634 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
1622 ++iii; 1635 ++iii;
1623 QLabel* lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); 1636 QLabel* lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame );
1624 topLayout->addMultiCellWidget(lab, iii,iii,0,1); 1637 topLayout->addMultiCellWidget(lab, iii,iii,0,1);
1625 ++iii; 1638 ++iii;
1626 lab = new QLabel( i18n("The year in the date is ignored."), topFrame ); 1639 lab = new QLabel( i18n("The year in the date is ignored."), topFrame );
1627 topLayout->addMultiCellWidget(lab, iii,iii,0,1); 1640 topLayout->addMultiCellWidget(lab, iii,iii,0,1);
1628 ++iii; 1641 ++iii;
1629 lab = new QLabel( i18n("Daylight start:"), topFrame ); 1642 lab = new QLabel( i18n("Daylight start:"), topFrame );
1630 topLayout->addWidget(lab, iii,0); 1643 topLayout->addWidget(lab, iii,0);
1631 mStartDateSavingEdit = new KDateEdit(topFrame); 1644 mStartDateSavingEdit = new KDateEdit(topFrame);
1632 topLayout->addWidget(mStartDateSavingEdit, iii,1); 1645 topLayout->addWidget(mStartDateSavingEdit, iii,1);
1633 ++iii; 1646 ++iii;
1634 1647
1635 lab = new QLabel( i18n("Daylight end:"), topFrame ); 1648 lab = new QLabel( i18n("Daylight end:"), topFrame );
1636 topLayout->addWidget(lab, iii,0); 1649 topLayout->addWidget(lab, iii,0);
1637 mEndDateSavingEdit = new KDateEdit(topFrame); 1650 mEndDateSavingEdit = new KDateEdit(topFrame);
1638 topLayout->addWidget(mEndDateSavingEdit, iii,1); 1651 topLayout->addWidget(mEndDateSavingEdit, iii,1);
1639 ++iii; 1652 ++iii;
1640 QDate current ( 2001, 1,1); 1653 QDate current ( 2001, 1,1);
1641 mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1)); 1654 mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1));
1642 mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1)); 1655 mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1));
1643#endif 1656#endif
1644 1657
1645} 1658}
1646 1659
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 9cafc60..5d7b066 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -1,1119 +1,1153 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qlayout.h> 24#include <qlayout.h>
25#include <qheader.h> 25#include <qheader.h>
26#include <qcursor.h> 26#include <qcursor.h>
27 27
28#include <qvbox.h> 28#include <qvbox.h>
29#include <kdebug.h> 29#include <kdebug.h>
30#include "koprefs.h" 30#include "koprefs.h"
31#include <klocale.h> 31#include <klocale.h>
32#include <kglobal.h> 32#include <kglobal.h>
33#include <kiconloader.h> 33#include <kiconloader.h>
34#include <kmessagebox.h> 34#include <kmessagebox.h>
35 35
36#include <libkcal/icaldrag.h> 36#include <libkcal/icaldrag.h>
37#include <libkcal/vcaldrag.h> 37#include <libkcal/vcaldrag.h>
38#include <libkcal/calfilter.h> 38#include <libkcal/calfilter.h>
39#include <libkcal/dndfactory.h> 39#include <libkcal/dndfactory.h>
40#include <libkcal/calendarresources.h> 40#include <libkcal/calendarresources.h>
41#include <libkcal/resourcecalendar.h> 41#include <libkcal/resourcecalendar.h>
42#include <kresources/resourceselectdialog.h> 42#include <kresources/resourceselectdialog.h>
43#ifndef DESKTOP_VERSION 43#ifndef DESKTOP_VERSION
44#include <qpe/qpeapplication.h> 44#include <qpe/qpeapplication.h>
45#else 45#else
46#include <qapplication.h> 46#include <qapplication.h>
47#endif 47#endif
48#ifndef KORG_NOPRINTER 48#ifndef KORG_NOPRINTER
49#include "calprinter.h" 49#include "calprinter.h"
50#endif 50#endif
51#include "docprefs.h" 51#include "docprefs.h"
52 52
53#include "kotodoview.h" 53#include "kotodoview.h"
54using namespace KOrg; 54using namespace KOrg;
55 55
56KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent, 56KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent,
57 const char *name) : 57 const char *name) :
58 KListView(parent,name) 58 KListView(parent,name)
59{ 59{
60 mName = QString ( name ); 60 mName = QString ( name );
61 mCalendar = calendar; 61 mCalendar = calendar;
62#ifndef DESKTOP_VERSION 62#ifndef DESKTOP_VERSION
63 QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); 63 QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold );
64#endif 64#endif
65 mOldCurrent = 0; 65 mOldCurrent = 0;
66 mMousePressed = false; 66 mMousePressed = false;
67 67
68 setAcceptDrops(true); 68 setAcceptDrops(true);
69 viewport()->setAcceptDrops(true); 69 viewport()->setAcceptDrops(true);
70 int size = 16; 70 int size = 16;
71 if (qApp->desktop()->width() < 300 ) 71 if (qApp->desktop()->width() < 300 )
72 size = 12; 72 size = 12;
73 setTreeStepSize( size + 6 ); 73 setTreeStepSize( size + 6 );
74 74
75} 75}
76 76
77void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e) 77void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e)
78{ 78{
79#ifndef KORG_NODND 79#ifndef KORG_NODND
80// kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl; 80// kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl;
81 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && 81 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) &&
82 !QTextDrag::canDecode( e ) ) { 82 !QTextDrag::canDecode( e ) ) {
83 e->ignore(); 83 e->ignore();
84 return; 84 return;
85 } 85 }
86 86
87 mOldCurrent = currentItem(); 87 mOldCurrent = currentItem();
88#endif 88#endif
89} 89}
90 90
91 91
92void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e) 92void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e)
93{ 93{
94#ifndef KORG_NODND 94#ifndef KORG_NODND
95// kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl; 95// kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl;
96 96
97 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && 97 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) &&
98 !QTextDrag::canDecode( e ) ) { 98 !QTextDrag::canDecode( e ) ) {
99 e->ignore(); 99 e->ignore();
100 return; 100 return;
101 } 101 }
102 102
103 e->accept(); 103 e->accept();
104#endif 104#endif
105} 105}
106 106
107void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *) 107void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *)
108{ 108{
109#ifndef KORG_NODND 109#ifndef KORG_NODND
110// kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl; 110// kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl;
111 111
112 setCurrentItem(mOldCurrent); 112 setCurrentItem(mOldCurrent);
113 setSelected(mOldCurrent,true); 113 setSelected(mOldCurrent,true);
114#endif 114#endif
115} 115}
116 116
117void KOTodoListView::contentsDropEvent(QDropEvent *e) 117void KOTodoListView::contentsDropEvent(QDropEvent *e)
118{ 118{
119#ifndef KORG_NODND 119#ifndef KORG_NODND
120// kdDebug() << "KOTodoListView::contentsDropEvent" << endl; 120// kdDebug() << "KOTodoListView::contentsDropEvent" << endl;
121 121
122 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && 122 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) &&
123 !QTextDrag::canDecode( e ) ) { 123 !QTextDrag::canDecode( e ) ) {
124 e->ignore(); 124 e->ignore();
125 return; 125 return;
126 } 126 }
127 127
128 DndFactory factory( mCalendar ); 128 DndFactory factory( mCalendar );
129 Todo *todo = factory.createDropTodo(e); 129 Todo *todo = factory.createDropTodo(e);
130 130
131 if (todo) { 131 if (todo) {
132 e->acceptAction(); 132 e->acceptAction();
133 133
134 KOTodoViewItem *destination = 134 KOTodoViewItem *destination =
135 (KOTodoViewItem *)itemAt(contentsToViewport(e->pos())); 135 (KOTodoViewItem *)itemAt(contentsToViewport(e->pos()));
136 Todo *destinationEvent = 0; 136 Todo *destinationEvent = 0;
137 if (destination) destinationEvent = destination->todo(); 137 if (destination) destinationEvent = destination->todo();
138 138
139 Todo *existingTodo = mCalendar->todo(todo->uid()); 139 Todo *existingTodo = mCalendar->todo(todo->uid());
140 140
141 if(existingTodo) { 141 if(existingTodo) {
142// kdDebug() << "Drop existing Todo" << endl; 142// kdDebug() << "Drop existing Todo" << endl;
143 Incidence *to = destinationEvent; 143 Incidence *to = destinationEvent;
144 while(to) { 144 while(to) {
145 if (to->uid() == todo->uid()) { 145 if (to->uid() == todo->uid()) {
146 KMessageBox::sorry(this, 146 KMessageBox::sorry(this,
147 i18n("Cannot move To-Do to itself or a child of itself"), 147 i18n("Cannot move To-Do to itself or a child of itself"),
148 i18n("Drop To-Do")); 148 i18n("Drop To-Do"));
149 delete todo; 149 delete todo;
150 return; 150 return;
151 } 151 }
152 to = to->relatedTo(); 152 to = to->relatedTo();
153 } 153 }
154 existingTodo->setRelatedTo(destinationEvent); 154 existingTodo->setRelatedTo(destinationEvent);
155 emit todoDropped(todo); 155 emit todoDropped(todo);
156 delete todo; 156 delete todo;
157 } else { 157 } else {
158// kdDebug() << "Drop new Todo" << endl; 158// kdDebug() << "Drop new Todo" << endl;
159 todo->setRelatedTo(destinationEvent); 159 todo->setRelatedTo(destinationEvent);
160 mCalendar->addTodo(todo); 160 mCalendar->addTodo(todo);
161 161
162 emit todoDropped(todo); 162 emit todoDropped(todo);
163 } 163 }
164 } 164 }
165 else { 165 else {
166 QString text; 166 QString text;
167 if (QTextDrag::decode(e,text)) { 167 if (QTextDrag::decode(e,text)) {
168 //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) ); 168 //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) );
169 KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) )); 169 KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) ));
170 kdDebug() << "Dropped : " << text << endl; 170 kdDebug() << "Dropped : " << text << endl;
171 QStringList emails = QStringList::split(",",text); 171 QStringList emails = QStringList::split(",",text);
172 for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { 172 for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) {
173 kdDebug() << " Email: " << (*it) << endl; 173 kdDebug() << " Email: " << (*it) << endl;
174 int pos = (*it).find("<"); 174 int pos = (*it).find("<");
175 QString name = (*it).left(pos); 175 QString name = (*it).left(pos);
176 QString email = (*it).mid(pos); 176 QString email = (*it).mid(pos);
177 if (!email.isEmpty() && todoi) { 177 if (!email.isEmpty() && todoi) {
178 todoi->todo()->addAttendee(new Attendee(name,email)); 178 todoi->todo()->addAttendee(new Attendee(name,email));
179 } 179 }
180 } 180 }
181 } 181 }
182 else { 182 else {
183 kdDebug() << "KOTodoListView::contentsDropEvent(): Todo from drop not decodable" << endl; 183 kdDebug() << "KOTodoListView::contentsDropEvent(): Todo from drop not decodable" << endl;
184 e->ignore(); 184 e->ignore();
185 } 185 }
186 } 186 }
187#endif 187#endif
188} 188}
189 189
190void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) 190void KOTodoListView::contentsMousePressEvent(QMouseEvent* e)
191{ 191{
192 QListView::contentsMousePressEvent(e); 192 QListView::contentsMousePressEvent(e);
193#ifndef KORG_NODND 193#ifndef KORG_NODND
194 QPoint p(contentsToViewport(e->pos())); 194 QPoint p(contentsToViewport(e->pos()));
195 QListViewItem *i = itemAt(p); 195 QListViewItem *i = itemAt(p);
196 if (i) { 196 if (i) {
197 // if the user clicked into the root decoration of the item, don't 197 // if the user clicked into the root decoration of the item, don't
198 // try to start a drag! 198 // try to start a drag!
199 if (p.x() > header()->sectionPos(header()->mapToIndex(0)) + 199 if (p.x() > header()->sectionPos(header()->mapToIndex(0)) +
200 treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + 200 treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) +
201 itemMargin() || 201 itemMargin() ||
202 p.x() < header()->sectionPos(header()->mapToIndex(0))) { 202 p.x() < header()->sectionPos(header()->mapToIndex(0))) {
203 if (e->button()==Qt::LeftButton) { 203 if (e->button()==Qt::LeftButton) {
204 mPressPos = e->pos(); 204 mPressPos = e->pos();
205 mMousePressed = true; 205 mMousePressed = true;
206 } 206 }
207 } 207 }
208 } 208 }
209#endif 209#endif
210} 210}
211 211
212void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) 212void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e)
213{ 213{
214 214
215#ifndef KORG_NODND 215#ifndef KORG_NODND
216// kdDebug() << "KOTodoListView::contentsMouseMoveEvent()" << endl; 216// kdDebug() << "KOTodoListView::contentsMouseMoveEvent()" << endl;
217 QListView::contentsMouseMoveEvent(e); 217 QListView::contentsMouseMoveEvent(e);
218 if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > 218 if (mMousePressed && (mPressPos - e->pos()).manhattanLength() >
219 QApplication::startDragDistance()) { 219 QApplication::startDragDistance()) {
220 mMousePressed = false; 220 mMousePressed = false;
221 QListViewItem *item = itemAt(contentsToViewport(mPressPos)); 221 QListViewItem *item = itemAt(contentsToViewport(mPressPos));
222 if (item) { 222 if (item) {
223// kdDebug() << "Start Drag for item " << item->text(0) << endl; 223// kdDebug() << "Start Drag for item " << item->text(0) << endl;
224 DndFactory factory( mCalendar ); 224 DndFactory factory( mCalendar );
225 ICalDrag *vd = factory.createDragTodo( 225 ICalDrag *vd = factory.createDragTodo(
226 ((KOTodoViewItem *)item)->todo(),viewport()); 226 ((KOTodoViewItem *)item)->todo(),viewport());
227 if (vd->drag()) { 227 if (vd->drag()) {
228 kdDebug() << "KOTodoListView::contentsMouseMoveEvent(): Delete drag source" << endl; 228 kdDebug() << "KOTodoListView::contentsMouseMoveEvent(): Delete drag source" << endl;
229 } 229 }
230/* 230/*
231 QString source = fullPath(item); 231 QString source = fullPath(item);
232 if ( QFile::exists(source) ) { 232 if ( QFile::exists(source) ) {
233 QUriDrag* ud = new QUriDrag(viewport()); 233 QUriDrag* ud = new QUriDrag(viewport());
234 ud->setFilenames( source ); 234 ud->setFilenames( source );
235 if ( ud->drag() ) 235 if ( ud->drag() )
236 QMessageBox::information( this, "Drag source", 236 QMessageBox::information( this, "Drag source",
237 QString("Delete ")+source, "Not implemented" ); 237 QString("Delete ")+source, "Not implemented" );
238*/ 238*/
239 } 239 }
240 } 240 }
241#endif 241#endif
242} 242}
243void KOTodoListView::keyPressEvent ( QKeyEvent * e ) 243void KOTodoListView::keyPressEvent ( QKeyEvent * e )
244{ 244{
245 245
246 QListViewItem* cn; 246 QListViewItem* cn;
247 if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) { 247 if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) {
248 cn = currentItem(); 248 cn = currentItem();
249 if ( cn ) { 249 if ( cn ) {
250 KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); 250 KOTodoViewItem* ci = (KOTodoViewItem*)( cn );
251 if ( ci ){ 251 if ( ci ){
252 if ( e->state() == ShiftButton ) 252 if ( e->state() == ShiftButton )
253 ci->setOn( false ); 253 ci->setOn( false );
254 else 254 else
255 ci->setOn( true ); 255 ci->setOn( true );
256 cn = cn->nextSibling(); 256 cn = cn->nextSibling();
257 if ( cn ) { 257 if ( cn ) {
258 setCurrentItem ( cn ); 258 setCurrentItem ( cn );
259 ensureItemVisible ( cn ); 259 ensureItemVisible ( cn );
260 } 260 }
261 261
262 } 262 }
263 } 263 }
264 264
265 return; 265 return;
266 } 266 }
267 267
268 // qDebug("KOTodoListView::keyPressEvent "); 268 // qDebug("KOTodoListView::keyPressEvent ");
269 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { 269 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) {
270 switch ( e->key() ) { 270 switch ( e->key() ) {
271 case Qt::Key_Down: 271 case Qt::Key_Down:
272 case Qt::Key_Up: 272 case Qt::Key_Up:
273 QListView::keyPressEvent ( e ); 273 QListView::keyPressEvent ( e );
274 break; 274 break;
275 case Qt::Key_Left: 275 case Qt::Key_Left:
276 case Qt::Key_Right: 276 case Qt::Key_Right:
277 QListView::keyPressEvent ( e ); 277 QListView::keyPressEvent ( e );
278 e->accept(); 278 e->accept();
279 return; 279 return;
280 break; 280 break;
281 default: 281 default:
282 e->ignore(); 282 e->ignore();
283 break; 283 break;
284 } 284 }
285 return; 285 return;
286 } 286 }
287 e->ignore(); 287 e->ignore();
288} 288}
289void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) 289void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e)
290{ 290{
291 QListView::contentsMouseReleaseEvent(e); 291 QListView::contentsMouseReleaseEvent(e);
292 mMousePressed = false; 292 mMousePressed = false;
293} 293}
294 294
295void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) 295void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e)
296{ 296{
297 if (!e) return; 297 if (!e) return;
298 298
299 QPoint vp = contentsToViewport(e->pos()); 299 QPoint vp = contentsToViewport(e->pos());
300 300
301 QListViewItem *item = itemAt(vp); 301 QListViewItem *item = itemAt(vp);
302 302
303 emit double_Clicked(item); 303 emit double_Clicked(item);
304 if (!item) return; 304 if (!item) return;
305 305
306 emit doubleClicked(item,vp,0); 306 emit doubleClicked(item,vp,0);
307} 307}
308 308
309///////////////////////////////////////////////////////////////////////////// 309/////////////////////////////////////////////////////////////////////////////
310 310
311KOQuickTodo::KOQuickTodo(QWidget *parent) : 311KOQuickTodo::KOQuickTodo(QWidget *parent) :
312 QLineEdit(parent) 312 QLineEdit(parent)
313{ 313{
314 setText(i18n("Click to add a new Todo")); 314 setText(i18n("Click to add a new Todo"));
315} 315}
316 316
317void KOQuickTodo::focusInEvent(QFocusEvent *ev) 317void KOQuickTodo::focusInEvent(QFocusEvent *ev)
318{ 318{
319 if ( text()==i18n("Click to add a new Todo") ) 319 if ( text()==i18n("Click to add a new Todo") )
320 setText(""); 320 setText("");
321 QLineEdit::focusInEvent(ev); 321 QLineEdit::focusInEvent(ev);
322} 322}
323 323
324void KOQuickTodo::focusOutEvent(QFocusEvent *ev) 324void KOQuickTodo::focusOutEvent(QFocusEvent *ev)
325{ 325{
326 setText(i18n("Click to add a new Todo")); 326 setText(i18n("Click to add a new Todo"));
327 QLineEdit::focusOutEvent(ev); 327 QLineEdit::focusOutEvent(ev);
328} 328}
329 329
330///////////////////////////////////////////////////////////////////////////// 330/////////////////////////////////////////////////////////////////////////////
331 331
332KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : 332KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
333 KOrg::BaseView(calendar,parent,name) 333 KOrg::BaseView(calendar,parent,name)
334{ 334{
335 mNavigator = 0;
335 QBoxLayout *topLayout = new QVBoxLayout(this); 336 QBoxLayout *topLayout = new QVBoxLayout(this);
336 mName = QString ( name ); 337 mName = QString ( name );
337 mBlockUpdate = false; 338 mBlockUpdate = false;
338 mQuickAdd = new KOQuickTodo(this); 339 mQuickAdd = new KOQuickTodo(this);
339 topLayout->addWidget(mQuickAdd); 340 topLayout->addWidget(mQuickAdd);
340 341
341 if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); 342 if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide();
342 343
343 mTodoListView = new KOTodoListView(calendar,this, name ); 344 mTodoListView = new KOTodoListView(calendar,this, name );
344 topLayout->addWidget(mTodoListView); 345 topLayout->addWidget(mTodoListView);
345 //mTodoListView->header()->setMaximumHeight(30); 346 //mTodoListView->header()->setMaximumHeight(30);
346 mTodoListView->setRootIsDecorated(true); 347 mTodoListView->setRootIsDecorated(true);
347 mTodoListView->setAllColumnsShowFocus(true); 348 mTodoListView->setAllColumnsShowFocus(true);
348 349
349 mTodoListView->setShowSortIndicator(true); 350 mTodoListView->setShowSortIndicator(true);
350 351
351 mTodoListView->addColumn(i18n("Todo")); 352 mTodoListView->addColumn(i18n("Todo"));
352 mTodoListView->addColumn(i18n("Prio")); 353 mTodoListView->addColumn(i18n("Prio"));
353 mTodoListView->setColumnAlignment(1,AlignHCenter); 354 mTodoListView->setColumnAlignment(1,AlignHCenter);
354 mTodoListView->addColumn(i18n("Complete")); 355 mTodoListView->addColumn(i18n("Complete"));
355 mTodoListView->setColumnAlignment(2,AlignHCenter); 356 mTodoListView->setColumnAlignment(2,AlignCenter);
357
356 mTodoListView->addColumn(i18n("Due Date")); 358 mTodoListView->addColumn(i18n("Due Date"));
357 mTodoListView->setColumnAlignment(3,AlignLeft); 359 mTodoListView->setColumnAlignment(3,AlignLeft);
358 mTodoListView->addColumn(i18n("Due Time")); 360 mTodoListView->addColumn(i18n("Due Time"));
359 mTodoListView->setColumnAlignment(4,AlignHCenter); 361 mTodoListView->setColumnAlignment(4,AlignHCenter);
362
363 mTodoListView->addColumn(i18n("Start Date"));
364 mTodoListView->setColumnAlignment(5,AlignLeft);
365 mTodoListView->addColumn(i18n("Start Time"));
366 mTodoListView->setColumnAlignment(6,AlignHCenter);
367
360 mTodoListView->addColumn(i18n("Cancelled")); 368 mTodoListView->addColumn(i18n("Cancelled"));
361 mTodoListView->addColumn(i18n("Categories")); 369 mTodoListView->addColumn(i18n("Categories"));
362#if 0 370#if 0
363 mTodoListView->addColumn(i18n("Sort Id")); 371 mTodoListView->addColumn(i18n("Sort Id"));
364 mTodoListView->setColumnAlignment(4,AlignHCenter); 372 mTodoListView->setColumnAlignment(4,AlignHCenter);
365#endif 373#endif
366 374
367 mTodoListView->setMinimumHeight( 60 ); 375 mTodoListView->setMinimumHeight( 60 );
368 mTodoListView->setItemsRenameable( true ); 376 mTodoListView->setItemsRenameable( true );
369 mTodoListView->setRenameable( 0 ); 377 mTodoListView->setRenameable( 0 );
370 mTodoListView->setColumnWidth( 0, 120 ); 378 mTodoListView->setColumnWidth( 0, 120 );
371 mTodoListView->setColumnWidthMode(0, QListView::Manual); 379 mTodoListView->setColumnWidthMode(0, QListView::Manual);
372 mTodoListView->setColumnWidthMode(1, QListView::Manual); 380 mTodoListView->setColumnWidthMode(1, QListView::Manual);
373 mTodoListView->setColumnWidthMode(2, QListView::Manual); 381 mTodoListView->setColumnWidthMode(2, QListView::Manual);
374 mTodoListView->setColumnWidthMode(3, QListView::Manual); 382 mTodoListView->setColumnWidthMode(3, QListView::Manual);
375 mTodoListView->setColumnWidthMode(4, QListView::Manual); 383 mTodoListView->setColumnWidthMode(4, QListView::Manual);
376 mTodoListView->setColumnWidthMode(5, QListView::Manual); 384 mTodoListView->setColumnWidthMode(5, QListView::Manual);
377 mTodoListView->setColumnWidthMode(6, QListView::Manual); 385 mTodoListView->setColumnWidthMode(6, QListView::Manual);
378 mTodoListView->setColumnAlignment( 2, AlignCenter ); 386 mTodoListView->setColumnWidthMode(7, QListView::Manual);
379#if 0 387 mTodoListView->setColumnWidthMode(8, QListView::Manual);
380 mTodoListView->setColumnWidthMode(6, QListView::Manual); 388
381#endif
382 389
383 mPriorityPopupMenu = new QPopupMenu(this); 390 mPriorityPopupMenu = new QPopupMenu(this);
384 for (int i = 1; i <= 5; i++) { 391 for (int i = 1; i <= 5; i++) {
385 QString label = QString ("%1").arg (i); 392 QString label = QString ("%1").arg (i);
386 mPriority[mPriorityPopupMenu->insertItem (label)] = i; 393 mPriority[mPriorityPopupMenu->insertItem (label)] = i;
387 } 394 }
388 connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); 395 connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int)));
389 396
390 mPercentageCompletedPopupMenu = new QPopupMenu(this); 397 mPercentageCompletedPopupMenu = new QPopupMenu(this);
391 for (int i = 0; i <= 100; i+=20) { 398 for (int i = 0; i <= 100; i+=20) {
392 QString label = QString ("%1 %").arg (i); 399 QString label = QString ("%1 %").arg (i);
393 mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; 400 mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i;
394 } 401 }
395 connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); 402 connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int)));
396 403
397 404
398 405
399 mItemPopupMenu = new QPopupMenu(this); 406 mItemPopupMenu = new QPopupMenu(this);
400 mItemPopupMenu->insertItem(i18n("Show..."), this, 407 mItemPopupMenu->insertItem(i18n("Show..."), this,
401 SLOT (showTodo())); 408 SLOT (showTodo()));
402 mItemPopupMenu->insertItem(i18n("Edit..."), this, 409 mItemPopupMenu->insertItem(i18n("Edit..."), this,
403 SLOT (editTodo())); 410 SLOT (editTodo()));
404 mItemPopupMenu->insertItem( i18n("Delete"), this, 411 mItemPopupMenu->insertItem( i18n("Delete"), this,
405 SLOT (deleteTodo())); 412 SLOT (deleteTodo()));
406 mItemPopupMenu->insertItem( i18n("Clone..."), this, 413 mItemPopupMenu->insertItem( i18n("Clone..."), this,
407 SLOT (cloneTodo())); 414 SLOT (cloneTodo()));
408 mItemPopupMenu->insertItem( i18n("Move..."), this, 415 mItemPopupMenu->insertItem( i18n("Move..."), this,
409 SLOT (moveTodo())); 416 SLOT (moveTodo()));
410 mItemPopupMenu->insertItem( i18n("Beam..."), this, 417 mItemPopupMenu->insertItem( i18n("Beam..."), this,
411 SLOT (beamTodo())); 418 SLOT (beamTodo()));
412 mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, 419 mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this,
413 SLOT (cancelTodo())); 420 SLOT (cancelTodo()));
414 mItemPopupMenu->insertSeparator(); 421 mItemPopupMenu->insertSeparator();
415 422
416 mItemPopupMenu->insertItem( i18n("New Todo..."), this, 423 mItemPopupMenu->insertItem( i18n("New Todo..."), this,
417 SLOT (newTodo())); 424 SLOT (newTodo()));
418 mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, 425 mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this,
419 SLOT (newSubTodo())); 426 SLOT (newSubTodo()));
420 mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, 427 mItemPopupMenu->insertItem(i18n("Unparent Todo"), this,
421 SLOT (unparentTodo()),0,21); 428 SLOT (unparentTodo()),0,21);
422 mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, 429 mItemPopupMenu->insertItem(i18n("Reparent Todo"), this,
423 SLOT (reparentTodo()),0,22); 430 SLOT (reparentTodo()),0,22);
424 mItemPopupMenu->insertSeparator(); 431 mItemPopupMenu->insertSeparator();
425 mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), 432 mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"),
426 this, SLOT( purgeCompleted() ) ); 433 this, SLOT( purgeCompleted() ) );
427 mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), 434 mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"),
428 this, SLOT( toggleCompleted() ),0, 33 ); 435 this, SLOT( toggleCompleted() ),0, 33 );
429 mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), 436 mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"),
430 this, SLOT( toggleQuickTodo() ),0, 34 ); 437 this, SLOT( toggleQuickTodo() ),0, 34 );
438 mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"),
439 this, SLOT( toggleRunning() ),0, 35 );
431 440
432 mPopupMenu = new QPopupMenu(this); 441 mPopupMenu = new QPopupMenu(this);
433 mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, 442 mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this,
434 SLOT (newTodo()),0,1); 443 SLOT (newTodo()),0,1);
435 mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), 444 mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"),
436 this, SLOT(purgeCompleted()),0,2); 445 this, SLOT(purgeCompleted()),0,2);
437 mPopupMenu->insertItem(i18n("Show Completed"), 446 mPopupMenu->insertItem(i18n("Show Completed"),
438 this, SLOT( toggleCompleted() ),0,3 ); 447 this, SLOT( toggleCompleted() ),0,3 );
439 mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), 448 mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"),
440 this, SLOT( toggleQuickTodo() ),0,4 ); 449 this, SLOT( toggleQuickTodo() ),0,4 );
450 mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"),
451 this, SLOT( toggleRunning() ),0,5 );
441 mDocPrefs = new DocPrefs( name ); 452 mDocPrefs = new DocPrefs( name );
442 453
443 mPopupMenu->setCheckable( true ); 454 mPopupMenu->setCheckable( true );
444 mItemPopupMenu->setCheckable( true ); 455 mItemPopupMenu->setCheckable( true );
456
457
458 mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo );
459 mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo );
460
461 mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo);
462 mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo );
463
464 mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos);
465 mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos );
466
467
445 // Double clicking conflicts with opening/closing the subtree 468 // Double clicking conflicts with opening/closing the subtree
446 connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), 469 connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ),
447 SLOT( editItem( QListViewItem *) ) ); 470 SLOT( editItem( QListViewItem *) ) );
448 /* 471 /*
449 connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, 472 connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *,
450 const QPoint &,int ) ), 473 const QPoint &,int ) ),
451 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); 474 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) );
452 */ 475 */
453 connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, 476 connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *,
454 const QPoint &,int ) ), 477 const QPoint &,int ) ),
455 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); 478 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) );
456 connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), 479 connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ),
457 SLOT( itemClicked( QListViewItem * ) ) ); 480 SLOT( itemClicked( QListViewItem * ) ) );
458 connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), 481 connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ),
459 SLOT( itemDoubleClicked( QListViewItem * ) ) ); 482 SLOT( itemDoubleClicked( QListViewItem * ) ) );
460 connect( mTodoListView, SIGNAL( todoDropped( Todo * ) ), 483 connect( mTodoListView, SIGNAL( todoDropped( Todo * ) ),
461 SLOT( updateView() ) ); 484 SLOT( updateView() ) );
462 connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), 485 connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ),
463 SLOT( itemStateChanged( QListViewItem * ) ) ); 486 SLOT( itemStateChanged( QListViewItem * ) ) );
464 connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), 487 connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ),
465 SLOT( itemStateChanged( QListViewItem * ) ) ); 488 SLOT( itemStateChanged( QListViewItem * ) ) );
466 489
467#if 0 490#if 0
468 connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), 491 connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)),
469 SLOT(selectionChanged(QListViewItem *))); 492 SLOT(selectionChanged(QListViewItem *)));
470 connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), 493 connect(mTodoListView,SIGNAL(clicked(QListViewItem *)),
471 SLOT(selectionChanged(QListViewItem *))); 494 SLOT(selectionChanged(QListViewItem *)));
472 connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), 495 connect(mTodoListView,SIGNAL(pressed(QListViewItem *)),
473 SLOT(selectionChanged(QListViewItem *))); 496 SLOT(selectionChanged(QListViewItem *)));
474#endif 497#endif
475 connect( mTodoListView, SIGNAL(selectionChanged() ), 498 connect( mTodoListView, SIGNAL(selectionChanged() ),
476 SLOT( processSelectionChange() ) ); 499 SLOT( processSelectionChange() ) );
477 connect( mQuickAdd, SIGNAL( returnPressed () ), 500 connect( mQuickAdd, SIGNAL( returnPressed () ),
478 SLOT( addQuickTodo() ) ); 501 SLOT( addQuickTodo() ) );
479// if ( QApplication::desktop()->width() < 480 ) {
480// setNarrow();
481 // mTodoListView->setColumnWidth( 0, 100 );
482
483 // }
484 502
485} 503}
486 504
487KOTodoView::~KOTodoView() 505KOTodoView::~KOTodoView()
488{ 506{
489 delete mDocPrefs; 507 delete mDocPrefs;
490} 508}
491 509
492void KOTodoView::jumpToDate () 510void KOTodoView::jumpToDate ()
493{ 511{
494 // if (mActiveItem) { 512 // if (mActiveItem) {
495// mActiveItem->todo()); 513// mActiveItem->todo());
496// if ( mActiveItem->todo()->hasDueDate() ) 514// if ( mActiveItem->todo()->hasDueDate() )
497// emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); 515// emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() );
498} 516}
499 517
500void KOTodoView::setNarrow()
501{
502 //mTodoListView->setColumnWidth( 0, 120 );
503 mTodoListView->setColumnWidth( 1, 35 );
504 mTodoListView->setColumnWidth( 2, 40 );
505 mTodoListView->setColumnWidth( 3, 80 );
506 mTodoListView->setColumnWidth( 4, 40 );
507 mTodoListView->setColumnWidth( 5, 90 );
508
509}
510void KOTodoView::updateView() 518void KOTodoView::updateView()
511{ 519{
512 pendingSubtodo = 0; 520 pendingSubtodo = 0;
513 if ( mBlockUpdate ) { 521 if ( mBlockUpdate ) {
514 //qDebug("blocked "); 522 //qDebug("blocked ");
515 return; 523 return;
516 } 524 }
517 //qDebug("update "); 525 //qDebug("update ");
518// kdDebug() << "KOTodoView::updateView()" << endl; 526// kdDebug() << "KOTodoView::updateView()" << endl;
519 QFont fo = KOPrefs::instance()->mTodoViewFont; 527 QFont fo = KOPrefs::instance()->mTodoViewFont;
520 mTodoListView->clear(); 528 mTodoListView->clear();
521 if ( mName == "todolistsmall" ) { 529 if ( mName == "todolistsmall" ) {
522 if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { 530 if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) {
523 int ps = fo.pointSize() -2; 531 int ps = fo.pointSize() -2;
524 if ( ps > 12 ) 532 if ( ps > 12 )
525 ps -= 2; 533 ps -= 2;
526 fo.setPointSize( ps ); 534 fo.setPointSize( ps );
527 } 535 }
528 } 536 }
529 537
530 mTodoListView->setFont( fo ); 538 mTodoListView->setFont( fo );
531 // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); 539 // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont );
532 //mTodoListView->header()->setMaximumHeight(fm.height()); 540 //mTodoListView->header()->setMaximumHeight(fm.height());
533 QPtrList<Todo> todoList = calendar()->todos(); 541 QPtrList<Todo> todoList = calendar()->todos();
534 542
535/* 543/*
536 kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; 544 kdDebug() << "KOTodoView::updateView(): Todo List:" << endl;
537 Event *t; 545 Event *t;
538 for(t = todoList.first(); t; t = todoList.next()) { 546 for(t = todoList.first(); t; t = todoList.next()) {
539 kdDebug() << " " << t->getSummary() << endl; 547 kdDebug() << " " << t->getSummary() << endl;
540 548
541 if (t->getRelatedTo()) { 549 if (t->getRelatedTo()) {
542 kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; 550 kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl;
543 } 551 }
544 552
545 QPtrList<Event> l = t->getRelations(); 553 QPtrList<Event> l = t->getRelations();
546 Event *c; 554 Event *c;
547 for(c=l.first();c;c=l.next()) { 555 for(c=l.first();c;c=l.next()) {
548 kdDebug() << " - relation: " << c->getSummary() << endl; 556 kdDebug() << " - relation: " << c->getSummary() << endl;
549 } 557 }
550 } 558 }
551*/ 559*/
552 560
553 // Put for each Event a KOTodoViewItem in the list view. Don't rely on a 561 // Put for each Event a KOTodoViewItem in the list view. Don't rely on a
554 // specific order of events. That means that we have to generate parent items 562 // specific order of events. That means that we have to generate parent items
555 // recursively for proper hierarchical display of Todos. 563 // recursively for proper hierarchical display of Todos.
556 mTodoMap.clear(); 564 mTodoMap.clear();
557 Todo *todo; 565 Todo *todo;
558 todo = todoList.first();// todo; todo = todoList.next()) { 566 todo = todoList.first();// todo; todo = todoList.next()) {
559 while ( todo ) { 567 while ( todo ) {
560 bool next = true; 568 bool next = true;
561 // qDebug("todo %s ", todo->summary().latin1()); 569 // qDebug("todo %s ", todo->summary().latin1());
562 Incidence *incidence = todo->relatedTo(); 570 Incidence *incidence = todo->relatedTo();
563 while ( incidence ) { 571 while ( incidence ) {
564 if ( incidence->type() == "Todo") { 572 if ( incidence->type() == "Todo") {
565 //qDebug("related %s ",incidence->summary().latin1() ); 573 //qDebug("related %s ",incidence->summary().latin1() );
566 if ( !(todoList.contains ( ((Todo* )incidence ) ) )) { 574 if ( !(todoList.contains ( ((Todo* )incidence ) ) )) {
567 //qDebug("related not found "); 575 //qDebug("related not found ");
568 todoList.remove( ); 576 todoList.remove( );
569 todo = todoList.current(); 577 todo = todoList.current();
570 next = false; 578 next = false;
571 incidence = 0; 579 incidence = 0;
572 580
573 } else { 581 } else {
574 //qDebug("related found "); 582 //qDebug("related found ");
575 incidence = incidence->relatedTo(); 583 incidence = incidence->relatedTo();
576 } 584 }
577 } else 585 } else
578 incidence = 0; 586 incidence = 0;
579 } 587 }
580 if ( next ) 588 if ( next )
581 todo = todoList.next(); 589 todo = todoList.next();
582 } 590 }
583// qDebug("again .... "); 591// qDebug("again .... ");
584// for(todo = todoList.first(); todo; todo = todoList.next()) { 592// for(todo = todoList.first(); todo; todo = todoList.next()) {
585 593
586// qDebug("yytodo %s ", todo->summary().latin1()); 594// qDebug("yytodo %s ", todo->summary().latin1());
587// } 595// }
588 //qDebug("for "); 596 //qDebug("for ");
589 for(todo = todoList.first(); todo; todo = todoList.next()) { 597 for(todo = todoList.first(); todo; todo = todoList.next()) {
590 if (!mTodoMap.contains(todo) && ( KOPrefs::instance()->mShowCompletedTodo || !todo->isCompleted() ) ) 598 if (!mTodoMap.contains(todo) && checkTodo( todo ) )
591 { 599 {
592 insertTodoItem(todo); 600 insertTodoItem(todo);
593 } 601 }
594 } 602 }
595 //qDebug("for end "); 603 //qDebug("for end ");
596 // Restore opened/closed state 604 // Restore opened/closed state
597 mTodoListView->blockSignals( true ); 605 mTodoListView->blockSignals( true );
598 if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); 606 if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() );
599 mTodoListView->blockSignals( false ); 607 mTodoListView->blockSignals( false );
600 mTodoListView->setFocus(); 608 mTodoListView->setFocus();
601 processSelectionChange(); 609 processSelectionChange();
602} 610}
603 611
612bool KOTodoView::checkTodo( Todo * todo )
613{
614
615 if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() )
616 return false;
617 if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) {
618 if ( todo->hasStartDate() )
619 if ( mNavigator->selectedDates().last() < todo->dtStart().date() )
620 return false;
621 if ( todo->hasDueDate() )
622 if ( mNavigator->selectedDates().first() > todo->dtDue().date() )
623 return false;
624 }
625 return true;
626}
627
604void KOTodoView::restoreItemState( QListViewItem *item ) 628void KOTodoView::restoreItemState( QListViewItem *item )
605{ 629{
606 pendingSubtodo = 0; 630 pendingSubtodo = 0;
607 while( item ) { 631 while( item ) {
608 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 632 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
609 todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); 633 todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) );
610 if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); 634 if( item->childCount() > 0 ) restoreItemState( item->firstChild() );
611 item = item->nextSibling(); 635 item = item->nextSibling();
612 } 636 }
613} 637}
614 638
615 639
616QMap<Todo *,KOTodoViewItem *>::ConstIterator 640QMap<Todo *,KOTodoViewItem *>::ConstIterator
617 KOTodoView::insertTodoItem(Todo *todo) 641 KOTodoView::insertTodoItem(Todo *todo)
618{ 642{
643
619// kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl; 644// kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl;
620 // TODO: Check, if dynmaic cast is necessary 645 // TODO: Check, if dynmaic cast is necessary
621 646
622 pendingSubtodo = 0; 647 pendingSubtodo = 0;
623 Incidence *incidence = todo->relatedTo(); 648 Incidence *incidence = todo->relatedTo();
624 if (incidence && incidence->type() == "Todo") { 649 if (incidence && incidence->type() == "Todo") {
625 Todo *relatedTodo = static_cast<Todo *>(incidence); 650 Todo *relatedTodo = static_cast<Todo *>(incidence);
626 651
627// kdDebug() << " has Related" << endl; 652// kdDebug() << " has Related" << endl;
628 QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; 653 QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator;
629 itemIterator = mTodoMap.find(relatedTodo); 654 itemIterator = mTodoMap.find(relatedTodo);
630 if (itemIterator == mTodoMap.end()) { 655 if (itemIterator == mTodoMap.end()) {
631// kdDebug() << " related not yet in list" << endl; 656// kdDebug() << " related not yet in list" << endl;
632 itemIterator = insertTodoItem (relatedTodo); 657 itemIterator = insertTodoItem (relatedTodo);
633 } 658 }
634 // isn't this pretty stupid? We give one Todo to the KOTodoViewItem 659 // isn't this pretty stupid? We give one Todo to the KOTodoViewItem
635 // and one into the map. Sure finding is more easy but why? -zecke 660 // and one into the map. Sure finding is more easy but why? -zecke
636 KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this); 661 KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this);
637 return mTodoMap.insert(todo,todoItem); 662 return mTodoMap.insert(todo,todoItem);
638 } else { 663 } else {
639// kdDebug() << " no Related" << endl; 664// kdDebug() << " no Related" << endl;
640 // see above -zecke 665 // see above -zecke
641 KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); 666 KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this);
642 return mTodoMap.insert(todo,todoItem); 667 return mTodoMap.insert(todo,todoItem);
643 } 668 }
644} 669}
645 670
646 671
647void KOTodoView::updateConfig() 672void KOTodoView::updateConfig()
648{ 673{
649 updateView(); 674 updateView();
650 mTodoListView->repaintContents(); 675 mTodoListView->repaintContents();
651} 676}
652 677
653QPtrList<Incidence> KOTodoView::selectedIncidences() 678QPtrList<Incidence> KOTodoView::selectedIncidences()
654{ 679{
655 QPtrList<Incidence> selected; 680 QPtrList<Incidence> selected;
656 681
657 KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); 682 KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem());
658// if (!item) item = mActiveItem; 683// if (!item) item = mActiveItem;
659 if (item) selected.append(item->todo()); 684 if (item) selected.append(item->todo());
660 685
661 return selected; 686 return selected;
662} 687}
663 688
664QPtrList<Todo> KOTodoView::selectedTodos() 689QPtrList<Todo> KOTodoView::selectedTodos()
665{ 690{
666 QPtrList<Todo> selected; 691 QPtrList<Todo> selected;
667 692
668 KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); 693 KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem());
669// if (!item) item = mActiveItem; 694// if (!item) item = mActiveItem;
670 if (item) selected.append(item->todo()); 695 if (item) selected.append(item->todo());
671 696
672 return selected; 697 return selected;
673} 698}
674 699
675void KOTodoView::changeEventDisplay(Event *, int) 700void KOTodoView::changeEventDisplay(Event *, int)
676{ 701{
677 updateView(); 702 updateView();
678} 703}
679 704
680void KOTodoView::showDates(const QDate &, const QDate &) 705void KOTodoView::showDates(const QDate &, const QDate &)
681{ 706{
682} 707}
683 708
684void KOTodoView::showEvents(QPtrList<Event>) 709void KOTodoView::showEvents(QPtrList<Event>)
685{ 710{
686 kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl; 711 kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl;
687} 712}
688 713
689void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd, 714void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd,
690 const QDate &td) 715 const QDate &td)
691{ 716{
692#ifndef KORG_NOPRINTER 717#ifndef KORG_NOPRINTER
693 calPrinter->preview(CalPrinter::Todolist, fd, td); 718 calPrinter->preview(CalPrinter::Todolist, fd, td);
694#endif 719#endif
695} 720}
696 721
697void KOTodoView::editItem(QListViewItem *item ) 722void KOTodoView::editItem(QListViewItem *item )
698{ 723{
699 // qDebug("editItem(QListViewItem *item ) "); 724 // qDebug("editItem(QListViewItem *item ) ");
700 emit editTodoSignal(((KOTodoViewItem *)item)->todo()); 725 emit editTodoSignal(((KOTodoViewItem *)item)->todo());
701} 726}
702 727
703void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) 728void KOTodoView::showItem(QListViewItem *item,const QPoint &,int)
704{ 729{
705 emit showTodoSignal(((KOTodoViewItem *)item)->todo()); 730 emit showTodoSignal(((KOTodoViewItem *)item)->todo());
706} 731}
707 732
708void KOTodoView::popupMenu(QListViewItem *item,const QPoint &,int column) 733void KOTodoView::popupMenu(QListViewItem *item,const QPoint &,int column)
709{ 734{
710 pendingSubtodo = 0; 735 pendingSubtodo = 0;
711 mActiveItem = (KOTodoViewItem *)item; 736 mActiveItem = (KOTodoViewItem *)item;
712 if (item) { 737 if (item) {
713 switch (column){ 738 switch (column){
714 case 1: 739 case 1:
715 mPriorityPopupMenu->popup(QCursor::pos ()); break; 740 mPriorityPopupMenu->popup(QCursor::pos ()); break;
716 case 2: 741 case 2:
717 mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break; 742 mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break;
718 case 3: 743 case 3:
719 moveTodo(); 744 moveTodo();
720 break; 745 break;
721 case 6: 746 case 8:
722 getCategoryPopupMenu((KOTodoViewItem *)item)->popup(QCursor::pos ()); break; 747 getCategoryPopupMenu((KOTodoViewItem *)item)->popup(QCursor::pos ()); break;
723 default: 748 default:
724 mItemPopupMenu->popup(QCursor::pos()); 749 mItemPopupMenu->popup(QCursor::pos());
725 } 750 }
726 } else mPopupMenu->popup(QCursor::pos()); 751 } else mPopupMenu->popup(QCursor::pos());
727} 752}
728void KOTodoView::newTodo() 753void KOTodoView::newTodo()
729{ 754{
730 emit newTodoSignal(); 755 emit newTodoSignal();
731} 756}
732 757
733void KOTodoView::newSubTodo() 758void KOTodoView::newSubTodo()
734{ 759{
735 if (mActiveItem) { 760 if (mActiveItem) {
736 emit newSubTodoSignal(mActiveItem->todo()); 761 emit newSubTodoSignal(mActiveItem->todo());
737 } 762 }
738} 763}
739void KOTodoView::unparentTodo() 764void KOTodoView::unparentTodo()
740{ 765{
741 if (mActiveItem) { 766 if (mActiveItem) {
742 emit unparentTodoSignal(mActiveItem->todo()); 767 emit unparentTodoSignal(mActiveItem->todo());
743 } 768 }
744} 769}
745 770
746void KOTodoView::reparentTodo() 771void KOTodoView::reparentTodo()
747{ 772{
748 if (mActiveItem) { 773 if (mActiveItem) {
749 qDebug("KOTodoView::reparentTodo() "); 774 qDebug("KOTodoView::reparentTodo() ");
750 topLevelWidget()->setCaption(i18n("Click on new parent item")); 775 topLevelWidget()->setCaption(i18n("Click on new parent item"));
751 pendingSubtodo = mActiveItem; 776 pendingSubtodo = mActiveItem;
752 } 777 }
753} 778}
754void KOTodoView::editTodo() 779void KOTodoView::editTodo()
755{ 780{
756 if (mActiveItem) { 781 if (mActiveItem) {
757 emit editTodoSignal(mActiveItem->todo()); 782 emit editTodoSignal(mActiveItem->todo());
758 } 783 }
759} 784}
760void KOTodoView::cloneTodo() 785void KOTodoView::cloneTodo()
761{ 786{
762 if (mActiveItem) { 787 if (mActiveItem) {
763 emit cloneTodoSignal((Incidence*)mActiveItem->todo()); 788 emit cloneTodoSignal((Incidence*)mActiveItem->todo());
764 } 789 }
765} 790}
766void KOTodoView::cancelTodo() 791void KOTodoView::cancelTodo()
767{ 792{
768 if (mActiveItem) { 793 if (mActiveItem) {
769 emit cancelTodoSignal((Incidence*)mActiveItem->todo()); 794 emit cancelTodoSignal((Incidence*)mActiveItem->todo());
770 } 795 }
771} 796}
772void KOTodoView::moveTodo() 797void KOTodoView::moveTodo()
773{ 798{
774 if (mActiveItem) { 799 if (mActiveItem) {
775 emit moveTodoSignal((Incidence*)mActiveItem->todo()); 800 emit moveTodoSignal((Incidence*)mActiveItem->todo());
776 } 801 }
777} 802}
778void KOTodoView::beamTodo() 803void KOTodoView::beamTodo()
779{ 804{
780 if (mActiveItem) { 805 if (mActiveItem) {
781 emit beamTodoSignal((Incidence*)mActiveItem->todo()); 806 emit beamTodoSignal((Incidence*)mActiveItem->todo());
782 } 807 }
783} 808}
784 809
785 810
786void KOTodoView::showTodo() 811void KOTodoView::showTodo()
787{ 812{
788 if (mActiveItem) { 813 if (mActiveItem) {
789 emit showTodoSignal(mActiveItem->todo()); 814 emit showTodoSignal(mActiveItem->todo());
790 } 815 }
791} 816}
792 817
793void KOTodoView::deleteTodo() 818void KOTodoView::deleteTodo()
794{ 819{
795 if (mActiveItem) { 820 if (mActiveItem) {
796 if (mActiveItem->childCount()) { 821 if (mActiveItem->childCount()) {
797 KMessageBox::sorry(this,i18n("Cannot delete To-Do which has children."), 822 KMessageBox::sorry(this,i18n("Cannot delete To-Do which has children."),
798 i18n("Delete To-Do")); 823 i18n("Delete To-Do"));
799 } else { 824 } else {
800 emit deleteTodoSignal(mActiveItem->todo()); 825 emit deleteTodoSignal(mActiveItem->todo());
801 } 826 }
802 } 827 }
803} 828}
804 829
805void KOTodoView::setNewPriority(int index) 830void KOTodoView::setNewPriority(int index)
806{ 831{
807 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { 832 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
808 mActiveItem->todo()->setPriority(mPriority[index]); 833 mActiveItem->todo()->setPriority(mPriority[index]);
809 mActiveItem->construct(); 834 mActiveItem->construct();
810 todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED); 835 todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED);
811 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 836 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
812 } 837 }
813} 838}
814 839
815void KOTodoView::setNewPercentage(int index) 840void KOTodoView::setNewPercentage(int index)
816{ 841{
817 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { 842 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
818 if (mPercentage[index] == 100) { 843 if (mPercentage[index] == 100) {
819 mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); 844 mActiveItem->todo()->setCompleted(QDateTime::currentDateTime());
820 } else { 845 } else {
821 mActiveItem->todo()->setCompleted(false); 846 mActiveItem->todo()->setCompleted(false);
822 } 847 }
823 mActiveItem->todo()->setPercentComplete(mPercentage[index]); 848 mActiveItem->todo()->setPercentComplete(mPercentage[index]);
824 mActiveItem->construct(); 849 mActiveItem->construct();
825 todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); 850 todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED);
826 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 851 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
827 } 852 }
828} 853}
829 854
830 855
831QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) 856QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem)
832{ 857{
833 QPopupMenu* tempMenu = new QPopupMenu (this); 858 QPopupMenu* tempMenu = new QPopupMenu (this);
834 QStringList checkedCategories = todoItem->todo()->categories (); 859 QStringList checkedCategories = todoItem->todo()->categories ();
835 860
836 tempMenu->setCheckable (true); 861 tempMenu->setCheckable (true);
837 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); 862 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin ();
838 it != KOPrefs::instance()->mCustomCategories.end (); 863 it != KOPrefs::instance()->mCustomCategories.end ();
839 ++it) { 864 ++it) {
840 int index = tempMenu->insertItem (*it); 865 int index = tempMenu->insertItem (*it);
841 mCategory[index] = *it; 866 mCategory[index] = *it;
842 if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true); 867 if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true);
843 } 868 }
844 869
845 connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); 870 connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int)));
846 return tempMenu; 871 return tempMenu;
847 872
848 873
849} 874}
850void KOTodoView::changedCategories(int index) 875void KOTodoView::changedCategories(int index)
851{ 876{
852 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { 877 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
853 QStringList categories = mActiveItem->todo()->categories (); 878 QStringList categories = mActiveItem->todo()->categories ();
854 if (categories.find (mCategory[index]) != categories.end ()) 879 if (categories.find (mCategory[index]) != categories.end ())
855 categories.remove (mCategory[index]); 880 categories.remove (mCategory[index]);
856 else 881 else
857 categories.insert (categories.end(), mCategory[index]); 882 categories.insert (categories.end(), mCategory[index]);
858 categories.sort (); 883 categories.sort ();
859 mActiveItem->todo()->setCategories (categories); 884 mActiveItem->todo()->setCategories (categories);
860 mActiveItem->construct(); 885 mActiveItem->construct();
861 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 886 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
862 todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); 887 todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED);
863 } 888 }
864} 889}
865void KOTodoView::itemDoubleClicked(QListViewItem *item) 890void KOTodoView::itemDoubleClicked(QListViewItem *item)
866{ 891{
867 if ( pendingSubtodo != 0 ) { 892 if ( pendingSubtodo != 0 ) {
868 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 893 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
869 } 894 }
870 pendingSubtodo = 0; 895 pendingSubtodo = 0;
871 if (!item) { 896 if (!item) {
872 newTodo(); 897 newTodo();
873 return; 898 return;
874 } 899 }
875 if ( KOPrefs::instance()->mEditOnDoubleClick ) 900 if ( KOPrefs::instance()->mEditOnDoubleClick )
876 editItem( item ); 901 editItem( item );
877 else 902 else
878 showItem( item , QPoint(), 0 ); 903 showItem( item , QPoint(), 0 );
879} 904}
880void KOTodoView::itemClicked(QListViewItem *item) 905void KOTodoView::itemClicked(QListViewItem *item)
881{ 906{
882 907
883 if (!item) { 908 if (!item) {
884 if ( pendingSubtodo != 0 ) { 909 if ( pendingSubtodo != 0 ) {
885 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 910 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
886 } 911 }
887 pendingSubtodo = 0; 912 pendingSubtodo = 0;
888 return; 913 return;
889 } 914 }
890 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 915 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
891 if ( pendingSubtodo != 0 ) { 916 if ( pendingSubtodo != 0 ) {
892 bool allowReparent = true; 917 bool allowReparent = true;
893 QListViewItem *par = item; 918 QListViewItem *par = item;
894 while ( par ) { 919 while ( par ) {
895 if ( par == pendingSubtodo ) { 920 if ( par == pendingSubtodo ) {
896 allowReparent = false; 921 allowReparent = false;
897 break; 922 break;
898 } 923 }
899 par = par->parent(); 924 par = par->parent();
900 } 925 }
901 if ( !allowReparent ) { 926 if ( !allowReparent ) {
902 topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); 927 topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!"));
903 qDebug("Recursive reparenting not possible "); 928 qDebug("Recursive reparenting not possible ");
904 pendingSubtodo = 0; 929 pendingSubtodo = 0;
905 } else { 930 } else {
906 Todo* newParent = todoItem->todo(); 931 Todo* newParent = todoItem->todo();
907 Todo* newSub = pendingSubtodo->todo(); 932 Todo* newSub = pendingSubtodo->todo();
908 pendingSubtodo = 0; 933 pendingSubtodo = 0;
909 emit reparentTodoSignal( newParent,newSub ); 934 emit reparentTodoSignal( newParent,newSub );
910 return; 935 return;
911 } 936 }
912 } 937 }
913 int completed = todoItem->todo()->isCompleted(); // Completed or not? 938 int completed = todoItem->todo()->isCompleted(); // Completed or not?
914 939
915 if (todoItem->isOn()) { 940 if (todoItem->isOn()) {
916 if (!completed) { 941 if (!completed) {
917 todoItem->todo()->setCompleted(QDateTime::currentDateTime()); 942 todoItem->todo()->setCompleted(QDateTime::currentDateTime());
918 } 943 }
919 } else { 944 } else {
920 if (completed) { 945 if (completed) {
921 todoItem->todo()->setCompleted(false); 946 todoItem->todo()->setCompleted(false);
922 } 947 }
923 } 948 }
924} 949}
925 950
926void KOTodoView::setDocumentId( const QString &id ) 951void KOTodoView::setDocumentId( const QString &id )
927{ 952{
928 kdDebug() << "KOTodoView::setDocumentId()" << endl; 953 kdDebug() << "KOTodoView::setDocumentId()" << endl;
929 954
930 mDocPrefs->setDoc( id ); 955 mDocPrefs->setDoc( id );
931} 956}
932 957
933void KOTodoView::itemStateChanged( QListViewItem *item ) 958void KOTodoView::itemStateChanged( QListViewItem *item )
934{ 959{
935 if (!item) return; 960 if (!item) return;
936 961
937 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 962 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
938 963
939// kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; 964// kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl;
940 965
941 if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); 966 if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() );
942} 967}
943 968
944void KOTodoView::saveLayout(KConfig *config, const QString &group) const 969void KOTodoView::saveLayout(KConfig *config, const QString &group) const
945{ 970{
946 mTodoListView->saveLayout(config,group); 971 mTodoListView->saveLayout(config,group);
947} 972}
948 973
949void KOTodoView::restoreLayout(KConfig *config, const QString &group) 974void KOTodoView::restoreLayout(KConfig *config, const QString &group)
950{ 975{
951 mTodoListView->restoreLayout(config,group); 976 mTodoListView->restoreLayout(config,group);
952} 977}
953 978
954void KOTodoView::processSelectionChange() 979void KOTodoView::processSelectionChange()
955{ 980{
956// kdDebug() << "KOTodoView::processSelectionChange()" << endl; 981// kdDebug() << "KOTodoView::processSelectionChange()" << endl;
957 982
958 KOTodoViewItem *item = 983 KOTodoViewItem *item =
959 static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() ); 984 static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() );
960 985
961 if ( !item ) { 986 if ( !item ) {
962 emit incidenceSelected( 0 ); 987 emit incidenceSelected( 0 );
963 } else { 988 } else {
964 emit incidenceSelected( item->todo() ); 989 emit incidenceSelected( item->todo() );
965 } 990 }
966} 991}
967 992
968void KOTodoView::modified(bool b) 993void KOTodoView::modified(bool b)
969{ 994{
970 emit isModified(b); 995 emit isModified(b);
971} 996}
972void KOTodoView::setTodoModified( Todo* todo ) 997void KOTodoView::setTodoModified( Todo* todo )
973{ 998{
974 todoModified( todo, KOGlobals::UNKNOWN_MODIFIED ); 999 todoModified( todo, KOGlobals::UNKNOWN_MODIFIED );
975} 1000}
976void KOTodoView::clearSelection() 1001void KOTodoView::clearSelection()
977{ 1002{
978 mTodoListView->selectAll( false ); 1003 mTodoListView->selectAll( false );
979} 1004}
980 1005
981void KOTodoView::purgeCompleted() 1006void KOTodoView::purgeCompleted()
982{ 1007{
983 emit purgeCompletedSignal(); 1008 emit purgeCompletedSignal();
984} 1009}
985void KOTodoView::toggleQuickTodo() 1010void KOTodoView::toggleQuickTodo()
986{ 1011{
987 if ( mQuickAdd->isVisible() ) { 1012 if ( mQuickAdd->isVisible() ) {
988 mQuickAdd->hide(); 1013 mQuickAdd->hide();
989 KOPrefs::instance()->mEnableQuickTodo = false; 1014 KOPrefs::instance()->mEnableQuickTodo = false;
990 } 1015 }
991 else { 1016 else {
992 mQuickAdd->show(); 1017 mQuickAdd->show();
993 KOPrefs::instance()->mEnableQuickTodo = true; 1018 KOPrefs::instance()->mEnableQuickTodo = true;
994 } 1019 }
995 mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); 1020 mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo);
996 mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); 1021 mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo );
997} 1022}
1023
1024void KOTodoView::toggleRunning()
1025{
1026 KOPrefs::instance()->mHideNonStartedTodos = !KOPrefs::instance()->mHideNonStartedTodos;
1027 mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos);
1028 mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos );
1029 updateView();
1030}
1031
998void KOTodoView::toggleCompleted() 1032void KOTodoView::toggleCompleted()
999{ 1033{
1000 KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo; 1034 KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo;
1001 mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); 1035 mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo );
1002 mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); 1036 mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo );
1003 updateView(); 1037 updateView();
1004} 1038}
1005 1039
1006void KOTodoView::addQuickTodo() 1040void KOTodoView::addQuickTodo()
1007{ 1041{
1008 Todo *todo = new Todo(); 1042 Todo *todo = new Todo();
1009 todo->setSummary(mQuickAdd->text()); 1043 todo->setSummary(mQuickAdd->text());
1010 todo->setOrganizer(KOPrefs::instance()->email()); 1044 todo->setOrganizer(KOPrefs::instance()->email());
1011 CalFilter * cf = mCalendar->filter(); 1045 CalFilter * cf = mCalendar->filter();
1012 if ( cf ) { 1046 if ( cf ) {
1013 if ( cf->isEnabled()&& cf->showCategories()) { 1047 if ( cf->isEnabled()&& cf->showCategories()) {
1014 todo->setCategories(cf->categoryList()); 1048 todo->setCategories(cf->categoryList());
1015 } 1049 }
1016 if ( cf->isEnabled() ) 1050 if ( cf->isEnabled() )
1017 todo->setSecrecy( cf->getSecrecy()); 1051 todo->setSecrecy( cf->getSecrecy());
1018 } 1052 }
1019 mCalendar->addTodo(todo); 1053 mCalendar->addTodo(todo);
1020 mQuickAdd->setText(""); 1054 mQuickAdd->setText("");
1021 todoModified (todo, KOGlobals::EVENTADDED ); 1055 todoModified (todo, KOGlobals::EVENTADDED );
1022 updateView(); 1056 updateView();
1023} 1057}
1024void KOTodoView::keyPressEvent ( QKeyEvent * e ) 1058void KOTodoView::keyPressEvent ( QKeyEvent * e )
1025{ 1059{
1026 // e->ignore(); 1060 // e->ignore();
1027 //return; 1061 //return;
1028 //qDebug("KOTodoView::keyPressEvent "); 1062 //qDebug("KOTodoView::keyPressEvent ");
1029 switch ( e->key() ) { 1063 switch ( e->key() ) {
1030 case Qt::Key_Down: 1064 case Qt::Key_Down:
1031 case Qt::Key_Up: 1065 case Qt::Key_Up:
1032 QWidget::keyPressEvent ( e ); 1066 QWidget::keyPressEvent ( e );
1033 break; 1067 break;
1034 1068
1035 case Qt::Key_Q: 1069 case Qt::Key_Q:
1036 toggleQuickTodo(); 1070 toggleQuickTodo();
1037 break; 1071 break;
1038 case Qt::Key_U: 1072 case Qt::Key_U:
1039 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { 1073 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) {
1040 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); 1074 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
1041 unparentTodo(); 1075 unparentTodo();
1042 e->accept(); 1076 e->accept();
1043 } else 1077 } else
1044 e->ignore(); 1078 e->ignore();
1045 break; 1079 break;
1046 case Qt::Key_S: 1080 case Qt::Key_S:
1047 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { 1081 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) {
1048 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); 1082 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
1049 reparentTodo(); 1083 reparentTodo();
1050 e->accept(); 1084 e->accept();
1051 } else 1085 } else
1052 e->ignore(); 1086 e->ignore();
1053 break; 1087 break;
1054 case Qt::Key_P: 1088 case Qt::Key_P:
1055 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { 1089 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) {
1056 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); 1090 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
1057 if ( pendingSubtodo ) 1091 if ( pendingSubtodo )
1058 itemClicked(mActiveItem); 1092 itemClicked(mActiveItem);
1059 e->accept(); 1093 e->accept();
1060 } else 1094 } else
1061 e->ignore(); 1095 e->ignore();
1062 break; 1096 break;
1063 case Qt::Key_Escape: 1097 case Qt::Key_Escape:
1064 if ( pendingSubtodo ) { 1098 if ( pendingSubtodo ) {
1065 itemClicked(0); 1099 itemClicked(0);
1066 e->accept(); 1100 e->accept();
1067 } else 1101 } else
1068 e->ignore(); 1102 e->ignore();
1069 break; 1103 break;
1070 default: 1104 default:
1071 e->ignore(); 1105 e->ignore();
1072 } 1106 }
1073 1107
1074 if ( true ) { 1108 if ( true ) {
1075 if ( e->key() == Qt::Key_I ) { 1109 if ( e->key() == Qt::Key_I ) {
1076 KOTodoViewItem*cn = (KOTodoViewItem*)mTodoListView->currentItem(); 1110 KOTodoViewItem*cn = (KOTodoViewItem*)mTodoListView->currentItem();
1077 if ( cn ) { 1111 if ( cn ) {
1078 mActiveItem = cn; 1112 mActiveItem = cn;
1079 KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); 1113 KOTodoViewItem* ci = (KOTodoViewItem*)( cn );
1080 if ( ci ){ 1114 if ( ci ){
1081 showTodo(); 1115 showTodo();
1082 cn = (KOTodoViewItem*)cn->itemBelow(); 1116 cn = (KOTodoViewItem*)cn->itemBelow();
1083 if ( cn ) { 1117 if ( cn ) {
1084 mTodoListView->setCurrentItem ( cn ); 1118 mTodoListView->setCurrentItem ( cn );
1085 mTodoListView->ensureItemVisible ( cn ); 1119 mTodoListView->ensureItemVisible ( cn );
1086 } 1120 }
1087 1121
1088 } 1122 }
1089 } 1123 }
1090 e->accept(); 1124 e->accept();
1091 1125
1092 } 1126 }
1093 1127
1094 } 1128 }
1095 1129
1096} 1130}
1097void KOTodoView::updateTodo( Todo * t, int type ) 1131void KOTodoView::updateTodo( Todo * t, int type )
1098{ 1132{
1099 if ( mBlockUpdate) 1133 if ( mBlockUpdate)
1100 return; 1134 return;
1101 1135
1102 QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; 1136 QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator;
1103 itemIterator = mTodoMap.find(t); 1137 itemIterator = mTodoMap.find(t);
1104 if (itemIterator != mTodoMap.end()) { 1138 if (itemIterator != mTodoMap.end()) {
1105 (*itemIterator)->construct(); 1139 (*itemIterator)->construct();
1106 } else { 1140 } else {
1107 if ( type == KOGlobals::EVENTADDED ) { 1141 if ( type == KOGlobals::EVENTADDED ) {
1108 insertTodoItem( t ); 1142 insertTodoItem( t );
1109 } 1143 }
1110 } 1144 }
1111 1145
1112} 1146}
1113 1147
1114void KOTodoView::todoModified(Todo * t , int p ) 1148void KOTodoView::todoModified(Todo * t , int p )
1115{ 1149{
1116 mBlockUpdate = true; 1150 mBlockUpdate = true;
1117 emit todoModifiedSignal ( t, p ); 1151 emit todoModifiedSignal ( t, p );
1118 mBlockUpdate = false; 1152 mBlockUpdate = false;
1119} 1153}
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h
index 0c08677..5ca0362 100644
--- a/korganizer/kotodoview.h
+++ b/korganizer/kotodoview.h
@@ -1,234 +1,239 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000, 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000, 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef KOTODOVIEW_H 23#ifndef KOTODOVIEW_H
24#define KOTODOVIEW_H 24#define KOTODOVIEW_H
25 25
26#include <qfont.h> 26#include <qfont.h>
27#include <qfontmetrics.h> 27#include <qfontmetrics.h>
28#include <qlineedit.h> 28#include <qlineedit.h>
29#include <qptrlist.h> 29#include <qptrlist.h>
30#include <qstrlist.h> 30#include <qstrlist.h>
31#include <qlistbox.h> 31#include <qlistbox.h>
32#include <qpopupmenu.h> 32#include <qpopupmenu.h>
33#include <qlabel.h> 33#include <qlabel.h>
34#include <qmap.h> 34#include <qmap.h>
35#include <qlistview.h> 35#include <qlistview.h>
36#include <klistview.h> 36#include <klistview.h>
37 37
38#include <libkcal/calendar.h> 38#include <libkcal/calendar.h>
39#include <libkcal/todo.h> 39#include <libkcal/todo.h>
40 40
41#include <korganizer/baseview.h> 41#include <korganizer/baseview.h>
42 42
43#include "kotodoviewitem.h" 43#include "kotodoviewitem.h"
44#include "koprefs.h" 44#include "koprefs.h"
45#include "koglobals.h" 45#include "koglobals.h"
46#include "datenavigator.h"
46 47
47class QDragEnterEvent; 48class QDragEnterEvent;
48class QDragMoveEvent; 49class QDragMoveEvent;
49class QDragLeaveEvent; 50class QDragLeaveEvent;
50class QDropEvent; 51class QDropEvent;
51 52
52class DocPrefs; 53class DocPrefs;
53 54
54class KOTodoListView : public KListView 55class KOTodoListView : public KListView
55{ 56{
56 Q_OBJECT 57 Q_OBJECT
57 public: 58 public:
58 KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0); 59 KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0);
59 virtual ~KOTodoListView() {} 60 virtual ~KOTodoListView() {}
60 61
61 signals: 62 signals:
62 void todoDropped(Todo *); 63 void todoDropped(Todo *);
63 void double_Clicked(QListViewItem *item); 64 void double_Clicked(QListViewItem *item);
64 65
65 protected: 66 protected:
66 void contentsDragEnterEvent(QDragEnterEvent *); 67 void contentsDragEnterEvent(QDragEnterEvent *);
67 void contentsDragMoveEvent(QDragMoveEvent *); 68 void contentsDragMoveEvent(QDragMoveEvent *);
68 void contentsDragLeaveEvent(QDragLeaveEvent *); 69 void contentsDragLeaveEvent(QDragLeaveEvent *);
69 void contentsDropEvent(QDropEvent *); 70 void contentsDropEvent(QDropEvent *);
70 71
71 void contentsMousePressEvent(QMouseEvent *); 72 void contentsMousePressEvent(QMouseEvent *);
72 void contentsMouseMoveEvent(QMouseEvent *); 73 void contentsMouseMoveEvent(QMouseEvent *);
73 void contentsMouseReleaseEvent(QMouseEvent *); 74 void contentsMouseReleaseEvent(QMouseEvent *);
74 void contentsMouseDoubleClickEvent(QMouseEvent *); 75 void contentsMouseDoubleClickEvent(QMouseEvent *);
75 76
76 private: 77 private:
77 QString mName; 78 QString mName;
78 Calendar *mCalendar; 79 Calendar *mCalendar;
79 QPoint mPressPos; 80 QPoint mPressPos;
80 bool mMousePressed; 81 bool mMousePressed;
81 QListViewItem *mOldCurrent; 82 QListViewItem *mOldCurrent;
82 void keyPressEvent ( QKeyEvent * ) ; 83 void keyPressEvent ( QKeyEvent * ) ;
83}; 84};
84 85
85 86
86/** 87/**
87 This is the line-edit on top of the todoview for fast addition of new todos 88 This is the line-edit on top of the todoview for fast addition of new todos
88*/ 89*/
89class KOQuickTodo : public QLineEdit 90class KOQuickTodo : public QLineEdit
90{ 91{
91 public: 92 public:
92 KOQuickTodo(QWidget *parent=0); 93 KOQuickTodo(QWidget *parent=0);
93 protected: 94 protected:
94 void focusInEvent(QFocusEvent *ev); 95 void focusInEvent(QFocusEvent *ev);
95 void focusOutEvent(QFocusEvent *ev); 96 void focusOutEvent(QFocusEvent *ev);
96}; 97};
97 98
98 99
99/** 100/**
100 This class provides a multi-column list view of todo events. 101 This class provides a multi-column list view of todo events.
101 102
102 @short multi-column list view of todo events. 103 @short multi-column list view of todo events.
103 @author Cornelius Schumacher <schumacher@kde.org> 104 @author Cornelius Schumacher <schumacher@kde.org>
104*/ 105*/
105class KOTodoView : public KOrg::BaseView 106class KOTodoView : public KOrg::BaseView
106{ 107{
107 Q_OBJECT 108 Q_OBJECT
108 public: 109 public:
109 KOTodoView(Calendar *, QWidget* parent=0, const char* name=0 ); 110 KOTodoView(Calendar *, QWidget* parent=0, const char* name=0 );
110 ~KOTodoView(); 111 ~KOTodoView();
111 112
112 QPtrList<Incidence> selectedIncidences(); 113 QPtrList<Incidence> selectedIncidences();
113 QPtrList<Todo> selectedTodos(); 114 QPtrList<Todo> selectedTodos();
114 115
115 DateList selectedDates() 116 DateList selectedDates()
116 {DateList q; 117 {DateList q;
117 return q;} 118 return q;}
118 119
119 /** Return number of shown dates. TodoView does not show dates, */ 120 /** Return number of shown dates. TodoView does not show dates, */
120 int currentDateCount() { return 0; } 121 int currentDateCount() { return 0; }
121 void setNarrow();
122 122
123 void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td); 123 void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td);
124 124
125 void setDocumentId( const QString & ); 125 void setDocumentId( const QString & );
126 126
127 void saveLayout(KConfig *config, const QString &group) const; 127 void saveLayout(KConfig *config, const QString &group) const;
128 void restoreLayout(KConfig *config, const QString &group); 128 void restoreLayout(KConfig *config, const QString &group);
129 /** Create a popup menu to set categories */ 129 /** Create a popup menu to set categories */
130 QPopupMenu *getCategoryPopupMenu (KOTodoViewItem *todoItem); 130 QPopupMenu *getCategoryPopupMenu (KOTodoViewItem *todoItem);
131 void setNavigator( DateNavigator* nav ) {mNavigator = nav;}
131 132
132 public slots: 133 public slots:
133 void updateView(); 134 void updateView();
134 void updateConfig(); 135 void updateConfig();
135 136
136 void changeEventDisplay(Event *, int); 137 void changeEventDisplay(Event *, int);
137 138
138 void showDates(const QDate &start, const QDate &end); 139 void showDates(const QDate &start, const QDate &end);
139 void showEvents(QPtrList<Event> eventList); 140 void showEvents(QPtrList<Event> eventList);
140 141
141 void clearSelection(); 142 void clearSelection();
142 void jumpToDate (); 143 void jumpToDate ();
143 144
144 void editItem(QListViewItem *item); 145 void editItem(QListViewItem *item);
145 void showItem(QListViewItem *item,const QPoint &,int); 146 void showItem(QListViewItem *item,const QPoint &,int);
146 void popupMenu(QListViewItem *item,const QPoint &,int); 147 void popupMenu(QListViewItem *item,const QPoint &,int);
147 void newTodo(); 148 void newTodo();
148 void newSubTodo(); 149 void newSubTodo();
149 void unparentTodo(); 150 void unparentTodo();
150 void reparentTodo(); 151 void reparentTodo();
151 void showTodo(); 152 void showTodo();
152 void editTodo(); 153 void editTodo();
153 void cloneTodo(); 154 void cloneTodo();
154 void cancelTodo(); 155 void cancelTodo();
155 void moveTodo(); 156 void moveTodo();
156 void beamTodo(); 157 void beamTodo();
157 void deleteTodo(); 158 void deleteTodo();
158 159
159 void setNewPriority(int); 160 void setNewPriority(int);
160 void setNewPercentage(int); 161 void setNewPercentage(int);
161 void changedCategories(int); 162 void changedCategories(int);
162 163
163 void purgeCompleted(); 164 void purgeCompleted();
164 void toggleCompleted(); 165 void toggleCompleted();
166 void toggleRunning();
165 void toggleQuickTodo(); 167 void toggleQuickTodo();
166 void updateTodo( Todo *, int ); 168 void updateTodo( Todo *, int );
167 169
168 void itemClicked(QListViewItem *); 170 void itemClicked(QListViewItem *);
169 void itemStateChanged(QListViewItem *); 171 void itemStateChanged(QListViewItem *);
170 void modified(bool); 172 void modified(bool);
171 void itemDoubleClicked(QListViewItem *item); 173 void itemDoubleClicked(QListViewItem *item);
172 174
173 signals: 175 signals:
174 void newTodoSignal(); 176 void newTodoSignal();
175 void newSubTodoSignal(Todo *); 177 void newSubTodoSignal(Todo *);
176 void unparentTodoSignal(Todo *); 178 void unparentTodoSignal(Todo *);
177 void reparentTodoSignal( Todo *,Todo * ); 179 void reparentTodoSignal( Todo *,Todo * );
178 void showTodoSignal(Todo *); 180 void showTodoSignal(Todo *);
179 181
180 void editTodoSignal(Todo *); 182 void editTodoSignal(Todo *);
181 void deleteTodoSignal(Todo *); 183 void deleteTodoSignal(Todo *);
182 void todoModifiedSignal (Todo *, int); 184 void todoModifiedSignal (Todo *, int);
183 185
184 void isModified(bool); 186 void isModified(bool);
185 void cloneTodoSignal( Incidence * ); 187 void cloneTodoSignal( Incidence * );
186 void cancelTodoSignal( Incidence * ); 188 void cancelTodoSignal( Incidence * );
187 void moveTodoSignal( Incidence * ); 189 void moveTodoSignal( Incidence * );
188 void beamTodoSignal( Incidence * ); 190 void beamTodoSignal( Incidence * );
189 void purgeCompletedSignal(); 191 void purgeCompletedSignal();
190 192
191 protected slots: 193 protected slots:
192 void processSelectionChange(); 194 void processSelectionChange();
193 void addQuickTodo(); 195 void addQuickTodo();
194 196
195 private: 197 private:
196 /* 198 /*
197 * the TodoEditor approach is rather unscaling in the long 199 * the TodoEditor approach is rather unscaling in the long
198 * run. 200 * run.
199 * Korganizer keeps it in memory and we need to update 201 * Korganizer keeps it in memory and we need to update
200 * 1. make KOTodoViewItem a QObject again? 202 * 1. make KOTodoViewItem a QObject again?
201 * 2. add a public method for setting one todo modified? 203 * 2. add a public method for setting one todo modified?
202 * 3. add a private method for setting a todo modified + friend here? 204 * 3. add a private method for setting a todo modified + friend here?
203 * -- zecke 2002-07-08 205 * -- zecke 2002-07-08
204 */ 206 */
205 friend class KOTodoViewItem; 207 friend class KOTodoViewItem;
206 void setTodoModified( Todo* ); 208 void setTodoModified( Todo* );
207 QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo); 209 QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo);
208 void restoreItemState( QListViewItem * ); 210 void restoreItemState( QListViewItem * );
209 211
212 bool checkTodo( Todo * );
213
210 KOTodoListView *mTodoListView; 214 KOTodoListView *mTodoListView;
211 QPopupMenu *mItemPopupMenu; 215 QPopupMenu *mItemPopupMenu;
212 QPopupMenu *mPopupMenu; 216 QPopupMenu *mPopupMenu;
213 QPopupMenu *mPriorityPopupMenu; 217 QPopupMenu *mPriorityPopupMenu;
214 QPopupMenu *mPercentageCompletedPopupMenu; 218 QPopupMenu *mPercentageCompletedPopupMenu;
215 QPopupMenu *mCategoryPopupMenu; 219 QPopupMenu *mCategoryPopupMenu;
216 220
217 QMap<int, int> mPercentage; 221 QMap<int, int> mPercentage;
218 QMap<int, int> mPriority; 222 QMap<int, int> mPriority;
219 QMap<int, QString> mCategory; 223 QMap<int, QString> mCategory;
220 KOTodoViewItem *mActiveItem; 224 KOTodoViewItem *mActiveItem;
221 225
222 QMap<Todo *,KOTodoViewItem *> mTodoMap; 226 QMap<Todo *,KOTodoViewItem *> mTodoMap;
223 QString mName; 227 QString mName;
224 228
225 DocPrefs *mDocPrefs; 229 DocPrefs *mDocPrefs;
226 QString mCurrentDoc; 230 QString mCurrentDoc;
227 KOQuickTodo *mQuickAdd; 231 KOQuickTodo *mQuickAdd;
228 bool mBlockUpdate; 232 bool mBlockUpdate;
229 void todoModified(Todo *, int ); 233 void todoModified(Todo *, int );
230 void keyPressEvent ( QKeyEvent * ) ; 234 void keyPressEvent ( QKeyEvent * ) ;
231 KOTodoViewItem * pendingSubtodo; 235 KOTodoViewItem * pendingSubtodo;
236 DateNavigator* mNavigator;
232}; 237};
233 238
234#endif 239#endif
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp
index ae0b334..347d982 100644
--- a/korganizer/kotodoviewitem.cpp
+++ b/korganizer/kotodoviewitem.cpp
@@ -1,432 +1,457 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#include <klocale.h> 20#include <klocale.h>
21#include <kdebug.h> 21#include <kdebug.h>
22#include <qapp.h> 22#include <qapp.h>
23 23
24#include <kiconloader.h> 24#include <kiconloader.h>
25#include "kotodoviewitem.h" 25#include "kotodoviewitem.h"
26#include "kotodoview.h" 26#include "kotodoview.h"
27#include "koprefs.h" 27#include "koprefs.h"
28 28
29KOTodoViewItem::KOTodoViewItem( QListView *parent, Todo *todo, KOTodoView *kotodo) 29KOTodoViewItem::KOTodoViewItem( QListView *parent, Todo *todo, KOTodoView *kotodo)
30 : QCheckListItem( parent , "", CheckBox ), mTodo( todo ), mTodoView( kotodo ) 30 : QCheckListItem( parent , "", CheckBox ), mTodo( todo ), mTodoView( kotodo )
31{ 31{
32 construct(); 32 construct();
33} 33}
34 34
35KOTodoViewItem::KOTodoViewItem( KOTodoViewItem *parent, Todo *todo, KOTodoView *kotodo ) 35KOTodoViewItem::KOTodoViewItem( KOTodoViewItem *parent, Todo *todo, KOTodoView *kotodo )
36 : QCheckListItem( parent, "", CheckBox ), mTodo( todo ), mTodoView( kotodo ) 36 : QCheckListItem( parent, "", CheckBox ), mTodo( todo ), mTodoView( kotodo )
37{ 37{
38 construct(); 38 construct();
39} 39}
40 40
41QString KOTodoViewItem::key(int column,bool) const 41QString KOTodoViewItem::key(int column,bool) const
42{ 42{
43 QMap<int,QString>::ConstIterator it = mKeyMap.find(column); 43 QMap<int,QString>::ConstIterator it = mKeyMap.find(column);
44 if (it == mKeyMap.end()) { 44 if (it == mKeyMap.end()) {
45 return text(column).lower(); 45 return text(column).lower();
46 } else { 46 } else {
47 return *it; 47 return *it;
48 } 48 }
49} 49}
50 50
51void KOTodoViewItem:: setup() 51void KOTodoViewItem:: setup()
52{ 52{
53 53
54 int h = 20; 54 int h = 20;
55 if ( listView () ) { 55 if ( listView () ) {
56 QFontMetrics fm ( listView ()->font () ); 56 QFontMetrics fm ( listView ()->font () );
57 h = fm.height(); 57 h = fm.height();
58 } 58 }
59 setHeight( h ); 59 setHeight( h );
60 60
61} 61}
62void KOTodoViewItem::setSortKey(int column,const QString &key) 62void KOTodoViewItem::setSortKey(int column,const QString &key)
63{ 63{
64 mKeyMap.insert(column,key); 64 mKeyMap.insert(column,key);
65} 65}
66 66
67#if QT_VERSION >= 300 67#if QT_VERSION >= 300
68void KOTodoViewItem::paintBranches(QPainter *p,const QColorGroup & cg,int w, 68void KOTodoViewItem::paintBranches(QPainter *p,const QColorGroup & cg,int w,
69 int y,int h) 69 int y,int h)
70{ 70{
71 QListViewItem::paintBranches(p,cg,w,y,h); 71 QListViewItem::paintBranches(p,cg,w,y,h);
72} 72}
73#else 73#else
74#endif 74#endif
75 75
76void KOTodoViewItem::construct() 76void KOTodoViewItem::construct()
77{ 77{
78 // qDebug("KOTodoViewItem::construct() "); 78 // qDebug("KOTodoViewItem::construct() ");
79 m_init = true; 79 m_init = true;
80 QString keyd = "=="; 80 QString keyd = "==";
81 QString keyt = "=="; 81 QString keyt = "==";
82 QString skeyd = "==";
83 QString skeyt = "==";
82 84
83 setOn(mTodo->isCompleted()); 85 setOn(mTodo->isCompleted());
84 setText(0,mTodo->summary()); 86 setText(0,mTodo->summary());
85 setText(1,QString::number(mTodo->priority())); 87 setText(1,QString::number(mTodo->priority()));
86 setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); 88 setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete())));
87 if (mTodo->percentComplete()<100) { 89 if (mTodo->percentComplete()<100) {
88 if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); 90 if (mTodo->isCompleted()) setSortKey(2,QString::number(999));
89 else setSortKey(2,QString::number(mTodo->percentComplete())); 91 else setSortKey(2,QString::number(mTodo->percentComplete()));
90 } 92 }
91 else { 93 else {
92 if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); 94 if (mTodo->isCompleted()) setSortKey(2,QString::number(999));
93 else setSortKey(2,QString::number(99)); 95 else setSortKey(2,QString::number(99));
94 } 96 }
95 if (mTodo->hasDueDate()) { 97 if (mTodo->hasDueDate()) {
96 setText(3, mTodo->dtDueDateStr()); 98 setText(3, mTodo->dtDueDateStr());
97 QDate d = mTodo->dtDue().date(); 99 QDate d = mTodo->dtDue().date();
98 keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); 100 keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
99 setSortKey(3,keyd); 101 // setSortKey(3,keyd);
100 if (mTodo->doesFloat()) { 102 if (mTodo->doesFloat()) {
101 setText(4,""); 103 setText(4,"");
102 } 104 }
103 else { 105 else {
104 setText(4,mTodo->dtDueTimeStr()); 106 setText(4,mTodo->dtDueTimeStr());
105 QTime t = mTodo->dtDue().time(); 107 QTime t = mTodo->dtDue().time();
106 keyt.sprintf("%02d%02d",t.hour(),t.minute()); 108 keyt.sprintf("%02d%02d",t.hour(),t.minute());
107 setSortKey(4,keyt); 109 //setSortKey(4,keyt);
108 } 110 }
109 } else { 111 } else {
110 setText(3,""); 112 setText(3,"");
111 setText(4,""); 113 setText(4,"");
112 } 114 }
113 setSortKey(3,keyd); 115 setSortKey(3,keyd);
114 setSortKey(4,keyt); 116 setSortKey(4,keyt);
115 117
116 if (mTodo->isCompleted()) setSortKey(1,"6" + QString::number(mTodo->priority())+keyd+keyt); 118 if (mTodo->isCompleted()) setSortKey(1,"6" + QString::number(mTodo->priority())+keyd+keyt);
117 else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); 119 else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt);
118 120
119 setText(5,mTodo->cancelled() ? i18n("Yes") : i18n("No")); 121
120 setText(6,mTodo->categoriesStr()); 122
123 if (mTodo->hasStartDate()) {
124 setText(5, mTodo->dtStartDateStr());
125 QDate d = mTodo->dtStart().date();
126 skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
127
128 if (mTodo->doesFloat()) {
129 setText(6,"");
130 }
131 else {
132 setText(6,mTodo->dtStartTimeStr());
133 QTime t = mTodo->dtStart().time();
134 skeyt.sprintf("%02d%02d",t.hour(),t.minute());
135
136 }
137 } else {
138 setText(5,"");
139 setText(6,"");
140 }
141 setSortKey(5,skeyd);
142 setSortKey(6,skeyt);
143
144 setText(7,mTodo->cancelled() ? i18n("Yes") : i18n("No"));
145 setText(8,mTodo->categoriesStr());
121 146
122#if 0 147#if 0
123 // Find sort id in description. It's the text behind the last '#' character 148 // Find sort id in description. It's the text behind the last '#' character
124 // found in the description. White spaces are removed from beginning and end 149 // found in the description. White spaces are removed from beginning and end
125 // of sort id. 150 // of sort id.
126 int pos = mTodo->description().findRev('#'); 151 int pos = mTodo->description().findRev('#');
127 if (pos < 0) { 152 if (pos < 0) {
128 setText(6,""); 153 setText(6,"");
129 } else { 154 } else {
130 QString str = mTodo->description().mid(pos+1); 155 QString str = mTodo->description().mid(pos+1);
131 str.stripWhiteSpace(); 156 str.stripWhiteSpace();
132 setText(6,str); 157 setText(6,str);
133 } 158 }
134#endif 159#endif
135 160
136 m_known = false; 161 m_known = false;
137 m_init = false; 162 m_init = false;
138 163
139 setMyPixmap(); 164 setMyPixmap();
140 165
141} 166}
142void KOTodoViewItem::setMyPixmap() 167void KOTodoViewItem::setMyPixmap()
143{ 168{
144 int size = 5; 169 int size = 5;
145 QPixmap pixi = QPixmap( 1, 1 ); 170 QPixmap pixi = QPixmap( 1, 1 );
146 // if ( !mTodo->isCompleted() && mTodo->hasDueDate() && mTodo->dtDue() < QDateTime::currentDateTime() ) { 171 // if ( !mTodo->isCompleted() && mTodo->hasDueDate() && mTodo->dtDue() < QDateTime::currentDateTime() ) {
147// pixi = SmallIcon("redcross16"); 172// pixi = SmallIcon("redcross16");
148// } else { 173// } else {
149 QPainter p; 174 QPainter p;
150 175
151 int pixSize = 0; 176 int pixSize = 0;
152 QPixmap pPix = QPixmap( size, size ); 177 QPixmap pPix = QPixmap( size, size );
153 if ( mTodo->description().length() > 0 ) { 178 if ( mTodo->description().length() > 0 ) {
154 pixi.resize(size, pixSize+size); 179 pixi.resize(size, pixSize+size);
155 pPix.fill( Qt::darkGreen ); 180 pPix.fill( Qt::darkGreen );
156 p.begin( &pixi ); 181 p.begin( &pixi );
157 p. drawPixmap ( 0, pixSize, pPix); 182 p. drawPixmap ( 0, pixSize, pPix);
158 p.end(); 183 p.end();
159 pixSize += size; 184 pixSize += size;
160 } 185 }
161 if ( mTodo->isAlarmEnabled() ) { 186 if ( mTodo->isAlarmEnabled() ) {
162 pixi.resize(size, pixSize+size); 187 pixi.resize(size, pixSize+size);
163 pPix.fill( Qt::red ); 188 pPix.fill( Qt::red );
164 p.begin( &pixi ); 189 p.begin( &pixi );
165 p. drawPixmap ( 0, pixSize, pPix); 190 p. drawPixmap ( 0, pixSize, pPix);
166 p.end(); 191 p.end();
167 pixSize += size; 192 pixSize += size;
168 } 193 }
169 // } 194 // }
170 if ( pixi.width() > 1 ) { 195 if ( pixi.width() > 1 ) {
171 setPixmap ( 0,pixi ) ; 196 setPixmap ( 0,pixi ) ;
172 } 197 }
173 198
174 199
175} 200}
176void KOTodoViewItem::stateChange(bool state) 201void KOTodoViewItem::stateChange(bool state)
177{ 202{
178 // qDebug("KOTodoViewItem::stateChange "); 203 // qDebug("KOTodoViewItem::stateChange ");
179 // do not change setting on startup 204 // do not change setting on startup
180 if ( m_init ) return; 205 if ( m_init ) return;
181 206
182 kdDebug() << "State changed, modified " << state << endl; 207 kdDebug() << "State changed, modified " << state << endl;
183 QString keyd = "=="; 208 QString keyd = "==";
184 QString keyt = "=="; 209 QString keyt = "==";
185 210
186 if (state) mTodo->setCompleted(state); 211 if (state) mTodo->setCompleted(state);
187 else mTodo->setPercentComplete(0); 212 else mTodo->setPercentComplete(0);
188 if (isOn()!=state) { 213 if (isOn()!=state) {
189 setOn(state); 214 setOn(state);
190 } 215 }
191 216
192 if (mTodo->hasDueDate()) { 217 if (mTodo->hasDueDate()) {
193 setText(3, mTodo->dtDueDateStr()); 218 setText(3, mTodo->dtDueDateStr());
194 QDate d = mTodo->dtDue().date(); 219 QDate d = mTodo->dtDue().date();
195 keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); 220 keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
196 setSortKey(3,keyd); 221 setSortKey(3,keyd);
197 if (mTodo->doesFloat()) { 222 if (mTodo->doesFloat()) {
198 setText(4,""); 223 setText(4,"");
199 } 224 }
200 else { 225 else {
201 setText(4,mTodo->dtDueTimeStr()); 226 setText(4,mTodo->dtDueTimeStr());
202 QTime t = mTodo->dtDue().time(); 227 QTime t = mTodo->dtDue().time();
203 keyt.sprintf("%02d%02d",t.hour(),t.minute()); 228 keyt.sprintf("%02d%02d",t.hour(),t.minute());
204 setSortKey(4,keyt); 229 setSortKey(4,keyt);
205 } 230 }
206 } 231 }
207 if (mTodo->isCompleted()) setSortKey(1,QString::number(9)+keyd+keyt); 232 if (mTodo->isCompleted()) setSortKey(1,QString::number(9)+keyd+keyt);
208 else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); 233 else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt);
209 234
210 setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); 235 setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete())));
211 if (mTodo->percentComplete()<100) { 236 if (mTodo->percentComplete()<100) {
212 if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); 237 if (mTodo->isCompleted()) setSortKey(2,QString::number(999));
213 else setSortKey(2,QString::number(mTodo->percentComplete())); 238 else setSortKey(2,QString::number(mTodo->percentComplete()));
214 } 239 }
215 else { 240 else {
216 if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); 241 if (mTodo->isCompleted()) setSortKey(2,QString::number(999));
217 else setSortKey(2,QString::number(99)); 242 else setSortKey(2,QString::number(99));
218 } 243 }
219 QListViewItem * myChild = firstChild(); 244 QListViewItem * myChild = firstChild();
220 KOTodoViewItem *item; 245 KOTodoViewItem *item;
221 while( myChild ) { 246 while( myChild ) {
222 item = static_cast<KOTodoViewItem*>(myChild); 247 item = static_cast<KOTodoViewItem*>(myChild);
223 item->stateChange(state); 248 item->stateChange(state);
224 myChild = myChild->nextSibling(); 249 myChild = myChild->nextSibling();
225 } 250 }
226 mTodoView->modified(true); 251 mTodoView->modified(true);
227 mTodoView->setTodoModified( mTodo ); 252 mTodoView->setTodoModified( mTodo );
228 setMyPixmap(); 253 setMyPixmap();
229} 254}
230 255
231bool KOTodoViewItem::isAlternate() 256bool KOTodoViewItem::isAlternate()
232{ 257{
233#ifndef KORG_NOLVALTERNATION 258#ifndef KORG_NOLVALTERNATION
234 KOTodoListView *lv = static_cast<KOTodoListView *>(listView()); 259 KOTodoListView *lv = static_cast<KOTodoListView *>(listView());
235 if (lv && lv->alternateBackground().isValid()) 260 if (lv && lv->alternateBackground().isValid())
236 { 261 {
237 KOTodoViewItem *above = 0; 262 KOTodoViewItem *above = 0;
238 above = dynamic_cast<KOTodoViewItem *>(itemAbove()); 263 above = dynamic_cast<KOTodoViewItem *>(itemAbove());
239 m_known = above ? above->m_known : true; 264 m_known = above ? above->m_known : true;
240 if (m_known) 265 if (m_known)
241 { 266 {
242 m_odd = above ? !above->m_odd : false; 267 m_odd = above ? !above->m_odd : false;
243 } 268 }
244 else 269 else
245 { 270 {
246 KOTodoViewItem *item; 271 KOTodoViewItem *item;
247 bool previous = true; 272 bool previous = true;
248 if (QListViewItem::parent()) 273 if (QListViewItem::parent())
249 { 274 {
250 item = dynamic_cast<KOTodoViewItem *>(QListViewItem::parent()); 275 item = dynamic_cast<KOTodoViewItem *>(QListViewItem::parent());
251 if (item) 276 if (item)
252 previous = item->m_odd; 277 previous = item->m_odd;
253 item = dynamic_cast<KOTodoViewItem *>(QListViewItem::parent()->firstChild()); 278 item = dynamic_cast<KOTodoViewItem *>(QListViewItem::parent()->firstChild());
254 } 279 }
255 else 280 else
256 { 281 {
257 item = dynamic_cast<KOTodoViewItem *>(lv->firstChild()); 282 item = dynamic_cast<KOTodoViewItem *>(lv->firstChild());
258 } 283 }
259 284
260 while(item) 285 while(item)
261 { 286 {
262 item->m_odd = previous = !previous; 287 item->m_odd = previous = !previous;
263 item->m_known = true; 288 item->m_known = true;
264 item = dynamic_cast<KOTodoViewItem *>(item->nextSibling()); 289 item = dynamic_cast<KOTodoViewItem *>(item->nextSibling());
265 } 290 }
266 } 291 }
267 return m_odd; 292 return m_odd;
268 } 293 }
269 return false; 294 return false;
270#else 295#else
271 return false; 296 return false;
272#endif 297#endif
273} 298}
274 299
275void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment) 300void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment)
276{ 301{
277 QColorGroup _cg = cg; 302 QColorGroup _cg = cg;
278 QColorGroup::ColorRole role; 303 QColorGroup::ColorRole role;
279 if ( KOPrefs::instance()->mTodoViewUsesForegroundColor ) 304 if ( KOPrefs::instance()->mTodoViewUsesForegroundColor )
280 role = QColorGroup::Text; 305 role = QColorGroup::Text;
281 else 306 else
282 role = QColorGroup::Base; 307 role = QColorGroup::Base;
283 //#ifndef KORG_NOLVALTERNATION 308 //#ifndef KORG_NOLVALTERNATION
284 // if (isAlternate()) 309 // if (isAlternate())
285 // _cg.setColor(QColorGroup::Base, static_cast< KOTodoListView* >(listView())->alternateBackground()); 310 // _cg.setColor(QColorGroup::Base, static_cast< KOTodoListView* >(listView())->alternateBackground());
286 bool setColor = KOPrefs::instance()->mTodoViewUsesCatColors; 311 bool setColor = KOPrefs::instance()->mTodoViewUsesCatColors;
287 QColor colorToSet; 312 QColor colorToSet;
288 if ( setColor ) { 313 if ( setColor ) {
289 QStringList categories = mTodo->categories(); 314 QStringList categories = mTodo->categories();
290 QString cat = categories.first(); 315 QString cat = categories.first();
291 if ( !cat.isEmpty()) { 316 if ( !cat.isEmpty()) {
292 colorToSet = *(KOPrefs::instance()->categoryColor(cat) ); 317 colorToSet = *(KOPrefs::instance()->categoryColor(cat) );
293 } else 318 } else
294 setColor = false; 319 setColor = false;
295 } 320 }
296 if (mTodo->hasDueDate()) { 321 if (mTodo->hasDueDate()) {
297 if (mTodo->dtDue().date()==QDate::currentDate() && 322 if (mTodo->dtDue().date()==QDate::currentDate() &&
298 !mTodo->isCompleted()) { 323 !mTodo->isCompleted()) {
299 //_cg.setColor( role , KOPrefs::instance()->mTodoDueTodayColor); 324 //_cg.setColor( role , KOPrefs::instance()->mTodoDueTodayColor);
300 colorToSet = KOPrefs::instance()->mTodoDueTodayColor; 325 colorToSet = KOPrefs::instance()->mTodoDueTodayColor;
301 setColor = true; 326 setColor = true;
302 } 327 }
303 if (mTodo->dtDue().date() < QDate::currentDate() && 328 if (mTodo->dtDue().date() < QDate::currentDate() &&
304 !mTodo->isCompleted()) { 329 !mTodo->isCompleted()) {
305 //_cg.setColor( role, KOPrefs::instance()->mTodoOverdueColor); 330 //_cg.setColor( role, KOPrefs::instance()->mTodoOverdueColor);
306 colorToSet = KOPrefs::instance()->mTodoOverdueColor; 331 colorToSet = KOPrefs::instance()->mTodoOverdueColor;
307 setColor = true; 332 setColor = true;
308 } 333 }
309 } 334 }
310 335
311 if ( setColor ) { 336 if ( setColor ) {
312 _cg.setColor(role,colorToSet ); 337 _cg.setColor(role,colorToSet );
313 if ( role == QColorGroup::Base) { 338 if ( role == QColorGroup::Base) {
314 int rgb = colorToSet.red(); 339 int rgb = colorToSet.red();
315 rgb += colorToSet.blue()/2; 340 rgb += colorToSet.blue()/2;
316 rgb += colorToSet.green(); 341 rgb += colorToSet.green();
317 if ( rgb < 200 ) 342 if ( rgb < 200 )
318 _cg.setColor(QColorGroup::Text,Qt::white ); 343 _cg.setColor(QColorGroup::Text,Qt::white );
319 } 344 }
320 } 345 }
321 //#endif 346 //#endif
322 if ( column > 0 ){ 347 if ( column > 0 ){
323 if ( column == 2 && !KOPrefs::instance()->mTodoViewShowsPercentage ) { 348 if ( column == 2 && !KOPrefs::instance()->mTodoViewShowsPercentage ) {
324 p->save(); 349 p->save();
325 int progress = (int)(( (width-6)*mTodo->percentComplete())/100.0 + 0.5); 350 int progress = (int)(( (width-6)*mTodo->percentComplete())/100.0 + 0.5);
326 351
327 p->fillRect( 0, 0, width, height(), _cg.base() ); // background 352 p->fillRect( 0, 0, width, height(), _cg.base() ); // background
328 // p->setPen(Qt::black ); //border 353 // p->setPen(Qt::black ); //border
329 // p->setBrush( KOPrefs::instance()->mHighlightColorKGlobalSettings::baseColor() ); //filling 354 // p->setBrush( KOPrefs::instance()->mHighlightColorKGlobalSettings::baseColor() ); //filling
330 QColor fc = KOPrefs::instance()->mHighlightColor; 355 QColor fc = KOPrefs::instance()->mHighlightColor;
331 if ( mTodo->percentComplete() == 100 ) 356 if ( mTodo->percentComplete() == 100 )
332 fc = darkGreen; 357 fc = darkGreen;
333 p->drawRect( 2, 2, width-4, height()-4); 358 p->drawRect( 2, 2, width-4, height()-4);
334 p->fillRect( 3, 3, progress, height()-6, 359 p->fillRect( 3, 3, progress, height()-6,
335 fc ); 360 fc );
336 p->restore(); 361 p->restore();
337 } else { 362 } else {
338 QCheckListItem::paintCell(p, _cg, column, width, alignment); 363 QCheckListItem::paintCell(p, _cg, column, width, alignment);
339 } 364 }
340 return; 365 return;
341 } 366 }
342 367
343 int align = alignment; 368 int align = alignment;
344 369
345 if ( !p ) 370 if ( !p )
346 return; 371 return;
347 372
348 p->fillRect( 0, 0, width, height(), _cg.brush( QColorGroup::Base ) ); 373 p->fillRect( 0, 0, width, height(), _cg.brush( QColorGroup::Base ) );
349 374
350 QListView *lv = listView(); 375 QListView *lv = listView();
351 if ( !lv ) 376 if ( !lv )
352 return; 377 return;
353 int marg = 2;//lv->itemMargin(); 378 int marg = 2;//lv->itemMargin();
354 int r = 0; 379 int r = 0;
355 QCheckListItem::Type myType = QCheckListItem::CheckBox; 380 QCheckListItem::Type myType = QCheckListItem::CheckBox;
356 int BoxSize = 20; 381 int BoxSize = 20;
357 int boxOffset = 2; 382 int boxOffset = 2;
358 int xOffset = 2; 383 int xOffset = 2;
359 if (qApp->desktop()->width() < 300 ) { 384 if (qApp->desktop()->width() < 300 ) {
360 BoxSize = 14; 385 BoxSize = 14;
361 boxOffset = -1; 386 boxOffset = -1;
362 xOffset = 1; 387 xOffset = 1;
363 // marg = 0; 388 // marg = 0;
364 } 389 }
365 if ( height() < BoxSize ) { 390 if ( height() < BoxSize ) {
366 boxOffset = boxOffset - ((BoxSize - height())/2) ; 391 boxOffset = boxOffset - ((BoxSize - height())/2) ;
367 // qDebug("boxOffset %d height %d", boxOffset, height() ); 392 // qDebug("boxOffset %d height %d", boxOffset, height() );
368 BoxSize = height(); 393 BoxSize = height();
369 394
370 } 395 }
371 //bool winStyle = lv->style() == WindowsStyle; 396 //bool winStyle = lv->style() == WindowsStyle;
372 397
373 int lineStart = 5; 398 int lineStart = 5;
374 if ( myType == Controller ) { 399 if ( myType == Controller ) {
375 if ( !pixmap( 0 ) ) 400 if ( !pixmap( 0 ) )
376 r += BoxSize + 4; 401 r += BoxSize + 4;
377 } else { 402 } else {
378 ASSERT( lv ); //### 403 ASSERT( lv ); //###
379 //QFontMetrics fm( lv->font() ); 404 //QFontMetrics fm( lv->font() );
380 //int d = fm.height(); 405 //int d = fm.height();
381 int x = 0; 406 int x = 0;
382 int y = (height() - BoxSize) / 2; 407 int y = (height() - BoxSize) / 2;
383 //p->setPen( QPen( _cg.text(), winStyle ? 2 : 1 ) ); 408 //p->setPen( QPen( _cg.text(), winStyle ? 2 : 1 ) );
384 if ( myType == CheckBox ) { 409 if ( myType == CheckBox ) {
385 if ( isEnabled() ) 410 if ( isEnabled() )
386 p->setPen( QPen( _cg.text(), 1 ) ); 411 p->setPen( QPen( _cg.text(), 1 ) );
387 else 412 else
388 p->setPen( QPen( listView()->palette().color( QPalette::Disabled, QColorGroup::Text ), 1 ) ); 413 p->setPen( QPen( listView()->palette().color( QPalette::Disabled, QColorGroup::Text ), 1 ) );
389 p->drawRect( x+marg, y+2, BoxSize-4, BoxSize-4 ); 414 p->drawRect( x+marg, y+2, BoxSize-4, BoxSize-4 );
390 lineStart = x+marg; 415 lineStart = x+marg;
391 ///////////////////// 416 /////////////////////
392 x++; 417 x++;
393 y++; 418 y++;
394 if ( isOn() ) { 419 if ( isOn() ) {
395 QPointArray a( 7*2 ); 420 QPointArray a( 7*2 );
396 int i, xx, yy; 421 int i, xx, yy;
397 xx = x+xOffset+marg+(boxOffset/2); 422 xx = x+xOffset+marg+(boxOffset/2);
398 yy = y+5+boxOffset; 423 yy = y+5+boxOffset;
399 for ( i=0; i<3; i++ ) { 424 for ( i=0; i<3; i++ ) {
400 a.setPoint( 2*i, xx, yy ); 425 a.setPoint( 2*i, xx, yy );
401 a.setPoint( 2*i+1, xx, yy+2 ); 426 a.setPoint( 2*i+1, xx, yy+2 );
402 // qDebug(" "); 427 // qDebug(" ");
403 xx++; yy++; 428 xx++; yy++;
404 } 429 }
405 yy -= 2; 430 yy -= 2;
406 for ( i=3; i<7; i++ ) { 431 for ( i=3; i<7; i++ ) {
407 a.setPoint( 2*i, xx, yy ); 432 a.setPoint( 2*i, xx, yy );
408 a.setPoint( 2*i+1, xx, yy+2 ); 433 a.setPoint( 2*i+1, xx, yy+2 );
409 xx++; yy--; 434 xx++; yy--;
410 } 435 }
411 p->setPen( darkGreen ); 436 p->setPen( darkGreen );
412 p->drawLineSegments( a ); 437 p->drawLineSegments( a );
413 } 438 }
414 //////////////////////// 439 ////////////////////////
415 } 440 }
416 r += BoxSize + 4; 441 r += BoxSize + 4;
417 } 442 }
418 443
419 p->translate( r, 0 ); 444 p->translate( r, 0 );
420 p->setPen( QPen( _cg.text() ) ); 445 p->setPen( QPen( _cg.text() ) );
421 QListViewItem::paintCell( p, _cg, column, width - r, align ); 446 QListViewItem::paintCell( p, _cg, column, width - r, align );
422 if ( mTodo->cancelled () ) { 447 if ( mTodo->cancelled () ) {
423 p->setPen( black ); 448 p->setPen( black );
424 QRect br = p->boundingRect( 1,1,1,1,0,mTodo->summary() ); 449 QRect br = p->boundingRect( 1,1,1,1,0,mTodo->summary() );
425 int wid = br.width() +lineStart; 450 int wid = br.width() +lineStart;
426 if ( wid > width-3 ) 451 if ( wid > width-3 )
427 wid = width-3; 452 wid = width-3;
428 p->drawLine( lineStart, height()/2+1, wid, height()/2+1 ); 453 p->drawLine( lineStart, height()/2+1, wid, height()/2+1 );
429 454
430 } 455 }
431 456
432} 457}
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index 6e151f9..b2dd266 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -1,580 +1,581 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 3
4 Copyright (c) 2001 4 Copyright (c) 2001
5 Cornelius Schumacher <schumacher@kde.org> 5 Cornelius Schumacher <schumacher@kde.org>
6 6
7 This program is free software; you can redistribute it and/or modify 7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or 9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version. 10 (at your option) any later version.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software 18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 20
21 As a special exception, permission is given to link this program 21 As a special exception, permission is given to link this program
22 with any edition of Qt, and distribute the resulting executable, 22 with any edition of Qt, and distribute the resulting executable,
23 without including the source code for Qt in the source distribution. 23 without including the source code for Qt in the source distribution.
24*/ 24*/
25 25
26#include <qwidgetstack.h> 26#include <qwidgetstack.h>
27 27
28#include <kconfig.h> 28#include <kconfig.h>
29#include <kglobal.h> 29#include <kglobal.h>
30#ifndef DESKTOP_VERSION 30#ifndef DESKTOP_VERSION
31#include <qpe/qpeapplication.h> 31#include <qpe/qpeapplication.h>
32#else 32#else
33#include <qapplication.h> 33#include <qapplication.h>
34#endif 34#endif
35#include <qdatetime.h> 35#include <qdatetime.h>
36#include "calendarview.h" 36#include "calendarview.h"
37#include "datenavigator.h" 37#include "datenavigator.h"
38#include "kotodoview.h" 38#include "kotodoview.h"
39#include "koagendaview.h" 39#include "koagendaview.h"
40#include "kodialogmanager.h" 40#include "kodialogmanager.h"
41#include "komonthview.h" 41#include "komonthview.h"
42#include "kolistview.h" 42#include "kolistview.h"
43#include "kowhatsnextview.h" 43#include "kowhatsnextview.h"
44#include "kojournalview.h" 44#include "kojournalview.h"
45#include "kotimespanview.h" 45#include "kotimespanview.h"
46#include "koprefs.h" 46#include "koprefs.h"
47#include "navigatorbar.h" 47#include "navigatorbar.h"
48 48
49#include "koviewmanager.h" 49#include "koviewmanager.h"
50//extern bool externFlagMonthviewBlockPainting; 50//extern bool externFlagMonthviewBlockPainting;
51 51
52//bool globalFlagBlockPainting = false; 52//bool globalFlagBlockPainting = false;
53int globalFlagBlockAgenda = 0; 53int globalFlagBlockAgenda = 0;
54int globalFlagBlockLabel = 0; 54int globalFlagBlockLabel = 0;
55int globalFlagBlockAgendaItemPaint = 1; 55int globalFlagBlockAgendaItemPaint = 1;
56int globalFlagBlockAgendaItemUpdate = 1; 56int globalFlagBlockAgendaItemUpdate = 1;
57 57
58 58
59KOViewManager::KOViewManager( CalendarView *mainView ) : 59KOViewManager::KOViewManager( CalendarView *mainView ) :
60 QObject(), mMainView( mainView ) 60 QObject(), mMainView( mainView )
61{ 61{
62 mCurrentView = 0; 62 mCurrentView = 0;
63 63
64 mWhatsNextView = 0; 64 mWhatsNextView = 0;
65 mTodoView = 0; 65 mTodoView = 0;
66 mAgendaView = 0; 66 mAgendaView = 0;
67 mMonthView = 0; 67 mMonthView = 0;
68 mListView = 0; 68 mListView = 0;
69 mJournalView = 0; 69 mJournalView = 0;
70 mTimeSpanView = 0; 70 mTimeSpanView = 0;
71 mCurrentAgendaView = 0 ; 71 mCurrentAgendaView = 0 ;
72 mFlagShowNextxDays = false; 72 mFlagShowNextxDays = false;
73} 73}
74 74
75KOViewManager::~KOViewManager() 75KOViewManager::~KOViewManager()
76{ 76{
77} 77}
78 78
79 79
80KOrg::BaseView *KOViewManager::currentView() 80KOrg::BaseView *KOViewManager::currentView()
81{ 81{
82 return mCurrentView; 82 return mCurrentView;
83} 83}
84 84
85void KOViewManager::readSettings(KConfig *config) 85void KOViewManager::readSettings(KConfig *config)
86{ 86{
87 config->setGroup("General"); 87 config->setGroup("General");
88 QString view = config->readEntry("Current View"); 88 QString view = config->readEntry("Current View");
89 if (view == "WhatsNext") showWhatsNextView(); 89 if (view == "WhatsNext") showWhatsNextView();
90 else if (view == "Month") showMonthView(); 90 else if (view == "Month") showMonthView();
91 else if (view == "List") showListView(); 91 else if (view == "List") showListView();
92 else if (view == "Journal") showJournalView(); 92 else if (view == "Journal") showJournalView();
93 else if (view == "TimeSpan") showTimeSpanView(); 93 else if (view == "TimeSpan") showTimeSpanView();
94 else if (view == "Todo") showTodoView(); 94 else if (view == "Todo") showTodoView();
95 else { 95 else {
96 showAgendaView(); 96 showAgendaView();
97 } 97 }
98} 98}
99 99
100void KOViewManager::writeSettings(KConfig *config) 100void KOViewManager::writeSettings(KConfig *config)
101{ 101{
102 config->setGroup("General"); 102 config->setGroup("General");
103 103
104 QString view; 104 QString view;
105 if (mCurrentView == mWhatsNextView) view = "WhatsNext"; 105 if (mCurrentView == mWhatsNextView) view = "WhatsNext";
106 else if (mCurrentView == mMonthView) view = "Month"; 106 else if (mCurrentView == mMonthView) view = "Month";
107 else if (mCurrentView == mListView) view = "List"; 107 else if (mCurrentView == mListView) view = "List";
108 else if (mCurrentView == mJournalView) view = "Journal"; 108 else if (mCurrentView == mJournalView) view = "Journal";
109 else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; 109 else if (mCurrentView == mTimeSpanView) view = "TimeSpan";
110 else if (mCurrentView == mTodoView) view = "Todo"; 110 else if (mCurrentView == mTodoView) view = "Todo";
111 else view = "Agenda"; 111 else view = "Agenda";
112 112
113 config->writeEntry("Current View",view); 113 config->writeEntry("Current View",view);
114 114
115 if (mAgendaView) { 115 if (mAgendaView) {
116 mAgendaView->writeSettings(config); 116 mAgendaView->writeSettings(config);
117 } 117 }
118 if (mTimeSpanView) { 118 if (mTimeSpanView) {
119 mTimeSpanView->writeSettings(config); 119 mTimeSpanView->writeSettings(config);
120 } 120 }
121 if (mListView) { 121 if (mListView) {
122 mListView->writeSettings(config); 122 mListView->writeSettings(config);
123 } 123 }
124 if (mTodoView) { 124 if (mTodoView) {
125 mTodoView->saveLayout(config,"Todo View"); 125 mTodoView->saveLayout(config,"Todo View");
126 } 126 }
127} 127}
128 128
129void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) 129void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen )
130{ 130{
131 131
132 //mFlagShowNextxDays = false; 132 //mFlagShowNextxDays = false;
133 //if(view == mCurrentView) return; 133 //if(view == mCurrentView) return;
134 if ( view == 0 ) { 134 if ( view == 0 ) {
135 view = mCurrentView; 135 view = mCurrentView;
136 if ( view == 0 ) 136 if ( view == 0 )
137 return; 137 return;
138 } 138 }
139 bool full = fullScreen; 139 bool full = fullScreen;
140 if(view == mCurrentView && view != mWhatsNextView ) { 140 if(view == mCurrentView && view != mWhatsNextView ) {
141 if ( mCurrentAgendaView < 0 ) 141 if ( mCurrentAgendaView < 0 )
142 return; 142 return;
143 full = mMainView->leftFrame()->isVisible(); 143 full = mMainView->leftFrame()->isVisible();
144 } else { 144 } else {
145 mCurrentView = view; 145 mCurrentView = view;
146 146
147 // bool full = fullScreen; 147 // bool full = fullScreen;
148 bool isFull = !mMainView->leftFrame()->isVisible(); 148 bool isFull = !mMainView->leftFrame()->isVisible();
149 if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) 149 if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen )
150 full = true; 150 full = true;
151 if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) 151 if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen )
152 full = false; 152 full = false;
153 } 153 }
154 if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); 154 if ( mAgendaView ) mAgendaView->deleteSelectedDateTime();
155 raiseCurrentView( full ); 155 raiseCurrentView( full );
156 mMainView->processIncidenceSelection( 0 ); 156 mMainView->processIncidenceSelection( 0 );
157 mMainView->updateView(); 157 mMainView->updateView();
158 mMainView->adaptNavigationUnits(); 158 mMainView->adaptNavigationUnits();
159} 159}
160 160
161void KOViewManager::raiseCurrentView( bool fullScreen ) 161void KOViewManager::raiseCurrentView( bool fullScreen )
162{ 162{
163 //qDebug("raiseCurrentView "); 163 //qDebug("raiseCurrentView ");
164 mCurrentAgendaView = 0; 164 mCurrentAgendaView = 0;
165 int wid = mMainView->width() ; 165 int wid = mMainView->width() ;
166 int hei = mMainView->height(); 166 int hei = mMainView->height();
167 if ( mCurrentView == mMonthView ) { 167 if ( mCurrentView == mMonthView ) {
168 mMainView->navigatorBar()->show(); 168 mMainView->navigatorBar()->show();
169 hei -= mMainView->navigatorBar()->sizeHint().height(); 169 hei -= mMainView->navigatorBar()->sizeHint().height();
170 //mMainView->navigatorBar()->hide(); 170 //mMainView->navigatorBar()->hide();
171 } else { 171 } else {
172 mMainView->navigatorBar()->hide(); 172 mMainView->navigatorBar()->hide();
173 } 173 }
174 if ( fullScreen ) { 174 if ( fullScreen ) {
175 mMainView->leftFrame()->hide(); 175 mMainView->leftFrame()->hide();
176 } else { 176 } else {
177 mMainView->leftFrame()->show(); 177 mMainView->leftFrame()->show();
178 if ( KOPrefs::instance()->mVerticalScreen ) 178 if ( KOPrefs::instance()->mVerticalScreen )
179 hei -= mMainView->leftFrame()->height(); 179 hei -= mMainView->leftFrame()->height();
180 else 180 else
181 wid -= mMainView->leftFrame()->width(); 181 wid -= mMainView->leftFrame()->width();
182 } 182 }
183 183
184 if ( globalFlagBlockAgenda == 5 ) { 184 if ( globalFlagBlockAgenda == 5 ) {
185 globalFlagBlockAgenda = 4; 185 globalFlagBlockAgenda = 4;
186 globalFlagBlockAgendaItemPaint = 1; 186 globalFlagBlockAgendaItemPaint = 1;
187 } 187 }
188 mMainView->viewStack()->raiseWidget(mCurrentView); 188 mMainView->viewStack()->raiseWidget(mCurrentView);
189 if ( globalFlagBlockAgenda == 4 ) { 189 if ( globalFlagBlockAgenda == 4 ) {
190 if ( mCurrentView == mAgendaView ) { 190 if ( mCurrentView == mAgendaView ) {
191 //globalFlagBlockAgenda =1 ; 191 //globalFlagBlockAgenda =1 ;
192 if ( KOPrefs::instance()->mSetTimeToDayStartAt ) 192 if ( KOPrefs::instance()->mSetTimeToDayStartAt )
193 mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); 193 mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins );
194 else if ( KOPrefs::instance()->mCenterOnCurrentTime ) 194 else if ( KOPrefs::instance()->mCenterOnCurrentTime )
195 mAgendaView->setStartHour( QTime::currentTime ().hour() ); 195 mAgendaView->setStartHour( QTime::currentTime ().hour() );
196 qApp->processEvents(); 196 qApp->processEvents();
197 //qDebug("qApp->processEvents() "); 197 //qDebug("qApp->processEvents() ");
198 globalFlagBlockAgenda = 0; 198 globalFlagBlockAgenda = 0;
199 mAgendaView->repaintAgenda(); 199 mAgendaView->repaintAgenda();
200 200
201 } 201 }
202 globalFlagBlockAgenda = 0; 202 globalFlagBlockAgenda = 0;
203 } 203 }
204 //qDebug("raiseCurrentView ende "); 204 //qDebug("raiseCurrentView ende ");
205} 205}
206 206
207void KOViewManager::updateView() 207void KOViewManager::updateView()
208{ 208{
209 // qDebug("KOViewManager::updateView() "); 209 // qDebug("KOViewManager::updateView() ");
210 // if we are updating mTodoView, we get endless recursion 210 // if we are updating mTodoView, we get endless recursion
211 if ( mTodoView == mCurrentView ) 211 if ( mTodoView == mCurrentView )
212 return; 212 return;
213 if ( mCurrentView ) mCurrentView->updateView(); 213 if ( mCurrentView ) mCurrentView->updateView();
214 214
215} 215}
216 216
217void KOViewManager::updateView(const QDate &start, const QDate &end) 217void KOViewManager::updateView(const QDate &start, const QDate &end)
218{ 218{
219 // kdDebug() << "KOViewManager::updateView()" << endl; 219 // kdDebug() << "KOViewManager::updateView()" << endl;
220 220
221 if (mCurrentView) mCurrentView->showDates(start, end); 221 if (mCurrentView) mCurrentView->showDates(start, end);
222 222
223 if (mTodoView) mTodoView->updateView(); 223 if (mTodoView) mTodoView->updateView();
224} 224}
225 225
226 226
227void KOViewManager::updateWNview() 227void KOViewManager::updateWNview()
228{ 228{
229 if ( mCurrentView == mWhatsNextView && mWhatsNextView ) 229 if ( mCurrentView == mWhatsNextView && mWhatsNextView )
230 mWhatsNextView->updateView(); 230 mWhatsNextView->updateView();
231 231
232} 232}
233void KOViewManager::showWhatsNextView() 233void KOViewManager::showWhatsNextView()
234{ 234{
235 if (!mWhatsNextView) { 235 if (!mWhatsNextView) {
236 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), 236 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(),
237 "KOViewManager::WhatsNextView"); 237 "KOViewManager::WhatsNextView");
238 mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); 238 mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog());
239 connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); 239 connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig()));
240 addView(mWhatsNextView); 240 addView(mWhatsNextView);
241 } 241 }
242 globalFlagBlockAgenda = 1; 242 globalFlagBlockAgenda = 1;
243 showView(mWhatsNextView, true ); 243 showView(mWhatsNextView, true );
244 //mWhatsNextView->updateView(); 244 //mWhatsNextView->updateView();
245 245
246} 246}
247 247
248void KOViewManager::showListView() 248void KOViewManager::showListView()
249{ 249{
250 if (!mListView) { 250 if (!mListView) {
251 mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); 251 mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView");
252 addView(mListView); 252 addView(mListView);
253 253
254 connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), 254 connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)),
255 mMainView, SLOT(showIncidence(Incidence *))); 255 mMainView, SLOT(showIncidence(Incidence *)));
256 connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), 256 connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)),
257 mMainView, SLOT(editIncidence(Incidence *))); 257 mMainView, SLOT(editIncidence(Incidence *)));
258 connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), 258 connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)),
259 mMainView, SLOT(deleteIncidence(Incidence *))); 259 mMainView, SLOT(deleteIncidence(Incidence *)));
260 connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), 260 connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ),
261 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 261 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
262 connect( mListView, SIGNAL( signalNewEvent() ), 262 connect( mListView, SIGNAL( signalNewEvent() ),
263 mMainView, SLOT( newEvent() ) ); 263 mMainView, SLOT( newEvent() ) );
264 connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); 264 connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig()));
265 connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), 265 connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ),
266 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 266 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
267 connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), 267 connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ),
268 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 268 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
269 connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 269 connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
270 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 270 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
271 connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 271 connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
272 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 272 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
273 } 273 }
274 // bool temp = mFlagShowNextxDays; 274 // bool temp = mFlagShowNextxDays;
275 //globalFlagBlockPainting = true; 275 //globalFlagBlockPainting = true;
276 globalFlagBlockAgenda = 1; 276 globalFlagBlockAgenda = 1;
277 if ( KOPrefs::instance()->mListViewMonthTimespan ) 277 if ( KOPrefs::instance()->mListViewMonthTimespan )
278 mMainView->dateNavigator()->selectMonth(); 278 mMainView->dateNavigator()->selectMonth();
279 showView(mListView, KOPrefs::instance()->mFullViewTodo); 279 showView(mListView, KOPrefs::instance()->mFullViewTodo);
280 //mFlagShowNextxDays = temp; 280 //mFlagShowNextxDays = temp;
281} 281}
282 282
283void KOViewManager::showAgendaView( bool fullScreen ) 283void KOViewManager::showAgendaView( bool fullScreen )
284{ 284{
285 285
286 mMainView->dialogManager()->hideSearchDialog(); 286 mMainView->dialogManager()->hideSearchDialog();
287 // qDebug("KOViewManager::showAgendaView "); 287 // qDebug("KOViewManager::showAgendaView ");
288 bool full; 288 bool full;
289 full = fullScreen; 289 full = fullScreen;
290 if (!mAgendaView) { 290 if (!mAgendaView) {
291 full = false; 291 full = false;
292 mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); 292 mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView");
293 addView(mAgendaView); 293 addView(mAgendaView);
294#ifndef DESKTOP_VERSION 294#ifndef DESKTOP_VERSION
295 QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); 295 QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold );
296#endif 296#endif
297 connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), 297 connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )),
298 mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); 298 mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) ));
299 299
300 // SIGNALS/SLOTS FOR DAY/WEEK VIEW 300 // SIGNALS/SLOTS FOR DAY/WEEK VIEW
301 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), 301 connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)),
302 mMainView, SLOT(newEvent(QDateTime))); 302 mMainView, SLOT(newEvent(QDateTime)));
303 // connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), 303 // connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)),
304 // mMainView, SLOT(newEvent(QDateTime,QDateTime))); 304 // mMainView, SLOT(newEvent(QDateTime,QDateTime)));
305 connect(mAgendaView,SIGNAL(newEventSignal(QDate)), 305 connect(mAgendaView,SIGNAL(newEventSignal(QDate)),
306 mMainView, SLOT(newEvent(QDate))); 306 mMainView, SLOT(newEvent(QDate)));
307 307
308 connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), 308 connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)),
309 mMainView, SLOT(editIncidence(Incidence *))); 309 mMainView, SLOT(editIncidence(Incidence *)));
310 connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), 310 connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)),
311 mMainView, SLOT(showIncidence(Incidence *))); 311 mMainView, SLOT(showIncidence(Incidence *)));
312 connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), 312 connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)),
313 mMainView, SLOT(deleteIncidence(Incidence *))); 313 mMainView, SLOT(deleteIncidence(Incidence *)));
314 314
315 connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), 315 connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ),
316 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 316 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
317 317
318 connect(mAgendaView, SIGNAL( toggleExpand() ), 318 connect(mAgendaView, SIGNAL( toggleExpand() ),
319 mMainView, SLOT( toggleExpand() ) ); 319 mMainView, SLOT( toggleExpand() ) );
320 320
321 connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ), 321 connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ),
322 mAgendaView, SLOT( setExpandedButton( bool ) ) ); 322 mAgendaView, SLOT( setExpandedButton( bool ) ) );
323 connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), 323 connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ),
324 mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; 324 mMainView, SLOT(cloneIncidence(Incidence *) ) ) ;
325 connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), 325 connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ),
326 mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; 326 mMainView, SLOT(cancelIncidence(Incidence *) ) ) ;
327 connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); 327 connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig()));
328 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, 328 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView,
329 SLOT( updateTodo( Todo *, int ) ) ); 329 SLOT( updateTodo( Todo *, int ) ) );
330 connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), 330 connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )),
331 mMainView, SIGNAL( todoModified( Todo *, int ))); 331 mMainView, SIGNAL( todoModified( Todo *, int )));
332 connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 332 connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
333 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 333 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
334 connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 334 connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
335 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 335 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
336 mAgendaView->readSettings(); 336 mAgendaView->readSettings();
337 mAgendaView->updateConfig(); 337 mAgendaView->updateConfig();
338 } 338 }
339 339
340 showView( mAgendaView, full); 340 showView( mAgendaView, full);
341 341
342} 342}
343 343
344void KOViewManager::showDayView() 344void KOViewManager::showDayView()
345{ 345{
346 mFlagShowNextxDays = false; 346 mFlagShowNextxDays = false;
347 globalFlagBlockLabel = 1; 347 globalFlagBlockLabel = 1;
348 globalFlagBlockAgenda = 1; 348 globalFlagBlockAgenda = 1;
349 if ( mCurrentAgendaView != 1 ) 349 if ( mCurrentAgendaView != 1 )
350 mCurrentAgendaView = -1; 350 mCurrentAgendaView = -1;
351 showAgendaView(); 351 showAgendaView();
352 qApp->processEvents(); 352 qApp->processEvents();
353 globalFlagBlockAgenda = 2; 353 globalFlagBlockAgenda = 2;
354 globalFlagBlockLabel = 0; 354 globalFlagBlockLabel = 0;
355 mMainView->dateNavigator()->selectDates( 1 ); 355 mMainView->dateNavigator()->selectDates( 1 );
356 mCurrentAgendaView = 1 ; 356 mCurrentAgendaView = 1 ;
357 357
358} 358}
359 359
360void KOViewManager::showWorkWeekView() 360void KOViewManager::showWorkWeekView()
361{ 361{
362 mFlagShowNextxDays = false; 362 mFlagShowNextxDays = false;
363 globalFlagBlockAgenda = 1; 363 globalFlagBlockAgenda = 1;
364 globalFlagBlockLabel = 1; 364 globalFlagBlockLabel = 1;
365 if ( mCurrentAgendaView != 5 ) 365 if ( mCurrentAgendaView != 5 )
366 mCurrentAgendaView = -1; 366 mCurrentAgendaView = -1;
367 showAgendaView(); 367 showAgendaView();
368 qApp->processEvents(); 368 qApp->processEvents();
369 globalFlagBlockAgenda = 2; 369 globalFlagBlockAgenda = 2;
370 globalFlagBlockLabel = 0; 370 globalFlagBlockLabel = 0;
371 mMainView->dateNavigator()->selectWorkWeek(); 371 mMainView->dateNavigator()->selectWorkWeek();
372 mCurrentAgendaView = 5 ; 372 mCurrentAgendaView = 5 ;
373 373
374} 374}
375 375
376void KOViewManager::showWeekView() 376void KOViewManager::showWeekView()
377{ 377{
378 /* 378 /*
379 globalFlagBlockAgenda = 2; 379 globalFlagBlockAgenda = 2;
380 qDebug("4globalFlagBlockAgenda = 2; "); 380 qDebug("4globalFlagBlockAgenda = 2; ");
381 //globalFlagBlockPainting = true; 381 //globalFlagBlockPainting = true;
382 mMainView->dateNavigator()->selectWeek(); 382 mMainView->dateNavigator()->selectWeek();
383 showAgendaView(); 383 showAgendaView();
384 */ 384 */
385 385
386 386
387 mFlagShowNextxDays = false; 387 mFlagShowNextxDays = false;
388 globalFlagBlockAgenda = 1; 388 globalFlagBlockAgenda = 1;
389 globalFlagBlockLabel = 1; 389 globalFlagBlockLabel = 1;
390 if ( mCurrentAgendaView != 7 ) 390 if ( mCurrentAgendaView != 7 )
391 mCurrentAgendaView = -1; 391 mCurrentAgendaView = -1;
392 showAgendaView(); 392 showAgendaView();
393 qApp->processEvents(); 393 qApp->processEvents();
394 globalFlagBlockAgenda = 2; 394 globalFlagBlockAgenda = 2;
395 globalFlagBlockLabel = 0; 395 globalFlagBlockLabel = 0;
396 mMainView->dateNavigator()->selectWeek(); 396 mMainView->dateNavigator()->selectWeek();
397 mCurrentAgendaView = 7 ; 397 mCurrentAgendaView = 7 ;
398} 398}
399 399
400void KOViewManager::showNextXView() 400void KOViewManager::showNextXView()
401{ 401{
402 402
403 globalFlagBlockAgenda = 1; 403 globalFlagBlockAgenda = 1;
404 if ( mCurrentAgendaView != 3 ) 404 if ( mCurrentAgendaView != 3 )
405 mCurrentAgendaView = -1; 405 mCurrentAgendaView = -1;
406 showAgendaView(KOPrefs::instance()->mFullViewMonth); 406 showAgendaView(KOPrefs::instance()->mFullViewMonth);
407 globalFlagBlockAgenda = 2; 407 globalFlagBlockAgenda = 2;
408 mMainView->dateNavigator()->selectDates( QDate::currentDate(), 408 mMainView->dateNavigator()->selectDates( QDate::currentDate(),
409 KOPrefs::instance()->mNextXDays ); 409 KOPrefs::instance()->mNextXDays );
410 mFlagShowNextxDays = true; 410 mFlagShowNextxDays = true;
411 mCurrentAgendaView = 3 ; 411 mCurrentAgendaView = 3 ;
412} 412}
413bool KOViewManager::showsNextDays() 413bool KOViewManager::showsNextDays()
414{ 414{
415 return mFlagShowNextxDays; 415 return mFlagShowNextxDays;
416} 416}
417void KOViewManager::showMonthView() 417void KOViewManager::showMonthView()
418{ 418{
419 if (!mMonthView) { 419 if (!mMonthView) {
420 mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); 420 mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView");
421 421
422 addView(mMonthView); 422 addView(mMonthView);
423 // mMonthView->show(); 423 // mMonthView->show();
424 // SIGNALS/SLOTS FOR MONTH VIEW 424 // SIGNALS/SLOTS FOR MONTH VIEW
425 connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), 425 connect(mMonthView, SIGNAL(newEventSignal(QDateTime)),
426 mMainView, SLOT(newEvent(QDateTime))); 426 mMainView, SLOT(newEvent(QDateTime)));
427 427
428 connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), 428 connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)),
429 mMainView, SLOT(showIncidence(Incidence *))); 429 mMainView, SLOT(showIncidence(Incidence *)));
430 connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), 430 connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)),
431 mMainView, SLOT(editIncidence(Incidence *))); 431 mMainView, SLOT(editIncidence(Incidence *)));
432 connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), 432 connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)),
433 mMainView, SLOT(deleteIncidence(Incidence *))); 433 mMainView, SLOT(deleteIncidence(Incidence *)));
434 434
435 connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), 435 connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ),
436 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 436 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
437 connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), 437 connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ),
438 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 438 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
439 connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), 439 connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ),
440 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 440 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
441 441
442 connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 442 connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
443 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 443 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
444 connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 444 connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
445 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 445 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
446 connect( mMonthView, SIGNAL( selectWeekNum( int ) ), 446 connect( mMonthView, SIGNAL( selectWeekNum( int ) ),
447 mMainView, SLOT ( selectWeekNum( int ) ) ); 447 mMainView, SLOT ( selectWeekNum( int ) ) );
448 connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), 448 connect( mMonthView, SIGNAL( showDaySignal( QDate ) ),
449 mMainView, SLOT ( showDay( QDate ) ) ); 449 mMainView, SLOT ( showDay( QDate ) ) );
450 connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); 450 connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig()));
451 mMonthView->updateConfig(); 451 mMonthView->updateConfig();
452 } 452 }
453 453
454 globalFlagBlockAgenda = 1; 454 globalFlagBlockAgenda = 1;
455 //mFlagShowNextxDays = false; 455 //mFlagShowNextxDays = false;
456 // if(mMonthView == mCurrentView) return; 456 // if(mMonthView == mCurrentView) return;
457 mMainView->dateNavigator()->selectMonth(); 457 mMainView->dateNavigator()->selectMonth();
458 // DateList tmpList = mMainView->dateNavigator()->selectedDates( ); 458 // DateList tmpList = mMainView->dateNavigator()->selectedDates( );
459 //mMonthView->showDates(tmpList.first(), tmpList.last()); 459 //mMonthView->showDates(tmpList.first(), tmpList.last());
460 460
461 showView(mMonthView, true ); 461 showView(mMonthView, true );
462 462
463} 463}
464 464
465void KOViewManager::showTodoView() 465void KOViewManager::showTodoView()
466{ 466{
467 //mFlagShowNextxDays = false; 467 //mFlagShowNextxDays = false;
468 if ( !mTodoView ) { 468 if ( !mTodoView ) {
469 mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), 469 mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(),
470 "KOViewManager::TodoView" ); 470 "KOViewManager::TodoView" );
471 471
472 addView( mTodoView ); 472 addView( mTodoView );
473 // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); 473 // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold );
474 474
475 // SIGNALS/SLOTS FOR TODO VIEW 475 // SIGNALS/SLOTS FOR TODO VIEW
476 connect( mTodoView, SIGNAL( newTodoSignal() ), 476 connect( mTodoView, SIGNAL( newTodoSignal() ),
477 mMainView, SLOT( newTodo() ) ); 477 mMainView, SLOT( newTodo() ) );
478 connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), 478 connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ),
479 mMainView, SLOT( newSubTodo( Todo *) ) ); 479 mMainView, SLOT( newSubTodo( Todo *) ) );
480 connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), 480 connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ),
481 mMainView, SLOT( showTodo( Todo * ) ) ); 481 mMainView, SLOT( showTodo( Todo * ) ) );
482 connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), 482 connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ),
483 mMainView, SLOT( editTodo( Todo * ) ) ); 483 mMainView, SLOT( editTodo( Todo * ) ) );
484 connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), 484 connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ),
485 mMainView, SLOT( deleteTodo( Todo * ) ) ); 485 mMainView, SLOT( deleteTodo( Todo * ) ) );
486 connect( mTodoView, SIGNAL( purgeCompletedSignal() ), 486 connect( mTodoView, SIGNAL( purgeCompletedSignal() ),
487 mMainView, SLOT( purgeCompleted() ) ); 487 mMainView, SLOT( purgeCompleted() ) );
488 488
489 connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), 489 connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ),
490 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 490 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
491 491
492 connect( mMainView, SIGNAL( configChanged() ), mTodoView, 492 connect( mMainView, SIGNAL( configChanged() ), mTodoView,
493 SLOT( updateConfig() ) ); 493 SLOT( updateConfig() ) );
494 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, 494 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView,
495 SLOT( updateTodo( Todo *, int ) ) ); 495 SLOT( updateTodo( Todo *, int ) ) );
496 connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), 496 connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ),
497 mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); 497 mMainView, SIGNAL ( todoModified( Todo *, int ) ) );
498 connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), 498 connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ),
499 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 499 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
500 connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), 500 connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ),
501 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 501 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
502 connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), 502 connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ),
503 mMainView, SLOT ( todo_unsub( Todo * ) ) ); 503 mMainView, SLOT ( todo_unsub( Todo * ) ) );
504 connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), 504 connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
505 mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); 505 mMainView, SLOT ( todo_resub( Todo *, Todo *) ) );
506 connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), 506 connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ),
507 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 507 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
508 connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), 508 connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ),
509 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 509 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
510 KConfig *config = KOGlobals::config(); 510 KConfig *config = KOGlobals::config();
511 mTodoView->restoreLayout(config,"Todo View"); 511 mTodoView->restoreLayout(config,"Todo View");
512 mTodoView->setNavigator( mMainView->dateNavigator() );
512 } 513 }
513 514
514 globalFlagBlockAgenda = 1; 515 globalFlagBlockAgenda = 1;
515 showView( mTodoView, true ); 516 showView( mTodoView, true );
516 517
517} 518}
518 519
519void KOViewManager::showJournalView() 520void KOViewManager::showJournalView()
520{ 521{
521 //mFlagShowNextxDays = false; 522 //mFlagShowNextxDays = false;
522 if (!mJournalView) { 523 if (!mJournalView) {
523 mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), 524 mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(),
524 "KOViewManager::JournalView"); 525 "KOViewManager::JournalView");
525 connect( mMainView, SIGNAL( configChanged() ), mJournalView, 526 connect( mMainView, SIGNAL( configChanged() ), mJournalView,
526 SLOT( updateConfig() ) ); 527 SLOT( updateConfig() ) );
527 connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); 528 connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) );
528 addView(mJournalView); 529 addView(mJournalView);
529 } 530 }
530 531
531 showView(mJournalView); 532 showView(mJournalView);
532} 533}
533 534
534void KOViewManager::showTimeSpanView() 535void KOViewManager::showTimeSpanView()
535{ 536{
536 //mFlagShowNextxDays = false; 537 //mFlagShowNextxDays = false;
537 if (!mTimeSpanView) { 538 if (!mTimeSpanView) {
538 mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(), 539 mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(),
539 "KOViewManager::TimeSpanView"); 540 "KOViewManager::TimeSpanView");
540 addView(mTimeSpanView); 541 addView(mTimeSpanView);
541 542
542 mTimeSpanView->readSettings(); 543 mTimeSpanView->readSettings();
543 } 544 }
544 545
545 showView(mTimeSpanView); 546 showView(mTimeSpanView);
546} 547}
547 548
548Incidence *KOViewManager::currentSelection() 549Incidence *KOViewManager::currentSelection()
549{ 550{
550 if (!mCurrentView) return 0; 551 if (!mCurrentView) return 0;
551 if ( mCurrentView == mListView ) { 552 if ( mCurrentView == mListView ) {
552 if ( mListView->currentItem() ) 553 if ( mListView->currentItem() )
553 return mListView->currentItem(); 554 return mListView->currentItem();
554 } 555 }
555 return mCurrentView->selectedIncidences().first(); 556 return mCurrentView->selectedIncidences().first();
556} 557}
557 558
558QDate KOViewManager::currentSelectionDate() 559QDate KOViewManager::currentSelectionDate()
559{ 560{
560 QDate qd; 561 QDate qd;
561 if (mCurrentView) { 562 if (mCurrentView) {
562 DateList qvl = mCurrentView->selectedDates(); 563 DateList qvl = mCurrentView->selectedDates();
563 if (!qvl.isEmpty()) qd = qvl.first(); 564 if (!qvl.isEmpty()) qd = qvl.first();
564 } 565 }
565 return qd; 566 return qd;
566} 567}
567 568
568void KOViewManager::addView(KOrg::BaseView *view) 569void KOViewManager::addView(KOrg::BaseView *view)
569{ 570{
570#if QT_VERSION >= 300 571#if QT_VERSION >= 300
571 mMainView->viewStack()->addWidget( view ); 572 mMainView->viewStack()->addWidget( view );
572#else 573#else
573 mMainView->viewStack()->addWidget( view, 1 ); 574 mMainView->viewStack()->addWidget( view, 1 );
574#endif 575#endif
575} 576}
576 577
577void KOViewManager::setDocumentId( const QString &id ) 578void KOViewManager::setDocumentId( const QString &id )
578{ 579{
579 if (mTodoView) mTodoView->setDocumentId( id ); 580 if (mTodoView) mTodoView->setDocumentId( id );
580} 581}
diff --git a/version b/version
index ef03779..65eb8d1 100644
--- a/version
+++ b/version
@@ -1 +1 @@
version = "1.9.15"; version = "1.9.16";