author | zautrix <zautrix> | 2004-12-04 13:59:01 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-12-04 13:59:01 (UTC) |
commit | a3b1470f3da722d044505f78bef9de51b2107802 (patch) (unidiff) | |
tree | 52965f580d00f865231661ff3d51af5c881e77cc | |
parent | 7828f46413766ee5db72dc9bd457eac0868f0646 (diff) | |
download | kdepimpi-a3b1470f3da722d044505f78bef9de51b2107802.zip kdepimpi-a3b1470f3da722d044505f78bef9de51b2107802.tar.gz kdepimpi-a3b1470f3da722d044505f78bef9de51b2107802.tar.bz2 |
monthview changes
-rw-r--r-- | bin/kdepim/WhatsNew.txt | 6 | ||||
-rw-r--r-- | korganizer/calendarview.cpp | 5 | ||||
-rw-r--r-- | korganizer/datenavigator.cpp | 6 | ||||
-rw-r--r-- | korganizer/datenavigator.h | 1 | ||||
-rw-r--r-- | korganizer/interfaces/korganizer/baseview.h | 1 | ||||
-rw-r--r-- | korganizer/komonthview.h | 1 |
6 files changed, 19 insertions, 1 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index eb7cf13..4fff7e1 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt | |||
@@ -1,611 +1,617 @@ | |||
1 | Info about the changes in new versions of KDE-Pim/Pi | 1 | Info about the changes in new versions of KDE-Pim/Pi |
2 | 2 | ||
3 | ********** VERSION 1.9.14 ************ | 3 | ********** VERSION 1.9.14 ************ |
4 | 4 | ||
5 | Fixed some problems with the dialog sizes when switching | 5 | Fixed some problems with the dialog sizes when switching |
6 | portrait/landscape mode on 640x480 PDA display. | 6 | portrait/landscape mode on 640x480 PDA display. |
7 | 7 | ||
8 | Fixed some other small bugs. | 8 | Fixed some other small bugs. |
9 | 9 | ||
10 | Fixed an ugly bug in KOpieMail: | 10 | Fixed an ugly bug in KOpieMail: |
11 | KOpieMail was not able to write files (mails) to MSDOS file system, | 11 | KOpieMail was not able to write files (mails) to MSDOS file system, |
12 | like on an usual preformatted SD card. That should work now. | 12 | like on an usual preformatted SD card. That should work now. |
13 | To save your mail data on the Sd card do the following: | 13 | To save your mail data on the Sd card do the following: |
14 | Create a dir on the SD card: | 14 | Create a dir on the SD card: |
15 | mkdir /mnt/card/localmail | 15 | mkdir /mnt/card/localmail |
16 | Go to your home dir: | 16 | Go to your home dir: |
17 | cd | 17 | cd |
18 | Go to kopiemail data storage dir: | 18 | Go to kopiemail data storage dir: |
19 | cd kdepim/apps/kopiemail | 19 | cd kdepim/apps/kopiemail |
20 | Create a symlink to the SD card: | 20 | Create a symlink to the SD card: |
21 | ls -s /mnt/card/localmail | 21 | ls -s /mnt/card/localmail |
22 | Now KOpieMail will store all mails on the SD card. | 22 | Now KOpieMail will store all mails on the SD card. |
23 | 23 | ||
24 | KO/Pi Monthview: | ||
25 | Now "Go to Today" selects the current month from day 1-end, | ||
26 | not the current date + some days. | ||
27 | I.e. "Go to Today" shows now always | ||
28 | the current month with first day of month in the first row. | ||
29 | |||
24 | 30 | ||
25 | ********** VERSION 1.9.13 ************ | 31 | ********** VERSION 1.9.13 ************ |
26 | 32 | ||
27 | Fixed nasty PwM/Pi file reading bug, when | 33 | Fixed nasty PwM/Pi file reading bug, when |
28 | the used hash algo of file is different then the global | 34 | the used hash algo of file is different then the global |
29 | hash algo. | 35 | hash algo. |
30 | 36 | ||
31 | Added KA/Pi support for opie mailit mailapplication. | 37 | Added KA/Pi support for opie mailit mailapplication. |
32 | 38 | ||
33 | Fixed some bugs in OM/Pi. | 39 | Fixed some bugs in OM/Pi. |
34 | Now character conversion tables are available for the Zaurus | 40 | Now character conversion tables are available for the Zaurus |
35 | to make OM/Pi working properly. | 41 | to make OM/Pi working properly. |
36 | To get the character conversion in OM/Pi working, please download | 42 | To get the character conversion in OM/Pi working, please download |
37 | at the sourceforge project site the package | 43 | at the sourceforge project site the package |
38 | sr-character-conversion_SharpROM_arm.ipk.zip | 44 | sr-character-conversion_SharpROM_arm.ipk.zip |
39 | (or oz-character-conversion_OZ-gcc3xx_arm.ipk.zip for OZ roms) | 45 | (or oz-character-conversion_OZ-gcc3xx_arm.ipk.zip for OZ roms) |
40 | from the section "general files for KDE/Pim" | 46 | from the section "general files for KDE/Pim" |
41 | Instructions how to install this package are in a ReadMe in this file. | 47 | Instructions how to install this package are in a ReadMe in this file. |
42 | 48 | ||
43 | 49 | ||
44 | Fixed the orientation change problem in KA/Pi when switching | 50 | Fixed the orientation change problem in KA/Pi when switching |
45 | portrait/landscape mode. | 51 | portrait/landscape mode. |
46 | 52 | ||
47 | French translation available for KA/Pi and OM/Pi. | 53 | French translation available for KA/Pi and OM/Pi. |
48 | 54 | ||
49 | Fixed some problems with categories in KO/Pi in DTM sync. | 55 | Fixed some problems with categories in KO/Pi in DTM sync. |
50 | 56 | ||
51 | Added selection dialog for export to phone in KA/Pi. | 57 | Added selection dialog for export to phone in KA/Pi. |
52 | 58 | ||
53 | If in KO/Pi is an attendee selected to add to a meeting and this | 59 | If in KO/Pi is an attendee selected to add to a meeting and this |
54 | attendee is already in the list of attendees, this person is not added | 60 | attendee is already in the list of attendees, this person is not added |
55 | again. | 61 | again. |
56 | 62 | ||
57 | Some menu cleanup in KA/Pi. | 63 | Some menu cleanup in KA/Pi. |
58 | 64 | ||
59 | ********** VERSION 1.9.12 ************ | 65 | ********** VERSION 1.9.12 ************ |
60 | 66 | ||
61 | Fix for the bug in KO/Pi What's Next view of version 1.9.11. | 67 | Fix for the bug in KO/Pi What's Next view of version 1.9.11. |
62 | 68 | ||
63 | Bugfix: Licence file is now shown again. | 69 | Bugfix: Licence file is now shown again. |
64 | 70 | ||
65 | OM/Pi now supports Unicode (utf8 charset). | 71 | OM/Pi now supports Unicode (utf8 charset). |
66 | Fixed some bugs in OM/Pi. | 72 | Fixed some bugs in OM/Pi. |
67 | 73 | ||
68 | KA/Pi has more German translation. | 74 | KA/Pi has more German translation. |
69 | 75 | ||
70 | 76 | ||
71 | ********** VERSION 1.9.11 ************ | 77 | ********** VERSION 1.9.11 ************ |
72 | 78 | ||
73 | Fixed several problems in PWM/Pi, like | 79 | Fixed several problems in PWM/Pi, like |
74 | asking the user, if unsaved changed are pending | 80 | asking the user, if unsaved changed are pending |
75 | when closing the app. | 81 | when closing the app. |
76 | And PwM/Pi handles now different texts for the | 82 | And PwM/Pi handles now different texts for the |
77 | fields Description, Username, Password, configurable per category. | 83 | fields Description, Username, Password, configurable per category. |
78 | 84 | ||
79 | Fixed a crash in KO/Pi , when importing/loading vcs files | 85 | Fixed a crash in KO/Pi , when importing/loading vcs files |
80 | which have an entry with an attendee with state: | 86 | which have an entry with an attendee with state: |
81 | NEEDS ACTION | 87 | NEEDS ACTION |
82 | 88 | ||
83 | Fixed some problems in the German translation of OM/Pi, | 89 | Fixed some problems in the German translation of OM/Pi, |
84 | which makes some dialogs not fitting on the screen | 90 | which makes some dialogs not fitting on the screen |
85 | of the Z 5500. | 91 | of the Z 5500. |
86 | 92 | ||
87 | Fixed Qtopia crash, when disabling/deinstalling | 93 | Fixed Qtopia crash, when disabling/deinstalling |
88 | KO/Pi alarm applet. | 94 | KO/Pi alarm applet. |
89 | 95 | ||
90 | Implemented direct KDE<->KA/Pi sync for KA/Pi running | 96 | Implemented direct KDE<->KA/Pi sync for KA/Pi running |
91 | on Linux desktop. | 97 | on Linux desktop. |
92 | 98 | ||
93 | Added feature "remove sync info" to sync menu. | 99 | Added feature "remove sync info" to sync menu. |
94 | 100 | ||
95 | Tweaked the KO/Pi What's next view a bit, added | 101 | Tweaked the KO/Pi What's next view a bit, added |
96 | setting to hide events that are done. | 102 | setting to hide events that are done. |
97 | 103 | ||
98 | Disabled "beam receive enabled" on startup to | 104 | Disabled "beam receive enabled" on startup to |
99 | avoid problems if Fastload is enabled. | 105 | avoid problems if Fastload is enabled. |
100 | Please set "beam receive enabled", | 106 | Please set "beam receive enabled", |
101 | if you want to receive data via IR. | 107 | if you want to receive data via IR. |
102 | 108 | ||
103 | Fixed bug in direct KDE<->KO/Pi sync for KO/Pi running | 109 | Fixed bug in direct KDE<->KO/Pi sync for KO/Pi running |
104 | on Linux desktop. | 110 | on Linux desktop. |
105 | 111 | ||
106 | Made in KA/Pi scrolling possible, if details view is selected. | 112 | Made in KA/Pi scrolling possible, if details view is selected. |
107 | (The keyboard focus is set automatically to the search line) | 113 | (The keyboard focus is set automatically to the search line) |
108 | 114 | ||
109 | Fixed a bug in DMT sync, that a new entry in DTM was added | 115 | Fixed a bug in DMT sync, that a new entry in DTM was added |
110 | on every sync to Kx/Pi. | 116 | on every sync to Kx/Pi. |
111 | 117 | ||
112 | Fixed missing writing of KA/Pi categories to DMT entries when syncing. | 118 | Fixed missing writing of KA/Pi categories to DMT entries when syncing. |
113 | 119 | ||
114 | Fixed a bug in DMT sync with todos created in KO/Pi containing | 120 | Fixed a bug in DMT sync with todos created in KO/Pi containing |
115 | non-latin1 characters. | 121 | non-latin1 characters. |
116 | 122 | ||
117 | Rearranged package contents of Sharp-ipks and made all | 123 | Rearranged package contents of Sharp-ipks and made all |
118 | packages installable on SD again. | 124 | packages installable on SD again. |
119 | 125 | ||
120 | Fixed the writing of addressbook data in DTM sync. | 126 | Fixed the writing of addressbook data in DTM sync. |
121 | Empty fields in KA/Pi were not removed. | 127 | Empty fields in KA/Pi were not removed. |
122 | 128 | ||
123 | Added better category handling in KA/Pi: | 129 | Added better category handling in KA/Pi: |
124 | Added item | 130 | Added item |
125 | Edit Categories and | 131 | Edit Categories and |
126 | Manage new categories | 132 | Manage new categories |
127 | to the settings menu. | 133 | to the settings menu. |
128 | Possible to configure a view to display categories. | 134 | Possible to configure a view to display categories. |
129 | 135 | ||
130 | Added detailed "KDE Sync Howto" and "Multi Sync Howto" to Help menu. | 136 | Added detailed "KDE Sync Howto" and "Multi Sync Howto" to Help menu. |
131 | 137 | ||
132 | Fixed displaying of "free" days and time in KO Monthview and Agendaview. | 138 | Fixed displaying of "free" days and time in KO Monthview and Agendaview. |
133 | 139 | ||
134 | ... and many other bugfixes. | 140 | ... and many other bugfixes. |
135 | 141 | ||
136 | ********** VERSION 1.9.10 ************ | 142 | ********** VERSION 1.9.10 ************ |
137 | 143 | ||
138 | Many internal small bugfixes. | 144 | Many internal small bugfixes. |
139 | And fix of the "big" bug in KO/Pi, | 145 | And fix of the "big" bug in KO/Pi, |
140 | that after Syncing the appointments had an offset by several hours. | 146 | that after Syncing the appointments had an offset by several hours. |
141 | That was a problem with the internal timezone setting, | 147 | That was a problem with the internal timezone setting, |
142 | introduced by the changed timezone configuration settings. | 148 | introduced by the changed timezone configuration settings. |
143 | 149 | ||
144 | German translation for OM/Pi is now available. | 150 | German translation for OM/Pi is now available. |
145 | 151 | ||
146 | 152 | ||
147 | ********** VERSION 1.9.9 ************ | 153 | ********** VERSION 1.9.9 ************ |
148 | 154 | ||
149 | KDE-Pim/Pi has a new Member! | 155 | KDE-Pim/Pi has a new Member! |
150 | It is called PWM/Pi (Passwordmanager/platform-independent) | 156 | It is called PWM/Pi (Passwordmanager/platform-independent) |
151 | and it is available for the Zaurus. | 157 | and it is available for the Zaurus. |
152 | It is planned, that it will be available later for Windows. | 158 | It is planned, that it will be available later for Windows. |
153 | (And for Linux, of course). | 159 | (And for Linux, of course). |
154 | It is a port of the Passwordmanager of KDE. | 160 | It is a port of the Passwordmanager of KDE. |
155 | It will need the MicroKDElibs to run. | 161 | It will need the MicroKDElibs to run. |
156 | 162 | ||
157 | Made loading of addressbooks in KA/Pi up to 7 times faster! | 163 | Made loading of addressbooks in KA/Pi up to 7 times faster! |
158 | The bigger your addressbook file, the more starting speed | 164 | The bigger your addressbook file, the more starting speed |
159 | will you gain. (relatively) | 165 | will you gain. (relatively) |
160 | 166 | ||
161 | The Qtopia addressbook connector is now platform independend | 167 | The Qtopia addressbook connector is now platform independend |
162 | as well and should work on any platform for importing/exporting | 168 | as well and should work on any platform for importing/exporting |
163 | Qtopia and Opie XML files. | 169 | Qtopia and Opie XML files. |
164 | 170 | ||
165 | Added a +30min feature to the timezone settings to make | 171 | Added a +30min feature to the timezone settings to make |
166 | KDE-Pim/Pi useable in Australia and other parts on the | 172 | KDE-Pim/Pi useable in Australia and other parts on the |
167 | world with strange timezones ;-) | 173 | world with strange timezones ;-) |
168 | 174 | ||
169 | German "Umlaute" should now be sorted correctly on the Z in KA/Pi. | 175 | German "Umlaute" should now be sorted correctly on the Z in KA/Pi. |
170 | 176 | ||
171 | It is now possible to disable the | 177 | It is now possible to disable the |
172 | "receive data via infrared" feature, such that syncing with | 178 | "receive data via infrared" feature, such that syncing with |
173 | Outlook is now possible again with Kx/Pi runing. | 179 | Outlook is now possible again with Kx/Pi runing. |
174 | Please disable it, before syncing Sharp DTM with Outlook. | 180 | Please disable it, before syncing Sharp DTM with Outlook. |
175 | For your convenience, the "receive data via infrared" feature | 181 | For your convenience, the "receive data via infrared" feature |
176 | is disabled automatically, if you sync Kx/Pi with DTM. | 182 | is disabled automatically, if you sync Kx/Pi with DTM. |
177 | You have to enable it again manually after syncing. | 183 | You have to enable it again manually after syncing. |
178 | Enabling this feature makes it impossible to start the | 184 | Enabling this feature makes it impossible to start the |
179 | Sharp DTM apps. If this feature is enabled, you will only get the | 185 | Sharp DTM apps. If this feature is enabled, you will only get the |
180 | alarm notification from KO/Pi and not from the Sharp calendar. | 186 | alarm notification from KO/Pi and not from the Sharp calendar. |
181 | This is very useful if you sync KO/Pi with Sharp DTM, | 187 | This is very useful if you sync KO/Pi with Sharp DTM, |
182 | because after syncing you usually would get notified about | 188 | because after syncing you usually would get notified about |
183 | an alarm by KO/Pi and the Sharp Calendar. | 189 | an alarm by KO/Pi and the Sharp Calendar. |
184 | 190 | ||
185 | Together with the Linux desktop version of KO/Pi | 191 | Together with the Linux desktop version of KO/Pi |
186 | it is now possible to sync KO/Pi on the Zaurus | 192 | it is now possible to sync KO/Pi on the Zaurus |
187 | with the complete KDE-desktop (3.3 or later) | 193 | with the complete KDE-desktop (3.3 or later) |
188 | calendar data easily. | 194 | calendar data easily. |
189 | That makes it possible to sync the Z with one | 195 | That makes it possible to sync the Z with one |
190 | click of a mouse with the KDE-Desktop. | 196 | click of a mouse with the KDE-Desktop. |
191 | This feature it available for all Zaurus platforms KO/Pi | 197 | This feature it available for all Zaurus platforms KO/Pi |
192 | is running on. | 198 | is running on. |
193 | The only thing needed is a running KO/Pi on Linux and | 199 | The only thing needed is a running KO/Pi on Linux and |
194 | a compiled version of the small | 200 | a compiled version of the small |
195 | KDE-Pim/Pi<->KDE-Desktop access command line program, | 201 | KDE-Pim/Pi<->KDE-Desktop access command line program, |
196 | which is in the KDE-Pim/Pi sources available. | 202 | which is in the KDE-Pim/Pi sources available. |
197 | 203 | ||
198 | The "KDE-desktop" syncing feature for KA/Pi will follow | 204 | The "KDE-desktop" syncing feature for KA/Pi will follow |
199 | in the next releases. | 205 | in the next releases. |
200 | 206 | ||
201 | Fixed the vcard export bug, which had the version 1.9.8. | 207 | Fixed the vcard export bug, which had the version 1.9.8. |
202 | 208 | ||
203 | Added missing GERMAN translation to KO/Pi. | 209 | Added missing GERMAN translation to KO/Pi. |
204 | Hi PsionX, could you add the missing french translation?Thx! | 210 | Hi PsionX, could you add the missing french translation?Thx! |
205 | 211 | ||
206 | Translation files for KA/Pi are available as well. | 212 | Translation files for KA/Pi are available as well. |
207 | GERMAN translation will be available in the next release. | 213 | GERMAN translation will be available in the next release. |
208 | PsionX ( yres, you again ;-) ), could you start translating | 214 | PsionX ( yres, you again ;-) ), could you start translating |
209 | KA/Pi? Thx! | 215 | KA/Pi? Thx! |
210 | 216 | ||
211 | You can download the version 1.9.9 at | 217 | You can download the version 1.9.9 at |
212 | 218 | ||
213 | http://sourceforge.net/project/showfiles.php?group_id=104103&package_id=112604 | 219 | http://sourceforge.net/project/showfiles.php?group_id=104103&package_id=112604 |
214 | 220 | ||
215 | Note: | 221 | Note: |
216 | To run the mail program OM/Pi you need libopenssl. | 222 | To run the mail program OM/Pi you need libopenssl. |
217 | A link to a download loaction is available at | 223 | A link to a download loaction is available at |
218 | ZSI at www.killefiz.de | 224 | ZSI at www.killefiz.de |
219 | 225 | ||
220 | 226 | ||
221 | ********** VERSION 1.9.8 ************ | 227 | ********** VERSION 1.9.8 ************ |
222 | 228 | ||
223 | Fixed character decoding in OM/Pi. | 229 | Fixed character decoding in OM/Pi. |
224 | (e.g. German "Umlaute" were not displayed properly.) | 230 | (e.g. German "Umlaute" were not displayed properly.) |
225 | 231 | ||
226 | Made is possible to reparent todos in KO/Pi. | 232 | Made is possible to reparent todos in KO/Pi. |
227 | Use contextmenu or keys (look at Help-Keys + Colors) for that. | 233 | Use contextmenu or keys (look at Help-Keys + Colors) for that. |
228 | 234 | ||
229 | Added the missing Sync-Howto and WhatsNew to the packages. | 235 | Added the missing Sync-Howto and WhatsNew to the packages. |
230 | 236 | ||
231 | KO/Pi on Linux desktop can now sync with KDE desktop. | 237 | KO/Pi on Linux desktop can now sync with KDE desktop. |
232 | That means: When using KO/Pi on Linux desktop for syncing with | 238 | That means: When using KO/Pi on Linux desktop for syncing with |
233 | KDE desktop and the Zaurus, the Zaurus can be synced now | 239 | KDE desktop and the Zaurus, the Zaurus can be synced now |
234 | with all KDE-Calendar resources, not only with one local file. | 240 | with all KDE-Calendar resources, not only with one local file. |
235 | (That makes it possible to sync the Zaurus with the | 241 | (That makes it possible to sync the Zaurus with the |
236 | calendar data on a Kolab server) | 242 | calendar data on a Kolab server) |
237 | 243 | ||
238 | KA/Pi syncing with KDE desktop will be available in the next version. | 244 | KA/Pi syncing with KDE desktop will be available in the next version. |
239 | 245 | ||
240 | 246 | ||
241 | ********** VERSION 1.9.7 ************ | 247 | ********** VERSION 1.9.7 ************ |
242 | 248 | ||
243 | KO/Pi - KA/Pi on Windows: | 249 | KO/Pi - KA/Pi on Windows: |
244 | Now a directory can be defined by the user, where the | 250 | Now a directory can be defined by the user, where the |
245 | application/config data should be saved. | 251 | application/config data should be saved. |
246 | Define your desired path in the evironment variable | 252 | Define your desired path in the evironment variable |
247 | MICROKDEHOME | 253 | MICROKDEHOME |
248 | before starting KO/Pi or KA/Pi. | 254 | before starting KO/Pi or KA/Pi. |
249 | 255 | ||
250 | An easy Kx/Pi to Kx/Pi syncing is now possible | 256 | An easy Kx/Pi to Kx/Pi syncing is now possible |
251 | (it is called Pi-Sync) via network. | 257 | (it is called Pi-Sync) via network. |
252 | Please look at the Sync Howto. | 258 | Please look at the Sync Howto. |
253 | 259 | ||
254 | Exporting of calendar data and contacts to mobile phones is now possible. | 260 | Exporting of calendar data and contacts to mobile phones is now possible. |
255 | The SyncHowto is updated with information howto | 261 | The SyncHowto is updated with information howto |
256 | access/sync mobile phones. | 262 | access/sync mobile phones. |
257 | Please look at the Sync Howto. | 263 | Please look at the Sync Howto. |
258 | 264 | ||
259 | Now KO/Pi and KA/Pi on the Zaurus can receive data via infrared directly. | 265 | Now KO/Pi and KA/Pi on the Zaurus can receive data via infrared directly. |
260 | Please disable Fastload for the original contact/calendar applications | 266 | Please disable Fastload for the original contact/calendar applications |
261 | and close them. | 267 | and close them. |
262 | KO/Pi and KA/Pi must be running in order to receive the data. | 268 | KO/Pi and KA/Pi must be running in order to receive the data. |
263 | (KO/Pi and KA/Pi are always running if Fastload for them is enabled!) | 269 | (KO/Pi and KA/Pi are always running if Fastload for them is enabled!) |
264 | 270 | ||
265 | In the KA/Pi details view are now the preferred tel. numbers displayed on top | 271 | In the KA/Pi details view are now the preferred tel. numbers displayed on top |
266 | of the other data ( emails/tel.numbers/addresses) | 272 | of the other data ( emails/tel.numbers/addresses) |
267 | 273 | ||
268 | Fixed some syncing problems in KA/Pi. | 274 | Fixed some syncing problems in KA/Pi. |
269 | 275 | ||
270 | Added font settings for the KA/Pi details view. | 276 | Added font settings for the KA/Pi details view. |
271 | Added fields "children's name" and "gender" to KA/Pi. | 277 | Added fields "children's name" and "gender" to KA/Pi. |
272 | 278 | ||
273 | Made searching in KA/Pi better: | 279 | Made searching in KA/Pi better: |
274 | Now the first item in a view is selected after a search automatically and | 280 | Now the first item in a view is selected after a search automatically and |
275 | the views can be scrolled up/down when the search input field has the keyboard focus. | 281 | the views can be scrolled up/down when the search input field has the keyboard focus. |
276 | 282 | ||
277 | And, of course, fixed a bunch of reported bugs in KO/Pi and KA/Pi. | 283 | And, of course, fixed a bunch of reported bugs in KO/Pi and KA/Pi. |
278 | 284 | ||
279 | 285 | ||
280 | ********** VERSION 1.9.6 ************ | 286 | ********** VERSION 1.9.6 ************ |
281 | 287 | ||
282 | Changes in the external application communication on the Zaurus | 288 | Changes in the external application communication on the Zaurus |
283 | in order to use less RAM when the apps are running. | 289 | in order to use less RAM when the apps are running. |
284 | First syncing of addressbooks (KA/Pi) is possible. | 290 | First syncing of addressbooks (KA/Pi) is possible. |
285 | 291 | ||
286 | 292 | ||
287 | ********** VERSION 1.9.5a ************ | 293 | ********** VERSION 1.9.5a ************ |
288 | 294 | ||
289 | Fixed a bug in KO/Pi in the SharpDTM sync of version 1.9.5. | 295 | Fixed a bug in KO/Pi in the SharpDTM sync of version 1.9.5. |
290 | Fixed some small bugs. | 296 | Fixed some small bugs. |
291 | KA/Pi shows now the birthday in summary view. | 297 | KA/Pi shows now the birthday in summary view. |
292 | Now OM/Pi and KA/Pi are using the date format defined in KO/Pi | 298 | Now OM/Pi and KA/Pi are using the date format defined in KO/Pi |
293 | for displaying dates. | 299 | for displaying dates. |
294 | 300 | ||
295 | 301 | ||
296 | ********** VERSION 1.9.5 ************ | 302 | ********** VERSION 1.9.5 ************ |
297 | 303 | ||
298 | There is still no Addressbook syncing! | 304 | There is still no Addressbook syncing! |
299 | 305 | ||
300 | New in 1.9.5: | 306 | New in 1.9.5: |
301 | 307 | ||
302 | Many bugfixes. | 308 | Many bugfixes. |
303 | Better searching in KA/Pi. | 309 | Better searching in KA/Pi. |
304 | You can configure in KA/Pi if you want to search only after | 310 | You can configure in KA/Pi if you want to search only after |
305 | <return> key pressed. | 311 | <return> key pressed. |
306 | 312 | ||
307 | Better mail downloading in OM/Pi. | 313 | Better mail downloading in OM/Pi. |
308 | 314 | ||
309 | First experimental alpha version of sync of KO/Pi with mobile phones. | 315 | First experimental alpha version of sync of KO/Pi with mobile phones. |
310 | See gammu documentation for supported phones. | 316 | See gammu documentation for supported phones. |
311 | You need to install the package kammu_1.9.5_arm.ipk for sync of KO/Pi with mobile phones. kammu_1.9.5_arm.ipk needs libbluetooth and libsdp. | 317 | You need to install the package kammu_1.9.5_arm.ipk for sync of KO/Pi with mobile phones. kammu_1.9.5_arm.ipk needs libbluetooth and libsdp. |
312 | Quick hint how to use: | 318 | Quick hint how to use: |
313 | NOTE: MOBILE PHONE SYNC IS EXPERIMENTAL! | 319 | NOTE: MOBILE PHONE SYNC IS EXPERIMENTAL! |
314 | Install kammu_1.9.5_arm.ipk , libbluetooth and libsdp. | 320 | Install kammu_1.9.5_arm.ipk , libbluetooth and libsdp. |
315 | Create syncprofile - mobile device | 321 | Create syncprofile - mobile device |
316 | Remove entry for model. (Leave empty ). | 322 | Remove entry for model. (Leave empty ). |
317 | Enable infrared on Zaurus and your Phone. | 323 | Enable infrared on Zaurus and your Phone. |
318 | Sync. | 324 | Sync. |
319 | To get a more detailed log, start kopi from konsole. | 325 | To get a more detailed log, start kopi from konsole. |
320 | 326 | ||
321 | ********** VERSION 1.9.4 ************ | 327 | ********** VERSION 1.9.4 ************ |
322 | 328 | ||
323 | This is the version 1.9.4 of KDE-Pim/Pi for the Zaurus. | 329 | This is the version 1.9.4 of KDE-Pim/Pi for the Zaurus. |
324 | 330 | ||
325 | WARNING: | 331 | WARNING: |
326 | PLEASE BACKUP ALL YOUR DATA! | 332 | PLEASE BACKUP ALL YOUR DATA! |
327 | We have changed a lot and maybe there are some unknown problems. | 333 | We have changed a lot and maybe there are some unknown problems. |
328 | 334 | ||
329 | SYNC HANDLING HAS CHANGED! | 335 | SYNC HANDLING HAS CHANGED! |
330 | Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. | 336 | Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. |
331 | (This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). | 337 | (This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). |
332 | 338 | ||
333 | You need the kmicrokdelibs_1.9.4_arm.ipk as a base for the other programs. | 339 | You need the kmicrokdelibs_1.9.4_arm.ipk as a base for the other programs. |
334 | If you get the error: "Install only possible in main memory", just try it again to install it on SD card. That worked for me. And it was reported that rebooting Qtopia did help in this case as well. | 340 | If you get the error: "Install only possible in main memory", just try it again to install it on SD card. That worked for me. And it was reported that rebooting Qtopia did help in this case as well. |
335 | 341 | ||
336 | As programs are available: | 342 | As programs are available: |
337 | KO/Pi (korganizer ipk) - a calendar program. | 343 | KO/Pi (korganizer ipk) - a calendar program. |
338 | KA/Pi (kaddressbook ipk ) - an addressbook | 344 | KA/Pi (kaddressbook ipk ) - an addressbook |
339 | OM/Pi (kopiemail ipk ) an email program with pop/smtp and IMAP support. | 345 | OM/Pi (kopiemail ipk ) an email program with pop/smtp and IMAP support. |
340 | 346 | ||
341 | An alarm notification program ( korganizer-alarm ipk ) for KO/Pi that notifies you about alarms, even if the Zaurus is in suspend mode. | 347 | An alarm notification program ( korganizer-alarm ipk ) for KO/Pi that notifies you about alarms, even if the Zaurus is in suspend mode. |
342 | (If you do not see an icon in the taskbar after installing korganizer-alarm, please restart Qtopia) | 348 | (If you do not see an icon in the taskbar after installing korganizer-alarm, please restart Qtopia) |
343 | 349 | ||
344 | All the applications are installed in a "Pim" TAB. | 350 | All the applications are installed in a "Pim" TAB. |
345 | If this TAB is new on your system, you can get an icon in this TAB by installing pim_TAB_icon_1.9.4_arm.ipk | 351 | If this TAB is new on your system, you can get an icon in this TAB by installing pim_TAB_icon_1.9.4_arm.ipk |
346 | 352 | ||
347 | All the application are integrated. | 353 | All the application are integrated. |
348 | Such that you can choose in KO/Pi the attendees of a meeting from the addresses in KA/Pi. When you click in KA/Pi on the email address, OM/Pi is started to write the mail. | 354 | Such that you can choose in KO/Pi the attendees of a meeting from the addresses in KA/Pi. When you click in KA/Pi on the email address, OM/Pi is started to write the mail. |
349 | 355 | ||
350 | HINT: | 356 | HINT: |
351 | If you install KPhone/Pi 0.9.7, it will be called, if you click in KA/Pi on a phone number. | 357 | If you install KPhone/Pi 0.9.7, it will be called, if you click in KA/Pi on a phone number. |
352 | 358 | ||
353 | What's new? | 359 | What's new? |
354 | 360 | ||
355 | SYNC HANDLING HAS CHANGED! | 361 | SYNC HANDLING HAS CHANGED! |
356 | Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. | 362 | Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. |
357 | (This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). | 363 | (This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). |
358 | 364 | ||
359 | New in OM/Pi: | 365 | New in OM/Pi: |
360 | When copying(i.e. downloading mails) , you can specify, that only mails of a given size should be downloaded. Added mail copy possibility for selected mails. | 366 | When copying(i.e. downloading mails) , you can specify, that only mails of a given size should be downloaded. Added mail copy possibility for selected mails. |
361 | 367 | ||
362 | New in KO/Pi: | 368 | New in KO/Pi: |
363 | French is now available for KO/Pi. | 369 | French is now available for KO/Pi. |
364 | Choose menu:Actions - Configure:TAB locale | 370 | Choose menu:Actions - Configure:TAB locale |
365 | Syncing has changed. | 371 | Syncing has changed. |
366 | Phone sync available soon. | 372 | Phone sync available soon. |
367 | Not much changes, I cannot remember them ... | 373 | Not much changes, I cannot remember them ... |
368 | 374 | ||
369 | New in KA/Pi: | 375 | New in KA/Pi: |
370 | Beaming possible. | 376 | Beaming possible. |
371 | Sharp DTM readonly access possible( create a new DTM resource ); | 377 | Sharp DTM readonly access possible( create a new DTM resource ); |
372 | Better searching possible. | 378 | Better searching possible. |
373 | Search is performed only after pressing the return key. | 379 | Search is performed only after pressing the return key. |
374 | Use wildcard * to specify parts of a name. | 380 | Use wildcard * to specify parts of a name. |
375 | 381 | ||
376 | Better name/email selection dialog (called from KO/Pi or OM/Pi). In this dialog, now searching is possible. Like in KA/Pi, use return key and wildcard * . | 382 | Better name/email selection dialog (called from KO/Pi or OM/Pi). In this dialog, now searching is possible. Like in KA/Pi, use return key and wildcard * . |
377 | 383 | ||
378 | A big improvement is the new management of the contact access. | 384 | A big improvement is the new management of the contact access. |
379 | In version 1.9.3, every application was using their own addressbook access data. | 385 | In version 1.9.3, every application was using their own addressbook access data. |
380 | That means, the addressbook was loaded up to three times in the memory, when accessed by KA/Pi, KO/Pi and OM/Pi. | 386 | That means, the addressbook was loaded up to three times in the memory, when accessed by KA/Pi, KO/Pi and OM/Pi. |
381 | That was wasting of memory, if you had several hundreds of contacts. | 387 | That was wasting of memory, if you had several hundreds of contacts. |
382 | 388 | ||
383 | Now only KA/Pi accesses the addressbook. | 389 | Now only KA/Pi accesses the addressbook. |
384 | If KO/Pi or OM/Pi want to get some name/email data, they request KA/Pi to open the name/email selection dialog and send it back to them. | 390 | If KO/Pi or OM/Pi want to get some name/email data, they request KA/Pi to open the name/email selection dialog and send it back to them. |
385 | If you click on an attendee in a meeting, its contact data is displayed in KA/Pi directly. | 391 | If you click on an attendee in a meeting, its contact data is displayed in KA/Pi directly. |
386 | That means, if KO/Pi or OM/Pi want to access contact data, KA/Pi is started first. | 392 | That means, if KO/Pi or OM/Pi want to access contact data, KA/Pi is started first. |
387 | 393 | ||
388 | New in the KO/Pi alarm applet: | 394 | New in the KO/Pi alarm applet: |
389 | Configure your own timer popup menu! | 395 | Configure your own timer popup menu! |
390 | (Text and minutes for timer countdown) | 396 | (Text and minutes for timer countdown) |
391 | Just edit the file | 397 | Just edit the file |
392 | (yourhomedir)/.kopialarmtimerrc | 398 | (yourhomedir)/.kopialarmtimerrc |
393 | and start/stop a timer to get a new menu with the data of this file. | 399 | and start/stop a timer to get a new menu with the data of this file. |
394 | 400 | ||
395 | ********** VERSION 1.9.3 ************ | 401 | ********** VERSION 1.9.3 ************ |
396 | 1) | 402 | 1) |
397 | Now KO/Pi on Windows imports directly the calendar data of | 403 | Now KO/Pi on Windows imports directly the calendar data of |
398 | an installed Outlook. Should work with OL version >= 2000. | 404 | an installed Outlook. Should work with OL version >= 2000. |
399 | 405 | ||
400 | ********** VERSION 1.9.2 ************ | 406 | ********** VERSION 1.9.2 ************ |
401 | 1) | 407 | 1) |
402 | KDE-Pim/Pi has got a new member: | 408 | KDE-Pim/Pi has got a new member: |
403 | KmicroMail (KM/Pi) is a mail program, | 409 | KmicroMail (KM/Pi) is a mail program, |
404 | which can handle IMAP and POP mail access. | 410 | which can handle IMAP and POP mail access. |
405 | It is based on Opie-Mail v3. | 411 | It is based on Opie-Mail v3. |
406 | All dependencies to the Opie libraries ar removed, | 412 | All dependencies to the Opie libraries ar removed, |
407 | such that no additional Opie lib is needed. | 413 | such that no additional Opie lib is needed. |
408 | It is already integrated in KO/Pi and KA/Pi. | 414 | It is already integrated in KO/Pi and KA/Pi. |
409 | It it now available for the Zaurus,probably it | 415 | It it now available for the Zaurus,probably it |
410 | will be available for other platforms later. | 416 | will be available for other platforms later. |
411 | Hint: | 417 | Hint: |
412 | Create your own contact (name + email) | 418 | Create your own contact (name + email) |
413 | in KA/Pi, select this contact and choose menu: | 419 | in KA/Pi, select this contact and choose menu: |
414 | Settings - Set Who Am I. | 420 | Settings - Set Who Am I. |
415 | Now the settings of this contact are used as | 421 | Now the settings of this contact are used as |
416 | the sender data in KM/Pi. | 422 | the sender data in KM/Pi. |
417 | 2) | 423 | 2) |
418 | KDE-Pim/Pi is split up in five different | 424 | KDE-Pim/Pi is split up in five different |
419 | packages now precompiled for Sharp Zaurus: | 425 | packages now precompiled for Sharp Zaurus: |
420 | --kmicrokdelibs_1.9.2_arm.ipk | 426 | --kmicrokdelibs_1.9.2_arm.ipk |
421 | The libs are needed for any | 427 | The libs are needed for any |
422 | of the following programs: | 428 | of the following programs: |
423 | --kaddressbook_1.9.2_arm.ipk | 429 | --kaddressbook_1.9.2_arm.ipk |
424 | --kmicromail_1.9.2_arm.ipk | 430 | --kmicromail_1.9.2_arm.ipk |
425 | --korganizer_1.9.2_arm.ipk | 431 | --korganizer_1.9.2_arm.ipk |
426 | Independ from that, there is the alarm applet | 432 | Independ from that, there is the alarm applet |
427 | available for KO/Pi, which also offers | 433 | available for KO/Pi, which also offers |
428 | quick access for a new mail or | 434 | quick access for a new mail or |
429 | showing the addressbook.: | 435 | showing the addressbook.: |
430 | --korganizer-alarm_1.9.2_arm.ipk | 436 | --korganizer-alarm_1.9.2_arm.ipk |
431 | Independend means, that the alarm applet | 437 | Independend means, that the alarm applet |
432 | does not need any of the libs or programs above to run. | 438 | does not need any of the libs or programs above to run. |
433 | But it would be quite useless without these programs. | 439 | But it would be quite useless without these programs. |
434 | NOTE: | 440 | NOTE: |
435 | If you get a | 441 | If you get a |
436 | "This application depends on other programs" | 442 | "This application depends on other programs" |
437 | during installation of | 443 | during installation of |
438 | --kmicrokdelibs_1.9.2_arm.ipk | 444 | --kmicrokdelibs_1.9.2_arm.ipk |
439 | you probably do not have to care about that. | 445 | you probably do not have to care about that. |
440 | kmicrokdelibs_1.9.2 will come with some | 446 | kmicrokdelibs_1.9.2 will come with some |
441 | resource plugins, which needs additional libraries. | 447 | resource plugins, which needs additional libraries. |
442 | (E.g. libopie1, if you want to use the | 448 | (E.g. libopie1, if you want to use the |
443 | opie resource connector in KA/Pi). | 449 | opie resource connector in KA/Pi). |
444 | If you do not have this libraries installed, | 450 | If you do not have this libraries installed, |
445 | you simply cannot use the resource. | 451 | you simply cannot use the resource. |
446 | To make it clear: | 452 | To make it clear: |
447 | If the libraries are missing, the applications | 453 | If the libraries are missing, the applications |
448 | using kmicrokdelibs will start, | 454 | using kmicrokdelibs will start, |
449 | because the resources are plugins. | 455 | because the resources are plugins. |
450 | 3) | 456 | 3) |
451 | KO/Pi and friends are now installable on SD-Card! | 457 | KO/Pi and friends are now installable on SD-Card! |
452 | It is recommended to install all libs and apps | 458 | It is recommended to install all libs and apps |
453 | on the SD card or all in the internal storage. | 459 | on the SD card or all in the internal storage. |
454 | There may be problems, if this is mixed. | 460 | There may be problems, if this is mixed. |
455 | 4) | 461 | 4) |
456 | Fixed two bugs in the alarm notification on Windows. | 462 | Fixed two bugs in the alarm notification on Windows. |
457 | 5) | 463 | 5) |
458 | Great improvement! | 464 | Great improvement! |
459 | KO/Pi uses now the latest version of libical. | 465 | KO/Pi uses now the latest version of libical. |
460 | Libical is the library which actually reads | 466 | Libical is the library which actually reads |
461 | the calendar files and extract the data from it. | 467 | the calendar files and extract the data from it. |
462 | With the old version, there were problems | 468 | With the old version, there were problems |
463 | (crashes or program hangs) when licical did read | 469 | (crashes or program hangs) when licical did read |
464 | files, which were not stored from KO/Pi. | 470 | files, which were not stored from KO/Pi. |
465 | I do not know, if the new libical works perfect, | 471 | I do not know, if the new libical works perfect, |
466 | but actually it works much better than | 472 | but actually it works much better than |
467 | the old version. | 473 | the old version. |
468 | There are no problems with compatibility with | 474 | There are no problems with compatibility with |
469 | old calendar files of KO/Pi, of course! | 475 | old calendar files of KO/Pi, of course! |
470 | 6) | 476 | 6) |
471 | New in KA/Pi: | 477 | New in KA/Pi: |
472 | Opie addressbook resource connector available! | 478 | Opie addressbook resource connector available! |
473 | You will need libopie1 and the opie addressbook, | 479 | You will need libopie1 and the opie addressbook, |
474 | of course. | 480 | of course. |
475 | With the Opie addressbook resource connector, | 481 | With the Opie addressbook resource connector, |
476 | you can access the Opie addressbook readonly in KA/Pi. | 482 | you can access the Opie addressbook readonly in KA/Pi. |
477 | If you want to edit or import the data into KA/Pi, | 483 | If you want to edit or import the data into KA/Pi, |
478 | do this: | 484 | do this: |
479 | a) Create an Opie resource. | 485 | a) Create an Opie resource. |
480 | (Menu: Settings-Configure Resources). | 486 | (Menu: Settings-Configure Resources). |
481 | After configuration and restarting KA/Pi you should see | 487 | After configuration and restarting KA/Pi you should see |
482 | the Opie contacts in KA/Pi. | 488 | the Opie contacts in KA/Pi. |
483 | b) Select some or all Opie contacts. | 489 | b) Select some or all Opie contacts. |
484 | (NOTE: +++++ | 490 | (NOTE: +++++ |
485 | To know exactly, what contacts are Opie contacts, | 491 | To know exactly, what contacts are Opie contacts, |
486 | do this: Choose menu: | 492 | do this: Choose menu: |
487 | View-Modify View - TAB Fields. | 493 | View-Modify View - TAB Fields. |
488 | Select in the above list "Resource" and click | 494 | Select in the above list "Resource" and click |
489 | down arrow to add it to the "Selected fields". | 495 | down arrow to add it to the "Selected fields". |
490 | Click OK. | 496 | Click OK. |
491 | Now you have a new column "Resource" in your list, | 497 | Now you have a new column "Resource" in your list, |
492 | where you can see, what an Opie resource is. | 498 | where you can see, what an Opie resource is. |
493 | ++++ NOTE end.) | 499 | ++++ NOTE end.) |
494 | Ok, we do have now some Opie contacts seleted. | 500 | Ok, we do have now some Opie contacts seleted. |
495 | (Use SHIFT or CTRL key in order to multiple select). | 501 | (Use SHIFT or CTRL key in order to multiple select). |
496 | c) Choose menu: Edit-Copy. | 502 | c) Choose menu: Edit-Copy. |
497 | d) Choose menu: Edit-Paste. | 503 | d) Choose menu: Edit-Paste. |
498 | e) Select the resource, you want to add the contacts to. | 504 | e) Select the resource, you want to add the contacts to. |
499 | Congrats! Now you have read/write access to the copied | 505 | Congrats! Now you have read/write access to the copied |
500 | opie contacts as "real" KA/Pi contacts. | 506 | opie contacts as "real" KA/Pi contacts. |
501 | 507 | ||
502 | 508 | ||
503 | ********** VERSION 1.9.1 ************ | 509 | ********** VERSION 1.9.1 ************ |
504 | 1) | 510 | 1) |
505 | +++ IMPORTANT 1 +++ | 511 | +++ IMPORTANT 1 +++ |
506 | 512 | ||
507 | The storing place of the default calendar | 513 | The storing place of the default calendar |
508 | file has changed! | 514 | file has changed! |
509 | The default calendar file was | 515 | The default calendar file was |
510 | Applications/korganizer/mycalendar.ics | 516 | Applications/korganizer/mycalendar.ics |
511 | on Zaurus and | 517 | on Zaurus and |
512 | (yourHomeDir)/korganizer/mycalendar.ics | 518 | (yourHomeDir)/korganizer/mycalendar.ics |
513 | on Windows/Linux desktop. Now it is | 519 | on Windows/Linux desktop. Now it is |
514 | (yourHomeDir)/kdepim/korganizer/mycalendar.ics | 520 | (yourHomeDir)/kdepim/korganizer/mycalendar.ics |
515 | on Zaurus, Windows and Linux. | 521 | on Zaurus, Windows and Linux. |
516 | To load the old file, choose menu | 522 | To load the old file, choose menu |
517 | File-Load calendar backup. | 523 | File-Load calendar backup. |
518 | (It should be loaded automatically | 524 | (It should be loaded automatically |
519 | at startup with a warning message displayed). | 525 | at startup with a warning message displayed). |
520 | The place of the configuration file has changed too. | 526 | The place of the configuration file has changed too. |
521 | If you want to use your old KO/Pi config, | 527 | If you want to use your old KO/Pi config, |
522 | copy it to | 528 | copy it to |
523 | (yourHomeDir)/kdepim/config/korganizerrc | 529 | (yourHomeDir)/kdepim/config/korganizerrc |
524 | Please read VERSION 1.9.0 - topic 3) as well! | 530 | Please read VERSION 1.9.0 - topic 3) as well! |
525 | 531 | ||
526 | +++ IMPORTANT 2 +++ | 532 | +++ IMPORTANT 2 +++ |
527 | 533 | ||
528 | Because of the new paths, you will need | 534 | Because of the new paths, you will need |
529 | a new version of the KO/Pi alarm applet | 535 | a new version of the KO/Pi alarm applet |
530 | for Zaurus. | 536 | for Zaurus. |
531 | Use version >= 1.9.1 | 537 | Use version >= 1.9.1 |
532 | 538 | ||
533 | 2) | 539 | 2) |
534 | Now the QWhat'sThis Icon works for items | 540 | Now the QWhat'sThis Icon works for items |
535 | in the month view as well. | 541 | in the month view as well. |
536 | (See VERSION 1.7.8 Topic 1) ). | 542 | (See VERSION 1.7.8 Topic 1) ). |
537 | 3) | 543 | 3) |
538 | You can import birtsdays/anniversaries | 544 | You can import birtsdays/anniversaries |
539 | from KA/Pi into KO/Pi. | 545 | from KA/Pi into KO/Pi. |
540 | Choose menu File-Import birthdays. | 546 | Choose menu File-Import birthdays. |
541 | If you import twice, already imported items | 547 | If you import twice, already imported items |
542 | will not be imported again, if they | 548 | will not be imported again, if they |
543 | have not been changed in KO/Pi. | 549 | have not been changed in KO/Pi. |
544 | 4) | 550 | 4) |
545 | When syncing with sharp DTM, now a progress | 551 | When syncing with sharp DTM, now a progress |
546 | is shown, when the data is written back. | 552 | is shown, when the data is written back. |
547 | If there is much data in KO/Pi and no data | 553 | If there is much data in KO/Pi and no data |
548 | in DTM, that can take a long time. | 554 | in DTM, that can take a long time. |
549 | (But only for the first time ). | 555 | (But only for the first time ). |
550 | 5) | 556 | 5) |
551 | In the search dialog, you can search | 557 | In the search dialog, you can search |
552 | now for the name/email of an attendee | 558 | now for the name/email of an attendee |
553 | of an event/todo. | 559 | of an event/todo. |
554 | To get more space for displaying | 560 | To get more space for displaying |
555 | search results, the buttons | 561 | search results, the buttons |
556 | for "search" and "close" on the | 562 | for "search" and "close" on the |
557 | bottom are removed in the PDA version. | 563 | bottom are removed in the PDA version. |
558 | You have to click OK in the top right | 564 | You have to click OK in the top right |
559 | corner to do a search. | 565 | corner to do a search. |
560 | 6) | 566 | 6) |
561 | Now it is possible to disable the displaying | 567 | Now it is possible to disable the displaying |
562 | of todo items in the Allday part of the Agenda. | 568 | of todo items in the Allday part of the Agenda. |
563 | Choose Menu Action-Configure, | 569 | Choose Menu Action-Configure, |
564 | TAB Todo View, checkbox | 570 | TAB Todo View, checkbox |
565 | "Allday Agenda view shows todos" | 571 | "Allday Agenda view shows todos" |
566 | 7) | 572 | 7) |
567 | If FastLoad is enabled, now the settings and the | 573 | If FastLoad is enabled, now the settings and the |
568 | calendar data are saved, when KO/Pi is closed. | 574 | calendar data are saved, when KO/Pi is closed. |
569 | (If no Fastload is enabled, KO/Pi saves | 575 | (If no Fastload is enabled, KO/Pi saves |
570 | the data as well, of course) | 576 | the data as well, of course) |
571 | 8) | 577 | 8) |
572 | The Agenda View has a minimize-splitter now, | 578 | The Agenda View has a minimize-splitter now, |
573 | such that the height of the allday part can be | 579 | such that the height of the allday part can be |
574 | changed quickly. | 580 | changed quickly. |
575 | 581 | ||
576 | ********** VERSION 1.9.0 ************ | 582 | ********** VERSION 1.9.0 ************ |
577 | 1) | 583 | 1) |
578 | KO/Pi is now merged with the new microKDE from KA/Pi. | 584 | KO/Pi is now merged with the new microKDE from KA/Pi. |
579 | KO/Pi accesses now KA/Pi as the addressbook. | 585 | KO/Pi accesses now KA/Pi as the addressbook. |
580 | The other ddressbook-plugins are not working any longer. | 586 | The other ddressbook-plugins are not working any longer. |
581 | (It is planned, that later KA/Pi itself uses these plugins) | 587 | (It is planned, that later KA/Pi itself uses these plugins) |
582 | New versions of KO/Pi are only available | 588 | New versions of KO/Pi are only available |
583 | together with KA/Pi as the KDE-Pim/Pi package. | 589 | together with KA/Pi as the KDE-Pim/Pi package. |
584 | 2) | 590 | 2) |
585 | If you click on an attendee of a meeting in the | 591 | If you click on an attendee of a meeting in the |
586 | event viewer, a detailed summary of the | 592 | event viewer, a detailed summary of the |
587 | attendee is shown. | 593 | attendee is shown. |
588 | 3) | 594 | 3) |
589 | The place of the configuration file has changed. | 595 | The place of the configuration file has changed. |
590 | If you want to use your old KO/Pi config, copy | 596 | If you want to use your old KO/Pi config, copy |
591 | Applications/korganizer/config_korganizerrc | 597 | Applications/korganizer/config_korganizerrc |
592 | to | 598 | to |
593 | Applications/korganizer/config/korganizerrc | 599 | Applications/korganizer/config/korganizerrc |
594 | 600 | ||
595 | ********** VERSION 1.7.8 ************ | 601 | ********** VERSION 1.7.8 ************ |
596 | 1) | 602 | 1) |
597 | Now the QWhat'sThis ist working. | 603 | Now the QWhat'sThis ist working. |
598 | Enable the QWhat'sThis icon in the toolbar. | 604 | Enable the QWhat'sThis icon in the toolbar. |
599 | (You have to restart to reload the changed toolbar config). | 605 | (You have to restart to reload the changed toolbar config). |
600 | Now click on the QWhat'sThis Icon | 606 | Now click on the QWhat'sThis Icon |
601 | in the top right corner of KO/Pi. | 607 | in the top right corner of KO/Pi. |
602 | Then click on an item in the Agenda View: | 608 | Then click on an item in the Agenda View: |
603 | You will get a detailed display of the items content. | 609 | You will get a detailed display of the items content. |
604 | 2) | 610 | 2) |
605 | Some other very minor changes. | 611 | Some other very minor changes. |
606 | But I have forgotten the details ... | 612 | But I have forgotten the details ... |
607 | For that reason I start this log here: | 613 | For that reason I start this log here: |
608 | To document my changes, when I am doing it. | 614 | To document my changes, when I am doing it. |
609 | 615 | ||
610 | ********** VERSION 1.7.7 ************ | 616 | ********** VERSION 1.7.7 ************ |
611 | Stable Version of KO/Pi | 617 | Stable Version of KO/Pi |
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 3908dbb..47cd488 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1,3792 +1,3795 @@ | |||
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 |
134 | using namespace KOrg; | 134 | using namespace KOrg; |
135 | using namespace KCal; | 135 | using namespace KCal; |
136 | extern int globalFlagBlockAgenda; | 136 | extern int globalFlagBlockAgenda; |
137 | extern int globalFlagBlockStartup; | 137 | extern int globalFlagBlockStartup; |
138 | 138 | ||
139 | 139 | ||
140 | 140 | ||
141 | class KOBeamPrefs : public QDialog | 141 | class 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(); } |
173 | private: | 173 | private: |
174 | QRadioButton* vcal, *ical, *local, *tz; | 174 | QRadioButton* vcal, *ical, *local, *tz; |
175 | }; | 175 | }; |
176 | class KOCatPrefs : public QDialog | 176 | class 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(); } |
204 | private: | 204 | private: |
205 | QRadioButton* addCatBut; | 205 | QRadioButton* addCatBut; |
206 | }; | 206 | }; |
207 | 207 | ||
208 | 208 | ||
209 | 209 | ||
210 | CalendarView::CalendarView( CalendarResources *calendar, | 210 | CalendarView::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 | ||
223 | CalendarView::CalendarView( Calendar *calendar, | 223 | CalendarView::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 | ||
234 | void CalendarView::init() | 234 | void 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 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); | 269 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); |
270 | 270 | ||
271 | #ifdef KORG_NORESOURCEVIEW | 271 | #ifdef KORG_NORESOURCEVIEW |
272 | mResourceView = 0; | 272 | mResourceView = 0; |
273 | #else | 273 | #else |
274 | if ( mResourceManager ) { | 274 | if ( mResourceManager ) { |
275 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); | 275 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); |
276 | mResourceView->updateView(); | 276 | mResourceView->updateView(); |
277 | connect( mResourceView, SIGNAL( resourcesChanged() ), | 277 | connect( mResourceView, SIGNAL( resourcesChanged() ), |
278 | SLOT( updateView() ) ); | 278 | SLOT( updateView() ) ); |
279 | } else { | 279 | } else { |
280 | mResourceView = 0; | 280 | mResourceView = 0; |
281 | } | 281 | } |
282 | #endif | 282 | #endif |
283 | QWidget *rightBox = new QWidget( mPanner ); | 283 | QWidget *rightBox = new QWidget( mPanner ); |
284 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 284 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
285 | 285 | ||
286 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); | 286 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); |
287 | rightLayout->addWidget( mNavigatorBar ); | 287 | rightLayout->addWidget( mNavigatorBar ); |
288 | 288 | ||
289 | mRightFrame = new QWidgetStack( rightBox ); | 289 | mRightFrame = new QWidgetStack( rightBox ); |
290 | rightLayout->addWidget( mRightFrame, 1 ); | 290 | rightLayout->addWidget( mRightFrame, 1 ); |
291 | 291 | ||
292 | mLeftFrame = mLeftSplitter; | 292 | mLeftFrame = mLeftSplitter; |
293 | #else | 293 | #else |
294 | QWidget *mainBox = new QWidget( this ); | 294 | QWidget *mainBox = new QWidget( this ); |
295 | QWidget *leftFrame = new QWidget( mainBox ); | 295 | QWidget *leftFrame = new QWidget( mainBox ); |
296 | 296 | ||
297 | QBoxLayout * mainBoxLayout; | 297 | QBoxLayout * mainBoxLayout; |
298 | QBoxLayout * leftFrameLayout; | 298 | QBoxLayout * leftFrameLayout; |
299 | if ( KOPrefs::instance()->mVerticalScreen ) { | 299 | if ( KOPrefs::instance()->mVerticalScreen ) { |
300 | mainBoxLayout = new QVBoxLayout(mainBox); | 300 | mainBoxLayout = new QVBoxLayout(mainBox); |
301 | leftFrameLayout = new QHBoxLayout(leftFrame ); | 301 | leftFrameLayout = new QHBoxLayout(leftFrame ); |
302 | } else { | 302 | } else { |
303 | mainBoxLayout = new QHBoxLayout(mainBox); | 303 | mainBoxLayout = new QHBoxLayout(mainBox); |
304 | leftFrameLayout = new QVBoxLayout(leftFrame ); | 304 | leftFrameLayout = new QVBoxLayout(leftFrame ); |
305 | } | 305 | } |
306 | topLayout->addWidget( mainBox ); | 306 | topLayout->addWidget( mainBox ); |
307 | mainBoxLayout->addWidget (leftFrame); | 307 | mainBoxLayout->addWidget (leftFrame); |
308 | mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE, | 308 | mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE, |
309 | "CalendarView::DateNavigator", QDate::currentDate()); | 309 | "CalendarView::DateNavigator", QDate::currentDate()); |
310 | // mDateNavigator->blockSignals( true ); | 310 | // mDateNavigator->blockSignals( true ); |
311 | leftFrameLayout->addWidget( mDateNavigator ); | 311 | leftFrameLayout->addWidget( mDateNavigator ); |
312 | mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView"); | 312 | mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView"); |
313 | mTodoList = new KOTodoView(mCalendar, leftFrame, "todolistsmall"); | 313 | mTodoList = new KOTodoView(mCalendar, leftFrame, "todolistsmall"); |
314 | 314 | ||
315 | if ( QApplication::desktop()->width() < 480 ) { | 315 | if ( QApplication::desktop()->width() < 480 ) { |
316 | leftFrameLayout->addWidget(mFilterView); | 316 | leftFrameLayout->addWidget(mFilterView); |
317 | leftFrameLayout->addWidget(mTodoList, 2 ); | 317 | leftFrameLayout->addWidget(mTodoList, 2 ); |
318 | 318 | ||
319 | } else { | 319 | } else { |
320 | leftFrameLayout->addWidget(mTodoList,2 ); | 320 | leftFrameLayout->addWidget(mTodoList,2 ); |
321 | leftFrameLayout->addWidget(mFilterView ); | 321 | leftFrameLayout->addWidget(mFilterView ); |
322 | } | 322 | } |
323 | mFilterView->hide(); | 323 | mFilterView->hide(); |
324 | QWidget *rightBox = new QWidget( mainBox ); | 324 | QWidget *rightBox = new QWidget( mainBox ); |
325 | mainBoxLayout->addWidget ( rightBox, 10 ); | 325 | mainBoxLayout->addWidget ( rightBox, 10 ); |
326 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 326 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
327 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); | 327 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); |
328 | mRightFrame = new QWidgetStack( rightBox ); | 328 | mRightFrame = new QWidgetStack( rightBox ); |
329 | rightLayout->addWidget( mNavigatorBar ); | 329 | rightLayout->addWidget( mNavigatorBar ); |
330 | rightLayout->addWidget( mRightFrame, 10 ); | 330 | rightLayout->addWidget( mRightFrame, 10 ); |
331 | 331 | ||
332 | mLeftFrame = leftFrame; | 332 | mLeftFrame = leftFrame; |
333 | if ( KOPrefs::instance()->mVerticalScreen ) { | 333 | if ( KOPrefs::instance()->mVerticalScreen ) { |
334 | mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); | 334 | mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); |
335 | leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); | 335 | leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); |
336 | } else { | 336 | } else { |
337 | mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); | 337 | mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); |
338 | leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); | 338 | leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); |
339 | } | 339 | } |
340 | 340 | ||
341 | //qDebug("Calendarview Size %d %d ", width(), height()); | 341 | //qDebug("Calendarview Size %d %d ", width(), height()); |
342 | #endif | 342 | #endif |
343 | 343 | ||
344 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 344 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
345 | SLOT( showDates( const KCal::DateList & ) ) ); | 345 | SLOT( showDates( const KCal::DateList & ) ) ); |
346 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 346 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
347 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 347 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
348 | 348 | ||
349 | connect( mNavigatorBar, SIGNAL( goPrevYear() ), | 349 | connect( mNavigatorBar, SIGNAL( goPrevYear() ), |
350 | mNavigator, SLOT( selectPreviousYear() ) ); | 350 | mNavigator, SLOT( selectPreviousYear() ) ); |
351 | connect( mNavigatorBar, SIGNAL( goNextYear() ), | 351 | connect( mNavigatorBar, SIGNAL( goNextYear() ), |
352 | mNavigator, SLOT( selectNextYear() ) ); | 352 | mNavigator, SLOT( selectNextYear() ) ); |
353 | connect( mNavigatorBar, SIGNAL( goPrevMonth() ), | 353 | connect( mNavigatorBar, SIGNAL( goPrevMonth() ), |
354 | mNavigator, SLOT( selectPreviousMonth() ) ); | 354 | mNavigator, SLOT( selectPreviousMonth() ) ); |
355 | connect( mNavigatorBar, SIGNAL( goNextMonth() ), | 355 | connect( mNavigatorBar, SIGNAL( goNextMonth() ), |
356 | mNavigator, SLOT( selectNextMonth() ) ); | 356 | mNavigator, SLOT( selectNextMonth() ) ); |
357 | 357 | ||
358 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 358 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
359 | mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) ); | 359 | mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) ); |
360 | 360 | ||
361 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), | 361 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), |
362 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); | 362 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); |
363 | 363 | ||
364 | connect( mDateNavigator, SIGNAL( goPrevYear() ), | 364 | connect( mDateNavigator, SIGNAL( goPrevYear() ), |
365 | mNavigator, SLOT( selectPreviousYear() ) ); | 365 | mNavigator, SLOT( selectPreviousYear() ) ); |
366 | connect( mDateNavigator, SIGNAL( goNextYear() ), | 366 | connect( mDateNavigator, SIGNAL( goNextYear() ), |
367 | mNavigator, SLOT( selectNextYear() ) ); | 367 | mNavigator, SLOT( selectNextYear() ) ); |
368 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), | 368 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), |
369 | mNavigator, SLOT( selectPreviousMonth() ) ); | 369 | mNavigator, SLOT( selectPreviousMonth() ) ); |
370 | connect( mDateNavigator, SIGNAL( goNextMonth() ), | 370 | connect( mDateNavigator, SIGNAL( goNextMonth() ), |
371 | mNavigator, SLOT( selectNextMonth() ) ); | 371 | mNavigator, SLOT( selectNextMonth() ) ); |
372 | 372 | ||
373 | connect( mDateNavigator, SIGNAL( goPrevious() ), | 373 | connect( mDateNavigator, SIGNAL( goPrevious() ), |
374 | mNavigator, SLOT( selectPrevious() ) ); | 374 | mNavigator, SLOT( selectPrevious() ) ); |
375 | connect( mDateNavigator, SIGNAL( goNext() ), | 375 | connect( mDateNavigator, SIGNAL( goNext() ), |
376 | mNavigator, SLOT( selectNext() ) ); | 376 | mNavigator, SLOT( selectNext() ) ); |
377 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), | 377 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), |
378 | mNavigator, SLOT( slotMonthSelect( int ) ) ); | 378 | mNavigator, SLOT( slotMonthSelect( int ) ) ); |
379 | connect( mNavigatorBar, SIGNAL( monthSelected ( int ) ), | 379 | connect( mNavigatorBar, SIGNAL( monthSelected ( int ) ), |
380 | mNavigator, SLOT( slotMonthSelect( int ) ) ); | 380 | mNavigator, SLOT( slotMonthSelect( int ) ) ); |
381 | 381 | ||
382 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 382 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
383 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 383 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
384 | 384 | ||
385 | connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ), | 385 | connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ), |
386 | SLOT( eventAdded( Event *) ) ); | 386 | SLOT( eventAdded( Event *) ) ); |
387 | 387 | ||
388 | connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); | 388 | connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); |
389 | 389 | ||
390 | connect( this, SIGNAL( configChanged() ), | 390 | connect( this, SIGNAL( configChanged() ), |
391 | mDateNavigator, SLOT( updateConfig() ) ); | 391 | mDateNavigator, SLOT( updateConfig() ) ); |
392 | 392 | ||
393 | connect( mTodoList, SIGNAL( newTodoSignal() ), | 393 | connect( mTodoList, SIGNAL( newTodoSignal() ), |
394 | SLOT( newTodo() ) ); | 394 | SLOT( newTodo() ) ); |
395 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), | 395 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), |
396 | SLOT( newSubTodo( Todo * ) ) ); | 396 | SLOT( newSubTodo( Todo * ) ) ); |
397 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), | 397 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), |
398 | SLOT( editTodo( Todo * ) ) ); | 398 | SLOT( editTodo( Todo * ) ) ); |
399 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), | 399 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), |
400 | SLOT( showTodo( Todo *) ) ); | 400 | SLOT( showTodo( Todo *) ) ); |
401 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), | 401 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), |
402 | SLOT( deleteTodo( Todo *) ) ); | 402 | SLOT( deleteTodo( Todo *) ) ); |
403 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); | 403 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); |
404 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), | 404 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), |
405 | SLOT( purgeCompleted() ) ); | 405 | SLOT( purgeCompleted() ) ); |
406 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 406 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
407 | SIGNAL( todoModified( Todo *, int ) ) ); | 407 | SIGNAL( todoModified( Todo *, int ) ) ); |
408 | 408 | ||
409 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), | 409 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), |
410 | this, SLOT ( cloneIncidence( Incidence * ) ) ); | 410 | this, SLOT ( cloneIncidence( Incidence * ) ) ); |
411 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), | 411 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), |
412 | this, SLOT (cancelIncidence( Incidence * ) ) ); | 412 | this, SLOT (cancelIncidence( Incidence * ) ) ); |
413 | 413 | ||
414 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), | 414 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), |
415 | this, SLOT ( moveIncidence( Incidence * ) ) ); | 415 | this, SLOT ( moveIncidence( Incidence * ) ) ); |
416 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), | 416 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), |
417 | this, SLOT ( beamIncidence( Incidence * ) ) ); | 417 | this, SLOT ( beamIncidence( Incidence * ) ) ); |
418 | 418 | ||
419 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), | 419 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), |
420 | this, SLOT ( todo_unsub( Todo * ) ) ); | 420 | this, SLOT ( todo_unsub( Todo * ) ) ); |
421 | 421 | ||
422 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), | 422 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), |
423 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); | 423 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); |
424 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, | 424 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, |
425 | SLOT( updateTodo( Todo *, int ) ) ); | 425 | SLOT( updateTodo( Todo *, int ) ) ); |
426 | connect( this, SIGNAL( todoModified( Todo *, int )), this, | 426 | connect( this, SIGNAL( todoModified( Todo *, int )), this, |
427 | SLOT( changeTodoDisplay( Todo *, int ) ) ); | 427 | SLOT( changeTodoDisplay( Todo *, int ) ) ); |
428 | 428 | ||
429 | 429 | ||
430 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); | 430 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); |
431 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); | 431 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); |
432 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); | 432 | 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 & ) ) ); | 433 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); |
434 | 434 | ||
435 | 435 | ||
436 | 436 | ||
437 | 437 | ||
438 | 438 | ||
439 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), | 439 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), |
440 | SLOT(checkClipboard())); | 440 | SLOT(checkClipboard())); |
441 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), | 441 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), |
442 | SLOT( processTodoListSelection( Incidence * ) ) ); | 442 | SLOT( processTodoListSelection( Incidence * ) ) ); |
443 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); | 443 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); |
444 | 444 | ||
445 | // kdDebug() << "CalendarView::CalendarView() done" << endl; | 445 | // kdDebug() << "CalendarView::CalendarView() done" << endl; |
446 | 446 | ||
447 | mDateFrame = new QVBox(0,0,WType_Popup); | 447 | mDateFrame = new QVBox(0,0,WType_Popup); |
448 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); | 448 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); |
449 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); | 449 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); |
450 | mDateFrame->setLineWidth(3); | 450 | mDateFrame->setLineWidth(3); |
451 | mDateFrame->hide(); | 451 | mDateFrame->hide(); |
452 | mDateFrame->setCaption( i18n( "Pick a date to display")); | 452 | mDateFrame->setCaption( i18n( "Pick a date to display")); |
453 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); | 453 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); |
454 | 454 | ||
455 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); | 455 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); |
456 | 456 | ||
457 | mEventEditor = mDialogManager->getEventEditor(); | 457 | mEventEditor = mDialogManager->getEventEditor(); |
458 | mTodoEditor = mDialogManager->getTodoEditor(); | 458 | mTodoEditor = mDialogManager->getTodoEditor(); |
459 | 459 | ||
460 | mFlagEditDescription = false; | 460 | mFlagEditDescription = false; |
461 | 461 | ||
462 | mSuspendTimer = new QTimer( this ); | 462 | mSuspendTimer = new QTimer( this ); |
463 | mAlarmTimer = new QTimer( this ); | 463 | mAlarmTimer = new QTimer( this ); |
464 | mRecheckAlarmTimer = new QTimer( this ); | 464 | mRecheckAlarmTimer = new QTimer( this ); |
465 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); | 465 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); |
466 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); | 466 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); |
467 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); | 467 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); |
468 | mAlarmDialog = new AlarmDialog( this ); | 468 | mAlarmDialog = new AlarmDialog( this ); |
469 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); | 469 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); |
470 | mAlarmDialog->setServerNotification( false ); | 470 | mAlarmDialog->setServerNotification( false ); |
471 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); | 471 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); |
472 | 472 | ||
473 | 473 | ||
474 | #ifndef DESKTOP_VERSION | 474 | #ifndef DESKTOP_VERSION |
475 | //US listen for arriving address resultsets | 475 | //US listen for arriving address resultsets |
476 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), | 476 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), |
477 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); | 477 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); |
478 | #endif | 478 | #endif |
479 | 479 | ||
480 | } | 480 | } |
481 | 481 | ||
482 | 482 | ||
483 | CalendarView::~CalendarView() | 483 | CalendarView::~CalendarView() |
484 | { | 484 | { |
485 | // kdDebug() << "~CalendarView()" << endl; | 485 | // kdDebug() << "~CalendarView()" << endl; |
486 | //qDebug("CalendarView::~CalendarView() "); | 486 | //qDebug("CalendarView::~CalendarView() "); |
487 | delete mDialogManager; | 487 | delete mDialogManager; |
488 | delete mViewManager; | 488 | delete mViewManager; |
489 | delete mStorage; | 489 | delete mStorage; |
490 | delete mDateFrame ; | 490 | delete mDateFrame ; |
491 | delete beamDialog; | 491 | delete beamDialog; |
492 | //kdDebug() << "~CalendarView() done" << endl; | 492 | //kdDebug() << "~CalendarView() done" << endl; |
493 | } | 493 | } |
494 | void CalendarView::timerAlarm() | 494 | void CalendarView::timerAlarm() |
495 | { | 495 | { |
496 | //qDebug("CalendarView::timerAlarm() "); | 496 | //qDebug("CalendarView::timerAlarm() "); |
497 | computeAlarm(mAlarmNotification ); | 497 | computeAlarm(mAlarmNotification ); |
498 | } | 498 | } |
499 | 499 | ||
500 | void CalendarView::suspendAlarm() | 500 | void CalendarView::suspendAlarm() |
501 | { | 501 | { |
502 | //qDebug(" CalendarView::suspendAlarm() "); | 502 | //qDebug(" CalendarView::suspendAlarm() "); |
503 | computeAlarm(mSuspendAlarmNotification ); | 503 | computeAlarm(mSuspendAlarmNotification ); |
504 | 504 | ||
505 | } | 505 | } |
506 | 506 | ||
507 | void CalendarView::startAlarm( QString mess , QString filename) | 507 | void CalendarView::startAlarm( QString mess , QString filename) |
508 | { | 508 | { |
509 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); | 509 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); |
510 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); | 510 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); |
511 | 511 | ||
512 | } | 512 | } |
513 | 513 | ||
514 | void CalendarView::checkNextTimerAlarm() | 514 | void CalendarView::checkNextTimerAlarm() |
515 | { | 515 | { |
516 | mCalendar->checkAlarmForIncidence( 0, true ); | 516 | mCalendar->checkAlarmForIncidence( 0, true ); |
517 | } | 517 | } |
518 | 518 | ||
519 | void CalendarView::computeAlarm( QString msg ) | 519 | void CalendarView::computeAlarm( QString msg ) |
520 | { | 520 | { |
521 | 521 | ||
522 | QString mess = msg; | 522 | QString mess = msg; |
523 | QString mAlarmMessage = mess.mid( 9 ); | 523 | QString mAlarmMessage = mess.mid( 9 ); |
524 | QString filename = MainWindow::resourcePath(); | 524 | QString filename = MainWindow::resourcePath(); |
525 | filename += "koalarm.wav"; | 525 | filename += "koalarm.wav"; |
526 | QString tempfilename; | 526 | QString tempfilename; |
527 | if ( mess.left( 13 ) == "suspend_alarm") { | 527 | if ( mess.left( 13 ) == "suspend_alarm") { |
528 | bool error = false; | 528 | bool error = false; |
529 | int len = mess.mid( 13 ).find("+++"); | 529 | int len = mess.mid( 13 ).find("+++"); |
530 | if ( len < 2 ) | 530 | if ( len < 2 ) |
531 | error = true; | 531 | error = true; |
532 | else { | 532 | else { |
533 | tempfilename = mess.mid( 13, len ); | 533 | tempfilename = mess.mid( 13, len ); |
534 | if ( !QFile::exists( tempfilename ) ) | 534 | if ( !QFile::exists( tempfilename ) ) |
535 | error = true; | 535 | error = true; |
536 | } | 536 | } |
537 | if ( ! error ) { | 537 | if ( ! error ) { |
538 | filename = tempfilename; | 538 | filename = tempfilename; |
539 | } | 539 | } |
540 | mAlarmMessage = mess.mid( 13+len+3 ); | 540 | mAlarmMessage = mess.mid( 13+len+3 ); |
541 | //qDebug("suspend file %s ",tempfilename.latin1() ); | 541 | //qDebug("suspend file %s ",tempfilename.latin1() ); |
542 | startAlarm( mAlarmMessage, filename); | 542 | startAlarm( mAlarmMessage, filename); |
543 | return; | 543 | return; |
544 | } | 544 | } |
545 | if ( mess.left( 11 ) == "timer_alarm") { | 545 | if ( mess.left( 11 ) == "timer_alarm") { |
546 | //mTimerTime = 0; | 546 | //mTimerTime = 0; |
547 | startAlarm( mess.mid( 11 ), filename ); | 547 | startAlarm( mess.mid( 11 ), filename ); |
548 | return; | 548 | return; |
549 | } | 549 | } |
550 | if ( mess.left( 10 ) == "proc_alarm") { | 550 | if ( mess.left( 10 ) == "proc_alarm") { |
551 | bool error = false; | 551 | bool error = false; |
552 | int len = mess.mid( 10 ).find("+++"); | 552 | int len = mess.mid( 10 ).find("+++"); |
553 | if ( len < 2 ) | 553 | if ( len < 2 ) |
554 | error = true; | 554 | error = true; |
555 | else { | 555 | else { |
556 | tempfilename = mess.mid( 10, len ); | 556 | tempfilename = mess.mid( 10, len ); |
557 | if ( !QFile::exists( tempfilename ) ) | 557 | if ( !QFile::exists( tempfilename ) ) |
558 | error = true; | 558 | error = true; |
559 | } | 559 | } |
560 | if ( error ) { | 560 | if ( error ) { |
561 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; | 561 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; |
562 | mAlarmMessage += mess.mid( 10+len+3+9 ); | 562 | mAlarmMessage += mess.mid( 10+len+3+9 ); |
563 | } else { | 563 | } else { |
564 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); | 564 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); |
565 | //qDebug("-----system command %s ",tempfilename.latin1() ); | 565 | //qDebug("-----system command %s ",tempfilename.latin1() ); |
566 | #ifndef _WIN32_ | 566 | #ifndef _WIN32_ |
567 | if ( vfork () == 0 ) { | 567 | if ( vfork () == 0 ) { |
568 | execl ( tempfilename.latin1(), 0 ); | 568 | execl ( tempfilename.latin1(), 0 ); |
569 | return; | 569 | return; |
570 | } | 570 | } |
571 | #else | 571 | #else |
572 | QProcess* p = new QProcess(); | 572 | QProcess* p = new QProcess(); |
573 | p->addArgument( tempfilename.latin1() ); | 573 | p->addArgument( tempfilename.latin1() ); |
574 | p->start(); | 574 | p->start(); |
575 | return; | 575 | return; |
576 | #endif | 576 | #endif |
577 | 577 | ||
578 | return; | 578 | return; |
579 | } | 579 | } |
580 | 580 | ||
581 | //qDebug("+++++++system command %s ",tempfilename.latin1() ); | 581 | //qDebug("+++++++system command %s ",tempfilename.latin1() ); |
582 | } | 582 | } |
583 | if ( mess.left( 11 ) == "audio_alarm") { | 583 | if ( mess.left( 11 ) == "audio_alarm") { |
584 | bool error = false; | 584 | bool error = false; |
585 | int len = mess.mid( 11 ).find("+++"); | 585 | int len = mess.mid( 11 ).find("+++"); |
586 | if ( len < 2 ) | 586 | if ( len < 2 ) |
587 | error = true; | 587 | error = true; |
588 | else { | 588 | else { |
589 | tempfilename = mess.mid( 11, len ); | 589 | tempfilename = mess.mid( 11, len ); |
590 | if ( !QFile::exists( tempfilename ) ) | 590 | if ( !QFile::exists( tempfilename ) ) |
591 | error = true; | 591 | error = true; |
592 | } | 592 | } |
593 | if ( ! error ) { | 593 | if ( ! error ) { |
594 | filename = tempfilename; | 594 | filename = tempfilename; |
595 | } | 595 | } |
596 | mAlarmMessage = mess.mid( 11+len+3+9 ); | 596 | mAlarmMessage = mess.mid( 11+len+3+9 ); |
597 | //qDebug("audio file command %s ",tempfilename.latin1() ); | 597 | //qDebug("audio file command %s ",tempfilename.latin1() ); |
598 | } | 598 | } |
599 | if ( mess.left( 9 ) == "cal_alarm") { | 599 | if ( mess.left( 9 ) == "cal_alarm") { |
600 | mAlarmMessage = mess.mid( 9 ) ; | 600 | mAlarmMessage = mess.mid( 9 ) ; |
601 | } | 601 | } |
602 | 602 | ||
603 | startAlarm( mAlarmMessage, filename ); | 603 | startAlarm( mAlarmMessage, filename ); |
604 | 604 | ||
605 | 605 | ||
606 | } | 606 | } |
607 | 607 | ||
608 | void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString ¬i ) | 608 | void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString ¬i ) |
609 | { | 609 | { |
610 | //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 610 | //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
611 | 611 | ||
612 | mSuspendAlarmNotification = noti; | 612 | mSuspendAlarmNotification = noti; |
613 | int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; | 613 | int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; |
614 | //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); | 614 | //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); |
615 | mSuspendTimer->start( ms , true ); | 615 | mSuspendTimer->start( ms , true ); |
616 | 616 | ||
617 | } | 617 | } |
618 | 618 | ||
619 | void CalendarView::addAlarm(const QDateTime &qdt, const QString ¬i ) | 619 | void CalendarView::addAlarm(const QDateTime &qdt, const QString ¬i ) |
620 | { | 620 | { |
621 | //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 621 | //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
622 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { | 622 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { |
623 | #ifndef DESKTOP_VERSION | 623 | #ifndef DESKTOP_VERSION |
624 | AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() ); | 624 | AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() ); |
625 | #endif | 625 | #endif |
626 | return; | 626 | return; |
627 | } | 627 | } |
628 | int maxSec; | 628 | int maxSec; |
629 | //maxSec = 5; //testing only | 629 | //maxSec = 5; //testing only |
630 | maxSec = 86400+3600; // one day+1hour | 630 | maxSec = 86400+3600; // one day+1hour |
631 | mAlarmNotification = noti; | 631 | mAlarmNotification = noti; |
632 | int sec = QDateTime::currentDateTime().secsTo( qdt ); | 632 | int sec = QDateTime::currentDateTime().secsTo( qdt ); |
633 | if ( sec > maxSec ) { | 633 | if ( sec > maxSec ) { |
634 | mRecheckAlarmTimer->start( maxSec * 1000 ); | 634 | mRecheckAlarmTimer->start( maxSec * 1000 ); |
635 | // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); | 635 | // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); |
636 | return; | 636 | return; |
637 | } else { | 637 | } else { |
638 | mRecheckAlarmTimer->stop(); | 638 | mRecheckAlarmTimer->stop(); |
639 | } | 639 | } |
640 | //qDebug("Alarm timer started with secs: %d ", sec); | 640 | //qDebug("Alarm timer started with secs: %d ", sec); |
641 | mAlarmTimer->start( sec *1000 , true ); | 641 | mAlarmTimer->start( sec *1000 , true ); |
642 | 642 | ||
643 | } | 643 | } |
644 | // called by mRecheckAlarmTimer to get next alarm | 644 | // called by mRecheckAlarmTimer to get next alarm |
645 | // we need this, because a QTimer has only a max range of 25 days | 645 | // we need this, because a QTimer has only a max range of 25 days |
646 | void CalendarView::recheckTimerAlarm() | 646 | void CalendarView::recheckTimerAlarm() |
647 | { | 647 | { |
648 | mAlarmTimer->stop(); | 648 | mAlarmTimer->stop(); |
649 | mRecheckAlarmTimer->stop(); | 649 | mRecheckAlarmTimer->stop(); |
650 | mCalendar->checkAlarmForIncidence( 0, true ); | 650 | mCalendar->checkAlarmForIncidence( 0, true ); |
651 | } | 651 | } |
652 | void CalendarView::removeAlarm(const QDateTime &qdt, const QString ¬i ) | 652 | void CalendarView::removeAlarm(const QDateTime &qdt, const QString ¬i ) |
653 | { | 653 | { |
654 | //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 654 | //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
655 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { | 655 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { |
656 | #ifndef DESKTOP_VERSION | 656 | #ifndef DESKTOP_VERSION |
657 | AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); | 657 | AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); |
658 | #endif | 658 | #endif |
659 | return; | 659 | return; |
660 | } | 660 | } |
661 | mAlarmTimer->stop(); | 661 | mAlarmTimer->stop(); |
662 | } | 662 | } |
663 | void CalendarView::selectWeekNum ( int num ) | 663 | void CalendarView::selectWeekNum ( int num ) |
664 | { | 664 | { |
665 | dateNavigator()->selectWeek( num ); | 665 | dateNavigator()->selectWeek( num ); |
666 | mViewManager->showWeekView(); | 666 | mViewManager->showWeekView(); |
667 | } | 667 | } |
668 | KOViewManager *CalendarView::viewManager() | 668 | KOViewManager *CalendarView::viewManager() |
669 | { | 669 | { |
670 | return mViewManager; | 670 | return mViewManager; |
671 | } | 671 | } |
672 | 672 | ||
673 | KODialogManager *CalendarView::dialogManager() | 673 | KODialogManager *CalendarView::dialogManager() |
674 | { | 674 | { |
675 | return mDialogManager; | 675 | return mDialogManager; |
676 | } | 676 | } |
677 | 677 | ||
678 | QDate CalendarView::startDate() | 678 | QDate CalendarView::startDate() |
679 | { | 679 | { |
680 | DateList dates = mNavigator->selectedDates(); | 680 | DateList dates = mNavigator->selectedDates(); |
681 | 681 | ||
682 | return dates.first(); | 682 | return dates.first(); |
683 | } | 683 | } |
684 | 684 | ||
685 | QDate CalendarView::endDate() | 685 | QDate CalendarView::endDate() |
686 | { | 686 | { |
687 | DateList dates = mNavigator->selectedDates(); | 687 | DateList dates = mNavigator->selectedDates(); |
688 | 688 | ||
689 | return dates.last(); | 689 | return dates.last(); |
690 | } | 690 | } |
691 | 691 | ||
692 | 692 | ||
693 | void CalendarView::createPrinter() | 693 | void CalendarView::createPrinter() |
694 | { | 694 | { |
695 | #ifndef KORG_NOPRINTER | 695 | #ifndef KORG_NOPRINTER |
696 | if (!mCalPrinter) { | 696 | if (!mCalPrinter) { |
697 | mCalPrinter = new CalPrinter(this, mCalendar); | 697 | mCalPrinter = new CalPrinter(this, mCalendar); |
698 | connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); | 698 | connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); |
699 | } | 699 | } |
700 | #endif | 700 | #endif |
701 | } | 701 | } |
702 | 702 | ||
703 | 703 | ||
704 | //KOPrefs::instance()->mWriteBackFile | 704 | //KOPrefs::instance()->mWriteBackFile |
705 | //KOPrefs::instance()->mWriteBackExistingOnly | 705 | //KOPrefs::instance()->mWriteBackExistingOnly |
706 | 706 | ||
707 | // 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); | 707 | // 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); |
708 | // 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); | 708 | // 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); |
709 | // 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); | 709 | // 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); |
710 | // 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); | 710 | // 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); |
711 | // 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); | 711 | // 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); |
712 | // 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); | 712 | // 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); |
713 | 713 | ||
714 | int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) | 714 | int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) |
715 | { | 715 | { |
716 | 716 | ||
717 | // 0 equal | 717 | // 0 equal |
718 | // 1 take local | 718 | // 1 take local |
719 | // 2 take remote | 719 | // 2 take remote |
720 | // 3 cancel | 720 | // 3 cancel |
721 | QDateTime lastSync = mLastCalendarSync; | 721 | QDateTime lastSync = mLastCalendarSync; |
722 | QDateTime localMod = local->lastModified(); | 722 | QDateTime localMod = local->lastModified(); |
723 | QDateTime remoteMod = remote->lastModified(); | 723 | QDateTime remoteMod = remote->lastModified(); |
724 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 724 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
725 | bool remCh, locCh; | 725 | bool remCh, locCh; |
726 | remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); | 726 | remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); |
727 | //if ( remCh ) | 727 | //if ( remCh ) |
728 | //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); | 728 | //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); |
729 | locCh = ( localMod > mLastCalendarSync ); | 729 | locCh = ( localMod > mLastCalendarSync ); |
730 | if ( !remCh && ! locCh ) { | 730 | if ( !remCh && ! locCh ) { |
731 | //qDebug("both not changed "); | 731 | //qDebug("both not changed "); |
732 | lastSync = localMod.addDays(1); | 732 | lastSync = localMod.addDays(1); |
733 | if ( mode <= SYNC_PREF_ASK ) | 733 | if ( mode <= SYNC_PREF_ASK ) |
734 | return 0; | 734 | return 0; |
735 | } else { | 735 | } else { |
736 | if ( locCh ) { | 736 | if ( locCh ) { |
737 | //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1()); | 737 | //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1()); |
738 | lastSync = localMod.addDays( -1 ); | 738 | lastSync = localMod.addDays( -1 ); |
739 | if ( !remCh ) | 739 | if ( !remCh ) |
740 | remoteMod = ( lastSync.addDays( -1 ) ); | 740 | remoteMod = ( lastSync.addDays( -1 ) ); |
741 | } else { | 741 | } else { |
742 | //qDebug(" not loc changed "); | 742 | //qDebug(" not loc changed "); |
743 | lastSync = localMod.addDays( 1 ); | 743 | lastSync = localMod.addDays( 1 ); |
744 | if ( remCh ) | 744 | if ( remCh ) |
745 | remoteMod =( lastSync.addDays( 1 ) ); | 745 | remoteMod =( lastSync.addDays( 1 ) ); |
746 | 746 | ||
747 | } | 747 | } |
748 | } | 748 | } |
749 | full = true; | 749 | full = true; |
750 | if ( mode < SYNC_PREF_ASK ) | 750 | if ( mode < SYNC_PREF_ASK ) |
751 | mode = SYNC_PREF_ASK; | 751 | mode = SYNC_PREF_ASK; |
752 | } else { | 752 | } else { |
753 | if ( localMod == remoteMod ) | 753 | if ( localMod == remoteMod ) |
754 | // if ( local->revision() == remote->revision() ) | 754 | // if ( local->revision() == remote->revision() ) |
755 | return 0; | 755 | return 0; |
756 | 756 | ||
757 | } | 757 | } |
758 | // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); | 758 | // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); |
759 | 759 | ||
760 | //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision()); | 760 | //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision()); |
761 | //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() ); | 761 | //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() ); |
762 | //full = true; //debug only | 762 | //full = true; //debug only |
763 | if ( full ) { | 763 | if ( full ) { |
764 | bool equ = false; | 764 | bool equ = false; |
765 | if ( local->type() == "Event" ) { | 765 | if ( local->type() == "Event" ) { |
766 | equ = (*((Event*) local) == *((Event*) remote)); | 766 | equ = (*((Event*) local) == *((Event*) remote)); |
767 | } | 767 | } |
768 | else if ( local->type() =="Todo" ) | 768 | else if ( local->type() =="Todo" ) |
769 | equ = (*((Todo*) local) == (*(Todo*) remote)); | 769 | equ = (*((Todo*) local) == (*(Todo*) remote)); |
770 | else if ( local->type() =="Journal" ) | 770 | else if ( local->type() =="Journal" ) |
771 | equ = (*((Journal*) local) == *((Journal*) remote)); | 771 | equ = (*((Journal*) local) == *((Journal*) remote)); |
772 | if ( equ ) { | 772 | if ( equ ) { |
773 | //qDebug("equal "); | 773 | //qDebug("equal "); |
774 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 774 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
775 | local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); | 775 | local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); |
776 | } | 776 | } |
777 | if ( mode < SYNC_PREF_FORCE_LOCAL ) | 777 | if ( mode < SYNC_PREF_FORCE_LOCAL ) |
778 | return 0; | 778 | return 0; |
779 | 779 | ||
780 | }//else //debug only | 780 | }//else //debug only |
781 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); | 781 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); |
782 | } | 782 | } |
783 | int result; | 783 | int result; |
784 | bool localIsNew; | 784 | bool localIsNew; |
785 | //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , localMod.toString().latin1() , remoteMod.toString().latin1() ); | 785 | //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , localMod.toString().latin1() , remoteMod.toString().latin1() ); |
786 | 786 | ||
787 | if ( full && mode < SYNC_PREF_NEWEST ) | 787 | if ( full && mode < SYNC_PREF_NEWEST ) |
788 | mode = SYNC_PREF_ASK; | 788 | mode = SYNC_PREF_ASK; |
789 | 789 | ||
790 | switch( mode ) { | 790 | switch( mode ) { |
791 | case SYNC_PREF_LOCAL: | 791 | case SYNC_PREF_LOCAL: |
792 | if ( lastSync > remoteMod ) | 792 | if ( lastSync > remoteMod ) |
793 | return 1; | 793 | return 1; |
794 | if ( lastSync > localMod ) | 794 | if ( lastSync > localMod ) |
795 | return 2; | 795 | return 2; |
796 | return 1; | 796 | return 1; |
797 | break; | 797 | break; |
798 | case SYNC_PREF_REMOTE: | 798 | case SYNC_PREF_REMOTE: |
799 | if ( lastSync > remoteMod ) | 799 | if ( lastSync > remoteMod ) |
800 | return 1; | 800 | return 1; |
801 | if ( lastSync > localMod ) | 801 | if ( lastSync > localMod ) |
802 | return 2; | 802 | return 2; |
803 | return 2; | 803 | return 2; |
804 | break; | 804 | break; |
805 | case SYNC_PREF_NEWEST: | 805 | case SYNC_PREF_NEWEST: |
806 | if ( localMod > remoteMod ) | 806 | if ( localMod > remoteMod ) |
807 | return 1; | 807 | return 1; |
808 | else | 808 | else |
809 | return 2; | 809 | return 2; |
810 | break; | 810 | break; |
811 | case SYNC_PREF_ASK: | 811 | case SYNC_PREF_ASK: |
812 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); | 812 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); |
813 | if ( lastSync > remoteMod ) | 813 | if ( lastSync > remoteMod ) |
814 | return 1; | 814 | return 1; |
815 | if ( lastSync > localMod ) | 815 | if ( lastSync > localMod ) |
816 | return 2; | 816 | return 2; |
817 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); | 817 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); |
818 | localIsNew = localMod >= remoteMod; | 818 | localIsNew = localMod >= remoteMod; |
819 | if ( localIsNew ) | 819 | if ( localIsNew ) |
820 | getEventViewerDialog()->setColorMode( 1 ); | 820 | getEventViewerDialog()->setColorMode( 1 ); |
821 | else | 821 | else |
822 | getEventViewerDialog()->setColorMode( 2 ); | 822 | getEventViewerDialog()->setColorMode( 2 ); |
823 | getEventViewerDialog()->setIncidence(local); | 823 | getEventViewerDialog()->setIncidence(local); |
824 | if ( localIsNew ) | 824 | if ( localIsNew ) |
825 | getEventViewerDialog()->setColorMode( 2 ); | 825 | getEventViewerDialog()->setColorMode( 2 ); |
826 | else | 826 | else |
827 | getEventViewerDialog()->setColorMode( 1 ); | 827 | getEventViewerDialog()->setColorMode( 1 ); |
828 | getEventViewerDialog()->addIncidence(remote); | 828 | getEventViewerDialog()->addIncidence(remote); |
829 | getEventViewerDialog()->setColorMode( 0 ); | 829 | getEventViewerDialog()->setColorMode( 0 ); |
830 | //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); | 830 | //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); |
831 | getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); | 831 | getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); |
832 | getEventViewerDialog()->showMe(); | 832 | getEventViewerDialog()->showMe(); |
833 | result = getEventViewerDialog()->executeS( localIsNew ); | 833 | result = getEventViewerDialog()->executeS( localIsNew ); |
834 | return result; | 834 | return result; |
835 | 835 | ||
836 | break; | 836 | break; |
837 | case SYNC_PREF_FORCE_LOCAL: | 837 | case SYNC_PREF_FORCE_LOCAL: |
838 | return 1; | 838 | return 1; |
839 | break; | 839 | break; |
840 | case SYNC_PREF_FORCE_REMOTE: | 840 | case SYNC_PREF_FORCE_REMOTE: |
841 | return 2; | 841 | return 2; |
842 | break; | 842 | break; |
843 | 843 | ||
844 | default: | 844 | default: |
845 | // SYNC_PREF_TAKE_BOTH not implemented | 845 | // SYNC_PREF_TAKE_BOTH not implemented |
846 | break; | 846 | break; |
847 | } | 847 | } |
848 | return 0; | 848 | return 0; |
849 | } | 849 | } |
850 | Event* CalendarView::getLastSyncEvent() | 850 | Event* CalendarView::getLastSyncEvent() |
851 | { | 851 | { |
852 | Event* lse; | 852 | Event* lse; |
853 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); | 853 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); |
854 | lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); | 854 | lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); |
855 | if (!lse) { | 855 | if (!lse) { |
856 | lse = new Event(); | 856 | lse = new Event(); |
857 | lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); | 857 | lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); |
858 | QString sum = ""; | 858 | QString sum = ""; |
859 | if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) | 859 | if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) |
860 | sum = "E: "; | 860 | sum = "E: "; |
861 | lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); | 861 | lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); |
862 | lse->setDtStart( mLastCalendarSync ); | 862 | lse->setDtStart( mLastCalendarSync ); |
863 | lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); | 863 | lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); |
864 | lse->setCategories( i18n("SyncEvent") ); | 864 | lse->setCategories( i18n("SyncEvent") ); |
865 | lse->setReadOnly( true ); | 865 | lse->setReadOnly( true ); |
866 | mCalendar->addEvent( lse ); | 866 | mCalendar->addEvent( lse ); |
867 | } | 867 | } |
868 | 868 | ||
869 | return lse; | 869 | return lse; |
870 | 870 | ||
871 | } | 871 | } |
872 | 872 | ||
873 | // we check, if the to delete event has a id for a profile | 873 | // we check, if the to delete event has a id for a profile |
874 | // if yes, we set this id in the profile to delete | 874 | // if yes, we set this id in the profile to delete |
875 | void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) | 875 | void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) |
876 | { | 876 | { |
877 | if ( lastSync.count() == 0 ) { | 877 | if ( lastSync.count() == 0 ) { |
878 | //qDebug(" lastSync.count() == 0"); | 878 | //qDebug(" lastSync.count() == 0"); |
879 | return; | 879 | return; |
880 | } | 880 | } |
881 | if ( toDelete->type() == "Journal" ) | 881 | if ( toDelete->type() == "Journal" ) |
882 | return; | 882 | return; |
883 | 883 | ||
884 | Event* eve = lastSync.first(); | 884 | Event* eve = lastSync.first(); |
885 | 885 | ||
886 | while ( eve ) { | 886 | while ( eve ) { |
887 | QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name | 887 | QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name |
888 | if ( !id.isEmpty() ) { | 888 | if ( !id.isEmpty() ) { |
889 | QString des = eve->description(); | 889 | QString des = eve->description(); |
890 | QString pref = "e"; | 890 | QString pref = "e"; |
891 | if ( toDelete->type() == "Todo" ) | 891 | if ( toDelete->type() == "Todo" ) |
892 | pref = "t"; | 892 | pref = "t"; |
893 | des += pref+ id + ","; | 893 | des += pref+ id + ","; |
894 | eve->setReadOnly( false ); | 894 | eve->setReadOnly( false ); |
895 | eve->setDescription( des ); | 895 | eve->setDescription( des ); |
896 | //qDebug("setdes %s ", des.latin1()); | 896 | //qDebug("setdes %s ", des.latin1()); |
897 | eve->setReadOnly( true ); | 897 | eve->setReadOnly( true ); |
898 | } | 898 | } |
899 | eve = lastSync.next(); | 899 | eve = lastSync.next(); |
900 | } | 900 | } |
901 | 901 | ||
902 | } | 902 | } |
903 | void CalendarView::checkExternalId( Incidence * inc ) | 903 | void CalendarView::checkExternalId( Incidence * inc ) |
904 | { | 904 | { |
905 | QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; | 905 | QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; |
906 | checkExternSyncEvent( lastSync, inc ); | 906 | checkExternSyncEvent( lastSync, inc ); |
907 | 907 | ||
908 | } | 908 | } |
909 | bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) | 909 | bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) |
910 | { | 910 | { |
911 | bool syncOK = true; | 911 | bool syncOK = true; |
912 | int addedEvent = 0; | 912 | int addedEvent = 0; |
913 | int addedEventR = 0; | 913 | int addedEventR = 0; |
914 | int deletedEventR = 0; | 914 | int deletedEventR = 0; |
915 | int deletedEventL = 0; | 915 | int deletedEventL = 0; |
916 | int changedLocal = 0; | 916 | int changedLocal = 0; |
917 | int changedRemote = 0; | 917 | int changedRemote = 0; |
918 | //QPtrList<Event> el = local->rawEvents(); | 918 | //QPtrList<Event> el = local->rawEvents(); |
919 | Event* eventR; | 919 | Event* eventR; |
920 | QString uid; | 920 | QString uid; |
921 | int take; | 921 | int take; |
922 | Event* eventL; | 922 | Event* eventL; |
923 | Event* eventRSync; | 923 | Event* eventRSync; |
924 | Event* eventLSync; | 924 | Event* eventLSync; |
925 | QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); | 925 | QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); |
926 | QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); | 926 | QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); |
927 | bool fullDateRange = false; | 927 | bool fullDateRange = false; |
928 | local->resetTempSyncStat(); | 928 | local->resetTempSyncStat(); |
929 | mLastCalendarSync = QDateTime::currentDateTime(); | 929 | mLastCalendarSync = QDateTime::currentDateTime(); |
930 | if ( mSyncManager->syncWithDesktop() ) { | 930 | if ( mSyncManager->syncWithDesktop() ) { |
931 | remote->resetPilotStat(1); | 931 | remote->resetPilotStat(1); |
932 | if ( KSyncManager::mRequestedSyncEvent.isValid() ) { | 932 | if ( KSyncManager::mRequestedSyncEvent.isValid() ) { |
933 | mLastCalendarSync = KSyncManager::mRequestedSyncEvent; | 933 | mLastCalendarSync = KSyncManager::mRequestedSyncEvent; |
934 | qDebug("using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() ); | 934 | qDebug("using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() ); |
935 | } else { | 935 | } else { |
936 | qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime "); | 936 | qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime "); |
937 | } | 937 | } |
938 | } | 938 | } |
939 | QDateTime modifiedCalendar = mLastCalendarSync; | 939 | QDateTime modifiedCalendar = mLastCalendarSync; |
940 | eventLSync = getLastSyncEvent(); | 940 | eventLSync = getLastSyncEvent(); |
941 | eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); | 941 | eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); |
942 | if ( eventR ) { | 942 | if ( eventR ) { |
943 | eventRSync = (Event*) eventR->clone(); | 943 | eventRSync = (Event*) eventR->clone(); |
944 | remote->deleteEvent(eventR ); | 944 | remote->deleteEvent(eventR ); |
945 | 945 | ||
946 | } else { | 946 | } else { |
947 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) { | 947 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) { |
948 | eventRSync = (Event*)eventLSync->clone(); | 948 | eventRSync = (Event*)eventLSync->clone(); |
949 | } else { | 949 | } else { |
950 | fullDateRange = true; | 950 | fullDateRange = true; |
951 | eventRSync = new Event(); | 951 | eventRSync = new Event(); |
952 | eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); | 952 | eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); |
953 | eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); | 953 | eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); |
954 | eventRSync->setDtStart( mLastCalendarSync ); | 954 | eventRSync->setDtStart( mLastCalendarSync ); |
955 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); | 955 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); |
956 | eventRSync->setCategories( i18n("SyncEvent") ); | 956 | eventRSync->setCategories( i18n("SyncEvent") ); |
957 | } | 957 | } |
958 | } | 958 | } |
959 | if ( eventLSync->dtStart() == mLastCalendarSync ) | 959 | if ( eventLSync->dtStart() == mLastCalendarSync ) |
960 | fullDateRange = true; | 960 | fullDateRange = true; |
961 | 961 | ||
962 | if ( ! fullDateRange ) { | 962 | if ( ! fullDateRange ) { |
963 | if ( eventLSync->dtStart() != eventRSync->dtStart() ) { | 963 | if ( eventLSync->dtStart() != eventRSync->dtStart() ) { |
964 | 964 | ||
965 | // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); | 965 | // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); |
966 | //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); | 966 | //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); |
967 | fullDateRange = true; | 967 | fullDateRange = true; |
968 | } | 968 | } |
969 | } | 969 | } |
970 | if ( mSyncManager->syncWithDesktop() ) { | 970 | if ( mSyncManager->syncWithDesktop() ) { |
971 | fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync ); | 971 | fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync ); |
972 | } | 972 | } |
973 | if ( fullDateRange ) | 973 | if ( fullDateRange ) |
974 | mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); | 974 | mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); |
975 | else | 975 | else |
976 | mLastCalendarSync = eventLSync->dtStart(); | 976 | mLastCalendarSync = eventLSync->dtStart(); |
977 | // for resyncing if own file has changed | 977 | // for resyncing if own file has changed |
978 | if ( mCurrentSyncDevice == "deleteaftersync" ) { | 978 | if ( mCurrentSyncDevice == "deleteaftersync" ) { |
979 | mLastCalendarSync = loadedFileVersion; | 979 | mLastCalendarSync = loadedFileVersion; |
980 | //qDebug("setting mLastCalendarSync "); | 980 | //qDebug("setting mLastCalendarSync "); |
981 | } | 981 | } |
982 | //qDebug("*************************** "); | 982 | //qDebug("*************************** "); |
983 | qDebug("mLastCalendarSync %s full: %d",mLastCalendarSync.toString().latin1(), fullDateRange); | 983 | qDebug("mLastCalendarSync %s full: %d",mLastCalendarSync.toString().latin1(), fullDateRange); |
984 | QPtrList<Incidence> er = remote->rawIncidences(); | 984 | QPtrList<Incidence> er = remote->rawIncidences(); |
985 | Incidence* inR = er.first(); | 985 | Incidence* inR = er.first(); |
986 | Incidence* inL; | 986 | Incidence* inL; |
987 | QProgressBar bar( er.count(),0 ); | 987 | QProgressBar bar( er.count(),0 ); |
988 | bar.setCaption (i18n("Syncing - close to abort!") ); | 988 | bar.setCaption (i18n("Syncing - close to abort!") ); |
989 | 989 | ||
990 | int w = 300; | 990 | int w = 300; |
991 | if ( QApplication::desktop()->width() < 320 ) | 991 | if ( QApplication::desktop()->width() < 320 ) |
992 | w = 220; | 992 | w = 220; |
993 | int h = bar.sizeHint().height() ; | 993 | int h = bar.sizeHint().height() ; |
994 | int dw = QApplication::desktop()->width(); | 994 | int dw = QApplication::desktop()->width(); |
995 | int dh = QApplication::desktop()->height(); | 995 | int dh = QApplication::desktop()->height(); |
996 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 996 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
997 | bar.show(); | 997 | bar.show(); |
998 | int modulo = (er.count()/10)+1; | 998 | int modulo = (er.count()/10)+1; |
999 | int incCounter = 0; | 999 | int incCounter = 0; |
1000 | while ( inR ) { | 1000 | while ( inR ) { |
1001 | if ( ! bar.isVisible() ) | 1001 | if ( ! bar.isVisible() ) |
1002 | return false; | 1002 | return false; |
1003 | if ( incCounter % modulo == 0 ) | 1003 | if ( incCounter % modulo == 0 ) |
1004 | bar.setProgress( incCounter ); | 1004 | bar.setProgress( incCounter ); |
1005 | ++incCounter; | 1005 | ++incCounter; |
1006 | uid = inR->uid(); | 1006 | uid = inR->uid(); |
1007 | bool skipIncidence = false; | 1007 | bool skipIncidence = false; |
1008 | if ( uid.left(15) == QString("last-syncEvent-") ) | 1008 | if ( uid.left(15) == QString("last-syncEvent-") ) |
1009 | skipIncidence = true; | 1009 | skipIncidence = true; |
1010 | QString idS; | 1010 | QString idS; |
1011 | qApp->processEvents(); | 1011 | qApp->processEvents(); |
1012 | if ( !skipIncidence ) { | 1012 | if ( !skipIncidence ) { |
1013 | inL = local->incidence( uid ); | 1013 | inL = local->incidence( uid ); |
1014 | if ( inL ) { // maybe conflict - same uid in both calendars | 1014 | if ( inL ) { // maybe conflict - same uid in both calendars |
1015 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { | 1015 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { |
1016 | //qDebug("take %d %s ", take, inL->summary().latin1()); | 1016 | //qDebug("take %d %s ", take, inL->summary().latin1()); |
1017 | if ( take == 3 ) | 1017 | if ( take == 3 ) |
1018 | return false; | 1018 | return false; |
1019 | if ( take == 1 ) {// take local ********************** | 1019 | if ( take == 1 ) {// take local ********************** |
1020 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) | 1020 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) |
1021 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1021 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1022 | else | 1022 | else |
1023 | idS = inR->IDStr(); | 1023 | idS = inR->IDStr(); |
1024 | remote->deleteIncidence( inR ); | 1024 | remote->deleteIncidence( inR ); |
1025 | inR = inL->clone(); | 1025 | inR = inL->clone(); |
1026 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 1026 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
1027 | if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) | 1027 | if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) |
1028 | inR->setIDStr( idS ); | 1028 | inR->setIDStr( idS ); |
1029 | remote->addIncidence( inR ); | 1029 | remote->addIncidence( inR ); |
1030 | if ( mSyncManager->syncWithDesktop() ) | 1030 | if ( mSyncManager->syncWithDesktop() ) |
1031 | inR->setPilotId( 2 ); | 1031 | inR->setPilotId( 2 ); |
1032 | ++changedRemote; | 1032 | ++changedRemote; |
1033 | } else {// take remote ********************** | 1033 | } else {// take remote ********************** |
1034 | idS = inL->IDStr(); | 1034 | idS = inL->IDStr(); |
1035 | int pid = inL->pilotId(); | 1035 | int pid = inL->pilotId(); |
1036 | local->deleteIncidence( inL ); | 1036 | local->deleteIncidence( inL ); |
1037 | inL = inR->clone(); | 1037 | inL = inR->clone(); |
1038 | if ( mSyncManager->syncWithDesktop() ) | 1038 | if ( mSyncManager->syncWithDesktop() ) |
1039 | inL->setPilotId( pid ); | 1039 | inL->setPilotId( pid ); |
1040 | inL->setIDStr( idS ); | 1040 | inL->setIDStr( idS ); |
1041 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1041 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1042 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1042 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1043 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); | 1043 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); |
1044 | } | 1044 | } |
1045 | local->addIncidence( inL ); | 1045 | local->addIncidence( inL ); |
1046 | ++changedLocal; | 1046 | ++changedLocal; |
1047 | } | 1047 | } |
1048 | } | 1048 | } |
1049 | } else { // no conflict ********** add or delete remote | 1049 | } else { // no conflict ********** add or delete remote |
1050 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1050 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1051 | QString des = eventLSync->description(); | 1051 | QString des = eventLSync->description(); |
1052 | QString pref = "e"; | 1052 | QString pref = "e"; |
1053 | if ( inR->type() == "Todo" ) | 1053 | if ( inR->type() == "Todo" ) |
1054 | pref = "t"; | 1054 | pref = "t"; |
1055 | if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it | 1055 | if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it |
1056 | inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); | 1056 | inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); |
1057 | //remote->deleteIncidence( inR ); | 1057 | //remote->deleteIncidence( inR ); |
1058 | ++deletedEventR; | 1058 | ++deletedEventR; |
1059 | } else { | 1059 | } else { |
1060 | inR->setLastModified( modifiedCalendar ); | 1060 | inR->setLastModified( modifiedCalendar ); |
1061 | inL = inR->clone(); | 1061 | inL = inR->clone(); |
1062 | inL->setIDStr( ":" ); | 1062 | inL->setIDStr( ":" ); |
1063 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1063 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1064 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); | 1064 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); |
1065 | local->addIncidence( inL ); | 1065 | local->addIncidence( inL ); |
1066 | ++addedEvent; | 1066 | ++addedEvent; |
1067 | } | 1067 | } |
1068 | } else { | 1068 | } else { |
1069 | if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { | 1069 | if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { |
1070 | inR->setLastModified( modifiedCalendar ); | 1070 | inR->setLastModified( modifiedCalendar ); |
1071 | inL = inR->clone(); | 1071 | inL = inR->clone(); |
1072 | inL->setIDStr( ":" ); | 1072 | inL->setIDStr( ":" ); |
1073 | local->addIncidence( inL ); | 1073 | local->addIncidence( inL ); |
1074 | ++addedEvent; | 1074 | ++addedEvent; |
1075 | } else { | 1075 | } else { |
1076 | checkExternSyncEvent(eventRSyncSharp, inR); | 1076 | checkExternSyncEvent(eventRSyncSharp, inR); |
1077 | remote->deleteIncidence( inR ); | 1077 | remote->deleteIncidence( inR ); |
1078 | ++deletedEventR; | 1078 | ++deletedEventR; |
1079 | } | 1079 | } |
1080 | } | 1080 | } |
1081 | } | 1081 | } |
1082 | } | 1082 | } |
1083 | inR = er.next(); | 1083 | inR = er.next(); |
1084 | } | 1084 | } |
1085 | QPtrList<Incidence> el = local->rawIncidences(); | 1085 | QPtrList<Incidence> el = local->rawIncidences(); |
1086 | inL = el.first(); | 1086 | inL = el.first(); |
1087 | modulo = (el.count()/10)+1; | 1087 | modulo = (el.count()/10)+1; |
1088 | bar.setCaption (i18n("Add / remove events") ); | 1088 | bar.setCaption (i18n("Add / remove events") ); |
1089 | bar.setTotalSteps ( el.count() ) ; | 1089 | bar.setTotalSteps ( el.count() ) ; |
1090 | bar.show(); | 1090 | bar.show(); |
1091 | incCounter = 0; | 1091 | incCounter = 0; |
1092 | 1092 | ||
1093 | while ( inL ) { | 1093 | while ( inL ) { |
1094 | 1094 | ||
1095 | qApp->processEvents(); | 1095 | qApp->processEvents(); |
1096 | if ( ! bar.isVisible() ) | 1096 | if ( ! bar.isVisible() ) |
1097 | return false; | 1097 | return false; |
1098 | if ( incCounter % modulo == 0 ) | 1098 | if ( incCounter % modulo == 0 ) |
1099 | bar.setProgress( incCounter ); | 1099 | bar.setProgress( incCounter ); |
1100 | ++incCounter; | 1100 | ++incCounter; |
1101 | uid = inL->uid(); | 1101 | uid = inL->uid(); |
1102 | bool skipIncidence = false; | 1102 | bool skipIncidence = false; |
1103 | if ( uid.left(15) == QString("last-syncEvent-") ) | 1103 | if ( uid.left(15) == QString("last-syncEvent-") ) |
1104 | skipIncidence = true; | 1104 | skipIncidence = true; |
1105 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) | 1105 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) |
1106 | skipIncidence = true; | 1106 | skipIncidence = true; |
1107 | if ( !skipIncidence ) { | 1107 | if ( !skipIncidence ) { |
1108 | inR = remote->incidence( uid ); | 1108 | inR = remote->incidence( uid ); |
1109 | if ( ! inR ) { // no conflict ********** add or delete local | 1109 | if ( ! inR ) { // no conflict ********** add or delete local |
1110 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1110 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1111 | if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { | 1111 | if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { |
1112 | checkExternSyncEvent(eventLSyncSharp, inL); | 1112 | checkExternSyncEvent(eventLSyncSharp, inL); |
1113 | local->deleteIncidence( inL ); | 1113 | local->deleteIncidence( inL ); |
1114 | ++deletedEventL; | 1114 | ++deletedEventL; |
1115 | } else { | 1115 | } else { |
1116 | if ( ! mSyncManager->mWriteBackExistingOnly ) { | 1116 | if ( ! mSyncManager->mWriteBackExistingOnly ) { |
1117 | inL->removeID(mCurrentSyncDevice ); | 1117 | inL->removeID(mCurrentSyncDevice ); |
1118 | ++addedEventR; | 1118 | ++addedEventR; |
1119 | //qDebug("remote added Incidence %s ", inL->summary().latin1()); | 1119 | //qDebug("remote added Incidence %s ", inL->summary().latin1()); |
1120 | inL->setLastModified( modifiedCalendar ); | 1120 | inL->setLastModified( modifiedCalendar ); |
1121 | inR = inL->clone(); | 1121 | inR = inL->clone(); |
1122 | inR->setIDStr( ":" ); | 1122 | inR->setIDStr( ":" ); |
1123 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 1123 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
1124 | remote->addIncidence( inR ); | 1124 | remote->addIncidence( inR ); |
1125 | } | 1125 | } |
1126 | } | 1126 | } |
1127 | } else { | 1127 | } else { |
1128 | if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { | 1128 | if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { |
1129 | checkExternSyncEvent(eventLSyncSharp, inL); | 1129 | checkExternSyncEvent(eventLSyncSharp, inL); |
1130 | local->deleteIncidence( inL ); | 1130 | local->deleteIncidence( inL ); |
1131 | ++deletedEventL; | 1131 | ++deletedEventL; |
1132 | } else { | 1132 | } else { |
1133 | if ( ! mSyncManager->mWriteBackExistingOnly ) { | 1133 | if ( ! mSyncManager->mWriteBackExistingOnly ) { |
1134 | ++addedEventR; | 1134 | ++addedEventR; |
1135 | inL->setLastModified( modifiedCalendar ); | 1135 | inL->setLastModified( modifiedCalendar ); |
1136 | inR = inL->clone(); | 1136 | inR = inL->clone(); |
1137 | inR->setIDStr( ":" ); | 1137 | inR->setIDStr( ":" ); |
1138 | remote->addIncidence( inR ); | 1138 | remote->addIncidence( inR ); |
1139 | } | 1139 | } |
1140 | } | 1140 | } |
1141 | } | 1141 | } |
1142 | } | 1142 | } |
1143 | } | 1143 | } |
1144 | inL = el.next(); | 1144 | inL = el.next(); |
1145 | } | 1145 | } |
1146 | int delFut = 0; | 1146 | int delFut = 0; |
1147 | int remRem = 0; | 1147 | int remRem = 0; |
1148 | if ( mSyncManager->mWriteBackInFuture ) { | 1148 | if ( mSyncManager->mWriteBackInFuture ) { |
1149 | er = remote->rawIncidences(); | 1149 | er = remote->rawIncidences(); |
1150 | remRem = er.count(); | 1150 | remRem = er.count(); |
1151 | inR = er.first(); | 1151 | inR = er.first(); |
1152 | QDateTime dt; | 1152 | QDateTime dt; |
1153 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); | 1153 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); |
1154 | QDateTime end = cur.addDays( (mSyncManager->mWriteBackInFuture +1 ) *7 ); | 1154 | QDateTime end = cur.addDays( (mSyncManager->mWriteBackInFuture +1 ) *7 ); |
1155 | while ( inR ) { | 1155 | while ( inR ) { |
1156 | if ( inR->type() == "Todo" ) { | 1156 | if ( inR->type() == "Todo" ) { |
1157 | Todo * t = (Todo*)inR; | 1157 | Todo * t = (Todo*)inR; |
1158 | if ( t->hasDueDate() ) | 1158 | if ( t->hasDueDate() ) |
1159 | dt = t->dtDue(); | 1159 | dt = t->dtDue(); |
1160 | else | 1160 | else |
1161 | dt = cur.addSecs( 62 ); | 1161 | dt = cur.addSecs( 62 ); |
1162 | } | 1162 | } |
1163 | else if (inR->type() == "Event" ) { | 1163 | else if (inR->type() == "Event" ) { |
1164 | bool ok; | 1164 | bool ok; |
1165 | dt = inR->getNextOccurence( cur, &ok ); | 1165 | dt = inR->getNextOccurence( cur, &ok ); |
1166 | if ( !ok ) | 1166 | if ( !ok ) |
1167 | dt = cur.addSecs( -62 ); | 1167 | dt = cur.addSecs( -62 ); |
1168 | } | 1168 | } |
1169 | else | 1169 | else |
1170 | dt = inR->dtStart(); | 1170 | dt = inR->dtStart(); |
1171 | if ( dt < cur || dt > end ) { | 1171 | if ( dt < cur || dt > end ) { |
1172 | remote->deleteIncidence( inR ); | 1172 | remote->deleteIncidence( inR ); |
1173 | ++delFut; | 1173 | ++delFut; |
1174 | } | 1174 | } |
1175 | inR = er.next(); | 1175 | inR = er.next(); |
1176 | } | 1176 | } |
1177 | } | 1177 | } |
1178 | bar.hide(); | 1178 | bar.hide(); |
1179 | mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); | 1179 | mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); |
1180 | eventLSync->setReadOnly( false ); | 1180 | eventLSync->setReadOnly( false ); |
1181 | eventLSync->setDtStart( mLastCalendarSync ); | 1181 | eventLSync->setDtStart( mLastCalendarSync ); |
1182 | eventRSync->setDtStart( mLastCalendarSync ); | 1182 | eventRSync->setDtStart( mLastCalendarSync ); |
1183 | eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); | 1183 | eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); |
1184 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); | 1184 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); |
1185 | eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; | 1185 | eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; |
1186 | eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); | 1186 | eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); |
1187 | eventLSync->setReadOnly( true ); | 1187 | eventLSync->setReadOnly( true ); |
1188 | qDebug("********** %d %d ", mGlobalSyncMode == SYNC_MODE_NORMAL, mSyncManager->syncWithDesktop() ); | 1188 | qDebug("********** %d %d ", mGlobalSyncMode == SYNC_MODE_NORMAL, mSyncManager->syncWithDesktop() ); |
1189 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal... | 1189 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal... |
1190 | remote->addEvent( eventRSync ); | 1190 | remote->addEvent( eventRSync ); |
1191 | else | 1191 | else |
1192 | delete eventRSync; | 1192 | delete eventRSync; |
1193 | QString mes; | 1193 | QString mes; |
1194 | mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR ); | 1194 | mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR ); |
1195 | QString delmess; | 1195 | QString delmess; |
1196 | if ( delFut ) { | 1196 | if ( delFut ) { |
1197 | delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInFuture, remRem-delFut); | 1197 | delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInFuture, remRem-delFut); |
1198 | mes += delmess; | 1198 | mes += delmess; |
1199 | } | 1199 | } |
1200 | mes = i18n("Local calendar changed!\n") +mes; | 1200 | mes = i18n("Local calendar changed!\n") +mes; |
1201 | mCalendar->checkAlarmForIncidence( 0, true ); | 1201 | mCalendar->checkAlarmForIncidence( 0, true ); |
1202 | qDebug( mes ); | 1202 | qDebug( mes ); |
1203 | if ( mSyncManager->mShowSyncSummary ) { | 1203 | if ( mSyncManager->mShowSyncSummary ) { |
1204 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, | 1204 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, |
1205 | i18n("KO/Pi Synchronization"),i18n("Write back"))) { | 1205 | i18n("KO/Pi Synchronization"),i18n("Write back"))) { |
1206 | qDebug("cancelled "); | 1206 | qDebug("cancelled "); |
1207 | return false; | 1207 | return false; |
1208 | } | 1208 | } |
1209 | } | 1209 | } |
1210 | return syncOK; | 1210 | return syncOK; |
1211 | } | 1211 | } |
1212 | 1212 | ||
1213 | void CalendarView::setSyncDevice( QString s ) | 1213 | void CalendarView::setSyncDevice( QString s ) |
1214 | { | 1214 | { |
1215 | mCurrentSyncDevice= s; | 1215 | mCurrentSyncDevice= s; |
1216 | } | 1216 | } |
1217 | void CalendarView::setSyncName( QString s ) | 1217 | void CalendarView::setSyncName( QString s ) |
1218 | { | 1218 | { |
1219 | mCurrentSyncName= s; | 1219 | mCurrentSyncName= s; |
1220 | } | 1220 | } |
1221 | bool CalendarView::syncCalendar(QString filename, int mode) | 1221 | bool CalendarView::syncCalendar(QString filename, int mode) |
1222 | { | 1222 | { |
1223 | //qDebug("syncCalendar %s ", filename.latin1()); | 1223 | //qDebug("syncCalendar %s ", filename.latin1()); |
1224 | mGlobalSyncMode = SYNC_MODE_NORMAL; | 1224 | mGlobalSyncMode = SYNC_MODE_NORMAL; |
1225 | CalendarLocal* calendar = new CalendarLocal(); | 1225 | CalendarLocal* calendar = new CalendarLocal(); |
1226 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 1226 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
1227 | FileStorage* storage = new FileStorage( calendar ); | 1227 | FileStorage* storage = new FileStorage( calendar ); |
1228 | bool syncOK = false; | 1228 | bool syncOK = false; |
1229 | storage->setFileName( filename ); | 1229 | storage->setFileName( filename ); |
1230 | // qDebug("loading ... "); | 1230 | // qDebug("loading ... "); |
1231 | if ( storage->load() ) { | 1231 | if ( storage->load() ) { |
1232 | getEventViewerDialog()->setSyncMode( true ); | 1232 | getEventViewerDialog()->setSyncMode( true ); |
1233 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); | 1233 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); |
1234 | getEventViewerDialog()->setSyncMode( false ); | 1234 | getEventViewerDialog()->setSyncMode( false ); |
1235 | if ( syncOK ) { | 1235 | if ( syncOK ) { |
1236 | if ( mSyncManager->mWriteBackFile ) | 1236 | if ( mSyncManager->mWriteBackFile ) |
1237 | { | 1237 | { |
1238 | storage->setSaveFormat( new ICalFormat() ); | 1238 | storage->setSaveFormat( new ICalFormat() ); |
1239 | storage->save(); | 1239 | storage->save(); |
1240 | } | 1240 | } |
1241 | } | 1241 | } |
1242 | setModified( true ); | 1242 | setModified( true ); |
1243 | } | 1243 | } |
1244 | delete storage; | 1244 | delete storage; |
1245 | delete calendar; | 1245 | delete calendar; |
1246 | if ( syncOK ) | 1246 | if ( syncOK ) |
1247 | updateView(); | 1247 | updateView(); |
1248 | return syncOK; | 1248 | return syncOK; |
1249 | } | 1249 | } |
1250 | 1250 | ||
1251 | void CalendarView::syncExternal( int mode ) | 1251 | void CalendarView::syncExternal( int mode ) |
1252 | { | 1252 | { |
1253 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 1253 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
1254 | 1254 | ||
1255 | qApp->processEvents(); | 1255 | qApp->processEvents(); |
1256 | CalendarLocal* calendar = new CalendarLocal(); | 1256 | CalendarLocal* calendar = new CalendarLocal(); |
1257 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 1257 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
1258 | bool syncOK = false; | 1258 | bool syncOK = false; |
1259 | bool loadSuccess = false; | 1259 | bool loadSuccess = false; |
1260 | PhoneFormat* phoneFormat = 0; | 1260 | PhoneFormat* phoneFormat = 0; |
1261 | emit tempDisableBR(true); | 1261 | emit tempDisableBR(true); |
1262 | #ifndef DESKTOP_VERSION | 1262 | #ifndef DESKTOP_VERSION |
1263 | SharpFormat* sharpFormat = 0; | 1263 | SharpFormat* sharpFormat = 0; |
1264 | if ( mode == 0 ) { // sharp | 1264 | if ( mode == 0 ) { // sharp |
1265 | sharpFormat = new SharpFormat () ; | 1265 | sharpFormat = new SharpFormat () ; |
1266 | loadSuccess = sharpFormat->load( calendar, mCalendar ); | 1266 | loadSuccess = sharpFormat->load( calendar, mCalendar ); |
1267 | 1267 | ||
1268 | } else | 1268 | } else |
1269 | #endif | 1269 | #endif |
1270 | if ( mode == 1 ) { // phone | 1270 | if ( mode == 1 ) { // phone |
1271 | phoneFormat = new PhoneFormat (mCurrentSyncDevice, | 1271 | phoneFormat = new PhoneFormat (mCurrentSyncDevice, |
1272 | mSyncManager->mPhoneDevice, | 1272 | mSyncManager->mPhoneDevice, |
1273 | mSyncManager->mPhoneConnection, | 1273 | mSyncManager->mPhoneConnection, |
1274 | mSyncManager->mPhoneModel); | 1274 | mSyncManager->mPhoneModel); |
1275 | loadSuccess = phoneFormat->load( calendar,mCalendar); | 1275 | loadSuccess = phoneFormat->load( calendar,mCalendar); |
1276 | 1276 | ||
1277 | } else { | 1277 | } else { |
1278 | emit tempDisableBR(false); | 1278 | emit tempDisableBR(false); |
1279 | return; | 1279 | return; |
1280 | } | 1280 | } |
1281 | if ( loadSuccess ) { | 1281 | if ( loadSuccess ) { |
1282 | getEventViewerDialog()->setSyncMode( true ); | 1282 | getEventViewerDialog()->setSyncMode( true ); |
1283 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); | 1283 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); |
1284 | getEventViewerDialog()->setSyncMode( false ); | 1284 | getEventViewerDialog()->setSyncMode( false ); |
1285 | qApp->processEvents(); | 1285 | qApp->processEvents(); |
1286 | if ( syncOK ) { | 1286 | if ( syncOK ) { |
1287 | if ( mSyncManager->mWriteBackFile ) | 1287 | if ( mSyncManager->mWriteBackFile ) |
1288 | { | 1288 | { |
1289 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); | 1289 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); |
1290 | Incidence* inc = iL.first(); | 1290 | Incidence* inc = iL.first(); |
1291 | if ( phoneFormat ) { | 1291 | if ( phoneFormat ) { |
1292 | while ( inc ) { | 1292 | while ( inc ) { |
1293 | inc->removeID(mCurrentSyncDevice); | 1293 | inc->removeID(mCurrentSyncDevice); |
1294 | inc = iL.next(); | 1294 | inc = iL.next(); |
1295 | } | 1295 | } |
1296 | } | 1296 | } |
1297 | #ifndef DESKTOP_VERSION | 1297 | #ifndef DESKTOP_VERSION |
1298 | if ( sharpFormat ) | 1298 | if ( sharpFormat ) |
1299 | sharpFormat->save(calendar); | 1299 | sharpFormat->save(calendar); |
1300 | #endif | 1300 | #endif |
1301 | if ( phoneFormat ) | 1301 | if ( phoneFormat ) |
1302 | phoneFormat->save(calendar); | 1302 | phoneFormat->save(calendar); |
1303 | iL = calendar->rawIncidences(); | 1303 | iL = calendar->rawIncidences(); |
1304 | inc = iL.first(); | 1304 | inc = iL.first(); |
1305 | Incidence* loc; | 1305 | Incidence* loc; |
1306 | while ( inc ) { | 1306 | while ( inc ) { |
1307 | if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { | 1307 | if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { |
1308 | loc = mCalendar->incidence(inc->uid() ); | 1308 | loc = mCalendar->incidence(inc->uid() ); |
1309 | if ( loc ) { | 1309 | if ( loc ) { |
1310 | loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); | 1310 | loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); |
1311 | loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); | 1311 | loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); |
1312 | } | 1312 | } |
1313 | } | 1313 | } |
1314 | inc = iL.next(); | 1314 | inc = iL.next(); |
1315 | } | 1315 | } |
1316 | Incidence* lse = getLastSyncEvent(); | 1316 | Incidence* lse = getLastSyncEvent(); |
1317 | if ( lse ) { | 1317 | if ( lse ) { |
1318 | lse->setReadOnly( false ); | 1318 | lse->setReadOnly( false ); |
1319 | lse->setDescription( "" ); | 1319 | lse->setDescription( "" ); |
1320 | lse->setReadOnly( true ); | 1320 | lse->setReadOnly( true ); |
1321 | } | 1321 | } |
1322 | } | 1322 | } |
1323 | } else { | 1323 | } else { |
1324 | topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); | 1324 | topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); |
1325 | } | 1325 | } |
1326 | setModified( true ); | 1326 | setModified( true ); |
1327 | } else { | 1327 | } else { |
1328 | QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; | 1328 | QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; |
1329 | QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), | 1329 | QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), |
1330 | question, i18n("Ok")) ; | 1330 | question, i18n("Ok")) ; |
1331 | 1331 | ||
1332 | } | 1332 | } |
1333 | delete calendar; | 1333 | delete calendar; |
1334 | updateView(); | 1334 | updateView(); |
1335 | emit tempDisableBR(false); | 1335 | emit tempDisableBR(false); |
1336 | return ;//syncOK; | 1336 | return ;//syncOK; |
1337 | 1337 | ||
1338 | } | 1338 | } |
1339 | 1339 | ||
1340 | bool CalendarView::importBday() | 1340 | bool CalendarView::importBday() |
1341 | { | 1341 | { |
1342 | #ifndef KORG_NOKABC | 1342 | #ifndef KORG_NOKABC |
1343 | 1343 | ||
1344 | #ifdef DESKTOP_VERSION | 1344 | #ifdef DESKTOP_VERSION |
1345 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); | 1345 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); |
1346 | KABC::AddressBook::Iterator it; | 1346 | KABC::AddressBook::Iterator it; |
1347 | int count = 0; | 1347 | int count = 0; |
1348 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 1348 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
1349 | ++count; | 1349 | ++count; |
1350 | } | 1350 | } |
1351 | QProgressBar bar(count,0 ); | 1351 | QProgressBar bar(count,0 ); |
1352 | int w = 300; | 1352 | int w = 300; |
1353 | if ( QApplication::desktop()->width() < 320 ) | 1353 | if ( QApplication::desktop()->width() < 320 ) |
1354 | w = 220; | 1354 | w = 220; |
1355 | int h = bar.sizeHint().height() ; | 1355 | int h = bar.sizeHint().height() ; |
1356 | int dw = QApplication::desktop()->width(); | 1356 | int dw = QApplication::desktop()->width(); |
1357 | int dh = QApplication::desktop()->height(); | 1357 | int dh = QApplication::desktop()->height(); |
1358 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 1358 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
1359 | bar.show(); | 1359 | bar.show(); |
1360 | bar.setCaption (i18n("Reading addressbook - close to abort!") ); | 1360 | bar.setCaption (i18n("Reading addressbook - close to abort!") ); |
1361 | qApp->processEvents(); | 1361 | qApp->processEvents(); |
1362 | count = 0; | 1362 | count = 0; |
1363 | int addCount = 0; | 1363 | int addCount = 0; |
1364 | KCal::Attendee* a = 0; | 1364 | KCal::Attendee* a = 0; |
1365 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 1365 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
1366 | if ( ! bar.isVisible() ) | 1366 | if ( ! bar.isVisible() ) |
1367 | return false; | 1367 | return false; |
1368 | bar.setProgress( count++ ); | 1368 | bar.setProgress( count++ ); |
1369 | qApp->processEvents(); | 1369 | qApp->processEvents(); |
1370 | //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); | 1370 | //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); |
1371 | if ( (*it).birthday().date().isValid() ){ | 1371 | if ( (*it).birthday().date().isValid() ){ |
1372 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; | 1372 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; |
1373 | if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) | 1373 | if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) |
1374 | ++addCount; | 1374 | ++addCount; |
1375 | } | 1375 | } |
1376 | QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); | 1376 | QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); |
1377 | if ( anni.isValid() ){ | 1377 | if ( anni.isValid() ){ |
1378 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; | 1378 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; |
1379 | if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) | 1379 | if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) |
1380 | ++addCount; | 1380 | ++addCount; |
1381 | } | 1381 | } |
1382 | } | 1382 | } |
1383 | updateView(); | 1383 | updateView(); |
1384 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); | 1384 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); |
1385 | #else //DESKTOP_VERSION | 1385 | #else //DESKTOP_VERSION |
1386 | 1386 | ||
1387 | ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); | 1387 | ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); |
1388 | // the result should now arrive through method insertBirthdays | 1388 | // the result should now arrive through method insertBirthdays |
1389 | 1389 | ||
1390 | #endif //DESKTOP_VERSION | 1390 | #endif //DESKTOP_VERSION |
1391 | 1391 | ||
1392 | #endif //KORG_NOKABC | 1392 | #endif //KORG_NOKABC |
1393 | 1393 | ||
1394 | 1394 | ||
1395 | return true; | 1395 | return true; |
1396 | } | 1396 | } |
1397 | 1397 | ||
1398 | // This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI | 1398 | // This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI |
1399 | void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList, | 1399 | void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList, |
1400 | const QStringList& anniversaryList, const QStringList& realNameList, | 1400 | const QStringList& anniversaryList, const QStringList& realNameList, |
1401 | const QStringList& emailList, const QStringList& assembledNameList, | 1401 | const QStringList& emailList, const QStringList& assembledNameList, |
1402 | const QStringList& uidList) | 1402 | const QStringList& uidList) |
1403 | { | 1403 | { |
1404 | qDebug("CalendarView::insertBirthdays"); | 1404 | qDebug("CalendarView::insertBirthdays"); |
1405 | if (uid == this->name()) | 1405 | if (uid == this->name()) |
1406 | { | 1406 | { |
1407 | int count = birthdayList.count(); | 1407 | int count = birthdayList.count(); |
1408 | int addCount = 0; | 1408 | int addCount = 0; |
1409 | KCal::Attendee* a = 0; | 1409 | KCal::Attendee* a = 0; |
1410 | 1410 | ||
1411 | qDebug("CalView 1 %i", count); | 1411 | qDebug("CalView 1 %i", count); |
1412 | 1412 | ||
1413 | QProgressBar bar(count,0 ); | 1413 | QProgressBar bar(count,0 ); |
1414 | int w = 300; | 1414 | int w = 300; |
1415 | if ( QApplication::desktop()->width() < 320 ) | 1415 | if ( QApplication::desktop()->width() < 320 ) |
1416 | w = 220; | 1416 | w = 220; |
1417 | int h = bar.sizeHint().height() ; | 1417 | int h = bar.sizeHint().height() ; |
1418 | int dw = QApplication::desktop()->width(); | 1418 | int dw = QApplication::desktop()->width(); |
1419 | int dh = QApplication::desktop()->height(); | 1419 | int dh = QApplication::desktop()->height(); |
1420 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 1420 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
1421 | bar.show(); | 1421 | bar.show(); |
1422 | bar.setCaption (i18n("inserting birthdays - close to abort!") ); | 1422 | bar.setCaption (i18n("inserting birthdays - close to abort!") ); |
1423 | qApp->processEvents(); | 1423 | qApp->processEvents(); |
1424 | 1424 | ||
1425 | QDate birthday; | 1425 | QDate birthday; |
1426 | QDate anniversary; | 1426 | QDate anniversary; |
1427 | QString realName; | 1427 | QString realName; |
1428 | QString email; | 1428 | QString email; |
1429 | QString assembledName; | 1429 | QString assembledName; |
1430 | QString uid; | 1430 | QString uid; |
1431 | bool ok = true; | 1431 | bool ok = true; |
1432 | for ( int i = 0; i < count; i++) | 1432 | for ( int i = 0; i < count; i++) |
1433 | { | 1433 | { |
1434 | if ( ! bar.isVisible() ) | 1434 | if ( ! bar.isVisible() ) |
1435 | return; | 1435 | return; |
1436 | bar.setProgress( i ); | 1436 | bar.setProgress( i ); |
1437 | qApp->processEvents(); | 1437 | qApp->processEvents(); |
1438 | 1438 | ||
1439 | birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok); | 1439 | birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok); |
1440 | if (!ok) { | 1440 | if (!ok) { |
1441 | ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1()); | 1441 | ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1()); |
1442 | } | 1442 | } |
1443 | 1443 | ||
1444 | anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok); | 1444 | anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok); |
1445 | if (!ok) { | 1445 | if (!ok) { |
1446 | ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1()); | 1446 | ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1()); |
1447 | } | 1447 | } |
1448 | realName = realNameList[i]; | 1448 | realName = realNameList[i]; |
1449 | email = emailList[i]; | 1449 | email = emailList[i]; |
1450 | assembledName = assembledNameList[i]; | 1450 | assembledName = assembledNameList[i]; |
1451 | uid = uidList[i]; | 1451 | uid = uidList[i]; |
1452 | //qDebug("insert birthday in KO/Pi: %s,%s,%s,%s: %s, %s", realName.latin1(), email.latin1(), assembledName.latin1(), uid.latin1(), birthdayList[i].latin1(), anniversaryList[i].latin1() ); | 1452 | //qDebug("insert birthday in KO/Pi: %s,%s,%s,%s: %s, %s", realName.latin1(), email.latin1(), assembledName.latin1(), uid.latin1(), birthdayList[i].latin1(), anniversaryList[i].latin1() ); |
1453 | 1453 | ||
1454 | if ( birthday.isValid() ){ | 1454 | if ( birthday.isValid() ){ |
1455 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, | 1455 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, |
1456 | KCal::Attendee::ReqParticipant,uid) ; | 1456 | KCal::Attendee::ReqParticipant,uid) ; |
1457 | if ( addAnniversary( birthday, assembledName, a, true ) ) | 1457 | if ( addAnniversary( birthday, assembledName, a, true ) ) |
1458 | ++addCount; | 1458 | ++addCount; |
1459 | } | 1459 | } |
1460 | 1460 | ||
1461 | if ( anniversary.isValid() ){ | 1461 | if ( anniversary.isValid() ){ |
1462 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, | 1462 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, |
1463 | KCal::Attendee::ReqParticipant,uid) ; | 1463 | KCal::Attendee::ReqParticipant,uid) ; |
1464 | if ( addAnniversary( anniversary, assembledName, a, false ) ) | 1464 | if ( addAnniversary( anniversary, assembledName, a, false ) ) |
1465 | ++addCount; | 1465 | ++addCount; |
1466 | } | 1466 | } |
1467 | } | 1467 | } |
1468 | 1468 | ||
1469 | updateView(); | 1469 | updateView(); |
1470 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); | 1470 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); |
1471 | 1471 | ||
1472 | } | 1472 | } |
1473 | 1473 | ||
1474 | } | 1474 | } |
1475 | 1475 | ||
1476 | 1476 | ||
1477 | 1477 | ||
1478 | bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) | 1478 | bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) |
1479 | { | 1479 | { |
1480 | //qDebug("addAnni "); | 1480 | //qDebug("addAnni "); |
1481 | Event * ev = new Event(); | 1481 | Event * ev = new Event(); |
1482 | if ( a ) { | 1482 | if ( a ) { |
1483 | ev->addAttendee( a ); | 1483 | ev->addAttendee( a ); |
1484 | } | 1484 | } |
1485 | QString kind; | 1485 | QString kind; |
1486 | if ( birthday ) | 1486 | if ( birthday ) |
1487 | kind = i18n( "Birthday" ); | 1487 | kind = i18n( "Birthday" ); |
1488 | else | 1488 | else |
1489 | kind = i18n( "Anniversary" ); | 1489 | kind = i18n( "Anniversary" ); |
1490 | ev->setSummary( name + " - " + kind ); | 1490 | ev->setSummary( name + " - " + kind ); |
1491 | ev->setOrganizer(a->email()); | 1491 | ev->setOrganizer(a->email()); |
1492 | ev->setCategories( kind ); | 1492 | ev->setCategories( kind ); |
1493 | ev->setDtStart( QDateTime(date) ); | 1493 | ev->setDtStart( QDateTime(date) ); |
1494 | ev->setDtEnd( QDateTime(date) ); | 1494 | ev->setDtEnd( QDateTime(date) ); |
1495 | ev->setFloats( true ); | 1495 | ev->setFloats( true ); |
1496 | Recurrence * rec = ev->recurrence(); | 1496 | Recurrence * rec = ev->recurrence(); |
1497 | rec->setYearly(Recurrence::rYearlyMonth,1,-1); | 1497 | rec->setYearly(Recurrence::rYearlyMonth,1,-1); |
1498 | rec->addYearlyNum( date.month() ); | 1498 | rec->addYearlyNum( date.month() ); |
1499 | if ( !mCalendar->addAnniversaryNoDup( ev ) ) { | 1499 | if ( !mCalendar->addAnniversaryNoDup( ev ) ) { |
1500 | delete ev; | 1500 | delete ev; |
1501 | return false; | 1501 | return false; |
1502 | } | 1502 | } |
1503 | return true; | 1503 | return true; |
1504 | 1504 | ||
1505 | } | 1505 | } |
1506 | bool CalendarView::importQtopia( const QString &categories, | 1506 | bool CalendarView::importQtopia( const QString &categories, |
1507 | const QString &datebook, | 1507 | const QString &datebook, |
1508 | const QString &todolist ) | 1508 | const QString &todolist ) |
1509 | { | 1509 | { |
1510 | 1510 | ||
1511 | QtopiaFormat qtopiaFormat; | 1511 | QtopiaFormat qtopiaFormat; |
1512 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); | 1512 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); |
1513 | if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); | 1513 | if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); |
1514 | if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); | 1514 | if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); |
1515 | if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); | 1515 | if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); |
1516 | 1516 | ||
1517 | updateView(); | 1517 | updateView(); |
1518 | return true; | 1518 | return true; |
1519 | 1519 | ||
1520 | #if 0 | 1520 | #if 0 |
1521 | mGlobalSyncMode = SYNC_MODE_QTOPIA; | 1521 | mGlobalSyncMode = SYNC_MODE_QTOPIA; |
1522 | mCurrentSyncDevice = "qtopia-XML"; | 1522 | mCurrentSyncDevice = "qtopia-XML"; |
1523 | if ( mSyncManager->mAskForPreferences ) | 1523 | if ( mSyncManager->mAskForPreferences ) |
1524 | edit_sync_options(); | 1524 | edit_sync_options(); |
1525 | qApp->processEvents(); | 1525 | qApp->processEvents(); |
1526 | CalendarLocal* calendar = new CalendarLocal(); | 1526 | CalendarLocal* calendar = new CalendarLocal(); |
1527 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 1527 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
1528 | bool syncOK = false; | 1528 | bool syncOK = false; |
1529 | QtopiaFormat qtopiaFormat; | 1529 | QtopiaFormat qtopiaFormat; |
1530 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); | 1530 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); |
1531 | bool loadOk = true; | 1531 | bool loadOk = true; |
1532 | if ( !categories.isEmpty() ) | 1532 | if ( !categories.isEmpty() ) |
1533 | loadOk = qtopiaFormat.load( calendar, categories ); | 1533 | loadOk = qtopiaFormat.load( calendar, categories ); |
1534 | if ( loadOk && !datebook.isEmpty() ) | 1534 | if ( loadOk && !datebook.isEmpty() ) |
1535 | loadOk = qtopiaFormat.load( calendar, datebook ); | 1535 | loadOk = qtopiaFormat.load( calendar, datebook ); |
1536 | if ( loadOk && !todolist.isEmpty() ) | 1536 | if ( loadOk && !todolist.isEmpty() ) |
1537 | loadOk = qtopiaFormat.load( calendar, todolist ); | 1537 | loadOk = qtopiaFormat.load( calendar, todolist ); |
1538 | 1538 | ||
1539 | if ( loadOk ) { | 1539 | if ( loadOk ) { |
1540 | getEventViewerDialog()->setSyncMode( true ); | 1540 | getEventViewerDialog()->setSyncMode( true ); |
1541 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); | 1541 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); |
1542 | getEventViewerDialog()->setSyncMode( false ); | 1542 | getEventViewerDialog()->setSyncMode( false ); |
1543 | qApp->processEvents(); | 1543 | qApp->processEvents(); |
1544 | if ( syncOK ) { | 1544 | if ( syncOK ) { |
1545 | if ( mSyncManager->mWriteBackFile ) | 1545 | if ( mSyncManager->mWriteBackFile ) |
1546 | { | 1546 | { |
1547 | // write back XML file | 1547 | // write back XML file |
1548 | 1548 | ||
1549 | } | 1549 | } |
1550 | setModified( true ); | 1550 | setModified( true ); |
1551 | } | 1551 | } |
1552 | } else { | 1552 | } else { |
1553 | QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; | 1553 | QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; |
1554 | QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), | 1554 | QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), |
1555 | question, i18n("Ok")) ; | 1555 | question, i18n("Ok")) ; |
1556 | } | 1556 | } |
1557 | delete calendar; | 1557 | delete calendar; |
1558 | updateView(); | 1558 | updateView(); |
1559 | return syncOK; | 1559 | return syncOK; |
1560 | 1560 | ||
1561 | 1561 | ||
1562 | #endif | 1562 | #endif |
1563 | 1563 | ||
1564 | } | 1564 | } |
1565 | 1565 | ||
1566 | void CalendarView::setSyncEventsReadOnly() | 1566 | void CalendarView::setSyncEventsReadOnly() |
1567 | { | 1567 | { |
1568 | Event * ev; | 1568 | Event * ev; |
1569 | QPtrList<Event> eL = mCalendar->rawEvents(); | 1569 | QPtrList<Event> eL = mCalendar->rawEvents(); |
1570 | ev = eL.first(); | 1570 | ev = eL.first(); |
1571 | while ( ev ) { | 1571 | while ( ev ) { |
1572 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) | 1572 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) |
1573 | ev->setReadOnly( true ); | 1573 | ev->setReadOnly( true ); |
1574 | ev = eL.next(); | 1574 | ev = eL.next(); |
1575 | } | 1575 | } |
1576 | } | 1576 | } |
1577 | bool CalendarView::openCalendar(QString filename, bool merge) | 1577 | bool CalendarView::openCalendar(QString filename, bool merge) |
1578 | { | 1578 | { |
1579 | 1579 | ||
1580 | if (filename.isEmpty()) { | 1580 | if (filename.isEmpty()) { |
1581 | return false; | 1581 | return false; |
1582 | } | 1582 | } |
1583 | 1583 | ||
1584 | if (!QFile::exists(filename)) { | 1584 | if (!QFile::exists(filename)) { |
1585 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); | 1585 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); |
1586 | return false; | 1586 | return false; |
1587 | } | 1587 | } |
1588 | 1588 | ||
1589 | globalFlagBlockAgenda = 1; | 1589 | globalFlagBlockAgenda = 1; |
1590 | if (!merge) mCalendar->close(); | 1590 | if (!merge) mCalendar->close(); |
1591 | 1591 | ||
1592 | mStorage->setFileName( filename ); | 1592 | mStorage->setFileName( filename ); |
1593 | 1593 | ||
1594 | if ( mStorage->load() ) { | 1594 | if ( mStorage->load() ) { |
1595 | if ( merge ) ;//setModified( true ); | 1595 | if ( merge ) ;//setModified( true ); |
1596 | else { | 1596 | else { |
1597 | //setModified( true ); | 1597 | //setModified( true ); |
1598 | mViewManager->setDocumentId( filename ); | 1598 | mViewManager->setDocumentId( filename ); |
1599 | mDialogManager->setDocumentId( filename ); | 1599 | mDialogManager->setDocumentId( filename ); |
1600 | mTodoList->setDocumentId( filename ); | 1600 | mTodoList->setDocumentId( filename ); |
1601 | } | 1601 | } |
1602 | globalFlagBlockAgenda = 2; | 1602 | globalFlagBlockAgenda = 2; |
1603 | // if ( getLastSyncEvent() ) | 1603 | // if ( getLastSyncEvent() ) |
1604 | // getLastSyncEvent()->setReadOnly( true ); | 1604 | // getLastSyncEvent()->setReadOnly( true ); |
1605 | mCalendar->reInitAlarmSettings(); | 1605 | mCalendar->reInitAlarmSettings(); |
1606 | setSyncEventsReadOnly(); | 1606 | setSyncEventsReadOnly(); |
1607 | updateUnmanagedViews(); | 1607 | updateUnmanagedViews(); |
1608 | updateView(); | 1608 | updateView(); |
1609 | if ( filename != MainWindow::defaultFileName() ) { | 1609 | if ( filename != MainWindow::defaultFileName() ) { |
1610 | saveCalendar( MainWindow::defaultFileName() ); | 1610 | saveCalendar( MainWindow::defaultFileName() ); |
1611 | } else { | 1611 | } else { |
1612 | QFileInfo finf ( MainWindow::defaultFileName()); | 1612 | QFileInfo finf ( MainWindow::defaultFileName()); |
1613 | if ( finf.exists() ) { | 1613 | if ( finf.exists() ) { |
1614 | setLoadedFileVersion( finf.lastModified () ); | 1614 | setLoadedFileVersion( finf.lastModified () ); |
1615 | } | 1615 | } |
1616 | } | 1616 | } |
1617 | return true; | 1617 | return true; |
1618 | } else { | 1618 | } else { |
1619 | // while failing to load, the calendar object could | 1619 | // while failing to load, the calendar object could |
1620 | // have become partially populated. Clear it out. | 1620 | // have become partially populated. Clear it out. |
1621 | if ( !merge ) { | 1621 | if ( !merge ) { |
1622 | mCalendar->close(); | 1622 | mCalendar->close(); |
1623 | mViewManager->setDocumentId( filename ); | 1623 | mViewManager->setDocumentId( filename ); |
1624 | mDialogManager->setDocumentId( filename ); | 1624 | mDialogManager->setDocumentId( filename ); |
1625 | mTodoList->setDocumentId( filename ); | 1625 | mTodoList->setDocumentId( filename ); |
1626 | } | 1626 | } |
1627 | 1627 | ||
1628 | //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); | 1628 | //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); |
1629 | 1629 | ||
1630 | QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); | 1630 | QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); |
1631 | globalFlagBlockAgenda = 2; | 1631 | globalFlagBlockAgenda = 2; |
1632 | mCalendar->reInitAlarmSettings(); | 1632 | mCalendar->reInitAlarmSettings(); |
1633 | setSyncEventsReadOnly(); | 1633 | setSyncEventsReadOnly(); |
1634 | updateUnmanagedViews(); | 1634 | updateUnmanagedViews(); |
1635 | updateView(); | 1635 | updateView(); |
1636 | } | 1636 | } |
1637 | return false; | 1637 | return false; |
1638 | } | 1638 | } |
1639 | void CalendarView::showOpenError() | 1639 | void CalendarView::showOpenError() |
1640 | { | 1640 | { |
1641 | KMessageBox::error(this,i18n("Couldn't load calendar\n.")); | 1641 | KMessageBox::error(this,i18n("Couldn't load calendar\n.")); |
1642 | } | 1642 | } |
1643 | void CalendarView::setLoadedFileVersion(QDateTime dt) | 1643 | void CalendarView::setLoadedFileVersion(QDateTime dt) |
1644 | { | 1644 | { |
1645 | loadedFileVersion = dt; | 1645 | loadedFileVersion = dt; |
1646 | } | 1646 | } |
1647 | bool CalendarView::checkFileChanged(QString fn) | 1647 | bool CalendarView::checkFileChanged(QString fn) |
1648 | { | 1648 | { |
1649 | QFileInfo finf ( fn ); | 1649 | QFileInfo finf ( fn ); |
1650 | if ( !finf.exists() ) | 1650 | if ( !finf.exists() ) |
1651 | return true; | 1651 | return true; |
1652 | QDateTime dt = finf.lastModified (); | 1652 | QDateTime dt = finf.lastModified (); |
1653 | if ( dt <= loadedFileVersion ) | 1653 | if ( dt <= loadedFileVersion ) |
1654 | return false; | 1654 | return false; |
1655 | return true; | 1655 | return true; |
1656 | 1656 | ||
1657 | } | 1657 | } |
1658 | void CalendarView::watchSavedFile() | 1658 | void CalendarView::watchSavedFile() |
1659 | { | 1659 | { |
1660 | QFileInfo finf ( MainWindow::defaultFileName()); | 1660 | QFileInfo finf ( MainWindow::defaultFileName()); |
1661 | if ( !finf.exists() ) | 1661 | if ( !finf.exists() ) |
1662 | return; | 1662 | return; |
1663 | QDateTime dt = finf.lastModified (); | 1663 | QDateTime dt = finf.lastModified (); |
1664 | if ( dt < loadedFileVersion ) { | 1664 | if ( dt < loadedFileVersion ) { |
1665 | //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); | 1665 | //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); |
1666 | QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); | 1666 | QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); |
1667 | return; | 1667 | return; |
1668 | } | 1668 | } |
1669 | loadedFileVersion = dt; | 1669 | loadedFileVersion = dt; |
1670 | } | 1670 | } |
1671 | 1671 | ||
1672 | bool CalendarView::checkFileVersion(QString fn) | 1672 | bool CalendarView::checkFileVersion(QString fn) |
1673 | { | 1673 | { |
1674 | QFileInfo finf ( fn ); | 1674 | QFileInfo finf ( fn ); |
1675 | if ( !finf.exists() ) | 1675 | if ( !finf.exists() ) |
1676 | return true; | 1676 | return true; |
1677 | QDateTime dt = finf.lastModified (); | 1677 | QDateTime dt = finf.lastModified (); |
1678 | //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); | 1678 | //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); |
1679 | //qDebug("file on disk version %s",dt.toString().latin1()); | 1679 | //qDebug("file on disk version %s",dt.toString().latin1()); |
1680 | if ( dt <= loadedFileVersion ) | 1680 | if ( dt <= loadedFileVersion ) |
1681 | return true; | 1681 | return true; |
1682 | int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) , | 1682 | int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) , |
1683 | i18n("KO/Pi Warning"),i18n("Overwrite"), | 1683 | i18n("KO/Pi Warning"),i18n("Overwrite"), |
1684 | i18n("Sync+save")); | 1684 | i18n("Sync+save")); |
1685 | 1685 | ||
1686 | if ( km == KMessageBox::Cancel ) | 1686 | if ( km == KMessageBox::Cancel ) |
1687 | return false; | 1687 | return false; |
1688 | if ( km == KMessageBox::Yes ) | 1688 | if ( km == KMessageBox::Yes ) |
1689 | return true; | 1689 | return true; |
1690 | 1690 | ||
1691 | setSyncDevice("deleteaftersync" ); | 1691 | setSyncDevice("deleteaftersync" ); |
1692 | mSyncManager->mAskForPreferences = true; | 1692 | mSyncManager->mAskForPreferences = true; |
1693 | mSyncManager->mSyncAlgoPrefs = 3; | 1693 | mSyncManager->mSyncAlgoPrefs = 3; |
1694 | mSyncManager->mWriteBackFile = false; | 1694 | mSyncManager->mWriteBackFile = false; |
1695 | mSyncManager->mWriteBackExistingOnly = false; | 1695 | mSyncManager->mWriteBackExistingOnly = false; |
1696 | mSyncManager->mShowSyncSummary = false; | 1696 | mSyncManager->mShowSyncSummary = false; |
1697 | syncCalendar( fn, 3 ); | 1697 | syncCalendar( fn, 3 ); |
1698 | Event * e = getLastSyncEvent(); | 1698 | Event * e = getLastSyncEvent(); |
1699 | mCalendar->deleteEvent ( e ); | 1699 | mCalendar->deleteEvent ( e ); |
1700 | updateView(); | 1700 | updateView(); |
1701 | return true; | 1701 | return true; |
1702 | } | 1702 | } |
1703 | 1703 | ||
1704 | bool CalendarView::saveCalendar( QString filename ) | 1704 | bool CalendarView::saveCalendar( QString filename ) |
1705 | { | 1705 | { |
1706 | 1706 | ||
1707 | // Store back all unsaved data into calendar object | 1707 | // Store back all unsaved data into calendar object |
1708 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); | 1708 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); |
1709 | if ( mViewManager->currentView() ) | 1709 | if ( mViewManager->currentView() ) |
1710 | mViewManager->currentView()->flushView(); | 1710 | mViewManager->currentView()->flushView(); |
1711 | 1711 | ||
1712 | 1712 | ||
1713 | QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); | 1713 | QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); |
1714 | mStorage->setSaveFormat( new ICalFormat() ); | 1714 | mStorage->setSaveFormat( new ICalFormat() ); |
1715 | mStorage->setFileName( filename ); | 1715 | mStorage->setFileName( filename ); |
1716 | bool success; | 1716 | bool success; |
1717 | success = mStorage->save(); | 1717 | success = mStorage->save(); |
1718 | if ( !success ) { | 1718 | if ( !success ) { |
1719 | return false; | 1719 | return false; |
1720 | } | 1720 | } |
1721 | if ( filename == MainWindow::defaultFileName() ) { | 1721 | if ( filename == MainWindow::defaultFileName() ) { |
1722 | setLoadedFileVersion( lfv ); | 1722 | setLoadedFileVersion( lfv ); |
1723 | watchSavedFile(); | 1723 | watchSavedFile(); |
1724 | } | 1724 | } |
1725 | return true; | 1725 | return true; |
1726 | } | 1726 | } |
1727 | 1727 | ||
1728 | void CalendarView::closeCalendar() | 1728 | void CalendarView::closeCalendar() |
1729 | { | 1729 | { |
1730 | 1730 | ||
1731 | // child windows no longer valid | 1731 | // child windows no longer valid |
1732 | emit closingDown(); | 1732 | emit closingDown(); |
1733 | 1733 | ||
1734 | mCalendar->close(); | 1734 | mCalendar->close(); |
1735 | setModified(false); | 1735 | setModified(false); |
1736 | updateView(); | 1736 | updateView(); |
1737 | } | 1737 | } |
1738 | 1738 | ||
1739 | void CalendarView::archiveCalendar() | 1739 | void CalendarView::archiveCalendar() |
1740 | { | 1740 | { |
1741 | mDialogManager->showArchiveDialog(); | 1741 | mDialogManager->showArchiveDialog(); |
1742 | } | 1742 | } |
1743 | 1743 | ||
1744 | 1744 | ||
1745 | void CalendarView::readSettings() | 1745 | void CalendarView::readSettings() |
1746 | { | 1746 | { |
1747 | 1747 | ||
1748 | 1748 | ||
1749 | // mViewManager->showAgendaView(); | 1749 | // mViewManager->showAgendaView(); |
1750 | QString str; | 1750 | QString str; |
1751 | //qDebug("CalendarView::readSettings() "); | 1751 | //qDebug("CalendarView::readSettings() "); |
1752 | // read settings from the KConfig, supplying reasonable | 1752 | // read settings from the KConfig, supplying reasonable |
1753 | // defaults where none are to be found | 1753 | // defaults where none are to be found |
1754 | KConfig *config = KOGlobals::config(); | 1754 | KConfig *config = KOGlobals::config(); |
1755 | #ifndef KORG_NOSPLITTER | 1755 | #ifndef KORG_NOSPLITTER |
1756 | config->setGroup("KOrganizer Geometry"); | 1756 | config->setGroup("KOrganizer Geometry"); |
1757 | 1757 | ||
1758 | QValueList<int> sizes = config->readIntListEntry("Separator1"); | 1758 | QValueList<int> sizes = config->readIntListEntry("Separator1"); |
1759 | if (sizes.count() != 2) { | 1759 | if (sizes.count() != 2) { |
1760 | sizes << mDateNavigator->minimumSizeHint().width(); | 1760 | sizes << mDateNavigator->minimumSizeHint().width(); |
1761 | sizes << 300; | 1761 | sizes << 300; |
1762 | } | 1762 | } |
1763 | mPanner->setSizes(sizes); | 1763 | mPanner->setSizes(sizes); |
1764 | 1764 | ||
1765 | sizes = config->readIntListEntry("Separator2"); | 1765 | sizes = config->readIntListEntry("Separator2"); |
1766 | if ( ( mResourceView && sizes.count() == 4 ) || | 1766 | if ( ( mResourceView && sizes.count() == 4 ) || |
1767 | ( !mResourceView && sizes.count() == 3 ) ) { | 1767 | ( !mResourceView && sizes.count() == 3 ) ) { |
1768 | mLeftSplitter->setSizes(sizes); | 1768 | mLeftSplitter->setSizes(sizes); |
1769 | } | 1769 | } |
1770 | #endif | 1770 | #endif |
1771 | globalFlagBlockAgenda = 1; | 1771 | globalFlagBlockAgenda = 1; |
1772 | mViewManager->showAgendaView(); | 1772 | mViewManager->showAgendaView(); |
1773 | //mViewManager->readSettings( config ); | 1773 | //mViewManager->readSettings( config ); |
1774 | mTodoList->restoreLayout(config,QString("Todo Layout")); | 1774 | mTodoList->restoreLayout(config,QString("Todo Layout")); |
1775 | readFilterSettings(config); | 1775 | readFilterSettings(config); |
1776 | config->setGroup( "Views" ); | 1776 | config->setGroup( "Views" ); |
1777 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); | 1777 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); |
1778 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); | 1778 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); |
1779 | else if ( dateCount == 7 ) mNavigator->selectWeek(); | 1779 | else if ( dateCount == 7 ) mNavigator->selectWeek(); |
1780 | else mNavigator->selectDates( dateCount ); | 1780 | else mNavigator->selectDates( dateCount ); |
1781 | // mViewManager->readSettings( config ); | 1781 | // mViewManager->readSettings( config ); |
1782 | updateConfig(); | 1782 | updateConfig(); |
1783 | globalFlagBlockAgenda = 2; | 1783 | globalFlagBlockAgenda = 2; |
1784 | mViewManager->readSettings( config ); | 1784 | mViewManager->readSettings( config ); |
1785 | #ifdef DESKTOP_VERSION | 1785 | #ifdef DESKTOP_VERSION |
1786 | config->setGroup("WidgetLayout"); | 1786 | config->setGroup("WidgetLayout"); |
1787 | QStringList list; | 1787 | QStringList list; |
1788 | list = config->readListEntry("MainLayout"); | 1788 | list = config->readListEntry("MainLayout"); |
1789 | int x,y,w,h; | 1789 | int x,y,w,h; |
1790 | if ( ! list.isEmpty() ) { | 1790 | if ( ! list.isEmpty() ) { |
1791 | x = list[0].toInt(); | 1791 | x = list[0].toInt(); |
1792 | y = list[1].toInt(); | 1792 | y = list[1].toInt(); |
1793 | w = list[2].toInt(); | 1793 | w = list[2].toInt(); |
1794 | h = list[3].toInt(); | 1794 | h = list[3].toInt(); |
1795 | topLevelWidget()->setGeometry(x,y,w,h); | 1795 | topLevelWidget()->setGeometry(x,y,w,h); |
1796 | 1796 | ||
1797 | } else { | 1797 | } else { |
1798 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); | 1798 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); |
1799 | } | 1799 | } |
1800 | list = config->readListEntry("EditEventLayout"); | 1800 | list = config->readListEntry("EditEventLayout"); |
1801 | if ( ! list.isEmpty() ) { | 1801 | if ( ! list.isEmpty() ) { |
1802 | x = list[0].toInt(); | 1802 | x = list[0].toInt(); |
1803 | y = list[1].toInt(); | 1803 | y = list[1].toInt(); |
1804 | w = list[2].toInt(); | 1804 | w = list[2].toInt(); |
1805 | h = list[3].toInt(); | 1805 | h = list[3].toInt(); |
1806 | mEventEditor->setGeometry(x,y,w,h); | 1806 | mEventEditor->setGeometry(x,y,w,h); |
1807 | 1807 | ||
1808 | } | 1808 | } |
1809 | list = config->readListEntry("EditTodoLayout"); | 1809 | list = config->readListEntry("EditTodoLayout"); |
1810 | if ( ! list.isEmpty() ) { | 1810 | if ( ! list.isEmpty() ) { |
1811 | x = list[0].toInt(); | 1811 | x = list[0].toInt(); |
1812 | y = list[1].toInt(); | 1812 | y = list[1].toInt(); |
1813 | w = list[2].toInt(); | 1813 | w = list[2].toInt(); |
1814 | h = list[3].toInt(); | 1814 | h = list[3].toInt(); |
1815 | mTodoEditor->setGeometry(x,y,w,h); | 1815 | mTodoEditor->setGeometry(x,y,w,h); |
1816 | 1816 | ||
1817 | } | 1817 | } |
1818 | list = config->readListEntry("ViewerLayout"); | 1818 | list = config->readListEntry("ViewerLayout"); |
1819 | if ( ! list.isEmpty() ) { | 1819 | if ( ! list.isEmpty() ) { |
1820 | x = list[0].toInt(); | 1820 | x = list[0].toInt(); |
1821 | y = list[1].toInt(); | 1821 | y = list[1].toInt(); |
1822 | w = list[2].toInt(); | 1822 | w = list[2].toInt(); |
1823 | h = list[3].toInt(); | 1823 | h = list[3].toInt(); |
1824 | getEventViewerDialog()->setGeometry(x,y,w,h); | 1824 | getEventViewerDialog()->setGeometry(x,y,w,h); |
1825 | } | 1825 | } |
1826 | #endif | 1826 | #endif |
1827 | 1827 | ||
1828 | } | 1828 | } |
1829 | 1829 | ||
1830 | 1830 | ||
1831 | void CalendarView::writeSettings() | 1831 | void CalendarView::writeSettings() |
1832 | { | 1832 | { |
1833 | // kdDebug() << "CalendarView::writeSettings" << endl; | 1833 | // kdDebug() << "CalendarView::writeSettings" << endl; |
1834 | 1834 | ||
1835 | KConfig *config = KOGlobals::config(); | 1835 | KConfig *config = KOGlobals::config(); |
1836 | 1836 | ||
1837 | #ifndef KORG_NOSPLITTER | 1837 | #ifndef KORG_NOSPLITTER |
1838 | config->setGroup("KOrganizer Geometry"); | 1838 | config->setGroup("KOrganizer Geometry"); |
1839 | 1839 | ||
1840 | QValueList<int> list = mPanner->sizes(); | 1840 | QValueList<int> list = mPanner->sizes(); |
1841 | config->writeEntry("Separator1",list); | 1841 | config->writeEntry("Separator1",list); |
1842 | 1842 | ||
1843 | list = mLeftSplitter->sizes(); | 1843 | list = mLeftSplitter->sizes(); |
1844 | config->writeEntry("Separator2",list); | 1844 | config->writeEntry("Separator2",list); |
1845 | #endif | 1845 | #endif |
1846 | 1846 | ||
1847 | mViewManager->writeSettings( config ); | 1847 | mViewManager->writeSettings( config ); |
1848 | mTodoList->saveLayout(config,QString("Todo Layout")); | 1848 | mTodoList->saveLayout(config,QString("Todo Layout")); |
1849 | mDialogManager->writeSettings( config ); | 1849 | mDialogManager->writeSettings( config ); |
1850 | //KOPrefs::instance()->usrWriteConfig(); | 1850 | //KOPrefs::instance()->usrWriteConfig(); |
1851 | KOPrefs::instance()->writeConfig(); | 1851 | KOPrefs::instance()->writeConfig(); |
1852 | 1852 | ||
1853 | writeFilterSettings(config); | 1853 | writeFilterSettings(config); |
1854 | 1854 | ||
1855 | config->setGroup( "Views" ); | 1855 | config->setGroup( "Views" ); |
1856 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); | 1856 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); |
1857 | 1857 | ||
1858 | #ifdef DESKTOP_VERSION | 1858 | #ifdef DESKTOP_VERSION |
1859 | config->setGroup("WidgetLayout"); | 1859 | config->setGroup("WidgetLayout"); |
1860 | QStringList list ;//= config->readListEntry("MainLayout"); | 1860 | QStringList list ;//= config->readListEntry("MainLayout"); |
1861 | int x,y,w,h; | 1861 | int x,y,w,h; |
1862 | QWidget* wid; | 1862 | QWidget* wid; |
1863 | wid = topLevelWidget(); | 1863 | wid = topLevelWidget(); |
1864 | x = wid->geometry().x(); | 1864 | x = wid->geometry().x(); |
1865 | y = wid->geometry().y(); | 1865 | y = wid->geometry().y(); |
1866 | w = wid->width(); | 1866 | w = wid->width(); |
1867 | h = wid->height(); | 1867 | h = wid->height(); |
1868 | list.clear(); | 1868 | list.clear(); |
1869 | list << QString::number( x ); | 1869 | list << QString::number( x ); |
1870 | list << QString::number( y ); | 1870 | list << QString::number( y ); |
1871 | list << QString::number( w ); | 1871 | list << QString::number( w ); |
1872 | list << QString::number( h ); | 1872 | list << QString::number( h ); |
1873 | config->writeEntry("MainLayout",list ); | 1873 | config->writeEntry("MainLayout",list ); |
1874 | 1874 | ||
1875 | wid = mEventEditor; | 1875 | wid = mEventEditor; |
1876 | x = wid->geometry().x(); | 1876 | x = wid->geometry().x(); |
1877 | y = wid->geometry().y(); | 1877 | y = wid->geometry().y(); |
1878 | w = wid->width(); | 1878 | w = wid->width(); |
1879 | h = wid->height(); | 1879 | h = wid->height(); |
1880 | list.clear(); | 1880 | list.clear(); |
1881 | list << QString::number( x ); | 1881 | list << QString::number( x ); |
1882 | list << QString::number( y ); | 1882 | list << QString::number( y ); |
1883 | list << QString::number( w ); | 1883 | list << QString::number( w ); |
1884 | list << QString::number( h ); | 1884 | list << QString::number( h ); |
1885 | config->writeEntry("EditEventLayout",list ); | 1885 | config->writeEntry("EditEventLayout",list ); |
1886 | 1886 | ||
1887 | wid = mTodoEditor; | 1887 | wid = mTodoEditor; |
1888 | x = wid->geometry().x(); | 1888 | x = wid->geometry().x(); |
1889 | y = wid->geometry().y(); | 1889 | y = wid->geometry().y(); |
1890 | w = wid->width(); | 1890 | w = wid->width(); |
1891 | h = wid->height(); | 1891 | h = wid->height(); |
1892 | list.clear(); | 1892 | list.clear(); |
1893 | list << QString::number( x ); | 1893 | list << QString::number( x ); |
1894 | list << QString::number( y ); | 1894 | list << QString::number( y ); |
1895 | list << QString::number( w ); | 1895 | list << QString::number( w ); |
1896 | list << QString::number( h ); | 1896 | list << QString::number( h ); |
1897 | config->writeEntry("EditTodoLayout",list ); | 1897 | config->writeEntry("EditTodoLayout",list ); |
1898 | wid = getEventViewerDialog(); | 1898 | wid = getEventViewerDialog(); |
1899 | x = wid->geometry().x(); | 1899 | x = wid->geometry().x(); |
1900 | y = wid->geometry().y(); | 1900 | y = wid->geometry().y(); |
1901 | w = wid->width(); | 1901 | w = wid->width(); |
1902 | h = wid->height(); | 1902 | h = wid->height(); |
1903 | list.clear(); | 1903 | list.clear(); |
1904 | list << QString::number( x ); | 1904 | list << QString::number( x ); |
1905 | list << QString::number( y ); | 1905 | list << QString::number( y ); |
1906 | list << QString::number( w ); | 1906 | list << QString::number( w ); |
1907 | list << QString::number( h ); | 1907 | list << QString::number( h ); |
1908 | config->writeEntry("ViewerLayout",list ); | 1908 | config->writeEntry("ViewerLayout",list ); |
1909 | wid = mDialogManager->getSearchDialog(); | 1909 | wid = mDialogManager->getSearchDialog(); |
1910 | if ( wid ) { | 1910 | if ( wid ) { |
1911 | x = wid->geometry().x(); | 1911 | x = wid->geometry().x(); |
1912 | y = wid->geometry().y(); | 1912 | y = wid->geometry().y(); |
1913 | w = wid->width(); | 1913 | w = wid->width(); |
1914 | h = wid->height(); | 1914 | h = wid->height(); |
1915 | list.clear(); | 1915 | list.clear(); |
1916 | list << QString::number( x ); | 1916 | list << QString::number( x ); |
1917 | list << QString::number( y ); | 1917 | list << QString::number( y ); |
1918 | list << QString::number( w ); | 1918 | list << QString::number( w ); |
1919 | list << QString::number( h ); | 1919 | list << QString::number( h ); |
1920 | config->writeEntry("SearchLayout",list ); | 1920 | config->writeEntry("SearchLayout",list ); |
1921 | } | 1921 | } |
1922 | #endif | 1922 | #endif |
1923 | 1923 | ||
1924 | 1924 | ||
1925 | config->sync(); | 1925 | config->sync(); |
1926 | } | 1926 | } |
1927 | 1927 | ||
1928 | void CalendarView::readFilterSettings(KConfig *config) | 1928 | void CalendarView::readFilterSettings(KConfig *config) |
1929 | { | 1929 | { |
1930 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; | 1930 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; |
1931 | 1931 | ||
1932 | mFilters.clear(); | 1932 | mFilters.clear(); |
1933 | 1933 | ||
1934 | config->setGroup("General"); | 1934 | config->setGroup("General"); |
1935 | QStringList filterList = config->readListEntry("CalendarFilters"); | 1935 | QStringList filterList = config->readListEntry("CalendarFilters"); |
1936 | 1936 | ||
1937 | QStringList::ConstIterator it = filterList.begin(); | 1937 | QStringList::ConstIterator it = filterList.begin(); |
1938 | QStringList::ConstIterator end = filterList.end(); | 1938 | QStringList::ConstIterator end = filterList.end(); |
1939 | while(it != end) { | 1939 | while(it != end) { |
1940 | // kdDebug() << " filter: " << (*it) << endl; | 1940 | // kdDebug() << " filter: " << (*it) << endl; |
1941 | 1941 | ||
1942 | CalFilter *filter; | 1942 | CalFilter *filter; |
1943 | filter = new CalFilter(*it); | 1943 | filter = new CalFilter(*it); |
1944 | config->setGroup("Filter_" + (*it)); | 1944 | config->setGroup("Filter_" + (*it)); |
1945 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); | 1945 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); |
1946 | filter->setCriteria(config->readNumEntry("Criteria",0)); | 1946 | filter->setCriteria(config->readNumEntry("Criteria",0)); |
1947 | filter->setCategoryList(config->readListEntry("CategoryList")); | 1947 | filter->setCategoryList(config->readListEntry("CategoryList")); |
1948 | mFilters.append(filter); | 1948 | mFilters.append(filter); |
1949 | 1949 | ||
1950 | ++it; | 1950 | ++it; |
1951 | } | 1951 | } |
1952 | 1952 | ||
1953 | if (mFilters.count() == 0) { | 1953 | if (mFilters.count() == 0) { |
1954 | CalFilter *filter = new CalFilter(i18n("Default")); | 1954 | CalFilter *filter = new CalFilter(i18n("Default")); |
1955 | mFilters.append(filter); | 1955 | mFilters.append(filter); |
1956 | } | 1956 | } |
1957 | mFilterView->updateFilters(); | 1957 | mFilterView->updateFilters(); |
1958 | config->setGroup("FilterView"); | 1958 | config->setGroup("FilterView"); |
1959 | 1959 | ||
1960 | mFilterView->blockSignals(true); | 1960 | mFilterView->blockSignals(true); |
1961 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); | 1961 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); |
1962 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); | 1962 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); |
1963 | mFilterView->blockSignals(false); | 1963 | mFilterView->blockSignals(false); |
1964 | // We do it manually to avoid it being done twice by the above calls | 1964 | // We do it manually to avoid it being done twice by the above calls |
1965 | updateFilter(); | 1965 | updateFilter(); |
1966 | } | 1966 | } |
1967 | 1967 | ||
1968 | void CalendarView::writeFilterSettings(KConfig *config) | 1968 | void CalendarView::writeFilterSettings(KConfig *config) |
1969 | { | 1969 | { |
1970 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; | 1970 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; |
1971 | 1971 | ||
1972 | QStringList filterList; | 1972 | QStringList filterList; |
1973 | 1973 | ||
1974 | CalFilter *filter = mFilters.first(); | 1974 | CalFilter *filter = mFilters.first(); |
1975 | while(filter) { | 1975 | while(filter) { |
1976 | // kdDebug() << " fn: " << filter->name() << endl; | 1976 | // kdDebug() << " fn: " << filter->name() << endl; |
1977 | filterList << filter->name(); | 1977 | filterList << filter->name(); |
1978 | config->setGroup("Filter_" + filter->name()); | 1978 | config->setGroup("Filter_" + filter->name()); |
1979 | config->writeEntry("Criteria",filter->criteria()); | 1979 | config->writeEntry("Criteria",filter->criteria()); |
1980 | config->writeEntry("CategoryList",filter->categoryList()); | 1980 | config->writeEntry("CategoryList",filter->categoryList()); |
1981 | filter = mFilters.next(); | 1981 | filter = mFilters.next(); |
1982 | } | 1982 | } |
1983 | config->setGroup("General"); | 1983 | config->setGroup("General"); |
1984 | config->writeEntry("CalendarFilters",filterList); | 1984 | config->writeEntry("CalendarFilters",filterList); |
1985 | 1985 | ||
1986 | config->setGroup("FilterView"); | 1986 | config->setGroup("FilterView"); |
1987 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); | 1987 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); |
1988 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); | 1988 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); |
1989 | } | 1989 | } |
1990 | 1990 | ||
1991 | 1991 | ||
1992 | void CalendarView::goToday() | 1992 | void CalendarView::goToday() |
1993 | { | 1993 | { |
1994 | mNavigator->selectToday(); | 1994 | if ( mViewManager->currentView()->isMonthView() ) |
1995 | mNavigator->selectTodayMonth(); | ||
1996 | else | ||
1997 | mNavigator->selectToday(); | ||
1995 | } | 1998 | } |
1996 | 1999 | ||
1997 | void CalendarView::goNext() | 2000 | void CalendarView::goNext() |
1998 | { | 2001 | { |
1999 | mNavigator->selectNext(); | 2002 | mNavigator->selectNext(); |
2000 | } | 2003 | } |
2001 | 2004 | ||
2002 | void CalendarView::goPrevious() | 2005 | void CalendarView::goPrevious() |
2003 | { | 2006 | { |
2004 | mNavigator->selectPrevious(); | 2007 | mNavigator->selectPrevious(); |
2005 | } | 2008 | } |
2006 | void CalendarView::goNextMonth() | 2009 | void CalendarView::goNextMonth() |
2007 | { | 2010 | { |
2008 | mNavigator->selectNextMonth(); | 2011 | mNavigator->selectNextMonth(); |
2009 | } | 2012 | } |
2010 | 2013 | ||
2011 | void CalendarView::goPreviousMonth() | 2014 | void CalendarView::goPreviousMonth() |
2012 | { | 2015 | { |
2013 | mNavigator->selectPreviousMonth(); | 2016 | mNavigator->selectPreviousMonth(); |
2014 | } | 2017 | } |
2015 | void CalendarView::writeLocale() | 2018 | void CalendarView::writeLocale() |
2016 | { | 2019 | { |
2017 | //KPimGlobalPrefs::instance()->setGlobalConfig(); | 2020 | //KPimGlobalPrefs::instance()->setGlobalConfig(); |
2018 | #if 0 | 2021 | #if 0 |
2019 | KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); | 2022 | KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); |
2020 | KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); | 2023 | KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); |
2021 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); | 2024 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); |
2022 | KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); | 2025 | KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); |
2023 | QString dummy = KOPrefs::instance()->mUserDateFormatLong; | 2026 | QString dummy = KOPrefs::instance()->mUserDateFormatLong; |
2024 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); | 2027 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); |
2025 | dummy = KOPrefs::instance()->mUserDateFormatShort; | 2028 | dummy = KOPrefs::instance()->mUserDateFormatShort; |
2026 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); | 2029 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); |
2027 | KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, | 2030 | KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, |
2028 | KOPrefs::instance()->mDaylightsavingStart, | 2031 | KOPrefs::instance()->mDaylightsavingStart, |
2029 | KOPrefs::instance()->mDaylightsavingEnd ); | 2032 | KOPrefs::instance()->mDaylightsavingEnd ); |
2030 | KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId ); | 2033 | KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId ); |
2031 | #endif | 2034 | #endif |
2032 | } | 2035 | } |
2033 | void CalendarView::updateConfig() | 2036 | void CalendarView::updateConfig() |
2034 | { | 2037 | { |
2035 | writeLocale(); | 2038 | writeLocale(); |
2036 | if ( KOPrefs::instance()->mUseAppColors ) | 2039 | if ( KOPrefs::instance()->mUseAppColors ) |
2037 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 2040 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
2038 | emit configChanged(); | 2041 | emit configChanged(); |
2039 | mTodoList->updateConfig(); | 2042 | mTodoList->updateConfig(); |
2040 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); | 2043 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); |
2041 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2044 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2042 | // To make the "fill window" configurations work | 2045 | // To make the "fill window" configurations work |
2043 | //mViewManager->raiseCurrentView(); | 2046 | //mViewManager->raiseCurrentView(); |
2044 | } | 2047 | } |
2045 | 2048 | ||
2046 | 2049 | ||
2047 | void CalendarView::eventChanged(Event *event) | 2050 | void CalendarView::eventChanged(Event *event) |
2048 | { | 2051 | { |
2049 | changeEventDisplay(event,KOGlobals::EVENTEDITED); | 2052 | changeEventDisplay(event,KOGlobals::EVENTEDITED); |
2050 | //updateUnmanagedViews(); | 2053 | //updateUnmanagedViews(); |
2051 | } | 2054 | } |
2052 | 2055 | ||
2053 | void CalendarView::eventAdded(Event *event) | 2056 | void CalendarView::eventAdded(Event *event) |
2054 | { | 2057 | { |
2055 | changeEventDisplay(event,KOGlobals::EVENTADDED); | 2058 | changeEventDisplay(event,KOGlobals::EVENTADDED); |
2056 | } | 2059 | } |
2057 | 2060 | ||
2058 | void CalendarView::eventToBeDeleted(Event *) | 2061 | void CalendarView::eventToBeDeleted(Event *) |
2059 | { | 2062 | { |
2060 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; | 2063 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; |
2061 | } | 2064 | } |
2062 | 2065 | ||
2063 | void CalendarView::eventDeleted() | 2066 | void CalendarView::eventDeleted() |
2064 | { | 2067 | { |
2065 | changeEventDisplay(0,KOGlobals::EVENTDELETED); | 2068 | changeEventDisplay(0,KOGlobals::EVENTDELETED); |
2066 | } | 2069 | } |
2067 | void CalendarView::changeTodoDisplay(Todo *which, int action) | 2070 | void CalendarView::changeTodoDisplay(Todo *which, int action) |
2068 | { | 2071 | { |
2069 | changeIncidenceDisplay((Incidence *)which, action); | 2072 | changeIncidenceDisplay((Incidence *)which, action); |
2070 | mDateNavigator->updateView(); //LR | 2073 | mDateNavigator->updateView(); //LR |
2071 | //mDialogManager->updateSearchDialog(); | 2074 | //mDialogManager->updateSearchDialog(); |
2072 | 2075 | ||
2073 | if (which) { | 2076 | if (which) { |
2074 | mViewManager->updateWNview(); | 2077 | mViewManager->updateWNview(); |
2075 | //mTodoList->updateView(); | 2078 | //mTodoList->updateView(); |
2076 | } | 2079 | } |
2077 | 2080 | ||
2078 | } | 2081 | } |
2079 | 2082 | ||
2080 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) | 2083 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) |
2081 | { | 2084 | { |
2082 | updateUnmanagedViews(); | 2085 | updateUnmanagedViews(); |
2083 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); | 2086 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); |
2084 | if ( action == KOGlobals::EVENTDELETED ) { //delete | 2087 | if ( action == KOGlobals::EVENTDELETED ) { //delete |
2085 | mCalendar->checkAlarmForIncidence( 0, true ); | 2088 | mCalendar->checkAlarmForIncidence( 0, true ); |
2086 | if ( mEventViewerDialog ) | 2089 | if ( mEventViewerDialog ) |
2087 | mEventViewerDialog->hide(); | 2090 | mEventViewerDialog->hide(); |
2088 | } | 2091 | } |
2089 | else | 2092 | else |
2090 | mCalendar->checkAlarmForIncidence( which , false ); | 2093 | mCalendar->checkAlarmForIncidence( which , false ); |
2091 | } | 2094 | } |
2092 | 2095 | ||
2093 | // most of the changeEventDisplays() right now just call the view's | 2096 | // most of the changeEventDisplays() right now just call the view's |
2094 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. | 2097 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. |
2095 | void CalendarView::changeEventDisplay(Event *which, int action) | 2098 | void CalendarView::changeEventDisplay(Event *which, int action) |
2096 | { | 2099 | { |
2097 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; | 2100 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; |
2098 | changeIncidenceDisplay((Incidence *)which, action); | 2101 | changeIncidenceDisplay((Incidence *)which, action); |
2099 | mDateNavigator->updateView(); | 2102 | mDateNavigator->updateView(); |
2100 | //mDialogManager->updateSearchDialog(); | 2103 | //mDialogManager->updateSearchDialog(); |
2101 | 2104 | ||
2102 | if (which) { | 2105 | if (which) { |
2103 | // If there is an event view visible update the display | 2106 | // If there is an event view visible update the display |
2104 | mViewManager->currentView()->changeEventDisplay(which,action); | 2107 | mViewManager->currentView()->changeEventDisplay(which,action); |
2105 | // TODO: check, if update needed | 2108 | // TODO: check, if update needed |
2106 | // if (which->getTodoStatus()) { | 2109 | // if (which->getTodoStatus()) { |
2107 | mTodoList->updateView(); | 2110 | mTodoList->updateView(); |
2108 | // } | 2111 | // } |
2109 | } else { | 2112 | } else { |
2110 | mViewManager->currentView()->updateView(); | 2113 | mViewManager->currentView()->updateView(); |
2111 | } | 2114 | } |
2112 | } | 2115 | } |
2113 | 2116 | ||
2114 | 2117 | ||
2115 | void CalendarView::updateTodoViews() | 2118 | void CalendarView::updateTodoViews() |
2116 | { | 2119 | { |
2117 | 2120 | ||
2118 | mTodoList->updateView(); | 2121 | mTodoList->updateView(); |
2119 | mViewManager->currentView()->updateView(); | 2122 | mViewManager->currentView()->updateView(); |
2120 | 2123 | ||
2121 | } | 2124 | } |
2122 | 2125 | ||
2123 | 2126 | ||
2124 | void CalendarView::updateView(const QDate &start, const QDate &end) | 2127 | void CalendarView::updateView(const QDate &start, const QDate &end) |
2125 | { | 2128 | { |
2126 | mTodoList->updateView(); | 2129 | mTodoList->updateView(); |
2127 | mViewManager->updateView(start, end); | 2130 | mViewManager->updateView(start, end); |
2128 | //mDateNavigator->updateView(); | 2131 | //mDateNavigator->updateView(); |
2129 | } | 2132 | } |
2130 | 2133 | ||
2131 | void CalendarView::updateView() | 2134 | void CalendarView::updateView() |
2132 | { | 2135 | { |
2133 | DateList tmpList = mNavigator->selectedDates(); | 2136 | DateList tmpList = mNavigator->selectedDates(); |
2134 | 2137 | ||
2135 | // We assume that the navigator only selects consecutive days. | 2138 | // We assume that the navigator only selects consecutive days. |
2136 | updateView( tmpList.first(), tmpList.last() ); | 2139 | updateView( tmpList.first(), tmpList.last() ); |
2137 | } | 2140 | } |
2138 | 2141 | ||
2139 | void CalendarView::updateUnmanagedViews() | 2142 | void CalendarView::updateUnmanagedViews() |
2140 | { | 2143 | { |
2141 | mDateNavigator->updateDayMatrix(); | 2144 | mDateNavigator->updateDayMatrix(); |
2142 | } | 2145 | } |
2143 | 2146 | ||
2144 | int CalendarView::msgItemDelete() | 2147 | int CalendarView::msgItemDelete() |
2145 | { | 2148 | { |
2146 | return KMessageBox::warningContinueCancel(this, | 2149 | return KMessageBox::warningContinueCancel(this, |
2147 | i18n("This item will be\npermanently deleted."), | 2150 | i18n("This item will be\npermanently deleted."), |
2148 | i18n("KO/Pi Confirmation"),i18n("Delete")); | 2151 | i18n("KO/Pi Confirmation"),i18n("Delete")); |
2149 | } | 2152 | } |
2150 | 2153 | ||
2151 | 2154 | ||
2152 | void CalendarView::edit_cut() | 2155 | void CalendarView::edit_cut() |
2153 | { | 2156 | { |
2154 | Event *anEvent=0; | 2157 | Event *anEvent=0; |
2155 | 2158 | ||
2156 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2159 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2157 | 2160 | ||
2158 | if (mViewManager->currentView()->isEventView()) { | 2161 | if (mViewManager->currentView()->isEventView()) { |
2159 | if ( incidence && incidence->type() == "Event" ) { | 2162 | if ( incidence && incidence->type() == "Event" ) { |
2160 | anEvent = static_cast<Event *>(incidence); | 2163 | anEvent = static_cast<Event *>(incidence); |
2161 | } | 2164 | } |
2162 | } | 2165 | } |
2163 | 2166 | ||
2164 | if (!anEvent) { | 2167 | if (!anEvent) { |
2165 | KNotifyClient::beep(); | 2168 | KNotifyClient::beep(); |
2166 | return; | 2169 | return; |
2167 | } | 2170 | } |
2168 | DndFactory factory( mCalendar ); | 2171 | DndFactory factory( mCalendar ); |
2169 | factory.cutEvent(anEvent); | 2172 | factory.cutEvent(anEvent); |
2170 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 2173 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
2171 | } | 2174 | } |
2172 | 2175 | ||
2173 | void CalendarView::edit_copy() | 2176 | void CalendarView::edit_copy() |
2174 | { | 2177 | { |
2175 | Event *anEvent=0; | 2178 | Event *anEvent=0; |
2176 | 2179 | ||
2177 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2180 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2178 | 2181 | ||
2179 | if (mViewManager->currentView()->isEventView()) { | 2182 | if (mViewManager->currentView()->isEventView()) { |
2180 | if ( incidence && incidence->type() == "Event" ) { | 2183 | if ( incidence && incidence->type() == "Event" ) { |
2181 | anEvent = static_cast<Event *>(incidence); | 2184 | anEvent = static_cast<Event *>(incidence); |
2182 | } | 2185 | } |
2183 | } | 2186 | } |
2184 | 2187 | ||
2185 | if (!anEvent) { | 2188 | if (!anEvent) { |
2186 | KNotifyClient::beep(); | 2189 | KNotifyClient::beep(); |
2187 | return; | 2190 | return; |
2188 | } | 2191 | } |
2189 | DndFactory factory( mCalendar ); | 2192 | DndFactory factory( mCalendar ); |
2190 | factory.copyEvent(anEvent); | 2193 | factory.copyEvent(anEvent); |
2191 | } | 2194 | } |
2192 | 2195 | ||
2193 | void CalendarView::edit_paste() | 2196 | void CalendarView::edit_paste() |
2194 | { | 2197 | { |
2195 | QDate date = mNavigator->selectedDates().first(); | 2198 | QDate date = mNavigator->selectedDates().first(); |
2196 | 2199 | ||
2197 | DndFactory factory( mCalendar ); | 2200 | DndFactory factory( mCalendar ); |
2198 | Event *pastedEvent = factory.pasteEvent( date ); | 2201 | Event *pastedEvent = factory.pasteEvent( date ); |
2199 | 2202 | ||
2200 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); | 2203 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); |
2201 | } | 2204 | } |
2202 | 2205 | ||
2203 | void CalendarView::edit_options() | 2206 | void CalendarView::edit_options() |
2204 | { | 2207 | { |
2205 | mDialogManager->showOptionsDialog(); | 2208 | mDialogManager->showOptionsDialog(); |
2206 | //writeSettings(); | 2209 | //writeSettings(); |
2207 | } | 2210 | } |
2208 | 2211 | ||
2209 | void CalendarView::slotSelectPickerDate( QDate d) | 2212 | void CalendarView::slotSelectPickerDate( QDate d) |
2210 | { | 2213 | { |
2211 | mDateFrame->hide(); | 2214 | mDateFrame->hide(); |
2212 | if ( mDatePickerMode == 1 ) { | 2215 | if ( mDatePickerMode == 1 ) { |
2213 | mNavigator->slotDaySelect( d ); | 2216 | mNavigator->slotDaySelect( d ); |
2214 | } else if ( mDatePickerMode == 2 ) { | 2217 | } else if ( mDatePickerMode == 2 ) { |
2215 | if ( mMoveIncidence->type() == "Todo" ) { | 2218 | if ( mMoveIncidence->type() == "Todo" ) { |
2216 | Todo * to = (Todo *) mMoveIncidence; | 2219 | Todo * to = (Todo *) mMoveIncidence; |
2217 | QTime tim; | 2220 | QTime tim; |
2218 | if ( to->hasDueDate() ) | 2221 | if ( to->hasDueDate() ) |
2219 | tim = to->dtDue().time(); | 2222 | tim = to->dtDue().time(); |
2220 | else { | 2223 | else { |
2221 | tim = QTime ( 0,0,0 ); | 2224 | tim = QTime ( 0,0,0 ); |
2222 | to->setFloats( true ); | 2225 | to->setFloats( true ); |
2223 | to->setHasDueDate( true ); | 2226 | to->setHasDueDate( true ); |
2224 | } | 2227 | } |
2225 | QDateTime dt ( d,tim ); | 2228 | QDateTime dt ( d,tim ); |
2226 | to->setDtDue( dt ); | 2229 | to->setDtDue( dt ); |
2227 | todoChanged( to ); | 2230 | todoChanged( to ); |
2228 | } else { | 2231 | } else { |
2229 | QTime tim = mMoveIncidence->dtStart().time(); | 2232 | QTime tim = mMoveIncidence->dtStart().time(); |
2230 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); | 2233 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); |
2231 | QDateTime dt ( d,tim ); | 2234 | QDateTime dt ( d,tim ); |
2232 | mMoveIncidence->setDtStart( dt ); | 2235 | mMoveIncidence->setDtStart( dt ); |
2233 | ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); | 2236 | ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); |
2234 | changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); | 2237 | changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); |
2235 | } | 2238 | } |
2236 | 2239 | ||
2237 | mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); | 2240 | mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); |
2238 | } | 2241 | } |
2239 | } | 2242 | } |
2240 | 2243 | ||
2241 | void CalendarView::removeCategories() | 2244 | void CalendarView::removeCategories() |
2242 | { | 2245 | { |
2243 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); | 2246 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); |
2244 | QStringList catList = KOPrefs::instance()->mCustomCategories; | 2247 | QStringList catList = KOPrefs::instance()->mCustomCategories; |
2245 | QStringList catIncList; | 2248 | QStringList catIncList; |
2246 | QStringList newCatList; | 2249 | QStringList newCatList; |
2247 | Incidence* inc = incList.first(); | 2250 | Incidence* inc = incList.first(); |
2248 | int i; | 2251 | int i; |
2249 | int count = 0; | 2252 | int count = 0; |
2250 | while ( inc ) { | 2253 | while ( inc ) { |
2251 | newCatList.clear(); | 2254 | newCatList.clear(); |
2252 | catIncList = inc->categories() ; | 2255 | catIncList = inc->categories() ; |
2253 | for( i = 0; i< catIncList.count(); ++i ) { | 2256 | for( i = 0; i< catIncList.count(); ++i ) { |
2254 | if ( catList.contains (catIncList[i])) | 2257 | if ( catList.contains (catIncList[i])) |
2255 | newCatList.append( catIncList[i] ); | 2258 | newCatList.append( catIncList[i] ); |
2256 | } | 2259 | } |
2257 | newCatList.sort(); | 2260 | newCatList.sort(); |
2258 | inc->setCategories( newCatList.join(",") ); | 2261 | inc->setCategories( newCatList.join(",") ); |
2259 | inc = incList.next(); | 2262 | inc = incList.next(); |
2260 | } | 2263 | } |
2261 | } | 2264 | } |
2262 | 2265 | ||
2263 | int CalendarView::addCategories() | 2266 | int CalendarView::addCategories() |
2264 | { | 2267 | { |
2265 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); | 2268 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); |
2266 | QStringList catList = KOPrefs::instance()->mCustomCategories; | 2269 | QStringList catList = KOPrefs::instance()->mCustomCategories; |
2267 | QStringList catIncList; | 2270 | QStringList catIncList; |
2268 | Incidence* inc = incList.first(); | 2271 | Incidence* inc = incList.first(); |
2269 | int i; | 2272 | int i; |
2270 | int count = 0; | 2273 | int count = 0; |
2271 | while ( inc ) { | 2274 | while ( inc ) { |
2272 | catIncList = inc->categories() ; | 2275 | catIncList = inc->categories() ; |
2273 | for( i = 0; i< catIncList.count(); ++i ) { | 2276 | for( i = 0; i< catIncList.count(); ++i ) { |
2274 | if ( !catList.contains (catIncList[i])) { | 2277 | if ( !catList.contains (catIncList[i])) { |
2275 | catList.append( catIncList[i] ); | 2278 | catList.append( catIncList[i] ); |
2276 | //qDebug("add cat %s ", catIncList[i].latin1()); | 2279 | //qDebug("add cat %s ", catIncList[i].latin1()); |
2277 | ++count; | 2280 | ++count; |
2278 | } | 2281 | } |
2279 | } | 2282 | } |
2280 | inc = incList.next(); | 2283 | inc = incList.next(); |
2281 | } | 2284 | } |
2282 | catList.sort(); | 2285 | catList.sort(); |
2283 | KOPrefs::instance()->mCustomCategories = catList; | 2286 | KOPrefs::instance()->mCustomCategories = catList; |
2284 | return count; | 2287 | return count; |
2285 | } | 2288 | } |
2286 | 2289 | ||
2287 | void CalendarView::manageCategories() | 2290 | void CalendarView::manageCategories() |
2288 | { | 2291 | { |
2289 | KOCatPrefs* cp = new KOCatPrefs(); | 2292 | KOCatPrefs* cp = new KOCatPrefs(); |
2290 | cp->show(); | 2293 | cp->show(); |
2291 | int w =cp->sizeHint().width() ; | 2294 | int w =cp->sizeHint().width() ; |
2292 | int h = cp->sizeHint().height() ; | 2295 | int h = cp->sizeHint().height() ; |
2293 | int dw = QApplication::desktop()->width(); | 2296 | int dw = QApplication::desktop()->width(); |
2294 | int dh = QApplication::desktop()->height(); | 2297 | int dh = QApplication::desktop()->height(); |
2295 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2298 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2296 | if ( !cp->exec() ) { | 2299 | if ( !cp->exec() ) { |
2297 | delete cp; | 2300 | delete cp; |
2298 | return; | 2301 | return; |
2299 | } | 2302 | } |
2300 | int count = 0; | 2303 | int count = 0; |
2301 | if ( cp->addCat() ) { | 2304 | if ( cp->addCat() ) { |
2302 | count = addCategories(); | 2305 | count = addCategories(); |
2303 | if ( count ) { | 2306 | if ( count ) { |
2304 | topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); | 2307 | topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); |
2305 | writeSettings(); | 2308 | writeSettings(); |
2306 | } else | 2309 | } else |
2307 | topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! ")); | 2310 | topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! ")); |
2308 | } else { | 2311 | } else { |
2309 | removeCategories(); | 2312 | removeCategories(); |
2310 | updateView(); | 2313 | updateView(); |
2311 | } | 2314 | } |
2312 | delete cp; | 2315 | delete cp; |
2313 | } | 2316 | } |
2314 | 2317 | ||
2315 | void CalendarView::beamIncidence(Incidence * Inc) | 2318 | void CalendarView::beamIncidence(Incidence * Inc) |
2316 | { | 2319 | { |
2317 | QPtrList<Incidence> delSel ; | 2320 | QPtrList<Incidence> delSel ; |
2318 | delSel.append(Inc); | 2321 | delSel.append(Inc); |
2319 | beamIncidenceList( delSel ); | 2322 | beamIncidenceList( delSel ); |
2320 | } | 2323 | } |
2321 | void CalendarView::beamCalendar() | 2324 | void CalendarView::beamCalendar() |
2322 | { | 2325 | { |
2323 | QPtrList<Incidence> delSel = mCalendar->rawIncidences(); | 2326 | QPtrList<Incidence> delSel = mCalendar->rawIncidences(); |
2324 | //qDebug("beamCalendar() "); | 2327 | //qDebug("beamCalendar() "); |
2325 | beamIncidenceList( delSel ); | 2328 | beamIncidenceList( delSel ); |
2326 | } | 2329 | } |
2327 | void CalendarView::beamFilteredCalendar() | 2330 | void CalendarView::beamFilteredCalendar() |
2328 | { | 2331 | { |
2329 | QPtrList<Incidence> delSel = mCalendar->incidences(); | 2332 | QPtrList<Incidence> delSel = mCalendar->incidences(); |
2330 | //qDebug("beamFilteredCalendar() "); | 2333 | //qDebug("beamFilteredCalendar() "); |
2331 | beamIncidenceList( delSel ); | 2334 | beamIncidenceList( delSel ); |
2332 | } | 2335 | } |
2333 | void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) | 2336 | void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) |
2334 | { | 2337 | { |
2335 | if ( beamDialog->exec () == QDialog::Rejected ) | 2338 | if ( beamDialog->exec () == QDialog::Rejected ) |
2336 | return; | 2339 | return; |
2337 | #ifdef DESKTOP_VERSION | 2340 | #ifdef DESKTOP_VERSION |
2338 | QString fn = locateLocal( "tmp", "kopibeamfile" ); | 2341 | QString fn = locateLocal( "tmp", "kopibeamfile" ); |
2339 | #else | 2342 | #else |
2340 | QString fn = "/tmp/kopibeamfile"; | 2343 | QString fn = "/tmp/kopibeamfile"; |
2341 | #endif | 2344 | #endif |
2342 | QString mes; | 2345 | QString mes; |
2343 | bool createbup = true; | 2346 | bool createbup = true; |
2344 | if ( createbup ) { | 2347 | if ( createbup ) { |
2345 | QString description = "\n"; | 2348 | QString description = "\n"; |
2346 | CalendarLocal* cal = new CalendarLocal(); | 2349 | CalendarLocal* cal = new CalendarLocal(); |
2347 | if ( beamDialog->beamLocal() ) | 2350 | if ( beamDialog->beamLocal() ) |
2348 | cal->setLocalTime(); | 2351 | cal->setLocalTime(); |
2349 | else | 2352 | else |
2350 | cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2353 | cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2351 | Incidence *incidence = delSel.first(); | 2354 | Incidence *incidence = delSel.first(); |
2352 | bool addText = false; | 2355 | bool addText = false; |
2353 | if ( delSel.count() < 10 ) | 2356 | if ( delSel.count() < 10 ) |
2354 | addText = true; | 2357 | addText = true; |
2355 | else { | 2358 | else { |
2356 | description.sprintf(i18n(" %d items?"),delSel.count() ); | 2359 | description.sprintf(i18n(" %d items?"),delSel.count() ); |
2357 | } | 2360 | } |
2358 | while ( incidence ) { | 2361 | while ( incidence ) { |
2359 | Incidence *in = incidence->clone(); | 2362 | Incidence *in = incidence->clone(); |
2360 | if ( ! in->summary().isEmpty() ) { | 2363 | if ( ! in->summary().isEmpty() ) { |
2361 | in->setDescription(""); | 2364 | in->setDescription(""); |
2362 | } else { | 2365 | } else { |
2363 | in->setSummary( in->description().left(20)); | 2366 | in->setSummary( in->description().left(20)); |
2364 | in->setDescription(""); | 2367 | in->setDescription(""); |
2365 | } | 2368 | } |
2366 | if ( addText ) | 2369 | if ( addText ) |
2367 | description += in->summary() + "\n"; | 2370 | description += in->summary() + "\n"; |
2368 | cal->addIncidence( in ); | 2371 | cal->addIncidence( in ); |
2369 | incidence = delSel.next(); | 2372 | incidence = delSel.next(); |
2370 | } | 2373 | } |
2371 | if ( beamDialog->beamVcal() ) { | 2374 | if ( beamDialog->beamVcal() ) { |
2372 | fn += ".vcs"; | 2375 | fn += ".vcs"; |
2373 | FileStorage storage( cal, fn, new VCalFormat ); | 2376 | FileStorage storage( cal, fn, new VCalFormat ); |
2374 | storage.save(); | 2377 | storage.save(); |
2375 | } else { | 2378 | } else { |
2376 | fn += ".ics"; | 2379 | fn += ".ics"; |
2377 | FileStorage storage( cal, fn, new ICalFormat( ) ); | 2380 | FileStorage storage( cal, fn, new ICalFormat( ) ); |
2378 | storage.save(); | 2381 | storage.save(); |
2379 | } | 2382 | } |
2380 | delete cal; | 2383 | delete cal; |
2381 | mes = i18n("KO/Pi: Ready for beaming"); | 2384 | mes = i18n("KO/Pi: Ready for beaming"); |
2382 | topLevelWidget()->setCaption(mes); | 2385 | topLevelWidget()->setCaption(mes); |
2383 | KApplication::convert2latin1( fn ); | 2386 | KApplication::convert2latin1( fn ); |
2384 | #ifndef DESKTOP_VERSION | 2387 | #ifndef DESKTOP_VERSION |
2385 | Ir *ir = new Ir( this ); | 2388 | Ir *ir = new Ir( this ); |
2386 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); | 2389 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); |
2387 | ir->send( fn, description, "text/x-vCalendar" ); | 2390 | ir->send( fn, description, "text/x-vCalendar" ); |
2388 | #endif | 2391 | #endif |
2389 | } | 2392 | } |
2390 | } | 2393 | } |
2391 | void CalendarView::beamDone( Ir *ir ) | 2394 | void CalendarView::beamDone( Ir *ir ) |
2392 | { | 2395 | { |
2393 | #ifndef DESKTOP_VERSION | 2396 | #ifndef DESKTOP_VERSION |
2394 | delete ir; | 2397 | delete ir; |
2395 | #endif | 2398 | #endif |
2396 | topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); | 2399 | topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); |
2397 | topLevelWidget()->raise(); | 2400 | topLevelWidget()->raise(); |
2398 | } | 2401 | } |
2399 | 2402 | ||
2400 | void CalendarView::moveIncidence(Incidence * inc ) | 2403 | void CalendarView::moveIncidence(Incidence * inc ) |
2401 | { | 2404 | { |
2402 | if ( !inc ) return; | 2405 | if ( !inc ) return; |
2403 | // qDebug("showDatePickerForIncidence( ) "); | 2406 | // qDebug("showDatePickerForIncidence( ) "); |
2404 | if ( mDateFrame->isVisible() ) | 2407 | if ( mDateFrame->isVisible() ) |
2405 | mDateFrame->hide(); | 2408 | mDateFrame->hide(); |
2406 | else { | 2409 | else { |
2407 | int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ; | 2410 | int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ; |
2408 | int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ; | 2411 | int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ; |
2409 | int dw = QApplication::desktop()->width(); | 2412 | int dw = QApplication::desktop()->width(); |
2410 | int dh = QApplication::desktop()->height(); | 2413 | int dh = QApplication::desktop()->height(); |
2411 | mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2414 | mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2412 | mDateFrame->show(); | 2415 | mDateFrame->show(); |
2413 | } | 2416 | } |
2414 | mDatePickerMode = 2; | 2417 | mDatePickerMode = 2; |
2415 | mMoveIncidence = inc ; | 2418 | mMoveIncidence = inc ; |
2416 | QDate da; | 2419 | QDate da; |
2417 | if ( mMoveIncidence->type() == "Todo" ) { | 2420 | if ( mMoveIncidence->type() == "Todo" ) { |
2418 | Todo * to = (Todo *) mMoveIncidence; | 2421 | Todo * to = (Todo *) mMoveIncidence; |
2419 | if ( to->hasDueDate() ) | 2422 | if ( to->hasDueDate() ) |
2420 | da = to->dtDue().date(); | 2423 | da = to->dtDue().date(); |
2421 | else | 2424 | else |
2422 | da = QDate::currentDate(); | 2425 | da = QDate::currentDate(); |
2423 | } else { | 2426 | } else { |
2424 | da = mMoveIncidence->dtStart().date(); | 2427 | da = mMoveIncidence->dtStart().date(); |
2425 | } | 2428 | } |
2426 | mDatePicker->setDate( da ); | 2429 | mDatePicker->setDate( da ); |
2427 | } | 2430 | } |
2428 | void CalendarView::showDatePicker( ) | 2431 | void CalendarView::showDatePicker( ) |
2429 | { | 2432 | { |
2430 | //qDebug("CalendarView::showDatePicker( ) "); | 2433 | //qDebug("CalendarView::showDatePicker( ) "); |
2431 | if ( mDateFrame->isVisible() ) | 2434 | if ( mDateFrame->isVisible() ) |
2432 | mDateFrame->hide(); | 2435 | mDateFrame->hide(); |
2433 | else { | 2436 | else { |
2434 | int w =mDatePicker->sizeHint().width() ; | 2437 | int w =mDatePicker->sizeHint().width() ; |
2435 | int h = mDatePicker->sizeHint().height() ; | 2438 | int h = mDatePicker->sizeHint().height() ; |
2436 | int dw = QApplication::desktop()->width(); | 2439 | int dw = QApplication::desktop()->width(); |
2437 | int dh = QApplication::desktop()->height(); | 2440 | int dh = QApplication::desktop()->height(); |
2438 | mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2441 | mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2439 | mDateFrame->show(); | 2442 | mDateFrame->show(); |
2440 | } | 2443 | } |
2441 | mDatePickerMode = 1; | 2444 | mDatePickerMode = 1; |
2442 | mDatePicker->setDate( mNavigator->selectedDates().first() ); | 2445 | mDatePicker->setDate( mNavigator->selectedDates().first() ); |
2443 | } | 2446 | } |
2444 | 2447 | ||
2445 | void CalendarView::showEventEditor() | 2448 | void CalendarView::showEventEditor() |
2446 | { | 2449 | { |
2447 | #ifdef DESKTOP_VERSION | 2450 | #ifdef DESKTOP_VERSION |
2448 | mEventEditor->show(); | 2451 | mEventEditor->show(); |
2449 | #else | 2452 | #else |
2450 | if ( mEventEditor->width() != QApplication::desktop()->width() ) | 2453 | if ( mEventEditor->width() != QApplication::desktop()->width() ) |
2451 | mEventEditor->hide(); | 2454 | mEventEditor->hide(); |
2452 | mEventEditor->showMaximized(); | 2455 | mEventEditor->showMaximized(); |
2453 | #endif | 2456 | #endif |
2454 | } | 2457 | } |
2455 | void CalendarView::showTodoEditor() | 2458 | void CalendarView::showTodoEditor() |
2456 | { | 2459 | { |
2457 | #ifdef DESKTOP_VERSION | 2460 | #ifdef DESKTOP_VERSION |
2458 | mTodoEditor->show(); | 2461 | mTodoEditor->show(); |
2459 | #else | 2462 | #else |
2460 | if ( mTodoEditor->width() != QApplication::desktop()->width() ) | 2463 | if ( mTodoEditor->width() != QApplication::desktop()->width() ) |
2461 | mTodoEditor->hide(); | 2464 | mTodoEditor->hide(); |
2462 | mTodoEditor->showMaximized(); | 2465 | mTodoEditor->showMaximized(); |
2463 | #endif | 2466 | #endif |
2464 | } | 2467 | } |
2465 | 2468 | ||
2466 | void CalendarView::cloneIncidence() | 2469 | void CalendarView::cloneIncidence() |
2467 | { | 2470 | { |
2468 | Incidence *incidence = currentSelection(); | 2471 | Incidence *incidence = currentSelection(); |
2469 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 2472 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2470 | if ( incidence ) { | 2473 | if ( incidence ) { |
2471 | cloneIncidence(incidence); | 2474 | cloneIncidence(incidence); |
2472 | } | 2475 | } |
2473 | } | 2476 | } |
2474 | void CalendarView::moveIncidence() | 2477 | void CalendarView::moveIncidence() |
2475 | { | 2478 | { |
2476 | Incidence *incidence = currentSelection(); | 2479 | Incidence *incidence = currentSelection(); |
2477 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 2480 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2478 | if ( incidence ) { | 2481 | if ( incidence ) { |
2479 | moveIncidence(incidence); | 2482 | moveIncidence(incidence); |
2480 | } | 2483 | } |
2481 | } | 2484 | } |
2482 | void CalendarView::beamIncidence() | 2485 | void CalendarView::beamIncidence() |
2483 | { | 2486 | { |
2484 | Incidence *incidence = currentSelection(); | 2487 | Incidence *incidence = currentSelection(); |
2485 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 2488 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2486 | if ( incidence ) { | 2489 | if ( incidence ) { |
2487 | beamIncidence(incidence); | 2490 | beamIncidence(incidence); |
2488 | } | 2491 | } |
2489 | } | 2492 | } |
2490 | void CalendarView::toggleCancelIncidence() | 2493 | void CalendarView::toggleCancelIncidence() |
2491 | { | 2494 | { |
2492 | Incidence *incidence = currentSelection(); | 2495 | Incidence *incidence = currentSelection(); |
2493 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 2496 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2494 | if ( incidence ) { | 2497 | if ( incidence ) { |
2495 | cancelIncidence(incidence); | 2498 | cancelIncidence(incidence); |
2496 | } | 2499 | } |
2497 | } | 2500 | } |
2498 | 2501 | ||
2499 | 2502 | ||
2500 | void CalendarView::cancelIncidence(Incidence * inc ) | 2503 | void CalendarView::cancelIncidence(Incidence * inc ) |
2501 | { | 2504 | { |
2502 | inc->setCancelled( ! inc->cancelled() ); | 2505 | inc->setCancelled( ! inc->cancelled() ); |
2503 | changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); | 2506 | changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); |
2504 | updateView(); | 2507 | updateView(); |
2505 | } | 2508 | } |
2506 | void CalendarView::cloneIncidence(Incidence * orgInc ) | 2509 | void CalendarView::cloneIncidence(Incidence * orgInc ) |
2507 | { | 2510 | { |
2508 | Incidence * newInc = orgInc->clone(); | 2511 | Incidence * newInc = orgInc->clone(); |
2509 | newInc->recreate(); | 2512 | newInc->recreate(); |
2510 | 2513 | ||
2511 | if ( newInc->type() == "Todo" ) { | 2514 | if ( newInc->type() == "Todo" ) { |
2512 | Todo* t = (Todo*) newInc; | 2515 | Todo* t = (Todo*) newInc; |
2513 | mTodoEditor->editTodo( t ); | 2516 | mTodoEditor->editTodo( t ); |
2514 | showTodoEditor(); | 2517 | showTodoEditor(); |
2515 | if ( mTodoEditor->exec() ) { | 2518 | if ( mTodoEditor->exec() ) { |
2516 | mCalendar->addTodo( t ); | 2519 | mCalendar->addTodo( t ); |
2517 | updateView(); | 2520 | updateView(); |
2518 | } else { | 2521 | } else { |
2519 | delete t; | 2522 | delete t; |
2520 | } | 2523 | } |
2521 | } | 2524 | } |
2522 | else { | 2525 | else { |
2523 | Event* e = (Event*) newInc; | 2526 | Event* e = (Event*) newInc; |
2524 | mEventEditor->editEvent( e ); | 2527 | mEventEditor->editEvent( e ); |
2525 | showEventEditor(); | 2528 | showEventEditor(); |
2526 | if ( mEventEditor->exec() ) { | 2529 | if ( mEventEditor->exec() ) { |
2527 | mCalendar->addEvent( e ); | 2530 | mCalendar->addEvent( e ); |
2528 | updateView(); | 2531 | updateView(); |
2529 | } else { | 2532 | } else { |
2530 | delete e; | 2533 | delete e; |
2531 | } | 2534 | } |
2532 | } | 2535 | } |
2533 | } | 2536 | } |
2534 | 2537 | ||
2535 | void CalendarView::newEvent() | 2538 | void CalendarView::newEvent() |
2536 | { | 2539 | { |
2537 | // TODO: Replace this code by a common eventDurationHint of KOBaseView. | 2540 | // TODO: Replace this code by a common eventDurationHint of KOBaseView. |
2538 | KOAgendaView *aView = mViewManager->agendaView(); | 2541 | KOAgendaView *aView = mViewManager->agendaView(); |
2539 | if (aView) { | 2542 | if (aView) { |
2540 | if (aView->selectionStart().isValid()) { | 2543 | if (aView->selectionStart().isValid()) { |
2541 | if (aView->selectedIsAllDay()) { | 2544 | if (aView->selectedIsAllDay()) { |
2542 | newEvent(aView->selectionStart(),aView->selectionEnd(),true); | 2545 | newEvent(aView->selectionStart(),aView->selectionEnd(),true); |
2543 | } else { | 2546 | } else { |
2544 | newEvent(aView->selectionStart(),aView->selectionEnd()); | 2547 | newEvent(aView->selectionStart(),aView->selectionEnd()); |
2545 | } | 2548 | } |
2546 | return; | 2549 | return; |
2547 | } | 2550 | } |
2548 | } | 2551 | } |
2549 | 2552 | ||
2550 | QDate date = mNavigator->selectedDates().first(); | 2553 | QDate date = mNavigator->selectedDates().first(); |
2551 | QDateTime current = QDateTime::currentDateTime(); | 2554 | QDateTime current = QDateTime::currentDateTime(); |
2552 | if ( date <= current.date() ) { | 2555 | if ( date <= current.date() ) { |
2553 | int hour = current.time().hour() +1; | 2556 | int hour = current.time().hour() +1; |
2554 | newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), | 2557 | newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), |
2555 | QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); | 2558 | QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); |
2556 | } else | 2559 | } else |
2557 | newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), | 2560 | newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), |
2558 | QDateTime( date, QTime( KOPrefs::instance()->mStartTime + | 2561 | QDateTime( date, QTime( KOPrefs::instance()->mStartTime + |
2559 | KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); | 2562 | KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); |
2560 | } | 2563 | } |
2561 | 2564 | ||
2562 | void CalendarView::newEvent(QDateTime fh) | 2565 | void CalendarView::newEvent(QDateTime fh) |
2563 | { | 2566 | { |
2564 | newEvent(fh, | 2567 | newEvent(fh, |
2565 | QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); | 2568 | QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); |
2566 | } | 2569 | } |
2567 | 2570 | ||
2568 | void CalendarView::newEvent(QDate dt) | 2571 | void CalendarView::newEvent(QDate dt) |
2569 | { | 2572 | { |
2570 | newEvent(QDateTime(dt, QTime(0,0,0)), | 2573 | newEvent(QDateTime(dt, QTime(0,0,0)), |
2571 | QDateTime(dt, QTime(0,0,0)), true); | 2574 | QDateTime(dt, QTime(0,0,0)), true); |
2572 | } | 2575 | } |
2573 | 2576 | ||
2574 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) | 2577 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) |
2575 | { | 2578 | { |
2576 | 2579 | ||
2577 | mEventEditor->newEvent(fromHint,toHint,allDay); | 2580 | mEventEditor->newEvent(fromHint,toHint,allDay); |
2578 | if ( mFilterView->filtersEnabled() ) { | 2581 | if ( mFilterView->filtersEnabled() ) { |
2579 | CalFilter *filter = mFilterView->selectedFilter(); | 2582 | CalFilter *filter = mFilterView->selectedFilter(); |
2580 | if (filter && filter->showCategories()) { | 2583 | if (filter && filter->showCategories()) { |
2581 | mEventEditor->setCategories(filter->categoryList().join(",") ); | 2584 | mEventEditor->setCategories(filter->categoryList().join(",") ); |
2582 | } | 2585 | } |
2583 | if ( filter ) | 2586 | if ( filter ) |
2584 | mEventEditor->setSecrecy( filter->getSecrecy() ); | 2587 | mEventEditor->setSecrecy( filter->getSecrecy() ); |
2585 | } | 2588 | } |
2586 | showEventEditor(); | 2589 | showEventEditor(); |
2587 | } | 2590 | } |
2588 | void CalendarView::todoAdded(Todo * t) | 2591 | void CalendarView::todoAdded(Todo * t) |
2589 | { | 2592 | { |
2590 | 2593 | ||
2591 | changeTodoDisplay ( t ,KOGlobals::EVENTADDED); | 2594 | changeTodoDisplay ( t ,KOGlobals::EVENTADDED); |
2592 | updateTodoViews(); | 2595 | updateTodoViews(); |
2593 | } | 2596 | } |
2594 | void CalendarView::todoChanged(Todo * t) | 2597 | void CalendarView::todoChanged(Todo * t) |
2595 | { | 2598 | { |
2596 | emit todoModified( t, 4 ); | 2599 | emit todoModified( t, 4 ); |
2597 | // updateTodoViews(); | 2600 | // updateTodoViews(); |
2598 | } | 2601 | } |
2599 | void CalendarView::todoToBeDeleted(Todo *) | 2602 | void CalendarView::todoToBeDeleted(Todo *) |
2600 | { | 2603 | { |
2601 | //qDebug("todoToBeDeleted(Todo *) "); | 2604 | //qDebug("todoToBeDeleted(Todo *) "); |
2602 | updateTodoViews(); | 2605 | updateTodoViews(); |
2603 | } | 2606 | } |
2604 | void CalendarView::todoDeleted() | 2607 | void CalendarView::todoDeleted() |
2605 | { | 2608 | { |
2606 | //qDebug(" todoDeleted()"); | 2609 | //qDebug(" todoDeleted()"); |
2607 | updateTodoViews(); | 2610 | updateTodoViews(); |
2608 | } | 2611 | } |
2609 | 2612 | ||
2610 | 2613 | ||
2611 | 2614 | ||
2612 | void CalendarView::newTodo() | 2615 | void CalendarView::newTodo() |
2613 | { | 2616 | { |
2614 | 2617 | ||
2615 | mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),0,true); | 2618 | mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),0,true); |
2616 | if ( mFilterView->filtersEnabled() ) { | 2619 | if ( mFilterView->filtersEnabled() ) { |
2617 | CalFilter *filter = mFilterView->selectedFilter(); | 2620 | CalFilter *filter = mFilterView->selectedFilter(); |
2618 | if (filter && filter->showCategories()) { | 2621 | if (filter && filter->showCategories()) { |
2619 | mTodoEditor->setCategories(filter->categoryList().join(",") ); | 2622 | mTodoEditor->setCategories(filter->categoryList().join(",") ); |
2620 | } | 2623 | } |
2621 | if ( filter ) | 2624 | if ( filter ) |
2622 | mTodoEditor->setSecrecy( filter->getSecrecy() ); | 2625 | mTodoEditor->setSecrecy( filter->getSecrecy() ); |
2623 | } | 2626 | } |
2624 | showTodoEditor(); | 2627 | showTodoEditor(); |
2625 | } | 2628 | } |
2626 | 2629 | ||
2627 | void CalendarView::newSubTodo() | 2630 | void CalendarView::newSubTodo() |
2628 | { | 2631 | { |
2629 | Todo *todo = selectedTodo(); | 2632 | Todo *todo = selectedTodo(); |
2630 | if ( todo ) newSubTodo( todo ); | 2633 | if ( todo ) newSubTodo( todo ); |
2631 | } | 2634 | } |
2632 | 2635 | ||
2633 | void CalendarView::newSubTodo(Todo *parentEvent) | 2636 | void CalendarView::newSubTodo(Todo *parentEvent) |
2634 | { | 2637 | { |
2635 | 2638 | ||
2636 | mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),parentEvent,true); | 2639 | mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),parentEvent,true); |
2637 | showTodoEditor(); | 2640 | showTodoEditor(); |
2638 | } | 2641 | } |
2639 | 2642 | ||
2640 | void CalendarView::newFloatingEvent() | 2643 | void CalendarView::newFloatingEvent() |
2641 | { | 2644 | { |
2642 | DateList tmpList = mNavigator->selectedDates(); | 2645 | DateList tmpList = mNavigator->selectedDates(); |
2643 | QDate date = tmpList.first(); | 2646 | QDate date = tmpList.first(); |
2644 | 2647 | ||
2645 | newEvent( QDateTime( date, QTime( 12, 0, 0 ) ), | 2648 | newEvent( QDateTime( date, QTime( 12, 0, 0 ) ), |
2646 | QDateTime( date, QTime( 12, 0, 0 ) ), true ); | 2649 | QDateTime( date, QTime( 12, 0, 0 ) ), true ); |
2647 | } | 2650 | } |
2648 | 2651 | ||
2649 | 2652 | ||
2650 | void CalendarView::editEvent( Event *event ) | 2653 | void CalendarView::editEvent( Event *event ) |
2651 | { | 2654 | { |
2652 | 2655 | ||
2653 | if ( !event ) return; | 2656 | if ( !event ) return; |
2654 | if ( event->isReadOnly() ) { | 2657 | if ( event->isReadOnly() ) { |
2655 | showEvent( event ); | 2658 | showEvent( event ); |
2656 | return; | 2659 | return; |
2657 | } | 2660 | } |
2658 | mEventEditor->editEvent( event , mFlagEditDescription); | 2661 | mEventEditor->editEvent( event , mFlagEditDescription); |
2659 | showEventEditor(); | 2662 | showEventEditor(); |
2660 | } | 2663 | } |
2661 | void CalendarView::editJournal( Journal *jour ) | 2664 | void CalendarView::editJournal( Journal *jour ) |
2662 | { | 2665 | { |
2663 | if ( !jour ) return; | 2666 | if ( !jour ) return; |
2664 | mDialogManager->hideSearchDialog(); | 2667 | mDialogManager->hideSearchDialog(); |
2665 | mViewManager->showJournalView(); | 2668 | mViewManager->showJournalView(); |
2666 | mNavigator->slotDaySelect( jour->dtStart().date() ); | 2669 | mNavigator->slotDaySelect( jour->dtStart().date() ); |
2667 | } | 2670 | } |
2668 | void CalendarView::editTodo( Todo *todo ) | 2671 | void CalendarView::editTodo( Todo *todo ) |
2669 | { | 2672 | { |
2670 | if ( !todo ) return; | 2673 | if ( !todo ) return; |
2671 | 2674 | ||
2672 | if ( todo->isReadOnly() ) { | 2675 | if ( todo->isReadOnly() ) { |
2673 | showTodo( todo ); | 2676 | showTodo( todo ); |
2674 | return; | 2677 | return; |
2675 | } | 2678 | } |
2676 | mTodoEditor->editTodo( todo ,mFlagEditDescription); | 2679 | mTodoEditor->editTodo( todo ,mFlagEditDescription); |
2677 | showTodoEditor(); | 2680 | showTodoEditor(); |
2678 | 2681 | ||
2679 | } | 2682 | } |
2680 | 2683 | ||
2681 | KOEventViewerDialog* CalendarView::getEventViewerDialog() | 2684 | KOEventViewerDialog* CalendarView::getEventViewerDialog() |
2682 | { | 2685 | { |
2683 | if ( !mEventViewerDialog ) { | 2686 | if ( !mEventViewerDialog ) { |
2684 | mEventViewerDialog = new KOEventViewerDialog(this); | 2687 | mEventViewerDialog = new KOEventViewerDialog(this); |
2685 | connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); | 2688 | connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); |
2686 | connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); | 2689 | connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); |
2687 | connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), | 2690 | connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), |
2688 | dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); | 2691 | dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); |
2689 | connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), | 2692 | connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), |
2690 | viewManager(), SLOT( showAgendaView( bool ) ) ); | 2693 | viewManager(), SLOT( showAgendaView( bool ) ) ); |
2691 | mEventViewerDialog->resize( 640, 480 ); | 2694 | mEventViewerDialog->resize( 640, 480 ); |
2692 | 2695 | ||
2693 | } | 2696 | } |
2694 | return mEventViewerDialog; | 2697 | return mEventViewerDialog; |
2695 | } | 2698 | } |
2696 | void CalendarView::showEvent(Event *event) | 2699 | void CalendarView::showEvent(Event *event) |
2697 | { | 2700 | { |
2698 | getEventViewerDialog()->setEvent(event); | 2701 | getEventViewerDialog()->setEvent(event); |
2699 | getEventViewerDialog()->showMe(); | 2702 | getEventViewerDialog()->showMe(); |
2700 | } | 2703 | } |
2701 | 2704 | ||
2702 | void CalendarView::showTodo(Todo *event) | 2705 | void CalendarView::showTodo(Todo *event) |
2703 | { | 2706 | { |
2704 | getEventViewerDialog()->setTodo(event); | 2707 | getEventViewerDialog()->setTodo(event); |
2705 | getEventViewerDialog()->showMe(); | 2708 | getEventViewerDialog()->showMe(); |
2706 | } | 2709 | } |
2707 | void CalendarView::showJournal( Journal *jour ) | 2710 | void CalendarView::showJournal( Journal *jour ) |
2708 | { | 2711 | { |
2709 | getEventViewerDialog()->setJournal(jour); | 2712 | getEventViewerDialog()->setJournal(jour); |
2710 | getEventViewerDialog()->showMe(); | 2713 | getEventViewerDialog()->showMe(); |
2711 | 2714 | ||
2712 | } | 2715 | } |
2713 | // void CalendarView::todoModified (Todo *event, int changed) | 2716 | // void CalendarView::todoModified (Todo *event, int changed) |
2714 | // { | 2717 | // { |
2715 | // // if (mDialogList.find (event) != mDialogList.end ()) { | 2718 | // // if (mDialogList.find (event) != mDialogList.end ()) { |
2716 | // // kdDebug() << "Todo modified and open" << endl; | 2719 | // // kdDebug() << "Todo modified and open" << endl; |
2717 | // // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; | 2720 | // // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; |
2718 | // // temp->modified (changed); | 2721 | // // temp->modified (changed); |
2719 | 2722 | ||
2720 | // // } | 2723 | // // } |
2721 | 2724 | ||
2722 | // mViewManager->updateView(); | 2725 | // mViewManager->updateView(); |
2723 | // } | 2726 | // } |
2724 | 2727 | ||
2725 | void CalendarView::appointment_show() | 2728 | void CalendarView::appointment_show() |
2726 | { | 2729 | { |
2727 | Event *anEvent = 0; | 2730 | Event *anEvent = 0; |
2728 | 2731 | ||
2729 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2732 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2730 | 2733 | ||
2731 | if (mViewManager->currentView()->isEventView()) { | 2734 | if (mViewManager->currentView()->isEventView()) { |
2732 | if ( incidence && incidence->type() == "Event" ) { | 2735 | if ( incidence && incidence->type() == "Event" ) { |
2733 | anEvent = static_cast<Event *>(incidence); | 2736 | anEvent = static_cast<Event *>(incidence); |
2734 | } | 2737 | } |
2735 | } | 2738 | } |
2736 | 2739 | ||
2737 | if (!anEvent) { | 2740 | if (!anEvent) { |
2738 | KNotifyClient::beep(); | 2741 | KNotifyClient::beep(); |
2739 | return; | 2742 | return; |
2740 | } | 2743 | } |
2741 | 2744 | ||
2742 | showEvent(anEvent); | 2745 | showEvent(anEvent); |
2743 | } | 2746 | } |
2744 | 2747 | ||
2745 | void CalendarView::appointment_edit() | 2748 | void CalendarView::appointment_edit() |
2746 | { | 2749 | { |
2747 | Event *anEvent = 0; | 2750 | Event *anEvent = 0; |
2748 | 2751 | ||
2749 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2752 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2750 | 2753 | ||
2751 | if (mViewManager->currentView()->isEventView()) { | 2754 | if (mViewManager->currentView()->isEventView()) { |
2752 | if ( incidence && incidence->type() == "Event" ) { | 2755 | if ( incidence && incidence->type() == "Event" ) { |
2753 | anEvent = static_cast<Event *>(incidence); | 2756 | anEvent = static_cast<Event *>(incidence); |
2754 | } | 2757 | } |
2755 | } | 2758 | } |
2756 | 2759 | ||
2757 | if (!anEvent) { | 2760 | if (!anEvent) { |
2758 | KNotifyClient::beep(); | 2761 | KNotifyClient::beep(); |
2759 | return; | 2762 | return; |
2760 | } | 2763 | } |
2761 | 2764 | ||
2762 | editEvent(anEvent); | 2765 | editEvent(anEvent); |
2763 | } | 2766 | } |
2764 | 2767 | ||
2765 | void CalendarView::appointment_delete() | 2768 | void CalendarView::appointment_delete() |
2766 | { | 2769 | { |
2767 | Event *anEvent = 0; | 2770 | Event *anEvent = 0; |
2768 | 2771 | ||
2769 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2772 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2770 | 2773 | ||
2771 | if (mViewManager->currentView()->isEventView()) { | 2774 | if (mViewManager->currentView()->isEventView()) { |
2772 | if ( incidence && incidence->type() == "Event" ) { | 2775 | if ( incidence && incidence->type() == "Event" ) { |
2773 | anEvent = static_cast<Event *>(incidence); | 2776 | anEvent = static_cast<Event *>(incidence); |
2774 | } | 2777 | } |
2775 | } | 2778 | } |
2776 | 2779 | ||
2777 | if (!anEvent) { | 2780 | if (!anEvent) { |
2778 | KNotifyClient::beep(); | 2781 | KNotifyClient::beep(); |
2779 | return; | 2782 | return; |
2780 | } | 2783 | } |
2781 | 2784 | ||
2782 | deleteEvent(anEvent); | 2785 | deleteEvent(anEvent); |
2783 | } | 2786 | } |
2784 | 2787 | ||
2785 | void CalendarView::todo_resub( Todo * parent, Todo * sub ) | 2788 | void CalendarView::todo_resub( Todo * parent, Todo * sub ) |
2786 | { | 2789 | { |
2787 | if (!sub) return; | 2790 | if (!sub) return; |
2788 | if (!parent) return; | 2791 | if (!parent) return; |
2789 | if ( sub->relatedTo() ) | 2792 | if ( sub->relatedTo() ) |
2790 | sub->relatedTo()->removeRelation(sub); | 2793 | sub->relatedTo()->removeRelation(sub); |
2791 | sub->setRelatedTo(parent); | 2794 | sub->setRelatedTo(parent); |
2792 | sub->setRelatedToUid(parent->uid()); | 2795 | sub->setRelatedToUid(parent->uid()); |
2793 | parent->addRelation(sub); | 2796 | parent->addRelation(sub); |
2794 | sub->updated(); | 2797 | sub->updated(); |
2795 | parent->updated(); | 2798 | parent->updated(); |
2796 | setModified(true); | 2799 | setModified(true); |
2797 | updateView(); | 2800 | updateView(); |
2798 | } | 2801 | } |
2799 | void CalendarView::todo_unsub(Todo *anTodo ) | 2802 | void CalendarView::todo_unsub(Todo *anTodo ) |
2800 | { | 2803 | { |
2801 | // Todo *anTodo = selectedTodo(); | 2804 | // Todo *anTodo = selectedTodo(); |
2802 | if (!anTodo) return; | 2805 | if (!anTodo) return; |
2803 | if (!anTodo->relatedTo()) return; | 2806 | if (!anTodo->relatedTo()) return; |
2804 | anTodo->relatedTo()->removeRelation(anTodo); | 2807 | anTodo->relatedTo()->removeRelation(anTodo); |
2805 | anTodo->setRelatedTo(0); | 2808 | anTodo->setRelatedTo(0); |
2806 | anTodo->updated(); | 2809 | anTodo->updated(); |
2807 | anTodo->setRelatedToUid(""); | 2810 | anTodo->setRelatedToUid(""); |
2808 | setModified(true); | 2811 | setModified(true); |
2809 | updateView(); | 2812 | updateView(); |
2810 | } | 2813 | } |
2811 | 2814 | ||
2812 | void CalendarView::deleteTodo(Todo *todo) | 2815 | void CalendarView::deleteTodo(Todo *todo) |
2813 | { | 2816 | { |
2814 | if (!todo) { | 2817 | if (!todo) { |
2815 | KNotifyClient::beep(); | 2818 | KNotifyClient::beep(); |
2816 | return; | 2819 | return; |
2817 | } | 2820 | } |
2818 | if (KOPrefs::instance()->mConfirm) { | 2821 | if (KOPrefs::instance()->mConfirm) { |
2819 | switch (msgItemDelete()) { | 2822 | switch (msgItemDelete()) { |
2820 | case KMessageBox::Continue: // OK | 2823 | case KMessageBox::Continue: // OK |
2821 | if (!todo->relations().isEmpty()) { | 2824 | if (!todo->relations().isEmpty()) { |
2822 | KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."), | 2825 | KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."), |
2823 | i18n("Delete To-Do")); | 2826 | i18n("Delete To-Do")); |
2824 | } else { | 2827 | } else { |
2825 | checkExternalId( todo ); | 2828 | checkExternalId( todo ); |
2826 | calendar()->deleteTodo(todo); | 2829 | calendar()->deleteTodo(todo); |
2827 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); | 2830 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); |
2828 | updateView(); | 2831 | updateView(); |
2829 | } | 2832 | } |
2830 | break; | 2833 | break; |
2831 | } // switch | 2834 | } // switch |
2832 | } else { | 2835 | } else { |
2833 | if (!todo->relations().isEmpty()) { | 2836 | if (!todo->relations().isEmpty()) { |
2834 | KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."), | 2837 | KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."), |
2835 | i18n("Delete To-Do")); | 2838 | i18n("Delete To-Do")); |
2836 | } else { | 2839 | } else { |
2837 | checkExternalId( todo ); | 2840 | checkExternalId( todo ); |
2838 | mCalendar->deleteTodo(todo); | 2841 | mCalendar->deleteTodo(todo); |
2839 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); | 2842 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); |
2840 | updateView(); | 2843 | updateView(); |
2841 | } | 2844 | } |
2842 | } | 2845 | } |
2843 | emit updateSearchDialog(); | 2846 | emit updateSearchDialog(); |
2844 | } | 2847 | } |
2845 | void CalendarView::deleteJournal(Journal *jour) | 2848 | void CalendarView::deleteJournal(Journal *jour) |
2846 | { | 2849 | { |
2847 | if (!jour) { | 2850 | if (!jour) { |
2848 | KNotifyClient::beep(); | 2851 | KNotifyClient::beep(); |
2849 | return; | 2852 | return; |
2850 | } | 2853 | } |
2851 | if (KOPrefs::instance()->mConfirm) { | 2854 | if (KOPrefs::instance()->mConfirm) { |
2852 | switch (msgItemDelete()) { | 2855 | switch (msgItemDelete()) { |
2853 | case KMessageBox::Continue: // OK | 2856 | case KMessageBox::Continue: // OK |
2854 | calendar()->deleteJournal(jour); | 2857 | calendar()->deleteJournal(jour); |
2855 | updateView(); | 2858 | updateView(); |
2856 | break; | 2859 | break; |
2857 | } // switch | 2860 | } // switch |
2858 | } else { | 2861 | } else { |
2859 | calendar()->deleteJournal(jour);; | 2862 | calendar()->deleteJournal(jour);; |
2860 | updateView(); | 2863 | updateView(); |
2861 | } | 2864 | } |
2862 | emit updateSearchDialog(); | 2865 | emit updateSearchDialog(); |
2863 | } | 2866 | } |
2864 | 2867 | ||
2865 | void CalendarView::deleteEvent(Event *anEvent) | 2868 | void CalendarView::deleteEvent(Event *anEvent) |
2866 | { | 2869 | { |
2867 | if (!anEvent) { | 2870 | if (!anEvent) { |
2868 | KNotifyClient::beep(); | 2871 | KNotifyClient::beep(); |
2869 | return; | 2872 | return; |
2870 | } | 2873 | } |
2871 | 2874 | ||
2872 | if (anEvent->recurrence()->doesRecur()) { | 2875 | if (anEvent->recurrence()->doesRecur()) { |
2873 | QDate itemDate = mViewManager->currentSelectionDate(); | 2876 | QDate itemDate = mViewManager->currentSelectionDate(); |
2874 | int km; | 2877 | int km; |
2875 | if (!itemDate.isValid()) { | 2878 | if (!itemDate.isValid()) { |
2876 | //kdDebug() << "Date Not Valid" << endl; | 2879 | //kdDebug() << "Date Not Valid" << endl; |
2877 | if (KOPrefs::instance()->mConfirm) { | 2880 | if (KOPrefs::instance()->mConfirm) { |
2878 | km = KMessageBox::warningContinueCancel(this,anEvent->summary() + | 2881 | km = KMessageBox::warningContinueCancel(this,anEvent->summary() + |
2879 | i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"), | 2882 | i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"), |
2880 | i18n("KO/Pi Confirmation"),i18n("Delete All")); | 2883 | i18n("KO/Pi Confirmation"),i18n("Delete All")); |
2881 | if ( km == KMessageBox::Continue ) | 2884 | if ( km == KMessageBox::Continue ) |
2882 | km = KMessageBox::No; // No = all below | 2885 | km = KMessageBox::No; // No = all below |
2883 | } else | 2886 | } else |
2884 | km = KMessageBox::No; | 2887 | km = KMessageBox::No; |
2885 | } else { | 2888 | } else { |
2886 | km = KMessageBox::warningYesNoCancel(this,anEvent->summary() + | 2889 | km = KMessageBox::warningYesNoCancel(this,anEvent->summary() + |
2887 | i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+ | 2890 | i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+ |
2888 | KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"), | 2891 | KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"), |
2889 | i18n("KO/Pi Confirmation"),i18n("Current"), | 2892 | i18n("KO/Pi Confirmation"),i18n("Current"), |
2890 | i18n("All")); | 2893 | i18n("All")); |
2891 | } | 2894 | } |
2892 | switch(km) { | 2895 | switch(km) { |
2893 | 2896 | ||
2894 | case KMessageBox::No: // Continue // all | 2897 | case KMessageBox::No: // Continue // all |
2895 | //qDebug("KMessageBox::No "); | 2898 | //qDebug("KMessageBox::No "); |
2896 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) | 2899 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) |
2897 | schedule(Scheduler::Cancel,anEvent); | 2900 | schedule(Scheduler::Cancel,anEvent); |
2898 | 2901 | ||
2899 | checkExternalId( anEvent); | 2902 | checkExternalId( anEvent); |
2900 | mCalendar->deleteEvent(anEvent); | 2903 | mCalendar->deleteEvent(anEvent); |
2901 | changeEventDisplay(anEvent,KOGlobals::EVENTDELETED); | 2904 | changeEventDisplay(anEvent,KOGlobals::EVENTDELETED); |
2902 | break; | 2905 | break; |
2903 | 2906 | ||
2904 | // Disabled because it does not work | 2907 | // Disabled because it does not work |
2905 | //#if 0 | 2908 | //#if 0 |
2906 | case KMessageBox::Yes: // just this one | 2909 | case KMessageBox::Yes: // just this one |
2907 | //QDate qd = mNavigator->selectedDates().first(); | 2910 | //QDate qd = mNavigator->selectedDates().first(); |
2908 | //if (!qd.isValid()) { | 2911 | //if (!qd.isValid()) { |
2909 | // kdDebug() << "no date selected, or invalid date" << endl; | 2912 | // kdDebug() << "no date selected, or invalid date" << endl; |
2910 | // KNotifyClient::beep(); | 2913 | // KNotifyClient::beep(); |
2911 | // return; | 2914 | // return; |
2912 | //} | 2915 | //} |
2913 | //while (!anEvent->recursOn(qd)) qd = qd.addDays(1); | 2916 | //while (!anEvent->recursOn(qd)) qd = qd.addDays(1); |
2914 | if (itemDate!=QDate(1,1,1) || itemDate.isValid()) { | 2917 | if (itemDate!=QDate(1,1,1) || itemDate.isValid()) { |
2915 | anEvent->addExDate(itemDate); | 2918 | anEvent->addExDate(itemDate); |
2916 | int duration = anEvent->recurrence()->duration(); | 2919 | int duration = anEvent->recurrence()->duration(); |
2917 | if ( duration > 0 ) { | 2920 | if ( duration > 0 ) { |
2918 | anEvent->recurrence()->setDuration( duration - 1 ); | 2921 | anEvent->recurrence()->setDuration( duration - 1 ); |
2919 | } | 2922 | } |
2920 | changeEventDisplay(anEvent, KOGlobals::EVENTEDITED); | 2923 | changeEventDisplay(anEvent, KOGlobals::EVENTEDITED); |
2921 | } | 2924 | } |
2922 | break; | 2925 | break; |
2923 | //#endif | 2926 | //#endif |
2924 | } // switch | 2927 | } // switch |
2925 | } else { | 2928 | } else { |
2926 | if (KOPrefs::instance()->mConfirm) { | 2929 | if (KOPrefs::instance()->mConfirm) { |
2927 | switch (KMessageBox::warningContinueCancel(this,anEvent->summary() + | 2930 | switch (KMessageBox::warningContinueCancel(this,anEvent->summary() + |
2928 | i18n("\nAre you sure you want\nto delete this event?"), | 2931 | i18n("\nAre you sure you want\nto delete this event?"), |
2929 | i18n("KO/Pi Confirmation"),i18n("Delete"))) { | 2932 | i18n("KO/Pi Confirmation"),i18n("Delete"))) { |
2930 | case KMessageBox::Continue: // OK | 2933 | case KMessageBox::Continue: // OK |
2931 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) | 2934 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) |
2932 | schedule(Scheduler::Cancel,anEvent); | 2935 | schedule(Scheduler::Cancel,anEvent); |
2933 | checkExternalId( anEvent); | 2936 | checkExternalId( anEvent); |
2934 | mCalendar->deleteEvent(anEvent); | 2937 | mCalendar->deleteEvent(anEvent); |
2935 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 2938 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
2936 | break; | 2939 | break; |
2937 | } // switch | 2940 | } // switch |
2938 | } else { | 2941 | } else { |
2939 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) | 2942 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) |
2940 | schedule(Scheduler::Cancel,anEvent); | 2943 | schedule(Scheduler::Cancel,anEvent); |
2941 | checkExternalId( anEvent); | 2944 | checkExternalId( anEvent); |
2942 | mCalendar->deleteEvent(anEvent); | 2945 | mCalendar->deleteEvent(anEvent); |
2943 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 2946 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
2944 | } | 2947 | } |
2945 | } // if-else | 2948 | } // if-else |
2946 | emit updateSearchDialog(); | 2949 | emit updateSearchDialog(); |
2947 | } | 2950 | } |
2948 | 2951 | ||
2949 | bool CalendarView::deleteEvent(const QString &uid) | 2952 | bool CalendarView::deleteEvent(const QString &uid) |
2950 | { | 2953 | { |
2951 | Event *ev = mCalendar->event(uid); | 2954 | Event *ev = mCalendar->event(uid); |
2952 | if (ev) { | 2955 | if (ev) { |
2953 | deleteEvent(ev); | 2956 | deleteEvent(ev); |
2954 | return true; | 2957 | return true; |
2955 | } else { | 2958 | } else { |
2956 | return false; | 2959 | return false; |
2957 | } | 2960 | } |
2958 | } | 2961 | } |
2959 | 2962 | ||
2960 | /*****************************************************************************/ | 2963 | /*****************************************************************************/ |
2961 | 2964 | ||
2962 | void CalendarView::action_mail() | 2965 | void CalendarView::action_mail() |
2963 | { | 2966 | { |
2964 | #ifndef KORG_NOMAIL | 2967 | #ifndef KORG_NOMAIL |
2965 | KOMailClient mailClient; | 2968 | KOMailClient mailClient; |
2966 | 2969 | ||
2967 | Incidence *incidence = currentSelection(); | 2970 | Incidence *incidence = currentSelection(); |
2968 | 2971 | ||
2969 | if (!incidence) { | 2972 | if (!incidence) { |
2970 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); | 2973 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); |
2971 | return; | 2974 | return; |
2972 | } | 2975 | } |
2973 | if(incidence->attendeeCount() == 0 ) { | 2976 | if(incidence->attendeeCount() == 0 ) { |
2974 | KMessageBox::sorry(this, | 2977 | KMessageBox::sorry(this, |
2975 | i18n("Can't generate mail:\nNo attendees defined.\n")); | 2978 | i18n("Can't generate mail:\nNo attendees defined.\n")); |
2976 | return; | 2979 | return; |
2977 | } | 2980 | } |
2978 | 2981 | ||
2979 | CalendarLocal cal_tmp; | 2982 | CalendarLocal cal_tmp; |
2980 | Event *event = 0; | 2983 | Event *event = 0; |
2981 | Event *ev = 0; | 2984 | Event *ev = 0; |
2982 | if ( incidence && incidence->type() == "Event" ) { | 2985 | if ( incidence && incidence->type() == "Event" ) { |
2983 | event = static_cast<Event *>(incidence); | 2986 | event = static_cast<Event *>(incidence); |
2984 | ev = new Event(*event); | 2987 | ev = new Event(*event); |
2985 | cal_tmp.addEvent(ev); | 2988 | cal_tmp.addEvent(ev); |
2986 | } | 2989 | } |
2987 | ICalFormat mForm(); | 2990 | ICalFormat mForm(); |
2988 | QString attachment = mForm.toString( &cal_tmp ); | 2991 | QString attachment = mForm.toString( &cal_tmp ); |
2989 | if (ev) delete(ev); | 2992 | if (ev) delete(ev); |
2990 | 2993 | ||
2991 | mailClient.mailAttendees(currentSelection(), attachment); | 2994 | mailClient.mailAttendees(currentSelection(), attachment); |
2992 | 2995 | ||
2993 | #endif | 2996 | #endif |
2994 | 2997 | ||
2995 | #if 0 | 2998 | #if 0 |
2996 | Event *anEvent = 0; | 2999 | Event *anEvent = 0; |
2997 | if (mViewManager->currentView()->isEventView()) { | 3000 | if (mViewManager->currentView()->isEventView()) { |
2998 | anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first()); | 3001 | anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first()); |
2999 | } | 3002 | } |
3000 | 3003 | ||
3001 | if (!anEvent) { | 3004 | if (!anEvent) { |
3002 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); | 3005 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); |
3003 | return; | 3006 | return; |
3004 | } | 3007 | } |
3005 | if(anEvent->attendeeCount() == 0 ) { | 3008 | if(anEvent->attendeeCount() == 0 ) { |
3006 | KMessageBox::sorry(this, | 3009 | KMessageBox::sorry(this, |
3007 | i18n("Can't generate mail:\nNo attendees defined.\n")); | 3010 | i18n("Can't generate mail:\nNo attendees defined.\n")); |
3008 | return; | 3011 | return; |
3009 | } | 3012 | } |
3010 | 3013 | ||
3011 | mailobject.emailEvent(anEvent); | 3014 | mailobject.emailEvent(anEvent); |
3012 | #endif | 3015 | #endif |
3013 | } | 3016 | } |
3014 | 3017 | ||
3015 | 3018 | ||
3016 | void CalendarView::schedule_publish(Incidence *incidence) | 3019 | void CalendarView::schedule_publish(Incidence *incidence) |
3017 | { | 3020 | { |
3018 | Event *event = 0; | 3021 | Event *event = 0; |
3019 | Todo *todo = 0; | 3022 | Todo *todo = 0; |
3020 | 3023 | ||
3021 | if (incidence == 0) { | 3024 | if (incidence == 0) { |
3022 | incidence = mViewManager->currentView()->selectedIncidences().first(); | 3025 | incidence = mViewManager->currentView()->selectedIncidences().first(); |
3023 | if (incidence == 0) { | 3026 | if (incidence == 0) { |
3024 | incidence = mTodoList->selectedIncidences().first(); | 3027 | incidence = mTodoList->selectedIncidences().first(); |
3025 | } | 3028 | } |
3026 | } | 3029 | } |
3027 | if ( incidence && incidence->type() == "Event" ) { | 3030 | if ( incidence && incidence->type() == "Event" ) { |
3028 | event = static_cast<Event *>(incidence); | 3031 | event = static_cast<Event *>(incidence); |
3029 | } else { | 3032 | } else { |
3030 | if ( incidence && incidence->type() == "Todo" ) { | 3033 | if ( incidence && incidence->type() == "Todo" ) { |
3031 | todo = static_cast<Todo *>(incidence); | 3034 | todo = static_cast<Todo *>(incidence); |
3032 | } | 3035 | } |
3033 | } | 3036 | } |
3034 | 3037 | ||
3035 | if (!event && !todo) { | 3038 | if (!event && !todo) { |
3036 | KMessageBox::sorry(this,i18n("No event selected.")); | 3039 | KMessageBox::sorry(this,i18n("No event selected.")); |
3037 | return; | 3040 | return; |
3038 | } | 3041 | } |
3039 | 3042 | ||
3040 | PublishDialog *publishdlg = new PublishDialog(); | 3043 | PublishDialog *publishdlg = new PublishDialog(); |
3041 | if (incidence->attendeeCount()>0) { | 3044 | if (incidence->attendeeCount()>0) { |
3042 | QPtrList<Attendee> attendees = incidence->attendees(); | 3045 | QPtrList<Attendee> attendees = incidence->attendees(); |
3043 | attendees.first(); | 3046 | attendees.first(); |
3044 | while ( attendees.current()!=0 ) { | 3047 | while ( attendees.current()!=0 ) { |
3045 | publishdlg->addAttendee(attendees.current()); | 3048 | publishdlg->addAttendee(attendees.current()); |
3046 | attendees.next(); | 3049 | attendees.next(); |
3047 | } | 3050 | } |
3048 | } | 3051 | } |
3049 | bool send = true; | 3052 | bool send = true; |
3050 | if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) { | 3053 | if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) { |
3051 | if ( publishdlg->exec() != QDialog::Accepted ) | 3054 | if ( publishdlg->exec() != QDialog::Accepted ) |
3052 | send = false; | 3055 | send = false; |
3053 | } | 3056 | } |
3054 | if ( send ) { | 3057 | if ( send ) { |
3055 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); | 3058 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); |
3056 | if ( event ) { | 3059 | if ( event ) { |
3057 | Event *ev = new Event(*event); | 3060 | Event *ev = new Event(*event); |
3058 | ev->registerObserver(0); | 3061 | ev->registerObserver(0); |
3059 | ev->clearAttendees(); | 3062 | ev->clearAttendees(); |
3060 | if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { | 3063 | if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { |
3061 | delete(ev); | 3064 | delete(ev); |
3062 | } | 3065 | } |
3063 | } else { | 3066 | } else { |
3064 | if ( todo ) { | 3067 | if ( todo ) { |
3065 | Todo *ev = new Todo(*todo); | 3068 | Todo *ev = new Todo(*todo); |
3066 | ev->registerObserver(0); | 3069 | ev->registerObserver(0); |
3067 | ev->clearAttendees(); | 3070 | ev->clearAttendees(); |
3068 | if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { | 3071 | if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { |
3069 | delete(ev); | 3072 | delete(ev); |
3070 | } | 3073 | } |
3071 | } | 3074 | } |
3072 | } | 3075 | } |
3073 | } | 3076 | } |
3074 | delete publishdlg; | 3077 | delete publishdlg; |
3075 | } | 3078 | } |
3076 | 3079 | ||
3077 | void CalendarView::schedule_request(Incidence *incidence) | 3080 | void CalendarView::schedule_request(Incidence *incidence) |
3078 | { | 3081 | { |
3079 | schedule(Scheduler::Request,incidence); | 3082 | schedule(Scheduler::Request,incidence); |
3080 | } | 3083 | } |
3081 | 3084 | ||
3082 | void CalendarView::schedule_refresh(Incidence *incidence) | 3085 | void CalendarView::schedule_refresh(Incidence *incidence) |
3083 | { | 3086 | { |
3084 | schedule(Scheduler::Refresh,incidence); | 3087 | schedule(Scheduler::Refresh,incidence); |
3085 | } | 3088 | } |
3086 | 3089 | ||
3087 | void CalendarView::schedule_cancel(Incidence *incidence) | 3090 | void CalendarView::schedule_cancel(Incidence *incidence) |
3088 | { | 3091 | { |
3089 | schedule(Scheduler::Cancel,incidence); | 3092 | schedule(Scheduler::Cancel,incidence); |
3090 | } | 3093 | } |
3091 | 3094 | ||
3092 | void CalendarView::schedule_add(Incidence *incidence) | 3095 | void CalendarView::schedule_add(Incidence *incidence) |
3093 | { | 3096 | { |
3094 | schedule(Scheduler::Add,incidence); | 3097 | schedule(Scheduler::Add,incidence); |
3095 | } | 3098 | } |
3096 | 3099 | ||
3097 | void CalendarView::schedule_reply(Incidence *incidence) | 3100 | void CalendarView::schedule_reply(Incidence *incidence) |
3098 | { | 3101 | { |
3099 | schedule(Scheduler::Reply,incidence); | 3102 | schedule(Scheduler::Reply,incidence); |
3100 | } | 3103 | } |
3101 | 3104 | ||
3102 | void CalendarView::schedule_counter(Incidence *incidence) | 3105 | void CalendarView::schedule_counter(Incidence *incidence) |
3103 | { | 3106 | { |
3104 | schedule(Scheduler::Counter,incidence); | 3107 | schedule(Scheduler::Counter,incidence); |
3105 | } | 3108 | } |
3106 | 3109 | ||
3107 | void CalendarView::schedule_declinecounter(Incidence *incidence) | 3110 | void CalendarView::schedule_declinecounter(Incidence *incidence) |
3108 | { | 3111 | { |
3109 | schedule(Scheduler::Declinecounter,incidence); | 3112 | schedule(Scheduler::Declinecounter,incidence); |
3110 | } | 3113 | } |
3111 | 3114 | ||
3112 | void CalendarView::schedule_publish_freebusy(int daysToPublish) | 3115 | void CalendarView::schedule_publish_freebusy(int daysToPublish) |
3113 | { | 3116 | { |
3114 | QDateTime start = QDateTime::currentDateTime(); | 3117 | QDateTime start = QDateTime::currentDateTime(); |
3115 | QDateTime end = start.addDays(daysToPublish); | 3118 | QDateTime end = start.addDays(daysToPublish); |
3116 | 3119 | ||
3117 | FreeBusy *freebusy = new FreeBusy(mCalendar, start, end); | 3120 | FreeBusy *freebusy = new FreeBusy(mCalendar, start, end); |
3118 | freebusy->setOrganizer(KOPrefs::instance()->email()); | 3121 | freebusy->setOrganizer(KOPrefs::instance()->email()); |
3119 | 3122 | ||
3120 | 3123 | ||
3121 | PublishDialog *publishdlg = new PublishDialog(); | 3124 | PublishDialog *publishdlg = new PublishDialog(); |
3122 | if ( publishdlg->exec() == QDialog::Accepted ) { | 3125 | if ( publishdlg->exec() == QDialog::Accepted ) { |
3123 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); | 3126 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); |
3124 | if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) { | 3127 | if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) { |
3125 | delete(freebusy); | 3128 | delete(freebusy); |
3126 | } | 3129 | } |
3127 | } | 3130 | } |
3128 | delete publishdlg; | 3131 | delete publishdlg; |
3129 | } | 3132 | } |
3130 | 3133 | ||
3131 | void CalendarView::schedule(Scheduler::Method method, Incidence *incidence) | 3134 | void CalendarView::schedule(Scheduler::Method method, Incidence *incidence) |
3132 | { | 3135 | { |
3133 | Event *event = 0; | 3136 | Event *event = 0; |
3134 | Todo *todo = 0; | 3137 | Todo *todo = 0; |
3135 | 3138 | ||
3136 | if (incidence == 0) { | 3139 | if (incidence == 0) { |
3137 | incidence = mViewManager->currentView()->selectedIncidences().first(); | 3140 | incidence = mViewManager->currentView()->selectedIncidences().first(); |
3138 | if (incidence == 0) { | 3141 | if (incidence == 0) { |
3139 | incidence = mTodoList->selectedIncidences().first(); | 3142 | incidence = mTodoList->selectedIncidences().first(); |
3140 | } | 3143 | } |
3141 | } | 3144 | } |
3142 | if ( incidence && incidence->type() == "Event" ) { | 3145 | if ( incidence && incidence->type() == "Event" ) { |
3143 | event = static_cast<Event *>(incidence); | 3146 | event = static_cast<Event *>(incidence); |
3144 | } | 3147 | } |
3145 | if ( incidence && incidence->type() == "Todo" ) { | 3148 | if ( incidence && incidence->type() == "Todo" ) { |
3146 | todo = static_cast<Todo *>(incidence); | 3149 | todo = static_cast<Todo *>(incidence); |
3147 | } | 3150 | } |
3148 | 3151 | ||
3149 | if (!event && !todo) { | 3152 | if (!event && !todo) { |
3150 | KMessageBox::sorry(this,i18n("No event selected.")); | 3153 | KMessageBox::sorry(this,i18n("No event selected.")); |
3151 | return; | 3154 | return; |
3152 | } | 3155 | } |
3153 | 3156 | ||
3154 | if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) { | 3157 | if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) { |
3155 | KMessageBox::sorry(this,i18n("The event has no attendees.")); | 3158 | KMessageBox::sorry(this,i18n("The event has no attendees.")); |
3156 | return; | 3159 | return; |
3157 | } | 3160 | } |
3158 | 3161 | ||
3159 | Event *ev = 0; | 3162 | Event *ev = 0; |
3160 | if (event) ev = new Event(*event); | 3163 | if (event) ev = new Event(*event); |
3161 | Todo *to = 0; | 3164 | Todo *to = 0; |
3162 | if (todo) to = new Todo(*todo); | 3165 | if (todo) to = new Todo(*todo); |
3163 | 3166 | ||
3164 | if (method == Scheduler::Reply || method == Scheduler::Refresh) { | 3167 | if (method == Scheduler::Reply || method == Scheduler::Refresh) { |
3165 | Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); | 3168 | Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); |
3166 | if (!me) { | 3169 | if (!me) { |
3167 | KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails.")); | 3170 | KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails.")); |
3168 | return; | 3171 | return; |
3169 | } | 3172 | } |
3170 | if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) { | 3173 | if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) { |
3171 | StatusDialog *statdlg = new StatusDialog(this); | 3174 | StatusDialog *statdlg = new StatusDialog(this); |
3172 | if (!statdlg->exec()==QDialog::Accepted) return; | 3175 | if (!statdlg->exec()==QDialog::Accepted) return; |
3173 | me->setStatus( statdlg->status() ); | 3176 | me->setStatus( statdlg->status() ); |
3174 | delete(statdlg); | 3177 | delete(statdlg); |
3175 | } | 3178 | } |
3176 | Attendee *menew = new Attendee(*me); | 3179 | Attendee *menew = new Attendee(*me); |
3177 | if (ev) { | 3180 | if (ev) { |
3178 | ev->clearAttendees(); | 3181 | ev->clearAttendees(); |
3179 | ev->addAttendee(menew,false); | 3182 | ev->addAttendee(menew,false); |
3180 | } else { | 3183 | } else { |
3181 | if (to) { | 3184 | if (to) { |
3182 | todo->clearAttendees(); | 3185 | todo->clearAttendees(); |
3183 | todo->addAttendee(menew,false); | 3186 | todo->addAttendee(menew,false); |
3184 | } | 3187 | } |
3185 | } | 3188 | } |
3186 | } | 3189 | } |
3187 | 3190 | ||
3188 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); | 3191 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); |
3189 | if (ev) { | 3192 | if (ev) { |
3190 | if ( !dlg->addMessage(ev,method) ) delete(ev); | 3193 | if ( !dlg->addMessage(ev,method) ) delete(ev); |
3191 | } else { | 3194 | } else { |
3192 | if (to) { | 3195 | if (to) { |
3193 | if ( !dlg->addMessage(to,method) ) delete(to); | 3196 | if ( !dlg->addMessage(to,method) ) delete(to); |
3194 | } | 3197 | } |
3195 | } | 3198 | } |
3196 | } | 3199 | } |
3197 | 3200 | ||
3198 | void CalendarView::openAddressbook() | 3201 | void CalendarView::openAddressbook() |
3199 | { | 3202 | { |
3200 | KRun::runCommand("kaddressbook"); | 3203 | KRun::runCommand("kaddressbook"); |
3201 | } | 3204 | } |
3202 | 3205 | ||
3203 | void CalendarView::setModified(bool modified) | 3206 | void CalendarView::setModified(bool modified) |
3204 | { | 3207 | { |
3205 | if ( modified ) | 3208 | if ( modified ) |
3206 | emit signalmodified(); | 3209 | emit signalmodified(); |
3207 | if (mModified != modified) { | 3210 | if (mModified != modified) { |
3208 | mModified = modified; | 3211 | mModified = modified; |
3209 | emit modifiedChanged(mModified); | 3212 | emit modifiedChanged(mModified); |
3210 | } | 3213 | } |
3211 | } | 3214 | } |
3212 | 3215 | ||
3213 | bool CalendarView::isReadOnly() | 3216 | bool CalendarView::isReadOnly() |
3214 | { | 3217 | { |
3215 | return mReadOnly; | 3218 | return mReadOnly; |
3216 | } | 3219 | } |
3217 | 3220 | ||
3218 | void CalendarView::setReadOnly(bool readOnly) | 3221 | void CalendarView::setReadOnly(bool readOnly) |
3219 | { | 3222 | { |
3220 | if (mReadOnly != readOnly) { | 3223 | if (mReadOnly != readOnly) { |
3221 | mReadOnly = readOnly; | 3224 | mReadOnly = readOnly; |
3222 | emit readOnlyChanged(mReadOnly); | 3225 | emit readOnlyChanged(mReadOnly); |
3223 | } | 3226 | } |
3224 | } | 3227 | } |
3225 | 3228 | ||
3226 | bool CalendarView::isModified() | 3229 | bool CalendarView::isModified() |
3227 | { | 3230 | { |
3228 | return mModified; | 3231 | return mModified; |
3229 | } | 3232 | } |
3230 | 3233 | ||
3231 | void CalendarView::printSetup() | 3234 | void CalendarView::printSetup() |
3232 | { | 3235 | { |
3233 | #ifndef KORG_NOPRINTER | 3236 | #ifndef KORG_NOPRINTER |
3234 | createPrinter(); | 3237 | createPrinter(); |
3235 | 3238 | ||
3236 | mCalPrinter->setupPrinter(); | 3239 | mCalPrinter->setupPrinter(); |
3237 | #endif | 3240 | #endif |
3238 | } | 3241 | } |
3239 | 3242 | ||
3240 | void CalendarView::print() | 3243 | void CalendarView::print() |
3241 | { | 3244 | { |
3242 | #ifndef KORG_NOPRINTER | 3245 | #ifndef KORG_NOPRINTER |
3243 | createPrinter(); | 3246 | createPrinter(); |
3244 | 3247 | ||
3245 | DateList tmpDateList = mNavigator->selectedDates(); | 3248 | DateList tmpDateList = mNavigator->selectedDates(); |
3246 | mCalPrinter->print(CalPrinter::Month, | 3249 | mCalPrinter->print(CalPrinter::Month, |
3247 | tmpDateList.first(), tmpDateList.last()); | 3250 | tmpDateList.first(), tmpDateList.last()); |
3248 | #endif | 3251 | #endif |
3249 | } | 3252 | } |
3250 | 3253 | ||
3251 | void CalendarView::printPreview() | 3254 | void CalendarView::printPreview() |
3252 | { | 3255 | { |
3253 | #ifndef KORG_NOPRINTER | 3256 | #ifndef KORG_NOPRINTER |
3254 | kdDebug() << "CalendarView::printPreview()" << endl; | 3257 | kdDebug() << "CalendarView::printPreview()" << endl; |
3255 | 3258 | ||
3256 | createPrinter(); | 3259 | createPrinter(); |
3257 | 3260 | ||
3258 | DateList tmpDateList = mNavigator->selectedDates(); | 3261 | DateList tmpDateList = mNavigator->selectedDates(); |
3259 | 3262 | ||
3260 | mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(), | 3263 | mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(), |
3261 | tmpDateList.last()); | 3264 | tmpDateList.last()); |
3262 | #endif | 3265 | #endif |
3263 | } | 3266 | } |
3264 | 3267 | ||
3265 | void CalendarView::exportICalendar() | 3268 | void CalendarView::exportICalendar() |
3266 | { | 3269 | { |
3267 | QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this); | 3270 | QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this); |
3268 | 3271 | ||
3269 | // Force correct extension | 3272 | // Force correct extension |
3270 | if (filename.right(4) != ".ics") filename += ".ics"; | 3273 | if (filename.right(4) != ".ics") filename += ".ics"; |
3271 | 3274 | ||
3272 | FileStorage storage( mCalendar, filename, new ICalFormat() ); | 3275 | FileStorage storage( mCalendar, filename, new ICalFormat() ); |
3273 | storage.save(); | 3276 | storage.save(); |
3274 | } | 3277 | } |
3275 | 3278 | ||
3276 | bool CalendarView::exportVCalendar( QString filename ) | 3279 | bool CalendarView::exportVCalendar( QString filename ) |
3277 | { | 3280 | { |
3278 | if (mCalendar->journals().count() > 0) { | 3281 | if (mCalendar->journals().count() > 0) { |
3279 | int result = KMessageBox::warningContinueCancel(this, | 3282 | int result = KMessageBox::warningContinueCancel(this, |
3280 | i18n("The journal entries can not be\nexported to a vCalendar file."), | 3283 | i18n("The journal entries can not be\nexported to a vCalendar file."), |
3281 | i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), | 3284 | i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), |
3282 | true); | 3285 | true); |
3283 | if (result != KMessageBox::Continue) return false; | 3286 | if (result != KMessageBox::Continue) return false; |
3284 | } | 3287 | } |
3285 | 3288 | ||
3286 | //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this); | 3289 | //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this); |
3287 | 3290 | ||
3288 | // Force correct extension | 3291 | // Force correct extension |
3289 | if (filename.right(4) != ".vcs") filename += ".vcs"; | 3292 | if (filename.right(4) != ".vcs") filename += ".vcs"; |
3290 | 3293 | ||
3291 | FileStorage storage( mCalendar, filename, new VCalFormat ); | 3294 | FileStorage storage( mCalendar, filename, new VCalFormat ); |
3292 | return storage.save(); | 3295 | return storage.save(); |
3293 | 3296 | ||
3294 | } | 3297 | } |
3295 | 3298 | ||
3296 | void CalendarView::eventUpdated(Incidence *) | 3299 | void CalendarView::eventUpdated(Incidence *) |
3297 | { | 3300 | { |
3298 | setModified(); | 3301 | setModified(); |
3299 | // Don't call updateView here. The code, which has caused the update of the | 3302 | // Don't call updateView here. The code, which has caused the update of the |
3300 | // event is responsible for updating the view. | 3303 | // event is responsible for updating the view. |
3301 | // updateView(); | 3304 | // updateView(); |
3302 | } | 3305 | } |
3303 | 3306 | ||
3304 | void CalendarView::adaptNavigationUnits() | 3307 | void CalendarView::adaptNavigationUnits() |
3305 | { | 3308 | { |
3306 | if (mViewManager->currentView()->isEventView()) { | 3309 | if (mViewManager->currentView()->isEventView()) { |
3307 | int days = mViewManager->currentView()->currentDateCount(); | 3310 | int days = mViewManager->currentView()->currentDateCount(); |
3308 | if (days == 1) { | 3311 | if (days == 1) { |
3309 | emit changeNavStringPrev(i18n("&Previous Day")); | 3312 | emit changeNavStringPrev(i18n("&Previous Day")); |
3310 | emit changeNavStringNext(i18n("&Next Day")); | 3313 | emit changeNavStringNext(i18n("&Next Day")); |
3311 | } else { | 3314 | } else { |
3312 | emit changeNavStringPrev(i18n("&Previous Week")); | 3315 | emit changeNavStringPrev(i18n("&Previous Week")); |
3313 | emit changeNavStringNext(i18n("&Next Week")); | 3316 | emit changeNavStringNext(i18n("&Next Week")); |
3314 | } | 3317 | } |
3315 | } | 3318 | } |
3316 | } | 3319 | } |
3317 | 3320 | ||
3318 | void CalendarView::processMainViewSelection( Incidence *incidence ) | 3321 | void CalendarView::processMainViewSelection( Incidence *incidence ) |
3319 | { | 3322 | { |
3320 | if ( incidence ) mTodoList->clearSelection(); | 3323 | if ( incidence ) mTodoList->clearSelection(); |
3321 | processIncidenceSelection( incidence ); | 3324 | processIncidenceSelection( incidence ); |
3322 | } | 3325 | } |
3323 | 3326 | ||
3324 | void CalendarView::processTodoListSelection( Incidence *incidence ) | 3327 | void CalendarView::processTodoListSelection( Incidence *incidence ) |
3325 | { | 3328 | { |
3326 | if ( incidence && mViewManager->currentView() ) { | 3329 | if ( incidence && mViewManager->currentView() ) { |
3327 | mViewManager->currentView()->clearSelection(); | 3330 | mViewManager->currentView()->clearSelection(); |
3328 | } | 3331 | } |
3329 | processIncidenceSelection( incidence ); | 3332 | processIncidenceSelection( incidence ); |
3330 | } | 3333 | } |
3331 | 3334 | ||
3332 | void CalendarView::processIncidenceSelection( Incidence *incidence ) | 3335 | void CalendarView::processIncidenceSelection( Incidence *incidence ) |
3333 | { | 3336 | { |
3334 | if ( incidence == mSelectedIncidence ) return; | 3337 | if ( incidence == mSelectedIncidence ) return; |
3335 | 3338 | ||
3336 | mSelectedIncidence = incidence; | 3339 | mSelectedIncidence = incidence; |
3337 | 3340 | ||
3338 | emit incidenceSelected( mSelectedIncidence ); | 3341 | emit incidenceSelected( mSelectedIncidence ); |
3339 | 3342 | ||
3340 | if ( incidence && incidence->type() == "Event" ) { | 3343 | if ( incidence && incidence->type() == "Event" ) { |
3341 | Event *event = static_cast<Event *>( incidence ); | 3344 | Event *event = static_cast<Event *>( incidence ); |
3342 | if ( event->organizer() == KOPrefs::instance()->email() ) { | 3345 | if ( event->organizer() == KOPrefs::instance()->email() ) { |
3343 | emit organizerEventsSelected( true ); | 3346 | emit organizerEventsSelected( true ); |
3344 | } else { | 3347 | } else { |
3345 | emit organizerEventsSelected(false); | 3348 | emit organizerEventsSelected(false); |
3346 | } | 3349 | } |
3347 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, | 3350 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, |
3348 | KOPrefs::instance()->email() ) ) { | 3351 | KOPrefs::instance()->email() ) ) { |
3349 | emit groupEventsSelected( true ); | 3352 | emit groupEventsSelected( true ); |
3350 | } else { | 3353 | } else { |
3351 | emit groupEventsSelected(false); | 3354 | emit groupEventsSelected(false); |
3352 | } | 3355 | } |
3353 | return; | 3356 | return; |
3354 | } else { | 3357 | } else { |
3355 | if ( incidence && incidence->type() == "Todo" ) { | 3358 | if ( incidence && incidence->type() == "Todo" ) { |
3356 | emit todoSelected( true ); | 3359 | emit todoSelected( true ); |
3357 | Todo *event = static_cast<Todo *>( incidence ); | 3360 | Todo *event = static_cast<Todo *>( incidence ); |
3358 | if ( event->organizer() == KOPrefs::instance()->email() ) { | 3361 | if ( event->organizer() == KOPrefs::instance()->email() ) { |
3359 | emit organizerEventsSelected( true ); | 3362 | emit organizerEventsSelected( true ); |
3360 | } else { | 3363 | } else { |
3361 | emit organizerEventsSelected(false); | 3364 | emit organizerEventsSelected(false); |
3362 | } | 3365 | } |
3363 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, | 3366 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, |
3364 | KOPrefs::instance()->email() ) ) { | 3367 | KOPrefs::instance()->email() ) ) { |
3365 | emit groupEventsSelected( true ); | 3368 | emit groupEventsSelected( true ); |
3366 | } else { | 3369 | } else { |
3367 | emit groupEventsSelected(false); | 3370 | emit groupEventsSelected(false); |
3368 | } | 3371 | } |
3369 | return; | 3372 | return; |
3370 | } else { | 3373 | } else { |
3371 | emit todoSelected( false ); | 3374 | emit todoSelected( false ); |
3372 | emit organizerEventsSelected(false); | 3375 | emit organizerEventsSelected(false); |
3373 | emit groupEventsSelected(false); | 3376 | emit groupEventsSelected(false); |
3374 | } | 3377 | } |
3375 | return; | 3378 | return; |
3376 | } | 3379 | } |
3377 | 3380 | ||
3378 | /* if ( incidence && incidence->type() == "Todo" ) { | 3381 | /* if ( incidence && incidence->type() == "Todo" ) { |
3379 | emit todoSelected( true ); | 3382 | emit todoSelected( true ); |
3380 | } else { | 3383 | } else { |
3381 | emit todoSelected( false ); | 3384 | emit todoSelected( false ); |
3382 | }*/ | 3385 | }*/ |
3383 | } | 3386 | } |
3384 | 3387 | ||
3385 | 3388 | ||
3386 | void CalendarView::checkClipboard() | 3389 | void CalendarView::checkClipboard() |
3387 | { | 3390 | { |
3388 | #ifndef KORG_NODND | 3391 | #ifndef KORG_NODND |
3389 | if (ICalDrag::canDecode(QApplication::clipboard()->data())) { | 3392 | if (ICalDrag::canDecode(QApplication::clipboard()->data())) { |
3390 | emit pasteEnabled(true); | 3393 | emit pasteEnabled(true); |
3391 | } else { | 3394 | } else { |
3392 | emit pasteEnabled(false); | 3395 | emit pasteEnabled(false); |
3393 | } | 3396 | } |
3394 | #endif | 3397 | #endif |
3395 | } | 3398 | } |
3396 | 3399 | ||
3397 | void CalendarView::showDates(const DateList &selectedDates) | 3400 | void CalendarView::showDates(const DateList &selectedDates) |
3398 | { | 3401 | { |
3399 | // kdDebug() << "CalendarView::selectDates()" << endl; | 3402 | // kdDebug() << "CalendarView::selectDates()" << endl; |
3400 | 3403 | ||
3401 | if ( mViewManager->currentView() ) { | 3404 | if ( mViewManager->currentView() ) { |
3402 | updateView( selectedDates.first(), selectedDates.last() ); | 3405 | updateView( selectedDates.first(), selectedDates.last() ); |
3403 | } else { | 3406 | } else { |
3404 | mViewManager->showAgendaView(); | 3407 | mViewManager->showAgendaView(); |
3405 | } | 3408 | } |
3406 | 3409 | ||
3407 | QString selDates; | 3410 | QString selDates; |
3408 | selDates = KGlobal::locale()->formatDate( selectedDates.first(), true); | 3411 | selDates = KGlobal::locale()->formatDate( selectedDates.first(), true); |
3409 | if (selectedDates.first() < selectedDates.last() ) | 3412 | if (selectedDates.first() < selectedDates.last() ) |
3410 | selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); | 3413 | selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); |
3411 | topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); | 3414 | topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); |
3412 | 3415 | ||
3413 | } | 3416 | } |
3414 | 3417 | ||
3415 | QPtrList<CalFilter> CalendarView::filters() | 3418 | QPtrList<CalFilter> CalendarView::filters() |
3416 | { | 3419 | { |
3417 | return mFilters; | 3420 | return mFilters; |
3418 | 3421 | ||
3419 | } | 3422 | } |
3420 | void CalendarView::editFilters() | 3423 | void CalendarView::editFilters() |
3421 | { | 3424 | { |
3422 | // kdDebug() << "CalendarView::editFilters()" << endl; | 3425 | // kdDebug() << "CalendarView::editFilters()" << endl; |
3423 | 3426 | ||
3424 | CalFilter *filter = mFilters.first(); | 3427 | CalFilter *filter = mFilters.first(); |
3425 | while(filter) { | 3428 | while(filter) { |
3426 | kdDebug() << " Filter: " << filter->name() << endl; | 3429 | kdDebug() << " Filter: " << filter->name() << endl; |
3427 | filter = mFilters.next(); | 3430 | filter = mFilters.next(); |
3428 | } | 3431 | } |
3429 | 3432 | ||
3430 | mDialogManager->showFilterEditDialog(&mFilters); | 3433 | mDialogManager->showFilterEditDialog(&mFilters); |
3431 | } | 3434 | } |
3432 | void CalendarView::toggleFilter() | 3435 | void CalendarView::toggleFilter() |
3433 | { | 3436 | { |
3434 | showFilter(! mFilterView->isVisible()); | 3437 | showFilter(! mFilterView->isVisible()); |
3435 | } | 3438 | } |
3436 | 3439 | ||
3437 | KOFilterView *CalendarView::filterView() | 3440 | KOFilterView *CalendarView::filterView() |
3438 | { | 3441 | { |
3439 | return mFilterView; | 3442 | return mFilterView; |
3440 | } | 3443 | } |
3441 | void CalendarView::selectFilter( int fil ) | 3444 | void CalendarView::selectFilter( int fil ) |
3442 | { | 3445 | { |
3443 | mFilterView->setSelectedFilter( fil ); | 3446 | mFilterView->setSelectedFilter( fil ); |
3444 | } | 3447 | } |
3445 | void CalendarView::showFilter(bool visible) | 3448 | void CalendarView::showFilter(bool visible) |
3446 | { | 3449 | { |
3447 | if (visible) mFilterView->show(); | 3450 | if (visible) mFilterView->show(); |
3448 | else mFilterView->hide(); | 3451 | else mFilterView->hide(); |
3449 | } | 3452 | } |
3450 | void CalendarView::toggleFilerEnabled( ) | 3453 | void CalendarView::toggleFilerEnabled( ) |
3451 | { | 3454 | { |
3452 | mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); | 3455 | mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); |
3453 | if ( !mFilterView->filtersEnabled() ) | 3456 | if ( !mFilterView->filtersEnabled() ) |
3454 | topLevelWidget()->setCaption( i18n("Filter disabled ") ); | 3457 | topLevelWidget()->setCaption( i18n("Filter disabled ") ); |
3455 | 3458 | ||
3456 | } | 3459 | } |
3457 | void CalendarView::updateFilter() | 3460 | void CalendarView::updateFilter() |
3458 | { | 3461 | { |
3459 | CalFilter *filter = mFilterView->selectedFilter(); | 3462 | CalFilter *filter = mFilterView->selectedFilter(); |
3460 | if (filter) { | 3463 | if (filter) { |
3461 | if (mFilterView->filtersEnabled()) { | 3464 | if (mFilterView->filtersEnabled()) { |
3462 | topLevelWidget()->setCaption( i18n("Filter selected: ")+filter->name() ); | 3465 | topLevelWidget()->setCaption( i18n("Filter selected: ")+filter->name() ); |
3463 | filter->setEnabled(true); | 3466 | filter->setEnabled(true); |
3464 | } | 3467 | } |
3465 | else filter->setEnabled(false); | 3468 | else filter->setEnabled(false); |
3466 | mCalendar->setFilter(filter); | 3469 | mCalendar->setFilter(filter); |
3467 | updateView(); | 3470 | updateView(); |
3468 | } | 3471 | } |
3469 | } | 3472 | } |
3470 | 3473 | ||
3471 | void CalendarView::filterEdited() | 3474 | void CalendarView::filterEdited() |
3472 | { | 3475 | { |
3473 | mFilterView->updateFilters(); | 3476 | mFilterView->updateFilters(); |
3474 | updateFilter(); | 3477 | updateFilter(); |
3475 | writeSettings(); | 3478 | writeSettings(); |
3476 | } | 3479 | } |
3477 | 3480 | ||
3478 | 3481 | ||
3479 | void CalendarView::takeOverEvent() | 3482 | void CalendarView::takeOverEvent() |
3480 | { | 3483 | { |
3481 | Incidence *incidence = currentSelection(); | 3484 | Incidence *incidence = currentSelection(); |
3482 | 3485 | ||
3483 | if (!incidence) return; | 3486 | if (!incidence) return; |
3484 | 3487 | ||
3485 | incidence->setOrganizer(KOPrefs::instance()->email()); | 3488 | incidence->setOrganizer(KOPrefs::instance()->email()); |
3486 | incidence->recreate(); | 3489 | incidence->recreate(); |
3487 | incidence->setReadOnly(false); | 3490 | incidence->setReadOnly(false); |
3488 | 3491 | ||
3489 | updateView(); | 3492 | updateView(); |
3490 | } | 3493 | } |
3491 | 3494 | ||
3492 | void CalendarView::takeOverCalendar() | 3495 | void CalendarView::takeOverCalendar() |
3493 | { | 3496 | { |
3494 | // TODO: Create Calendar::allIncidences() function and use it here | 3497 | // TODO: Create Calendar::allIncidences() function and use it here |
3495 | 3498 | ||
3496 | QPtrList<Event> events = mCalendar->events(); | 3499 | QPtrList<Event> events = mCalendar->events(); |
3497 | for(uint i=0; i<events.count(); ++i) { | 3500 | for(uint i=0; i<events.count(); ++i) { |
3498 | events.at(i)->setOrganizer(KOPrefs::instance()->email()); | 3501 | events.at(i)->setOrganizer(KOPrefs::instance()->email()); |
3499 | events.at(i)->recreate(); | 3502 | events.at(i)->recreate(); |
3500 | events.at(i)->setReadOnly(false); | 3503 | events.at(i)->setReadOnly(false); |
3501 | } | 3504 | } |
3502 | 3505 | ||
3503 | QPtrList<Todo> todos = mCalendar->todos(); | 3506 | QPtrList<Todo> todos = mCalendar->todos(); |
3504 | for(uint i=0; i<todos.count(); ++i) { | 3507 | for(uint i=0; i<todos.count(); ++i) { |
3505 | todos.at(i)->setOrganizer(KOPrefs::instance()->email()); | 3508 | todos.at(i)->setOrganizer(KOPrefs::instance()->email()); |
3506 | todos.at(i)->recreate(); | 3509 | todos.at(i)->recreate(); |
3507 | todos.at(i)->setReadOnly(false); | 3510 | todos.at(i)->setReadOnly(false); |
3508 | } | 3511 | } |
3509 | 3512 | ||
3510 | QPtrList<Journal> journals = mCalendar->journals(); | 3513 | QPtrList<Journal> journals = mCalendar->journals(); |
3511 | for(uint i=0; i<journals.count(); ++i) { | 3514 | for(uint i=0; i<journals.count(); ++i) { |
3512 | journals.at(i)->setOrganizer(KOPrefs::instance()->email()); | 3515 | journals.at(i)->setOrganizer(KOPrefs::instance()->email()); |
3513 | journals.at(i)->recreate(); | 3516 | journals.at(i)->recreate(); |
3514 | journals.at(i)->setReadOnly(false); | 3517 | journals.at(i)->setReadOnly(false); |
3515 | } | 3518 | } |
3516 | 3519 | ||
3517 | updateView(); | 3520 | updateView(); |
3518 | } | 3521 | } |
3519 | 3522 | ||
3520 | void CalendarView::showIntro() | 3523 | void CalendarView::showIntro() |
3521 | { | 3524 | { |
3522 | kdDebug() << "To be implemented." << endl; | 3525 | kdDebug() << "To be implemented." << endl; |
3523 | } | 3526 | } |
3524 | 3527 | ||
3525 | QWidgetStack *CalendarView::viewStack() | 3528 | QWidgetStack *CalendarView::viewStack() |
3526 | { | 3529 | { |
3527 | return mRightFrame; | 3530 | return mRightFrame; |
3528 | } | 3531 | } |
3529 | 3532 | ||
3530 | QWidget *CalendarView::leftFrame() | 3533 | QWidget *CalendarView::leftFrame() |
3531 | { | 3534 | { |
3532 | return mLeftFrame; | 3535 | return mLeftFrame; |
3533 | } | 3536 | } |
3534 | 3537 | ||
3535 | DateNavigator *CalendarView::dateNavigator() | 3538 | DateNavigator *CalendarView::dateNavigator() |
3536 | { | 3539 | { |
3537 | return mNavigator; | 3540 | return mNavigator; |
3538 | } | 3541 | } |
3539 | 3542 | ||
3540 | KDateNavigator* CalendarView::dateNavigatorWidget() | 3543 | KDateNavigator* CalendarView::dateNavigatorWidget() |
3541 | { | 3544 | { |
3542 | return mDateNavigator; | 3545 | return mDateNavigator; |
3543 | } | 3546 | } |
3544 | void CalendarView::toggleDateNavigatorWidget() | 3547 | void CalendarView::toggleDateNavigatorWidget() |
3545 | { | 3548 | { |
3546 | if (mDateNavigator->isVisible()) | 3549 | if (mDateNavigator->isVisible()) |
3547 | mDateNavigator->hide(); | 3550 | mDateNavigator->hide(); |
3548 | else | 3551 | else |
3549 | mDateNavigator->show(); | 3552 | mDateNavigator->show(); |
3550 | } | 3553 | } |
3551 | void CalendarView::addView(KOrg::BaseView *view) | 3554 | void CalendarView::addView(KOrg::BaseView *view) |
3552 | { | 3555 | { |
3553 | mViewManager->addView(view); | 3556 | mViewManager->addView(view); |
3554 | } | 3557 | } |
3555 | 3558 | ||
3556 | void CalendarView::showView(KOrg::BaseView *view) | 3559 | void CalendarView::showView(KOrg::BaseView *view) |
3557 | { | 3560 | { |
3558 | mViewManager->showView(view, mLeftFrame->isVisible()); | 3561 | mViewManager->showView(view, mLeftFrame->isVisible()); |
3559 | } | 3562 | } |
3560 | 3563 | ||
3561 | Incidence *CalendarView::currentSelection() | 3564 | Incidence *CalendarView::currentSelection() |
3562 | { | 3565 | { |
3563 | return mViewManager->currentSelection(); | 3566 | return mViewManager->currentSelection(); |
3564 | } | 3567 | } |
3565 | void CalendarView::toggleAllDaySize() | 3568 | void CalendarView::toggleAllDaySize() |
3566 | { | 3569 | { |
3567 | /* | 3570 | /* |
3568 | if ( KOPrefs::instance()->mAllDaySize > 47 ) | 3571 | if ( KOPrefs::instance()->mAllDaySize > 47 ) |
3569 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; | 3572 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; |
3570 | else | 3573 | else |
3571 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; | 3574 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; |
3572 | */ | 3575 | */ |
3573 | viewManager()->agendaView()->toggleAllDay(); | 3576 | viewManager()->agendaView()->toggleAllDay(); |
3574 | } | 3577 | } |
3575 | void CalendarView::toggleExpand() | 3578 | void CalendarView::toggleExpand() |
3576 | { | 3579 | { |
3577 | // if ( mLeftFrame->isHidden() ) { | 3580 | // if ( mLeftFrame->isHidden() ) { |
3578 | // mLeftFrame->show(); | 3581 | // mLeftFrame->show(); |
3579 | // emit calendarViewExpanded( false ); | 3582 | // emit calendarViewExpanded( false ); |
3580 | // } else { | 3583 | // } else { |
3581 | // mLeftFrame->hide(); | 3584 | // mLeftFrame->hide(); |
3582 | // emit calendarViewExpanded( true ); | 3585 | // emit calendarViewExpanded( true ); |
3583 | // } | 3586 | // } |
3584 | 3587 | ||
3585 | globalFlagBlockAgenda = 1; | 3588 | globalFlagBlockAgenda = 1; |
3586 | emit calendarViewExpanded( !mLeftFrame->isHidden() ); | 3589 | emit calendarViewExpanded( !mLeftFrame->isHidden() ); |
3587 | globalFlagBlockAgenda = 5; | 3590 | globalFlagBlockAgenda = 5; |
3588 | mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); | 3591 | mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); |
3589 | //mViewManager->showView( 0, true ); | 3592 | //mViewManager->showView( 0, true ); |
3590 | } | 3593 | } |
3591 | 3594 | ||
3592 | void CalendarView::calendarModified( bool modified, Calendar * ) | 3595 | void CalendarView::calendarModified( bool modified, Calendar * ) |
3593 | { | 3596 | { |
3594 | setModified( modified ); | 3597 | setModified( modified ); |
3595 | } | 3598 | } |
3596 | 3599 | ||
3597 | Todo *CalendarView::selectedTodo() | 3600 | Todo *CalendarView::selectedTodo() |
3598 | { | 3601 | { |
3599 | Incidence *incidence = currentSelection(); | 3602 | Incidence *incidence = currentSelection(); |
3600 | if ( incidence && incidence->type() == "Todo" ) { | 3603 | if ( incidence && incidence->type() == "Todo" ) { |
3601 | return static_cast<Todo *>( incidence ); | 3604 | return static_cast<Todo *>( incidence ); |
3602 | } | 3605 | } |
3603 | 3606 | ||
3604 | incidence = mTodoList->selectedIncidences().first(); | 3607 | incidence = mTodoList->selectedIncidences().first(); |
3605 | if ( incidence && incidence->type() == "Todo" ) { | 3608 | if ( incidence && incidence->type() == "Todo" ) { |
3606 | return static_cast<Todo *>( incidence ); | 3609 | return static_cast<Todo *>( incidence ); |
3607 | } | 3610 | } |
3608 | 3611 | ||
3609 | return 0; | 3612 | return 0; |
3610 | } | 3613 | } |
3611 | 3614 | ||
3612 | void CalendarView::dialogClosing(Incidence *in) | 3615 | void CalendarView::dialogClosing(Incidence *in) |
3613 | { | 3616 | { |
3614 | // mDialogList.remove(in); | 3617 | // mDialogList.remove(in); |
3615 | } | 3618 | } |
3616 | 3619 | ||
3617 | void CalendarView::showIncidence() | 3620 | void CalendarView::showIncidence() |
3618 | { | 3621 | { |
3619 | Incidence *incidence = currentSelection(); | 3622 | Incidence *incidence = currentSelection(); |
3620 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3623 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3621 | if ( incidence ) { | 3624 | if ( incidence ) { |
3622 | ShowIncidenceVisitor v; | 3625 | ShowIncidenceVisitor v; |
3623 | v.act( incidence, this ); | 3626 | v.act( incidence, this ); |
3624 | } | 3627 | } |
3625 | } | 3628 | } |
3626 | void CalendarView::editIncidenceDescription() | 3629 | void CalendarView::editIncidenceDescription() |
3627 | { | 3630 | { |
3628 | mFlagEditDescription = true; | 3631 | mFlagEditDescription = true; |
3629 | editIncidence(); | 3632 | editIncidence(); |
3630 | mFlagEditDescription = false; | 3633 | mFlagEditDescription = false; |
3631 | } | 3634 | } |
3632 | void CalendarView::editIncidence() | 3635 | void CalendarView::editIncidence() |
3633 | { | 3636 | { |
3634 | // qDebug("editIncidence() "); | 3637 | // qDebug("editIncidence() "); |
3635 | Incidence *incidence = currentSelection(); | 3638 | Incidence *incidence = currentSelection(); |
3636 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3639 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3637 | if ( incidence ) { | 3640 | if ( incidence ) { |
3638 | EditIncidenceVisitor v; | 3641 | EditIncidenceVisitor v; |
3639 | v.act( incidence, this ); | 3642 | v.act( incidence, this ); |
3640 | } | 3643 | } |
3641 | } | 3644 | } |
3642 | 3645 | ||
3643 | void CalendarView::deleteIncidence() | 3646 | void CalendarView::deleteIncidence() |
3644 | { | 3647 | { |
3645 | Incidence *incidence = currentSelection(); | 3648 | Incidence *incidence = currentSelection(); |
3646 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3649 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3647 | if ( incidence ) { | 3650 | if ( incidence ) { |
3648 | deleteIncidence(incidence); | 3651 | deleteIncidence(incidence); |
3649 | } | 3652 | } |
3650 | } | 3653 | } |
3651 | 3654 | ||
3652 | void CalendarView::showIncidence(Incidence *incidence) | 3655 | void CalendarView::showIncidence(Incidence *incidence) |
3653 | { | 3656 | { |
3654 | if ( incidence ) { | 3657 | if ( incidence ) { |
3655 | ShowIncidenceVisitor v; | 3658 | ShowIncidenceVisitor v; |
3656 | v.act( incidence, this ); | 3659 | v.act( incidence, this ); |
3657 | } | 3660 | } |
3658 | } | 3661 | } |
3659 | 3662 | ||
3660 | void CalendarView::editIncidence(Incidence *incidence) | 3663 | void CalendarView::editIncidence(Incidence *incidence) |
3661 | { | 3664 | { |
3662 | if ( incidence ) { | 3665 | if ( incidence ) { |
3663 | 3666 | ||
3664 | EditIncidenceVisitor v; | 3667 | EditIncidenceVisitor v; |
3665 | v.act( incidence, this ); | 3668 | v.act( incidence, this ); |
3666 | 3669 | ||
3667 | } | 3670 | } |
3668 | } | 3671 | } |
3669 | 3672 | ||
3670 | void CalendarView::deleteIncidence(Incidence *incidence) | 3673 | void CalendarView::deleteIncidence(Incidence *incidence) |
3671 | { | 3674 | { |
3672 | //qDebug(" CalendarView::deleteIncidence "); | 3675 | //qDebug(" CalendarView::deleteIncidence "); |
3673 | if ( incidence ) { | 3676 | if ( incidence ) { |
3674 | DeleteIncidenceVisitor v; | 3677 | DeleteIncidenceVisitor v; |
3675 | v.act( incidence, this ); | 3678 | v.act( incidence, this ); |
3676 | } | 3679 | } |
3677 | } | 3680 | } |
3678 | 3681 | ||
3679 | 3682 | ||
3680 | void CalendarView::lookForOutgoingMessages() | 3683 | void CalendarView::lookForOutgoingMessages() |
3681 | { | 3684 | { |
3682 | OutgoingDialog *ogd = mDialogManager->outgoingDialog(); | 3685 | OutgoingDialog *ogd = mDialogManager->outgoingDialog(); |
3683 | ogd->loadMessages(); | 3686 | ogd->loadMessages(); |
3684 | } | 3687 | } |
3685 | 3688 | ||
3686 | void CalendarView::lookForIncomingMessages() | 3689 | void CalendarView::lookForIncomingMessages() |
3687 | { | 3690 | { |
3688 | IncomingDialog *icd = mDialogManager->incomingDialog(); | 3691 | IncomingDialog *icd = mDialogManager->incomingDialog(); |
3689 | icd->retrieve(); | 3692 | icd->retrieve(); |
3690 | } | 3693 | } |
3691 | 3694 | ||
3692 | bool CalendarView::removeCompletedSubTodos( Todo* t ) | 3695 | bool CalendarView::removeCompletedSubTodos( Todo* t ) |
3693 | { | 3696 | { |
3694 | bool deleteTodo = true; | 3697 | bool deleteTodo = true; |
3695 | QPtrList<Incidence> subTodos; | 3698 | QPtrList<Incidence> subTodos; |
3696 | Incidence *aTodo; | 3699 | Incidence *aTodo; |
3697 | subTodos = t->relations(); | 3700 | subTodos = t->relations(); |
3698 | for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { | 3701 | for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { |
3699 | if (! removeCompletedSubTodos( (Todo*) aTodo )) | 3702 | if (! removeCompletedSubTodos( (Todo*) aTodo )) |
3700 | deleteTodo = false; | 3703 | deleteTodo = false; |
3701 | } | 3704 | } |
3702 | if ( deleteTodo ) { | 3705 | if ( deleteTodo ) { |
3703 | if ( t->isCompleted() ) { | 3706 | if ( t->isCompleted() ) { |
3704 | checkExternalId( t ); | 3707 | checkExternalId( t ); |
3705 | mCalendar->deleteTodo( t ); | 3708 | mCalendar->deleteTodo( t ); |
3706 | changeTodoDisplay( t,KOGlobals::EVENTDELETED ); | 3709 | changeTodoDisplay( t,KOGlobals::EVENTDELETED ); |
3707 | } | 3710 | } |
3708 | else | 3711 | else |
3709 | deleteTodo = false; | 3712 | deleteTodo = false; |
3710 | } | 3713 | } |
3711 | return deleteTodo; | 3714 | return deleteTodo; |
3712 | 3715 | ||
3713 | } | 3716 | } |
3714 | void CalendarView::purgeCompleted() | 3717 | void CalendarView::purgeCompleted() |
3715 | { | 3718 | { |
3716 | int result = KMessageBox::warningContinueCancel(this, | 3719 | int result = KMessageBox::warningContinueCancel(this, |
3717 | i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge")); | 3720 | i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge")); |
3718 | 3721 | ||
3719 | if (result == KMessageBox::Continue) { | 3722 | if (result == KMessageBox::Continue) { |
3720 | 3723 | ||
3721 | QPtrList<Todo> todoCal; | 3724 | QPtrList<Todo> todoCal; |
3722 | QPtrList<Todo> rootTodos; | 3725 | QPtrList<Todo> rootTodos; |
3723 | //QPtrList<Incidence> rel; | 3726 | //QPtrList<Incidence> rel; |
3724 | Todo *aTodo;//, *rTodo; | 3727 | Todo *aTodo;//, *rTodo; |
3725 | Incidence *rIncidence; | 3728 | Incidence *rIncidence; |
3726 | bool childDelete = false; | 3729 | bool childDelete = false; |
3727 | bool deletedOne = true; | 3730 | bool deletedOne = true; |
3728 | todoCal = calendar()->todos(); | 3731 | todoCal = calendar()->todos(); |
3729 | for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { | 3732 | for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { |
3730 | if ( !aTodo->relatedTo() ) | 3733 | if ( !aTodo->relatedTo() ) |
3731 | rootTodos.append( aTodo ); | 3734 | rootTodos.append( aTodo ); |
3732 | } | 3735 | } |
3733 | for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { | 3736 | for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { |
3734 | removeCompletedSubTodos( aTodo ); | 3737 | removeCompletedSubTodos( aTodo ); |
3735 | } | 3738 | } |
3736 | 3739 | ||
3737 | updateView(); | 3740 | updateView(); |
3738 | } | 3741 | } |
3739 | } | 3742 | } |
3740 | 3743 | ||
3741 | void CalendarView::slotCalendarChanged() | 3744 | void CalendarView::slotCalendarChanged() |
3742 | { | 3745 | { |
3743 | ; | 3746 | ; |
3744 | } | 3747 | } |
3745 | 3748 | ||
3746 | NavigatorBar *CalendarView::navigatorBar() | 3749 | NavigatorBar *CalendarView::navigatorBar() |
3747 | { | 3750 | { |
3748 | return mNavigatorBar; | 3751 | return mNavigatorBar; |
3749 | } | 3752 | } |
3750 | 3753 | ||
3751 | 3754 | ||
3752 | 3755 | ||
3753 | void CalendarView::keyPressEvent ( QKeyEvent *e) | 3756 | void CalendarView::keyPressEvent ( QKeyEvent *e) |
3754 | { | 3757 | { |
3755 | //qDebug(" alendarView::keyPressEvent "); | 3758 | //qDebug(" alendarView::keyPressEvent "); |
3756 | e->ignore(); | 3759 | e->ignore(); |
3757 | } | 3760 | } |
3758 | 3761 | ||
3759 | 3762 | ||
3760 | bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) | 3763 | bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) |
3761 | { | 3764 | { |
3762 | // mSyncManager = manager; | 3765 | // mSyncManager = manager; |
3763 | if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { | 3766 | if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { |
3764 | qDebug("SyncKDE request detected!"); | 3767 | qDebug("SyncKDE request detected!"); |
3765 | } | 3768 | } |
3766 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); | 3769 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); |
3767 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); | 3770 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); |
3768 | return syncCalendar( filename, mode ); | 3771 | return syncCalendar( filename, mode ); |
3769 | } | 3772 | } |
3770 | bool CalendarView::syncExternal(KSyncManager* manager, QString resource) | 3773 | bool CalendarView::syncExternal(KSyncManager* manager, QString resource) |
3771 | { | 3774 | { |
3772 | //mSyncManager = manager; | 3775 | //mSyncManager = manager; |
3773 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); | 3776 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); |
3774 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); | 3777 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); |
3775 | if ( resource == "sharp" ) | 3778 | if ( resource == "sharp" ) |
3776 | syncExternal( 0 ); | 3779 | syncExternal( 0 ); |
3777 | if ( resource == "phone" ) | 3780 | if ( resource == "phone" ) |
3778 | syncExternal( 1 ); | 3781 | syncExternal( 1 ); |
3779 | // pending setmodified | 3782 | // pending setmodified |
3780 | return true; | 3783 | return true; |
3781 | } | 3784 | } |
3782 | void CalendarView::setSyncManager(KSyncManager* manager) | 3785 | void CalendarView::setSyncManager(KSyncManager* manager) |
3783 | { | 3786 | { |
3784 | mSyncManager = manager; | 3787 | mSyncManager = manager; |
3785 | } | 3788 | } |
3786 | 3789 | ||
3787 | void CalendarView::removeSyncInfo( QString syncProfile) | 3790 | void CalendarView::removeSyncInfo( QString syncProfile) |
3788 | { | 3791 | { |
3789 | qDebug("removeSyncInfo for profile %s ", syncProfile.latin1()); | 3792 | qDebug("removeSyncInfo for profile %s ", syncProfile.latin1()); |
3790 | mCalendar->removeSyncInfo( syncProfile ); | 3793 | mCalendar->removeSyncInfo( syncProfile ); |
3791 | 3794 | ||
3792 | } | 3795 | } |
diff --git a/korganizer/datenavigator.cpp b/korganizer/datenavigator.cpp index e26e20b..3156b2b 100644 --- a/korganizer/datenavigator.cpp +++ b/korganizer/datenavigator.cpp | |||
@@ -1,287 +1,293 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include "datenavigator.h" | 24 | #include "datenavigator.h" |
25 | 25 | ||
26 | #include "koglobals.h" | 26 | #include "koglobals.h" |
27 | 27 | ||
28 | #include <kcalendarsystem.h> | 28 | #include <kcalendarsystem.h> |
29 | 29 | ||
30 | #include <kdebug.h> | 30 | #include <kdebug.h> |
31 | #include <kglobal.h> | 31 | #include <kglobal.h> |
32 | #include <klocale.h> | 32 | #include <klocale.h> |
33 | 33 | ||
34 | using namespace KCal; | 34 | using namespace KCal; |
35 | 35 | ||
36 | DateNavigator::DateNavigator( QObject *parent, const char *name , KOViewManager * v) | 36 | DateNavigator::DateNavigator( QObject *parent, const char *name , KOViewManager * v) |
37 | : QObject( parent, name ) | 37 | : QObject( parent, name ) |
38 | { | 38 | { |
39 | mViewManager = v; | 39 | mViewManager = v; |
40 | mSelectedDates.append( QDate::currentDate() ); | 40 | mSelectedDates.append( QDate::currentDate() ); |
41 | } | 41 | } |
42 | 42 | ||
43 | DateNavigator::~DateNavigator() | 43 | DateNavigator::~DateNavigator() |
44 | { | 44 | { |
45 | } | 45 | } |
46 | 46 | ||
47 | void DateNavigator::slotMonthSelect( int m ) | 47 | void DateNavigator::slotMonthSelect( int m ) |
48 | { | 48 | { |
49 | QDate firstSelected = mSelectedDates.first(); | 49 | QDate firstSelected = mSelectedDates.first(); |
50 | int weekDay = firstSelected.dayOfWeek(); | 50 | int weekDay = firstSelected.dayOfWeek(); |
51 | int diff = m - firstSelected.month() ; | 51 | int diff = m - firstSelected.month() ; |
52 | firstSelected = KOGlobals::self()->calendarSystem()->addMonths( firstSelected, diff ); | 52 | firstSelected = KOGlobals::self()->calendarSystem()->addMonths( firstSelected, diff ); |
53 | 53 | ||
54 | if ( mSelectedDates.first().day() == 1 && mSelectedDates.count() > 27 ) | 54 | if ( mSelectedDates.first().day() == 1 && mSelectedDates.count() > 27 ) |
55 | selectMonthByDate( firstSelected ); | 55 | selectMonthByDate( firstSelected ); |
56 | else | 56 | else |
57 | selectWeekByDay( weekDay, firstSelected ); | 57 | selectWeekByDay( weekDay, firstSelected ); |
58 | 58 | ||
59 | } | 59 | } |
60 | 60 | ||
61 | void DateNavigator::slotDaySelect( QDate d ) | 61 | void DateNavigator::slotDaySelect( QDate d ) |
62 | { | 62 | { |
63 | QDate firstSelected = mSelectedDates.first(); | 63 | QDate firstSelected = mSelectedDates.first(); |
64 | int weekDay = firstSelected.dayOfWeek(); | 64 | int weekDay = firstSelected.dayOfWeek(); |
65 | //int diff = firstSelected.daysTo( d ) ; | 65 | //int diff = firstSelected.daysTo( d ) ; |
66 | firstSelected = firstSelected.addDays( firstSelected .daysTo( d ) ); | 66 | firstSelected = firstSelected.addDays( firstSelected .daysTo( d ) ); |
67 | 67 | ||
68 | selectWeekByDay( weekDay, firstSelected ); | 68 | selectWeekByDay( weekDay, firstSelected ); |
69 | 69 | ||
70 | } | 70 | } |
71 | 71 | ||
72 | void DateNavigator::selectMonthByDate( const QDate & firstSelected ) | 72 | void DateNavigator::selectMonthByDate( const QDate & firstSelected ) |
73 | { | 73 | { |
74 | 74 | ||
75 | int monthDay = firstSelected.day(); | 75 | int monthDay = firstSelected.day(); |
76 | QDate date = firstSelected.addDays( 1-monthDay ); | 76 | QDate date = firstSelected.addDays( 1-monthDay ); |
77 | selectDates( date , date.daysInMonth ()); | 77 | selectDates( date , date.daysInMonth ()); |
78 | 78 | ||
79 | } | 79 | } |
80 | void DateNavigator::selectMonth() | 80 | void DateNavigator::selectMonth() |
81 | { | 81 | { |
82 | 82 | ||
83 | QDate date =mSelectedDates.first(); | 83 | QDate date =mSelectedDates.first(); |
84 | selectMonthByDate( date ); | 84 | selectMonthByDate( date ); |
85 | } | 85 | } |
86 | 86 | ||
87 | DateList DateNavigator::selectedDates() | 87 | DateList DateNavigator::selectedDates() |
88 | { | 88 | { |
89 | return mSelectedDates; | 89 | return mSelectedDates; |
90 | } | 90 | } |
91 | 91 | ||
92 | int DateNavigator::datesCount() const | 92 | int DateNavigator::datesCount() const |
93 | { | 93 | { |
94 | return mSelectedDates.count(); | 94 | return mSelectedDates.count(); |
95 | } | 95 | } |
96 | 96 | ||
97 | void DateNavigator::selectDates( const DateList& dateList ) | 97 | void DateNavigator::selectDates( const DateList& dateList ) |
98 | { | 98 | { |
99 | if (dateList.count() > 0) { | 99 | if (dateList.count() > 0) { |
100 | mSelectedDates = dateList; | 100 | mSelectedDates = dateList; |
101 | emitSelected(); | 101 | emitSelected(); |
102 | } | 102 | } |
103 | } | 103 | } |
104 | 104 | ||
105 | void DateNavigator::selectDate( const QDate &date ) | 105 | void DateNavigator::selectDate( const QDate &date ) |
106 | { | 106 | { |
107 | QDate d = date; | 107 | QDate d = date; |
108 | 108 | ||
109 | if ( !d.isValid() ) { | 109 | if ( !d.isValid() ) { |
110 | d = QDate::currentDate(); | 110 | d = QDate::currentDate(); |
111 | } | 111 | } |
112 | 112 | ||
113 | mSelectedDates.clear(); | 113 | mSelectedDates.clear(); |
114 | mSelectedDates.append( d ); | 114 | mSelectedDates.append( d ); |
115 | 115 | ||
116 | emitSelected(); | 116 | emitSelected(); |
117 | } | 117 | } |
118 | 118 | ||
119 | void DateNavigator::selectDates( int count ) | 119 | void DateNavigator::selectDates( int count ) |
120 | { | 120 | { |
121 | 121 | ||
122 | QDate d = mSelectedDates.first(); | 122 | QDate d = mSelectedDates.first(); |
123 | selectDates( d, count ); | 123 | selectDates( d, count ); |
124 | } | 124 | } |
125 | 125 | ||
126 | void DateNavigator::selectDates( const QDate &d, int count ) | 126 | void DateNavigator::selectDates( const QDate &d, int count ) |
127 | { | 127 | { |
128 | DateList dates; | 128 | DateList dates; |
129 | 129 | ||
130 | int i; | 130 | int i; |
131 | for( i = 0; i < count; ++i ) { | 131 | for( i = 0; i < count; ++i ) { |
132 | dates.append( d.addDays( i ) ); | 132 | dates.append( d.addDays( i ) ); |
133 | } | 133 | } |
134 | 134 | ||
135 | mSelectedDates = dates; | 135 | mSelectedDates = dates; |
136 | 136 | ||
137 | emitSelected(); | 137 | emitSelected(); |
138 | } | 138 | } |
139 | 139 | ||
140 | void DateNavigator::selectWeekByDay( int weekDay, const QDate &d ) | 140 | void DateNavigator::selectWeekByDay( int weekDay, const QDate &d ) |
141 | { | 141 | { |
142 | // qDebug("selectWeekByDay( %d %s ", weekDay, d.toString().latin1()); | 142 | // qDebug("selectWeekByDay( %d %s ", weekDay, d.toString().latin1()); |
143 | int dateCount = mSelectedDates.count(); | 143 | int dateCount = mSelectedDates.count(); |
144 | bool weekStart = ( weekDay == KGlobal::locale()->weekStartDay() ); | 144 | bool weekStart = ( weekDay == KGlobal::locale()->weekStartDay() ); |
145 | if ( weekDay == 1 && dateCount == 5 ) selectWorkWeek( d ); | 145 | if ( weekDay == 1 && dateCount == 5 ) selectWorkWeek( d ); |
146 | else if ( weekStart && dateCount == 7 ) selectWeek( d ); | 146 | else if ( weekStart && dateCount == 7 ) selectWeek( d ); |
147 | else selectDates( d, dateCount ); | 147 | else selectDates( d, dateCount ); |
148 | } | 148 | } |
149 | 149 | ||
150 | void DateNavigator::selectWeek() | 150 | void DateNavigator::selectWeek() |
151 | { | 151 | { |
152 | QDate d = mSelectedDates.first(); | 152 | QDate d = mSelectedDates.first(); |
153 | selectWeek( d ); | 153 | selectWeek( d ); |
154 | } | 154 | } |
155 | void DateNavigator::selectWeek( int num ) | 155 | void DateNavigator::selectWeek( int num ) |
156 | { | 156 | { |
157 | int year = mSelectedDates.first().year(); | 157 | int year = mSelectedDates.first().year(); |
158 | if ( mSelectedDates.first().dayOfYear() > 300 && num < 10 ) | 158 | if ( mSelectedDates.first().dayOfYear() > 300 && num < 10 ) |
159 | ++year; | 159 | ++year; |
160 | if ( mSelectedDates.first().dayOfYear() < 70 && num > 40 ) | 160 | if ( mSelectedDates.first().dayOfYear() < 70 && num > 40 ) |
161 | --year; | 161 | --year; |
162 | QDate d = QDate ( year, 1,1); | 162 | QDate d = QDate ( year, 1,1); |
163 | while ( d.dayOfWeek() != 4 ) | 163 | while ( d.dayOfWeek() != 4 ) |
164 | d = d.addDays( 1 ); | 164 | d = d.addDays( 1 ); |
165 | selectWeek( d.addDays ( (num-1) *7 ) ); | 165 | selectWeek( d.addDays ( (num-1) *7 ) ); |
166 | } | 166 | } |
167 | void DateNavigator::selectWeek( const QDate &d ) | 167 | void DateNavigator::selectWeek( const QDate &d ) |
168 | { | 168 | { |
169 | int dayOfWeek = KOGlobals::self()->calendarSystem()->dayOfWeek( d ); | 169 | int dayOfWeek = KOGlobals::self()->calendarSystem()->dayOfWeek( d ); |
170 | 170 | ||
171 | int weekStart = KGlobal::locale()->weekStartDay(); | 171 | int weekStart = KGlobal::locale()->weekStartDay(); |
172 | QDate firstDate = d.addDays( weekStart - dayOfWeek ); | 172 | QDate firstDate = d.addDays( weekStart - dayOfWeek ); |
173 | 173 | ||
174 | if ( weekStart != 1 && dayOfWeek < weekStart ) { | 174 | if ( weekStart != 1 && dayOfWeek < weekStart ) { |
175 | firstDate = firstDate.addDays(-7 ); | 175 | firstDate = firstDate.addDays(-7 ); |
176 | } | 176 | } |
177 | 177 | ||
178 | 178 | ||
179 | selectDates( firstDate, 7 ); | 179 | selectDates( firstDate, 7 ); |
180 | } | 180 | } |
181 | 181 | ||
182 | void DateNavigator::selectWorkWeek() | 182 | void DateNavigator::selectWorkWeek() |
183 | { | 183 | { |
184 | QDate d = mSelectedDates.first(); | 184 | QDate d = mSelectedDates.first(); |
185 | selectWorkWeek( d ); | 185 | selectWorkWeek( d ); |
186 | } | 186 | } |
187 | 187 | ||
188 | void DateNavigator::selectWorkWeek( const QDate &d ) | 188 | void DateNavigator::selectWorkWeek( const QDate &d ) |
189 | { | 189 | { |
190 | int dayOfWeek = KOGlobals::self()->calendarSystem()->dayOfWeek( d ); | 190 | int dayOfWeek = KOGlobals::self()->calendarSystem()->dayOfWeek( d ); |
191 | 191 | ||
192 | QDate firstDate = d.addDays( 1 - dayOfWeek ); | 192 | QDate firstDate = d.addDays( 1 - dayOfWeek ); |
193 | 193 | ||
194 | int weekStart = KGlobal::locale()->weekStartDay(); | 194 | int weekStart = KGlobal::locale()->weekStartDay(); |
195 | if ( weekStart != 1 && dayOfWeek >= weekStart ) { | 195 | if ( weekStart != 1 && dayOfWeek >= weekStart ) { |
196 | firstDate = firstDate.addDays( 7 ); | 196 | firstDate = firstDate.addDays( 7 ); |
197 | } | 197 | } |
198 | 198 | ||
199 | selectDates( firstDate, 5 ); | 199 | selectDates( firstDate, 5 ); |
200 | } | 200 | } |
201 | 201 | ||
202 | void DateNavigator::selectTodayMonth() | ||
203 | { | ||
204 | QDate date = QDate::currentDate().addDays( 1-QDate::currentDate().day() ); | ||
205 | selectDates( date , date.daysInMonth ()); | ||
206 | |||
207 | } | ||
202 | void DateNavigator::selectToday() | 208 | void DateNavigator::selectToday() |
203 | { | 209 | { |
204 | QDate d = QDate::currentDate(); | 210 | QDate d = QDate::currentDate(); |
205 | 211 | ||
206 | int dateCount = mSelectedDates.count(); | 212 | int dateCount = mSelectedDates.count(); |
207 | 213 | ||
208 | if ( dateCount == 5 ) selectWorkWeek( d ); | 214 | if ( dateCount == 5 ) selectWorkWeek( d ); |
209 | else if ( dateCount == 7 ) selectWeek( d ); | 215 | else if ( dateCount == 7 ) selectWeek( d ); |
210 | else selectDates( d, dateCount ); | 216 | else selectDates( d, dateCount ); |
211 | } | 217 | } |
212 | 218 | ||
213 | void DateNavigator::selectPreviousYear() | 219 | void DateNavigator::selectPreviousYear() |
214 | { | 220 | { |
215 | QDate firstSelected = mSelectedDates.first(); | 221 | QDate firstSelected = mSelectedDates.first(); |
216 | int weekDay = firstSelected.dayOfWeek(); | 222 | int weekDay = firstSelected.dayOfWeek(); |
217 | firstSelected = KOGlobals::self()->calendarSystem()->addYears( firstSelected, -1 ); | 223 | firstSelected = KOGlobals::self()->calendarSystem()->addYears( firstSelected, -1 ); |
218 | 224 | ||
219 | selectWeekByDay( weekDay, firstSelected ); | 225 | selectWeekByDay( weekDay, firstSelected ); |
220 | } | 226 | } |
221 | 227 | ||
222 | void DateNavigator::selectPreviousMonth() | 228 | void DateNavigator::selectPreviousMonth() |
223 | { | 229 | { |
224 | QDate firstSelected = mSelectedDates.first(); | 230 | QDate firstSelected = mSelectedDates.first(); |
225 | int weekDay = firstSelected.dayOfWeek(); | 231 | int weekDay = firstSelected.dayOfWeek(); |
226 | firstSelected = KOGlobals::self()->calendarSystem()->addMonths( firstSelected, -1 ); | 232 | firstSelected = KOGlobals::self()->calendarSystem()->addMonths( firstSelected, -1 ); |
227 | 233 | ||
228 | 234 | ||
229 | if ( mSelectedDates.first().day() == 1 && mSelectedDates.count() > 27 ) | 235 | if ( mSelectedDates.first().day() == 1 && mSelectedDates.count() > 27 ) |
230 | selectMonthByDate( firstSelected ); | 236 | selectMonthByDate( firstSelected ); |
231 | else | 237 | else |
232 | selectWeekByDay( weekDay, firstSelected ); | 238 | selectWeekByDay( weekDay, firstSelected ); |
233 | } | 239 | } |
234 | 240 | ||
235 | void DateNavigator::selectNextMonth() | 241 | void DateNavigator::selectNextMonth() |
236 | { | 242 | { |
237 | QDate firstSelected = mSelectedDates.first(); | 243 | QDate firstSelected = mSelectedDates.first(); |
238 | int weekDay = firstSelected.dayOfWeek(); | 244 | int weekDay = firstSelected.dayOfWeek(); |
239 | 245 | ||
240 | firstSelected = KOGlobals::self()->calendarSystem()->addMonths( firstSelected, 1 ); | 246 | firstSelected = KOGlobals::self()->calendarSystem()->addMonths( firstSelected, 1 ); |
241 | 247 | ||
242 | if ( mSelectedDates.first().day() == 1 && mSelectedDates.count() > 27 ) | 248 | if ( mSelectedDates.first().day() == 1 && mSelectedDates.count() > 27 ) |
243 | selectMonthByDate( firstSelected ); | 249 | selectMonthByDate( firstSelected ); |
244 | else | 250 | else |
245 | selectWeekByDay( weekDay, firstSelected ); | 251 | selectWeekByDay( weekDay, firstSelected ); |
246 | 252 | ||
247 | } | 253 | } |
248 | 254 | ||
249 | void DateNavigator::selectNextYear() | 255 | void DateNavigator::selectNextYear() |
250 | { | 256 | { |
251 | QDate firstSelected = mSelectedDates.first(); | 257 | QDate firstSelected = mSelectedDates.first(); |
252 | int weekDay = firstSelected.dayOfWeek(); | 258 | int weekDay = firstSelected.dayOfWeek(); |
253 | firstSelected = KOGlobals::self()->calendarSystem()->addYears( firstSelected, 1 ); | 259 | firstSelected = KOGlobals::self()->calendarSystem()->addYears( firstSelected, 1 ); |
254 | 260 | ||
255 | selectWeekByDay( weekDay, firstSelected ); | 261 | selectWeekByDay( weekDay, firstSelected ); |
256 | } | 262 | } |
257 | 263 | ||
258 | void DateNavigator::selectPrevious() | 264 | void DateNavigator::selectPrevious() |
259 | { | 265 | { |
260 | int offset = -7; | 266 | int offset = -7; |
261 | if ( datesCount() == 1 ) { | 267 | if ( datesCount() == 1 ) { |
262 | offset = -1; | 268 | offset = -1; |
263 | } | 269 | } |
264 | if ( mViewManager ) | 270 | if ( mViewManager ) |
265 | if ( mViewManager->showsNextDays() ) | 271 | if ( mViewManager->showsNextDays() ) |
266 | offset = -datesCount(); | 272 | offset = -datesCount(); |
267 | selectDates( mSelectedDates.first().addDays( offset ), datesCount() ); | 273 | selectDates( mSelectedDates.first().addDays( offset ), datesCount() ); |
268 | } | 274 | } |
269 | 275 | ||
270 | void DateNavigator::selectNext() | 276 | void DateNavigator::selectNext() |
271 | { | 277 | { |
272 | int offset = 7; | 278 | int offset = 7; |
273 | if ( datesCount() == 1 ) { | 279 | if ( datesCount() == 1 ) { |
274 | offset = 1; | 280 | offset = 1; |
275 | } | 281 | } |
276 | if ( mViewManager ) | 282 | if ( mViewManager ) |
277 | if ( mViewManager->showsNextDays() ) | 283 | if ( mViewManager->showsNextDays() ) |
278 | offset = datesCount(); | 284 | offset = datesCount(); |
279 | selectDates( mSelectedDates.first().addDays( offset ), datesCount() ); | 285 | selectDates( mSelectedDates.first().addDays( offset ), datesCount() ); |
280 | } | 286 | } |
281 | 287 | ||
282 | void DateNavigator::emitSelected() | 288 | void DateNavigator::emitSelected() |
283 | { | 289 | { |
284 | emit datesSelected( mSelectedDates ); | 290 | emit datesSelected( mSelectedDates ); |
285 | } | 291 | } |
286 | 292 | ||
287 | //#include "datenavigator.moc" | 293 | //#include "datenavigator.moc" |
diff --git a/korganizer/datenavigator.h b/korganizer/datenavigator.h index 747e3d3..4a19e17 100644 --- a/korganizer/datenavigator.h +++ b/korganizer/datenavigator.h | |||
@@ -1,89 +1,90 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | #ifndef DATENAVIGATOR_H | 23 | #ifndef DATENAVIGATOR_H |
24 | #define DATENAVIGATOR_H | 24 | #define DATENAVIGATOR_H |
25 | 25 | ||
26 | #include <libkcal/incidencebase.h> | 26 | #include <libkcal/incidencebase.h> |
27 | 27 | ||
28 | #include <qobject.h> | 28 | #include <qobject.h> |
29 | #include "koviewmanager.h" | 29 | #include "koviewmanager.h" |
30 | 30 | ||
31 | /** | 31 | /** |
32 | This class controls date navigation. All requests to move the views to another | 32 | This class controls date navigation. All requests to move the views to another |
33 | date are sent to the DateNavigator. The DateNavigator processes the new | 33 | date are sent to the DateNavigator. The DateNavigator processes the new |
34 | selection of dates and emits the required signals for the views. | 34 | selection of dates and emits the required signals for the views. |
35 | */ | 35 | */ |
36 | class DateNavigator : public QObject | 36 | class DateNavigator : public QObject |
37 | { | 37 | { |
38 | Q_OBJECT | 38 | Q_OBJECT |
39 | public: | 39 | public: |
40 | DateNavigator( QObject *parent = 0, const char *name = 0 , KOViewManager * v = 0); | 40 | DateNavigator( QObject *parent = 0, const char *name = 0 , KOViewManager * v = 0); |
41 | ~DateNavigator(); | 41 | ~DateNavigator(); |
42 | 42 | ||
43 | KCal::DateList selectedDates(); | 43 | KCal::DateList selectedDates(); |
44 | 44 | ||
45 | int datesCount() const; | 45 | int datesCount() const; |
46 | 46 | ||
47 | public slots: | 47 | public slots: |
48 | void selectDates( const KCal::DateList & ); | 48 | void selectDates( const KCal::DateList & ); |
49 | void selectDate( const QDate & ); | 49 | void selectDate( const QDate & ); |
50 | 50 | ||
51 | void selectDates( int count ); | 51 | void selectDates( int count ); |
52 | void selectDates( const QDate &, int count ); | 52 | void selectDates( const QDate &, int count ); |
53 | 53 | ||
54 | void selectWeek(); | 54 | void selectWeek(); |
55 | void selectWeek( int weeknum ); | 55 | void selectWeek( int weeknum ); |
56 | void selectWeek( const QDate & ); | 56 | void selectWeek( const QDate & ); |
57 | 57 | ||
58 | void selectWorkWeek(); | 58 | void selectWorkWeek(); |
59 | void selectWorkWeek( const QDate & ); | 59 | void selectWorkWeek( const QDate & ); |
60 | 60 | ||
61 | void selectWeekByDay( int weekDay, const QDate & ); | 61 | void selectWeekByDay( int weekDay, const QDate & ); |
62 | 62 | ||
63 | void selectToday(); | 63 | void selectToday(); |
64 | void selectTodayMonth(); | ||
64 | 65 | ||
65 | void selectPreviousYear(); | 66 | void selectPreviousYear(); |
66 | void selectPreviousMonth(); | 67 | void selectPreviousMonth(); |
67 | void selectNextMonth(); | 68 | void selectNextMonth(); |
68 | void selectNextYear(); | 69 | void selectNextYear(); |
69 | 70 | ||
70 | void selectMonth(); | 71 | void selectMonth(); |
71 | void selectMonthByDate( const QDate & ); | 72 | void selectMonthByDate( const QDate & ); |
72 | 73 | ||
73 | void selectPrevious(); | 74 | void selectPrevious(); |
74 | void selectNext(); | 75 | void selectNext(); |
75 | void slotMonthSelect( int ); | 76 | void slotMonthSelect( int ); |
76 | void slotDaySelect( QDate d ); | 77 | void slotDaySelect( QDate d ); |
77 | 78 | ||
78 | signals: | 79 | signals: |
79 | void datesSelected( const KCal::DateList & ); | 80 | void datesSelected( const KCal::DateList & ); |
80 | 81 | ||
81 | protected: | 82 | protected: |
82 | void emitSelected(); | 83 | void emitSelected(); |
83 | 84 | ||
84 | private: | 85 | private: |
85 | KOViewManager * mViewManager; | 86 | KOViewManager * mViewManager; |
86 | KCal::DateList mSelectedDates; | 87 | KCal::DateList mSelectedDates; |
87 | }; | 88 | }; |
88 | 89 | ||
89 | #endif | 90 | #endif |
diff --git a/korganizer/interfaces/korganizer/baseview.h b/korganizer/interfaces/korganizer/baseview.h index 09f8ba3..2ac9de1 100644 --- a/korganizer/interfaces/korganizer/baseview.h +++ b/korganizer/interfaces/korganizer/baseview.h | |||
@@ -1,192 +1,193 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the KOrganizer interfaces. | 2 | This file is part of the KOrganizer interfaces. |
3 | Copyright (c) 1999 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 1999 Cornelius Schumacher <schumacher@kde.org> |
4 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This library is free software; you can redistribute it and/or | 6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public | 7 | modify it under the terms of the GNU Library General Public |
8 | License as published by the Free Software Foundation; either | 8 | License as published by the Free Software Foundation; either |
9 | version 2 of the License, or (at your option) any later version. | 9 | version 2 of the License, or (at your option) any later version. |
10 | 10 | ||
11 | This library is distributed in the hope that it will be useful, | 11 | This library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. | 14 | Library General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU Library General Public License | 16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | #ifndef KORG_BASEVIEW_H | 21 | #ifndef KORG_BASEVIEW_H |
22 | #define KORG_BASEVIEW_H | 22 | #define KORG_BASEVIEW_H |
23 | // $Id$ | 23 | // $Id$ |
24 | // KOBaseView is the abstract base class of all calendar views. | 24 | // KOBaseView is the abstract base class of all calendar views. |
25 | 25 | ||
26 | #include <qwidget.h> | 26 | #include <qwidget.h> |
27 | #include <qptrlist.h> | 27 | #include <qptrlist.h> |
28 | #include <qvaluelist.h> | 28 | #include <qvaluelist.h> |
29 | 29 | ||
30 | #include <klocale.h> | 30 | #include <klocale.h> |
31 | #include <kdebug.h> | 31 | #include <kdebug.h> |
32 | #include <kmessagebox.h> | 32 | #include <kmessagebox.h> |
33 | 33 | ||
34 | #include <libkcal/event.h> | 34 | #include <libkcal/event.h> |
35 | #include <libkcal/calendar.h> | 35 | #include <libkcal/calendar.h> |
36 | 36 | ||
37 | using namespace KCal; | 37 | using namespace KCal; |
38 | 38 | ||
39 | class CalPrinter; | 39 | class CalPrinter; |
40 | 40 | ||
41 | namespace KOrg { | 41 | namespace KOrg { |
42 | 42 | ||
43 | class CalPrinterBase | 43 | class CalPrinterBase |
44 | { | 44 | { |
45 | public: | 45 | public: |
46 | enum PrintType { Day, Week, Month, Todolist }; | 46 | enum PrintType { Day, Week, Month, Todolist }; |
47 | }; | 47 | }; |
48 | 48 | ||
49 | 49 | ||
50 | /** | 50 | /** |
51 | This class provides an interface for all views being displayed within the main | 51 | This class provides an interface for all views being displayed within the main |
52 | calendar view. It has functions to update the view, to specify date range and | 52 | calendar view. It has functions to update the view, to specify date range and |
53 | other display parameter and to return selected objects. An important class, | 53 | other display parameter and to return selected objects. An important class, |
54 | which inherits KOBaseView is KOEventView, which provides the interface for all | 54 | which inherits KOBaseView is KOEventView, which provides the interface for all |
55 | views of event data like the agenda or the month view. | 55 | views of event data like the agenda or the month view. |
56 | 56 | ||
57 | @short Base class for calendar views | 57 | @short Base class for calendar views |
58 | @author Preston Brown, Cornelius Schumacher | 58 | @author Preston Brown, Cornelius Schumacher |
59 | @see KOTodoView, KOEventView, KOListView, KOAgendaView, KOMonthView | 59 | @see KOTodoView, KOEventView, KOListView, KOAgendaView, KOMonthView |
60 | */ | 60 | */ |
61 | class BaseView : public QWidget | 61 | class BaseView : public QWidget |
62 | { | 62 | { |
63 | Q_OBJECT | 63 | Q_OBJECT |
64 | public: | 64 | public: |
65 | /** | 65 | /** |
66 | Constructs a view. | 66 | Constructs a view. |
67 | 67 | ||
68 | @param cal Pointer to the calendar object from which events | 68 | @param cal Pointer to the calendar object from which events |
69 | will be retrieved for display. | 69 | will be retrieved for display. |
70 | @param parent parent widget. | 70 | @param parent parent widget. |
71 | @param name name of this widget. | 71 | @param name name of this widget. |
72 | */ | 72 | */ |
73 | BaseView(Calendar *cal, QWidget *parent = 0, const char *name = 0) : | 73 | BaseView(Calendar *cal, QWidget *parent = 0, const char *name = 0) : |
74 | QWidget(parent, name), mCalendar(cal) {} | 74 | QWidget(parent, name), mCalendar(cal) {} |
75 | 75 | ||
76 | /** | 76 | /** |
77 | Destructor. Views will do view-specific cleanups here. | 77 | Destructor. Views will do view-specific cleanups here. |
78 | */ | 78 | */ |
79 | virtual ~BaseView() {} | 79 | virtual ~BaseView() {} |
80 | 80 | ||
81 | /** | 81 | /** |
82 | Return calendar object of this view. | 82 | Return calendar object of this view. |
83 | */ | 83 | */ |
84 | Calendar *calendar() { return mCalendar; } | 84 | Calendar *calendar() { return mCalendar; } |
85 | 85 | ||
86 | /** | 86 | /** |
87 | @return a list of selected events. Most views can probably only | 87 | @return a list of selected events. Most views can probably only |
88 | select a single event at a time, but some may be able to select | 88 | select a single event at a time, but some may be able to select |
89 | more than one. | 89 | more than one. |
90 | */ | 90 | */ |
91 | virtual QPtrList<Incidence> selectedIncidences() = 0; | 91 | virtual QPtrList<Incidence> selectedIncidences() = 0; |
92 | 92 | ||
93 | /** | 93 | /** |
94 | @return a list of the dates of selected events. Most views can probably only | 94 | @return a list of the dates of selected events. Most views can probably only |
95 | select a single event at a time, but some may be able to select | 95 | select a single event at a time, but some may be able to select |
96 | more than one. | 96 | more than one. |
97 | */ | 97 | */ |
98 | virtual DateList selectedDates() = 0; | 98 | virtual DateList selectedDates() = 0; |
99 | 99 | ||
100 | /** | 100 | /** |
101 | Generate a print preview of this event view. | 101 | Generate a print preview of this event view. |
102 | 102 | ||
103 | @param calPrinter Calendar printer object used for printing | 103 | @param calPrinter Calendar printer object used for printing |
104 | @param fd from date | 104 | @param fd from date |
105 | @param td to date | 105 | @param td to date |
106 | */ | 106 | */ |
107 | /* | 107 | /* |
108 | The date parameters should be determined by the view itself and not given as | 108 | The date parameters should be determined by the view itself and not given as |
109 | parameters. At the moment I just move the code from the topwidget to the | 109 | parameters. At the moment I just move the code from the topwidget to the |
110 | individual views. | 110 | individual views. |
111 | */ | 111 | */ |
112 | virtual void printPreview(CalPrinter *, | 112 | virtual void printPreview(CalPrinter *, |
113 | const QDate &, const QDate &) | 113 | const QDate &, const QDate &) |
114 | { | 114 | { |
115 | KMessageBox::sorry(this, i18n("Unfortunately, we don't handle printing for\n" | 115 | KMessageBox::sorry(this, i18n("Unfortunately, we don't handle printing for\n" |
116 | "that view yet.\n")); | 116 | "that view yet.\n")); |
117 | } | 117 | } |
118 | 118 | ||
119 | /** | 119 | /** |
120 | Print this view. | 120 | Print this view. |
121 | 121 | ||
122 | @param calPrinter Calendar printer object used for printing | 122 | @param calPrinter Calendar printer object used for printing |
123 | */ | 123 | */ |
124 | virtual void print(CalPrinter *) | 124 | virtual void print(CalPrinter *) |
125 | { | 125 | { |
126 | KMessageBox::sorry(this, i18n("Unfortunately, we don't handle printing for\n" | 126 | KMessageBox::sorry(this, i18n("Unfortunately, we don't handle printing for\n" |
127 | "that view yet.\n")); | 127 | "that view yet.\n")); |
128 | } | 128 | } |
129 | 129 | ||
130 | /** | 130 | /** |
131 | Return number of currently shown dates. A return value of 0 means no idea. | 131 | Return number of currently shown dates. A return value of 0 means no idea. |
132 | */ | 132 | */ |
133 | virtual int currentDateCount() = 0; | 133 | virtual int currentDateCount() = 0; |
134 | 134 | ||
135 | /** Return if this view is a view for displaying events. */ | 135 | /** Return if this view is a view for displaying events. */ |
136 | virtual bool isEventView() { return false; } | 136 | virtual bool isEventView() { return false; } |
137 | virtual bool isMonthView() { return false; } | ||
137 | 138 | ||
138 | public slots: | 139 | public slots: |
139 | /** | 140 | /** |
140 | Show incidences for the given date range. The date range actually shown may be | 141 | Show incidences for the given date range. The date range actually shown may be |
141 | different from the requested range, depending on the particular requirements | 142 | different from the requested range, depending on the particular requirements |
142 | of the view. | 143 | of the view. |
143 | 144 | ||
144 | @param start Start of date range. | 145 | @param start Start of date range. |
145 | @param end End of date range. | 146 | @param end End of date range. |
146 | */ | 147 | */ |
147 | virtual void showDates( const QDate &start, const QDate &end ) = 0; | 148 | virtual void showDates( const QDate &start, const QDate &end ) = 0; |
148 | 149 | ||
149 | /** | 150 | /** |
150 | Show given events. Depending on the actual view it might not be possible to | 151 | Show given events. Depending on the actual view it might not be possible to |
151 | show all given events. | 152 | show all given events. |
152 | 153 | ||
153 | @param eventList a list of events to show. | 154 | @param eventList a list of events to show. |
154 | */ | 155 | */ |
155 | virtual void showEvents(QPtrList<Event> eventList) = 0; | 156 | virtual void showEvents(QPtrList<Event> eventList) = 0; |
156 | 157 | ||
157 | /** | 158 | /** |
158 | Updates the current display to reflect changes that may have happened | 159 | Updates the current display to reflect changes that may have happened |
159 | in the calendar since the last display refresh. | 160 | in the calendar since the last display refresh. |
160 | */ | 161 | */ |
161 | virtual void updateView() = 0; | 162 | virtual void updateView() = 0; |
162 | 163 | ||
163 | /** | 164 | /** |
164 | Write all unsaved data back to calendar store. | 165 | Write all unsaved data back to calendar store. |
165 | */ | 166 | */ |
166 | virtual void flushView() {} | 167 | virtual void flushView() {} |
167 | 168 | ||
168 | /** | 169 | /** |
169 | Updates the current display to reflect the changes to one particular event. | 170 | Updates the current display to reflect the changes to one particular event. |
170 | */ | 171 | */ |
171 | virtual void changeEventDisplay(Event *, int) = 0; | 172 | virtual void changeEventDisplay(Event *, int) = 0; |
172 | 173 | ||
173 | /** | 174 | /** |
174 | Re-reads the KOrganizer configuration and picks up relevant | 175 | Re-reads the KOrganizer configuration and picks up relevant |
175 | changes which are applicable to the view. | 176 | changes which are applicable to the view. |
176 | */ | 177 | */ |
177 | virtual void updateConfig() {} | 178 | virtual void updateConfig() {} |
178 | 179 | ||
179 | /** | 180 | /** |
180 | Clear selection. The incidenceSelected signal is not emitted. | 181 | Clear selection. The incidenceSelected signal is not emitted. |
181 | */ | 182 | */ |
182 | virtual void clearSelection() {} | 183 | virtual void clearSelection() {} |
183 | 184 | ||
184 | signals: | 185 | signals: |
185 | void incidenceSelected( Incidence * ); | 186 | void incidenceSelected( Incidence * ); |
186 | 187 | ||
187 | protected: | 188 | protected: |
188 | Calendar *mCalendar; | 189 | Calendar *mCalendar; |
189 | }; | 190 | }; |
190 | 191 | ||
191 | } | 192 | } |
192 | #endif | 193 | #endif |
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index d976246..e94952f 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h | |||
@@ -1,252 +1,253 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #ifndef _KOMONTHVIEW_H | 20 | #ifndef _KOMONTHVIEW_H |
21 | #define _KOMONTHVIEW_H | 21 | #define _KOMONTHVIEW_H |
22 | 22 | ||
23 | #include <qlabel.h> | 23 | #include <qlabel.h> |
24 | #include <qframe.h> | 24 | #include <qframe.h> |
25 | #include <qdatetime.h> | 25 | #include <qdatetime.h> |
26 | #include <qlistbox.h> | 26 | #include <qlistbox.h> |
27 | #include <qpoint.h> | 27 | #include <qpoint.h> |
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #include <qintdict.h> | 29 | #include <qintdict.h> |
30 | #include <qpushbutton.h> | 30 | #include <qpushbutton.h> |
31 | #include <qvaluelist.h> | 31 | #include <qvaluelist.h> |
32 | #include <qptrvector.h> | 32 | #include <qptrvector.h> |
33 | 33 | ||
34 | #include <libkcal/calendar.h> | 34 | #include <libkcal/calendar.h> |
35 | #include <libkcal/event.h> | 35 | #include <libkcal/event.h> |
36 | 36 | ||
37 | #include "koeventview.h" | 37 | #include "koeventview.h" |
38 | 38 | ||
39 | class KOWeekButton : public QPushButton | 39 | class KOWeekButton : public QPushButton |
40 | { | 40 | { |
41 | Q_OBJECT | 41 | Q_OBJECT |
42 | public: | 42 | public: |
43 | KOWeekButton( QWidget *parent=0, const char *name=0 ) : | 43 | KOWeekButton( QWidget *parent=0, const char *name=0 ) : |
44 | QPushButton( parent, name) | 44 | QPushButton( parent, name) |
45 | { | 45 | { |
46 | connect( this, SIGNAL( clicked() ), | 46 | connect( this, SIGNAL( clicked() ), |
47 | SLOT( bottonClicked() )); | 47 | SLOT( bottonClicked() )); |
48 | mNumber = -1; | 48 | mNumber = -1; |
49 | } | 49 | } |
50 | void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));} | 50 | void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));} |
51 | signals: | 51 | signals: |
52 | void selectWeekNum ( int ); | 52 | void selectWeekNum ( int ); |
53 | private: | 53 | private: |
54 | int mNumber; | 54 | int mNumber; |
55 | private slots : | 55 | private slots : |
56 | void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } | 56 | void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } |
57 | }; | 57 | }; |
58 | 58 | ||
59 | class KNoScrollListBox: public QListBox | 59 | class KNoScrollListBox: public QListBox |
60 | { | 60 | { |
61 | Q_OBJECT | 61 | Q_OBJECT |
62 | public: | 62 | public: |
63 | KNoScrollListBox(QWidget *parent=0, const char *name=0); | 63 | KNoScrollListBox(QWidget *parent=0, const char *name=0); |
64 | ~KNoScrollListBox() {} | 64 | ~KNoScrollListBox() {} |
65 | QString getWhatsThisText(QPoint p) ; | 65 | QString getWhatsThisText(QPoint p) ; |
66 | 66 | ||
67 | signals: | 67 | signals: |
68 | void shiftDown(); | 68 | void shiftDown(); |
69 | void shiftUp(); | 69 | void shiftUp(); |
70 | void rightClick(); | 70 | void rightClick(); |
71 | 71 | ||
72 | protected slots: | 72 | protected slots: |
73 | void keyPressEvent(QKeyEvent *); | 73 | void keyPressEvent(QKeyEvent *); |
74 | void keyReleaseEvent(QKeyEvent *); | 74 | void keyReleaseEvent(QKeyEvent *); |
75 | void mousePressEvent(QMouseEvent *); | 75 | void mousePressEvent(QMouseEvent *); |
76 | }; | 76 | }; |
77 | 77 | ||
78 | 78 | ||
79 | class MonthViewItem: public QListBoxItem | 79 | class MonthViewItem: public QListBoxItem |
80 | { | 80 | { |
81 | public: | 81 | public: |
82 | MonthViewItem( Incidence *, QDate qd, const QString & title ); | 82 | MonthViewItem( Incidence *, QDate qd, const QString & title ); |
83 | 83 | ||
84 | void setRecur(bool on) { mRecur = on; } | 84 | void setRecur(bool on) { mRecur = on; } |
85 | void setAlarm(bool on) { mAlarm = on; } | 85 | void setAlarm(bool on) { mAlarm = on; } |
86 | void setReply(bool on) { mReply = on; } | 86 | void setReply(bool on) { mReply = on; } |
87 | void setMoreInfo(bool on) { mInfo = on; } | 87 | void setMoreInfo(bool on) { mInfo = on; } |
88 | 88 | ||
89 | 89 | ||
90 | void setPalette(const QPalette &p) { mPalette = p; } | 90 | void setPalette(const QPalette &p) { mPalette = p; } |
91 | QPalette palette() const { return mPalette; } | 91 | QPalette palette() const { return mPalette; } |
92 | 92 | ||
93 | Incidence *incidence() const { return mIncidence; } | 93 | Incidence *incidence() const { return mIncidence; } |
94 | QDate incidenceDate() { return mDate; } | 94 | QDate incidenceDate() { return mDate; } |
95 | 95 | ||
96 | protected: | 96 | protected: |
97 | virtual void paint(QPainter *); | 97 | virtual void paint(QPainter *); |
98 | virtual int height(const QListBox *) const; | 98 | virtual int height(const QListBox *) const; |
99 | virtual int width(const QListBox *) const; | 99 | virtual int width(const QListBox *) const; |
100 | 100 | ||
101 | private: | 101 | private: |
102 | bool mRecur; | 102 | bool mRecur; |
103 | bool mAlarm; | 103 | bool mAlarm; |
104 | bool mReply; | 104 | bool mReply; |
105 | bool mInfo; | 105 | bool mInfo; |
106 | 106 | ||
107 | QPalette mPalette; | 107 | QPalette mPalette; |
108 | QDate mDate; | 108 | QDate mDate; |
109 | 109 | ||
110 | Incidence *mIncidence; | 110 | Incidence *mIncidence; |
111 | }; | 111 | }; |
112 | 112 | ||
113 | 113 | ||
114 | class KOMonthView; | 114 | class KOMonthView; |
115 | 115 | ||
116 | class MonthViewCell : public QWidget | 116 | class MonthViewCell : public QWidget |
117 | { | 117 | { |
118 | Q_OBJECT | 118 | Q_OBJECT |
119 | public: | 119 | public: |
120 | MonthViewCell( KOMonthView * ); | 120 | MonthViewCell( KOMonthView * ); |
121 | 121 | ||
122 | void setDate( const QDate & ); | 122 | void setDate( const QDate & ); |
123 | QDate date() const; | 123 | QDate date() const; |
124 | 124 | ||
125 | void setPrimary( bool ); | 125 | void setPrimary( bool ); |
126 | bool isPrimary() const; | 126 | bool isPrimary() const; |
127 | 127 | ||
128 | void setHoliday( bool ); | 128 | void setHoliday( bool ); |
129 | void setHoliday( const QString & ); | 129 | void setHoliday( const QString & ); |
130 | 130 | ||
131 | void updateCell(); | 131 | void updateCell(); |
132 | 132 | ||
133 | void updateConfig(); | 133 | void updateConfig(); |
134 | 134 | ||
135 | void enableScrollBars( bool ); | 135 | void enableScrollBars( bool ); |
136 | 136 | ||
137 | Incidence *selectedIncidence(); | 137 | Incidence *selectedIncidence(); |
138 | QDate selectedIncidenceDate(); | 138 | QDate selectedIncidenceDate(); |
139 | 139 | ||
140 | void deselect(); | 140 | void deselect(); |
141 | void select(); | 141 | void select(); |
142 | 142 | ||
143 | signals: | 143 | signals: |
144 | void defaultAction( Incidence * ); | 144 | void defaultAction( Incidence * ); |
145 | void newEventSignal( QDateTime ); | 145 | void newEventSignal( QDateTime ); |
146 | 146 | ||
147 | protected: | 147 | protected: |
148 | void resizeEvent( QResizeEvent * ); | 148 | void resizeEvent( QResizeEvent * ); |
149 | 149 | ||
150 | protected slots: | 150 | protected slots: |
151 | void defaultAction( QListBoxItem * ); | 151 | void defaultAction( QListBoxItem * ); |
152 | void contextMenu( QListBoxItem * ); | 152 | void contextMenu( QListBoxItem * ); |
153 | void selection( QListBoxItem * ); | 153 | void selection( QListBoxItem * ); |
154 | void cellClicked( QListBoxItem * ); | 154 | void cellClicked( QListBoxItem * ); |
155 | void newEvent(); | 155 | void newEvent(); |
156 | 156 | ||
157 | private: | 157 | private: |
158 | KOMonthView *mMonthView; | 158 | KOMonthView *mMonthView; |
159 | 159 | ||
160 | QDate mDate; | 160 | QDate mDate; |
161 | bool mPrimary; | 161 | bool mPrimary; |
162 | bool mHoliday; | 162 | bool mHoliday; |
163 | QString mHolidayString; | 163 | QString mHolidayString; |
164 | 164 | ||
165 | //QLabel *mLabel; | 165 | //QLabel *mLabel; |
166 | QPushButton *mLabel; | 166 | QPushButton *mLabel; |
167 | QListBox *mItemList; | 167 | QListBox *mItemList; |
168 | 168 | ||
169 | QSize mLabelSize; | 169 | QSize mLabelSize; |
170 | QSize mLabelBigSize; | 170 | QSize mLabelBigSize; |
171 | QPalette mHolidayPalette; | 171 | QPalette mHolidayPalette; |
172 | QPalette mStandardPalette; | 172 | QPalette mStandardPalette; |
173 | QPalette mPrimaryPalette; | 173 | QPalette mPrimaryPalette; |
174 | QPalette mNonPrimaryPalette; | 174 | QPalette mNonPrimaryPalette; |
175 | void setMyPalette(); | 175 | void setMyPalette(); |
176 | QPalette getPalette (); | 176 | QPalette getPalette (); |
177 | void keyPressEvent ( QKeyEvent * ) ; | 177 | void keyPressEvent ( QKeyEvent * ) ; |
178 | 178 | ||
179 | }; | 179 | }; |
180 | 180 | ||
181 | 181 | ||
182 | class KOMonthView: public KOEventView | 182 | class KOMonthView: public KOEventView |
183 | { | 183 | { |
184 | Q_OBJECT | 184 | Q_OBJECT |
185 | public: | 185 | public: |
186 | KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); | 186 | KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); |
187 | ~KOMonthView(); | 187 | ~KOMonthView(); |
188 | 188 | ||
189 | /** Returns maximum number of days supported by the komonthview */ | 189 | /** Returns maximum number of days supported by the komonthview */ |
190 | virtual int maxDatesHint(); | 190 | virtual int maxDatesHint(); |
191 | 191 | ||
192 | /** Returns number of currently shown dates. */ | 192 | /** Returns number of currently shown dates. */ |
193 | virtual int currentDateCount(); | 193 | virtual int currentDateCount(); |
194 | 194 | ||
195 | /** returns the currently selected events */ | 195 | /** returns the currently selected events */ |
196 | virtual QPtrList<Incidence> selectedIncidences(); | 196 | virtual QPtrList<Incidence> selectedIncidences(); |
197 | 197 | ||
198 | /** returns dates of the currently selected events */ | 198 | /** returns dates of the currently selected events */ |
199 | virtual DateList selectedDates(); | 199 | virtual DateList selectedDates(); |
200 | 200 | ||
201 | virtual void printPreview(CalPrinter *calPrinter, | 201 | virtual void printPreview(CalPrinter *calPrinter, |
202 | const QDate &, const QDate &); | 202 | const QDate &, const QDate &); |
203 | bool isMonthView() { return true; } | ||
203 | 204 | ||
204 | MonthViewCell * selectedCell(); | 205 | MonthViewCell * selectedCell(); |
205 | public slots: | 206 | public slots: |
206 | virtual void updateView(); | 207 | virtual void updateView(); |
207 | virtual void updateConfig(); | 208 | virtual void updateConfig(); |
208 | virtual void showDates(const QDate &start, const QDate &end); | 209 | virtual void showDates(const QDate &start, const QDate &end); |
209 | virtual void showEvents(QPtrList<Event> eventList); | 210 | virtual void showEvents(QPtrList<Event> eventList); |
210 | 211 | ||
211 | void changeEventDisplay(Event *, int); | 212 | void changeEventDisplay(Event *, int); |
212 | 213 | ||
213 | void clearSelection(); | 214 | void clearSelection(); |
214 | 215 | ||
215 | void showContextMenu( Incidence * ); | 216 | void showContextMenu( Incidence * ); |
216 | 217 | ||
217 | void setSelectedCell( MonthViewCell * ); | 218 | void setSelectedCell( MonthViewCell * ); |
218 | 219 | ||
219 | protected slots: | 220 | protected slots: |
220 | void processSelectionChange(); | 221 | void processSelectionChange(); |
221 | signals: | 222 | signals: |
222 | void selectWeekNum ( int ); | 223 | void selectWeekNum ( int ); |
223 | protected: | 224 | protected: |
224 | void resizeEvent(QResizeEvent *); | 225 | void resizeEvent(QResizeEvent *); |
225 | void viewChanged(); | 226 | void viewChanged(); |
226 | void updateDayLabels(); | 227 | void updateDayLabels(); |
227 | 228 | ||
228 | private: | 229 | private: |
229 | int mDaysPerWeek; | 230 | int mDaysPerWeek; |
230 | int mNumWeeks; | 231 | int mNumWeeks; |
231 | int mNumCells; | 232 | int mNumCells; |
232 | bool mWeekStartsMonday; | 233 | bool mWeekStartsMonday; |
233 | bool mShowSatSunComp; | 234 | bool mShowSatSunComp; |
234 | void computeLayout(); | 235 | void computeLayout(); |
235 | 236 | ||
236 | QPtrVector<MonthViewCell> mCells; | 237 | QPtrVector<MonthViewCell> mCells; |
237 | QPtrVector<QLabel> mDayLabels; | 238 | QPtrVector<QLabel> mDayLabels; |
238 | QPtrVector<KOWeekButton> mWeekLabels; | 239 | QPtrVector<KOWeekButton> mWeekLabels; |
239 | 240 | ||
240 | bool mShortDayLabels; | 241 | bool mShortDayLabels; |
241 | int mWidthLongDayLabel; | 242 | int mWidthLongDayLabel; |
242 | 243 | ||
243 | QDate mStartDate; | 244 | QDate mStartDate; |
244 | 245 | ||
245 | MonthViewCell *mSelectedCell; | 246 | MonthViewCell *mSelectedCell; |
246 | 247 | ||
247 | KOEventPopupMenu *mContextMenu; | 248 | KOEventPopupMenu *mContextMenu; |
248 | void keyPressEvent ( QKeyEvent * ) ; | 249 | void keyPressEvent ( QKeyEvent * ) ; |
249 | 250 | ||
250 | }; | 251 | }; |
251 | 252 | ||
252 | #endif | 253 | #endif |