author | zautrix <zautrix> | 2005-01-05 14:55:14 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-05 14:55:14 (UTC) |
commit | 71017beb975666a0f654898ed6a40a5303d567dc (patch) (unidiff) | |
tree | 39f3c0e3c890ee90806e93d9ce9bd9024be11d55 | |
parent | df0200487afbfa59b80a79e548d70b5203019003 (diff) | |
download | kdepimpi-71017beb975666a0f654898ed6a40a5303d567dc.zip kdepimpi-71017beb975666a0f654898ed6a40a5303d567dc.tar.gz kdepimpi-71017beb975666a0f654898ed6a40a5303d567dc.tar.bz2 |
minor fixes
-rw-r--r-- | bin/kdepim/WhatsNew.txt | 1 | ||||
-rw-r--r-- | korganizer/koagenda.cpp | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index bfe87f0..1a8b885 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt | |||
@@ -1,657 +1,658 @@ | |||
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.16 ************ | 3 | ********** VERSION 1.9.16 ************ |
4 | 4 | ||
5 | KO/Pi: | 5 | KO/Pi: |
6 | Fixed search dialog size on Z 6000 (480x640 display). | 6 | Fixed search dialog size on Z 6000 (480x640 display). |
7 | Added setting to hide/show time in agenda items. | 7 | Added setting to hide/show time in agenda items. |
8 | Added setting to hide not running todos in todo view. | 8 | Added setting to hide not running todos in todo view. |
9 | Added columns for start date/time in todo view. | 9 | Added columns for start date/time in todo view. |
10 | Replaced the solid half-hour lines in agenda view by dot lines. | ||
10 | 11 | ||
11 | ********** VERSION 1.9.15 ************ | 12 | ********** VERSION 1.9.15 ************ |
12 | 13 | ||
13 | Usebilty enhancements in KO/Pi: | 14 | Usebilty enhancements in KO/Pi: |
14 | When clicking on the date in a month view cell, the day view is shown. | 15 | When clicking on the date in a month view cell, the day view is shown. |
15 | Old behaviour was, that the "new event" dialog popped up. | 16 | Old behaviour was, that the "new event" dialog popped up. |
16 | 17 | ||
17 | Added a one step "undo delete" in KO/Pi (Accessable in the "Action" menu). | 18 | Added a one step "undo delete" in KO/Pi (Accessable in the "Action" menu). |
18 | That means, you can restore the latest | 19 | That means, you can restore the latest |
19 | event/todo/journal you have deleted. | 20 | event/todo/journal you have deleted. |
20 | A journal is deleted, if you clear all the text of the journal. | 21 | A journal is deleted, if you clear all the text of the journal. |
21 | 22 | ||
22 | Fixed the bug of the editor dialogs in KO/Pi of version 1.9.14. | 23 | Fixed the bug of the editor dialogs in KO/Pi of version 1.9.14. |
23 | 24 | ||
24 | KA/Pi starting in 480x640 resolution: | 25 | KA/Pi starting in 480x640 resolution: |
25 | Hide the filter action in toolbar | 26 | Hide the filter action in toolbar |
26 | and added icons for undo/delete/redo in toolbar. | 27 | and added icons for undo/delete/redo in toolbar. |
27 | 28 | ||
28 | Change in OM/Pi ViewMail dialog: | 29 | Change in OM/Pi ViewMail dialog: |
29 | When clicking on the "delete" icon the mail is deleted after confirmation as usual. But the edit dialog is not closed as before, now the next mail in the folder is shown automatically (if there is any). | 30 | When clicking on the "delete" icon the mail is deleted after confirmation as usual. But the edit dialog is not closed as before, now the next mail in the folder is shown automatically (if there is any). |
30 | 31 | ||
31 | Fixed a crash when deleting mail-accounts in OM/Pi. | 32 | Fixed a crash when deleting mail-accounts in OM/Pi. |
32 | 33 | ||
33 | 34 | ||
34 | ********** VERSION 1.9.14 ************ | 35 | ********** VERSION 1.9.14 ************ |
35 | 36 | ||
36 | Fixed some problems with the dialog sizes when switching | 37 | Fixed some problems with the dialog sizes when switching |
37 | portrait/landscape mode on 640x480 PDA display. | 38 | portrait/landscape mode on 640x480 PDA display. |
38 | 39 | ||
39 | Fixed some other small bugs in KA/Pi KO/Pi and OM/Pi and PwM/Pi. | 40 | Fixed some other small bugs in KA/Pi KO/Pi and OM/Pi and PwM/Pi. |
40 | 41 | ||
41 | Fixed an ugly bug in KOpieMail: | 42 | Fixed an ugly bug in KOpieMail: |
42 | KOpieMail was not able to write files (mails) to MSDOS file system, | 43 | KOpieMail was not able to write files (mails) to MSDOS file system, |
43 | like on an usual preformatted SD card. That should work now. | 44 | like on an usual preformatted SD card. That should work now. |
44 | To save your mail data on the Sd card do the following: | 45 | To save your mail data on the Sd card do the following: |
45 | Create a dir on the SD card: | 46 | Create a dir on the SD card: |
46 | mkdir /mnt/card/localmail | 47 | mkdir /mnt/card/localmail |
47 | Go to your home dir: | 48 | Go to your home dir: |
48 | cd | 49 | cd |
49 | Go to kopiemail data storage dir: | 50 | Go to kopiemail data storage dir: |
50 | cd kdepim/apps/kopiemail | 51 | cd kdepim/apps/kopiemail |
51 | Create a symlink to the SD card: | 52 | Create a symlink to the SD card: |
52 | ls -s /mnt/card/localmail | 53 | ls -s /mnt/card/localmail |
53 | Now KOpieMail will store all mails on the SD card. | 54 | Now KOpieMail will store all mails on the SD card. |
54 | 55 | ||
55 | KO/Pi Monthview: | 56 | KO/Pi Monthview: |
56 | Now "Go to Today" selects the current month from day 1-end, | 57 | Now "Go to Today" selects the current month from day 1-end, |
57 | not the current date + some days. | 58 | not the current date + some days. |
58 | I.e. "Go to Today" shows now always | 59 | I.e. "Go to Today" shows now always |
59 | the current month with first day of month in the first row. | 60 | the current month with first day of month in the first row. |
60 | 61 | ||
61 | Added missing German translation. | 62 | Added missing German translation. |
62 | 63 | ||
63 | Fixed icons of executeable on Wintendo. | 64 | Fixed icons of executeable on Wintendo. |
64 | 65 | ||
65 | Added a "Show next Mail" button to the OM/Pi | 66 | Added a "Show next Mail" button to the OM/Pi |
66 | mail viewer such that the mail below the current mail | 67 | mail viewer such that the mail below the current mail |
67 | in the mail list view of the current folder | 68 | in the mail list view of the current folder |
68 | can be read with a single click. | 69 | can be read with a single click. |
69 | 70 | ||
70 | 71 | ||
71 | ********** VERSION 1.9.13 ************ | 72 | ********** VERSION 1.9.13 ************ |
72 | 73 | ||
73 | Fixed nasty PwM/Pi file reading bug, when | 74 | Fixed nasty PwM/Pi file reading bug, when |
74 | the used hash algo of file is different then the global | 75 | the used hash algo of file is different then the global |
75 | hash algo. | 76 | hash algo. |
76 | 77 | ||
77 | Added KA/Pi support for opie mailit mailapplication. | 78 | Added KA/Pi support for opie mailit mailapplication. |
78 | 79 | ||
79 | Fixed some bugs in OM/Pi. | 80 | Fixed some bugs in OM/Pi. |
80 | Now character conversion tables are available for the Zaurus | 81 | Now character conversion tables are available for the Zaurus |
81 | to make OM/Pi working properly. | 82 | to make OM/Pi working properly. |
82 | To get the character conversion in OM/Pi working, please download | 83 | To get the character conversion in OM/Pi working, please download |
83 | at the sourceforge project site the package | 84 | at the sourceforge project site the package |
84 | sr-character-conversion_SharpROM_arm.ipk.zip | 85 | sr-character-conversion_SharpROM_arm.ipk.zip |
85 | (or oz-character-conversion_OZ-gcc3xx_arm.ipk.zip for OZ roms) | 86 | (or oz-character-conversion_OZ-gcc3xx_arm.ipk.zip for OZ roms) |
86 | from the section "general files for KDE/Pim" | 87 | from the section "general files for KDE/Pim" |
87 | Instructions how to install this package are in a ReadMe in this file. | 88 | Instructions how to install this package are in a ReadMe in this file. |
88 | 89 | ||
89 | 90 | ||
90 | Fixed the orientation change problem in KA/Pi when switching | 91 | Fixed the orientation change problem in KA/Pi when switching |
91 | portrait/landscape mode. | 92 | portrait/landscape mode. |
92 | 93 | ||
93 | French translation available for KA/Pi and OM/Pi. | 94 | French translation available for KA/Pi and OM/Pi. |
94 | 95 | ||
95 | Fixed some problems with categories in KO/Pi in DTM sync. | 96 | Fixed some problems with categories in KO/Pi in DTM sync. |
96 | 97 | ||
97 | Added selection dialog for export to phone in KA/Pi. | 98 | Added selection dialog for export to phone in KA/Pi. |
98 | 99 | ||
99 | If in KO/Pi is an attendee selected to add to a meeting and this | 100 | If in KO/Pi is an attendee selected to add to a meeting and this |
100 | attendee is already in the list of attendees, this person is not added | 101 | attendee is already in the list of attendees, this person is not added |
101 | again. | 102 | again. |
102 | 103 | ||
103 | Some menu cleanup in KA/Pi. | 104 | Some menu cleanup in KA/Pi. |
104 | 105 | ||
105 | ********** VERSION 1.9.12 ************ | 106 | ********** VERSION 1.9.12 ************ |
106 | 107 | ||
107 | Fix for the bug in KO/Pi What's Next view of version 1.9.11. | 108 | Fix for the bug in KO/Pi What's Next view of version 1.9.11. |
108 | 109 | ||
109 | Bugfix: Licence file is now shown again. | 110 | Bugfix: Licence file is now shown again. |
110 | 111 | ||
111 | OM/Pi now supports Unicode (utf8 charset). | 112 | OM/Pi now supports Unicode (utf8 charset). |
112 | Fixed some bugs in OM/Pi. | 113 | Fixed some bugs in OM/Pi. |
113 | 114 | ||
114 | KA/Pi has more German translation. | 115 | KA/Pi has more German translation. |
115 | 116 | ||
116 | 117 | ||
117 | ********** VERSION 1.9.11 ************ | 118 | ********** VERSION 1.9.11 ************ |
118 | 119 | ||
119 | Fixed several problems in PWM/Pi, like | 120 | Fixed several problems in PWM/Pi, like |
120 | asking the user, if unsaved changed are pending | 121 | asking the user, if unsaved changed are pending |
121 | when closing the app. | 122 | when closing the app. |
122 | And PwM/Pi handles now different texts for the | 123 | And PwM/Pi handles now different texts for the |
123 | fields Description, Username, Password, configurable per category. | 124 | fields Description, Username, Password, configurable per category. |
124 | 125 | ||
125 | Fixed a crash in KO/Pi , when importing/loading vcs files | 126 | Fixed a crash in KO/Pi , when importing/loading vcs files |
126 | which have an entry with an attendee with state: | 127 | which have an entry with an attendee with state: |
127 | NEEDS ACTION | 128 | NEEDS ACTION |
128 | 129 | ||
129 | Fixed some problems in the German translation of OM/Pi, | 130 | Fixed some problems in the German translation of OM/Pi, |
130 | which makes some dialogs not fitting on the screen | 131 | which makes some dialogs not fitting on the screen |
131 | of the Z 5500. | 132 | of the Z 5500. |
132 | 133 | ||
133 | Fixed Qtopia crash, when disabling/deinstalling | 134 | Fixed Qtopia crash, when disabling/deinstalling |
134 | KO/Pi alarm applet. | 135 | KO/Pi alarm applet. |
135 | 136 | ||
136 | Implemented direct KDE<->KA/Pi sync for KA/Pi running | 137 | Implemented direct KDE<->KA/Pi sync for KA/Pi running |
137 | on Linux desktop. | 138 | on Linux desktop. |
138 | 139 | ||
139 | Added feature "remove sync info" to sync menu. | 140 | Added feature "remove sync info" to sync menu. |
140 | 141 | ||
141 | Tweaked the KO/Pi What's next view a bit, added | 142 | Tweaked the KO/Pi What's next view a bit, added |
142 | setting to hide events that are done. | 143 | setting to hide events that are done. |
143 | 144 | ||
144 | Disabled "beam receive enabled" on startup to | 145 | Disabled "beam receive enabled" on startup to |
145 | avoid problems if Fastload is enabled. | 146 | avoid problems if Fastload is enabled. |
146 | Please set "beam receive enabled", | 147 | Please set "beam receive enabled", |
147 | if you want to receive data via IR. | 148 | if you want to receive data via IR. |
148 | 149 | ||
149 | Fixed bug in direct KDE<->KO/Pi sync for KO/Pi running | 150 | Fixed bug in direct KDE<->KO/Pi sync for KO/Pi running |
150 | on Linux desktop. | 151 | on Linux desktop. |
151 | 152 | ||
152 | Made in KA/Pi scrolling possible, if details view is selected. | 153 | Made in KA/Pi scrolling possible, if details view is selected. |
153 | (The keyboard focus is set automatically to the search line) | 154 | (The keyboard focus is set automatically to the search line) |
154 | 155 | ||
155 | Fixed a bug in DMT sync, that a new entry in DTM was added | 156 | Fixed a bug in DMT sync, that a new entry in DTM was added |
156 | on every sync to Kx/Pi. | 157 | on every sync to Kx/Pi. |
157 | 158 | ||
158 | Fixed missing writing of KA/Pi categories to DMT entries when syncing. | 159 | Fixed missing writing of KA/Pi categories to DMT entries when syncing. |
159 | 160 | ||
160 | Fixed a bug in DMT sync with todos created in KO/Pi containing | 161 | Fixed a bug in DMT sync with todos created in KO/Pi containing |
161 | non-latin1 characters. | 162 | non-latin1 characters. |
162 | 163 | ||
163 | Rearranged package contents of Sharp-ipks and made all | 164 | Rearranged package contents of Sharp-ipks and made all |
164 | packages installable on SD again. | 165 | packages installable on SD again. |
165 | 166 | ||
166 | Fixed the writing of addressbook data in DTM sync. | 167 | Fixed the writing of addressbook data in DTM sync. |
167 | Empty fields in KA/Pi were not removed. | 168 | Empty fields in KA/Pi were not removed. |
168 | 169 | ||
169 | Added better category handling in KA/Pi: | 170 | Added better category handling in KA/Pi: |
170 | Added item | 171 | Added item |
171 | Edit Categories and | 172 | Edit Categories and |
172 | Manage new categories | 173 | Manage new categories |
173 | to the settings menu. | 174 | to the settings menu. |
174 | Possible to configure a view to display categories. | 175 | Possible to configure a view to display categories. |
175 | 176 | ||
176 | Added detailed "KDE Sync Howto" and "Multi Sync Howto" to Help menu. | 177 | Added detailed "KDE Sync Howto" and "Multi Sync Howto" to Help menu. |
177 | 178 | ||
178 | Fixed displaying of "free" days and time in KO Monthview and Agendaview. | 179 | Fixed displaying of "free" days and time in KO Monthview and Agendaview. |
179 | 180 | ||
180 | ... and many other bugfixes. | 181 | ... and many other bugfixes. |
181 | 182 | ||
182 | ********** VERSION 1.9.10 ************ | 183 | ********** VERSION 1.9.10 ************ |
183 | 184 | ||
184 | Many internal small bugfixes. | 185 | Many internal small bugfixes. |
185 | And fix of the "big" bug in KO/Pi, | 186 | And fix of the "big" bug in KO/Pi, |
186 | that after Syncing the appointments had an offset by several hours. | 187 | that after Syncing the appointments had an offset by several hours. |
187 | That was a problem with the internal timezone setting, | 188 | That was a problem with the internal timezone setting, |
188 | introduced by the changed timezone configuration settings. | 189 | introduced by the changed timezone configuration settings. |
189 | 190 | ||
190 | German translation for OM/Pi is now available. | 191 | German translation for OM/Pi is now available. |
191 | 192 | ||
192 | 193 | ||
193 | ********** VERSION 1.9.9 ************ | 194 | ********** VERSION 1.9.9 ************ |
194 | 195 | ||
195 | KDE-Pim/Pi has a new Member! | 196 | KDE-Pim/Pi has a new Member! |
196 | It is called PWM/Pi (Passwordmanager/platform-independent) | 197 | It is called PWM/Pi (Passwordmanager/platform-independent) |
197 | and it is available for the Zaurus. | 198 | and it is available for the Zaurus. |
198 | It is planned, that it will be available later for Windows. | 199 | It is planned, that it will be available later for Windows. |
199 | (And for Linux, of course). | 200 | (And for Linux, of course). |
200 | It is a port of the Passwordmanager of KDE. | 201 | It is a port of the Passwordmanager of KDE. |
201 | It will need the MicroKDElibs to run. | 202 | It will need the MicroKDElibs to run. |
202 | 203 | ||
203 | Made loading of addressbooks in KA/Pi up to 7 times faster! | 204 | Made loading of addressbooks in KA/Pi up to 7 times faster! |
204 | The bigger your addressbook file, the more starting speed | 205 | The bigger your addressbook file, the more starting speed |
205 | will you gain. (relatively) | 206 | will you gain. (relatively) |
206 | 207 | ||
207 | The Qtopia addressbook connector is now platform independend | 208 | The Qtopia addressbook connector is now platform independend |
208 | as well and should work on any platform for importing/exporting | 209 | as well and should work on any platform for importing/exporting |
209 | Qtopia and Opie XML files. | 210 | Qtopia and Opie XML files. |
210 | 211 | ||
211 | Added a +30min feature to the timezone settings to make | 212 | Added a +30min feature to the timezone settings to make |
212 | KDE-Pim/Pi useable in Australia and other parts on the | 213 | KDE-Pim/Pi useable in Australia and other parts on the |
213 | world with strange timezones ;-) | 214 | world with strange timezones ;-) |
214 | 215 | ||
215 | German "Umlaute" should now be sorted correctly on the Z in KA/Pi. | 216 | German "Umlaute" should now be sorted correctly on the Z in KA/Pi. |
216 | 217 | ||
217 | It is now possible to disable the | 218 | It is now possible to disable the |
218 | "receive data via infrared" feature, such that syncing with | 219 | "receive data via infrared" feature, such that syncing with |
219 | Outlook is now possible again with Kx/Pi runing. | 220 | Outlook is now possible again with Kx/Pi runing. |
220 | Please disable it, before syncing Sharp DTM with Outlook. | 221 | Please disable it, before syncing Sharp DTM with Outlook. |
221 | For your convenience, the "receive data via infrared" feature | 222 | For your convenience, the "receive data via infrared" feature |
222 | is disabled automatically, if you sync Kx/Pi with DTM. | 223 | is disabled automatically, if you sync Kx/Pi with DTM. |
223 | You have to enable it again manually after syncing. | 224 | You have to enable it again manually after syncing. |
224 | Enabling this feature makes it impossible to start the | 225 | Enabling this feature makes it impossible to start the |
225 | Sharp DTM apps. If this feature is enabled, you will only get the | 226 | Sharp DTM apps. If this feature is enabled, you will only get the |
226 | alarm notification from KO/Pi and not from the Sharp calendar. | 227 | alarm notification from KO/Pi and not from the Sharp calendar. |
227 | This is very useful if you sync KO/Pi with Sharp DTM, | 228 | This is very useful if you sync KO/Pi with Sharp DTM, |
228 | because after syncing you usually would get notified about | 229 | because after syncing you usually would get notified about |
229 | an alarm by KO/Pi and the Sharp Calendar. | 230 | an alarm by KO/Pi and the Sharp Calendar. |
230 | 231 | ||
231 | Together with the Linux desktop version of KO/Pi | 232 | Together with the Linux desktop version of KO/Pi |
232 | it is now possible to sync KO/Pi on the Zaurus | 233 | it is now possible to sync KO/Pi on the Zaurus |
233 | with the complete KDE-desktop (3.3 or later) | 234 | with the complete KDE-desktop (3.3 or later) |
234 | calendar data easily. | 235 | calendar data easily. |
235 | That makes it possible to sync the Z with one | 236 | That makes it possible to sync the Z with one |
236 | click of a mouse with the KDE-Desktop. | 237 | click of a mouse with the KDE-Desktop. |
237 | This feature it available for all Zaurus platforms KO/Pi | 238 | This feature it available for all Zaurus platforms KO/Pi |
238 | is running on. | 239 | is running on. |
239 | The only thing needed is a running KO/Pi on Linux and | 240 | The only thing needed is a running KO/Pi on Linux and |
240 | a compiled version of the small | 241 | a compiled version of the small |
241 | KDE-Pim/Pi<->KDE-Desktop access command line program, | 242 | KDE-Pim/Pi<->KDE-Desktop access command line program, |
242 | which is in the KDE-Pim/Pi sources available. | 243 | which is in the KDE-Pim/Pi sources available. |
243 | 244 | ||
244 | The "KDE-desktop" syncing feature for KA/Pi will follow | 245 | The "KDE-desktop" syncing feature for KA/Pi will follow |
245 | in the next releases. | 246 | in the next releases. |
246 | 247 | ||
247 | Fixed the vcard export bug, which had the version 1.9.8. | 248 | Fixed the vcard export bug, which had the version 1.9.8. |
248 | 249 | ||
249 | Added missing GERMAN translation to KO/Pi. | 250 | Added missing GERMAN translation to KO/Pi. |
250 | Hi PsionX, could you add the missing french translation?Thx! | 251 | Hi PsionX, could you add the missing french translation?Thx! |
251 | 252 | ||
252 | Translation files for KA/Pi are available as well. | 253 | Translation files for KA/Pi are available as well. |
253 | GERMAN translation will be available in the next release. | 254 | GERMAN translation will be available in the next release. |
254 | PsionX ( yres, you again ;-) ), could you start translating | 255 | PsionX ( yres, you again ;-) ), could you start translating |
255 | KA/Pi? Thx! | 256 | KA/Pi? Thx! |
256 | 257 | ||
257 | You can download the version 1.9.9 at | 258 | You can download the version 1.9.9 at |
258 | 259 | ||
259 | http://sourceforge.net/project/showfiles.php?group_id=104103&package_id=112604 | 260 | http://sourceforge.net/project/showfiles.php?group_id=104103&package_id=112604 |
260 | 261 | ||
261 | Note: | 262 | Note: |
262 | To run the mail program OM/Pi you need libopenssl. | 263 | To run the mail program OM/Pi you need libopenssl. |
263 | A link to a download loaction is available at | 264 | A link to a download loaction is available at |
264 | ZSI at www.killefiz.de | 265 | ZSI at www.killefiz.de |
265 | 266 | ||
266 | 267 | ||
267 | ********** VERSION 1.9.8 ************ | 268 | ********** VERSION 1.9.8 ************ |
268 | 269 | ||
269 | Fixed character decoding in OM/Pi. | 270 | Fixed character decoding in OM/Pi. |
270 | (e.g. German "Umlaute" were not displayed properly.) | 271 | (e.g. German "Umlaute" were not displayed properly.) |
271 | 272 | ||
272 | Made is possible to reparent todos in KO/Pi. | 273 | Made is possible to reparent todos in KO/Pi. |
273 | Use contextmenu or keys (look at Help-Keys + Colors) for that. | 274 | Use contextmenu or keys (look at Help-Keys + Colors) for that. |
274 | 275 | ||
275 | Added the missing Sync-Howto and WhatsNew to the packages. | 276 | Added the missing Sync-Howto and WhatsNew to the packages. |
276 | 277 | ||
277 | KO/Pi on Linux desktop can now sync with KDE desktop. | 278 | KO/Pi on Linux desktop can now sync with KDE desktop. |
278 | That means: When using KO/Pi on Linux desktop for syncing with | 279 | That means: When using KO/Pi on Linux desktop for syncing with |
279 | KDE desktop and the Zaurus, the Zaurus can be synced now | 280 | KDE desktop and the Zaurus, the Zaurus can be synced now |
280 | with all KDE-Calendar resources, not only with one local file. | 281 | with all KDE-Calendar resources, not only with one local file. |
281 | (That makes it possible to sync the Zaurus with the | 282 | (That makes it possible to sync the Zaurus with the |
282 | calendar data on a Kolab server) | 283 | calendar data on a Kolab server) |
283 | 284 | ||
284 | KA/Pi syncing with KDE desktop will be available in the next version. | 285 | KA/Pi syncing with KDE desktop will be available in the next version. |
285 | 286 | ||
286 | 287 | ||
287 | ********** VERSION 1.9.7 ************ | 288 | ********** VERSION 1.9.7 ************ |
288 | 289 | ||
289 | KO/Pi - KA/Pi on Windows: | 290 | KO/Pi - KA/Pi on Windows: |
290 | Now a directory can be defined by the user, where the | 291 | Now a directory can be defined by the user, where the |
291 | application/config data should be saved. | 292 | application/config data should be saved. |
292 | Define your desired path in the evironment variable | 293 | Define your desired path in the evironment variable |
293 | MICROKDEHOME | 294 | MICROKDEHOME |
294 | before starting KO/Pi or KA/Pi. | 295 | before starting KO/Pi or KA/Pi. |
295 | 296 | ||
296 | An easy Kx/Pi to Kx/Pi syncing is now possible | 297 | An easy Kx/Pi to Kx/Pi syncing is now possible |
297 | (it is called Pi-Sync) via network. | 298 | (it is called Pi-Sync) via network. |
298 | Please look at the Sync Howto. | 299 | Please look at the Sync Howto. |
299 | 300 | ||
300 | Exporting of calendar data and contacts to mobile phones is now possible. | 301 | Exporting of calendar data and contacts to mobile phones is now possible. |
301 | The SyncHowto is updated with information howto | 302 | The SyncHowto is updated with information howto |
302 | access/sync mobile phones. | 303 | access/sync mobile phones. |
303 | Please look at the Sync Howto. | 304 | Please look at the Sync Howto. |
304 | 305 | ||
305 | Now KO/Pi and KA/Pi on the Zaurus can receive data via infrared directly. | 306 | Now KO/Pi and KA/Pi on the Zaurus can receive data via infrared directly. |
306 | Please disable Fastload for the original contact/calendar applications | 307 | Please disable Fastload for the original contact/calendar applications |
307 | and close them. | 308 | and close them. |
308 | KO/Pi and KA/Pi must be running in order to receive the data. | 309 | KO/Pi and KA/Pi must be running in order to receive the data. |
309 | (KO/Pi and KA/Pi are always running if Fastload for them is enabled!) | 310 | (KO/Pi and KA/Pi are always running if Fastload for them is enabled!) |
310 | 311 | ||
311 | In the KA/Pi details view are now the preferred tel. numbers displayed on top | 312 | In the KA/Pi details view are now the preferred tel. numbers displayed on top |
312 | of the other data ( emails/tel.numbers/addresses) | 313 | of the other data ( emails/tel.numbers/addresses) |
313 | 314 | ||
314 | Fixed some syncing problems in KA/Pi. | 315 | Fixed some syncing problems in KA/Pi. |
315 | 316 | ||
316 | Added font settings for the KA/Pi details view. | 317 | Added font settings for the KA/Pi details view. |
317 | Added fields "children's name" and "gender" to KA/Pi. | 318 | Added fields "children's name" and "gender" to KA/Pi. |
318 | 319 | ||
319 | Made searching in KA/Pi better: | 320 | Made searching in KA/Pi better: |
320 | Now the first item in a view is selected after a search automatically and | 321 | Now the first item in a view is selected after a search automatically and |
321 | the views can be scrolled up/down when the search input field has the keyboard focus. | 322 | the views can be scrolled up/down when the search input field has the keyboard focus. |
322 | 323 | ||
323 | And, of course, fixed a bunch of reported bugs in KO/Pi and KA/Pi. | 324 | And, of course, fixed a bunch of reported bugs in KO/Pi and KA/Pi. |
324 | 325 | ||
325 | 326 | ||
326 | ********** VERSION 1.9.6 ************ | 327 | ********** VERSION 1.9.6 ************ |
327 | 328 | ||
328 | Changes in the external application communication on the Zaurus | 329 | Changes in the external application communication on the Zaurus |
329 | in order to use less RAM when the apps are running. | 330 | in order to use less RAM when the apps are running. |
330 | First syncing of addressbooks (KA/Pi) is possible. | 331 | First syncing of addressbooks (KA/Pi) is possible. |
331 | 332 | ||
332 | 333 | ||
333 | ********** VERSION 1.9.5a ************ | 334 | ********** VERSION 1.9.5a ************ |
334 | 335 | ||
335 | Fixed a bug in KO/Pi in the SharpDTM sync of version 1.9.5. | 336 | Fixed a bug in KO/Pi in the SharpDTM sync of version 1.9.5. |
336 | Fixed some small bugs. | 337 | Fixed some small bugs. |
337 | KA/Pi shows now the birthday in summary view. | 338 | KA/Pi shows now the birthday in summary view. |
338 | Now OM/Pi and KA/Pi are using the date format defined in KO/Pi | 339 | Now OM/Pi and KA/Pi are using the date format defined in KO/Pi |
339 | for displaying dates. | 340 | for displaying dates. |
340 | 341 | ||
341 | 342 | ||
342 | ********** VERSION 1.9.5 ************ | 343 | ********** VERSION 1.9.5 ************ |
343 | 344 | ||
344 | There is still no Addressbook syncing! | 345 | There is still no Addressbook syncing! |
345 | 346 | ||
346 | New in 1.9.5: | 347 | New in 1.9.5: |
347 | 348 | ||
348 | Many bugfixes. | 349 | Many bugfixes. |
349 | Better searching in KA/Pi. | 350 | Better searching in KA/Pi. |
350 | You can configure in KA/Pi if you want to search only after | 351 | You can configure in KA/Pi if you want to search only after |
351 | <return> key pressed. | 352 | <return> key pressed. |
352 | 353 | ||
353 | Better mail downloading in OM/Pi. | 354 | Better mail downloading in OM/Pi. |
354 | 355 | ||
355 | First experimental alpha version of sync of KO/Pi with mobile phones. | 356 | First experimental alpha version of sync of KO/Pi with mobile phones. |
356 | See gammu documentation for supported phones. | 357 | See gammu documentation for supported phones. |
357 | 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. | 358 | 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. |
358 | Quick hint how to use: | 359 | Quick hint how to use: |
359 | NOTE: MOBILE PHONE SYNC IS EXPERIMENTAL! | 360 | NOTE: MOBILE PHONE SYNC IS EXPERIMENTAL! |
360 | Install kammu_1.9.5_arm.ipk , libbluetooth and libsdp. | 361 | Install kammu_1.9.5_arm.ipk , libbluetooth and libsdp. |
361 | Create syncprofile - mobile device | 362 | Create syncprofile - mobile device |
362 | Remove entry for model. (Leave empty ). | 363 | Remove entry for model. (Leave empty ). |
363 | Enable infrared on Zaurus and your Phone. | 364 | Enable infrared on Zaurus and your Phone. |
364 | Sync. | 365 | Sync. |
365 | To get a more detailed log, start kopi from konsole. | 366 | To get a more detailed log, start kopi from konsole. |
366 | 367 | ||
367 | ********** VERSION 1.9.4 ************ | 368 | ********** VERSION 1.9.4 ************ |
368 | 369 | ||
369 | This is the version 1.9.4 of KDE-Pim/Pi for the Zaurus. | 370 | This is the version 1.9.4 of KDE-Pim/Pi for the Zaurus. |
370 | 371 | ||
371 | WARNING: | 372 | WARNING: |
372 | PLEASE BACKUP ALL YOUR DATA! | 373 | PLEASE BACKUP ALL YOUR DATA! |
373 | We have changed a lot and maybe there are some unknown problems. | 374 | We have changed a lot and maybe there are some unknown problems. |
374 | 375 | ||
375 | SYNC HANDLING HAS CHANGED! | 376 | SYNC HANDLING HAS CHANGED! |
376 | Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. | 377 | Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. |
377 | (This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). | 378 | (This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). |
378 | 379 | ||
379 | You need the kmicrokdelibs_1.9.4_arm.ipk as a base for the other programs. | 380 | You need the kmicrokdelibs_1.9.4_arm.ipk as a base for the other programs. |
380 | 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. | 381 | 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. |
381 | 382 | ||
382 | As programs are available: | 383 | As programs are available: |
383 | KO/Pi (korganizer ipk) - a calendar program. | 384 | KO/Pi (korganizer ipk) - a calendar program. |
384 | KA/Pi (kaddressbook ipk ) - an addressbook | 385 | KA/Pi (kaddressbook ipk ) - an addressbook |
385 | OM/Pi (kopiemail ipk ) an email program with pop/smtp and IMAP support. | 386 | OM/Pi (kopiemail ipk ) an email program with pop/smtp and IMAP support. |
386 | 387 | ||
387 | An alarm notification program ( korganizer-alarm ipk ) for KO/Pi that notifies you about alarms, even if the Zaurus is in suspend mode. | 388 | An alarm notification program ( korganizer-alarm ipk ) for KO/Pi that notifies you about alarms, even if the Zaurus is in suspend mode. |
388 | (If you do not see an icon in the taskbar after installing korganizer-alarm, please restart Qtopia) | 389 | (If you do not see an icon in the taskbar after installing korganizer-alarm, please restart Qtopia) |
389 | 390 | ||
390 | All the applications are installed in a "Pim" TAB. | 391 | All the applications are installed in a "Pim" TAB. |
391 | 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 | 392 | 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 |
392 | 393 | ||
393 | All the application are integrated. | 394 | All the application are integrated. |
394 | 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. | 395 | 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. |
395 | 396 | ||
396 | HINT: | 397 | HINT: |
397 | If you install KPhone/Pi 0.9.7, it will be called, if you click in KA/Pi on a phone number. | 398 | If you install KPhone/Pi 0.9.7, it will be called, if you click in KA/Pi on a phone number. |
398 | 399 | ||
399 | What's new? | 400 | What's new? |
400 | 401 | ||
401 | SYNC HANDLING HAS CHANGED! | 402 | SYNC HANDLING HAS CHANGED! |
402 | Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. | 403 | Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. |
403 | (This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). | 404 | (This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). |
404 | 405 | ||
405 | New in OM/Pi: | 406 | New in OM/Pi: |
406 | 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. | 407 | 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. |
407 | 408 | ||
408 | New in KO/Pi: | 409 | New in KO/Pi: |
409 | French is now available for KO/Pi. | 410 | French is now available for KO/Pi. |
410 | Choose menu:Actions - Configure:TAB locale | 411 | Choose menu:Actions - Configure:TAB locale |
411 | Syncing has changed. | 412 | Syncing has changed. |
412 | Phone sync available soon. | 413 | Phone sync available soon. |
413 | Not much changes, I cannot remember them ... | 414 | Not much changes, I cannot remember them ... |
414 | 415 | ||
415 | New in KA/Pi: | 416 | New in KA/Pi: |
416 | Beaming possible. | 417 | Beaming possible. |
417 | Sharp DTM readonly access possible( create a new DTM resource ); | 418 | Sharp DTM readonly access possible( create a new DTM resource ); |
418 | Better searching possible. | 419 | Better searching possible. |
419 | Search is performed only after pressing the return key. | 420 | Search is performed only after pressing the return key. |
420 | Use wildcard * to specify parts of a name. | 421 | Use wildcard * to specify parts of a name. |
421 | 422 | ||
422 | 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 * . | 423 | 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 * . |
423 | 424 | ||
424 | A big improvement is the new management of the contact access. | 425 | A big improvement is the new management of the contact access. |
425 | In version 1.9.3, every application was using their own addressbook access data. | 426 | In version 1.9.3, every application was using their own addressbook access data. |
426 | That means, the addressbook was loaded up to three times in the memory, when accessed by KA/Pi, KO/Pi and OM/Pi. | 427 | That means, the addressbook was loaded up to three times in the memory, when accessed by KA/Pi, KO/Pi and OM/Pi. |
427 | That was wasting of memory, if you had several hundreds of contacts. | 428 | That was wasting of memory, if you had several hundreds of contacts. |
428 | 429 | ||
429 | Now only KA/Pi accesses the addressbook. | 430 | Now only KA/Pi accesses the addressbook. |
430 | 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. | 431 | 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. |
431 | If you click on an attendee in a meeting, its contact data is displayed in KA/Pi directly. | 432 | If you click on an attendee in a meeting, its contact data is displayed in KA/Pi directly. |
432 | That means, if KO/Pi or OM/Pi want to access contact data, KA/Pi is started first. | 433 | That means, if KO/Pi or OM/Pi want to access contact data, KA/Pi is started first. |
433 | 434 | ||
434 | New in the KO/Pi alarm applet: | 435 | New in the KO/Pi alarm applet: |
435 | Configure your own timer popup menu! | 436 | Configure your own timer popup menu! |
436 | (Text and minutes for timer countdown) | 437 | (Text and minutes for timer countdown) |
437 | Just edit the file | 438 | Just edit the file |
438 | (yourhomedir)/.kopialarmtimerrc | 439 | (yourhomedir)/.kopialarmtimerrc |
439 | and start/stop a timer to get a new menu with the data of this file. | 440 | and start/stop a timer to get a new menu with the data of this file. |
440 | 441 | ||
441 | ********** VERSION 1.9.3 ************ | 442 | ********** VERSION 1.9.3 ************ |
442 | 1) | 443 | 1) |
443 | Now KO/Pi on Windows imports directly the calendar data of | 444 | Now KO/Pi on Windows imports directly the calendar data of |
444 | an installed Outlook. Should work with OL version >= 2000. | 445 | an installed Outlook. Should work with OL version >= 2000. |
445 | 446 | ||
446 | ********** VERSION 1.9.2 ************ | 447 | ********** VERSION 1.9.2 ************ |
447 | 1) | 448 | 1) |
448 | KDE-Pim/Pi has got a new member: | 449 | KDE-Pim/Pi has got a new member: |
449 | KmicroMail (KM/Pi) is a mail program, | 450 | KmicroMail (KM/Pi) is a mail program, |
450 | which can handle IMAP and POP mail access. | 451 | which can handle IMAP and POP mail access. |
451 | It is based on Opie-Mail v3. | 452 | It is based on Opie-Mail v3. |
452 | All dependencies to the Opie libraries ar removed, | 453 | All dependencies to the Opie libraries ar removed, |
453 | such that no additional Opie lib is needed. | 454 | such that no additional Opie lib is needed. |
454 | It is already integrated in KO/Pi and KA/Pi. | 455 | It is already integrated in KO/Pi and KA/Pi. |
455 | It it now available for the Zaurus,probably it | 456 | It it now available for the Zaurus,probably it |
456 | will be available for other platforms later. | 457 | will be available for other platforms later. |
457 | Hint: | 458 | Hint: |
458 | Create your own contact (name + email) | 459 | Create your own contact (name + email) |
459 | in KA/Pi, select this contact and choose menu: | 460 | in KA/Pi, select this contact and choose menu: |
460 | Settings - Set Who Am I. | 461 | Settings - Set Who Am I. |
461 | Now the settings of this contact are used as | 462 | Now the settings of this contact are used as |
462 | the sender data in KM/Pi. | 463 | the sender data in KM/Pi. |
463 | 2) | 464 | 2) |
464 | KDE-Pim/Pi is split up in five different | 465 | KDE-Pim/Pi is split up in five different |
465 | packages now precompiled for Sharp Zaurus: | 466 | packages now precompiled for Sharp Zaurus: |
466 | --kmicrokdelibs_1.9.2_arm.ipk | 467 | --kmicrokdelibs_1.9.2_arm.ipk |
467 | The libs are needed for any | 468 | The libs are needed for any |
468 | of the following programs: | 469 | of the following programs: |
469 | --kaddressbook_1.9.2_arm.ipk | 470 | --kaddressbook_1.9.2_arm.ipk |
470 | --kmicromail_1.9.2_arm.ipk | 471 | --kmicromail_1.9.2_arm.ipk |
471 | --korganizer_1.9.2_arm.ipk | 472 | --korganizer_1.9.2_arm.ipk |
472 | Independ from that, there is the alarm applet | 473 | Independ from that, there is the alarm applet |
473 | available for KO/Pi, which also offers | 474 | available for KO/Pi, which also offers |
474 | quick access for a new mail or | 475 | quick access for a new mail or |
475 | showing the addressbook.: | 476 | showing the addressbook.: |
476 | --korganizer-alarm_1.9.2_arm.ipk | 477 | --korganizer-alarm_1.9.2_arm.ipk |
477 | Independend means, that the alarm applet | 478 | Independend means, that the alarm applet |
478 | does not need any of the libs or programs above to run. | 479 | does not need any of the libs or programs above to run. |
479 | But it would be quite useless without these programs. | 480 | But it would be quite useless without these programs. |
480 | NOTE: | 481 | NOTE: |
481 | If you get a | 482 | If you get a |
482 | "This application depends on other programs" | 483 | "This application depends on other programs" |
483 | during installation of | 484 | during installation of |
484 | --kmicrokdelibs_1.9.2_arm.ipk | 485 | --kmicrokdelibs_1.9.2_arm.ipk |
485 | you probably do not have to care about that. | 486 | you probably do not have to care about that. |
486 | kmicrokdelibs_1.9.2 will come with some | 487 | kmicrokdelibs_1.9.2 will come with some |
487 | resource plugins, which needs additional libraries. | 488 | resource plugins, which needs additional libraries. |
488 | (E.g. libopie1, if you want to use the | 489 | (E.g. libopie1, if you want to use the |
489 | opie resource connector in KA/Pi). | 490 | opie resource connector in KA/Pi). |
490 | If you do not have this libraries installed, | 491 | If you do not have this libraries installed, |
491 | you simply cannot use the resource. | 492 | you simply cannot use the resource. |
492 | To make it clear: | 493 | To make it clear: |
493 | If the libraries are missing, the applications | 494 | If the libraries are missing, the applications |
494 | using kmicrokdelibs will start, | 495 | using kmicrokdelibs will start, |
495 | because the resources are plugins. | 496 | because the resources are plugins. |
496 | 3) | 497 | 3) |
497 | KO/Pi and friends are now installable on SD-Card! | 498 | KO/Pi and friends are now installable on SD-Card! |
498 | It is recommended to install all libs and apps | 499 | It is recommended to install all libs and apps |
499 | on the SD card or all in the internal storage. | 500 | on the SD card or all in the internal storage. |
500 | There may be problems, if this is mixed. | 501 | There may be problems, if this is mixed. |
501 | 4) | 502 | 4) |
502 | Fixed two bugs in the alarm notification on Windows. | 503 | Fixed two bugs in the alarm notification on Windows. |
503 | 5) | 504 | 5) |
504 | Great improvement! | 505 | Great improvement! |
505 | KO/Pi uses now the latest version of libical. | 506 | KO/Pi uses now the latest version of libical. |
506 | Libical is the library which actually reads | 507 | Libical is the library which actually reads |
507 | the calendar files and extract the data from it. | 508 | the calendar files and extract the data from it. |
508 | With the old version, there were problems | 509 | With the old version, there were problems |
509 | (crashes or program hangs) when licical did read | 510 | (crashes or program hangs) when licical did read |
510 | files, which were not stored from KO/Pi. | 511 | files, which were not stored from KO/Pi. |
511 | I do not know, if the new libical works perfect, | 512 | I do not know, if the new libical works perfect, |
512 | but actually it works much better than | 513 | but actually it works much better than |
513 | the old version. | 514 | the old version. |
514 | There are no problems with compatibility with | 515 | There are no problems with compatibility with |
515 | old calendar files of KO/Pi, of course! | 516 | old calendar files of KO/Pi, of course! |
516 | 6) | 517 | 6) |
517 | New in KA/Pi: | 518 | New in KA/Pi: |
518 | Opie addressbook resource connector available! | 519 | Opie addressbook resource connector available! |
519 | You will need libopie1 and the opie addressbook, | 520 | You will need libopie1 and the opie addressbook, |
520 | of course. | 521 | of course. |
521 | With the Opie addressbook resource connector, | 522 | With the Opie addressbook resource connector, |
522 | you can access the Opie addressbook readonly in KA/Pi. | 523 | you can access the Opie addressbook readonly in KA/Pi. |
523 | If you want to edit or import the data into KA/Pi, | 524 | If you want to edit or import the data into KA/Pi, |
524 | do this: | 525 | do this: |
525 | a) Create an Opie resource. | 526 | a) Create an Opie resource. |
526 | (Menu: Settings-Configure Resources). | 527 | (Menu: Settings-Configure Resources). |
527 | After configuration and restarting KA/Pi you should see | 528 | After configuration and restarting KA/Pi you should see |
528 | the Opie contacts in KA/Pi. | 529 | the Opie contacts in KA/Pi. |
529 | b) Select some or all Opie contacts. | 530 | b) Select some or all Opie contacts. |
530 | (NOTE: +++++ | 531 | (NOTE: +++++ |
531 | To know exactly, what contacts are Opie contacts, | 532 | To know exactly, what contacts are Opie contacts, |
532 | do this: Choose menu: | 533 | do this: Choose menu: |
533 | View-Modify View - TAB Fields. | 534 | View-Modify View - TAB Fields. |
534 | Select in the above list "Resource" and click | 535 | Select in the above list "Resource" and click |
535 | down arrow to add it to the "Selected fields". | 536 | down arrow to add it to the "Selected fields". |
536 | Click OK. | 537 | Click OK. |
537 | Now you have a new column "Resource" in your list, | 538 | Now you have a new column "Resource" in your list, |
538 | where you can see, what an Opie resource is. | 539 | where you can see, what an Opie resource is. |
539 | ++++ NOTE end.) | 540 | ++++ NOTE end.) |
540 | Ok, we do have now some Opie contacts seleted. | 541 | Ok, we do have now some Opie contacts seleted. |
541 | (Use SHIFT or CTRL key in order to multiple select). | 542 | (Use SHIFT or CTRL key in order to multiple select). |
542 | c) Choose menu: Edit-Copy. | 543 | c) Choose menu: Edit-Copy. |
543 | d) Choose menu: Edit-Paste. | 544 | d) Choose menu: Edit-Paste. |
544 | e) Select the resource, you want to add the contacts to. | 545 | e) Select the resource, you want to add the contacts to. |
545 | Congrats! Now you have read/write access to the copied | 546 | Congrats! Now you have read/write access to the copied |
546 | opie contacts as "real" KA/Pi contacts. | 547 | opie contacts as "real" KA/Pi contacts. |
547 | 548 | ||
548 | 549 | ||
549 | ********** VERSION 1.9.1 ************ | 550 | ********** VERSION 1.9.1 ************ |
550 | 1) | 551 | 1) |
551 | +++ IMPORTANT 1 +++ | 552 | +++ IMPORTANT 1 +++ |
552 | 553 | ||
553 | The storing place of the default calendar | 554 | The storing place of the default calendar |
554 | file has changed! | 555 | file has changed! |
555 | The default calendar file was | 556 | The default calendar file was |
556 | Applications/korganizer/mycalendar.ics | 557 | Applications/korganizer/mycalendar.ics |
557 | on Zaurus and | 558 | on Zaurus and |
558 | (yourHomeDir)/korganizer/mycalendar.ics | 559 | (yourHomeDir)/korganizer/mycalendar.ics |
559 | on Windows/Linux desktop. Now it is | 560 | on Windows/Linux desktop. Now it is |
560 | (yourHomeDir)/kdepim/korganizer/mycalendar.ics | 561 | (yourHomeDir)/kdepim/korganizer/mycalendar.ics |
561 | on Zaurus, Windows and Linux. | 562 | on Zaurus, Windows and Linux. |
562 | To load the old file, choose menu | 563 | To load the old file, choose menu |
563 | File-Load calendar backup. | 564 | File-Load calendar backup. |
564 | (It should be loaded automatically | 565 | (It should be loaded automatically |
565 | at startup with a warning message displayed). | 566 | at startup with a warning message displayed). |
566 | The place of the configuration file has changed too. | 567 | The place of the configuration file has changed too. |
567 | If you want to use your old KO/Pi config, | 568 | If you want to use your old KO/Pi config, |
568 | copy it to | 569 | copy it to |
569 | (yourHomeDir)/kdepim/config/korganizerrc | 570 | (yourHomeDir)/kdepim/config/korganizerrc |
570 | Please read VERSION 1.9.0 - topic 3) as well! | 571 | Please read VERSION 1.9.0 - topic 3) as well! |
571 | 572 | ||
572 | +++ IMPORTANT 2 +++ | 573 | +++ IMPORTANT 2 +++ |
573 | 574 | ||
574 | Because of the new paths, you will need | 575 | Because of the new paths, you will need |
575 | a new version of the KO/Pi alarm applet | 576 | a new version of the KO/Pi alarm applet |
576 | for Zaurus. | 577 | for Zaurus. |
577 | Use version >= 1.9.1 | 578 | Use version >= 1.9.1 |
578 | 579 | ||
579 | 2) | 580 | 2) |
580 | Now the QWhat'sThis Icon works for items | 581 | Now the QWhat'sThis Icon works for items |
581 | in the month view as well. | 582 | in the month view as well. |
582 | (See VERSION 1.7.8 Topic 1) ). | 583 | (See VERSION 1.7.8 Topic 1) ). |
583 | 3) | 584 | 3) |
584 | You can import birtsdays/anniversaries | 585 | You can import birtsdays/anniversaries |
585 | from KA/Pi into KO/Pi. | 586 | from KA/Pi into KO/Pi. |
586 | Choose menu File-Import birthdays. | 587 | Choose menu File-Import birthdays. |
587 | If you import twice, already imported items | 588 | If you import twice, already imported items |
588 | will not be imported again, if they | 589 | will not be imported again, if they |
589 | have not been changed in KO/Pi. | 590 | have not been changed in KO/Pi. |
590 | 4) | 591 | 4) |
591 | When syncing with sharp DTM, now a progress | 592 | When syncing with sharp DTM, now a progress |
592 | is shown, when the data is written back. | 593 | is shown, when the data is written back. |
593 | If there is much data in KO/Pi and no data | 594 | If there is much data in KO/Pi and no data |
594 | in DTM, that can take a long time. | 595 | in DTM, that can take a long time. |
595 | (But only for the first time ). | 596 | (But only for the first time ). |
596 | 5) | 597 | 5) |
597 | In the search dialog, you can search | 598 | In the search dialog, you can search |
598 | now for the name/email of an attendee | 599 | now for the name/email of an attendee |
599 | of an event/todo. | 600 | of an event/todo. |
600 | To get more space for displaying | 601 | To get more space for displaying |
601 | search results, the buttons | 602 | search results, the buttons |
602 | for "search" and "close" on the | 603 | for "search" and "close" on the |
603 | bottom are removed in the PDA version. | 604 | bottom are removed in the PDA version. |
604 | You have to click OK in the top right | 605 | You have to click OK in the top right |
605 | corner to do a search. | 606 | corner to do a search. |
606 | 6) | 607 | 6) |
607 | Now it is possible to disable the displaying | 608 | Now it is possible to disable the displaying |
608 | of todo items in the Allday part of the Agenda. | 609 | of todo items in the Allday part of the Agenda. |
609 | Choose Menu Action-Configure, | 610 | Choose Menu Action-Configure, |
610 | TAB Todo View, checkbox | 611 | TAB Todo View, checkbox |
611 | "Allday Agenda view shows todos" | 612 | "Allday Agenda view shows todos" |
612 | 7) | 613 | 7) |
613 | If FastLoad is enabled, now the settings and the | 614 | If FastLoad is enabled, now the settings and the |
614 | calendar data are saved, when KO/Pi is closed. | 615 | calendar data are saved, when KO/Pi is closed. |
615 | (If no Fastload is enabled, KO/Pi saves | 616 | (If no Fastload is enabled, KO/Pi saves |
616 | the data as well, of course) | 617 | the data as well, of course) |
617 | 8) | 618 | 8) |
618 | The Agenda View has a minimize-splitter now, | 619 | The Agenda View has a minimize-splitter now, |
619 | such that the height of the allday part can be | 620 | such that the height of the allday part can be |
620 | changed quickly. | 621 | changed quickly. |
621 | 622 | ||
622 | ********** VERSION 1.9.0 ************ | 623 | ********** VERSION 1.9.0 ************ |
623 | 1) | 624 | 1) |
624 | KO/Pi is now merged with the new microKDE from KA/Pi. | 625 | KO/Pi is now merged with the new microKDE from KA/Pi. |
625 | KO/Pi accesses now KA/Pi as the addressbook. | 626 | KO/Pi accesses now KA/Pi as the addressbook. |
626 | The other ddressbook-plugins are not working any longer. | 627 | The other ddressbook-plugins are not working any longer. |
627 | (It is planned, that later KA/Pi itself uses these plugins) | 628 | (It is planned, that later KA/Pi itself uses these plugins) |
628 | New versions of KO/Pi are only available | 629 | New versions of KO/Pi are only available |
629 | together with KA/Pi as the KDE-Pim/Pi package. | 630 | together with KA/Pi as the KDE-Pim/Pi package. |
630 | 2) | 631 | 2) |
631 | If you click on an attendee of a meeting in the | 632 | If you click on an attendee of a meeting in the |
632 | event viewer, a detailed summary of the | 633 | event viewer, a detailed summary of the |
633 | attendee is shown. | 634 | attendee is shown. |
634 | 3) | 635 | 3) |
635 | The place of the configuration file has changed. | 636 | The place of the configuration file has changed. |
636 | If you want to use your old KO/Pi config, copy | 637 | If you want to use your old KO/Pi config, copy |
637 | Applications/korganizer/config_korganizerrc | 638 | Applications/korganizer/config_korganizerrc |
638 | to | 639 | to |
639 | Applications/korganizer/config/korganizerrc | 640 | Applications/korganizer/config/korganizerrc |
640 | 641 | ||
641 | ********** VERSION 1.7.8 ************ | 642 | ********** VERSION 1.7.8 ************ |
642 | 1) | 643 | 1) |
643 | Now the QWhat'sThis ist working. | 644 | Now the QWhat'sThis ist working. |
644 | Enable the QWhat'sThis icon in the toolbar. | 645 | Enable the QWhat'sThis icon in the toolbar. |
645 | (You have to restart to reload the changed toolbar config). | 646 | (You have to restart to reload the changed toolbar config). |
646 | Now click on the QWhat'sThis Icon | 647 | Now click on the QWhat'sThis Icon |
647 | in the top right corner of KO/Pi. | 648 | in the top right corner of KO/Pi. |
648 | Then click on an item in the Agenda View: | 649 | Then click on an item in the Agenda View: |
649 | You will get a detailed display of the items content. | 650 | You will get a detailed display of the items content. |
650 | 2) | 651 | 2) |
651 | Some other very minor changes. | 652 | Some other very minor changes. |
652 | But I have forgotten the details ... | 653 | But I have forgotten the details ... |
653 | For that reason I start this log here: | 654 | For that reason I start this log here: |
654 | To document my changes, when I am doing it. | 655 | To document my changes, when I am doing it. |
655 | 656 | ||
656 | ********** VERSION 1.7.7 ************ | 657 | ********** VERSION 1.7.7 ************ |
657 | Stable Version of KO/Pi | 658 | Stable Version of KO/Pi |
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index 6532705..eb3791e 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp | |||
@@ -1,1931 +1,1936 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | Marcus Bains line. | 5 | Marcus Bains line. |
6 | Copyright (c) 2001 Ali Rahimi | 6 | Copyright (c) 2001 Ali Rahimi |
7 | 7 | ||
8 | This program is free software; you can redistribute it and/or modify | 8 | This program is free software; you can redistribute it and/or modify |
9 | it under the terms of the GNU General Public License as published by | 9 | it under the terms of the GNU General Public License as published by |
10 | the Free Software Foundation; either version 2 of the License, or | 10 | the Free Software Foundation; either version 2 of the License, or |
11 | (at your option) any later version. | 11 | (at your option) any later version. |
12 | 12 | ||
13 | This program is distributed in the hope that it will be useful, | 13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. | 16 | GNU General Public License for more details. |
17 | 17 | ||
18 | You should have received a copy of the GNU General Public License | 18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software | 19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 | 21 | ||
22 | As a special exception, permission is given to link this program | 22 | As a special exception, permission is given to link this program |
23 | with any edition of Qt, and distribute the resulting executable, | 23 | with any edition of Qt, and distribute the resulting executable, |
24 | without including the source code for Qt in the source distribution. | 24 | without including the source code for Qt in the source distribution. |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #ifndef _WIN32_ | 27 | #ifndef _WIN32_ |
28 | #define protected public | 28 | #define protected public |
29 | #include <qwidget.h> | 29 | #include <qwidget.h> |
30 | #undef protected | 30 | #undef protected |
31 | #endif | 31 | #endif |
32 | #include <qintdict.h> | 32 | #include <qintdict.h> |
33 | #include <qdatetime.h> | 33 | #include <qdatetime.h> |
34 | #include <qapplication.h> | 34 | #include <qapplication.h> |
35 | #include <qpopupmenu.h> | 35 | #include <qpopupmenu.h> |
36 | #include <qcursor.h> | 36 | #include <qcursor.h> |
37 | #include <qpainter.h> | 37 | #include <qpainter.h> |
38 | 38 | ||
39 | #include <kdebug.h> | 39 | #include <kdebug.h> |
40 | #include <klocale.h> | 40 | #include <klocale.h> |
41 | #include <kiconloader.h> | 41 | #include <kiconloader.h> |
42 | #include <kglobal.h> | 42 | #include <kglobal.h> |
43 | 43 | ||
44 | #include "koagendaitem.h" | 44 | #include "koagendaitem.h" |
45 | #include "koprefs.h" | 45 | #include "koprefs.h" |
46 | #include "koglobals.h" | 46 | #include "koglobals.h" |
47 | 47 | ||
48 | #include "koagenda.h" | 48 | #include "koagenda.h" |
49 | 49 | ||
50 | #include <libkcal/event.h> | 50 | #include <libkcal/event.h> |
51 | #include <libkcal/todo.h> | 51 | #include <libkcal/todo.h> |
52 | 52 | ||
53 | #ifndef DESKTOP_VERSION | 53 | #ifndef DESKTOP_VERSION |
54 | #include <qpe/qpeapplication.h> | 54 | #include <qpe/qpeapplication.h> |
55 | #endif | 55 | #endif |
56 | 56 | ||
57 | //extern bool globalFlagBlockPainting; | 57 | //extern bool globalFlagBlockPainting; |
58 | extern int globalFlagBlockAgenda; | 58 | extern int globalFlagBlockAgenda; |
59 | extern int globalFlagBlockAgendaItemPaint; | 59 | extern int globalFlagBlockAgendaItemPaint; |
60 | extern int globalFlagBlockAgendaItemUpdate; | 60 | extern int globalFlagBlockAgendaItemUpdate; |
61 | extern int globalFlagBlockStartup; | 61 | extern int globalFlagBlockStartup; |
62 | 62 | ||
63 | //////////////////////////////////////////////////////////////////////////// | 63 | //////////////////////////////////////////////////////////////////////////// |
64 | MarcusBains::MarcusBains(KOAgenda *_agenda,const char *name) | 64 | MarcusBains::MarcusBains(KOAgenda *_agenda,const char *name) |
65 | : QFrame(_agenda->viewport(),name), agenda(_agenda) | 65 | : QFrame(_agenda->viewport(),name), agenda(_agenda) |
66 | { | 66 | { |
67 | setLineWidth(0); | 67 | setLineWidth(0); |
68 | setMargin(0); | 68 | setMargin(0); |
69 | setBackgroundColor(Qt::red); | 69 | setBackgroundColor(Qt::red); |
70 | minutes = new QTimer(this); | 70 | minutes = new QTimer(this); |
71 | connect(minutes, SIGNAL(timeout()), this, SLOT(updateLoc())); | 71 | connect(minutes, SIGNAL(timeout()), this, SLOT(updateLoc())); |
72 | minutes->start(0, true); | 72 | minutes->start(0, true); |
73 | 73 | ||
74 | mTimeBox = new QLabel(this); | 74 | mTimeBox = new QLabel(this); |
75 | mTimeBox->setAlignment(Qt::AlignRight | Qt::AlignBottom); | 75 | mTimeBox->setAlignment(Qt::AlignRight | Qt::AlignBottom); |
76 | QPalette pal = mTimeBox->palette(); | 76 | QPalette pal = mTimeBox->palette(); |
77 | pal.setColor(QColorGroup::Foreground, Qt::red); | 77 | pal.setColor(QColorGroup::Foreground, Qt::red); |
78 | mTimeBox->setPalette(pal); | 78 | mTimeBox->setPalette(pal); |
79 | //mTimeBox->setAutoMask(true); | 79 | //mTimeBox->setAutoMask(true); |
80 | 80 | ||
81 | agenda->addChild(mTimeBox); | 81 | agenda->addChild(mTimeBox); |
82 | 82 | ||
83 | oldToday = -1; | 83 | oldToday = -1; |
84 | } | 84 | } |
85 | 85 | ||
86 | MarcusBains::~MarcusBains() | 86 | MarcusBains::~MarcusBains() |
87 | { | 87 | { |
88 | delete minutes; | 88 | delete minutes; |
89 | } | 89 | } |
90 | 90 | ||
91 | int MarcusBains::todayColumn() | 91 | int MarcusBains::todayColumn() |
92 | { | 92 | { |
93 | QDate currentDate = QDate::currentDate(); | 93 | QDate currentDate = QDate::currentDate(); |
94 | 94 | ||
95 | DateList dateList = agenda->dateList(); | 95 | DateList dateList = agenda->dateList(); |
96 | DateList::ConstIterator it; | 96 | DateList::ConstIterator it; |
97 | int col = 0; | 97 | int col = 0; |
98 | for(it = dateList.begin(); it != dateList.end(); ++it) { | 98 | for(it = dateList.begin(); it != dateList.end(); ++it) { |
99 | if((*it) == currentDate) | 99 | if((*it) == currentDate) |
100 | return KOGlobals::self()->reverseLayout() ? | 100 | return KOGlobals::self()->reverseLayout() ? |
101 | agenda->columns() - 1 - col : col; | 101 | agenda->columns() - 1 - col : col; |
102 | ++col; | 102 | ++col; |
103 | } | 103 | } |
104 | 104 | ||
105 | return -1; | 105 | return -1; |
106 | } | 106 | } |
107 | void MarcusBains::updateLoc() | 107 | void MarcusBains::updateLoc() |
108 | { | 108 | { |
109 | updateLocation(); | 109 | updateLocation(); |
110 | } | 110 | } |
111 | void MarcusBains::updateLocation(bool recalculate) | 111 | void MarcusBains::updateLocation(bool recalculate) |
112 | { | 112 | { |
113 | 113 | ||
114 | QTime tim = QTime::currentTime(); | 114 | QTime tim = QTime::currentTime(); |
115 | //qDebug(" MarcusBains::updateLocation %s ", tim.toString().latin1()); | 115 | //qDebug(" MarcusBains::updateLocation %s ", tim.toString().latin1()); |
116 | if((tim.hour() == 0) && (oldTime.hour()==23)) | 116 | if((tim.hour() == 0) && (oldTime.hour()==23)) |
117 | recalculate = true; | 117 | recalculate = true; |
118 | 118 | ||
119 | int mins = tim.hour()*60 + tim.minute(); | 119 | int mins = tim.hour()*60 + tim.minute(); |
120 | int minutesPerCell = 24 * 60 / agenda->rows(); | 120 | int minutesPerCell = 24 * 60 / agenda->rows(); |
121 | int y = mins*agenda->gridSpacingY()/minutesPerCell; | 121 | int y = mins*agenda->gridSpacingY()/minutesPerCell; |
122 | int today = recalculate ? todayColumn() : oldToday; | 122 | int today = recalculate ? todayColumn() : oldToday; |
123 | int x = agenda->gridSpacingX()*today; | 123 | int x = agenda->gridSpacingX()*today; |
124 | bool disabled = !(KOPrefs::instance()->mMarcusBainsEnabled); | 124 | bool disabled = !(KOPrefs::instance()->mMarcusBainsEnabled); |
125 | 125 | ||
126 | oldTime = tim; | 126 | oldTime = tim; |
127 | oldToday = today; | 127 | oldToday = today; |
128 | 128 | ||
129 | if(disabled || (today<0)) { | 129 | if(disabled || (today<0)) { |
130 | hide(); mTimeBox->hide(); | 130 | hide(); mTimeBox->hide(); |
131 | return; | 131 | return; |
132 | } else { | 132 | } else { |
133 | show(); mTimeBox->show(); | 133 | show(); mTimeBox->show(); |
134 | } | 134 | } |
135 | 135 | ||
136 | if(recalculate) | 136 | if(recalculate) |
137 | setFixedSize(agenda->gridSpacingX(),1); | 137 | setFixedSize(agenda->gridSpacingX(),1); |
138 | agenda->moveChild(this, x, y); | 138 | agenda->moveChild(this, x, y); |
139 | raise(); | 139 | raise(); |
140 | 140 | ||
141 | if(recalculate) | 141 | if(recalculate) |
142 | //mTimeBox->setFont(QFont("helvetica",10)); | 142 | //mTimeBox->setFont(QFont("helvetica",10)); |
143 | mTimeBox->setFont(KOPrefs::instance()->mMarcusBainsFont); | 143 | mTimeBox->setFont(KOPrefs::instance()->mMarcusBainsFont); |
144 | 144 | ||
145 | mTimeBox->setText(KGlobal::locale()->formatTime(tim, KOPrefs::instance()->mMarcusBainsShowSeconds)); | 145 | mTimeBox->setText(KGlobal::locale()->formatTime(tim, KOPrefs::instance()->mMarcusBainsShowSeconds)); |
146 | mTimeBox->adjustSize(); | 146 | mTimeBox->adjustSize(); |
147 | // the -2 below is there because there is a bug in this program | 147 | // the -2 below is there because there is a bug in this program |
148 | // somewhere, where the last column of this widget is a few pixels | 148 | // somewhere, where the last column of this widget is a few pixels |
149 | // narrower than the other columns. | 149 | // narrower than the other columns. |
150 | int offs = (today==agenda->columns()-1) ? -4 : 0; | 150 | int offs = (today==agenda->columns()-1) ? -4 : 0; |
151 | agenda->moveChild(mTimeBox, | 151 | agenda->moveChild(mTimeBox, |
152 | x+agenda->gridSpacingX()-mTimeBox->width()+offs-1, | 152 | x+agenda->gridSpacingX()-mTimeBox->width()+offs-1, |
153 | y-mTimeBox->height()); | 153 | y-mTimeBox->height()); |
154 | 154 | ||
155 | mTimeBox->raise(); | 155 | mTimeBox->raise(); |
156 | //mTimeBox->setAutoMask(true); | 156 | //mTimeBox->setAutoMask(true); |
157 | minutes->start(5000,true); | 157 | minutes->start(5000,true); |
158 | } | 158 | } |
159 | 159 | ||
160 | 160 | ||
161 | //////////////////////////////////////////////////////////////////////////// | 161 | //////////////////////////////////////////////////////////////////////////// |
162 | 162 | ||
163 | 163 | ||
164 | /* | 164 | /* |
165 | Create an agenda widget with rows rows and columns columns. | 165 | Create an agenda widget with rows rows and columns columns. |
166 | */ | 166 | */ |
167 | KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent, | 167 | KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent, |
168 | const char *name,WFlags f) : | 168 | const char *name,WFlags f) : |
169 | QScrollView(parent,name,f) | 169 | QScrollView(parent,name,f) |
170 | { | 170 | { |
171 | 171 | ||
172 | mColumns = columns; | 172 | mColumns = columns; |
173 | mRows = rows; | 173 | mRows = rows; |
174 | mGridSpacingY = rowSize; | 174 | mGridSpacingY = rowSize; |
175 | mAllDayMode = false; | 175 | mAllDayMode = false; |
176 | #ifndef DESKTOP_VERSION | 176 | #ifndef DESKTOP_VERSION |
177 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 177 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
178 | #endif | 178 | #endif |
179 | mHolidayMask = 0; | 179 | mHolidayMask = 0; |
180 | init(); | 180 | init(); |
181 | } | 181 | } |
182 | 182 | ||
183 | /* | 183 | /* |
184 | Create an agenda widget with columns columns and one row. This is used for | 184 | Create an agenda widget with columns columns and one row. This is used for |
185 | all-day events. | 185 | all-day events. |
186 | */ | 186 | */ |
187 | KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,WFlags f) : | 187 | KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,WFlags f) : |
188 | QScrollView(parent,name,f) | 188 | QScrollView(parent,name,f) |
189 | { | 189 | { |
190 | 190 | ||
191 | blockResize = false; | 191 | blockResize = false; |
192 | mColumns = columns; | 192 | mColumns = columns; |
193 | mRows = 1; | 193 | mRows = 1; |
194 | //qDebug("aaaaaaaaaaaaaaaaaaldays %d ", KOPrefs::instance()->mAllDaySize); | 194 | //qDebug("aaaaaaaaaaaaaaaaaaldays %d ", KOPrefs::instance()->mAllDaySize); |
195 | mGridSpacingY = KOPrefs::instance()->mAllDaySize; | 195 | mGridSpacingY = KOPrefs::instance()->mAllDaySize; |
196 | mAllDayMode = true; | 196 | mAllDayMode = true; |
197 | #ifndef DESKTOP_VERSION | 197 | #ifndef DESKTOP_VERSION |
198 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 198 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
199 | #endif | 199 | #endif |
200 | mHolidayMask = 0; | 200 | mHolidayMask = 0; |
201 | init(); | 201 | init(); |
202 | } | 202 | } |
203 | 203 | ||
204 | 204 | ||
205 | KOAgenda::~KOAgenda() | 205 | KOAgenda::~KOAgenda() |
206 | { | 206 | { |
207 | if(mMarcusBains) delete mMarcusBains; | 207 | if(mMarcusBains) delete mMarcusBains; |
208 | 208 | ||
209 | } | 209 | } |
210 | 210 | ||
211 | Incidence *KOAgenda::selectedIncidence() const | 211 | Incidence *KOAgenda::selectedIncidence() const |
212 | { | 212 | { |
213 | return (mSelectedItem ? mSelectedItem->incidence() : 0); | 213 | return (mSelectedItem ? mSelectedItem->incidence() : 0); |
214 | } | 214 | } |
215 | 215 | ||
216 | 216 | ||
217 | QDate KOAgenda::selectedIncidenceDate() const | 217 | QDate KOAgenda::selectedIncidenceDate() const |
218 | { | 218 | { |
219 | return (mSelectedItem ? mSelectedItem->itemDate() : QDate()); | 219 | return (mSelectedItem ? mSelectedItem->itemDate() : QDate()); |
220 | } | 220 | } |
221 | 221 | ||
222 | 222 | ||
223 | void KOAgenda::init() | 223 | void KOAgenda::init() |
224 | { | 224 | { |
225 | #ifndef _WIN32_ | 225 | #ifndef _WIN32_ |
226 | int wflags = viewport()-> getWFlags() |WRepaintNoErase;//WResizeNoErase | 226 | int wflags = viewport()-> getWFlags() |WRepaintNoErase;//WResizeNoErase |
227 | viewport()->setWFlags ( wflags); | 227 | viewport()->setWFlags ( wflags); |
228 | #endif | 228 | #endif |
229 | mGridSpacingX = 80; | 229 | mGridSpacingX = 80; |
230 | mResizeBorderWidth = 8; | 230 | mResizeBorderWidth = 8; |
231 | mScrollBorderWidth = 8; | 231 | mScrollBorderWidth = 8; |
232 | mScrollDelay = 30; | 232 | mScrollDelay = 30; |
233 | mScrollOffset = 10; | 233 | mScrollOffset = 10; |
234 | mPaintPixmap.resize( 20,20); | 234 | mPaintPixmap.resize( 20,20); |
235 | //enableClipper(true); | 235 | //enableClipper(true); |
236 | 236 | ||
237 | // Grab key strokes for keyboard navigation of agenda. Seems to have no | 237 | // Grab key strokes for keyboard navigation of agenda. Seems to have no |
238 | // effect. Has to be fixed. | 238 | // effect. Has to be fixed. |
239 | setFocusPolicy(WheelFocus); | 239 | setFocusPolicy(WheelFocus); |
240 | 240 | ||
241 | connect(&mScrollUpTimer,SIGNAL(timeout()),SLOT(scrollUp())); | 241 | connect(&mScrollUpTimer,SIGNAL(timeout()),SLOT(scrollUp())); |
242 | connect(&mScrollDownTimer,SIGNAL(timeout()),SLOT(scrollDown())); | 242 | connect(&mScrollDownTimer,SIGNAL(timeout()),SLOT(scrollDown())); |
243 | connect(&mResizeTimer,SIGNAL(timeout()),SLOT(finishResize())); | 243 | connect(&mResizeTimer,SIGNAL(timeout()),SLOT(finishResize())); |
244 | 244 | ||
245 | mStartCellX = 0; | 245 | mStartCellX = 0; |
246 | mStartCellY = 0; | 246 | mStartCellY = 0; |
247 | mCurrentCellX = 0; | 247 | mCurrentCellX = 0; |
248 | mCurrentCellY = 0; | 248 | mCurrentCellY = 0; |
249 | 249 | ||
250 | mSelectionCellX = 0; | 250 | mSelectionCellX = 0; |
251 | mSelectionYTop = 0; | 251 | mSelectionYTop = 0; |
252 | mSelectionHeight = 0; | 252 | mSelectionHeight = 0; |
253 | 253 | ||
254 | mOldLowerScrollValue = -1; | 254 | mOldLowerScrollValue = -1; |
255 | mOldUpperScrollValue = -1; | 255 | mOldUpperScrollValue = -1; |
256 | 256 | ||
257 | mClickedItem = 0; | 257 | mClickedItem = 0; |
258 | 258 | ||
259 | mActionItem = 0; | 259 | mActionItem = 0; |
260 | mActionType = NOP; | 260 | mActionType = NOP; |
261 | mItemMoved = false; | 261 | mItemMoved = false; |
262 | 262 | ||
263 | mSelectedItem = 0; | 263 | mSelectedItem = 0; |
264 | 264 | ||
265 | // mItems.setAutoDelete(true); | 265 | // mItems.setAutoDelete(true); |
266 | 266 | ||
267 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); | 267 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); |
268 | 268 | ||
269 | viewport()->update(); | 269 | viewport()->update(); |
270 | 270 | ||
271 | setMinimumSize(30, 1); | 271 | setMinimumSize(30, 1); |
272 | // setMaximumHeight(mGridSpacingY * mRows + 5); | 272 | // setMaximumHeight(mGridSpacingY * mRows + 5); |
273 | 273 | ||
274 | // Disable horizontal scrollbar. This is a hack. The geometry should be | 274 | // Disable horizontal scrollbar. This is a hack. The geometry should be |
275 | // controlled in a way that the contents horizontally always fits. Then it is | 275 | // controlled in a way that the contents horizontally always fits. Then it is |
276 | // not necessary to turn off the scrollbar. | 276 | // not necessary to turn off the scrollbar. |
277 | setHScrollBarMode(AlwaysOff); | 277 | setHScrollBarMode(AlwaysOff); |
278 | if ( ! mAllDayMode ) | 278 | if ( ! mAllDayMode ) |
279 | setVScrollBarMode(AlwaysOn); | 279 | setVScrollBarMode(AlwaysOn); |
280 | else | 280 | else |
281 | setVScrollBarMode(AlwaysOff); | 281 | setVScrollBarMode(AlwaysOff); |
282 | 282 | ||
283 | setStartHour(KOPrefs::instance()->mDayBegins); | 283 | setStartHour(KOPrefs::instance()->mDayBegins); |
284 | 284 | ||
285 | calculateWorkingHours(); | 285 | calculateWorkingHours(); |
286 | 286 | ||
287 | connect(verticalScrollBar(),SIGNAL(valueChanged(int)), | 287 | connect(verticalScrollBar(),SIGNAL(valueChanged(int)), |
288 | SLOT(checkScrollBoundaries(int))); | 288 | SLOT(checkScrollBoundaries(int))); |
289 | 289 | ||
290 | // Create the Marcus Bains line. | 290 | // Create the Marcus Bains line. |
291 | if(mAllDayMode) | 291 | if(mAllDayMode) |
292 | mMarcusBains = 0; | 292 | mMarcusBains = 0; |
293 | else { | 293 | else { |
294 | mMarcusBains = new MarcusBains(this); | 294 | mMarcusBains = new MarcusBains(this); |
295 | addChild(mMarcusBains); | 295 | addChild(mMarcusBains); |
296 | } | 296 | } |
297 | } | 297 | } |
298 | 298 | ||
299 | void KOAgenda::clear() | 299 | void KOAgenda::clear() |
300 | { | 300 | { |
301 | KOAgendaItem *item; | 301 | KOAgendaItem *item; |
302 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 302 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
303 | mUnusedItems.append( item ); | 303 | mUnusedItems.append( item ); |
304 | //item->hide(); | 304 | //item->hide(); |
305 | } | 305 | } |
306 | mItems.clear(); | 306 | mItems.clear(); |
307 | mSelectedItem = 0; | 307 | mSelectedItem = 0; |
308 | clearSelection(); | 308 | clearSelection(); |
309 | } | 309 | } |
310 | 310 | ||
311 | void KOAgenda::clearSelection() | 311 | void KOAgenda::clearSelection() |
312 | { | 312 | { |
313 | mSelectionCellX = 0; | 313 | mSelectionCellX = 0; |
314 | mSelectionYTop = 0; | 314 | mSelectionYTop = 0; |
315 | mSelectionHeight = 0; | 315 | mSelectionHeight = 0; |
316 | } | 316 | } |
317 | 317 | ||
318 | void KOAgenda::marcus_bains() | 318 | void KOAgenda::marcus_bains() |
319 | { | 319 | { |
320 | if(mMarcusBains) mMarcusBains->updateLocation(true); | 320 | if(mMarcusBains) mMarcusBains->updateLocation(true); |
321 | } | 321 | } |
322 | 322 | ||
323 | 323 | ||
324 | void KOAgenda::changeColumns(int columns) | 324 | void KOAgenda::changeColumns(int columns) |
325 | { | 325 | { |
326 | if (columns == 0) { | 326 | if (columns == 0) { |
327 | kdDebug() << "KOAgenda::changeColumns() called with argument 0" << endl; | 327 | kdDebug() << "KOAgenda::changeColumns() called with argument 0" << endl; |
328 | return; | 328 | return; |
329 | } | 329 | } |
330 | 330 | ||
331 | clear(); | 331 | clear(); |
332 | 332 | ||
333 | mColumns = columns; | 333 | mColumns = columns; |
334 | // setMinimumSize(mColumns * 10, mGridSpacingY + 1); | 334 | // setMinimumSize(mColumns * 10, mGridSpacingY + 1); |
335 | // init(); | 335 | // init(); |
336 | // update(); | 336 | // update(); |
337 | //qDebug("KOAgenda::changeColumns "); | 337 | //qDebug("KOAgenda::changeColumns "); |
338 | computeSizes(); | 338 | computeSizes(); |
339 | // QResizeEvent event( size(), size() ); | 339 | // QResizeEvent event( size(), size() ); |
340 | 340 | ||
341 | //QApplication::sendEvent( this, &event ); | 341 | //QApplication::sendEvent( this, &event ); |
342 | } | 342 | } |
343 | 343 | ||
344 | /* | 344 | /* |
345 | This is the eventFilter function, which gets all events from the KOAgendaItems | 345 | This is the eventFilter function, which gets all events from the KOAgendaItems |
346 | contained in the agenda. It has to handle moving and resizing for all items. | 346 | contained in the agenda. It has to handle moving and resizing for all items. |
347 | */ | 347 | */ |
348 | bool KOAgenda::eventFilter ( QObject *object, QEvent *event ) | 348 | bool KOAgenda::eventFilter ( QObject *object, QEvent *event ) |
349 | { | 349 | { |
350 | // kdDebug() << "KOAgenda::eventFilter" << endl; | 350 | // kdDebug() << "KOAgenda::eventFilter" << endl; |
351 | switch(event->type()) { | 351 | switch(event->type()) { |
352 | case QEvent::MouseButtonPress: | 352 | case QEvent::MouseButtonPress: |
353 | case QEvent::MouseButtonDblClick: | 353 | case QEvent::MouseButtonDblClick: |
354 | case QEvent::MouseButtonRelease: | 354 | case QEvent::MouseButtonRelease: |
355 | case QEvent::MouseMove: | 355 | case QEvent::MouseMove: |
356 | return eventFilter_mouse(object, static_cast<QMouseEvent *>(event)); | 356 | return eventFilter_mouse(object, static_cast<QMouseEvent *>(event)); |
357 | 357 | ||
358 | case (QEvent::Leave): | 358 | case (QEvent::Leave): |
359 | if (!mActionItem) | 359 | if (!mActionItem) |
360 | setCursor(arrowCursor); | 360 | setCursor(arrowCursor); |
361 | return true; | 361 | return true; |
362 | 362 | ||
363 | default: | 363 | default: |
364 | return QScrollView::eventFilter(object,event); | 364 | return QScrollView::eventFilter(object,event); |
365 | } | 365 | } |
366 | } | 366 | } |
367 | 367 | ||
368 | 368 | ||
369 | bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) | 369 | bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) |
370 | { | 370 | { |
371 | //qDebug("KOAgenda::eventFilter_mous "); | 371 | //qDebug("KOAgenda::eventFilter_mous "); |
372 | QPoint viewportPos; | 372 | QPoint viewportPos; |
373 | if (object != viewport()) { | 373 | if (object != viewport()) { |
374 | viewportPos = ((QWidget *)object)->mapToParent(me->pos()); | 374 | viewportPos = ((QWidget *)object)->mapToParent(me->pos()); |
375 | } else { | 375 | } else { |
376 | viewportPos = me->pos(); | 376 | viewportPos = me->pos(); |
377 | } | 377 | } |
378 | static int startX = 0; | 378 | static int startX = 0; |
379 | static int startY = 0; | 379 | static int startY = 0; |
380 | static bool block = true; | 380 | static bool block = true; |
381 | switch (me->type()) { | 381 | switch (me->type()) { |
382 | case QEvent::MouseButtonPress: | 382 | case QEvent::MouseButtonPress: |
383 | //qDebug("QEvent::MouseButtonPress: "); | 383 | //qDebug("QEvent::MouseButtonPress: "); |
384 | // kdDebug() << "koagenda: filtered button press" << endl; | 384 | // kdDebug() << "koagenda: filtered button press" << endl; |
385 | if (object != viewport()) { | 385 | if (object != viewport()) { |
386 | if (me->button() == RightButton) { | 386 | if (me->button() == RightButton) { |
387 | 387 | ||
388 | mClickedItem = (KOAgendaItem *)object; | 388 | mClickedItem = (KOAgendaItem *)object; |
389 | if (mClickedItem) { | 389 | if (mClickedItem) { |
390 | selectItem(mClickedItem); | 390 | selectItem(mClickedItem); |
391 | // emit showIncidencePopupSignal(mClickedItem->incidence()); | 391 | // emit showIncidencePopupSignal(mClickedItem->incidence()); |
392 | } | 392 | } |
393 | //mItemPopup->popup(QCursor::pos()); | 393 | //mItemPopup->popup(QCursor::pos()); |
394 | } else { | 394 | } else { |
395 | mActionItem = (KOAgendaItem *)object; | 395 | mActionItem = (KOAgendaItem *)object; |
396 | if (mActionItem) { | 396 | if (mActionItem) { |
397 | if ( mSelectionHeight > 0 ) { | 397 | if ( mSelectionHeight > 0 ) { |
398 | int selectionCellX = mSelectionCellX * mGridSpacingX; | 398 | int selectionCellX = mSelectionCellX * mGridSpacingX; |
399 | int selectionYTop = mSelectionYTop; | 399 | int selectionYTop = mSelectionYTop; |
400 | int gridSpacingX = mGridSpacingX; | 400 | int gridSpacingX = mGridSpacingX; |
401 | int selectionHeight = mSelectionHeight; | 401 | int selectionHeight = mSelectionHeight; |
402 | clearSelection(); | 402 | clearSelection(); |
403 | repaintContents( selectionCellX, selectionYTop, | 403 | repaintContents( selectionCellX, selectionYTop, |
404 | gridSpacingX, selectionHeight,false ); | 404 | gridSpacingX, selectionHeight,false ); |
405 | } | 405 | } |
406 | selectItem(mActionItem); | 406 | selectItem(mActionItem); |
407 | Incidence *incidence = mActionItem->incidence(); | 407 | Incidence *incidence = mActionItem->incidence(); |
408 | if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) { | 408 | if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) { |
409 | mActionItem = 0; | 409 | mActionItem = 0; |
410 | } else { | 410 | } else { |
411 | startItemAction(viewportPos); | 411 | startItemAction(viewportPos); |
412 | startX = viewportPos.x(); | 412 | startX = viewportPos.x(); |
413 | startY = viewportPos.y(); | 413 | startY = viewportPos.y(); |
414 | block = true; | 414 | block = true; |
415 | } | 415 | } |
416 | } | 416 | } |
417 | } | 417 | } |
418 | } else { | 418 | } else { |
419 | selectItem(0); | 419 | selectItem(0); |
420 | mActionItem = 0; | 420 | mActionItem = 0; |
421 | setCursor(arrowCursor); | 421 | setCursor(arrowCursor); |
422 | startSelectAction(viewportPos); | 422 | startSelectAction(viewportPos); |
423 | } | 423 | } |
424 | break; | 424 | break; |
425 | 425 | ||
426 | case QEvent::MouseButtonRelease: | 426 | case QEvent::MouseButtonRelease: |
427 | //qDebug("QEvent::MouseButtonRelease: "); | 427 | //qDebug("QEvent::MouseButtonRelease: "); |
428 | if (me->button() == RightButton && block ) { | 428 | if (me->button() == RightButton && block ) { |
429 | if (object != viewport()) { | 429 | if (object != viewport()) { |
430 | mClickedItem = (KOAgendaItem *)object; | 430 | mClickedItem = (KOAgendaItem *)object; |
431 | if (mActionItem ) { | 431 | if (mActionItem ) { |
432 | endItemAction(); | 432 | endItemAction(); |
433 | } | 433 | } |
434 | if (mClickedItem) { | 434 | if (mClickedItem) { |
435 | selectItem(mClickedItem); | 435 | selectItem(mClickedItem); |
436 | emit showIncidencePopupSignal(mClickedItem->incidence()); | 436 | emit showIncidencePopupSignal(mClickedItem->incidence()); |
437 | } | 437 | } |
438 | } | 438 | } |
439 | break; | 439 | break; |
440 | } | 440 | } |
441 | block = true; | 441 | block = true; |
442 | if (mActionItem) { | 442 | if (mActionItem) { |
443 | QPoint clipperPos = clipper()->mapFromGlobal(viewport()->mapToGlobal(viewportPos)); | 443 | QPoint clipperPos = clipper()->mapFromGlobal(viewport()->mapToGlobal(viewportPos)); |
444 | //qDebug(" %d %d %d ",clipperPos.y(),visibleHeight() , 9 ); | 444 | //qDebug(" %d %d %d ",clipperPos.y(),visibleHeight() , 9 ); |
445 | if ( mActionType == MOVE && (clipperPos.y() > visibleHeight()-2 ||clipperPos.y() < 0 ) ) { | 445 | if ( mActionType == MOVE && (clipperPos.y() > visibleHeight()-2 ||clipperPos.y() < 0 ) ) { |
446 | mScrollUpTimer.stop(); | 446 | mScrollUpTimer.stop(); |
447 | mScrollDownTimer.stop(); | 447 | mScrollDownTimer.stop(); |
448 | mActionItem->resetMove(); | 448 | mActionItem->resetMove(); |
449 | placeSubCells( mActionItem ); | 449 | placeSubCells( mActionItem ); |
450 | // emit startDragSignal( mActionItem->incidence() ); | 450 | // emit startDragSignal( mActionItem->incidence() ); |
451 | setCursor( arrowCursor ); | 451 | setCursor( arrowCursor ); |
452 | mActionItem = 0; | 452 | mActionItem = 0; |
453 | mActionType = NOP; | 453 | mActionType = NOP; |
454 | mItemMoved = 0; | 454 | mItemMoved = 0; |
455 | return true; | 455 | return true; |
456 | } | 456 | } |
457 | endItemAction(); | 457 | endItemAction(); |
458 | } else if ( mActionType == SELECT ) { | 458 | } else if ( mActionType == SELECT ) { |
459 | endSelectAction(); | 459 | endSelectAction(); |
460 | } | 460 | } |
461 | break; | 461 | break; |
462 | 462 | ||
463 | case QEvent::MouseMove: | 463 | case QEvent::MouseMove: |
464 | if (object != viewport()) { | 464 | if (object != viewport()) { |
465 | KOAgendaItem *moveItem = (KOAgendaItem *)object; | 465 | KOAgendaItem *moveItem = (KOAgendaItem *)object; |
466 | //qDebug("moveItem %d ",moveItem ); | 466 | //qDebug("moveItem %d ",moveItem ); |
467 | if (!moveItem->incidence()->isReadOnly() /*&& | 467 | if (!moveItem->incidence()->isReadOnly() /*&& |
468 | !moveItem->incidence()->recurrence()->doesRecur()*/ ) | 468 | !moveItem->incidence()->recurrence()->doesRecur()*/ ) |
469 | if (!mActionItem) | 469 | if (!mActionItem) |
470 | setNoActionCursor(moveItem,viewportPos); | 470 | setNoActionCursor(moveItem,viewportPos); |
471 | else { | 471 | else { |
472 | if ( block ) { | 472 | if ( block ) { |
473 | int dX, dY; | 473 | int dX, dY; |
474 | dX = startX - viewportPos.x(); | 474 | dX = startX - viewportPos.x(); |
475 | if ( dX < 0 ) | 475 | if ( dX < 0 ) |
476 | dX = -dX; | 476 | dX = -dX; |
477 | dY = viewportPos.y() - startY; | 477 | dY = viewportPos.y() - startY; |
478 | if ( dY < 0 ) | 478 | if ( dY < 0 ) |
479 | dY = -dY; | 479 | dY = -dY; |
480 | int diff = 30; | 480 | int diff = 30; |
481 | if ( QApplication::desktop()->width() < 480 ) | 481 | if ( QApplication::desktop()->width() < 480 ) |
482 | diff = 15; | 482 | diff = 15; |
483 | // qDebug(" %d %d ",dX, dY ); | 483 | // qDebug(" %d %d ",dX, dY ); |
484 | if ( dX > diff || dY > diff ) { | 484 | if ( dX > diff || dY > diff ) { |
485 | block = false; | 485 | block = false; |
486 | } | 486 | } |
487 | } | 487 | } |
488 | if ( !block ) | 488 | if ( !block ) |
489 | performItemAction(viewportPos); | 489 | performItemAction(viewportPos); |
490 | } | 490 | } |
491 | } else { | 491 | } else { |
492 | if ( mActionType == SELECT ) { | 492 | if ( mActionType == SELECT ) { |
493 | performSelectAction( viewportPos ); | 493 | performSelectAction( viewportPos ); |
494 | } | 494 | } |
495 | } | 495 | } |
496 | break; | 496 | break; |
497 | 497 | ||
498 | case QEvent::MouseButtonDblClick: | 498 | case QEvent::MouseButtonDblClick: |
499 | if (object == viewport()) { | 499 | if (object == viewport()) { |
500 | selectItem(0); | 500 | selectItem(0); |
501 | int x,y; | 501 | int x,y; |
502 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 502 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
503 | int gx,gy; | 503 | int gx,gy; |
504 | contentsToGrid(x,y,gx,gy); | 504 | contentsToGrid(x,y,gx,gy); |
505 | emit newEventSignal(gx,gy); | 505 | emit newEventSignal(gx,gy); |
506 | } else { | 506 | } else { |
507 | KOAgendaItem *doubleClickedItem = (KOAgendaItem *)object; | 507 | KOAgendaItem *doubleClickedItem = (KOAgendaItem *)object; |
508 | selectItem(doubleClickedItem); | 508 | selectItem(doubleClickedItem); |
509 | if ( KOPrefs::instance()->mEditOnDoubleClick ) | 509 | if ( KOPrefs::instance()->mEditOnDoubleClick ) |
510 | emit editIncidenceSignal(doubleClickedItem->incidence()); | 510 | emit editIncidenceSignal(doubleClickedItem->incidence()); |
511 | else | 511 | else |
512 | emit showIncidenceSignal(doubleClickedItem->incidence()); | 512 | emit showIncidenceSignal(doubleClickedItem->incidence()); |
513 | } | 513 | } |
514 | break; | 514 | break; |
515 | 515 | ||
516 | default: | 516 | default: |
517 | break; | 517 | break; |
518 | } | 518 | } |
519 | 519 | ||
520 | return true; | 520 | return true; |
521 | } | 521 | } |
522 | 522 | ||
523 | void KOAgenda::startSelectAction(QPoint viewportPos) | 523 | void KOAgenda::startSelectAction(QPoint viewportPos) |
524 | { | 524 | { |
525 | //emit newStartSelectSignal(); | 525 | //emit newStartSelectSignal(); |
526 | 526 | ||
527 | mActionType = SELECT; | 527 | mActionType = SELECT; |
528 | 528 | ||
529 | int x,y; | 529 | int x,y; |
530 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 530 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
531 | int gx,gy; | 531 | int gx,gy; |
532 | contentsToGrid(x,y,gx,gy); | 532 | contentsToGrid(x,y,gx,gy); |
533 | 533 | ||
534 | mStartCellX = gx; | 534 | mStartCellX = gx; |
535 | mStartCellY = gy; | 535 | mStartCellY = gy; |
536 | mCurrentCellX = gx; | 536 | mCurrentCellX = gx; |
537 | mCurrentCellY = gy; | 537 | mCurrentCellY = gy; |
538 | 538 | ||
539 | // Store coordinates of old selection | 539 | // Store coordinates of old selection |
540 | int selectionX = mSelectionCellX * mGridSpacingX; | 540 | int selectionX = mSelectionCellX * mGridSpacingX; |
541 | int selectionYTop = mSelectionYTop; | 541 | int selectionYTop = mSelectionYTop; |
542 | int selectionHeight = mSelectionHeight; | 542 | int selectionHeight = mSelectionHeight; |
543 | 543 | ||
544 | // Store new selection | 544 | // Store new selection |
545 | mSelectionCellX = gx; | 545 | mSelectionCellX = gx; |
546 | mSelectionYTop = gy * mGridSpacingY; | 546 | mSelectionYTop = gy * mGridSpacingY; |
547 | mSelectionHeight = mGridSpacingY; | 547 | mSelectionHeight = mGridSpacingY; |
548 | 548 | ||
549 | // Clear old selection | 549 | // Clear old selection |
550 | repaintContents( selectionX, selectionYTop, | 550 | repaintContents( selectionX, selectionYTop, |
551 | mGridSpacingX, selectionHeight,false ); | 551 | mGridSpacingX, selectionHeight,false ); |
552 | 552 | ||
553 | // Paint new selection | 553 | // Paint new selection |
554 | // repaintContents( mSelectionCellX * mGridSpacingX, mSelectionYTop, | 554 | // repaintContents( mSelectionCellX * mGridSpacingX, mSelectionYTop, |
555 | // mGridSpacingX, mSelectionHeight ); | 555 | // mGridSpacingX, mSelectionHeight ); |
556 | } | 556 | } |
557 | 557 | ||
558 | void KOAgenda::performSelectAction(QPoint viewportPos) | 558 | void KOAgenda::performSelectAction(QPoint viewportPos) |
559 | { | 559 | { |
560 | int x,y; | 560 | int x,y; |
561 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 561 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
562 | int gx,gy; | 562 | int gx,gy; |
563 | contentsToGrid(x,y,gx,gy); | 563 | contentsToGrid(x,y,gx,gy); |
564 | 564 | ||
565 | QPoint clipperPos = clipper()-> | 565 | QPoint clipperPos = clipper()-> |
566 | mapFromGlobal(viewport()->mapToGlobal(viewportPos)); | 566 | mapFromGlobal(viewport()->mapToGlobal(viewportPos)); |
567 | 567 | ||
568 | // Scroll if cursor was moved to upper or lower end of agenda. | 568 | // Scroll if cursor was moved to upper or lower end of agenda. |
569 | if (clipperPos.y() < mScrollBorderWidth) { | 569 | if (clipperPos.y() < mScrollBorderWidth) { |
570 | mScrollUpTimer.start(mScrollDelay); | 570 | mScrollUpTimer.start(mScrollDelay); |
571 | } else if (visibleHeight() - clipperPos.y() < | 571 | } else if (visibleHeight() - clipperPos.y() < |
572 | mScrollBorderWidth) { | 572 | mScrollBorderWidth) { |
573 | mScrollDownTimer.start(mScrollDelay); | 573 | mScrollDownTimer.start(mScrollDelay); |
574 | } else { | 574 | } else { |
575 | mScrollUpTimer.stop(); | 575 | mScrollUpTimer.stop(); |
576 | mScrollDownTimer.stop(); | 576 | mScrollDownTimer.stop(); |
577 | } | 577 | } |
578 | 578 | ||
579 | if ( gy > mCurrentCellY ) { | 579 | if ( gy > mCurrentCellY ) { |
580 | mSelectionHeight = ( gy + 1 ) * mGridSpacingY - mSelectionYTop; | 580 | mSelectionHeight = ( gy + 1 ) * mGridSpacingY - mSelectionYTop; |
581 | 581 | ||
582 | #if 0 | 582 | #if 0 |
583 | // FIXME: Repaint only the newly selected region | 583 | // FIXME: Repaint only the newly selected region |
584 | repaintContents( mSelectionCellX * mGridSpacingX, | 584 | repaintContents( mSelectionCellX * mGridSpacingX, |
585 | mCurrentCellY + mGridSpacingY, | 585 | mCurrentCellY + mGridSpacingY, |
586 | mGridSpacingX, | 586 | mGridSpacingX, |
587 | mSelectionHeight - ( gy - mCurrentCellY - 1 ) * mGridSpacingY ); | 587 | mSelectionHeight - ( gy - mCurrentCellY - 1 ) * mGridSpacingY ); |
588 | #else | 588 | #else |
589 | repaintContents( (KOGlobals::self()->reverseLayout() ? | 589 | repaintContents( (KOGlobals::self()->reverseLayout() ? |
590 | mColumns - 1 - mSelectionCellX : mSelectionCellX) * | 590 | mColumns - 1 - mSelectionCellX : mSelectionCellX) * |
591 | mGridSpacingX, mSelectionYTop, | 591 | mGridSpacingX, mSelectionYTop, |
592 | mGridSpacingX, mSelectionHeight , false); | 592 | mGridSpacingX, mSelectionHeight , false); |
593 | #endif | 593 | #endif |
594 | 594 | ||
595 | mCurrentCellY = gy; | 595 | mCurrentCellY = gy; |
596 | } else if ( gy < mCurrentCellY ) { | 596 | } else if ( gy < mCurrentCellY ) { |
597 | if ( gy >= mStartCellY ) { | 597 | if ( gy >= mStartCellY ) { |
598 | int selectionHeight = mSelectionHeight; | 598 | int selectionHeight = mSelectionHeight; |
599 | mSelectionHeight = ( gy + 1 ) * mGridSpacingY - mSelectionYTop; | 599 | mSelectionHeight = ( gy + 1 ) * mGridSpacingY - mSelectionYTop; |
600 | 600 | ||
601 | repaintContents( (KOGlobals::self()->reverseLayout() ? | 601 | repaintContents( (KOGlobals::self()->reverseLayout() ? |
602 | mColumns - 1 - mSelectionCellX : mSelectionCellX) * | 602 | mColumns - 1 - mSelectionCellX : mSelectionCellX) * |
603 | mGridSpacingX, mSelectionYTop, | 603 | mGridSpacingX, mSelectionYTop, |
604 | mGridSpacingX, selectionHeight,false ); | 604 | mGridSpacingX, selectionHeight,false ); |
605 | 605 | ||
606 | mCurrentCellY = gy; | 606 | mCurrentCellY = gy; |
607 | } else { | 607 | } else { |
608 | } | 608 | } |
609 | } | 609 | } |
610 | } | 610 | } |
611 | 611 | ||
612 | void KOAgenda::endSelectAction() | 612 | void KOAgenda::endSelectAction() |
613 | { | 613 | { |
614 | mActionType = NOP; | 614 | mActionType = NOP; |
615 | mScrollUpTimer.stop(); | 615 | mScrollUpTimer.stop(); |
616 | mScrollDownTimer.stop(); | 616 | mScrollDownTimer.stop(); |
617 | 617 | ||
618 | emit newTimeSpanSignal(mStartCellX,mStartCellY,mCurrentCellX,mCurrentCellY); | 618 | emit newTimeSpanSignal(mStartCellX,mStartCellY,mCurrentCellX,mCurrentCellY); |
619 | } | 619 | } |
620 | 620 | ||
621 | void KOAgenda::startItemAction(QPoint viewportPos) | 621 | void KOAgenda::startItemAction(QPoint viewportPos) |
622 | { | 622 | { |
623 | int x,y; | 623 | int x,y; |
624 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 624 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
625 | int gx,gy; | 625 | int gx,gy; |
626 | contentsToGrid(x,y,gx,gy); | 626 | contentsToGrid(x,y,gx,gy); |
627 | 627 | ||
628 | mStartCellX = gx; | 628 | mStartCellX = gx; |
629 | mStartCellY = gy; | 629 | mStartCellY = gy; |
630 | mCurrentCellX = gx; | 630 | mCurrentCellX = gx; |
631 | mCurrentCellY = gy; | 631 | mCurrentCellY = gy; |
632 | 632 | ||
633 | if (mAllDayMode) { | 633 | if (mAllDayMode) { |
634 | int gridDistanceX = (x - gx * mGridSpacingX); | 634 | int gridDistanceX = (x - gx * mGridSpacingX); |
635 | if (gridDistanceX < mResizeBorderWidth && | 635 | if (gridDistanceX < mResizeBorderWidth && |
636 | mActionItem->cellX() == mCurrentCellX) { | 636 | mActionItem->cellX() == mCurrentCellX) { |
637 | mActionType = RESIZELEFT; | 637 | mActionType = RESIZELEFT; |
638 | setCursor(sizeHorCursor); | 638 | setCursor(sizeHorCursor); |
639 | } else if ((mGridSpacingX - gridDistanceX) < mResizeBorderWidth && | 639 | } else if ((mGridSpacingX - gridDistanceX) < mResizeBorderWidth && |
640 | mActionItem->cellXWidth() == mCurrentCellX) { | 640 | mActionItem->cellXWidth() == mCurrentCellX) { |
641 | mActionType = RESIZERIGHT; | 641 | mActionType = RESIZERIGHT; |
642 | setCursor(sizeHorCursor); | 642 | setCursor(sizeHorCursor); |
643 | } else { | 643 | } else { |
644 | mActionType = MOVE; | 644 | mActionType = MOVE; |
645 | mActionItem->startMove(); | 645 | mActionItem->startMove(); |
646 | setCursor(sizeAllCursor); | 646 | setCursor(sizeAllCursor); |
647 | } | 647 | } |
648 | } else { | 648 | } else { |
649 | int gridDistanceY = (y - gy * mGridSpacingY); | 649 | int gridDistanceY = (y - gy * mGridSpacingY); |
650 | bool allowResize = ( mActionItem->incidence()->type() != "Todo" ); | 650 | bool allowResize = ( mActionItem->incidence()->type() != "Todo" ); |
651 | if (allowResize && gridDistanceY < mResizeBorderWidth && | 651 | if (allowResize && gridDistanceY < mResizeBorderWidth && |
652 | mActionItem->cellYTop() == mCurrentCellY && | 652 | mActionItem->cellYTop() == mCurrentCellY && |
653 | !mActionItem->firstMultiItem()) { | 653 | !mActionItem->firstMultiItem()) { |
654 | mActionType = RESIZETOP; | 654 | mActionType = RESIZETOP; |
655 | setCursor(sizeVerCursor); | 655 | setCursor(sizeVerCursor); |
656 | } else if (allowResize &&(mGridSpacingY - gridDistanceY) < mResizeBorderWidth && | 656 | } else if (allowResize &&(mGridSpacingY - gridDistanceY) < mResizeBorderWidth && |
657 | mActionItem->cellYBottom() == mCurrentCellY && | 657 | mActionItem->cellYBottom() == mCurrentCellY && |
658 | !mActionItem->lastMultiItem()) { | 658 | !mActionItem->lastMultiItem()) { |
659 | mActionType = RESIZEBOTTOM; | 659 | mActionType = RESIZEBOTTOM; |
660 | setCursor(sizeVerCursor); | 660 | setCursor(sizeVerCursor); |
661 | } else { | 661 | } else { |
662 | mActionType = MOVE; | 662 | mActionType = MOVE; |
663 | mActionItem->startMove(); | 663 | mActionItem->startMove(); |
664 | setCursor(sizeAllCursor); | 664 | setCursor(sizeAllCursor); |
665 | } | 665 | } |
666 | } | 666 | } |
667 | } | 667 | } |
668 | 668 | ||
669 | void KOAgenda::performItemAction(QPoint viewportPos) | 669 | void KOAgenda::performItemAction(QPoint viewportPos) |
670 | { | 670 | { |
671 | // kdDebug() << "viewportPos: " << viewportPos.x() << "," << viewportPos.y() << endl; | 671 | // kdDebug() << "viewportPos: " << viewportPos.x() << "," << viewportPos.y() << endl; |
672 | // QPoint point = viewport()->mapToGlobal(viewportPos); | 672 | // QPoint point = viewport()->mapToGlobal(viewportPos); |
673 | // kdDebug() << "Global: " << point.x() << "," << point.y() << endl; | 673 | // kdDebug() << "Global: " << point.x() << "," << point.y() << endl; |
674 | // point = clipper()->mapFromGlobal(point); | 674 | // point = clipper()->mapFromGlobal(point); |
675 | // kdDebug() << "clipper: " << point.x() << "," << point.y() << endl; | 675 | // kdDebug() << "clipper: " << point.x() << "," << point.y() << endl; |
676 | // kdDebug() << "visible height: " << visibleHeight() << endl; | 676 | // kdDebug() << "visible height: " << visibleHeight() << endl; |
677 | int x,y; | 677 | int x,y; |
678 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 678 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
679 | // kdDebug() << "contents: " << x << "," << y << "\n" << endl; | 679 | // kdDebug() << "contents: " << x << "," << y << "\n" << endl; |
680 | int gx,gy; | 680 | int gx,gy; |
681 | contentsToGrid(x,y,gx,gy); | 681 | contentsToGrid(x,y,gx,gy); |
682 | QPoint clipperPos = clipper()-> | 682 | QPoint clipperPos = clipper()-> |
683 | mapFromGlobal(viewport()->mapToGlobal(viewportPos)); | 683 | mapFromGlobal(viewport()->mapToGlobal(viewportPos)); |
684 | 684 | ||
685 | // Cursor left active agenda area. | 685 | // Cursor left active agenda area. |
686 | // This starts a drag. | 686 | // This starts a drag. |
687 | if ( /*clipperPos.y() < 0 || clipperPos.y() > visibleHeight() ||*/ | 687 | if ( /*clipperPos.y() < 0 || clipperPos.y() > visibleHeight() ||*/ |
688 | clipperPos.x() < 0 || clipperPos.x() > visibleWidth() ) { | 688 | clipperPos.x() < 0 || clipperPos.x() > visibleWidth() ) { |
689 | if ( mActionType == MOVE ) { | 689 | if ( mActionType == MOVE ) { |
690 | mScrollUpTimer.stop(); | 690 | mScrollUpTimer.stop(); |
691 | mScrollDownTimer.stop(); | 691 | mScrollDownTimer.stop(); |
692 | mActionItem->resetMove(); | 692 | mActionItem->resetMove(); |
693 | placeSubCells( mActionItem ); | 693 | placeSubCells( mActionItem ); |
694 | // emit startDragSignal( mActionItem->incidence() ); | 694 | // emit startDragSignal( mActionItem->incidence() ); |
695 | setCursor( arrowCursor ); | 695 | setCursor( arrowCursor ); |
696 | mActionItem = 0; | 696 | mActionItem = 0; |
697 | mActionType = NOP; | 697 | mActionType = NOP; |
698 | mItemMoved = 0; | 698 | mItemMoved = 0; |
699 | return; | 699 | return; |
700 | } | 700 | } |
701 | } else { | 701 | } else { |
702 | switch ( mActionType ) { | 702 | switch ( mActionType ) { |
703 | case MOVE: | 703 | case MOVE: |
704 | setCursor( sizeAllCursor ); | 704 | setCursor( sizeAllCursor ); |
705 | break; | 705 | break; |
706 | case RESIZETOP: | 706 | case RESIZETOP: |
707 | case RESIZEBOTTOM: | 707 | case RESIZEBOTTOM: |
708 | setCursor( sizeVerCursor ); | 708 | setCursor( sizeVerCursor ); |
709 | break; | 709 | break; |
710 | case RESIZELEFT: | 710 | case RESIZELEFT: |
711 | case RESIZERIGHT: | 711 | case RESIZERIGHT: |
712 | setCursor( sizeHorCursor ); | 712 | setCursor( sizeHorCursor ); |
713 | break; | 713 | break; |
714 | default: | 714 | default: |
715 | setCursor( arrowCursor ); | 715 | setCursor( arrowCursor ); |
716 | } | 716 | } |
717 | } | 717 | } |
718 | 718 | ||
719 | // Scroll if item was moved to upper or lower end of agenda. | 719 | // Scroll if item was moved to upper or lower end of agenda. |
720 | if (clipperPos.y() < mScrollBorderWidth) { | 720 | if (clipperPos.y() < mScrollBorderWidth) { |
721 | mScrollUpTimer.start(mScrollDelay); | 721 | mScrollUpTimer.start(mScrollDelay); |
722 | } else if (visibleHeight() - clipperPos.y() < | 722 | } else if (visibleHeight() - clipperPos.y() < |
723 | mScrollBorderWidth) { | 723 | mScrollBorderWidth) { |
724 | mScrollDownTimer.start(mScrollDelay); | 724 | mScrollDownTimer.start(mScrollDelay); |
725 | } else { | 725 | } else { |
726 | mScrollUpTimer.stop(); | 726 | mScrollUpTimer.stop(); |
727 | mScrollDownTimer.stop(); | 727 | mScrollDownTimer.stop(); |
728 | } | 728 | } |
729 | 729 | ||
730 | // Move or resize item if necessary | 730 | // Move or resize item if necessary |
731 | if (mCurrentCellX != gx || mCurrentCellY != gy) { | 731 | if (mCurrentCellX != gx || mCurrentCellY != gy) { |
732 | mItemMoved = true; | 732 | mItemMoved = true; |
733 | mActionItem->raise(); | 733 | mActionItem->raise(); |
734 | if (mActionType == MOVE) { | 734 | if (mActionType == MOVE) { |
735 | // Move all items belonging to a multi item | 735 | // Move all items belonging to a multi item |
736 | KOAgendaItem *moveItem = mActionItem->firstMultiItem(); | 736 | KOAgendaItem *moveItem = mActionItem->firstMultiItem(); |
737 | bool isMultiItem = (moveItem || mActionItem->lastMultiItem()); | 737 | bool isMultiItem = (moveItem || mActionItem->lastMultiItem()); |
738 | if (!moveItem) moveItem = mActionItem; | 738 | if (!moveItem) moveItem = mActionItem; |
739 | while (moveItem) { | 739 | while (moveItem) { |
740 | int dy; | 740 | int dy; |
741 | if (isMultiItem) dy = 0; | 741 | if (isMultiItem) dy = 0; |
742 | else dy = gy - mCurrentCellY; | 742 | else dy = gy - mCurrentCellY; |
743 | moveItem->moveRelative(gx - mCurrentCellX,dy); | 743 | moveItem->moveRelative(gx - mCurrentCellX,dy); |
744 | int x,y; | 744 | int x,y; |
745 | gridToContents(moveItem->cellX(),moveItem->cellYTop(),x,y); | 745 | gridToContents(moveItem->cellX(),moveItem->cellYTop(),x,y); |
746 | moveItem->resize(mGridSpacingX * moveItem->cellWidth(), | 746 | moveItem->resize(mGridSpacingX * moveItem->cellWidth(), |
747 | mGridSpacingY * moveItem->cellHeight()); | 747 | mGridSpacingY * moveItem->cellHeight()); |
748 | moveChild(moveItem,x,y); | 748 | moveChild(moveItem,x,y); |
749 | moveItem = moveItem->nextMultiItem(); | 749 | moveItem = moveItem->nextMultiItem(); |
750 | } | 750 | } |
751 | } else if (mActionType == RESIZETOP) { | 751 | } else if (mActionType == RESIZETOP) { |
752 | if (mCurrentCellY <= mActionItem->cellYBottom()) { | 752 | if (mCurrentCellY <= mActionItem->cellYBottom()) { |
753 | mActionItem->expandTop(gy - mCurrentCellY); | 753 | mActionItem->expandTop(gy - mCurrentCellY); |
754 | mActionItem->resize(mActionItem->width(), | 754 | mActionItem->resize(mActionItem->width(), |
755 | mGridSpacingY * mActionItem->cellHeight()); | 755 | mGridSpacingY * mActionItem->cellHeight()); |
756 | int x,y; | 756 | int x,y; |
757 | gridToContents(mCurrentCellX,mActionItem->cellYTop(),x,y); | 757 | gridToContents(mCurrentCellX,mActionItem->cellYTop(),x,y); |
758 | //moveChild(mActionItem,childX(mActionItem),y); | 758 | //moveChild(mActionItem,childX(mActionItem),y); |
759 | QScrollView::moveChild( mActionItem,childX(mActionItem),y ); | 759 | QScrollView::moveChild( mActionItem,childX(mActionItem),y ); |
760 | } | 760 | } |
761 | } else if (mActionType == RESIZEBOTTOM) { | 761 | } else if (mActionType == RESIZEBOTTOM) { |
762 | if (mCurrentCellY >= mActionItem->cellYTop()) { | 762 | if (mCurrentCellY >= mActionItem->cellYTop()) { |
763 | mActionItem->expandBottom(gy - mCurrentCellY); | 763 | mActionItem->expandBottom(gy - mCurrentCellY); |
764 | mActionItem->resize(mActionItem->width(), | 764 | mActionItem->resize(mActionItem->width(), |
765 | mGridSpacingY * mActionItem->cellHeight()); | 765 | mGridSpacingY * mActionItem->cellHeight()); |
766 | } | 766 | } |
767 | } else if (mActionType == RESIZELEFT) { | 767 | } else if (mActionType == RESIZELEFT) { |
768 | if (mCurrentCellX <= mActionItem->cellXWidth()) { | 768 | if (mCurrentCellX <= mActionItem->cellXWidth()) { |
769 | mActionItem->expandLeft(gx - mCurrentCellX); | 769 | mActionItem->expandLeft(gx - mCurrentCellX); |
770 | mActionItem->resize(mGridSpacingX * mActionItem->cellWidth(), | 770 | mActionItem->resize(mGridSpacingX * mActionItem->cellWidth(), |
771 | mActionItem->height()); | 771 | mActionItem->height()); |
772 | int x,y; | 772 | int x,y; |
773 | gridToContents(mActionItem->cellX(),mActionItem->cellYTop(),x,y); | 773 | gridToContents(mActionItem->cellX(),mActionItem->cellYTop(),x,y); |
774 | moveChild(mActionItem,x,childY(mActionItem)); | 774 | moveChild(mActionItem,x,childY(mActionItem)); |
775 | } | 775 | } |
776 | } else if (mActionType == RESIZERIGHT) { | 776 | } else if (mActionType == RESIZERIGHT) { |
777 | if (mCurrentCellX >= mActionItem->cellX()) { | 777 | if (mCurrentCellX >= mActionItem->cellX()) { |
778 | mActionItem->expandRight(gx - mCurrentCellX); | 778 | mActionItem->expandRight(gx - mCurrentCellX); |
779 | mActionItem->resize(mGridSpacingX * mActionItem->cellWidth(), | 779 | mActionItem->resize(mGridSpacingX * mActionItem->cellWidth(), |
780 | mActionItem->height()); | 780 | mActionItem->height()); |
781 | } | 781 | } |
782 | } | 782 | } |
783 | mCurrentCellX = gx; | 783 | mCurrentCellX = gx; |
784 | mCurrentCellY = gy; | 784 | mCurrentCellY = gy; |
785 | } | 785 | } |
786 | } | 786 | } |
787 | 787 | ||
788 | void KOAgenda::endItemAction() | 788 | void KOAgenda::endItemAction() |
789 | { | 789 | { |
790 | 790 | ||
791 | if ( mItemMoved ) { | 791 | if ( mItemMoved ) { |
792 | KOAgendaItem *placeItem = mActionItem->firstMultiItem(); | 792 | KOAgendaItem *placeItem = mActionItem->firstMultiItem(); |
793 | if ( !placeItem ) { | 793 | if ( !placeItem ) { |
794 | placeItem = mActionItem; | 794 | placeItem = mActionItem; |
795 | } | 795 | } |
796 | if ( placeItem->incidence()->recurrence()->doesRecur() ) { | 796 | if ( placeItem->incidence()->recurrence()->doesRecur() ) { |
797 | Incidence* oldInc = placeItem->incidence(); | 797 | Incidence* oldInc = placeItem->incidence(); |
798 | placeItem->recreateIncidence(); | 798 | placeItem->recreateIncidence(); |
799 | emit addToCalSignal(placeItem->incidence(), oldInc ); | 799 | emit addToCalSignal(placeItem->incidence(), oldInc ); |
800 | } | 800 | } |
801 | int type = mActionType; | 801 | int type = mActionType; |
802 | if ( mAllDayMode ) | 802 | if ( mAllDayMode ) |
803 | type = -1; | 803 | type = -1; |
804 | KOAgendaItem *modifiedItem = placeItem; | 804 | KOAgendaItem *modifiedItem = placeItem; |
805 | //emit itemModified( placeItem, mActionType /*KOGlobals::EVENTEDITED */); | 805 | //emit itemModified( placeItem, mActionType /*KOGlobals::EVENTEDITED */); |
806 | QPtrList<KOAgendaItem> oldconflictItems ;//= placeItem->conflictItems(); | 806 | QPtrList<KOAgendaItem> oldconflictItems ;//= placeItem->conflictItems(); |
807 | KOAgendaItem *item; | 807 | KOAgendaItem *item; |
808 | 808 | ||
809 | if ( placeItem->incidence()->type() == "Todo" ) { | 809 | if ( placeItem->incidence()->type() == "Todo" ) { |
810 | mSelectedItem = 0; | 810 | mSelectedItem = 0; |
811 | //qDebug("todo %d %d %d ", mCurrentCellX, modifiedItem->cellX() ,modifiedItem->cellXWidth()); | 811 | //qDebug("todo %d %d %d ", mCurrentCellX, modifiedItem->cellX() ,modifiedItem->cellXWidth()); |
812 | modifiedItem->mLastMoveXPos = mCurrentCellX; | 812 | modifiedItem->mLastMoveXPos = mCurrentCellX; |
813 | emit itemModified( modifiedItem, mActionType ); | 813 | emit itemModified( modifiedItem, mActionType ); |
814 | } | 814 | } |
815 | else { | 815 | else { |
816 | #if 0 | 816 | #if 0 |
817 | for ( item=oldconflictItems.first(); item != 0; | 817 | for ( item=oldconflictItems.first(); item != 0; |
818 | item=oldconflictItems.next() ) { | 818 | item=oldconflictItems.next() ) { |
819 | placeSubCells(item); | 819 | placeSubCells(item); |
820 | } | 820 | } |
821 | while ( placeItem ) { | 821 | while ( placeItem ) { |
822 | //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1()); | 822 | //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1()); |
823 | placeSubCells( placeItem ); | 823 | placeSubCells( placeItem ); |
824 | placeItem = placeItem->nextMultiItem(); | 824 | placeItem = placeItem->nextMultiItem(); |
825 | } | 825 | } |
826 | #endif | 826 | #endif |
827 | 827 | ||
828 | globalFlagBlockAgendaItemPaint = 1; | 828 | globalFlagBlockAgendaItemPaint = 1; |
829 | for ( item=oldconflictItems.first(); item != 0; | 829 | for ( item=oldconflictItems.first(); item != 0; |
830 | item=oldconflictItems.next() ) { | 830 | item=oldconflictItems.next() ) { |
831 | placeSubCells(item); | 831 | placeSubCells(item); |
832 | } | 832 | } |
833 | while ( placeItem ) { | 833 | while ( placeItem ) { |
834 | //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1()); | 834 | //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1()); |
835 | oldconflictItems = placeItem->conflictItems(); | 835 | oldconflictItems = placeItem->conflictItems(); |
836 | for ( item=oldconflictItems.first(); item != 0; | 836 | for ( item=oldconflictItems.first(); item != 0; |
837 | item=oldconflictItems.next() ) { | 837 | item=oldconflictItems.next() ) { |
838 | placeSubCells(item); | 838 | placeSubCells(item); |
839 | } | 839 | } |
840 | placeSubCells( placeItem ); | 840 | placeSubCells( placeItem ); |
841 | placeItem = placeItem->nextMultiItem(); | 841 | placeItem = placeItem->nextMultiItem(); |
842 | } | 842 | } |
843 | globalFlagBlockAgendaItemPaint = 0; | 843 | globalFlagBlockAgendaItemPaint = 0; |
844 | for ( item=oldconflictItems.first(); item != 0; | 844 | for ( item=oldconflictItems.first(); item != 0; |
845 | item=oldconflictItems.next() ) { | 845 | item=oldconflictItems.next() ) { |
846 | globalFlagBlockAgendaItemUpdate = 0; | 846 | globalFlagBlockAgendaItemUpdate = 0; |
847 | item->repaintMe(); | 847 | item->repaintMe(); |
848 | globalFlagBlockAgendaItemUpdate = 1; | 848 | globalFlagBlockAgendaItemUpdate = 1; |
849 | item->repaint( false ); | 849 | item->repaint( false ); |
850 | } | 850 | } |
851 | placeItem = modifiedItem; | 851 | placeItem = modifiedItem; |
852 | 852 | ||
853 | while ( placeItem ) { | 853 | while ( placeItem ) { |
854 | //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1()); | 854 | //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1()); |
855 | globalFlagBlockAgendaItemUpdate = 0; | 855 | globalFlagBlockAgendaItemUpdate = 0; |
856 | placeItem->repaintMe(); | 856 | placeItem->repaintMe(); |
857 | globalFlagBlockAgendaItemUpdate = 1; | 857 | globalFlagBlockAgendaItemUpdate = 1; |
858 | placeItem->repaint(false); | 858 | placeItem->repaint(false); |
859 | placeItem = placeItem->nextMultiItem(); | 859 | placeItem = placeItem->nextMultiItem(); |
860 | } | 860 | } |
861 | emit itemModified( modifiedItem, mActionType ); | 861 | emit itemModified( modifiedItem, mActionType ); |
862 | 862 | ||
863 | 863 | ||
864 | placeItem = modifiedItem; | 864 | placeItem = modifiedItem; |
865 | while ( placeItem ) { | 865 | while ( placeItem ) { |
866 | oldconflictItems = placeItem->conflictItems(); | 866 | oldconflictItems = placeItem->conflictItems(); |
867 | for ( item=oldconflictItems.first(); item != 0; | 867 | for ( item=oldconflictItems.first(); item != 0; |
868 | item=oldconflictItems.next() ) { | 868 | item=oldconflictItems.next() ) { |
869 | placeSubCells(item); | 869 | placeSubCells(item); |
870 | } | 870 | } |
871 | placeSubCells( placeItem ); | 871 | placeSubCells( placeItem ); |
872 | placeItem = placeItem->nextMultiItem(); | 872 | placeItem = placeItem->nextMultiItem(); |
873 | 873 | ||
874 | } | 874 | } |
875 | placeItem = modifiedItem; | 875 | placeItem = modifiedItem; |
876 | while ( placeItem ) { | 876 | while ( placeItem ) { |
877 | oldconflictItems = placeItem->conflictItems(); | 877 | oldconflictItems = placeItem->conflictItems(); |
878 | for ( item=oldconflictItems.first(); item != 0; | 878 | for ( item=oldconflictItems.first(); item != 0; |
879 | item=oldconflictItems.next() ) { | 879 | item=oldconflictItems.next() ) { |
880 | globalFlagBlockAgendaItemUpdate = 0; | 880 | globalFlagBlockAgendaItemUpdate = 0; |
881 | item->repaintMe(); | 881 | item->repaintMe(); |
882 | globalFlagBlockAgendaItemUpdate = 1; | 882 | globalFlagBlockAgendaItemUpdate = 1; |
883 | item->repaint(false); | 883 | item->repaint(false); |
884 | } | 884 | } |
885 | placeItem = placeItem->nextMultiItem(); | 885 | placeItem = placeItem->nextMultiItem(); |
886 | } | 886 | } |
887 | /* | 887 | /* |
888 | 888 | ||
889 | oldconflictItems = modifiedItem->conflictItems(); | 889 | oldconflictItems = modifiedItem->conflictItems(); |
890 | for ( item=oldconflictItems.first(); item != 0; | 890 | for ( item=oldconflictItems.first(); item != 0; |
891 | item=oldconflictItems.next() ) { | 891 | item=oldconflictItems.next() ) { |
892 | globalFlagBlockAgendaItemUpdate = 0; | 892 | globalFlagBlockAgendaItemUpdate = 0; |
893 | item->paintMe(false); | 893 | item->paintMe(false); |
894 | globalFlagBlockAgendaItemUpdate = 1; | 894 | globalFlagBlockAgendaItemUpdate = 1; |
895 | item->repaint(false); | 895 | item->repaint(false); |
896 | } | 896 | } |
897 | */ | 897 | */ |
898 | 898 | ||
899 | 899 | ||
900 | } | 900 | } |
901 | 901 | ||
902 | } | 902 | } |
903 | 903 | ||
904 | mScrollUpTimer.stop(); | 904 | mScrollUpTimer.stop(); |
905 | mScrollDownTimer.stop(); | 905 | mScrollDownTimer.stop(); |
906 | setCursor( arrowCursor ); | 906 | setCursor( arrowCursor ); |
907 | mActionItem = 0; | 907 | mActionItem = 0; |
908 | mActionType = NOP; | 908 | mActionType = NOP; |
909 | mItemMoved = 0; | 909 | mItemMoved = 0; |
910 | 910 | ||
911 | } | 911 | } |
912 | 912 | ||
913 | void KOAgenda::setNoActionCursor(KOAgendaItem *moveItem,QPoint viewportPos) | 913 | void KOAgenda::setNoActionCursor(KOAgendaItem *moveItem,QPoint viewportPos) |
914 | { | 914 | { |
915 | // kdDebug() << "viewportPos: " << viewportPos.x() << "," << viewportPos.y() << endl; | 915 | // kdDebug() << "viewportPos: " << viewportPos.x() << "," << viewportPos.y() << endl; |
916 | // QPoint point = viewport()->mapToGlobal(viewportPos); | 916 | // QPoint point = viewport()->mapToGlobal(viewportPos); |
917 | // kdDebug() << "Global: " << point.x() << "," << point.y() << endl; | 917 | // kdDebug() << "Global: " << point.x() << "," << point.y() << endl; |
918 | // point = clipper()->mapFromGlobal(point); | 918 | // point = clipper()->mapFromGlobal(point); |
919 | // kdDebug() << "clipper: " << point.x() << "," << point.y() << endl; | 919 | // kdDebug() << "clipper: " << point.x() << "," << point.y() << endl; |
920 | 920 | ||
921 | int x,y; | 921 | int x,y; |
922 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 922 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
923 | // kdDebug() << "contents: " << x << "," << y << "\n" << endl; | 923 | // kdDebug() << "contents: " << x << "," << y << "\n" << endl; |
924 | int gx,gy; | 924 | int gx,gy; |
925 | contentsToGrid(x,y,gx,gy); | 925 | contentsToGrid(x,y,gx,gy); |
926 | 926 | ||
927 | // Change cursor to resize cursor if appropriate | 927 | // Change cursor to resize cursor if appropriate |
928 | if (mAllDayMode) { | 928 | if (mAllDayMode) { |
929 | int gridDistanceX = (x - gx * mGridSpacingX); | 929 | int gridDistanceX = (x - gx * mGridSpacingX); |
930 | if (gridDistanceX < mResizeBorderWidth && | 930 | if (gridDistanceX < mResizeBorderWidth && |
931 | moveItem->cellX() == gx) { | 931 | moveItem->cellX() == gx) { |
932 | setCursor(sizeHorCursor); | 932 | setCursor(sizeHorCursor); |
933 | } else if ((mGridSpacingX - gridDistanceX) < mResizeBorderWidth && | 933 | } else if ((mGridSpacingX - gridDistanceX) < mResizeBorderWidth && |
934 | moveItem->cellXWidth() == gx) { | 934 | moveItem->cellXWidth() == gx) { |
935 | setCursor(sizeHorCursor); | 935 | setCursor(sizeHorCursor); |
936 | } else { | 936 | } else { |
937 | setCursor(arrowCursor); | 937 | setCursor(arrowCursor); |
938 | } | 938 | } |
939 | } else { | 939 | } else { |
940 | int gridDistanceY = (y - gy * mGridSpacingY); | 940 | int gridDistanceY = (y - gy * mGridSpacingY); |
941 | if (gridDistanceY < mResizeBorderWidth && | 941 | if (gridDistanceY < mResizeBorderWidth && |
942 | moveItem->cellYTop() == gy && | 942 | moveItem->cellYTop() == gy && |
943 | !moveItem->firstMultiItem()) { | 943 | !moveItem->firstMultiItem()) { |
944 | setCursor(sizeVerCursor); | 944 | setCursor(sizeVerCursor); |
945 | } else if ((mGridSpacingY - gridDistanceY) < mResizeBorderWidth && | 945 | } else if ((mGridSpacingY - gridDistanceY) < mResizeBorderWidth && |
946 | moveItem->cellYBottom() == gy && | 946 | moveItem->cellYBottom() == gy && |
947 | !moveItem->lastMultiItem()) { | 947 | !moveItem->lastMultiItem()) { |
948 | setCursor(sizeVerCursor); | 948 | setCursor(sizeVerCursor); |
949 | } else { | 949 | } else { |
950 | setCursor(arrowCursor); | 950 | setCursor(arrowCursor); |
951 | } | 951 | } |
952 | } | 952 | } |
953 | } | 953 | } |
954 | 954 | ||
955 | 955 | ||
956 | /* | 956 | /* |
957 | Place item in cell and take care that multiple items using the same cell do | 957 | Place item in cell and take care that multiple items using the same cell do |
958 | not overlap. This method is not yet optimal. It doesn´t use the maximum space | 958 | not overlap. This method is not yet optimal. It doesn´t use the maximum space |
959 | it can get in all cases. | 959 | it can get in all cases. |
960 | At the moment the method has a bug: When an item is placed only the sub cell | 960 | At the moment the method has a bug: When an item is placed only the sub cell |
961 | widths of the items are changed, which are within the Y region the item to | 961 | widths of the items are changed, which are within the Y region the item to |
962 | place spans. When the sub cell width change of one of this items affects a | 962 | place spans. When the sub cell width change of one of this items affects a |
963 | cell, where other items are, which do not overlap in Y with the item to place, | 963 | cell, where other items are, which do not overlap in Y with the item to place, |
964 | the display gets corrupted, although the corruption looks quite nice. | 964 | the display gets corrupted, although the corruption looks quite nice. |
965 | */ | 965 | */ |
966 | void KOAgenda::placeSubCells(KOAgendaItem *placeItem) | 966 | void KOAgenda::placeSubCells(KOAgendaItem *placeItem) |
967 | { | 967 | { |
968 | 968 | ||
969 | QPtrList<KOAgendaItem> conflictItems; | 969 | QPtrList<KOAgendaItem> conflictItems; |
970 | int maxSubCells = 0; | 970 | int maxSubCells = 0; |
971 | QIntDict<KOAgendaItem> subCellDict(5); | 971 | QIntDict<KOAgendaItem> subCellDict(5); |
972 | 972 | ||
973 | KOAgendaItem *item; | 973 | KOAgendaItem *item; |
974 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 974 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
975 | if (item != placeItem) { | 975 | if (item != placeItem) { |
976 | if (placeItem->cellX() <= item->cellXWidth() && | 976 | if (placeItem->cellX() <= item->cellXWidth() && |
977 | placeItem->cellXWidth() >= item->cellX()) { | 977 | placeItem->cellXWidth() >= item->cellX()) { |
978 | if ((placeItem->cellYTop() <= item->cellYBottom()) && | 978 | if ((placeItem->cellYTop() <= item->cellYBottom()) && |
979 | (placeItem->cellYBottom() >= item->cellYTop())) { | 979 | (placeItem->cellYBottom() >= item->cellYTop())) { |
980 | conflictItems.append(item); | 980 | conflictItems.append(item); |
981 | if (item->subCells() > maxSubCells) | 981 | if (item->subCells() > maxSubCells) |
982 | maxSubCells = item->subCells(); | 982 | maxSubCells = item->subCells(); |
983 | subCellDict.insert(item->subCell(),item); | 983 | subCellDict.insert(item->subCell(),item); |
984 | } | 984 | } |
985 | } | 985 | } |
986 | } | 986 | } |
987 | } | 987 | } |
988 | 988 | ||
989 | if (conflictItems.count() > 0) { | 989 | if (conflictItems.count() > 0) { |
990 | // Look for unused sub cell and insert item | 990 | // Look for unused sub cell and insert item |
991 | int i; | 991 | int i; |
992 | for(i=0;i<maxSubCells;++i) { | 992 | for(i=0;i<maxSubCells;++i) { |
993 | if (!subCellDict.find(i)) { | 993 | if (!subCellDict.find(i)) { |
994 | placeItem->setSubCell(i); | 994 | placeItem->setSubCell(i); |
995 | break; | 995 | break; |
996 | } | 996 | } |
997 | } | 997 | } |
998 | if (i == maxSubCells) { | 998 | if (i == maxSubCells) { |
999 | placeItem->setSubCell(maxSubCells); | 999 | placeItem->setSubCell(maxSubCells); |
1000 | maxSubCells++; // add new item to number of sub cells | 1000 | maxSubCells++; // add new item to number of sub cells |
1001 | } | 1001 | } |
1002 | 1002 | ||
1003 | // Prepare for sub cell geometry adjustment | 1003 | // Prepare for sub cell geometry adjustment |
1004 | int newSubCellWidth; | 1004 | int newSubCellWidth; |
1005 | if (mAllDayMode) newSubCellWidth = mGridSpacingY / maxSubCells; | 1005 | if (mAllDayMode) newSubCellWidth = mGridSpacingY / maxSubCells; |
1006 | else newSubCellWidth = mGridSpacingX / maxSubCells; | 1006 | else newSubCellWidth = mGridSpacingX / maxSubCells; |
1007 | conflictItems.append(placeItem); | 1007 | conflictItems.append(placeItem); |
1008 | 1008 | ||
1009 | 1009 | ||
1010 | // Adjust sub cell geometry of all items | 1010 | // Adjust sub cell geometry of all items |
1011 | for ( item=conflictItems.first(); item != 0; | 1011 | for ( item=conflictItems.first(); item != 0; |
1012 | item=conflictItems.next() ) { | 1012 | item=conflictItems.next() ) { |
1013 | item->setSubCells(maxSubCells); | 1013 | item->setSubCells(maxSubCells); |
1014 | if (mAllDayMode) { | 1014 | if (mAllDayMode) { |
1015 | item->resize(item->cellWidth() * mGridSpacingX, newSubCellWidth); | 1015 | item->resize(item->cellWidth() * mGridSpacingX, newSubCellWidth); |
1016 | } else { | 1016 | } else { |
1017 | item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY); | 1017 | item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY); |
1018 | } | 1018 | } |
1019 | int x,y; | 1019 | int x,y; |
1020 | gridToContents(item->cellX(),item->cellYTop(),x,y); | 1020 | gridToContents(item->cellX(),item->cellYTop(),x,y); |
1021 | if (mAllDayMode) { | 1021 | if (mAllDayMode) { |
1022 | y += item->subCell() * newSubCellWidth; | 1022 | y += item->subCell() * newSubCellWidth; |
1023 | } else { | 1023 | } else { |
1024 | x += item->subCell() * newSubCellWidth; | 1024 | x += item->subCell() * newSubCellWidth; |
1025 | } | 1025 | } |
1026 | moveChild(item,x,y); | 1026 | moveChild(item,x,y); |
1027 | // qDebug("moveChild %s %d %d ", item->incidence()->summary().latin1() ,x,y); | 1027 | // qDebug("moveChild %s %d %d ", item->incidence()->summary().latin1() ,x,y); |
1028 | //item->updateItem(); | 1028 | //item->updateItem(); |
1029 | } | 1029 | } |
1030 | 1030 | ||
1031 | } else { | 1031 | } else { |
1032 | placeItem->setSubCell(0); | 1032 | placeItem->setSubCell(0); |
1033 | placeItem->setSubCells(1); | 1033 | placeItem->setSubCells(1); |
1034 | if (mAllDayMode) placeItem->resize(placeItem->width(),mGridSpacingY); | 1034 | if (mAllDayMode) placeItem->resize(placeItem->width(),mGridSpacingY); |
1035 | else placeItem->resize(mGridSpacingX,placeItem->height()); | 1035 | else placeItem->resize(mGridSpacingX,placeItem->height()); |
1036 | int x,y; | 1036 | int x,y; |
1037 | gridToContents(placeItem->cellX(),placeItem->cellYTop(),x,y); | 1037 | gridToContents(placeItem->cellX(),placeItem->cellYTop(),x,y); |
1038 | moveChild(placeItem,x,y); | 1038 | moveChild(placeItem,x,y); |
1039 | } | 1039 | } |
1040 | placeItem->setConflictItems(conflictItems); | 1040 | placeItem->setConflictItems(conflictItems); |
1041 | // for ( item=conflictItems.first(); item != 0; | 1041 | // for ( item=conflictItems.first(); item != 0; |
1042 | // item=conflictItems.next() ) { | 1042 | // item=conflictItems.next() ) { |
1043 | // //item->updateItem(); | 1043 | // //item->updateItem(); |
1044 | // //qDebug("xxx item->updateItem() %s %d %d", item->incidence()->summary().latin1(),item->x(), item->y() ); | 1044 | // //qDebug("xxx item->updateItem() %s %d %d", item->incidence()->summary().latin1(),item->x(), item->y() ); |
1045 | // } | 1045 | // } |
1046 | // placeItem->updateItem(); | 1046 | // placeItem->updateItem(); |
1047 | } | 1047 | } |
1048 | 1048 | ||
1049 | void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) | 1049 | void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) |
1050 | { | 1050 | { |
1051 | if ( globalFlagBlockAgenda ) | 1051 | if ( globalFlagBlockAgenda ) |
1052 | return; | 1052 | return; |
1053 | //qDebug("KOAgenda::drawContents "); | 1053 | //qDebug("KOAgenda::drawContents "); |
1054 | if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) | 1054 | if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) |
1055 | ;//drawContentsToPainter(); | 1055 | ;//drawContentsToPainter(); |
1056 | 1056 | ||
1057 | QPaintDevice* pd = p->device(); | 1057 | QPaintDevice* pd = p->device(); |
1058 | p->end(); | 1058 | p->end(); |
1059 | int vx, vy; | 1059 | int vx, vy; |
1060 | int selectionX = KOGlobals::self()->reverseLayout() ? | 1060 | int selectionX = KOGlobals::self()->reverseLayout() ? |
1061 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : | 1061 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : |
1062 | mSelectionCellX * mGridSpacingX; | 1062 | mSelectionCellX * mGridSpacingX; |
1063 | contentsToViewport ( cx, cy, vx,vy); | 1063 | contentsToViewport ( cx, cy, vx,vy); |
1064 | // qDebug(" %d %d %d %d ", cx, cy, cw,ch) ; | 1064 | // qDebug(" %d %d %d %d ", cx, cy, cw,ch) ; |
1065 | if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) | 1065 | if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) |
1066 | bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); | 1066 | bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); |
1067 | 1067 | ||
1068 | if ( mSelectionHeight > 0 ) { | 1068 | if ( mSelectionHeight > 0 ) { |
1069 | //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight ); | 1069 | //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight ); |
1070 | if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && | 1070 | if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && |
1071 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { | 1071 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { |
1072 | contentsToViewport ( selectionX, mSelectionYTop, vx,vy); | 1072 | contentsToViewport ( selectionX, mSelectionYTop, vx,vy); |
1073 | bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP); | 1073 | bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP); |
1074 | } | 1074 | } |
1075 | } | 1075 | } |
1076 | //qDebug("btbl "); | 1076 | //qDebug("btbl "); |
1077 | p->begin( pd ); | 1077 | p->begin( pd ); |
1078 | //qDebug("end "); | 1078 | //qDebug("end "); |
1079 | } | 1079 | } |
1080 | 1080 | ||
1081 | void KOAgenda::finishUpdate() | 1081 | void KOAgenda::finishUpdate() |
1082 | { | 1082 | { |
1083 | 1083 | ||
1084 | KOAgendaItem *item; | 1084 | KOAgendaItem *item; |
1085 | globalFlagBlockAgendaItemPaint = 1; | 1085 | globalFlagBlockAgendaItemPaint = 1; |
1086 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 1086 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
1087 | if ( !item->isVisible() ) | 1087 | if ( !item->isVisible() ) |
1088 | item->show(); | 1088 | item->show(); |
1089 | 1089 | ||
1090 | } | 1090 | } |
1091 | globalFlagBlockAgendaItemUpdate = 0; | 1091 | globalFlagBlockAgendaItemUpdate = 0; |
1092 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 1092 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
1093 | item->repaintMe( ); | 1093 | item->repaintMe( ); |
1094 | } | 1094 | } |
1095 | globalFlagBlockAgendaItemUpdate = 1; | 1095 | globalFlagBlockAgendaItemUpdate = 1; |
1096 | qApp->processEvents(); | 1096 | qApp->processEvents(); |
1097 | globalFlagBlockAgendaItemPaint = 0; | 1097 | globalFlagBlockAgendaItemPaint = 0; |
1098 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 1098 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
1099 | item->repaint( false ); | 1099 | item->repaint( false ); |
1100 | } | 1100 | } |
1101 | 1101 | ||
1102 | } | 1102 | } |
1103 | 1103 | ||
1104 | /* | 1104 | /* |
1105 | Draw grid in the background of the agenda. | 1105 | Draw grid in the background of the agenda. |
1106 | */ | 1106 | */ |
1107 | void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// int cx, int cy, int cw, int ch) | 1107 | void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// int cx, int cy, int cw, int ch) |
1108 | { | 1108 | { |
1109 | 1109 | ||
1110 | 1110 | ||
1111 | if ( ! mGridSpacingX || ! mGridSpacingY ||! mHolidayMask ) | 1111 | if ( ! mGridSpacingX || ! mGridSpacingY ||! mHolidayMask ) |
1112 | return; | 1112 | return; |
1113 | if ( globalFlagBlockAgenda > 1 && globalFlagBlockAgenda < 4 ) | 1113 | if ( globalFlagBlockAgenda > 1 && globalFlagBlockAgenda < 4 ) |
1114 | return; | 1114 | return; |
1115 | int cx = 0, cy = 0, cw = contentsWidth(), ch = contentsHeight(); | 1115 | int cx = 0, cy = 0, cw = contentsWidth(), ch = contentsHeight(); |
1116 | if ( ch < 1 ) | 1116 | if ( ch < 1 ) |
1117 | ch = 1; | 1117 | ch = 1; |
1118 | if ( mPaintPixmap.width() < contentsWidth()+42 || mPaintPixmap.height() < ch ) { | 1118 | if ( mPaintPixmap.width() < contentsWidth()+42 || mPaintPixmap.height() < ch ) { |
1119 | mPaintPixmap.resize( contentsWidth()+42, ch ); | 1119 | mPaintPixmap.resize( contentsWidth()+42, ch ); |
1120 | } | 1120 | } |
1121 | mCurPixWid = contentsWidth(); | 1121 | mCurPixWid = contentsWidth(); |
1122 | mCurPixHei = ch; | 1122 | mCurPixHei = ch; |
1123 | if ( mHighlightPixmap.width() < mGridSpacingX-1 || mHighlightPixmap.height() < ch ) { | 1123 | if ( mHighlightPixmap.width() < mGridSpacingX-1 || mHighlightPixmap.height() < ch ) { |
1124 | mHighlightPixmap.resize( mGridSpacingX-1, ch ); | 1124 | mHighlightPixmap.resize( mGridSpacingX-1, ch ); |
1125 | mHighlightPixmap.fill ( KOPrefs::instance()->mHighlightColor ); | 1125 | mHighlightPixmap.fill ( KOPrefs::instance()->mHighlightColor ); |
1126 | } | 1126 | } |
1127 | mPixPainter.begin( &mPaintPixmap) ; | 1127 | mPixPainter.begin( &mPaintPixmap) ; |
1128 | //qDebug("wid %d hei %d ",mPaintPixmap.width(),mPaintPixmap.height() ); | 1128 | //qDebug("wid %d hei %d ",mPaintPixmap.width(),mPaintPixmap.height() ); |
1129 | QPainter * p ; | 1129 | QPainter * p ; |
1130 | if (paint == 0) { | 1130 | if (paint == 0) { |
1131 | mPaintPixmap.fill(KOPrefs::instance()->mAgendaBgColor); | 1131 | mPaintPixmap.fill(KOPrefs::instance()->mAgendaBgColor); |
1132 | p = &mPixPainter; | 1132 | p = &mPixPainter; |
1133 | } | 1133 | } |
1134 | else | 1134 | else |
1135 | p = paint ; | 1135 | p = paint ; |
1136 | // qDebug("++++++KOAgenda::drawContentsTo Painter %d %d %d %d ", cx, cy, cw, ch); | 1136 | // qDebug("++++++KOAgenda::drawContentsTo Painter %d %d %d %d ", cx, cy, cw, ch); |
1137 | 1137 | ||
1138 | //--cx;++cw; | 1138 | //--cx;++cw; |
1139 | int lGridSpacingY = mGridSpacingY*2; | 1139 | int lGridSpacingY = mGridSpacingY*2; |
1140 | int selDay; | 1140 | int selDay; |
1141 | if ( !backgroundOnly ) | 1141 | if ( !backgroundOnly ) |
1142 | for ( selDay = 0; selDay < mSelectedDates.count(); ++selDay) | 1142 | for ( selDay = 0; selDay < mSelectedDates.count(); ++selDay) |
1143 | { | 1143 | { |
1144 | if ( mSelectedDates[selDay] == QDateTime::currentDateTime ().date() && KOPrefs::instance()->mHighlightCurrentDay) { | 1144 | if ( mSelectedDates[selDay] == QDateTime::currentDateTime ().date() && KOPrefs::instance()->mHighlightCurrentDay) { |
1145 | int x1 = cx; | 1145 | int x1 = cx; |
1146 | int y1 = 0; | 1146 | int y1 = 0; |
1147 | if (y1 < cy) y1 = cy; | 1147 | if (y1 < cy) y1 = cy; |
1148 | int x2 = cx+cw-1; | 1148 | int x2 = cx+cw-1; |
1149 | int y2 = contentsHeight(); | 1149 | int y2 = contentsHeight(); |
1150 | if (y2 > cy+ch-1) y2=cy+ch-1; | 1150 | if (y2 > cy+ch-1) y2=cy+ch-1; |
1151 | if (x2 >= x1 && y2 >= y1) { | 1151 | if (x2 >= x1 && y2 >= y1) { |
1152 | int gxStart = selDay; | 1152 | int gxStart = selDay; |
1153 | int gxEnd = gxStart ; | 1153 | int gxEnd = gxStart ; |
1154 | int xStart = KOGlobals::self()->reverseLayout() ? | 1154 | int xStart = KOGlobals::self()->reverseLayout() ? |
1155 | (mColumns - 1 - gxStart)*mGridSpacingX : | 1155 | (mColumns - 1 - gxStart)*mGridSpacingX : |
1156 | gxStart*mGridSpacingX; | 1156 | gxStart*mGridSpacingX; |
1157 | if (xStart < x1) xStart = x1; | 1157 | if (xStart < x1) xStart = x1; |
1158 | int xEnd = KOGlobals::self()->reverseLayout() ? | 1158 | int xEnd = KOGlobals::self()->reverseLayout() ? |
1159 | (mColumns - gxStart)*mGridSpacingX-1 : | 1159 | (mColumns - gxStart)*mGridSpacingX-1 : |
1160 | (gxStart+1)*mGridSpacingX-1; | 1160 | (gxStart+1)*mGridSpacingX-1; |
1161 | if (xEnd > x2) xEnd = x2; | 1161 | if (xEnd > x2) xEnd = x2; |
1162 | if ( KOPrefs::instance()->mUseHighlightLightColor ) | 1162 | if ( KOPrefs::instance()->mUseHighlightLightColor ) |
1163 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, | 1163 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, |
1164 | KOPrefs::instance()->mAgendaBgColor.light()); | 1164 | KOPrefs::instance()->mAgendaBgColor.light()); |
1165 | else | 1165 | else |
1166 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, | 1166 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, |
1167 | KOPrefs::instance()->mAgendaBgColor.dark()); | 1167 | KOPrefs::instance()->mAgendaBgColor.dark()); |
1168 | 1168 | ||
1169 | } | 1169 | } |
1170 | } | 1170 | } |
1171 | } | 1171 | } |
1172 | // Highlight working hours | 1172 | // Highlight working hours |
1173 | 1173 | ||
1174 | if ( !backgroundOnly ) | 1174 | if ( !backgroundOnly ) |
1175 | if (mWorkingHoursEnable) { | 1175 | if (mWorkingHoursEnable) { |
1176 | int x1 = cx; | 1176 | int x1 = cx; |
1177 | int y1 = mWorkingHoursYTop; | 1177 | int y1 = mWorkingHoursYTop; |
1178 | if (y1 < cy) y1 = cy; | 1178 | if (y1 < cy) y1 = cy; |
1179 | int x2 = cx+cw-1; | 1179 | int x2 = cx+cw-1; |
1180 | // int x2 = mGridSpacingX * 5 - 1; | 1180 | // int x2 = mGridSpacingX * 5 - 1; |
1181 | // if (x2 > cx+cw-1) x2 = cx + cw - 1; | 1181 | // if (x2 > cx+cw-1) x2 = cx + cw - 1; |
1182 | int y2 = mWorkingHoursYBottom; | 1182 | int y2 = mWorkingHoursYBottom; |
1183 | if (y2 > cy+ch-1) y2=cy+ch-1; | 1183 | if (y2 > cy+ch-1) y2=cy+ch-1; |
1184 | 1184 | ||
1185 | if (x2 >= x1 && y2 >= y1) { | 1185 | if (x2 >= x1 && y2 >= y1) { |
1186 | // qDebug("x1 %d mGridSpacingX %d ", x1, mGridSpacingX ); | 1186 | // qDebug("x1 %d mGridSpacingX %d ", x1, mGridSpacingX ); |
1187 | int gxStart = x1/mGridSpacingX; | 1187 | int gxStart = x1/mGridSpacingX; |
1188 | int gxEnd = x2/mGridSpacingX; | 1188 | int gxEnd = x2/mGridSpacingX; |
1189 | while(gxStart <= gxEnd) { | 1189 | while(gxStart <= gxEnd) { |
1190 | if (gxStart < int(mHolidayMask->count()) && | 1190 | if (gxStart < int(mHolidayMask->count()) && |
1191 | !mHolidayMask->at(gxStart)) { | 1191 | !mHolidayMask->at(gxStart)) { |
1192 | int xStart = KOGlobals::self()->reverseLayout() ? | 1192 | int xStart = KOGlobals::self()->reverseLayout() ? |
1193 | (mColumns - 1 - gxStart)*mGridSpacingX : | 1193 | (mColumns - 1 - gxStart)*mGridSpacingX : |
1194 | gxStart*mGridSpacingX; | 1194 | gxStart*mGridSpacingX; |
1195 | if (xStart < x1) xStart = x1; | 1195 | if (xStart < x1) xStart = x1; |
1196 | int xEnd = KOGlobals::self()->reverseLayout() ? | 1196 | int xEnd = KOGlobals::self()->reverseLayout() ? |
1197 | (mColumns - gxStart)*mGridSpacingX-1 : | 1197 | (mColumns - gxStart)*mGridSpacingX-1 : |
1198 | (gxStart+1)*mGridSpacingX-1; | 1198 | (gxStart+1)*mGridSpacingX-1; |
1199 | if (xEnd > x2) xEnd = x2; | 1199 | if (xEnd > x2) xEnd = x2; |
1200 | if ( mSelectedDates[gxStart] == QDateTime::currentDateTime ().date()&& KOPrefs::instance()->mHighlightCurrentDay ) { | 1200 | if ( mSelectedDates[gxStart] == QDateTime::currentDateTime ().date()&& KOPrefs::instance()->mHighlightCurrentDay ) { |
1201 | if ( KOPrefs::instance()->mUseHighlightLightColor ) | 1201 | if ( KOPrefs::instance()->mUseHighlightLightColor ) |
1202 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, | 1202 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, |
1203 | KOPrefs::instance()->mWorkingHoursColor.light()); | 1203 | KOPrefs::instance()->mWorkingHoursColor.light()); |
1204 | else | 1204 | else |
1205 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, | 1205 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, |
1206 | KOPrefs::instance()->mWorkingHoursColor.dark()); | 1206 | KOPrefs::instance()->mWorkingHoursColor.dark()); |
1207 | } else { | 1207 | } else { |
1208 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, | 1208 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, |
1209 | KOPrefs::instance()->mWorkingHoursColor); | 1209 | KOPrefs::instance()->mWorkingHoursColor); |
1210 | } | 1210 | } |
1211 | } | 1211 | } |
1212 | ++gxStart; | 1212 | ++gxStart; |
1213 | } | 1213 | } |
1214 | } | 1214 | } |
1215 | } | 1215 | } |
1216 | /* | 1216 | /* |
1217 | int selectionX = KOGlobals::self()->reverseLayout() ? | 1217 | int selectionX = KOGlobals::self()->reverseLayout() ? |
1218 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : | 1218 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : |
1219 | mSelectionCellX * mGridSpacingX; | 1219 | mSelectionCellX * mGridSpacingX; |
1220 | 1220 | ||
1221 | // Draw selection | 1221 | // Draw selection |
1222 | if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && | 1222 | if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && |
1223 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { | 1223 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { |
1224 | // TODO: paint only part within cx,cy,cw,ch | 1224 | // TODO: paint only part within cx,cy,cw,ch |
1225 | p->fillRect( selectionX, mSelectionYTop, mGridSpacingX, | 1225 | p->fillRect( selectionX, mSelectionYTop, mGridSpacingX, |
1226 | mSelectionHeight, KOPrefs::instance()->mHighlightColor ); | 1226 | mSelectionHeight, KOPrefs::instance()->mHighlightColor ); |
1227 | } | 1227 | } |
1228 | */ | 1228 | */ |
1229 | // Draw vertical lines of grid | 1229 | // Draw vertical lines of grid |
1230 | 1230 | ||
1231 | int x = ((int)(cx/mGridSpacingX))*mGridSpacingX; | 1231 | int x = ((int)(cx/mGridSpacingX))*mGridSpacingX; |
1232 | if ( mGridSpacingX > 0 ) { | 1232 | if ( mGridSpacingX > 0 ) { |
1233 | while (x < cx + cw) { | 1233 | while (x < cx + cw) { |
1234 | p->drawLine(x,cy,x,cy+ch); | 1234 | p->drawLine(x,cy,x,cy+ch); |
1235 | x+=mGridSpacingX; | 1235 | x+=mGridSpacingX; |
1236 | } | 1236 | } |
1237 | } | 1237 | } |
1238 | // Draw horizontal lines of grid | 1238 | // Draw horizontal lines of grid |
1239 | int y = ((int)(cy/lGridSpacingY))*lGridSpacingY; | 1239 | int y = ((int)(cy/lGridSpacingY))*lGridSpacingY; |
1240 | if ( lGridSpacingY > 0 ) { | 1240 | if ( lGridSpacingY > 0 ) { |
1241 | while (y < cy + ch) { | 1241 | while (y < cy + ch) { |
1242 | p->setPen( SolidLine ); | ||
1243 | p->drawLine(cx,y,cx+cw,y); | ||
1244 | y+=lGridSpacingY; | ||
1245 | p->setPen( DotLine ); | ||
1242 | p->drawLine(cx,y,cx+cw,y); | 1246 | p->drawLine(cx,y,cx+cw,y); |
1243 | y+=lGridSpacingY; | 1247 | y+=lGridSpacingY; |
1244 | } | 1248 | } |
1249 | p->setPen( SolidLine ); | ||
1245 | } | 1250 | } |
1246 | mPixPainter.end() ; | 1251 | mPixPainter.end() ; |
1247 | } | 1252 | } |
1248 | 1253 | ||
1249 | /* | 1254 | /* |
1250 | Convert srcollview contents coordinates to agenda grid coordinates. | 1255 | Convert srcollview contents coordinates to agenda grid coordinates. |
1251 | */ | 1256 | */ |
1252 | void KOAgenda::contentsToGrid (int x, int y, int& gx, int& gy) | 1257 | void KOAgenda::contentsToGrid (int x, int y, int& gx, int& gy) |
1253 | { | 1258 | { |
1254 | gx = KOGlobals::self()->reverseLayout() ? mColumns - 1 - x/mGridSpacingX : | 1259 | gx = KOGlobals::self()->reverseLayout() ? mColumns - 1 - x/mGridSpacingX : |
1255 | x/mGridSpacingX; | 1260 | x/mGridSpacingX; |
1256 | gy = y/mGridSpacingY; | 1261 | gy = y/mGridSpacingY; |
1257 | } | 1262 | } |
1258 | 1263 | ||
1259 | /* | 1264 | /* |
1260 | Convert agenda grid coordinates to scrollview contents coordinates. | 1265 | Convert agenda grid coordinates to scrollview contents coordinates. |
1261 | */ | 1266 | */ |
1262 | void KOAgenda::gridToContents (int gx, int gy, int& x, int& y) | 1267 | void KOAgenda::gridToContents (int gx, int gy, int& x, int& y) |
1263 | { | 1268 | { |
1264 | x = KOGlobals::self()->reverseLayout() ? (mColumns - 1 - gx)*mGridSpacingX: | 1269 | x = KOGlobals::self()->reverseLayout() ? (mColumns - 1 - gx)*mGridSpacingX: |
1265 | gx*mGridSpacingX; | 1270 | gx*mGridSpacingX; |
1266 | y = gy*mGridSpacingY; | 1271 | y = gy*mGridSpacingY; |
1267 | } | 1272 | } |
1268 | 1273 | ||
1269 | 1274 | ||
1270 | /* | 1275 | /* |
1271 | Return Y coordinate corresponding to time. Coordinates are rounded to fit into | 1276 | Return Y coordinate corresponding to time. Coordinates are rounded to fit into |
1272 | the grid. | 1277 | the grid. |
1273 | */ | 1278 | */ |
1274 | int KOAgenda::timeToY(const QTime &time) | 1279 | int KOAgenda::timeToY(const QTime &time) |
1275 | { | 1280 | { |
1276 | int minutesPerCell = 24 * 60 / mRows; | 1281 | int minutesPerCell = 24 * 60 / mRows; |
1277 | int timeMinutes = time.hour() * 60 + time.minute(); | 1282 | int timeMinutes = time.hour() * 60 + time.minute(); |
1278 | int Y = (timeMinutes + (minutesPerCell / 2)) / minutesPerCell; | 1283 | int Y = (timeMinutes + (minutesPerCell / 2)) / minutesPerCell; |
1279 | return Y; | 1284 | return Y; |
1280 | } | 1285 | } |
1281 | 1286 | ||
1282 | 1287 | ||
1283 | /* | 1288 | /* |
1284 | Return time corresponding to cell y coordinate. Coordinates are rounded to | 1289 | Return time corresponding to cell y coordinate. Coordinates are rounded to |
1285 | fit into the grid. | 1290 | fit into the grid. |
1286 | */ | 1291 | */ |
1287 | QTime KOAgenda::gyToTime(int gy) | 1292 | QTime KOAgenda::gyToTime(int gy) |
1288 | { | 1293 | { |
1289 | 1294 | ||
1290 | int secondsPerCell = 24 * 60 * 60/ mRows; | 1295 | int secondsPerCell = 24 * 60 * 60/ mRows; |
1291 | 1296 | ||
1292 | int timeSeconds = secondsPerCell * gy; | 1297 | int timeSeconds = secondsPerCell * gy; |
1293 | 1298 | ||
1294 | QTime time( 0, 0, 0 ); | 1299 | QTime time( 0, 0, 0 ); |
1295 | if ( timeSeconds < 24 * 60 * 60 ) { | 1300 | if ( timeSeconds < 24 * 60 * 60 ) { |
1296 | time = time.addSecs(timeSeconds); | 1301 | time = time.addSecs(timeSeconds); |
1297 | } else { | 1302 | } else { |
1298 | time.setHMS( 23, 59, 59 ); | 1303 | time.setHMS( 23, 59, 59 ); |
1299 | } | 1304 | } |
1300 | 1305 | ||
1301 | return time; | 1306 | return time; |
1302 | } | 1307 | } |
1303 | 1308 | ||
1304 | void KOAgenda::setStartHour(int startHour) | 1309 | void KOAgenda::setStartHour(int startHour) |
1305 | { | 1310 | { |
1306 | int startCell = startHour * mRows / 24; | 1311 | int startCell = startHour * mRows / 24; |
1307 | setContentsPos(0,startCell * gridSpacingY()); | 1312 | setContentsPos(0,startCell * gridSpacingY()); |
1308 | } | 1313 | } |
1309 | void KOAgenda::hideUnused() | 1314 | void KOAgenda::hideUnused() |
1310 | { | 1315 | { |
1311 | // experimental only | 1316 | // experimental only |
1312 | // return; | 1317 | // return; |
1313 | KOAgendaItem *item; | 1318 | KOAgendaItem *item; |
1314 | for ( item=mUnusedItems.first(); item != 0; item=mUnusedItems.next() ) { | 1319 | for ( item=mUnusedItems.first(); item != 0; item=mUnusedItems.next() ) { |
1315 | item->hide(); | 1320 | item->hide(); |
1316 | } | 1321 | } |
1317 | } | 1322 | } |
1318 | 1323 | ||
1319 | 1324 | ||
1320 | KOAgendaItem *KOAgenda::getNewItem(Incidence * event,QDate qd, QWidget* view) | 1325 | KOAgendaItem *KOAgenda::getNewItem(Incidence * event,QDate qd, QWidget* view) |
1321 | { | 1326 | { |
1322 | 1327 | ||
1323 | KOAgendaItem *fi; | 1328 | KOAgendaItem *fi; |
1324 | for ( fi=mUnusedItems.first(); fi != 0; fi=mUnusedItems.next() ) { | 1329 | for ( fi=mUnusedItems.first(); fi != 0; fi=mUnusedItems.next() ) { |
1325 | if ( fi->incidence() == event ) { | 1330 | if ( fi->incidence() == event ) { |
1326 | mUnusedItems.remove(); | 1331 | mUnusedItems.remove(); |
1327 | fi->init( event, qd ); | 1332 | fi->init( event, qd ); |
1328 | return fi; | 1333 | return fi; |
1329 | } | 1334 | } |
1330 | } | 1335 | } |
1331 | fi=mUnusedItems.first(); | 1336 | fi=mUnusedItems.first(); |
1332 | if ( fi ) { | 1337 | if ( fi ) { |
1333 | mUnusedItems.remove(); | 1338 | mUnusedItems.remove(); |
1334 | fi->init( event, qd ); | 1339 | fi->init( event, qd ); |
1335 | return fi; | 1340 | return fi; |
1336 | } | 1341 | } |
1337 | // qDebug("new KOAgendaItem "); | 1342 | // qDebug("new KOAgendaItem "); |
1338 | 1343 | ||
1339 | KOAgendaItem* agendaItem = new KOAgendaItem( event, qd, view, mAllDayMode ); | 1344 | KOAgendaItem* agendaItem = new KOAgendaItem( event, qd, view, mAllDayMode ); |
1340 | agendaItem->installEventFilter(this); | 1345 | agendaItem->installEventFilter(this); |
1341 | addChild(agendaItem,0,0); | 1346 | addChild(agendaItem,0,0); |
1342 | return agendaItem; | 1347 | return agendaItem; |
1343 | } | 1348 | } |
1344 | KOAgendaItem * KOAgenda::getItemForTodo ( Todo * todo ) | 1349 | KOAgendaItem * KOAgenda::getItemForTodo ( Todo * todo ) |
1345 | { | 1350 | { |
1346 | KOAgendaItem *item; | 1351 | KOAgendaItem *item; |
1347 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 1352 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
1348 | if ( item->incidence() == todo ) { | 1353 | if ( item->incidence() == todo ) { |
1349 | mItems.remove(); | 1354 | mItems.remove(); |
1350 | return item; | 1355 | return item; |
1351 | } | 1356 | } |
1352 | } | 1357 | } |
1353 | return 0; | 1358 | return 0; |
1354 | } | 1359 | } |
1355 | 1360 | ||
1356 | 1361 | ||
1357 | void KOAgenda::updateTodo( Todo * todo, int days, bool remove) | 1362 | void KOAgenda::updateTodo( Todo * todo, int days, bool remove) |
1358 | { | 1363 | { |
1359 | 1364 | ||
1360 | KOAgendaItem *item; | 1365 | KOAgendaItem *item; |
1361 | item = getItemForTodo ( todo ); | 1366 | item = getItemForTodo ( todo ); |
1362 | //qDebug("KOAgenda::updateTodo %d %d %d %d", this, todo, days, remove); | 1367 | //qDebug("KOAgenda::updateTodo %d %d %d %d", this, todo, days, remove); |
1363 | if ( item ) { | 1368 | if ( item ) { |
1364 | blockSignals( true ); | 1369 | blockSignals( true ); |
1365 | //qDebug("item found "); | 1370 | //qDebug("item found "); |
1366 | item->hide(); | 1371 | item->hide(); |
1367 | item->setCellX(-2, -1 ); | 1372 | item->setCellX(-2, -1 ); |
1368 | item->select(false); | 1373 | item->select(false); |
1369 | mUnusedItems.append( item ); | 1374 | mUnusedItems.append( item ); |
1370 | mItems.remove( item ); | 1375 | mItems.remove( item ); |
1371 | QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems(); | 1376 | QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems(); |
1372 | KOAgendaItem *itemit; | 1377 | KOAgendaItem *itemit; |
1373 | //globalFlagBlockAgendaItemPaint = 1; | 1378 | //globalFlagBlockAgendaItemPaint = 1; |
1374 | for ( itemit=oldconflictItems.first(); itemit != 0; | 1379 | for ( itemit=oldconflictItems.first(); itemit != 0; |
1375 | itemit=oldconflictItems.next() ) { | 1380 | itemit=oldconflictItems.next() ) { |
1376 | if ( itemit != item ) | 1381 | if ( itemit != item ) |
1377 | placeSubCells(itemit); | 1382 | placeSubCells(itemit); |
1378 | } | 1383 | } |
1379 | qApp->processEvents(); | 1384 | qApp->processEvents(); |
1380 | //globalFlagBlockAgendaItemPaint = 0; | 1385 | //globalFlagBlockAgendaItemPaint = 0; |
1381 | for ( itemit=oldconflictItems.first(); itemit != 0; | 1386 | for ( itemit=oldconflictItems.first(); itemit != 0; |
1382 | itemit=oldconflictItems.next() ) { | 1387 | itemit=oldconflictItems.next() ) { |
1383 | globalFlagBlockAgendaItemUpdate = 0; | 1388 | globalFlagBlockAgendaItemUpdate = 0; |
1384 | if ( itemit != item ) | 1389 | if ( itemit != item ) |
1385 | itemit->repaintMe(); | 1390 | itemit->repaintMe(); |
1386 | globalFlagBlockAgendaItemUpdate = 1; | 1391 | globalFlagBlockAgendaItemUpdate = 1; |
1387 | itemit->repaint(); | 1392 | itemit->repaint(); |
1388 | } | 1393 | } |
1389 | blockSignals( false ); | 1394 | blockSignals( false ); |
1390 | } | 1395 | } |
1391 | if ( remove ) { | 1396 | if ( remove ) { |
1392 | //qDebug("remove****************************************** "); | 1397 | //qDebug("remove****************************************** "); |
1393 | return; | 1398 | return; |
1394 | } | 1399 | } |
1395 | //qDebug("updateTodo+++++++++++++++++++++++++++++++++++++ "); | 1400 | //qDebug("updateTodo+++++++++++++++++++++++++++++++++++++ "); |
1396 | bool overdue = (!todo->isCompleted()) && (todo->dtDue() < QDate::currentDate())&& ( KOPrefs::instance()->mShowTodoInAgenda ); | 1401 | bool overdue = (!todo->isCompleted()) && (todo->dtDue() < QDate::currentDate())&& ( KOPrefs::instance()->mShowTodoInAgenda ); |
1397 | QDate currentDate; | 1402 | QDate currentDate; |
1398 | if ( overdue ) { | 1403 | if ( overdue ) { |
1399 | currentDate = QDate::currentDate(); | 1404 | currentDate = QDate::currentDate(); |
1400 | days += todo->dtDue().date().daysTo( currentDate ); | 1405 | days += todo->dtDue().date().daysTo( currentDate ); |
1401 | } | 1406 | } |
1402 | else | 1407 | else |
1403 | currentDate = todo->dtDue().date(); | 1408 | currentDate = todo->dtDue().date(); |
1404 | 1409 | ||
1405 | if ( todo->doesFloat() || overdue ) { | 1410 | if ( todo->doesFloat() || overdue ) { |
1406 | if ( ! mAllDayMode ) return; | 1411 | if ( ! mAllDayMode ) return; |
1407 | // aldayagenda | 1412 | // aldayagenda |
1408 | globalFlagBlockAgendaItemPaint = 1; | 1413 | globalFlagBlockAgendaItemPaint = 1; |
1409 | item = insertAllDayItem(todo, currentDate,days, days); | 1414 | item = insertAllDayItem(todo, currentDate,days, days); |
1410 | item->show(); | 1415 | item->show(); |
1411 | 1416 | ||
1412 | } | 1417 | } |
1413 | else { | 1418 | else { |
1414 | if ( mAllDayMode ) return; | 1419 | if ( mAllDayMode ) return; |
1415 | // mAgenda | 1420 | // mAgenda |
1416 | globalFlagBlockAgendaItemPaint = 1; | 1421 | globalFlagBlockAgendaItemPaint = 1; |
1417 | int endY = timeToY(todo->dtDue().time()) - 1; | 1422 | int endY = timeToY(todo->dtDue().time()) - 1; |
1418 | int hi = 12/KOPrefs::instance()->mHourSize; | 1423 | int hi = 12/KOPrefs::instance()->mHourSize; |
1419 | int startY = endY - 1-hi; | 1424 | int startY = endY - 1-hi; |
1420 | item = insertItem(todo,currentDate,days,startY,endY); | 1425 | item = insertItem(todo,currentDate,days,startY,endY); |
1421 | item->show(); | 1426 | item->show(); |
1422 | } | 1427 | } |
1423 | qApp->processEvents(); | 1428 | qApp->processEvents(); |
1424 | globalFlagBlockAgendaItemPaint = 0; | 1429 | globalFlagBlockAgendaItemPaint = 0; |
1425 | QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems(); | 1430 | QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems(); |
1426 | KOAgendaItem *itemit; | 1431 | KOAgendaItem *itemit; |
1427 | for ( itemit=oldconflictItems.first(); itemit != 0; | 1432 | for ( itemit=oldconflictItems.first(); itemit != 0; |
1428 | itemit=oldconflictItems.next() ) { | 1433 | itemit=oldconflictItems.next() ) { |
1429 | globalFlagBlockAgendaItemUpdate = 0; | 1434 | globalFlagBlockAgendaItemUpdate = 0; |
1430 | itemit->repaintMe(); | 1435 | itemit->repaintMe(); |
1431 | globalFlagBlockAgendaItemUpdate = 1; | 1436 | globalFlagBlockAgendaItemUpdate = 1; |
1432 | itemit->repaint(); | 1437 | itemit->repaint(); |
1433 | } | 1438 | } |
1434 | globalFlagBlockAgendaItemUpdate = 0; | 1439 | globalFlagBlockAgendaItemUpdate = 0; |
1435 | item->repaintMe(); | 1440 | item->repaintMe(); |
1436 | globalFlagBlockAgendaItemUpdate = 1; | 1441 | globalFlagBlockAgendaItemUpdate = 1; |
1437 | item->repaint(); | 1442 | item->repaint(); |
1438 | } | 1443 | } |
1439 | /* | 1444 | /* |
1440 | Insert KOAgendaItem into agenda. | 1445 | Insert KOAgendaItem into agenda. |
1441 | */ | 1446 | */ |
1442 | KOAgendaItem *KOAgenda::insertItem (Incidence *event,QDate qd,int X,int YTop,int YBottom) | 1447 | KOAgendaItem *KOAgenda::insertItem (Incidence *event,QDate qd,int X,int YTop,int YBottom) |
1443 | { | 1448 | { |
1444 | //kdDebug() << "KOAgenda::insertItem:" << event->summary() << "-" << qd.toString() << " ;top, bottom:" << YTop << "," << YBottom << endl; | 1449 | //kdDebug() << "KOAgenda::insertItem:" << event->summary() << "-" << qd.toString() << " ;top, bottom:" << YTop << "," << YBottom << endl; |
1445 | 1450 | ||
1446 | if (mAllDayMode) { | 1451 | if (mAllDayMode) { |
1447 | kdDebug() << "KOAgenda: calling insertItem in all-day mode is illegal." << endl; | 1452 | kdDebug() << "KOAgenda: calling insertItem in all-day mode is illegal." << endl; |
1448 | return 0; | 1453 | return 0; |
1449 | } | 1454 | } |
1450 | 1455 | ||
1451 | KOAgendaItem *agendaItem = getNewItem(event,qd,viewport()); | 1456 | KOAgendaItem *agendaItem = getNewItem(event,qd,viewport()); |
1452 | //agendaItem->setFrameStyle(WinPanel|Raised); | 1457 | //agendaItem->setFrameStyle(WinPanel|Raised); |
1453 | 1458 | ||
1454 | int YSize = YBottom - YTop + 1; | 1459 | int YSize = YBottom - YTop + 1; |
1455 | if (YSize < 0) { | 1460 | if (YSize < 0) { |
1456 | kdDebug() << "KOAgenda::insertItem(): Text: " << agendaItem->text() << " YSize<0" << endl; | 1461 | kdDebug() << "KOAgenda::insertItem(): Text: " << agendaItem->text() << " YSize<0" << endl; |
1457 | YSize = 1; | 1462 | YSize = 1; |
1458 | } | 1463 | } |
1459 | int iheight = mGridSpacingY * YSize; | 1464 | int iheight = mGridSpacingY * YSize; |
1460 | 1465 | ||
1461 | agendaItem->resize(mGridSpacingX,iheight ); | 1466 | agendaItem->resize(mGridSpacingX,iheight ); |
1462 | agendaItem->setCellXY(X,YTop,YBottom); | 1467 | agendaItem->setCellXY(X,YTop,YBottom); |
1463 | agendaItem->setCellXWidth(X); | 1468 | agendaItem->setCellXWidth(X); |
1464 | 1469 | ||
1465 | //addChild(agendaItem,X*mGridSpacingX,YTop*mGridSpacingY); | 1470 | //addChild(agendaItem,X*mGridSpacingX,YTop*mGridSpacingY); |
1466 | mItems.append(agendaItem); | 1471 | mItems.append(agendaItem); |
1467 | 1472 | ||
1468 | placeSubCells(agendaItem); | 1473 | placeSubCells(agendaItem); |
1469 | 1474 | ||
1470 | //agendaItem->show(); | 1475 | //agendaItem->show(); |
1471 | 1476 | ||
1472 | marcus_bains(); | 1477 | marcus_bains(); |
1473 | 1478 | ||
1474 | return agendaItem; | 1479 | return agendaItem; |
1475 | } | 1480 | } |
1476 | 1481 | ||
1477 | 1482 | ||
1478 | /* | 1483 | /* |
1479 | Insert all-day KOAgendaItem into agenda. | 1484 | Insert all-day KOAgendaItem into agenda. |
1480 | */ | 1485 | */ |
1481 | KOAgendaItem *KOAgenda::insertAllDayItem (Incidence *event,QDate qd,int XBegin,int XEnd) | 1486 | KOAgendaItem *KOAgenda::insertAllDayItem (Incidence *event,QDate qd,int XBegin,int XEnd) |
1482 | { | 1487 | { |
1483 | if (!mAllDayMode) { | 1488 | if (!mAllDayMode) { |
1484 | return 0; | 1489 | return 0; |
1485 | } | 1490 | } |
1486 | 1491 | ||
1487 | KOAgendaItem *agendaItem = getNewItem(event,qd,viewport()); | 1492 | KOAgendaItem *agendaItem = getNewItem(event,qd,viewport()); |
1488 | 1493 | ||
1489 | agendaItem->setCellXY(XBegin,0,0); | 1494 | agendaItem->setCellXY(XBegin,0,0); |
1490 | agendaItem->setCellXWidth(XEnd); | 1495 | agendaItem->setCellXWidth(XEnd); |
1491 | agendaItem->resize(mGridSpacingX * agendaItem->cellWidth(),mGridSpacingY); | 1496 | agendaItem->resize(mGridSpacingX * agendaItem->cellWidth(),mGridSpacingY); |
1492 | 1497 | ||
1493 | //addChild(agendaItem,XBegin*mGridSpacingX,0); | 1498 | //addChild(agendaItem,XBegin*mGridSpacingX,0); |
1494 | mItems.append(agendaItem); | 1499 | mItems.append(agendaItem); |
1495 | 1500 | ||
1496 | placeSubCells(agendaItem); | 1501 | placeSubCells(agendaItem); |
1497 | 1502 | ||
1498 | //agendaItem->show(); | 1503 | //agendaItem->show(); |
1499 | 1504 | ||
1500 | return agendaItem; | 1505 | return agendaItem; |
1501 | } | 1506 | } |
1502 | 1507 | ||
1503 | 1508 | ||
1504 | void KOAgenda::insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd, | 1509 | void KOAgenda::insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd, |
1505 | int YTop,int YBottom) | 1510 | int YTop,int YBottom) |
1506 | { | 1511 | { |
1507 | if (mAllDayMode) { | 1512 | if (mAllDayMode) { |
1508 | ; | 1513 | ; |
1509 | return; | 1514 | return; |
1510 | } | 1515 | } |
1511 | 1516 | ||
1512 | int cellX,cellYTop,cellYBottom; | 1517 | int cellX,cellYTop,cellYBottom; |
1513 | QString newtext; | 1518 | QString newtext; |
1514 | int width = XEnd - XBegin + 1; | 1519 | int width = XEnd - XBegin + 1; |
1515 | int count = 0; | 1520 | int count = 0; |
1516 | KOAgendaItem *current = 0; | 1521 | KOAgendaItem *current = 0; |
1517 | QPtrList<KOAgendaItem> multiItems; | 1522 | QPtrList<KOAgendaItem> multiItems; |
1518 | for (cellX = XBegin;cellX <= XEnd;++cellX) { | 1523 | for (cellX = XBegin;cellX <= XEnd;++cellX) { |
1519 | if (cellX == XBegin) cellYTop = YTop; | 1524 | if (cellX == XBegin) cellYTop = YTop; |
1520 | else cellYTop = 0; | 1525 | else cellYTop = 0; |
1521 | if (cellX == XEnd) cellYBottom = YBottom; | 1526 | if (cellX == XEnd) cellYBottom = YBottom; |
1522 | else cellYBottom = rows() - 1; | 1527 | else cellYBottom = rows() - 1; |
1523 | newtext = QString("(%1/%2): ").arg(++count).arg(width); | 1528 | newtext = QString("(%1/%2): ").arg(++count).arg(width); |
1524 | newtext.append(event->summary()); | 1529 | newtext.append(event->summary()); |
1525 | current = insertItem(event,qd,cellX,cellYTop,cellYBottom); | 1530 | current = insertItem(event,qd,cellX,cellYTop,cellYBottom); |
1526 | current->setText(newtext); | 1531 | current->setText(newtext); |
1527 | multiItems.append(current); | 1532 | multiItems.append(current); |
1528 | } | 1533 | } |
1529 | 1534 | ||
1530 | KOAgendaItem *next = 0; | 1535 | KOAgendaItem *next = 0; |
1531 | KOAgendaItem *last = multiItems.last(); | 1536 | KOAgendaItem *last = multiItems.last(); |
1532 | KOAgendaItem *first = multiItems.first(); | 1537 | KOAgendaItem *first = multiItems.first(); |
1533 | KOAgendaItem *setFirst,*setLast; | 1538 | KOAgendaItem *setFirst,*setLast; |
1534 | current = first; | 1539 | current = first; |
1535 | while (current) { | 1540 | while (current) { |
1536 | next = multiItems.next(); | 1541 | next = multiItems.next(); |
1537 | if (current == first) setFirst = 0; | 1542 | if (current == first) setFirst = 0; |
1538 | else setFirst = first; | 1543 | else setFirst = first; |
1539 | if (current == last) setLast = 0; | 1544 | if (current == last) setLast = 0; |
1540 | else setLast = last; | 1545 | else setLast = last; |
1541 | 1546 | ||
1542 | current->setMultiItem(setFirst,next,setLast); | 1547 | current->setMultiItem(setFirst,next,setLast); |
1543 | current = next; | 1548 | current = next; |
1544 | } | 1549 | } |
1545 | 1550 | ||
1546 | marcus_bains(); | 1551 | marcus_bains(); |
1547 | } | 1552 | } |
1548 | 1553 | ||
1549 | 1554 | ||
1550 | //QSizePolicy KOAgenda::sizePolicy() const | 1555 | //QSizePolicy KOAgenda::sizePolicy() const |
1551 | //{ | 1556 | //{ |
1552 | // Thought this would make the all-day event agenda minimum size and the | 1557 | // Thought this would make the all-day event agenda minimum size and the |
1553 | // normal agenda take the remaining space. But it doesn´t work. The QSplitter | 1558 | // normal agenda take the remaining space. But it doesn´t work. The QSplitter |
1554 | // don´t seem to think that an Expanding widget needs more space than a | 1559 | // don´t seem to think that an Expanding widget needs more space than a |
1555 | // Preferred one. | 1560 | // Preferred one. |
1556 | // But it doesn´t hurt, so it stays. | 1561 | // But it doesn´t hurt, so it stays. |
1557 | // if (mAllDayMode) { | 1562 | // if (mAllDayMode) { |
1558 | // return QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred); | 1563 | // return QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred); |
1559 | // } else { | 1564 | // } else { |
1560 | // return QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); | 1565 | // return QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); |
1561 | // } | 1566 | // } |
1562 | //} | 1567 | //} |
1563 | void KOAgenda::finishResize ( ) | 1568 | void KOAgenda::finishResize ( ) |
1564 | { | 1569 | { |
1565 | //qDebug("finishResize+++++++++++++++++++++++++++++++ ( ) "); | 1570 | //qDebug("finishResize+++++++++++++++++++++++++++++++ ( ) "); |
1566 | if ( globalFlagBlockAgenda == 0 ) { | 1571 | if ( globalFlagBlockAgenda == 0 ) { |
1567 | finishUpdate(); | 1572 | finishUpdate(); |
1568 | //qDebug("finishUpdate() called "); | 1573 | //qDebug("finishUpdate() called "); |
1569 | } | 1574 | } |
1570 | } | 1575 | } |
1571 | /* | 1576 | /* |
1572 | Overridden from QScrollView to provide proper resizing of KOAgendaItems. | 1577 | Overridden from QScrollView to provide proper resizing of KOAgendaItems. |
1573 | */ | 1578 | */ |
1574 | void KOAgenda::resizeEvent ( QResizeEvent *ev ) | 1579 | void KOAgenda::resizeEvent ( QResizeEvent *ev ) |
1575 | { | 1580 | { |
1576 | 1581 | ||
1577 | mResizeTimer.start( 150 , true ); | 1582 | mResizeTimer.start( 150 , true ); |
1578 | computeSizes(); | 1583 | computeSizes(); |
1579 | return; | 1584 | return; |
1580 | 1585 | ||
1581 | } | 1586 | } |
1582 | void KOAgenda::computeSizes() | 1587 | void KOAgenda::computeSizes() |
1583 | { | 1588 | { |
1584 | if ( globalFlagBlockStartup ) | 1589 | if ( globalFlagBlockStartup ) |
1585 | return; | 1590 | return; |
1586 | 1591 | ||
1587 | if (mAllDayMode) { | 1592 | if (mAllDayMode) { |
1588 | mGridSpacingX = (width()-3) / mColumns; | 1593 | mGridSpacingX = (width()-3) / mColumns; |
1589 | mGridSpacingY = height() - 2 * frameWidth() - 1; | 1594 | mGridSpacingY = height() - 2 * frameWidth() - 1; |
1590 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY + 1); | 1595 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY + 1); |
1591 | // mGridSpacingY = height(); | 1596 | // mGridSpacingY = height(); |
1592 | // resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); | 1597 | // resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); |
1593 | 1598 | ||
1594 | KOAgendaItem *item; | 1599 | KOAgendaItem *item; |
1595 | int subCellWidth; | 1600 | int subCellWidth; |
1596 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 1601 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
1597 | subCellWidth = mGridSpacingY / item->subCells(); | 1602 | subCellWidth = mGridSpacingY / item->subCells(); |
1598 | item->resize(mGridSpacingX * item->cellWidth(),subCellWidth); | 1603 | item->resize(mGridSpacingX * item->cellWidth(),subCellWidth); |
1599 | moveChild(item,KOGlobals::self()->reverseLayout() ? | 1604 | moveChild(item,KOGlobals::self()->reverseLayout() ? |
1600 | (mColumns - 1 - item->cellX()) * mGridSpacingX : | 1605 | (mColumns - 1 - item->cellX()) * mGridSpacingX : |
1601 | item->cellX() * mGridSpacingX, | 1606 | item->cellX() * mGridSpacingX, |
1602 | item->subCell() * subCellWidth); | 1607 | item->subCell() * subCellWidth); |
1603 | } | 1608 | } |
1604 | KOPrefs::instance()->mAllDaySize = mGridSpacingY; | 1609 | KOPrefs::instance()->mAllDaySize = mGridSpacingY; |
1605 | } else { | 1610 | } else { |
1606 | mGridSpacingX = (width() - verticalScrollBar()->width()-3)/mColumns; | 1611 | mGridSpacingX = (width() - verticalScrollBar()->width()-3)/mColumns; |
1607 | if (height() > mGridSpacingY * mRows + 1 ) { | 1612 | if (height() > mGridSpacingY * mRows + 1 ) { |
1608 | KOPrefs::instance()->mHourSize = ((height())/mRows)+1; | 1613 | KOPrefs::instance()->mHourSize = ((height())/mRows)+1; |
1609 | mGridSpacingY = KOPrefs::instance()->mHourSize ; | 1614 | mGridSpacingY = KOPrefs::instance()->mHourSize ; |
1610 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); | 1615 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); |
1611 | emit resizedSignal(); | 1616 | emit resizedSignal(); |
1612 | } else | 1617 | } else |
1613 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); | 1618 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); |
1614 | KOAgendaItem *item; | 1619 | KOAgendaItem *item; |
1615 | int subCellWidth; | 1620 | int subCellWidth; |
1616 | 1621 | ||
1617 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 1622 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
1618 | subCellWidth = mGridSpacingX / item->subCells(); | 1623 | subCellWidth = mGridSpacingX / item->subCells(); |
1619 | item->resize(subCellWidth,item->height()); | 1624 | item->resize(subCellWidth,item->height()); |
1620 | moveChild(item,(KOGlobals::self()->reverseLayout() ? | 1625 | moveChild(item,(KOGlobals::self()->reverseLayout() ? |
1621 | (mColumns - 1 - item->cellX()) * mGridSpacingX : | 1626 | (mColumns - 1 - item->cellX()) * mGridSpacingX : |
1622 | item->cellX() * mGridSpacingX) + | 1627 | item->cellX() * mGridSpacingX) + |
1623 | item->subCell() * subCellWidth,childY(item)); | 1628 | item->subCell() * subCellWidth,childY(item)); |
1624 | } | 1629 | } |
1625 | } | 1630 | } |
1626 | int cw = contentsWidth(); | 1631 | int cw = contentsWidth(); |
1627 | int ch = contentsHeight(); | 1632 | int ch = contentsHeight(); |
1628 | if ( mAllDayMode ) { | 1633 | if ( mAllDayMode ) { |
1629 | QPixmap* paintPixAll = KOAgendaItem::paintPixAllday(); | 1634 | QPixmap* paintPixAll = KOAgendaItem::paintPixAllday(); |
1630 | if ( paintPixAll->width() < cw || paintPixAll->height() < ch ) | 1635 | if ( paintPixAll->width() < cw || paintPixAll->height() < ch ) |
1631 | paintPixAll->resize( cw, ch ); | 1636 | paintPixAll->resize( cw, ch ); |
1632 | } else { | 1637 | } else { |
1633 | QPixmap* paintPix = KOAgendaItem::paintPix(); | 1638 | QPixmap* paintPix = KOAgendaItem::paintPix(); |
1634 | if ( paintPix->width() < cw || paintPix->height() < ch ) | 1639 | if ( paintPix->width() < cw || paintPix->height() < ch ) |
1635 | KOAgendaItem::resizePixmap( cw , ch ); | 1640 | KOAgendaItem::resizePixmap( cw , ch ); |
1636 | } | 1641 | } |
1637 | 1642 | ||
1638 | checkScrollBoundaries(); | 1643 | checkScrollBoundaries(); |
1639 | marcus_bains(); | 1644 | marcus_bains(); |
1640 | drawContentsToPainter(); | 1645 | drawContentsToPainter(); |
1641 | viewport()->repaint(false); | 1646 | viewport()->repaint(false); |
1642 | } | 1647 | } |
1643 | 1648 | ||
1644 | void KOAgenda::scrollUp() | 1649 | void KOAgenda::scrollUp() |
1645 | { | 1650 | { |
1646 | scrollBy(0,-mScrollOffset); | 1651 | scrollBy(0,-mScrollOffset); |
1647 | } | 1652 | } |
1648 | 1653 | ||
1649 | 1654 | ||
1650 | void KOAgenda::scrollDown() | 1655 | void KOAgenda::scrollDown() |
1651 | { | 1656 | { |
1652 | scrollBy(0,mScrollOffset); | 1657 | scrollBy(0,mScrollOffset); |
1653 | } | 1658 | } |
1654 | 1659 | ||
1655 | void KOAgenda::popupAlarm() | 1660 | void KOAgenda::popupAlarm() |
1656 | { | 1661 | { |
1657 | if (!mClickedItem) { | 1662 | if (!mClickedItem) { |
1658 | kdDebug() << "KOAgenda::popupAlarm() called without having a clicked item" << endl; | 1663 | kdDebug() << "KOAgenda::popupAlarm() called without having a clicked item" << endl; |
1659 | return; | 1664 | return; |
1660 | } | 1665 | } |
1661 | // TODO: deal correctly with multiple alarms | 1666 | // TODO: deal correctly with multiple alarms |
1662 | Alarm* alarm; | 1667 | Alarm* alarm; |
1663 | QPtrList<Alarm> list(mClickedItem->incidence()->alarms()); | 1668 | QPtrList<Alarm> list(mClickedItem->incidence()->alarms()); |
1664 | for(alarm=list.first();alarm;alarm=list.next()) { | 1669 | for(alarm=list.first();alarm;alarm=list.next()) { |
1665 | alarm->toggleAlarm(); | 1670 | alarm->toggleAlarm(); |
1666 | } | 1671 | } |
1667 | emit itemModified( mClickedItem , KOGlobals::EVENTEDITED ); | 1672 | emit itemModified( mClickedItem , KOGlobals::EVENTEDITED ); |
1668 | mClickedItem->paintMe( true ); | 1673 | mClickedItem->paintMe( true ); |
1669 | mClickedItem->repaint( false ); | 1674 | mClickedItem->repaint( false ); |
1670 | } | 1675 | } |
1671 | 1676 | ||
1672 | /* | 1677 | /* |
1673 | Calculates the minimum width | 1678 | Calculates the minimum width |
1674 | */ | 1679 | */ |
1675 | int KOAgenda::minimumWidth() const | 1680 | int KOAgenda::minimumWidth() const |
1676 | { | 1681 | { |
1677 | // TODO:: develop a way to dynamically determine the minimum width | 1682 | // TODO:: develop a way to dynamically determine the minimum width |
1678 | int min = 100; | 1683 | int min = 100; |
1679 | 1684 | ||
1680 | return min; | 1685 | return min; |
1681 | } | 1686 | } |
1682 | 1687 | ||
1683 | void KOAgenda::updateConfig() | 1688 | void KOAgenda::updateConfig() |
1684 | { | 1689 | { |
1685 | if ( viewport()->backgroundColor() != KOPrefs::instance()->mAgendaBgColor) | 1690 | if ( viewport()->backgroundColor() != KOPrefs::instance()->mAgendaBgColor) |
1686 | viewport()->setBackgroundColor(KOPrefs::instance()->mAgendaBgColor); | 1691 | viewport()->setBackgroundColor(KOPrefs::instance()->mAgendaBgColor); |
1687 | if ( mAllDayMode ) { | 1692 | if ( mAllDayMode ) { |
1688 | mGridSpacingY = height() - 1 ;// KOPrefs::instance()->mAllDaySize; | 1693 | mGridSpacingY = height() - 1 ;// KOPrefs::instance()->mAllDaySize; |
1689 | //mGridSpacingY = KOPrefs::instance()->mAllDaySize; | 1694 | //mGridSpacingY = KOPrefs::instance()->mAllDaySize; |
1690 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY+1 ); | 1695 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY+1 ); |
1691 | // setMaximumHeight( mGridSpacingY+1 ); | 1696 | // setMaximumHeight( mGridSpacingY+1 ); |
1692 | viewport()->repaint( false ); | 1697 | viewport()->repaint( false ); |
1693 | //setFixedHeight( mGridSpacingY+1 ); | 1698 | //setFixedHeight( mGridSpacingY+1 ); |
1694 | //qDebug("KOPrefs:aaaaa:instance()->mAllDaySize %d ", KOPrefs::instance()->mAllDaySize); | 1699 | //qDebug("KOPrefs:aaaaa:instance()->mAllDaySize %d ", KOPrefs::instance()->mAllDaySize); |
1695 | } | 1700 | } |
1696 | else { | 1701 | else { |
1697 | mGridSpacingY = KOPrefs::instance()->mHourSize; | 1702 | mGridSpacingY = KOPrefs::instance()->mHourSize; |
1698 | calculateWorkingHours(); | 1703 | calculateWorkingHours(); |
1699 | marcus_bains(); | 1704 | marcus_bains(); |
1700 | } | 1705 | } |
1701 | } | 1706 | } |
1702 | 1707 | ||
1703 | void KOAgenda::checkScrollBoundaries() | 1708 | void KOAgenda::checkScrollBoundaries() |
1704 | { | 1709 | { |
1705 | // Invalidate old values to force update | 1710 | // Invalidate old values to force update |
1706 | mOldLowerScrollValue = -1; | 1711 | mOldLowerScrollValue = -1; |
1707 | mOldUpperScrollValue = -1; | 1712 | mOldUpperScrollValue = -1; |
1708 | 1713 | ||
1709 | checkScrollBoundaries(verticalScrollBar()->value()); | 1714 | checkScrollBoundaries(verticalScrollBar()->value()); |
1710 | } | 1715 | } |
1711 | 1716 | ||
1712 | void KOAgenda::checkScrollBoundaries(int v) | 1717 | void KOAgenda::checkScrollBoundaries(int v) |
1713 | { | 1718 | { |
1714 | if ( mGridSpacingY == 0 ) | 1719 | if ( mGridSpacingY == 0 ) |
1715 | return; | 1720 | return; |
1716 | int yMin = v/mGridSpacingY; | 1721 | int yMin = v/mGridSpacingY; |
1717 | int yMax = (v+visibleHeight())/mGridSpacingY; | 1722 | int yMax = (v+visibleHeight())/mGridSpacingY; |
1718 | 1723 | ||
1719 | // kdDebug() << "--- yMin: " << yMin << " yMax: " << yMax << endl; | 1724 | // kdDebug() << "--- yMin: " << yMin << " yMax: " << yMax << endl; |
1720 | 1725 | ||
1721 | if (yMin != mOldLowerScrollValue) { | 1726 | if (yMin != mOldLowerScrollValue) { |
1722 | mOldLowerScrollValue = yMin; | 1727 | mOldLowerScrollValue = yMin; |
1723 | emit lowerYChanged(yMin); | 1728 | emit lowerYChanged(yMin); |
1724 | } | 1729 | } |
1725 | if (yMax != mOldUpperScrollValue) { | 1730 | if (yMax != mOldUpperScrollValue) { |
1726 | mOldUpperScrollValue = yMax; | 1731 | mOldUpperScrollValue = yMax; |
1727 | emit upperYChanged(yMax); | 1732 | emit upperYChanged(yMax); |
1728 | } | 1733 | } |
1729 | } | 1734 | } |
1730 | 1735 | ||
1731 | void KOAgenda::deselectItem() | 1736 | void KOAgenda::deselectItem() |
1732 | { | 1737 | { |
1733 | if (mSelectedItem.isNull()) return; | 1738 | if (mSelectedItem.isNull()) return; |
1734 | mSelectedItem->select(false); | 1739 | mSelectedItem->select(false); |
1735 | mSelectedItem = 0; | 1740 | mSelectedItem = 0; |
1736 | } | 1741 | } |
1737 | 1742 | ||
1738 | void KOAgenda::selectItem(KOAgendaItem *item) | 1743 | void KOAgenda::selectItem(KOAgendaItem *item) |
1739 | { | 1744 | { |
1740 | if ((KOAgendaItem *)mSelectedItem == item) return; | 1745 | if ((KOAgendaItem *)mSelectedItem == item) return; |
1741 | deselectItem(); | 1746 | deselectItem(); |
1742 | if (item == 0) { | 1747 | if (item == 0) { |
1743 | emit incidenceSelected( 0 ); | 1748 | emit incidenceSelected( 0 ); |
1744 | return; | 1749 | return; |
1745 | } | 1750 | } |
1746 | mSelectedItem = item; | 1751 | mSelectedItem = item; |
1747 | mSelectedItem->select(); | 1752 | mSelectedItem->select(); |
1748 | emit incidenceSelected( mSelectedItem->incidence() ); | 1753 | emit incidenceSelected( mSelectedItem->incidence() ); |
1749 | } | 1754 | } |
1750 | 1755 | ||
1751 | // This function seems never be called. | 1756 | // This function seems never be called. |
1752 | void KOAgenda::keyPressEvent( QKeyEvent *kev ) | 1757 | void KOAgenda::keyPressEvent( QKeyEvent *kev ) |
1753 | { | 1758 | { |
1754 | switch(kev->key()) { | 1759 | switch(kev->key()) { |
1755 | case Key_PageDown: | 1760 | case Key_PageDown: |
1756 | verticalScrollBar()->addPage(); | 1761 | verticalScrollBar()->addPage(); |
1757 | break; | 1762 | break; |
1758 | case Key_PageUp: | 1763 | case Key_PageUp: |
1759 | verticalScrollBar()->subtractPage(); | 1764 | verticalScrollBar()->subtractPage(); |
1760 | break; | 1765 | break; |
1761 | case Key_Down: | 1766 | case Key_Down: |
1762 | verticalScrollBar()->addLine(); | 1767 | verticalScrollBar()->addLine(); |
1763 | break; | 1768 | break; |
1764 | case Key_Up: | 1769 | case Key_Up: |
1765 | verticalScrollBar()->subtractLine(); | 1770 | verticalScrollBar()->subtractLine(); |
1766 | break; | 1771 | break; |
1767 | default: | 1772 | default: |
1768 | ; | 1773 | ; |
1769 | } | 1774 | } |
1770 | } | 1775 | } |
1771 | 1776 | ||
1772 | void KOAgenda::calculateWorkingHours() | 1777 | void KOAgenda::calculateWorkingHours() |
1773 | { | 1778 | { |
1774 | // mWorkingHoursEnable = KOPrefs::instance()->mEnableWorkingHours; | 1779 | // mWorkingHoursEnable = KOPrefs::instance()->mEnableWorkingHours; |
1775 | mWorkingHoursEnable = !mAllDayMode; | 1780 | mWorkingHoursEnable = !mAllDayMode; |
1776 | 1781 | ||
1777 | mWorkingHoursYTop = mGridSpacingY * | 1782 | mWorkingHoursYTop = mGridSpacingY * |
1778 | KOPrefs::instance()->mWorkingHoursStart * 4; | 1783 | KOPrefs::instance()->mWorkingHoursStart * 4; |
1779 | mWorkingHoursYBottom = mGridSpacingY * | 1784 | mWorkingHoursYBottom = mGridSpacingY * |
1780 | KOPrefs::instance()->mWorkingHoursEnd * 4 - 1; | 1785 | KOPrefs::instance()->mWorkingHoursEnd * 4 - 1; |
1781 | } | 1786 | } |
1782 | 1787 | ||
1783 | 1788 | ||
1784 | DateList KOAgenda::dateList() const | 1789 | DateList KOAgenda::dateList() const |
1785 | { | 1790 | { |
1786 | return mSelectedDates; | 1791 | return mSelectedDates; |
1787 | } | 1792 | } |
1788 | 1793 | ||
1789 | void KOAgenda::setDateList(const DateList &selectedDates) | 1794 | void KOAgenda::setDateList(const DateList &selectedDates) |
1790 | { | 1795 | { |
1791 | mSelectedDates = selectedDates; | 1796 | mSelectedDates = selectedDates; |
1792 | marcus_bains(); | 1797 | marcus_bains(); |
1793 | } | 1798 | } |
1794 | 1799 | ||
1795 | void KOAgenda::setHolidayMask(QMemArray<bool> *mask) | 1800 | void KOAgenda::setHolidayMask(QMemArray<bool> *mask) |
1796 | { | 1801 | { |
1797 | mHolidayMask = mask; | 1802 | mHolidayMask = mask; |
1798 | 1803 | ||
1799 | /* | 1804 | /* |
1800 | kdDebug() << "HolidayMask: "; | 1805 | kdDebug() << "HolidayMask: "; |
1801 | for(uint i=0;i<mask->count();++i) { | 1806 | for(uint i=0;i<mask->count();++i) { |
1802 | kdDebug() << (mask->at(i) ? "*" : "o"); | 1807 | kdDebug() << (mask->at(i) ? "*" : "o"); |
1803 | } | 1808 | } |
1804 | kdDebug() << endl; | 1809 | kdDebug() << endl; |
1805 | */ | 1810 | */ |
1806 | } | 1811 | } |
1807 | 1812 | ||
1808 | void KOAgenda::contentsMousePressEvent ( QMouseEvent *event ) | 1813 | void KOAgenda::contentsMousePressEvent ( QMouseEvent *event ) |
1809 | { | 1814 | { |
1810 | 1815 | ||
1811 | QScrollView::contentsMousePressEvent(event); | 1816 | QScrollView::contentsMousePressEvent(event); |
1812 | } | 1817 | } |
1813 | 1818 | ||
1814 | void KOAgenda::storePosition() | 1819 | void KOAgenda::storePosition() |
1815 | { | 1820 | { |
1816 | //mContentPosition | 1821 | //mContentPosition |
1817 | int max = mGridSpacingY*4*24; | 1822 | int max = mGridSpacingY*4*24; |
1818 | if ( contentsY() < 5 && max > viewport()->height()*3/2 ) | 1823 | if ( contentsY() < 5 && max > viewport()->height()*3/2 ) |
1819 | mContentPosition = 0; | 1824 | mContentPosition = 0; |
1820 | else if ( contentsY() + viewport()->height() > max - 5 && max > viewport()->height()*3/2) | 1825 | else if ( contentsY() + viewport()->height() > max - 5 && max > viewport()->height()*3/2) |
1821 | mContentPosition = -1.0; | 1826 | mContentPosition = -1.0; |
1822 | else | 1827 | else |
1823 | mContentPosition = ((float) max)/ ((float)(contentsY()+ ( viewport()->height()/2))); | 1828 | mContentPosition = ((float) max)/ ((float)(contentsY()+ ( viewport()->height()/2))); |
1824 | //qDebug("mContentPosition %f %d %d %d",mContentPosition , max, contentsY() ,viewport()->height()); | 1829 | //qDebug("mContentPosition %f %d %d %d",mContentPosition , max, contentsY() ,viewport()->height()); |
1825 | 1830 | ||
1826 | } | 1831 | } |
1827 | void KOAgenda::restorePosition() | 1832 | void KOAgenda::restorePosition() |
1828 | { | 1833 | { |
1829 | int posY; | 1834 | int posY; |
1830 | int max = mGridSpacingY*4*24; | 1835 | int max = mGridSpacingY*4*24; |
1831 | if ( mContentPosition < 0 ) | 1836 | if ( mContentPosition < 0 ) |
1832 | posY = max-viewport()->height(); | 1837 | posY = max-viewport()->height(); |
1833 | else | 1838 | else |
1834 | if ( mContentPosition == 0 ) | 1839 | if ( mContentPosition == 0 ) |
1835 | posY = 0; | 1840 | posY = 0; |
1836 | else | 1841 | else |
1837 | posY = (max/mContentPosition)-(viewport()->height()/2); | 1842 | posY = (max/mContentPosition)-(viewport()->height()/2); |
1838 | setContentsPos (0, posY ); | 1843 | setContentsPos (0, posY ); |
1839 | //qDebug("posY %d hei %d", posY, max); | 1844 | //qDebug("posY %d hei %d", posY, max); |
1840 | 1845 | ||
1841 | } | 1846 | } |
1842 | void KOAgenda::moveChild( QWidget *w, int x , int y ) | 1847 | void KOAgenda::moveChild( QWidget *w, int x , int y ) |
1843 | { | 1848 | { |
1844 | ++x; | 1849 | ++x; |
1845 | QScrollView::moveChild( w, x , y ); | 1850 | QScrollView::moveChild( w, x , y ); |
1846 | } | 1851 | } |
1847 | #include <qmessagebox.h> | 1852 | #include <qmessagebox.h> |
1848 | #ifdef DESKTOP_VERSION | 1853 | #ifdef DESKTOP_VERSION |
1849 | #include <qprinter.h> | 1854 | #include <qprinter.h> |
1850 | #include <qpainter.h> | 1855 | #include <qpainter.h> |
1851 | #include <qpaintdevicemetrics.h> | 1856 | #include <qpaintdevicemetrics.h> |
1852 | 1857 | ||
1853 | #endif | 1858 | #endif |
1854 | void KOAgenda::printSelection() | 1859 | void KOAgenda::printSelection() |
1855 | { | 1860 | { |
1856 | #ifdef DESKTOP_VERSION | 1861 | #ifdef DESKTOP_VERSION |
1857 | if ( mStartCellY == mCurrentCellY ) { | 1862 | if ( mStartCellY == mCurrentCellY ) { |
1858 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1863 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1859 | i18n("Nothing selected!\n\nThis prints the full width of the Agenda view as you see it!\n\nTo determine the vertical range of the printing, please select\na vertical range (with the left mouse button down) in one column. "), | 1864 | i18n("Nothing selected!\n\nThis prints the full width of the Agenda view as you see it!\n\nTo determine the vertical range of the printing, please select\na vertical range (with the left mouse button down) in one column. "), |
1860 | i18n("OK"), 0, 0, | 1865 | i18n("OK"), 0, 0, |
1861 | 0, 1 ); | 1866 | 0, 1 ); |
1862 | return; | 1867 | return; |
1863 | } | 1868 | } |
1864 | 1869 | ||
1865 | float dx, dy; | 1870 | float dx, dy; |
1866 | int x,y,w,h; | 1871 | int x,y,w,h; |
1867 | x= 0; | 1872 | x= 0; |
1868 | w= contentsWidth()+2; | 1873 | w= contentsWidth()+2; |
1869 | // h= contentsHeight(); | 1874 | // h= contentsHeight(); |
1870 | y = mGridSpacingY*mStartCellY; | 1875 | y = mGridSpacingY*mStartCellY; |
1871 | h = mGridSpacingY*(mCurrentCellY+1)-y+2; | 1876 | h = mGridSpacingY*(mCurrentCellY+1)-y+2; |
1872 | 1877 | ||
1873 | //return; | 1878 | //return; |
1874 | QPrinter* printer = new QPrinter(); | 1879 | QPrinter* printer = new QPrinter(); |
1875 | if ( !printer->setup()) { | 1880 | if ( !printer->setup()) { |
1876 | delete printer; | 1881 | delete printer; |
1877 | return; | 1882 | return; |
1878 | } | 1883 | } |
1879 | QPainter p( printer ); | 1884 | QPainter p( printer ); |
1880 | QPaintDeviceMetrics m = QPaintDeviceMetrics ( printer ); | 1885 | QPaintDeviceMetrics m = QPaintDeviceMetrics ( printer ); |
1881 | QString date = i18n("Date range: ")+KGlobal::locale()->formatDate( mSelectedDates.first() )+" - "+KGlobal::locale()->formatDate( mSelectedDates.last() ); | 1886 | QString date = i18n("Date range: ")+KGlobal::locale()->formatDate( mSelectedDates.first() )+" - "+KGlobal::locale()->formatDate( mSelectedDates.last() ); |
1882 | date += " --- printing time: " + KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), true ); | 1887 | date += " --- printing time: " + KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), true ); |
1883 | int hei = p.boundingRect(0,0, 5, 5, Qt::AlignLeft, date ).height(); | 1888 | int hei = p.boundingRect(0,0, 5, 5, Qt::AlignLeft, date ).height(); |
1884 | // p.drawText( 0, 0, date ); | 1889 | // p.drawText( 0, 0, date ); |
1885 | int offset = m.width()/8; | 1890 | int offset = m.width()/8; |
1886 | // compute the scale | 1891 | // compute the scale |
1887 | dx = ((float) m.width()-offset) / (float)w; | 1892 | dx = ((float) m.width()-offset) / (float)w; |
1888 | dy = (float)(m.height() - ( 2 * hei )-offset ) / (float)h; | 1893 | dy = (float)(m.height() - ( 2 * hei )-offset ) / (float)h; |
1889 | float scale; | 1894 | float scale; |
1890 | // scale to fit the width or height of the paper | 1895 | // scale to fit the width or height of the paper |
1891 | if ( dx < dy ) | 1896 | if ( dx < dy ) |
1892 | scale = dx; | 1897 | scale = dx; |
1893 | else | 1898 | else |
1894 | scale = dy; | 1899 | scale = dy; |
1895 | // set the scale | 1900 | // set the scale |
1896 | p.drawText( offset* scale, offset* scale*3/4, date ); | 1901 | p.drawText( offset* scale, offset* scale*3/4, date ); |
1897 | 1902 | ||
1898 | int selDay; | 1903 | int selDay; |
1899 | float widOffset = ((float) m.width()-offset) / ((float)(mSelectedDates.count())); | 1904 | float widOffset = ((float) m.width()-offset) / ((float)(mSelectedDates.count())); |
1900 | float startX = 1; | 1905 | float startX = 1; |
1901 | for ( selDay = 0; selDay < mSelectedDates.count(); ++selDay) | 1906 | for ( selDay = 0; selDay < mSelectedDates.count(); ++selDay) |
1902 | { | 1907 | { |
1903 | QString text = KGlobal::locale()->formatDate( mSelectedDates[selDay],true ); | 1908 | QString text = KGlobal::locale()->formatDate( mSelectedDates[selDay],true ); |
1904 | p.setClipRect(offset* scale+startX , 0, widOffset-4, offset* scale+(2*hei* scale) ); | 1909 | p.setClipRect(offset* scale+startX , 0, widOffset-4, offset* scale+(2*hei* scale) ); |
1905 | p.drawText( offset* scale+startX, (offset+hei)* scale, text ); | 1910 | p.drawText( offset* scale+startX, (offset+hei)* scale, text ); |
1906 | startX += widOffset; | 1911 | startX += widOffset; |
1907 | 1912 | ||
1908 | } | 1913 | } |
1909 | p.translate( offset* scale,offset* scale+ (-y * scale)+(2*hei* scale)); | 1914 | p.translate( offset* scale,offset* scale+ (-y * scale)+(2*hei* scale)); |
1910 | p.scale( scale, scale ); | 1915 | p.scale( scale, scale ); |
1911 | p.setClipRect( offset* scale, offset* scale+(2*hei* scale), w*scale, h*scale ); | 1916 | p.setClipRect( offset* scale, offset* scale+(2*hei* scale), w*scale, h*scale ); |
1912 | // now printing with y offset: 2 hei | 1917 | // now printing with y offset: 2 hei |
1913 | // p.translate( 0, -y*scale); | 1918 | // p.translate( 0, -y*scale); |
1914 | 1919 | ||
1915 | drawContentsToPainter(&p, true ); | 1920 | drawContentsToPainter(&p, true ); |
1916 | globalFlagBlockAgendaItemUpdate = false; | 1921 | globalFlagBlockAgendaItemUpdate = false; |
1917 | KOAgendaItem *item; | 1922 | KOAgendaItem *item; |
1918 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 1923 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
1919 | item->select(false); | 1924 | item->select(false); |
1920 | item->paintMe( false, &p ); | 1925 | item->paintMe( false, &p ); |
1921 | } | 1926 | } |
1922 | globalFlagBlockAgendaItemUpdate = true; | 1927 | globalFlagBlockAgendaItemUpdate = true; |
1923 | p.end(); | 1928 | p.end(); |
1924 | delete printer; | 1929 | delete printer; |
1925 | #else | 1930 | #else |
1926 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1931 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1927 | i18n("Not supported \non PDA!\n"), | 1932 | i18n("Not supported \non PDA!\n"), |
1928 | i18n("OK"), 0, 0, | 1933 | i18n("OK"), 0, 0, |
1929 | 0, 1 ); | 1934 | 0, 1 ); |
1930 | #endif | 1935 | #endif |
1931 | } | 1936 | } |