author | zautrix <zautrix> | 2005-02-23 10:58:09 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-23 10:58:09 (UTC) |
commit | 36704cb63582c161d2ab5c63e66ee63bbf3b865f (patch) (unidiff) | |
tree | 1541d63b50f7bc50278c6fed164f4b5228f18362 | |
parent | 87a2f1a301beae2a8550c340348741c69f0ac1dd (diff) | |
download | kdepimpi-36704cb63582c161d2ab5c63e66ee63bbf3b865f.zip kdepimpi-36704cb63582c161d2ab5c63e66ee63bbf3b865f.tar.gz kdepimpi-36704cb63582c161d2ab5c63e66ee63bbf3b865f.tar.bz2 |
fixed layout problem
-rw-r--r-- | bin/kdepim/WhatsNew.txt | 1 | ||||
-rw-r--r-- | korganizer/koagenda.cpp | 31 | ||||
-rw-r--r-- | korganizer/koagendaitem.cpp | 1 |
3 files changed, 31 insertions, 2 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index 05c1afd..28029ee 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt | |||
@@ -1,389 +1,390 @@ | |||
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 2.0.12 ************ | 3 | ********** VERSION 2.0.12 ************ |
4 | 4 | ||
5 | Fixed a bug in todo start/due date handling for non recurring todos with a start and due date. | 5 | Fixed a bug in todo start/due date handling for non recurring todos with a start and due date. |
6 | Fixed some layout problems in the KO/Pi agenda view when there were many conflicting itmes. | ||
6 | 7 | ||
7 | 8 | ||
8 | ********** VERSION 2.0.11 ************ | 9 | ********** VERSION 2.0.11 ************ |
9 | 10 | ||
10 | Fixed some problems in pi-sync mode | 11 | Fixed some problems in pi-sync mode |
11 | (e.g. details of events were not synced properly) | 12 | (e.g. details of events were not synced properly) |
12 | 13 | ||
13 | ********** VERSION 2.0.10 ************ | 14 | ********** VERSION 2.0.10 ************ |
14 | 15 | ||
15 | KO/Pi: | 16 | KO/Pi: |
16 | In the desktop versions the context menu in the search dialog was broken after introducing the What'sThis info for the list view. | 17 | In the desktop versions the context menu in the search dialog was broken after introducing the What'sThis info for the list view. |
17 | This is fixed. | 18 | This is fixed. |
18 | Changed the search dialog a bit to make it more user friendly. | 19 | Changed the search dialog a bit to make it more user friendly. |
19 | (E.g.: Removed message box about "no items found" and set key focus to search line edit after search). | 20 | (E.g.: Removed message box about "no items found" and set key focus to search line edit after search). |
20 | 21 | ||
21 | Added config option to hide the week number in KO/Pi toolbar. | 22 | Added config option to hide the week number in KO/Pi toolbar. |
22 | 23 | ||
23 | ********** VERSION 2.0.9 ************ | 24 | ********** VERSION 2.0.9 ************ |
24 | 25 | ||
25 | Made month view icons for multiday events a bit nicer. | 26 | Made month view icons for multiday events a bit nicer. |
26 | Some minor fixes in KO/Pi | 27 | Some minor fixes in KO/Pi |
27 | (e.g. go to today did not work for new week view properly). | 28 | (e.g. go to today did not work for new week view properly). |
28 | 29 | ||
29 | 30 | ||
30 | ********** VERSION 2.0.8 ************ | 31 | ********** VERSION 2.0.8 ************ |
31 | 32 | ||
32 | Fixed a problem in dependency info in the ipk files for the Zaurus. | 33 | Fixed a problem in dependency info in the ipk files for the Zaurus. |
33 | 34 | ||
34 | Added icon for the stealth new week view and made navigation more user friendly in monthview by adding a prev/next week button to the navigator bar. | 35 | Added icon for the stealth new week view and made navigation more user friendly in monthview by adding a prev/next week button to the navigator bar. |
35 | 36 | ||
36 | Added a "go today" button to the datepicker. | 37 | Added a "go today" button to the datepicker. |
37 | 38 | ||
38 | Added "created" and "last modified" to event/todo viewer (and What'sThis viewer) | 39 | Added "created" and "last modified" to event/todo viewer (and What'sThis viewer) |
39 | and made it configureable to show these values. | 40 | and made it configureable to show these values. |
40 | 41 | ||
41 | Fixed a problem for events (from external iCal files) that do have a duration but no end date. | 42 | Fixed a problem for events (from external iCal files) that do have a duration but no end date. |
42 | 43 | ||
43 | 44 | ||
44 | ********** VERSION 2.0.7 ************ | 45 | ********** VERSION 2.0.7 ************ |
45 | 46 | ||
46 | Added global application font settings | 47 | Added global application font settings |
47 | (for all KDE-Pim/Pi apps) to the general settings. | 48 | (for all KDE-Pim/Pi apps) to the general settings. |
48 | 49 | ||
49 | Fixed a problem in OM/Pi when trying to login to some IMAP servers | 50 | Fixed a problem in OM/Pi when trying to login to some IMAP servers |
50 | (like the IMAP server of Apple: mail.mac.com ) | 51 | (like the IMAP server of Apple: mail.mac.com ) |
51 | 52 | ||
52 | Added recurring todos to KO/Pi. | 53 | Added recurring todos to KO/Pi. |
53 | 54 | ||
54 | 55 | ||
55 | ********** VERSION 2.0.6 ************ | 56 | ********** VERSION 2.0.6 ************ |
56 | 57 | ||
57 | Some bugfixes in the pi-sync mode. | 58 | Some bugfixes in the pi-sync mode. |
58 | Added German translation for pi-sync mode. | 59 | Added German translation for pi-sync mode. |
59 | 60 | ||
60 | KO/Pi: | 61 | KO/Pi: |
61 | Made the todolist using alternate background. | 62 | Made the todolist using alternate background. |
62 | 63 | ||
63 | Other minor fixes in KO/Pi. | 64 | Other minor fixes in KO/Pi. |
64 | 65 | ||
65 | 66 | ||
66 | ********** VERSION 2.0.5 ************ | 67 | ********** VERSION 2.0.5 ************ |
67 | 68 | ||
68 | Bugfixes in KO/Pi. | 69 | Bugfixes in KO/Pi. |
69 | 70 | ||
70 | ********** VERSION 2.0.4 ************ | 71 | ********** VERSION 2.0.4 ************ |
71 | 72 | ||
72 | KO/Pi: | 73 | KO/Pi: |
73 | Fixed problem loading translations for summary/location edit boxes in event/todo editor. | 74 | Fixed problem loading translations for summary/location edit boxes in event/todo editor. |
74 | 75 | ||
75 | Added a general "select week number" to the toolbar. | 76 | Added a general "select week number" to the toolbar. |
76 | 77 | ||
77 | Fixed some small problem of the new features introduced in version 2.0.3. | 78 | Fixed some small problem of the new features introduced in version 2.0.3. |
78 | 79 | ||
79 | Made it possible to specify one specific category as category color, | 80 | Made it possible to specify one specific category as category color, |
80 | if more than one categories are selected. | 81 | if more than one categories are selected. |
81 | 82 | ||
82 | Fixed a bug in saving colors for categories with non-ascii characters. | 83 | Fixed a bug in saving colors for categories with non-ascii characters. |
83 | (Like, e.g. German Umlauts). | 84 | (Like, e.g. German Umlauts). |
84 | Propably you have to set your colors again for those categories. | 85 | Propably you have to set your colors again for those categories. |
85 | 86 | ||
86 | 87 | ||
87 | ********** VERSION 2.0.3 ************ | 88 | ********** VERSION 2.0.3 ************ |
88 | 89 | ||
89 | KO/Pi: | 90 | KO/Pi: |
90 | Added feature for changing alarm settings for many items at once: | 91 | Added feature for changing alarm settings for many items at once: |
91 | Open list view (or search dialog), select the desired items and choose in | 92 | Open list view (or search dialog), select the desired items and choose in |
92 | the popup menu: Set alarm for selected... | 93 | the popup menu: Set alarm for selected... |
93 | 94 | ||
94 | Added to the event/todo viewer the option to send an email to | 95 | Added to the event/todo viewer the option to send an email to |
95 | all attendees or all selected (with RSVP) attendees. | 96 | all attendees or all selected (with RSVP) attendees. |
96 | 97 | ||
97 | Made the week-month mode changing in month view faster. | 98 | Made the week-month mode changing in month view faster. |
98 | 99 | ||
99 | Made month view better useable with keyboard. | 100 | Made month view better useable with keyboard. |
100 | Now TAB key jumps to next cell with an event/todo. | 101 | Now TAB key jumps to next cell with an event/todo. |
101 | Scroll in cell with coursor keys, scroll in time (next week) with | 102 | Scroll in cell with coursor keys, scroll in time (next week) with |
102 | Shift/Control + coursorkeys. | 103 | Shift/Control + coursorkeys. |
103 | 104 | ||
104 | Fixed bug that the todo view flat mode was reset after first view update. | 105 | Fixed bug that the todo view flat mode was reset after first view update. |
105 | 106 | ||
106 | If a todo is displayed closed in the todo view, | 107 | If a todo is displayed closed in the todo view, |
107 | it is now displayed in overdue/due today color depending on the subtodos overdue/due today properties. | 108 | it is now displayed in overdue/due today color depending on the subtodos overdue/due today properties. |
108 | 109 | ||
109 | Added info about the numbers of years to the caption (title) information about a birthday event. | 110 | Added info about the numbers of years to the caption (title) information about a birthday event. |
110 | 111 | ||
111 | Made completion date in todo editor editable. | 112 | Made completion date in todo editor editable. |
112 | 113 | ||
113 | Added possibility to save/load templates for journals. | 114 | Added possibility to save/load templates for journals. |
114 | (Which is just a simple "save text to file" or "insert text from file". | 115 | (Which is just a simple "save text to file" or "insert text from file". |
115 | 116 | ||
116 | ********** VERSION 2.0.2 ************ | 117 | ********** VERSION 2.0.2 ************ |
117 | 118 | ||
118 | KO/Pi: | 119 | KO/Pi: |
119 | Fixed the layout problem of the day label buttons | 120 | Fixed the layout problem of the day label buttons |
120 | of the agenda view introduced in version 2.0.1. | 121 | of the agenda view introduced in version 2.0.1. |
121 | 122 | ||
122 | Added WhatsThis support for the todo view and the list view. | 123 | Added WhatsThis support for the todo view and the list view. |
123 | 124 | ||
124 | Added a quite useful feature to the montview. | 125 | Added a quite useful feature to the montview. |
125 | Just click on the week numbers on the left. | 126 | Just click on the week numbers on the left. |
126 | And in the top right corner of month view/agenda view | 127 | And in the top right corner of month view/agenda view |
127 | there is now a "week number quick selector". | 128 | there is now a "week number quick selector". |
128 | (Click on the black triangle). | 129 | (Click on the black triangle). |
129 | 130 | ||
130 | Made the quite difficult timezone change in KO/Pi easy. | 131 | Made the quite difficult timezone change in KO/Pi easy. |
131 | 132 | ||
132 | OM/Pi: | 133 | OM/Pi: |
133 | Fixed too small icons on desktop. | 134 | Fixed too small icons on desktop. |
134 | Fixed non visible icons in mainwindow on Z with fastload enabled. | 135 | Fixed non visible icons in mainwindow on Z with fastload enabled. |
135 | Added signature file setting to smtp account config. | 136 | Added signature file setting to smtp account config. |
136 | And the signature can be edited and saved in the edit mail dialog. | 137 | And the signature can be edited and saved in the edit mail dialog. |
137 | That does mean: | 138 | That does mean: |
138 | Simply edit the signature for the selected smtp account in the | 139 | Simply edit the signature for the selected smtp account in the |
139 | edit new mail dialog and press the "save signature" button there. | 140 | edit new mail dialog and press the "save signature" button there. |
140 | Then the signature is saved to the file specified in the smtp account settings. | 141 | Then the signature is saved to the file specified in the smtp account settings. |
141 | If there is no file specified, it is saved automatically to the file | 142 | If there is no file specified, it is saved automatically to the file |
142 | kdepim/apps/kopiemail/<accountname>.sig. | 143 | kdepim/apps/kopiemail/<accountname>.sig. |
143 | 144 | ||
144 | 145 | ||
145 | 146 | ||
146 | ********** VERSION 2.0.1 ************ | 147 | ********** VERSION 2.0.1 ************ |
147 | 148 | ||
148 | Oooops ... I forgot to test on the Zaurus 5500 ... | 149 | Oooops ... I forgot to test on the Zaurus 5500 ... |
149 | 150 | ||
150 | Fixed many problems of new (english) strings (and german translations) | 151 | Fixed many problems of new (english) strings (and german translations) |
151 | introduced in the latest versions, where the text was not fitting on the | 152 | introduced in the latest versions, where the text was not fitting on the |
152 | 240x320 display of the Zaurus 5500. | 153 | 240x320 display of the Zaurus 5500. |
153 | 154 | ||
154 | KO/Pi: | 155 | KO/Pi: |
155 | Added a popup menu ( press pen and hold to get popup ) to the agenda view | 156 | Added a popup menu ( press pen and hold to get popup ) to the agenda view |
156 | with many useful items (add event/todo, show next week, two weeks, month, journal). | 157 | with many useful items (add event/todo, show next week, two weeks, month, journal). |
157 | 158 | ||
158 | Added items to the todolist popup menu for: | 159 | Added items to the todolist popup menu for: |
159 | Display all opened, all closed or all todos flat. | 160 | Display all opened, all closed or all todos flat. |
160 | The "flat" view makes is possible to sort all todos after ,e.g., prio or date. | 161 | The "flat" view makes is possible to sort all todos after ,e.g., prio or date. |
161 | Made the reparenting of todos on the desktop possible via Drag&Drop. | 162 | Made the reparenting of todos on the desktop possible via Drag&Drop. |
162 | Fixed several bugs in setting the completed datetime for todos. | 163 | Fixed several bugs in setting the completed datetime for todos. |
163 | Added info about completed datetime of todos to the todo viewer. | 164 | Added info about completed datetime of todos to the todo viewer. |
164 | Now displaying a completed todo (with completed datetime set) in the agenda view | 165 | Now displaying a completed todo (with completed datetime set) in the agenda view |
165 | at the time of the completion. Such that now it is possible to see in the agenda view | 166 | at the time of the completion. Such that now it is possible to see in the agenda view |
166 | when what todo was completed. | 167 | when what todo was completed. |
167 | Fixed behaviour of automatic setting completion of todos with sub-todos/parent todos. | 168 | Fixed behaviour of automatic setting completion of todos with sub-todos/parent todos. |
168 | Now the behaviour is: | 169 | Now the behaviour is: |
169 | Setting a parent to complete sets all (sub)childs to complete. | 170 | Setting a parent to complete sets all (sub)childs to complete. |
170 | Setting a parent to uncomplete does not change the childs. | 171 | Setting a parent to uncomplete does not change the childs. |
171 | Setting a child to uncomplete sets all parent to uncomplete. | 172 | Setting a child to uncomplete sets all parent to uncomplete. |
172 | Setting a child to complete does not change the parents. | 173 | Setting a child to complete does not change the parents. |
173 | 174 | ||
174 | Smart updating and double buffering of the daymatrix. | 175 | Smart updating and double buffering of the daymatrix. |
175 | Showing holidays in the day matrix. | 176 | Showing holidays in the day matrix. |
176 | Many other small performance updates. | 177 | Many other small performance updates. |
177 | 178 | ||
178 | Made day labels in agenda clickable. By clicking a label, the day is displayed in single day mode. | 179 | Made day labels in agenda clickable. By clicking a label, the day is displayed in single day mode. |
179 | 180 | ||
180 | Now the translation file usertranslation.txt is supposed to be in utf8 format. | 181 | Now the translation file usertranslation.txt is supposed to be in utf8 format. |
181 | If you want to translate a language from western europe, just change the germantranslation.txt file. Please read the updated Usertranslation HowTo in KO/Pi Help menu. | 182 | If you want to translate a language from western europe, just change the germantranslation.txt file. Please read the updated Usertranslation HowTo in KO/Pi Help menu. |
182 | 183 | ||
183 | 184 | ||
184 | ********** VERSION 2.0.0 ************ | 185 | ********** VERSION 2.0.0 ************ |
185 | 186 | ||
186 | Stable release 2.0.0! | 187 | Stable release 2.0.0! |
187 | 188 | ||
188 | KO/Pi: | 189 | KO/Pi: |
189 | Fixed problem in edit dialog recreation at startup. | 190 | Fixed problem in edit dialog recreation at startup. |
190 | Made "toggle view*" menu items enabled context sensitive. | 191 | Made "toggle view*" menu items enabled context sensitive. |
191 | Changed agenda size menu to items 1-10. | 192 | Changed agenda size menu to items 1-10. |
192 | Made it possible to change agenda size quickly by pressing mouse on timelabels in agenda view and move mouse up/down. | 193 | Made it possible to change agenda size quickly by pressing mouse on timelabels in agenda view and move mouse up/down. |
193 | Usebility enhancements in the KO/Pi menus. | 194 | Usebility enhancements in the KO/Pi menus. |
194 | Birthday import now adds year to summary. | 195 | Birthday import now adds year to summary. |
195 | What's Next view shows age in years for birthday. | 196 | What's Next view shows age in years for birthday. |
196 | 197 | ||
197 | OM/Pi: | 198 | OM/Pi: |
198 | Added three info lines to display subject, from and to of selected mails. | 199 | Added three info lines to display subject, from and to of selected mails. |
199 | 200 | ||
200 | KA/Pi: | 201 | KA/Pi: |
201 | Fixed jump bar behaviour on Zaurus. | 202 | Fixed jump bar behaviour on Zaurus. |
202 | Now KA/Pi search field supports searching for a range of starting characters. | 203 | Now KA/Pi search field supports searching for a range of starting characters. |
203 | E.g. to search for all contact beginning with b to n, type | 204 | E.g. to search for all contact beginning with b to n, type |
204 | b-n | 205 | b-n |
205 | in the search field. | 206 | in the search field. |
206 | 207 | ||
207 | ********** VERSION 1.9.20 ************ | 208 | ********** VERSION 1.9.20 ************ |
208 | 209 | ||
209 | KO/Pi: | 210 | KO/Pi: |
210 | Added for the "dislplay one day" agenda mode | 211 | Added for the "dislplay one day" agenda mode |
211 | info in the caption and in the day lables: | 212 | info in the caption and in the day lables: |
212 | Now it is displayed, if the selected day is from "day before yesterday" | 213 | Now it is displayed, if the selected day is from "day before yesterday" |
213 | to "day after tomorrow". | 214 | to "day after tomorrow". |
214 | Made it possible to delete a Todo, which has sub-todos. | 215 | Made it possible to delete a Todo, which has sub-todos. |
215 | Fixed two small problems in the todo view. | 216 | Fixed two small problems in the todo view. |
216 | Added missing German translation for filter edit and print dialog. | 217 | Added missing German translation for filter edit and print dialog. |
217 | Made search dialog closeable by cancel key. | 218 | Made search dialog closeable by cancel key. |
218 | 219 | ||
219 | Made it possible to select in the date picker the (ligt grey ) | 220 | Made it possible to select in the date picker the (ligt grey ) |
220 | dates of the prev./next month with the mouse. | 221 | dates of the prev./next month with the mouse. |
221 | 222 | ||
222 | OM/Pi: | 223 | OM/Pi: |
223 | "Delete mail" icon in main window now deletes all selected mails. | 224 | "Delete mail" icon in main window now deletes all selected mails. |
224 | Fixed the problem, that the state flag of imap mails was ignored. | 225 | Fixed the problem, that the state flag of imap mails was ignored. |
225 | Now mails with "FLAG_SEEN" on the imap server get no icon in the list view | 226 | Now mails with "FLAG_SEEN" on the imap server get no icon in the list view |
226 | to indecate that they are already seen. | 227 | to indecate that they are already seen. |
227 | Fixed the problem that the body of some mails was not displayed in the | 228 | Fixed the problem that the body of some mails was not displayed in the |
228 | mail viewer when fetching them from the imap server directly to read them. | 229 | mail viewer when fetching them from the imap server directly to read them. |
229 | Made it (configurable) possible to show the "To:" field in the list view. | 230 | Made it (configurable) possible to show the "To:" field in the list view. |
230 | Added to the mail viewer the option "View Source" to make it possible to see the raw mail data. | 231 | Added to the mail viewer the option "View Source" to make it possible to see the raw mail data. |
231 | Added a "Download Mail" button to the mail viewer to quickly download the viewed mail to the | 232 | Added a "Download Mail" button to the mail viewer to quickly download the viewed mail to the |
232 | local storage folder (specified in account settings) of the account of the mail. | 233 | local storage folder (specified in account settings) of the account of the mail. |
233 | Removed some memory leaks in OM/Pi. | 234 | Removed some memory leaks in OM/Pi. |
234 | 235 | ||
235 | 236 | ||
236 | ********** VERSION 1.9.19 ************ | 237 | ********** VERSION 1.9.19 ************ |
237 | 238 | ||
238 | Added a lot of missing translations to KA/Pi, | 239 | Added a lot of missing translations to KA/Pi, |
239 | Added some missing translations to KO/Pi and OM/Pi. | 240 | Added some missing translations to KO/Pi and OM/Pi. |
240 | 241 | ||
241 | Fixed some minor problems in KA/Pi + KO/Pi. | 242 | Fixed some minor problems in KA/Pi + KO/Pi. |
242 | 243 | ||
243 | Fixed a crash when closing PwM/Pi. | 244 | Fixed a crash when closing PwM/Pi. |
244 | Added German translation for PwM/Pi. | 245 | Added German translation for PwM/Pi. |
245 | 246 | ||
246 | Made view change and Month View update faster in KO/Pi. | 247 | Made view change and Month View update faster in KO/Pi. |
247 | 248 | ||
248 | 249 | ||
249 | ********** VERSION 1.9.18 ************ | 250 | ********** VERSION 1.9.18 ************ |
250 | 251 | ||
251 | FYI: The VERSION 1.9.17 was a testing release only. | 252 | FYI: The VERSION 1.9.17 was a testing release only. |
252 | Please read the changelog of VERSION 1.9.17 as well. | 253 | Please read the changelog of VERSION 1.9.17 as well. |
253 | 254 | ||
254 | Cleaned up the syncing config dialog. | 255 | Cleaned up the syncing config dialog. |
255 | Added sync config options for date range for events. | 256 | Added sync config options for date range for events. |
256 | Added sync config options for filters on incoming data. | 257 | Added sync config options for filters on incoming data. |
257 | Added sync config options for filters on outgoing data. | 258 | Added sync config options for filters on outgoing data. |
258 | Please read the updated SyncHowTo about the new filter settings. | 259 | Please read the updated SyncHowTo about the new filter settings. |
259 | These filter settings make it now possible to sync with shared | 260 | These filter settings make it now possible to sync with shared |
260 | calendars without writing back private or confidential data | 261 | calendars without writing back private or confidential data |
261 | (via the outgoing filters). | 262 | (via the outgoing filters). |
262 | To sync only with particular parts of a shared calendar, | 263 | To sync only with particular parts of a shared calendar, |
263 | the incoming filter settings can be used. | 264 | the incoming filter settings can be used. |
264 | An example can be found in the SyncHowTo. | 265 | An example can be found in the SyncHowTo. |
265 | Same for shared addressbooks. | 266 | Same for shared addressbooks. |
266 | 267 | ||
267 | Added a setting for the global kdepim data storage. | 268 | Added a setting for the global kdepim data storage. |
268 | Usually the data is stored in (yourhomedir/kdepim). | 269 | Usually the data is stored in (yourhomedir/kdepim). |
269 | Now you can set in the Global config dialog TAB, subTAB "Data storage path" | 270 | Now you can set in the Global config dialog TAB, subTAB "Data storage path" |
270 | a directory where all the kdepim data is stored. | 271 | a directory where all the kdepim data is stored. |
271 | That makes it easy to save all kdepim data on a SD card on the Z, for example. | 272 | That makes it easy to save all kdepim data on a SD card on the Z, for example. |
272 | 273 | ||
273 | KO/Pi: | 274 | KO/Pi: |
274 | The timeedit input has a pulldown list for times. | 275 | The timeedit input has a pulldown list for times. |
275 | If opened, this pulldown list should now has the right time highlighted. | 276 | If opened, this pulldown list should now has the right time highlighted. |
276 | Added the possibility to exclude events/todos/journals in a filter. | 277 | Added the possibility to exclude events/todos/journals in a filter. |
277 | You should exclude journals, if you do not want them to sync with a public calendar. | 278 | You should exclude journals, if you do not want them to sync with a public calendar. |
278 | 279 | ||
279 | KA/Pi: | 280 | KA/Pi: |
280 | Added the possibility to in/exclude public/private/confidential contacts to a filter. | 281 | Added the possibility to in/exclude public/private/confidential contacts to a filter. |
281 | If you have already defined filterrules in KA/Pi you have to adjust them all by setting the "include public/private/confidential" property manually. Sorry for that ... | 282 | If you have already defined filterrules in KA/Pi you have to adjust them all by setting the "include public/private/confidential" property manually. Sorry for that ... |
282 | Added printing of card view and details view on desktop. | 283 | Added printing of card view and details view on desktop. |
283 | Printing of list view is not working... | 284 | Printing of list view is not working... |
284 | Added button for removing pictures in contact editor. | 285 | Added button for removing pictures in contact editor. |
285 | Parsing data fix of KA/Pi version 1.9.17. | 286 | Parsing data fix of KA/Pi version 1.9.17. |
286 | Fixed the "parse name automatically" problem of KA/Pi version 1.9.17. | 287 | Fixed the "parse name automatically" problem of KA/Pi version 1.9.17. |
287 | Fixed some syncing merging problems. | 288 | Fixed some syncing merging problems. |
288 | 289 | ||
289 | 290 | ||
290 | ********** VERSION 1.9.17 ************ | 291 | ********** VERSION 1.9.17 ************ |
291 | 292 | ||
292 | KO/Pi: | 293 | KO/Pi: |
293 | Fixed that tooltips were not updated after moving an item in agenda view. | 294 | Fixed that tooltips were not updated after moving an item in agenda view. |
294 | Fixed a bug in sorting start date for recurring events in list view. | 295 | Fixed a bug in sorting start date for recurring events in list view. |
295 | Changed the left button in todo viewer from "Agenda" to "Set completed". | 296 | Changed the left button in todo viewer from "Agenda" to "Set completed". |
296 | This makes it possible to change a todo in the What's Next View quickly to the completed state without leaving the What's Next View. | 297 | This makes it possible to change a todo in the What's Next View quickly to the completed state without leaving the What's Next View. |
297 | Added more info in the todo viewer: Startdate, parent/sub todos. | 298 | Added more info in the todo viewer: Startdate, parent/sub todos. |
298 | 299 | ||
299 | 300 | ||
300 | KA/Pi: | 301 | KA/Pi: |
301 | All fields search does now actually search all the (possible) fields, | 302 | All fields search does now actually search all the (possible) fields, |
302 | not only those listed in the contact list. | 303 | not only those listed in the contact list. |
303 | Made is possible to inline a picture in a vcard on the Z. | 304 | Made is possible to inline a picture in a vcard on the Z. |
304 | This was only possible on the desktop, now is it possible on the Z as well. | 305 | This was only possible on the desktop, now is it possible on the Z as well. |
305 | Fixed of missing save settings after filter configuration. | 306 | Fixed of missing save settings after filter configuration. |
306 | Made saving of addressbook much faster. | 307 | Made saving of addressbook much faster. |
307 | Fixed extension widget layout problem. | 308 | Fixed extension widget layout problem. |
308 | Fixed saving of default formatted name settings. | 309 | Fixed saving of default formatted name settings. |
309 | Fixed formatted name handling in edit dialog. | 310 | Fixed formatted name handling in edit dialog. |
310 | Added an option for changing formatted names of many contacts | 311 | Added an option for changing formatted names of many contacts |
311 | (menu: File - Change - Set formatted name). | 312 | (menu: File - Change - Set formatted name). |
312 | 313 | ||
313 | QWhatsThis was not working on the Z ( only black rectangle was shown). | 314 | QWhatsThis was not working on the Z ( only black rectangle was shown). |
314 | This is Fixed. | 315 | This is Fixed. |
315 | 316 | ||
316 | KDE-Sync: | 317 | KDE-Sync: |
317 | Now readonly KDE resources are synced as well. | 318 | Now readonly KDE resources are synced as well. |
318 | (They are not changed in KDE itself, of course). | 319 | (They are not changed in KDE itself, of course). |
319 | 320 | ||
320 | 321 | ||
321 | 322 | ||
322 | ********** VERSION 1.9.16 ************ | 323 | ********** VERSION 1.9.16 ************ |
323 | 324 | ||
324 | KO/Pi: | 325 | KO/Pi: |
325 | Fixed search dialog size on Z 6000 (480x640 display). | 326 | Fixed search dialog size on Z 6000 (480x640 display). |
326 | Added setting to hide/show time in agenda items. | 327 | Added setting to hide/show time in agenda items. |
327 | Added setting to hide not running todos in todo view. | 328 | Added setting to hide not running todos in todo view. |
328 | Added columns for start date/time in todo view. | 329 | Added columns for start date/time in todo view. |
329 | Replaced the solid half-hour lines in agenda view by dot lines. | 330 | Replaced the solid half-hour lines in agenda view by dot lines. |
330 | Added possibility of printing the What's Next View on the desktop | 331 | Added possibility of printing the What's Next View on the desktop |
331 | (i.e. Windows and Linux). | 332 | (i.e. Windows and Linux). |
332 | Fixed a crash in KO/Pi when starting KO/Pi with What's Next view. | 333 | Fixed a crash in KO/Pi when starting KO/Pi with What's Next view. |
333 | Added tooltips in month view.(Tooltips only available on desktop) | 334 | Added tooltips in month view.(Tooltips only available on desktop) |
334 | 335 | ||
335 | Fixed a strange problem in KO/Pi alarm applet. | 336 | Fixed a strange problem in KO/Pi alarm applet. |
336 | Did not find the actual problem, | 337 | Did not find the actual problem, |
337 | such that now Qtopia reboots again if deinstalling the alarm applet. | 338 | such that now Qtopia reboots again if deinstalling the alarm applet. |
338 | But the alarm applet should work again. | 339 | But the alarm applet should work again. |
339 | 340 | ||
340 | KA/Pi: | 341 | KA/Pi: |
341 | Fixed the problem, that internal pictures were not saved. | 342 | Fixed the problem, that internal pictures were not saved. |
342 | 343 | ||
343 | Fixed a problem in the pi-sync mode by increasing the timeout for data transfer from 20 seconds to 5 minutes. | 344 | Fixed a problem in the pi-sync mode by increasing the timeout for data transfer from 20 seconds to 5 minutes. |
344 | 345 | ||
345 | Fixed some minor problems. (Like word wrap in help text windows). | 346 | Fixed some minor problems. (Like word wrap in help text windows). |
346 | 347 | ||
347 | Fixed a compiling problem in microkde/kresources. | 348 | Fixed a compiling problem in microkde/kresources. |
348 | 349 | ||
349 | KO/Pi is using zdbat (renamed to db2file) for syncing with Sharp DTM. | 350 | KO/Pi is using zdbat (renamed to db2file) for syncing with Sharp DTM. |
350 | This version now includes zdbat 1.0.0 (old version was zdbat 0.2.9) | 351 | This version now includes zdbat 1.0.0 (old version was zdbat 0.2.9) |
351 | such that now syncing KO/Pi with Sharp DTM should work on the | 352 | such that now syncing KO/Pi with Sharp DTM should work on the |
352 | Zaurus C 3000 model. | 353 | Zaurus C 3000 model. |
353 | 354 | ||
354 | ********** VERSION 1.9.15 ************ | 355 | ********** VERSION 1.9.15 ************ |
355 | 356 | ||
356 | Usebilty enhancements in KO/Pi: | 357 | Usebilty enhancements in KO/Pi: |
357 | When clicking on the date in a month view cell, the day view is shown. | 358 | When clicking on the date in a month view cell, the day view is shown. |
358 | Old behaviour was, that the "new event" dialog popped up. | 359 | Old behaviour was, that the "new event" dialog popped up. |
359 | 360 | ||
360 | Added a one step "undo delete" in KO/Pi (Accessable in the "Action" menu). | 361 | Added a one step "undo delete" in KO/Pi (Accessable in the "Action" menu). |
361 | That means, you can restore the latest | 362 | That means, you can restore the latest |
362 | event/todo/journal you have deleted. | 363 | event/todo/journal you have deleted. |
363 | A journal is deleted, if you clear all the text of the journal. | 364 | A journal is deleted, if you clear all the text of the journal. |
364 | 365 | ||
365 | Fixed the bug of the editor dialogs in KO/Pi of version 1.9.14. | 366 | Fixed the bug of the editor dialogs in KO/Pi of version 1.9.14. |
366 | 367 | ||
367 | KA/Pi starting in 480x640 resolution: | 368 | KA/Pi starting in 480x640 resolution: |
368 | Hide the filter action in toolbar | 369 | Hide the filter action in toolbar |
369 | and added icons for undo/delete/redo in toolbar. | 370 | and added icons for undo/delete/redo in toolbar. |
370 | 371 | ||
371 | Change in OM/Pi ViewMail dialog: | 372 | Change in OM/Pi ViewMail dialog: |
372 | When clicking on the "delete" icon the mail is deleted after confirmation as usual. | 373 | When clicking on the "delete" icon the mail is deleted after confirmation as usual. |
373 | But the edit dialog is not closed as before, now the next mail in the folder is shown automatically (if there is any). | 374 | But the edit dialog is not closed as before, now the next mail in the folder is shown automatically (if there is any). |
374 | 375 | ||
375 | Fixed a crash when deleting mail-accounts in OM/Pi. | 376 | Fixed a crash when deleting mail-accounts in OM/Pi. |
376 | 377 | ||
377 | 378 | ||
378 | ********** VERSION 1.9.14 ************ | 379 | ********** VERSION 1.9.14 ************ |
379 | 380 | ||
380 | Fixed some problems with the dialog sizes when switching | 381 | Fixed some problems with the dialog sizes when switching |
381 | portrait/landscape mode on 640x480 PDA display. | 382 | portrait/landscape mode on 640x480 PDA display. |
382 | 383 | ||
383 | Fixed some other small bugs in KA/Pi KO/Pi and OM/Pi and PwM/Pi. | 384 | Fixed some other small bugs in KA/Pi KO/Pi and OM/Pi and PwM/Pi. |
384 | 385 | ||
385 | Fixed an ugly bug in KOpieMail: | 386 | Fixed an ugly bug in KOpieMail: |
386 | KOpieMail was not able to write files (mails) to MSDOS file system, | 387 | KOpieMail was not able to write files (mails) to MSDOS file system, |
387 | like on an usual preformatted SD card. That should work now. | 388 | like on an usual preformatted SD card. That should work now. |
388 | To save your mail data on the Sd card do the following: | 389 | To save your mail data on the Sd card do the following: |
389 | Create a dir on the SD card: | 390 | Create a dir on the SD card: |
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index a72e470..195b1fa 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp | |||
@@ -698,789 +698,816 @@ void KOAgenda::startItemAction(QPoint viewportPos) | |||
698 | contentsToGrid(x,y,gx,gy); | 698 | contentsToGrid(x,y,gx,gy); |
699 | 699 | ||
700 | mStartCellX = gx; | 700 | mStartCellX = gx; |
701 | mStartCellY = gy; | 701 | mStartCellY = gy; |
702 | mCurrentCellX = gx; | 702 | mCurrentCellX = gx; |
703 | mCurrentCellY = gy; | 703 | mCurrentCellY = gy; |
704 | 704 | ||
705 | if (mAllDayMode) { | 705 | if (mAllDayMode) { |
706 | int gridDistanceX = (x - gx * mGridSpacingX); | 706 | int gridDistanceX = (x - gx * mGridSpacingX); |
707 | if (gridDistanceX < mResizeBorderWidth && | 707 | if (gridDistanceX < mResizeBorderWidth && |
708 | mActionItem->cellX() == mCurrentCellX) { | 708 | mActionItem->cellX() == mCurrentCellX) { |
709 | mActionType = RESIZELEFT; | 709 | mActionType = RESIZELEFT; |
710 | setCursor(sizeHorCursor); | 710 | setCursor(sizeHorCursor); |
711 | } else if ((mGridSpacingX - gridDistanceX) < mResizeBorderWidth && | 711 | } else if ((mGridSpacingX - gridDistanceX) < mResizeBorderWidth && |
712 | mActionItem->cellXWidth() == mCurrentCellX) { | 712 | mActionItem->cellXWidth() == mCurrentCellX) { |
713 | mActionType = RESIZERIGHT; | 713 | mActionType = RESIZERIGHT; |
714 | setCursor(sizeHorCursor); | 714 | setCursor(sizeHorCursor); |
715 | } else { | 715 | } else { |
716 | mActionType = MOVE; | 716 | mActionType = MOVE; |
717 | mActionItem->startMove(); | 717 | mActionItem->startMove(); |
718 | setCursor(sizeAllCursor); | 718 | setCursor(sizeAllCursor); |
719 | } | 719 | } |
720 | } else { | 720 | } else { |
721 | int gridDistanceY = (y - gy * mGridSpacingY); | 721 | int gridDistanceY = (y - gy * mGridSpacingY); |
722 | bool allowResize = ( mActionItem->incidence()->type() != "Todo" ); | 722 | bool allowResize = ( mActionItem->incidence()->type() != "Todo" ); |
723 | if (allowResize && gridDistanceY < mResizeBorderWidth && | 723 | if (allowResize && gridDistanceY < mResizeBorderWidth && |
724 | mActionItem->cellYTop() == mCurrentCellY && | 724 | mActionItem->cellYTop() == mCurrentCellY && |
725 | !mActionItem->firstMultiItem()) { | 725 | !mActionItem->firstMultiItem()) { |
726 | mActionType = RESIZETOP; | 726 | mActionType = RESIZETOP; |
727 | setCursor(sizeVerCursor); | 727 | setCursor(sizeVerCursor); |
728 | } else if (allowResize &&(mGridSpacingY - gridDistanceY) < mResizeBorderWidth && | 728 | } else if (allowResize &&(mGridSpacingY - gridDistanceY) < mResizeBorderWidth && |
729 | mActionItem->cellYBottom() == mCurrentCellY && | 729 | mActionItem->cellYBottom() == mCurrentCellY && |
730 | !mActionItem->lastMultiItem()) { | 730 | !mActionItem->lastMultiItem()) { |
731 | mActionType = RESIZEBOTTOM; | 731 | mActionType = RESIZEBOTTOM; |
732 | setCursor(sizeVerCursor); | 732 | setCursor(sizeVerCursor); |
733 | } else { | 733 | } else { |
734 | mActionType = MOVE; | 734 | mActionType = MOVE; |
735 | mActionItem->startMove(); | 735 | mActionItem->startMove(); |
736 | setCursor(sizeAllCursor); | 736 | setCursor(sizeAllCursor); |
737 | } | 737 | } |
738 | } | 738 | } |
739 | } | 739 | } |
740 | 740 | ||
741 | void KOAgenda::performItemAction(QPoint viewportPos) | 741 | void KOAgenda::performItemAction(QPoint viewportPos) |
742 | { | 742 | { |
743 | // kdDebug() << "viewportPos: " << viewportPos.x() << "," << viewportPos.y() << endl; | 743 | // kdDebug() << "viewportPos: " << viewportPos.x() << "," << viewportPos.y() << endl; |
744 | // QPoint point = viewport()->mapToGlobal(viewportPos); | 744 | // QPoint point = viewport()->mapToGlobal(viewportPos); |
745 | // kdDebug() << "Global: " << point.x() << "," << point.y() << endl; | 745 | // kdDebug() << "Global: " << point.x() << "," << point.y() << endl; |
746 | // point = clipper()->mapFromGlobal(point); | 746 | // point = clipper()->mapFromGlobal(point); |
747 | // kdDebug() << "clipper: " << point.x() << "," << point.y() << endl; | 747 | // kdDebug() << "clipper: " << point.x() << "," << point.y() << endl; |
748 | // kdDebug() << "visible height: " << visibleHeight() << endl; | 748 | // kdDebug() << "visible height: " << visibleHeight() << endl; |
749 | int x,y; | 749 | int x,y; |
750 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 750 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
751 | // kdDebug() << "contents: " << x << "," << y << "\n" << endl; | 751 | // kdDebug() << "contents: " << x << "," << y << "\n" << endl; |
752 | int gx,gy; | 752 | int gx,gy; |
753 | contentsToGrid(x,y,gx,gy); | 753 | contentsToGrid(x,y,gx,gy); |
754 | QPoint clipperPos = clipper()-> | 754 | QPoint clipperPos = clipper()-> |
755 | mapFromGlobal(viewport()->mapToGlobal(viewportPos)); | 755 | mapFromGlobal(viewport()->mapToGlobal(viewportPos)); |
756 | 756 | ||
757 | // Cursor left active agenda area. | 757 | // Cursor left active agenda area. |
758 | // This starts a drag. | 758 | // This starts a drag. |
759 | if ( /*clipperPos.y() < 0 || clipperPos.y() > visibleHeight() ||*/ | 759 | if ( /*clipperPos.y() < 0 || clipperPos.y() > visibleHeight() ||*/ |
760 | clipperPos.x() < 0 || clipperPos.x() > visibleWidth() ) { | 760 | clipperPos.x() < 0 || clipperPos.x() > visibleWidth() ) { |
761 | if ( mActionType == MOVE ) { | 761 | if ( mActionType == MOVE ) { |
762 | mScrollUpTimer.stop(); | 762 | mScrollUpTimer.stop(); |
763 | mScrollDownTimer.stop(); | 763 | mScrollDownTimer.stop(); |
764 | mActionItem->resetMove(); | 764 | mActionItem->resetMove(); |
765 | placeSubCells( mActionItem ); | 765 | placeSubCells( mActionItem ); |
766 | // emit startDragSignal( mActionItem->incidence() ); | 766 | // emit startDragSignal( mActionItem->incidence() ); |
767 | setCursor( arrowCursor ); | 767 | setCursor( arrowCursor ); |
768 | mActionItem = 0; | 768 | mActionItem = 0; |
769 | mActionType = NOP; | 769 | mActionType = NOP; |
770 | mItemMoved = 0; | 770 | mItemMoved = 0; |
771 | return; | 771 | return; |
772 | } | 772 | } |
773 | } else { | 773 | } else { |
774 | switch ( mActionType ) { | 774 | switch ( mActionType ) { |
775 | case MOVE: | 775 | case MOVE: |
776 | setCursor( sizeAllCursor ); | 776 | setCursor( sizeAllCursor ); |
777 | break; | 777 | break; |
778 | case RESIZETOP: | 778 | case RESIZETOP: |
779 | case RESIZEBOTTOM: | 779 | case RESIZEBOTTOM: |
780 | setCursor( sizeVerCursor ); | 780 | setCursor( sizeVerCursor ); |
781 | break; | 781 | break; |
782 | case RESIZELEFT: | 782 | case RESIZELEFT: |
783 | case RESIZERIGHT: | 783 | case RESIZERIGHT: |
784 | setCursor( sizeHorCursor ); | 784 | setCursor( sizeHorCursor ); |
785 | break; | 785 | break; |
786 | default: | 786 | default: |
787 | setCursor( arrowCursor ); | 787 | setCursor( arrowCursor ); |
788 | } | 788 | } |
789 | } | 789 | } |
790 | 790 | ||
791 | // Scroll if item was moved to upper or lower end of agenda. | 791 | // Scroll if item was moved to upper or lower end of agenda. |
792 | if (clipperPos.y() < mScrollBorderWidth) { | 792 | if (clipperPos.y() < mScrollBorderWidth) { |
793 | mScrollUpTimer.start(mScrollDelay); | 793 | mScrollUpTimer.start(mScrollDelay); |
794 | } else if (visibleHeight() - clipperPos.y() < | 794 | } else if (visibleHeight() - clipperPos.y() < |
795 | mScrollBorderWidth) { | 795 | mScrollBorderWidth) { |
796 | mScrollDownTimer.start(mScrollDelay); | 796 | mScrollDownTimer.start(mScrollDelay); |
797 | } else { | 797 | } else { |
798 | mScrollUpTimer.stop(); | 798 | mScrollUpTimer.stop(); |
799 | mScrollDownTimer.stop(); | 799 | mScrollDownTimer.stop(); |
800 | } | 800 | } |
801 | 801 | ||
802 | // Move or resize item if necessary | 802 | // Move or resize item if necessary |
803 | if (mCurrentCellX != gx || mCurrentCellY != gy) { | 803 | if (mCurrentCellX != gx || mCurrentCellY != gy) { |
804 | mItemMoved = true; | 804 | mItemMoved = true; |
805 | mActionItem->raise(); | 805 | mActionItem->raise(); |
806 | if (mActionType == MOVE) { | 806 | if (mActionType == MOVE) { |
807 | // Move all items belonging to a multi item | 807 | // Move all items belonging to a multi item |
808 | KOAgendaItem *moveItem = mActionItem->firstMultiItem(); | 808 | KOAgendaItem *moveItem = mActionItem->firstMultiItem(); |
809 | bool isMultiItem = (moveItem || mActionItem->lastMultiItem()); | 809 | bool isMultiItem = (moveItem || mActionItem->lastMultiItem()); |
810 | if (!moveItem) moveItem = mActionItem; | 810 | if (!moveItem) moveItem = mActionItem; |
811 | while (moveItem) { | 811 | while (moveItem) { |
812 | int dy; | 812 | int dy; |
813 | if (isMultiItem) dy = 0; | 813 | if (isMultiItem) dy = 0; |
814 | else dy = gy - mCurrentCellY; | 814 | else dy = gy - mCurrentCellY; |
815 | moveItem->moveRelative(gx - mCurrentCellX,dy); | 815 | moveItem->moveRelative(gx - mCurrentCellX,dy); |
816 | int x,y; | 816 | int x,y; |
817 | gridToContents(moveItem->cellX(),moveItem->cellYTop(),x,y); | 817 | gridToContents(moveItem->cellX(),moveItem->cellYTop(),x,y); |
818 | moveItem->resize(mGridSpacingX * moveItem->cellWidth(), | 818 | moveItem->resize(mGridSpacingX * moveItem->cellWidth(), |
819 | mGridSpacingY * moveItem->cellHeight()); | 819 | mGridSpacingY * moveItem->cellHeight()); |
820 | moveChild(moveItem,x,y); | 820 | moveChild(moveItem,x,y); |
821 | moveItem = moveItem->nextMultiItem(); | 821 | moveItem = moveItem->nextMultiItem(); |
822 | } | 822 | } |
823 | } else if (mActionType == RESIZETOP) { | 823 | } else if (mActionType == RESIZETOP) { |
824 | if (mCurrentCellY <= mActionItem->cellYBottom()) { | 824 | if (mCurrentCellY <= mActionItem->cellYBottom()) { |
825 | mActionItem->expandTop(gy - mCurrentCellY); | 825 | mActionItem->expandTop(gy - mCurrentCellY); |
826 | mActionItem->resize(mActionItem->width(), | 826 | mActionItem->resize(mActionItem->width(), |
827 | mGridSpacingY * mActionItem->cellHeight()); | 827 | mGridSpacingY * mActionItem->cellHeight()); |
828 | int x,y; | 828 | int x,y; |
829 | gridToContents(mCurrentCellX,mActionItem->cellYTop(),x,y); | 829 | gridToContents(mCurrentCellX,mActionItem->cellYTop(),x,y); |
830 | //moveChild(mActionItem,childX(mActionItem),y); | 830 | //moveChild(mActionItem,childX(mActionItem),y); |
831 | QScrollView::moveChild( mActionItem,childX(mActionItem),y ); | 831 | QScrollView::moveChild( mActionItem,childX(mActionItem),y ); |
832 | } | 832 | } |
833 | } else if (mActionType == RESIZEBOTTOM) { | 833 | } else if (mActionType == RESIZEBOTTOM) { |
834 | if (mCurrentCellY >= mActionItem->cellYTop()) { | 834 | if (mCurrentCellY >= mActionItem->cellYTop()) { |
835 | mActionItem->expandBottom(gy - mCurrentCellY); | 835 | mActionItem->expandBottom(gy - mCurrentCellY); |
836 | mActionItem->resize(mActionItem->width(), | 836 | mActionItem->resize(mActionItem->width(), |
837 | mGridSpacingY * mActionItem->cellHeight()); | 837 | mGridSpacingY * mActionItem->cellHeight()); |
838 | } | 838 | } |
839 | } else if (mActionType == RESIZELEFT) { | 839 | } else if (mActionType == RESIZELEFT) { |
840 | if (mCurrentCellX <= mActionItem->cellXWidth()) { | 840 | if (mCurrentCellX <= mActionItem->cellXWidth()) { |
841 | mActionItem->expandLeft(gx - mCurrentCellX); | 841 | mActionItem->expandLeft(gx - mCurrentCellX); |
842 | mActionItem->resize(mGridSpacingX * mActionItem->cellWidth(), | 842 | mActionItem->resize(mGridSpacingX * mActionItem->cellWidth(), |
843 | mActionItem->height()); | 843 | mActionItem->height()); |
844 | int x,y; | 844 | int x,y; |
845 | gridToContents(mActionItem->cellX(),mActionItem->cellYTop(),x,y); | 845 | gridToContents(mActionItem->cellX(),mActionItem->cellYTop(),x,y); |
846 | moveChild(mActionItem,x,childY(mActionItem)); | 846 | moveChild(mActionItem,x,childY(mActionItem)); |
847 | } | 847 | } |
848 | } else if (mActionType == RESIZERIGHT) { | 848 | } else if (mActionType == RESIZERIGHT) { |
849 | if (mCurrentCellX >= mActionItem->cellX()) { | 849 | if (mCurrentCellX >= mActionItem->cellX()) { |
850 | mActionItem->expandRight(gx - mCurrentCellX); | 850 | mActionItem->expandRight(gx - mCurrentCellX); |
851 | mActionItem->resize(mGridSpacingX * mActionItem->cellWidth(), | 851 | mActionItem->resize(mGridSpacingX * mActionItem->cellWidth(), |
852 | mActionItem->height()); | 852 | mActionItem->height()); |
853 | } | 853 | } |
854 | } | 854 | } |
855 | mCurrentCellX = gx; | 855 | mCurrentCellX = gx; |
856 | mCurrentCellY = gy; | 856 | mCurrentCellY = gy; |
857 | } | 857 | } |
858 | } | 858 | } |
859 | 859 | ||
860 | void KOAgenda::endItemAction() | 860 | void KOAgenda::endItemAction() |
861 | { | 861 | { |
862 | 862 | ||
863 | if ( mItemMoved ) { | 863 | if ( mItemMoved ) { |
864 | KOAgendaItem *placeItem = mActionItem->firstMultiItem(); | 864 | KOAgendaItem *placeItem = mActionItem->firstMultiItem(); |
865 | if ( !placeItem ) { | 865 | if ( !placeItem ) { |
866 | placeItem = mActionItem; | 866 | placeItem = mActionItem; |
867 | } | 867 | } |
868 | if ( placeItem->incidence()->recurrence()->doesRecur() ) { | 868 | if ( placeItem->incidence()->recurrence()->doesRecur() ) { |
869 | Incidence* oldInc = placeItem->incidence(); | 869 | Incidence* oldInc = placeItem->incidence(); |
870 | placeItem->recreateIncidence(); | 870 | placeItem->recreateIncidence(); |
871 | emit addToCalSignal(placeItem->incidence(), oldInc ); | 871 | emit addToCalSignal(placeItem->incidence(), oldInc ); |
872 | } | 872 | } |
873 | int type = mActionType; | 873 | int type = mActionType; |
874 | if ( mAllDayMode ) | 874 | if ( mAllDayMode ) |
875 | type = -1; | 875 | type = -1; |
876 | KOAgendaItem *modifiedItem = placeItem; | 876 | KOAgendaItem *modifiedItem = placeItem; |
877 | //emit itemModified( placeItem, mActionType /*KOGlobals::EVENTEDITED */); | 877 | //emit itemModified( placeItem, mActionType /*KOGlobals::EVENTEDITED */); |
878 | QPtrList<KOAgendaItem> oldconflictItems ;//= placeItem->conflictItems(); | 878 | QPtrList<KOAgendaItem> oldconflictItems ;//= placeItem->conflictItems(); |
879 | KOAgendaItem *item; | 879 | KOAgendaItem *item; |
880 | 880 | ||
881 | if ( placeItem->incidence()->type() == "Todo" ) { | 881 | if ( placeItem->incidence()->type() == "Todo" ) { |
882 | mSelectedItem = 0; | 882 | mSelectedItem = 0; |
883 | //qDebug("todo %d %d %d ", mCurrentCellX, modifiedItem->cellX() ,modifiedItem->cellXWidth()); | 883 | //qDebug("todo %d %d %d ", mCurrentCellX, modifiedItem->cellX() ,modifiedItem->cellXWidth()); |
884 | modifiedItem->mLastMoveXPos = mCurrentCellX; | 884 | modifiedItem->mLastMoveXPos = mCurrentCellX; |
885 | emit itemModified( modifiedItem, mActionType ); | 885 | emit itemModified( modifiedItem, mActionType ); |
886 | } | 886 | } |
887 | else { | 887 | else { |
888 | #if 0 | 888 | #if 0 |
889 | for ( item=oldconflictItems.first(); item != 0; | 889 | for ( item=oldconflictItems.first(); item != 0; |
890 | item=oldconflictItems.next() ) { | 890 | item=oldconflictItems.next() ) { |
891 | placeSubCells(item); | 891 | placeSubCells(item); |
892 | } | 892 | } |
893 | while ( placeItem ) { | 893 | while ( placeItem ) { |
894 | //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1()); | 894 | //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1()); |
895 | placeSubCells( placeItem ); | 895 | placeSubCells( placeItem ); |
896 | placeItem = placeItem->nextMultiItem(); | 896 | placeItem = placeItem->nextMultiItem(); |
897 | } | 897 | } |
898 | #endif | 898 | #endif |
899 | 899 | ||
900 | globalFlagBlockAgendaItemPaint = 1; | 900 | globalFlagBlockAgendaItemPaint = 1; |
901 | for ( item=oldconflictItems.first(); item != 0; | 901 | for ( item=oldconflictItems.first(); item != 0; |
902 | item=oldconflictItems.next() ) { | 902 | item=oldconflictItems.next() ) { |
903 | placeSubCells(item); | 903 | placeSubCells(item); |
904 | } | 904 | } |
905 | while ( placeItem ) { | 905 | while ( placeItem ) { |
906 | //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1()); | 906 | //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1()); |
907 | oldconflictItems = placeItem->conflictItems(); | 907 | oldconflictItems = placeItem->conflictItems(); |
908 | for ( item=oldconflictItems.first(); item != 0; | 908 | for ( item=oldconflictItems.first(); item != 0; |
909 | item=oldconflictItems.next() ) { | 909 | item=oldconflictItems.next() ) { |
910 | placeSubCells(item); | 910 | placeSubCells(item); |
911 | } | 911 | } |
912 | placeSubCells( placeItem ); | 912 | placeSubCells( placeItem ); |
913 | placeItem = placeItem->nextMultiItem(); | 913 | placeItem = placeItem->nextMultiItem(); |
914 | } | 914 | } |
915 | globalFlagBlockAgendaItemPaint = 0; | 915 | globalFlagBlockAgendaItemPaint = 0; |
916 | for ( item=oldconflictItems.first(); item != 0; | 916 | for ( item=oldconflictItems.first(); item != 0; |
917 | item=oldconflictItems.next() ) { | 917 | item=oldconflictItems.next() ) { |
918 | globalFlagBlockAgendaItemUpdate = 0; | 918 | globalFlagBlockAgendaItemUpdate = 0; |
919 | item->repaintMe(); | 919 | item->repaintMe(); |
920 | globalFlagBlockAgendaItemUpdate = 1; | 920 | globalFlagBlockAgendaItemUpdate = 1; |
921 | item->repaint( false ); | 921 | item->repaint( false ); |
922 | } | 922 | } |
923 | placeItem = modifiedItem; | 923 | placeItem = modifiedItem; |
924 | 924 | ||
925 | while ( placeItem ) { | 925 | while ( placeItem ) { |
926 | //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1()); | 926 | //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1()); |
927 | globalFlagBlockAgendaItemUpdate = 0; | 927 | globalFlagBlockAgendaItemUpdate = 0; |
928 | placeItem->repaintMe(); | 928 | placeItem->repaintMe(); |
929 | globalFlagBlockAgendaItemUpdate = 1; | 929 | globalFlagBlockAgendaItemUpdate = 1; |
930 | placeItem->repaint(false); | 930 | placeItem->repaint(false); |
931 | placeItem = placeItem->nextMultiItem(); | 931 | placeItem = placeItem->nextMultiItem(); |
932 | } | 932 | } |
933 | emit itemModified( modifiedItem, mActionType ); | 933 | emit itemModified( modifiedItem, mActionType ); |
934 | 934 | ||
935 | 935 | ||
936 | placeItem = modifiedItem; | 936 | placeItem = modifiedItem; |
937 | while ( placeItem ) { | 937 | while ( placeItem ) { |
938 | oldconflictItems = placeItem->conflictItems(); | 938 | oldconflictItems = placeItem->conflictItems(); |
939 | for ( item=oldconflictItems.first(); item != 0; | 939 | for ( item=oldconflictItems.first(); item != 0; |
940 | item=oldconflictItems.next() ) { | 940 | item=oldconflictItems.next() ) { |
941 | placeSubCells(item); | 941 | placeSubCells(item); |
942 | } | 942 | } |
943 | placeSubCells( placeItem ); | 943 | placeSubCells( placeItem ); |
944 | placeItem = placeItem->nextMultiItem(); | 944 | placeItem = placeItem->nextMultiItem(); |
945 | 945 | ||
946 | } | 946 | } |
947 | placeItem = modifiedItem; | 947 | placeItem = modifiedItem; |
948 | while ( placeItem ) { | 948 | while ( placeItem ) { |
949 | oldconflictItems = placeItem->conflictItems(); | 949 | oldconflictItems = placeItem->conflictItems(); |
950 | for ( item=oldconflictItems.first(); item != 0; | 950 | for ( item=oldconflictItems.first(); item != 0; |
951 | item=oldconflictItems.next() ) { | 951 | item=oldconflictItems.next() ) { |
952 | globalFlagBlockAgendaItemUpdate = 0; | 952 | globalFlagBlockAgendaItemUpdate = 0; |
953 | item->repaintMe(); | 953 | item->repaintMe(); |
954 | globalFlagBlockAgendaItemUpdate = 1; | 954 | globalFlagBlockAgendaItemUpdate = 1; |
955 | item->repaint(false); | 955 | item->repaint(false); |
956 | } | 956 | } |
957 | placeItem = placeItem->nextMultiItem(); | 957 | placeItem = placeItem->nextMultiItem(); |
958 | } | 958 | } |
959 | /* | 959 | /* |
960 | 960 | ||
961 | oldconflictItems = modifiedItem->conflictItems(); | 961 | oldconflictItems = modifiedItem->conflictItems(); |
962 | for ( item=oldconflictItems.first(); item != 0; | 962 | for ( item=oldconflictItems.first(); item != 0; |
963 | item=oldconflictItems.next() ) { | 963 | item=oldconflictItems.next() ) { |
964 | globalFlagBlockAgendaItemUpdate = 0; | 964 | globalFlagBlockAgendaItemUpdate = 0; |
965 | item->paintMe(false); | 965 | item->paintMe(false); |
966 | globalFlagBlockAgendaItemUpdate = 1; | 966 | globalFlagBlockAgendaItemUpdate = 1; |
967 | item->repaint(false); | 967 | item->repaint(false); |
968 | } | 968 | } |
969 | */ | 969 | */ |
970 | 970 | ||
971 | 971 | ||
972 | } | 972 | } |
973 | 973 | ||
974 | } | 974 | } |
975 | 975 | ||
976 | mScrollUpTimer.stop(); | 976 | mScrollUpTimer.stop(); |
977 | mScrollDownTimer.stop(); | 977 | mScrollDownTimer.stop(); |
978 | setCursor( arrowCursor ); | 978 | setCursor( arrowCursor ); |
979 | mActionItem = 0; | 979 | mActionItem = 0; |
980 | mActionType = NOP; | 980 | mActionType = NOP; |
981 | mItemMoved = 0; | 981 | mItemMoved = 0; |
982 | 982 | ||
983 | } | 983 | } |
984 | 984 | ||
985 | void KOAgenda::setNoActionCursor(KOAgendaItem *moveItem,QPoint viewportPos) | 985 | void KOAgenda::setNoActionCursor(KOAgendaItem *moveItem,QPoint viewportPos) |
986 | { | 986 | { |
987 | // kdDebug() << "viewportPos: " << viewportPos.x() << "," << viewportPos.y() << endl; | 987 | // kdDebug() << "viewportPos: " << viewportPos.x() << "," << viewportPos.y() << endl; |
988 | // QPoint point = viewport()->mapToGlobal(viewportPos); | 988 | // QPoint point = viewport()->mapToGlobal(viewportPos); |
989 | // kdDebug() << "Global: " << point.x() << "," << point.y() << endl; | 989 | // kdDebug() << "Global: " << point.x() << "," << point.y() << endl; |
990 | // point = clipper()->mapFromGlobal(point); | 990 | // point = clipper()->mapFromGlobal(point); |
991 | // kdDebug() << "clipper: " << point.x() << "," << point.y() << endl; | 991 | // kdDebug() << "clipper: " << point.x() << "," << point.y() << endl; |
992 | 992 | ||
993 | int x,y; | 993 | int x,y; |
994 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 994 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
995 | // kdDebug() << "contents: " << x << "," << y << "\n" << endl; | 995 | // kdDebug() << "contents: " << x << "," << y << "\n" << endl; |
996 | int gx,gy; | 996 | int gx,gy; |
997 | contentsToGrid(x,y,gx,gy); | 997 | contentsToGrid(x,y,gx,gy); |
998 | 998 | ||
999 | // Change cursor to resize cursor if appropriate | 999 | // Change cursor to resize cursor if appropriate |
1000 | if (mAllDayMode) { | 1000 | if (mAllDayMode) { |
1001 | int gridDistanceX = (x - gx * mGridSpacingX); | 1001 | int gridDistanceX = (x - gx * mGridSpacingX); |
1002 | if (gridDistanceX < mResizeBorderWidth && | 1002 | if (gridDistanceX < mResizeBorderWidth && |
1003 | moveItem->cellX() == gx) { | 1003 | moveItem->cellX() == gx) { |
1004 | setCursor(sizeHorCursor); | 1004 | setCursor(sizeHorCursor); |
1005 | } else if ((mGridSpacingX - gridDistanceX) < mResizeBorderWidth && | 1005 | } else if ((mGridSpacingX - gridDistanceX) < mResizeBorderWidth && |
1006 | moveItem->cellXWidth() == gx) { | 1006 | moveItem->cellXWidth() == gx) { |
1007 | setCursor(sizeHorCursor); | 1007 | setCursor(sizeHorCursor); |
1008 | } else { | 1008 | } else { |
1009 | setCursor(arrowCursor); | 1009 | setCursor(arrowCursor); |
1010 | } | 1010 | } |
1011 | } else { | 1011 | } else { |
1012 | int gridDistanceY = (y - gy * mGridSpacingY); | 1012 | int gridDistanceY = (y - gy * mGridSpacingY); |
1013 | if (gridDistanceY < mResizeBorderWidth && | 1013 | if (gridDistanceY < mResizeBorderWidth && |
1014 | moveItem->cellYTop() == gy && | 1014 | moveItem->cellYTop() == gy && |
1015 | !moveItem->firstMultiItem()) { | 1015 | !moveItem->firstMultiItem()) { |
1016 | setCursor(sizeVerCursor); | 1016 | setCursor(sizeVerCursor); |
1017 | } else if ((mGridSpacingY - gridDistanceY) < mResizeBorderWidth && | 1017 | } else if ((mGridSpacingY - gridDistanceY) < mResizeBorderWidth && |
1018 | moveItem->cellYBottom() == gy && | 1018 | moveItem->cellYBottom() == gy && |
1019 | !moveItem->lastMultiItem()) { | 1019 | !moveItem->lastMultiItem()) { |
1020 | setCursor(sizeVerCursor); | 1020 | setCursor(sizeVerCursor); |
1021 | } else { | 1021 | } else { |
1022 | setCursor(arrowCursor); | 1022 | setCursor(arrowCursor); |
1023 | } | 1023 | } |
1024 | } | 1024 | } |
1025 | } | 1025 | } |
1026 | 1026 | ||
1027 | 1027 | ||
1028 | /* | 1028 | /* |
1029 | Place item in cell and take care that multiple items using the same cell do | 1029 | Place item in cell and take care that multiple items using the same cell do |
1030 | not overlap. This method is not yet optimal. It doesn´t use the maximum space | 1030 | not overlap. This method is not yet optimal. It doesn´t use the maximum space |
1031 | it can get in all cases. | 1031 | it can get in all cases. |
1032 | At the moment the method has a bug: When an item is placed only the sub cell | 1032 | At the moment the method has a bug: When an item is placed only the sub cell |
1033 | widths of the items are changed, which are within the Y region the item to | 1033 | widths of the items are changed, which are within the Y region the item to |
1034 | place spans. When the sub cell width change of one of this items affects a | 1034 | place spans. When the sub cell width change of one of this items affects a |
1035 | cell, where other items are, which do not overlap in Y with the item to place, | 1035 | cell, where other items are, which do not overlap in Y with the item to place, |
1036 | the display gets corrupted, although the corruption looks quite nice. | 1036 | the display gets corrupted, although the corruption looks quite nice. |
1037 | */ | 1037 | */ |
1038 | void KOAgenda::placeSubCells(KOAgendaItem *placeItem) | 1038 | void KOAgenda::placeSubCells(KOAgendaItem *placeItem) |
1039 | { | 1039 | { |
1040 | 1040 | ||
1041 | QPtrList<KOAgendaItem> conflictItems; | 1041 | QPtrList<KOAgendaItem> conflictItems; |
1042 | int maxSubCells = 0; | 1042 | int maxSubCells = 0; |
1043 | QIntDict<KOAgendaItem> subCellDict(5); | 1043 | QIntDict<KOAgendaItem> subCellDict(5); |
1044 | 1044 | ||
1045 | KOAgendaItem *item; | 1045 | KOAgendaItem *item; |
1046 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 1046 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
1047 | if (item != placeItem) { | 1047 | if (item != placeItem) { |
1048 | if (placeItem->cellX() <= item->cellXWidth() && | 1048 | if (placeItem->cellX() <= item->cellXWidth() && |
1049 | placeItem->cellXWidth() >= item->cellX()) { | 1049 | placeItem->cellXWidth() >= item->cellX()) { |
1050 | if ((placeItem->cellYTop() <= item->cellYBottom()) && | 1050 | if ((placeItem->cellYTop() <= item->cellYBottom()) && |
1051 | (placeItem->cellYBottom() >= item->cellYTop())) { | 1051 | (placeItem->cellYBottom() >= item->cellYTop())) { |
1052 | conflictItems.append(item); | 1052 | conflictItems.append(item); |
1053 | if (item->subCells() > maxSubCells) | 1053 | if (item->subCells() > maxSubCells) |
1054 | maxSubCells = item->subCells(); | 1054 | maxSubCells = item->subCells(); |
1055 | subCellDict.insert(item->subCell(),item); | 1055 | subCellDict.insert(item->subCell(),item); |
1056 | } | 1056 | } |
1057 | } | 1057 | } |
1058 | } | 1058 | } |
1059 | } | 1059 | } |
1060 | 1060 | ||
1061 | if (conflictItems.count() > 0) { | 1061 | if (conflictItems.count() > 0) { |
1062 | // Look for unused sub cell and insert item | 1062 | // Look for unused sub cell and insert item |
1063 | int i; | 1063 | int i; |
1064 | for(i=0;i<maxSubCells;++i) { | 1064 | for(i=0;i<maxSubCells;++i) { |
1065 | if (!subCellDict.find(i)) { | 1065 | if (!subCellDict.find(i)) { |
1066 | placeItem->setSubCell(i); | 1066 | placeItem->setSubCell(i); |
1067 | break; | 1067 | break; |
1068 | } | 1068 | } |
1069 | } | 1069 | } |
1070 | if (i == maxSubCells) { | 1070 | if (i == maxSubCells) { |
1071 | placeItem->setSubCell(maxSubCells); | 1071 | placeItem->setSubCell(maxSubCells); |
1072 | maxSubCells++; // add new item to number of sub cells | 1072 | maxSubCells++; // add new item to number of sub cells |
1073 | } | 1073 | } |
1074 | 1074 | ||
1075 | // Prepare for sub cell geometry adjustment | 1075 | // Prepare for sub cell geometry adjustment |
1076 | int newSubCellWidth; | 1076 | int newSubCellWidth; |
1077 | if (mAllDayMode) newSubCellWidth = mGridSpacingY / maxSubCells; | 1077 | if (mAllDayMode) newSubCellWidth = mGridSpacingY / maxSubCells; |
1078 | else newSubCellWidth = mGridSpacingX / maxSubCells; | 1078 | else newSubCellWidth = mGridSpacingX / maxSubCells; |
1079 | conflictItems.append(placeItem); | 1079 | conflictItems.append(placeItem); |
1080 | 1080 | ||
1081 | 1081 | ||
1082 | // Adjust sub cell geometry of all items | 1082 | // Adjust sub cell geometry of all direct conflict items |
1083 | for ( item=conflictItems.first(); item != 0; | 1083 | for ( item=conflictItems.first(); item != 0; |
1084 | item=conflictItems.next() ) { | 1084 | item=conflictItems.next() ) { |
1085 | item->setSubCells(maxSubCells); | 1085 | item->setSubCells(maxSubCells); |
1086 | if (mAllDayMode) { | 1086 | if (mAllDayMode) { |
1087 | item->resize(item->cellWidth() * mGridSpacingX, newSubCellWidth); | 1087 | item->resize(item->cellWidth() * mGridSpacingX, newSubCellWidth); |
1088 | } else { | 1088 | } else { |
1089 | item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY); | 1089 | item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY); |
1090 | } | 1090 | } |
1091 | int x,y; | 1091 | int x,y; |
1092 | gridToContents(item->cellX(),item->cellYTop(),x,y); | 1092 | gridToContents(item->cellX(),item->cellYTop(),x,y); |
1093 | if (mAllDayMode) { | 1093 | if (mAllDayMode) { |
1094 | y += item->subCell() * newSubCellWidth; | 1094 | y += item->subCell() * newSubCellWidth; |
1095 | } else { | 1095 | } else { |
1096 | x += item->subCell() * newSubCellWidth; | 1096 | x += item->subCell() * newSubCellWidth; |
1097 | } | 1097 | } |
1098 | moveChild(item,x,y); | 1098 | moveChild(item,x,y); |
1099 | // qDebug("moveChild %s %d %d ", item->incidence()->summary().latin1() ,x,y); | 1099 | // qDebug("moveChild %s %d %d ", item->incidence()->summary().latin1() ,x,y); |
1100 | //item->updateItem(); | 1100 | //item->updateItem(); |
1101 | } | 1101 | } |
1102 | 1102 | // Adjust sub cell geometry of all conflict items of all conflict items | |
1103 | for ( item=conflictItems.first(); item != 0; | ||
1104 | item=conflictItems.next() ) { | ||
1105 | if ( placeItem != item ) { | ||
1106 | KOAgendaItem *item2; | ||
1107 | QPtrList<KOAgendaItem> conflictItems2 = item->conflictItems(); | ||
1108 | for ( item2=conflictItems2.first(); item2 != 0; | ||
1109 | item2=conflictItems2.next() ) { | ||
1110 | if ( item2->subCells() != maxSubCells) { | ||
1111 | item2->setSubCells(maxSubCells); | ||
1112 | if (mAllDayMode) { | ||
1113 | item2->resize(item2->cellWidth() * mGridSpacingX, newSubCellWidth); | ||
1114 | } else { | ||
1115 | item2->resize(newSubCellWidth, item2->cellHeight() * mGridSpacingY); | ||
1116 | } | ||
1117 | int x,y; | ||
1118 | gridToContents(item2->cellX(),item2->cellYTop(),x,y); | ||
1119 | if (mAllDayMode) { | ||
1120 | y += item2->subCell() * newSubCellWidth; | ||
1121 | } else { | ||
1122 | x += item2->subCell() * newSubCellWidth; | ||
1123 | } | ||
1124 | moveChild(item2,x,y); | ||
1125 | //qDebug("setttttt %d %s",maxSubCells, item2->text().latin1() ); | ||
1126 | } | ||
1127 | } | ||
1128 | } | ||
1129 | } | ||
1103 | } else { | 1130 | } else { |
1104 | placeItem->setSubCell(0); | 1131 | placeItem->setSubCell(0); |
1105 | placeItem->setSubCells(1); | 1132 | placeItem->setSubCells(1); |
1106 | if (mAllDayMode) placeItem->resize(placeItem->width(),mGridSpacingY); | 1133 | if (mAllDayMode) placeItem->resize(placeItem->width(),mGridSpacingY); |
1107 | else placeItem->resize(mGridSpacingX,placeItem->height()); | 1134 | else placeItem->resize(mGridSpacingX,placeItem->height()); |
1108 | int x,y; | 1135 | int x,y; |
1109 | gridToContents(placeItem->cellX(),placeItem->cellYTop(),x,y); | 1136 | gridToContents(placeItem->cellX(),placeItem->cellYTop(),x,y); |
1110 | moveChild(placeItem,x,y); | 1137 | moveChild(placeItem,x,y); |
1111 | } | 1138 | } |
1112 | placeItem->setConflictItems(conflictItems); | 1139 | placeItem->setConflictItems(conflictItems); |
1113 | // for ( item=conflictItems.first(); item != 0; | 1140 | // for ( item=conflictItems.first(); item != 0; |
1114 | // item=conflictItems.next() ) { | 1141 | // item=conflictItems.next() ) { |
1115 | // //item->updateItem(); | 1142 | // //item->updateItem(); |
1116 | // //qDebug("xxx item->updateItem() %s %d %d", item->incidence()->summary().latin1(),item->x(), item->y() ); | 1143 | // //qDebug("xxx item->updateItem() %s %d %d", item->incidence()->summary().latin1(),item->x(), item->y() ); |
1117 | // } | 1144 | // } |
1118 | // placeItem->updateItem(); | 1145 | // placeItem->updateItem(); |
1119 | } | 1146 | } |
1120 | 1147 | ||
1121 | void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) | 1148 | void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) |
1122 | { | 1149 | { |
1123 | if ( globalFlagBlockAgenda ) | 1150 | if ( globalFlagBlockAgenda ) |
1124 | return; | 1151 | return; |
1125 | //qDebug("KOAgenda::drawContents "); | 1152 | //qDebug("KOAgenda::drawContents "); |
1126 | if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) | 1153 | if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) |
1127 | ;//drawContentsToPainter(); | 1154 | ;//drawContentsToPainter(); |
1128 | 1155 | ||
1129 | QPaintDevice* pd = p->device(); | 1156 | QPaintDevice* pd = p->device(); |
1130 | p->end(); | 1157 | p->end(); |
1131 | int vx, vy; | 1158 | int vx, vy; |
1132 | int selectionX = KOGlobals::self()->reverseLayout() ? | 1159 | int selectionX = KOGlobals::self()->reverseLayout() ? |
1133 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : | 1160 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : |
1134 | mSelectionCellX * mGridSpacingX; | 1161 | mSelectionCellX * mGridSpacingX; |
1135 | contentsToViewport ( cx, cy, vx,vy); | 1162 | contentsToViewport ( cx, cy, vx,vy); |
1136 | // qDebug(" %d %d %d %d ", cx, cy, cw,ch) ; | 1163 | // qDebug(" %d %d %d %d ", cx, cy, cw,ch) ; |
1137 | if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) | 1164 | if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) |
1138 | bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); | 1165 | bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); |
1139 | 1166 | ||
1140 | if ( mSelectionHeight > 0 ) { | 1167 | if ( mSelectionHeight > 0 ) { |
1141 | //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight ); | 1168 | //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight ); |
1142 | if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && | 1169 | if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && |
1143 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { | 1170 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { |
1144 | contentsToViewport ( selectionX, mSelectionYTop, vx,vy); | 1171 | contentsToViewport ( selectionX, mSelectionYTop, vx,vy); |
1145 | bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP); | 1172 | bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP); |
1146 | } | 1173 | } |
1147 | } | 1174 | } |
1148 | //qDebug("btbl "); | 1175 | //qDebug("btbl "); |
1149 | p->begin( pd ); | 1176 | p->begin( pd ); |
1150 | //qDebug("end "); | 1177 | //qDebug("end "); |
1151 | } | 1178 | } |
1152 | 1179 | ||
1153 | void KOAgenda::finishUpdate() | 1180 | void KOAgenda::finishUpdate() |
1154 | { | 1181 | { |
1155 | 1182 | ||
1156 | KOAgendaItem *item; | 1183 | KOAgendaItem *item; |
1157 | globalFlagBlockAgendaItemPaint = 1; | 1184 | globalFlagBlockAgendaItemPaint = 1; |
1158 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 1185 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
1159 | if ( !item->isVisible() ) | 1186 | if ( !item->isVisible() ) |
1160 | item->show(); | 1187 | item->show(); |
1161 | 1188 | ||
1162 | } | 1189 | } |
1163 | globalFlagBlockAgendaItemUpdate = 0; | 1190 | globalFlagBlockAgendaItemUpdate = 0; |
1164 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 1191 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
1165 | item->repaintMe( ); | 1192 | item->repaintMe( ); |
1166 | } | 1193 | } |
1167 | globalFlagBlockAgendaItemUpdate = 1; | 1194 | globalFlagBlockAgendaItemUpdate = 1; |
1168 | qApp->processEvents(); | 1195 | qApp->processEvents(); |
1169 | globalFlagBlockAgendaItemPaint = 0; | 1196 | globalFlagBlockAgendaItemPaint = 0; |
1170 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 1197 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
1171 | item->repaint( false ); | 1198 | item->repaint( false ); |
1172 | } | 1199 | } |
1173 | 1200 | ||
1174 | } | 1201 | } |
1175 | 1202 | ||
1176 | /* | 1203 | /* |
1177 | Draw grid in the background of the agenda. | 1204 | Draw grid in the background of the agenda. |
1178 | */ | 1205 | */ |
1179 | void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// int cx, int cy, int cw, int ch) | 1206 | void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// int cx, int cy, int cw, int ch) |
1180 | { | 1207 | { |
1181 | 1208 | ||
1182 | 1209 | ||
1183 | if ( ! mGridSpacingX || ! mGridSpacingY ||! mHolidayMask ) | 1210 | if ( ! mGridSpacingX || ! mGridSpacingY ||! mHolidayMask ) |
1184 | return; | 1211 | return; |
1185 | if ( globalFlagBlockAgenda > 1 && globalFlagBlockAgenda < 4 ) | 1212 | if ( globalFlagBlockAgenda > 1 && globalFlagBlockAgenda < 4 ) |
1186 | return; | 1213 | return; |
1187 | int cx = 0, cy = 0, cw = contentsWidth(), ch = contentsHeight(); | 1214 | int cx = 0, cy = 0, cw = contentsWidth(), ch = contentsHeight(); |
1188 | if ( ch < 1 ) | 1215 | if ( ch < 1 ) |
1189 | ch = 1; | 1216 | ch = 1; |
1190 | if ( mPaintPixmap.width() < contentsWidth()+42 || mPaintPixmap.height() < ch ) { | 1217 | if ( mPaintPixmap.width() < contentsWidth()+42 || mPaintPixmap.height() < ch ) { |
1191 | mPaintPixmap.resize( contentsWidth()+42, ch ); | 1218 | mPaintPixmap.resize( contentsWidth()+42, ch ); |
1192 | } | 1219 | } |
1193 | mCurPixWid = contentsWidth(); | 1220 | mCurPixWid = contentsWidth(); |
1194 | mCurPixHei = ch; | 1221 | mCurPixHei = ch; |
1195 | if ( mHighlightPixmap.width() < mGridSpacingX-1 || mHighlightPixmap.height() < ch ) { | 1222 | if ( mHighlightPixmap.width() < mGridSpacingX-1 || mHighlightPixmap.height() < ch ) { |
1196 | mHighlightPixmap.resize( mGridSpacingX-1, ch ); | 1223 | mHighlightPixmap.resize( mGridSpacingX-1, ch ); |
1197 | mHighlightPixmap.fill ( KOPrefs::instance()->mHighlightColor ); | 1224 | mHighlightPixmap.fill ( KOPrefs::instance()->mHighlightColor ); |
1198 | } | 1225 | } |
1199 | mPixPainter.begin( &mPaintPixmap) ; | 1226 | mPixPainter.begin( &mPaintPixmap) ; |
1200 | //qDebug("wid %d hei %d ",mPaintPixmap.width(),mPaintPixmap.height() ); | 1227 | //qDebug("wid %d hei %d ",mPaintPixmap.width(),mPaintPixmap.height() ); |
1201 | QPainter * p ; | 1228 | QPainter * p ; |
1202 | if (paint == 0) { | 1229 | if (paint == 0) { |
1203 | mPaintPixmap.fill(KOPrefs::instance()->mAgendaBgColor); | 1230 | mPaintPixmap.fill(KOPrefs::instance()->mAgendaBgColor); |
1204 | p = &mPixPainter; | 1231 | p = &mPixPainter; |
1205 | } | 1232 | } |
1206 | else | 1233 | else |
1207 | p = paint ; | 1234 | p = paint ; |
1208 | // qDebug("++++++KOAgenda::drawContentsTo Painter %d %d %d %d ", cx, cy, cw, ch); | 1235 | // qDebug("++++++KOAgenda::drawContentsTo Painter %d %d %d %d ", cx, cy, cw, ch); |
1209 | 1236 | ||
1210 | //--cx;++cw; | 1237 | //--cx;++cw; |
1211 | int lGridSpacingY = mGridSpacingY*2; | 1238 | int lGridSpacingY = mGridSpacingY*2; |
1212 | int selDay; | 1239 | int selDay; |
1213 | if ( !backgroundOnly ) | 1240 | if ( !backgroundOnly ) |
1214 | for ( selDay = 0; selDay < mSelectedDates.count(); ++selDay) | 1241 | for ( selDay = 0; selDay < mSelectedDates.count(); ++selDay) |
1215 | { | 1242 | { |
1216 | if ( mSelectedDates[selDay] == QDateTime::currentDateTime ().date() && KOPrefs::instance()->mHighlightCurrentDay) { | 1243 | if ( mSelectedDates[selDay] == QDateTime::currentDateTime ().date() && KOPrefs::instance()->mHighlightCurrentDay) { |
1217 | int x1 = cx; | 1244 | int x1 = cx; |
1218 | int y1 = 0; | 1245 | int y1 = 0; |
1219 | if (y1 < cy) y1 = cy; | 1246 | if (y1 < cy) y1 = cy; |
1220 | int x2 = cx+cw-1; | 1247 | int x2 = cx+cw-1; |
1221 | int y2 = contentsHeight(); | 1248 | int y2 = contentsHeight(); |
1222 | if (y2 > cy+ch-1) y2=cy+ch-1; | 1249 | if (y2 > cy+ch-1) y2=cy+ch-1; |
1223 | if (x2 >= x1 && y2 >= y1) { | 1250 | if (x2 >= x1 && y2 >= y1) { |
1224 | int gxStart = selDay; | 1251 | int gxStart = selDay; |
1225 | int gxEnd = gxStart ; | 1252 | int gxEnd = gxStart ; |
1226 | int xStart = KOGlobals::self()->reverseLayout() ? | 1253 | int xStart = KOGlobals::self()->reverseLayout() ? |
1227 | (mColumns - 1 - gxStart)*mGridSpacingX : | 1254 | (mColumns - 1 - gxStart)*mGridSpacingX : |
1228 | gxStart*mGridSpacingX; | 1255 | gxStart*mGridSpacingX; |
1229 | if (xStart < x1) xStart = x1; | 1256 | if (xStart < x1) xStart = x1; |
1230 | int xEnd = KOGlobals::self()->reverseLayout() ? | 1257 | int xEnd = KOGlobals::self()->reverseLayout() ? |
1231 | (mColumns - gxStart)*mGridSpacingX-1 : | 1258 | (mColumns - gxStart)*mGridSpacingX-1 : |
1232 | (gxStart+1)*mGridSpacingX-1; | 1259 | (gxStart+1)*mGridSpacingX-1; |
1233 | if (xEnd > x2) xEnd = x2; | 1260 | if (xEnd > x2) xEnd = x2; |
1234 | if ( KOPrefs::instance()->mUseHighlightLightColor ) | 1261 | if ( KOPrefs::instance()->mUseHighlightLightColor ) |
1235 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, | 1262 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, |
1236 | KOPrefs::instance()->mAgendaBgColor.light()); | 1263 | KOPrefs::instance()->mAgendaBgColor.light()); |
1237 | else | 1264 | else |
1238 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, | 1265 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, |
1239 | KOPrefs::instance()->mAgendaBgColor.dark()); | 1266 | KOPrefs::instance()->mAgendaBgColor.dark()); |
1240 | 1267 | ||
1241 | } | 1268 | } |
1242 | } | 1269 | } |
1243 | } | 1270 | } |
1244 | // Highlight working hours | 1271 | // Highlight working hours |
1245 | 1272 | ||
1246 | if ( !backgroundOnly ) | 1273 | if ( !backgroundOnly ) |
1247 | if (mWorkingHoursEnable) { | 1274 | if (mWorkingHoursEnable) { |
1248 | int x1 = cx; | 1275 | int x1 = cx; |
1249 | int y1 = mWorkingHoursYTop; | 1276 | int y1 = mWorkingHoursYTop; |
1250 | if (y1 < cy) y1 = cy; | 1277 | if (y1 < cy) y1 = cy; |
1251 | int x2 = cx+cw-1; | 1278 | int x2 = cx+cw-1; |
1252 | // int x2 = mGridSpacingX * 5 - 1; | 1279 | // int x2 = mGridSpacingX * 5 - 1; |
1253 | // if (x2 > cx+cw-1) x2 = cx + cw - 1; | 1280 | // if (x2 > cx+cw-1) x2 = cx + cw - 1; |
1254 | int y2 = mWorkingHoursYBottom; | 1281 | int y2 = mWorkingHoursYBottom; |
1255 | if (y2 > cy+ch-1) y2=cy+ch-1; | 1282 | if (y2 > cy+ch-1) y2=cy+ch-1; |
1256 | 1283 | ||
1257 | if (x2 >= x1 && y2 >= y1) { | 1284 | if (x2 >= x1 && y2 >= y1) { |
1258 | // qDebug("x1 %d mGridSpacingX %d ", x1, mGridSpacingX ); | 1285 | // qDebug("x1 %d mGridSpacingX %d ", x1, mGridSpacingX ); |
1259 | int gxStart = x1/mGridSpacingX; | 1286 | int gxStart = x1/mGridSpacingX; |
1260 | int gxEnd = x2/mGridSpacingX; | 1287 | int gxEnd = x2/mGridSpacingX; |
1261 | while(gxStart <= gxEnd) { | 1288 | while(gxStart <= gxEnd) { |
1262 | if (gxStart < int(mHolidayMask->count()) && | 1289 | if (gxStart < int(mHolidayMask->count()) && |
1263 | !mHolidayMask->at(gxStart)) { | 1290 | !mHolidayMask->at(gxStart)) { |
1264 | int xStart = KOGlobals::self()->reverseLayout() ? | 1291 | int xStart = KOGlobals::self()->reverseLayout() ? |
1265 | (mColumns - 1 - gxStart)*mGridSpacingX : | 1292 | (mColumns - 1 - gxStart)*mGridSpacingX : |
1266 | gxStart*mGridSpacingX; | 1293 | gxStart*mGridSpacingX; |
1267 | if (xStart < x1) xStart = x1; | 1294 | if (xStart < x1) xStart = x1; |
1268 | int xEnd = KOGlobals::self()->reverseLayout() ? | 1295 | int xEnd = KOGlobals::self()->reverseLayout() ? |
1269 | (mColumns - gxStart)*mGridSpacingX-1 : | 1296 | (mColumns - gxStart)*mGridSpacingX-1 : |
1270 | (gxStart+1)*mGridSpacingX-1; | 1297 | (gxStart+1)*mGridSpacingX-1; |
1271 | if (xEnd > x2) xEnd = x2; | 1298 | if (xEnd > x2) xEnd = x2; |
1272 | if ( mSelectedDates[gxStart] == QDateTime::currentDateTime ().date()&& KOPrefs::instance()->mHighlightCurrentDay ) { | 1299 | if ( mSelectedDates[gxStart] == QDateTime::currentDateTime ().date()&& KOPrefs::instance()->mHighlightCurrentDay ) { |
1273 | if ( KOPrefs::instance()->mUseHighlightLightColor ) | 1300 | if ( KOPrefs::instance()->mUseHighlightLightColor ) |
1274 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, | 1301 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, |
1275 | KOPrefs::instance()->mWorkingHoursColor.light()); | 1302 | KOPrefs::instance()->mWorkingHoursColor.light()); |
1276 | else | 1303 | else |
1277 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, | 1304 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, |
1278 | KOPrefs::instance()->mWorkingHoursColor.dark()); | 1305 | KOPrefs::instance()->mWorkingHoursColor.dark()); |
1279 | } else { | 1306 | } else { |
1280 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, | 1307 | p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, |
1281 | KOPrefs::instance()->mWorkingHoursColor); | 1308 | KOPrefs::instance()->mWorkingHoursColor); |
1282 | } | 1309 | } |
1283 | } | 1310 | } |
1284 | ++gxStart; | 1311 | ++gxStart; |
1285 | } | 1312 | } |
1286 | } | 1313 | } |
1287 | } | 1314 | } |
1288 | /* | 1315 | /* |
1289 | int selectionX = KOGlobals::self()->reverseLayout() ? | 1316 | int selectionX = KOGlobals::self()->reverseLayout() ? |
1290 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : | 1317 | (mColumns - 1 - mSelectionCellX) * mGridSpacingX : |
1291 | mSelectionCellX * mGridSpacingX; | 1318 | mSelectionCellX * mGridSpacingX; |
1292 | 1319 | ||
1293 | // Draw selection | 1320 | // Draw selection |
1294 | if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && | 1321 | if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && |
1295 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { | 1322 | ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { |
1296 | // TODO: paint only part within cx,cy,cw,ch | 1323 | // TODO: paint only part within cx,cy,cw,ch |
1297 | p->fillRect( selectionX, mSelectionYTop, mGridSpacingX, | 1324 | p->fillRect( selectionX, mSelectionYTop, mGridSpacingX, |
1298 | mSelectionHeight, KOPrefs::instance()->mHighlightColor ); | 1325 | mSelectionHeight, KOPrefs::instance()->mHighlightColor ); |
1299 | } | 1326 | } |
1300 | */ | 1327 | */ |
1301 | // Draw vertical lines of grid | 1328 | // Draw vertical lines of grid |
1302 | 1329 | ||
1303 | int x = ((int)(cx/mGridSpacingX))*mGridSpacingX; | 1330 | int x = ((int)(cx/mGridSpacingX))*mGridSpacingX; |
1304 | if ( mGridSpacingX > 0 ) { | 1331 | if ( mGridSpacingX > 0 ) { |
1305 | while (x < cx + cw) { | 1332 | while (x < cx + cw) { |
1306 | p->drawLine(x,cy,x,cy+ch); | 1333 | p->drawLine(x,cy,x,cy+ch); |
1307 | x+=mGridSpacingX; | 1334 | x+=mGridSpacingX; |
1308 | } | 1335 | } |
1309 | } | 1336 | } |
1310 | // Draw horizontal lines of grid | 1337 | // Draw horizontal lines of grid |
1311 | int y = ((int)(cy/lGridSpacingY))*lGridSpacingY; | 1338 | int y = ((int)(cy/lGridSpacingY))*lGridSpacingY; |
1312 | if ( lGridSpacingY > 0 ) { | 1339 | if ( lGridSpacingY > 0 ) { |
1313 | while (y < cy + ch) { | 1340 | while (y < cy + ch) { |
1314 | p->setPen( SolidLine ); | 1341 | p->setPen( SolidLine ); |
1315 | p->drawLine(cx,y,cx+cw,y); | 1342 | p->drawLine(cx,y,cx+cw,y); |
1316 | y+=lGridSpacingY; | 1343 | y+=lGridSpacingY; |
1317 | p->setPen( DotLine ); | 1344 | p->setPen( DotLine ); |
1318 | p->drawLine(cx,y,cx+cw,y); | 1345 | p->drawLine(cx,y,cx+cw,y); |
1319 | y+=lGridSpacingY; | 1346 | y+=lGridSpacingY; |
1320 | } | 1347 | } |
1321 | p->setPen( SolidLine ); | 1348 | p->setPen( SolidLine ); |
1322 | } | 1349 | } |
1323 | mPixPainter.end() ; | 1350 | mPixPainter.end() ; |
1324 | } | 1351 | } |
1325 | 1352 | ||
1326 | /* | 1353 | /* |
1327 | Convert srcollview contents coordinates to agenda grid coordinates. | 1354 | Convert srcollview contents coordinates to agenda grid coordinates. |
1328 | */ | 1355 | */ |
1329 | void KOAgenda::contentsToGrid (int x, int y, int& gx, int& gy) | 1356 | void KOAgenda::contentsToGrid (int x, int y, int& gx, int& gy) |
1330 | { | 1357 | { |
1331 | gx = KOGlobals::self()->reverseLayout() ? mColumns - 1 - x/mGridSpacingX : | 1358 | gx = KOGlobals::self()->reverseLayout() ? mColumns - 1 - x/mGridSpacingX : |
1332 | x/mGridSpacingX; | 1359 | x/mGridSpacingX; |
1333 | gy = y/mGridSpacingY; | 1360 | gy = y/mGridSpacingY; |
1334 | } | 1361 | } |
1335 | 1362 | ||
1336 | /* | 1363 | /* |
1337 | Convert agenda grid coordinates to scrollview contents coordinates. | 1364 | Convert agenda grid coordinates to scrollview contents coordinates. |
1338 | */ | 1365 | */ |
1339 | void KOAgenda::gridToContents (int gx, int gy, int& x, int& y) | 1366 | void KOAgenda::gridToContents (int gx, int gy, int& x, int& y) |
1340 | { | 1367 | { |
1341 | x = KOGlobals::self()->reverseLayout() ? (mColumns - 1 - gx)*mGridSpacingX: | 1368 | x = KOGlobals::self()->reverseLayout() ? (mColumns - 1 - gx)*mGridSpacingX: |
1342 | gx*mGridSpacingX; | 1369 | gx*mGridSpacingX; |
1343 | y = gy*mGridSpacingY; | 1370 | y = gy*mGridSpacingY; |
1344 | } | 1371 | } |
1345 | 1372 | ||
1346 | 1373 | ||
1347 | /* | 1374 | /* |
1348 | Return Y coordinate corresponding to time. Coordinates are rounded to fit into | 1375 | Return Y coordinate corresponding to time. Coordinates are rounded to fit into |
1349 | the grid. | 1376 | the grid. |
1350 | */ | 1377 | */ |
1351 | int KOAgenda::timeToY(const QTime &time) | 1378 | int KOAgenda::timeToY(const QTime &time) |
1352 | { | 1379 | { |
1353 | int minutesPerCell = 24 * 60 / mRows; | 1380 | int minutesPerCell = 24 * 60 / mRows; |
1354 | int timeMinutes = time.hour() * 60 + time.minute(); | 1381 | int timeMinutes = time.hour() * 60 + time.minute(); |
1355 | int Y = (timeMinutes + (minutesPerCell / 2)) / minutesPerCell; | 1382 | int Y = (timeMinutes + (minutesPerCell / 2)) / minutesPerCell; |
1356 | return Y; | 1383 | return Y; |
1357 | } | 1384 | } |
1358 | 1385 | ||
1359 | 1386 | ||
1360 | /* | 1387 | /* |
1361 | Return time corresponding to cell y coordinate. Coordinates are rounded to | 1388 | Return time corresponding to cell y coordinate. Coordinates are rounded to |
1362 | fit into the grid. | 1389 | fit into the grid. |
1363 | */ | 1390 | */ |
1364 | QTime KOAgenda::gyToTime(int gy) | 1391 | QTime KOAgenda::gyToTime(int gy) |
1365 | { | 1392 | { |
1366 | 1393 | ||
1367 | int secondsPerCell = 24 * 60 * 60/ mRows; | 1394 | int secondsPerCell = 24 * 60 * 60/ mRows; |
1368 | 1395 | ||
1369 | int timeSeconds = secondsPerCell * gy; | 1396 | int timeSeconds = secondsPerCell * gy; |
1370 | 1397 | ||
1371 | QTime time( 0, 0, 0 ); | 1398 | QTime time( 0, 0, 0 ); |
1372 | if ( timeSeconds < 24 * 60 * 60 ) { | 1399 | if ( timeSeconds < 24 * 60 * 60 ) { |
1373 | time = time.addSecs(timeSeconds); | 1400 | time = time.addSecs(timeSeconds); |
1374 | } else { | 1401 | } else { |
1375 | time.setHMS( 23, 59, 59 ); | 1402 | time.setHMS( 23, 59, 59 ); |
1376 | } | 1403 | } |
1377 | 1404 | ||
1378 | return time; | 1405 | return time; |
1379 | } | 1406 | } |
1380 | 1407 | ||
1381 | void KOAgenda::setStartHour(int startHour) | 1408 | void KOAgenda::setStartHour(int startHour) |
1382 | { | 1409 | { |
1383 | int startCell = startHour * mRows / 24; | 1410 | int startCell = startHour * mRows / 24; |
1384 | setContentsPos(0,startCell * gridSpacingY()); | 1411 | setContentsPos(0,startCell * gridSpacingY()); |
1385 | } | 1412 | } |
1386 | void KOAgenda::hideUnused() | 1413 | void KOAgenda::hideUnused() |
1387 | { | 1414 | { |
1388 | // experimental only | 1415 | // experimental only |
1389 | // return; | 1416 | // return; |
1390 | KOAgendaItem *item; | 1417 | KOAgendaItem *item; |
1391 | for ( item=mUnusedItems.first(); item != 0; item=mUnusedItems.next() ) { | 1418 | for ( item=mUnusedItems.first(); item != 0; item=mUnusedItems.next() ) { |
1392 | item->hide(); | 1419 | item->hide(); |
1393 | } | 1420 | } |
1394 | } | 1421 | } |
1395 | 1422 | ||
1396 | 1423 | ||
1397 | KOAgendaItem *KOAgenda::getNewItem(Incidence * event,QDate qd, QWidget* view) | 1424 | KOAgendaItem *KOAgenda::getNewItem(Incidence * event,QDate qd, QWidget* view) |
1398 | { | 1425 | { |
1399 | 1426 | ||
1400 | KOAgendaItem *fi; | 1427 | KOAgendaItem *fi; |
1401 | for ( fi=mUnusedItems.first(); fi != 0; fi=mUnusedItems.next() ) { | 1428 | for ( fi=mUnusedItems.first(); fi != 0; fi=mUnusedItems.next() ) { |
1402 | if ( fi->incidence() == event ) { | 1429 | if ( fi->incidence() == event ) { |
1403 | mUnusedItems.remove(); | 1430 | mUnusedItems.remove(); |
1404 | fi->init( event, qd ); | 1431 | fi->init( event, qd ); |
1405 | return fi; | 1432 | return fi; |
1406 | } | 1433 | } |
1407 | } | 1434 | } |
1408 | fi=mUnusedItems.first(); | 1435 | fi=mUnusedItems.first(); |
1409 | if ( fi ) { | 1436 | if ( fi ) { |
1410 | mUnusedItems.remove(); | 1437 | mUnusedItems.remove(); |
1411 | fi->init( event, qd ); | 1438 | fi->init( event, qd ); |
1412 | return fi; | 1439 | return fi; |
1413 | } | 1440 | } |
1414 | // qDebug("new KOAgendaItem "); | 1441 | // qDebug("new KOAgendaItem "); |
1415 | 1442 | ||
1416 | KOAgendaItem* agendaItem = new KOAgendaItem( event, qd, view, mAllDayMode ); | 1443 | KOAgendaItem* agendaItem = new KOAgendaItem( event, qd, view, mAllDayMode ); |
1417 | agendaItem->installEventFilter(this); | 1444 | agendaItem->installEventFilter(this); |
1418 | addChild(agendaItem,0,0); | 1445 | addChild(agendaItem,0,0); |
1419 | return agendaItem; | 1446 | return agendaItem; |
1420 | } | 1447 | } |
1421 | KOAgendaItem * KOAgenda::getItemForTodo ( Todo * todo ) | 1448 | KOAgendaItem * KOAgenda::getItemForTodo ( Todo * todo ) |
1422 | { | 1449 | { |
1423 | KOAgendaItem *item; | 1450 | KOAgendaItem *item; |
1424 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 1451 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
1425 | if ( item->incidence() == todo ) { | 1452 | if ( item->incidence() == todo ) { |
1426 | mItems.remove(); | 1453 | mItems.remove(); |
1427 | return item; | 1454 | return item; |
1428 | } | 1455 | } |
1429 | } | 1456 | } |
1430 | return 0; | 1457 | return 0; |
1431 | } | 1458 | } |
1432 | 1459 | ||
1433 | 1460 | ||
1434 | void KOAgenda::updateTodo( Todo * todo, int days, bool remove) | 1461 | void KOAgenda::updateTodo( Todo * todo, int days, bool remove) |
1435 | { | 1462 | { |
1436 | // ( todo->hasCompletedDate() && todo->completed().date() == currentDate )|| | 1463 | // ( todo->hasCompletedDate() && todo->completed().date() == currentDate )|| |
1437 | KOAgendaItem *item; | 1464 | KOAgendaItem *item; |
1438 | item = getItemForTodo ( todo ); | 1465 | item = getItemForTodo ( todo ); |
1439 | //qDebug("KOAgenda::updateTodo %d %d %d %d", this, todo, days, remove); | 1466 | //qDebug("KOAgenda::updateTodo %d %d %d %d", this, todo, days, remove); |
1440 | if ( item ) { | 1467 | if ( item ) { |
1441 | blockSignals( true ); | 1468 | blockSignals( true ); |
1442 | //qDebug("item found "); | 1469 | //qDebug("item found "); |
1443 | item->hide(); | 1470 | item->hide(); |
1444 | item->setCellX(-2, -1 ); | 1471 | item->setCellX(-2, -1 ); |
1445 | item->select(false); | 1472 | item->select(false); |
1446 | mUnusedItems.append( item ); | 1473 | mUnusedItems.append( item ); |
1447 | mItems.remove( item ); | 1474 | mItems.remove( item ); |
1448 | QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems(); | 1475 | QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems(); |
1449 | KOAgendaItem *itemit; | 1476 | KOAgendaItem *itemit; |
1450 | //globalFlagBlockAgendaItemPaint = 1; | 1477 | //globalFlagBlockAgendaItemPaint = 1; |
1451 | for ( itemit=oldconflictItems.first(); itemit != 0; | 1478 | for ( itemit=oldconflictItems.first(); itemit != 0; |
1452 | itemit=oldconflictItems.next() ) { | 1479 | itemit=oldconflictItems.next() ) { |
1453 | if ( itemit != item ) | 1480 | if ( itemit != item ) |
1454 | placeSubCells(itemit); | 1481 | placeSubCells(itemit); |
1455 | } | 1482 | } |
1456 | qApp->processEvents(); | 1483 | qApp->processEvents(); |
1457 | //globalFlagBlockAgendaItemPaint = 0; | 1484 | //globalFlagBlockAgendaItemPaint = 0; |
1458 | for ( itemit=oldconflictItems.first(); itemit != 0; | 1485 | for ( itemit=oldconflictItems.first(); itemit != 0; |
1459 | itemit=oldconflictItems.next() ) { | 1486 | itemit=oldconflictItems.next() ) { |
1460 | globalFlagBlockAgendaItemUpdate = 0; | 1487 | globalFlagBlockAgendaItemUpdate = 0; |
1461 | if ( itemit != item ) | 1488 | if ( itemit != item ) |
1462 | itemit->repaintMe(); | 1489 | itemit->repaintMe(); |
1463 | globalFlagBlockAgendaItemUpdate = 1; | 1490 | globalFlagBlockAgendaItemUpdate = 1; |
1464 | itemit->repaint(); | 1491 | itemit->repaint(); |
1465 | } | 1492 | } |
1466 | blockSignals( false ); | 1493 | blockSignals( false ); |
1467 | } | 1494 | } |
1468 | if ( remove ) { | 1495 | if ( remove ) { |
1469 | //qDebug("remove****************************************** "); | 1496 | //qDebug("remove****************************************** "); |
1470 | return; | 1497 | return; |
1471 | } | 1498 | } |
1472 | //qDebug("updateTodo+++++++++++++++++++++++++++++++++++++ "); | 1499 | //qDebug("updateTodo+++++++++++++++++++++++++++++++++++++ "); |
1473 | bool overdue = (!todo->isCompleted()) && (todo->dtDue() < QDate::currentDate())&& ( KOPrefs::instance()->mShowTodoInAgenda ); | 1500 | bool overdue = (!todo->isCompleted()) && (todo->dtDue() < QDate::currentDate())&& ( KOPrefs::instance()->mShowTodoInAgenda ); |
1474 | QDate currentDate; | 1501 | QDate currentDate; |
1475 | QDateTime dt; | 1502 | QDateTime dt; |
1476 | if ( todo->hasCompletedDate() ) | 1503 | if ( todo->hasCompletedDate() ) |
1477 | dt = todo->completed(); | 1504 | dt = todo->completed(); |
1478 | else | 1505 | else |
1479 | dt = todo->dtDue(); | 1506 | dt = todo->dtDue(); |
1480 | if ( overdue ) { | 1507 | if ( overdue ) { |
1481 | currentDate = QDate::currentDate(); | 1508 | currentDate = QDate::currentDate(); |
1482 | days += todo->dtDue().date().daysTo( currentDate ); | 1509 | days += todo->dtDue().date().daysTo( currentDate ); |
1483 | } | 1510 | } |
1484 | else | 1511 | else |
1485 | currentDate = dt.date(); | 1512 | currentDate = dt.date(); |
1486 | 1513 | ||
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index d0a7b07..38bd93a 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp | |||
@@ -1,521 +1,522 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <qlabel.h> | 20 | #include <qlabel.h> |
21 | #include <qlayout.h> | 21 | #include <qlayout.h> |
22 | #include <qhbox.h> | 22 | #include <qhbox.h> |
23 | #include <qvbox.h> | 23 | #include <qvbox.h> |
24 | #include <qtooltip.h> | 24 | #include <qtooltip.h> |
25 | #include <qwhatsthis.h> | 25 | #include <qwhatsthis.h> |
26 | #include <qdragobject.h> | 26 | #include <qdragobject.h> |
27 | #include <qdrawutil.h> | 27 | #include <qdrawutil.h> |
28 | #include <qpainter.h> | 28 | #include <qpainter.h> |
29 | 29 | ||
30 | #include <kiconloader.h> | 30 | #include <kiconloader.h> |
31 | #include <kdebug.h> | 31 | #include <kdebug.h> |
32 | #include <kglobal.h> | 32 | #include <kglobal.h> |
33 | #include <klocale.h> | 33 | #include <klocale.h> |
34 | #ifndef DESKTOP_VERSION | 34 | #ifndef DESKTOP_VERSION |
35 | #include <qpe/qpeapplication.h> | 35 | #include <qpe/qpeapplication.h> |
36 | #define AGENDA_ICON_SIZE 5 | 36 | #define AGENDA_ICON_SIZE 5 |
37 | #else | 37 | #else |
38 | #define AGENDA_ICON_SIZE 7 | 38 | #define AGENDA_ICON_SIZE 7 |
39 | #endif | 39 | #endif |
40 | #include <libkcal/icaldrag.h> | 40 | #include <libkcal/icaldrag.h> |
41 | #include <libkcal/vcaldrag.h> | 41 | #include <libkcal/vcaldrag.h> |
42 | #include <libkcal/kincidenceformatter.h> | 42 | #include <libkcal/kincidenceformatter.h> |
43 | extern int globalFlagBlockAgenda; | 43 | extern int globalFlagBlockAgenda; |
44 | extern int globalFlagBlockAgendaItemPaint; | 44 | extern int globalFlagBlockAgendaItemPaint; |
45 | extern int globalFlagBlockAgendaItemUpdate; | 45 | extern int globalFlagBlockAgendaItemUpdate; |
46 | 46 | ||
47 | #include "koprefs.h" | 47 | #include "koprefs.h" |
48 | 48 | ||
49 | #include "koagendaitem.h" | 49 | #include "koagendaitem.h" |
50 | //#include "koagendaitem.moc" | 50 | //#include "koagendaitem.moc" |
51 | 51 | ||
52 | 52 | ||
53 | //-------------------------------------------------------------------------- | 53 | //-------------------------------------------------------------------------- |
54 | 54 | ||
55 | QToolTipGroup *KOAgendaItem::mToolTipGroup = 0; | 55 | QToolTipGroup *KOAgendaItem::mToolTipGroup = 0; |
56 | 56 | ||
57 | //-------------------------------------------------------------------------- | 57 | //-------------------------------------------------------------------------- |
58 | 58 | ||
59 | class KOAgendaItemWhatsThis :public QWhatsThis | 59 | class KOAgendaItemWhatsThis :public QWhatsThis |
60 | { | 60 | { |
61 | public: | 61 | public: |
62 | KOAgendaItemWhatsThis( KOAgendaItem* view ) : QWhatsThis( view ),_view (view) { }; | 62 | KOAgendaItemWhatsThis( KOAgendaItem* view ) : QWhatsThis( view ),_view (view) { }; |
63 | 63 | ||
64 | protected: | 64 | protected: |
65 | virtual QString text( const QPoint& ) | 65 | virtual QString text( const QPoint& ) |
66 | { | 66 | { |
67 | return _view->getWhatsThisText() ; | 67 | return _view->getWhatsThisText() ; |
68 | } | 68 | } |
69 | private: | 69 | private: |
70 | KOAgendaItem * _view; | 70 | KOAgendaItem * _view; |
71 | }; | 71 | }; |
72 | 72 | ||
73 | KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, | 73 | KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, |
74 | const char *name,WFlags) : | 74 | const char *name,WFlags) : |
75 | QWidget(parent, name), mIncidence(incidence), mDate(qd) | 75 | QWidget(parent, name), mIncidence(incidence), mDate(qd) |
76 | { | 76 | { |
77 | #ifndef DESKTOP_VERSION | 77 | #ifndef DESKTOP_VERSION |
78 | QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); | 78 | QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); |
79 | #endif | 79 | #endif |
80 | new KOAgendaItemWhatsThis(this); | 80 | new KOAgendaItemWhatsThis(this); |
81 | int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase | 81 | int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase |
82 | setWFlags ( wflags); | 82 | setWFlags ( wflags); |
83 | mAllDay = allday; | 83 | mAllDay = allday; |
84 | init ( incidence, qd ); | 84 | init ( incidence, qd ); |
85 | setMouseTracking(true); | 85 | setMouseTracking(true); |
86 | //setAcceptDrops(true); | 86 | //setAcceptDrops(true); |
87 | xPaintCoord = -1; | 87 | xPaintCoord = -1; |
88 | yPaintCoord = -1; | 88 | yPaintCoord = -1; |
89 | } | 89 | } |
90 | QString KOAgendaItem::getWhatsThisText() | 90 | QString KOAgendaItem::getWhatsThisText() |
91 | { | 91 | { |
92 | if ( mIncidence ) | 92 | if ( mIncidence ) |
93 | return KIncidenceFormatter::instance()->getFormattedText( mIncidence, | 93 | return KIncidenceFormatter::instance()->getFormattedText( mIncidence, |
94 | KOPrefs::instance()->mWTshowDetails, | 94 | KOPrefs::instance()->mWTshowDetails, |
95 | KOPrefs::instance()->mWTshowCreated, | 95 | KOPrefs::instance()->mWTshowCreated, |
96 | KOPrefs::instance()->mWTshowChanged); | 96 | KOPrefs::instance()->mWTshowChanged); |
97 | return "KOAgendaItem::getWhatsThisText()::internal error"; | 97 | return "KOAgendaItem::getWhatsThisText()::internal error"; |
98 | } | 98 | } |
99 | void KOAgendaItem::init ( Incidence *incidence, QDate qd ) | 99 | void KOAgendaItem::init ( Incidence *incidence, QDate qd ) |
100 | { | 100 | { |
101 | mIncidence = incidence; | 101 | mIncidence = incidence; |
102 | mDate = qd; | 102 | mDate = qd; |
103 | mFirstMultiItem = 0; | 103 | mFirstMultiItem = 0; |
104 | mNextMultiItem = 0; | 104 | mNextMultiItem = 0; |
105 | mLastMultiItem = 0; | 105 | mLastMultiItem = 0; |
106 | computeText(); | 106 | computeText(); |
107 | 107 | ||
108 | if ( (incidence->type() == "Todo") && | 108 | if ( (incidence->type() == "Todo") && |
109 | ( !((static_cast<Todo*>(incidence))->isCompleted()) && | 109 | ( !((static_cast<Todo*>(incidence))->isCompleted()) && |
110 | ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) { | 110 | ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) { |
111 | if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date()) | 111 | if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date()) |
112 | mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; | 112 | mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; |
113 | else | 113 | else |
114 | mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; | 114 | mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; |
115 | } | 115 | } |
116 | else { | 116 | else { |
117 | QStringList categories = mIncidence->categories(); | 117 | QStringList categories = mIncidence->categories(); |
118 | QString cat = categories.first(); | 118 | QString cat = categories.first(); |
119 | if (cat.isEmpty()) { | 119 | if (cat.isEmpty()) { |
120 | if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) | 120 | if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) |
121 | mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; | 121 | mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; |
122 | else | 122 | else |
123 | mBackgroundColor =KOPrefs::instance()->mEventColor; | 123 | mBackgroundColor =KOPrefs::instance()->mEventColor; |
124 | } else { | 124 | } else { |
125 | mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); | 125 | mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); |
126 | if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) { | 126 | if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) { |
127 | if ( mBackgroundColor == KOPrefs::instance()->mEventColor ) | 127 | if ( mBackgroundColor == KOPrefs::instance()->mEventColor ) |
128 | mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; | 128 | mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; |
129 | } | 129 | } |
130 | } | 130 | } |
131 | 131 | ||
132 | } | 132 | } |
133 | mColorGroup = QColorGroup( mBackgroundColor.light(), | 133 | mColorGroup = QColorGroup( mBackgroundColor.light(), |
134 | mBackgroundColor.dark(),mBackgroundColor.light(), | 134 | mBackgroundColor.dark(),mBackgroundColor.light(), |
135 | mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ; | 135 | mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ; |
136 | setBackgroundColor( mBackgroundColor ); | 136 | setBackgroundColor( mBackgroundColor ); |
137 | 137 | ||
138 | mConflictItems.clear(); | ||
138 | setCellXY(0,0,1); | 139 | setCellXY(0,0,1); |
139 | setCellXWidth(0); | 140 | setCellXWidth(0); |
140 | setSubCell(0); | 141 | setSubCell(0); |
141 | setSubCells(1); | 142 | setSubCells(1); |
142 | setMultiItem(0,0,0); | 143 | setMultiItem(0,0,0); |
143 | startMove(); | 144 | startMove(); |
144 | mSelected = true; | 145 | mSelected = true; |
145 | select(false); | 146 | select(false); |
146 | QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); | 147 | QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); |
147 | mFontPixelSize = fontinf.height();; | 148 | mFontPixelSize = fontinf.height();; |
148 | hide(); | 149 | hide(); |
149 | xPaintCoord = -1; | 150 | xPaintCoord = -1; |
150 | yPaintCoord = -1; | 151 | yPaintCoord = -1; |
151 | } | 152 | } |
152 | 153 | ||
153 | 154 | ||
154 | KOAgendaItem::~KOAgendaItem() | 155 | KOAgendaItem::~KOAgendaItem() |
155 | { | 156 | { |
156 | // qDebug("deleteKOAgendaItem::~KOAgendaItem( "); | 157 | // qDebug("deleteKOAgendaItem::~KOAgendaItem( "); |
157 | 158 | ||
158 | } | 159 | } |
159 | 160 | ||
160 | void KOAgendaItem::recreateIncidence() | 161 | void KOAgendaItem::recreateIncidence() |
161 | { | 162 | { |
162 | #if 0 | 163 | #if 0 |
163 | Incidence* newInc = mIncidence->clone(); | 164 | Incidence* newInc = mIncidence->clone(); |
164 | newInc->recreate(); | 165 | newInc->recreate(); |
165 | if ( mIncidence->doesRecur() ) { | 166 | if ( mIncidence->doesRecur() ) { |
166 | mIncidence->addExDate( mDate ); | 167 | mIncidence->addExDate( mDate ); |
167 | newInc->recurrence()->unsetRecurs(); | 168 | newInc->recurrence()->unsetRecurs(); |
168 | int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); | 169 | int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); |
169 | QTime tim = mIncidence->dtStart().time(); | 170 | QTime tim = mIncidence->dtStart().time(); |
170 | newInc->setDtStart( QDateTime(mDate, tim) ); | 171 | newInc->setDtStart( QDateTime(mDate, tim) ); |
171 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); | 172 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); |
172 | } | 173 | } |
173 | #endif | 174 | #endif |
174 | mIncidence = mIncidence->recreateCloneException( mDate ); | 175 | mIncidence = mIncidence->recreateCloneException( mDate ); |
175 | } | 176 | } |
176 | bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) | 177 | bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) |
177 | { | 178 | { |
178 | int size = AGENDA_ICON_SIZE; | 179 | int size = AGENDA_ICON_SIZE; |
179 | 180 | ||
180 | int yOff = 0; | 181 | int yOff = 0; |
181 | int xOff = 0; | 182 | int xOff = 0; |
182 | int x = pos().x() +3; | 183 | int x = pos().x() +3; |
183 | int y; | 184 | int y; |
184 | if ( mAllDay ) | 185 | if ( mAllDay ) |
185 | y = pos().y()+3; | 186 | y = pos().y()+3; |
186 | else | 187 | else |
187 | y = mCellYTop * ( height() / cellHeight() ) +3; | 188 | y = mCellYTop * ( height() / cellHeight() ) +3; |
188 | if (mIncidence->cancelled()) { | 189 | if (mIncidence->cancelled()) { |
189 | int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x; | 190 | int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x; |
190 | int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y; | 191 | int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y; |
191 | p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 ); | 192 | p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 ); |
192 | p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos ); | 193 | p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos ); |
193 | if ( horLayout ) | 194 | if ( horLayout ) |
194 | ++xOff; | 195 | ++xOff; |
195 | else | 196 | else |
196 | ++yOff; | 197 | ++yOff; |
197 | } | 198 | } |
198 | if (mIncidence->isAlarmEnabled()) { | 199 | if (mIncidence->isAlarmEnabled()) { |
199 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red ); | 200 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red ); |
200 | if ( horLayout ) | 201 | if ( horLayout ) |
201 | ++xOff; | 202 | ++xOff; |
202 | else | 203 | else |
203 | ++yOff; | 204 | ++yOff; |
204 | } | 205 | } |
205 | if (mIncidence->recurrence()->doesRecur()) { | 206 | if (mIncidence->recurrence()->doesRecur()) { |
206 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue ); | 207 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue ); |
207 | if ( horLayout ) | 208 | if ( horLayout ) |
208 | ++xOff; | 209 | ++xOff; |
209 | else | 210 | else |
210 | ++yOff; | 211 | ++yOff; |
211 | } | 212 | } |
212 | if (mIncidence->description().length() > 0) { | 213 | if (mIncidence->description().length() > 0) { |
213 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen ); | 214 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen ); |
214 | if ( horLayout ) | 215 | if ( horLayout ) |
215 | ++xOff; | 216 | ++xOff; |
216 | else | 217 | else |
217 | ++yOff; | 218 | ++yOff; |
218 | } | 219 | } |
219 | if (mIncidence->isReadOnly()) { | 220 | if (mIncidence->isReadOnly()) { |
220 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white ); | 221 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white ); |
221 | if ( horLayout ) | 222 | if ( horLayout ) |
222 | ++xOff; | 223 | ++xOff; |
223 | else | 224 | else |
224 | ++yOff; | 225 | ++yOff; |
225 | } | 226 | } |
226 | 227 | ||
227 | if (mIncidence->attendeeCount()>0) { | 228 | if (mIncidence->attendeeCount()>0) { |
228 | 229 | ||
229 | if (mIncidence->organizer() == KOPrefs::instance()->email()) { | 230 | if (mIncidence->organizer() == KOPrefs::instance()->email()) { |
230 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black ); | 231 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black ); |
231 | if ( horLayout ) | 232 | if ( horLayout ) |
232 | ++xOff; | 233 | ++xOff; |
233 | else | 234 | else |
234 | ++yOff; | 235 | ++yOff; |
235 | } else { | 236 | } else { |
236 | Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); | 237 | Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); |
237 | if (me!=0) { | 238 | if (me!=0) { |
238 | 239 | ||
239 | 240 | ||
240 | } else { | 241 | } else { |
241 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow ); | 242 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow ); |
242 | if ( horLayout ) | 243 | if ( horLayout ) |
243 | ++xOff; | 244 | ++xOff; |
244 | else | 245 | else |
245 | ++yOff; | 246 | ++yOff; |
246 | 247 | ||
247 | } | 248 | } |
248 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow ); | 249 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow ); |
249 | if ( horLayout ) | 250 | if ( horLayout ) |
250 | ++xOff; | 251 | ++xOff; |
251 | else | 252 | else |
252 | ++yOff; | 253 | ++yOff; |
253 | 254 | ||
254 | } | 255 | } |
255 | 256 | ||
256 | } | 257 | } |
257 | return ( yOff || xOff ); | 258 | return ( yOff || xOff ); |
258 | } | 259 | } |
259 | 260 | ||
260 | 261 | ||
261 | void KOAgendaItem::select(bool selected) | 262 | void KOAgendaItem::select(bool selected) |
262 | { | 263 | { |
263 | //qDebug("select %d %d",firstMultiItem(), nextMultiItem() ); | 264 | //qDebug("select %d %d",firstMultiItem(), nextMultiItem() ); |
264 | if (mSelected == selected) return; | 265 | if (mSelected == selected) return; |
265 | mSelected = selected; | 266 | mSelected = selected; |
266 | if ( ! isVisible() ) | 267 | if ( ! isVisible() ) |
267 | return; | 268 | return; |
268 | if ( firstMultiItem() ) | 269 | if ( firstMultiItem() ) |
269 | firstMultiItem()->select( selected ); | 270 | firstMultiItem()->select( selected ); |
270 | if ( !firstMultiItem() && nextMultiItem() ) { | 271 | if ( !firstMultiItem() && nextMultiItem() ) { |
271 | KOAgendaItem * placeItem = nextMultiItem(); | 272 | KOAgendaItem * placeItem = nextMultiItem(); |
272 | while ( placeItem ) { | 273 | while ( placeItem ) { |
273 | placeItem->select( selected ); | 274 | placeItem->select( selected ); |
274 | placeItem = placeItem->nextMultiItem(); | 275 | placeItem = placeItem->nextMultiItem(); |
275 | } | 276 | } |
276 | } | 277 | } |
277 | globalFlagBlockAgendaItemUpdate = 0; | 278 | globalFlagBlockAgendaItemUpdate = 0; |
278 | paintMe( selected ); | 279 | paintMe( selected ); |
279 | globalFlagBlockAgendaItemUpdate = 1; | 280 | globalFlagBlockAgendaItemUpdate = 1; |
280 | repaint( false ); | 281 | repaint( false ); |
281 | } | 282 | } |
282 | 283 | ||
283 | 284 | ||
284 | /* | 285 | /* |
285 | The eventFilter has to filter the mouse events of the agenda item childs. The | 286 | The eventFilter has to filter the mouse events of the agenda item childs. The |
286 | events are fed into the event handling method of KOAgendaItem. This allows the | 287 | events are fed into the event handling method of KOAgendaItem. This allows the |
287 | KOAgenda to handle the KOAgendaItems by using an eventFilter. | 288 | KOAgenda to handle the KOAgendaItems by using an eventFilter. |
288 | */ | 289 | */ |
289 | bool KOAgendaItem::eventFilter ( QObject *object, QEvent *e ) | 290 | bool KOAgendaItem::eventFilter ( QObject *object, QEvent *e ) |
290 | { | 291 | { |
291 | if (e->type() == QEvent::MouseButtonPress || | 292 | if (e->type() == QEvent::MouseButtonPress || |
292 | e->type() == QEvent::MouseButtonDblClick || | 293 | e->type() == QEvent::MouseButtonDblClick || |
293 | e->type() == QEvent::MouseButtonRelease || | 294 | e->type() == QEvent::MouseButtonRelease || |
294 | e->type() == QEvent::MouseMove) { | 295 | e->type() == QEvent::MouseMove) { |
295 | QMouseEvent *me = (QMouseEvent *)e; | 296 | QMouseEvent *me = (QMouseEvent *)e; |
296 | QPoint itemPos = this->mapFromGlobal(((QWidget *)object)-> | 297 | QPoint itemPos = this->mapFromGlobal(((QWidget *)object)-> |
297 | mapToGlobal(me->pos())); | 298 | mapToGlobal(me->pos())); |
298 | QMouseEvent returnEvent (e->type(),itemPos,me->button(),me->state()); | 299 | QMouseEvent returnEvent (e->type(),itemPos,me->button(),me->state()); |
299 | return event(&returnEvent); | 300 | return event(&returnEvent); |
300 | } else { | 301 | } else { |
301 | return false; | 302 | return false; |
302 | } | 303 | } |
303 | } | 304 | } |
304 | void KOAgendaItem::repaintMe( ) | 305 | void KOAgendaItem::repaintMe( ) |
305 | { | 306 | { |
306 | paintMe ( mSelected ); | 307 | paintMe ( mSelected ); |
307 | } | 308 | } |
308 | void KOAgendaItem::paintMe( bool selected, QPainter* paint ) | 309 | void KOAgendaItem::paintMe( bool selected, QPainter* paint ) |
309 | { | 310 | { |
310 | if ( globalFlagBlockAgendaItemUpdate && ! selected) | 311 | if ( globalFlagBlockAgendaItemUpdate && ! selected) |
311 | return; | 312 | return; |
312 | QPainter pa; | 313 | QPainter pa; |
313 | 314 | ||
314 | if ( mSelected ) { | 315 | if ( mSelected ) { |
315 | pa.begin( paintPixSel() ); | 316 | pa.begin( paintPixSel() ); |
316 | } else { | 317 | } else { |
317 | if ( mAllDay ) | 318 | if ( mAllDay ) |
318 | pa.begin( paintPixAllday() ); | 319 | pa.begin( paintPixAllday() ); |
319 | else | 320 | else |
320 | pa.begin( paintPix() ); | 321 | pa.begin( paintPix() ); |
321 | } | 322 | } |
322 | int x, yy, w, h; | 323 | int x, yy, w, h; |
323 | float nfh = 7.0; | 324 | float nfh = 7.0; |
324 | x = pos().x(); w = width(); h = height (); | 325 | x = pos().x(); w = width(); h = height (); |
325 | if ( mAllDay ) | 326 | if ( mAllDay ) |
326 | yy = y(); | 327 | yy = y(); |
327 | else | 328 | else |
328 | yy = mCellYTop * ( height() / cellHeight() ); | 329 | yy = mCellYTop * ( height() / cellHeight() ); |
329 | xPaintCoord= x; | 330 | xPaintCoord= x; |
330 | yPaintCoord = yy; | 331 | yPaintCoord = yy; |
331 | wPaintCoord = width(); | 332 | wPaintCoord = width(); |
332 | hPaintCoord = height(); | 333 | hPaintCoord = height(); |
333 | //qDebug("paintMe %s %d %d %d %d",incidence()->summary().latin1(), x, yy, width(), height()); | 334 | //qDebug("paintMe %s %d %d %d %d",incidence()->summary().latin1(), x, yy, width(), height()); |
334 | if ( paint == 0 ) | 335 | if ( paint == 0 ) |
335 | paint = &pa; | 336 | paint = &pa; |
336 | bool horLayout = ( w < h ); | 337 | bool horLayout = ( w < h ); |
337 | int maxhei = mFontPixelSize+4; | 338 | int maxhei = mFontPixelSize+4; |
338 | if ( horLayout ) | 339 | if ( horLayout ) |
339 | maxhei += AGENDA_ICON_SIZE -4; | 340 | maxhei += AGENDA_ICON_SIZE -4; |
340 | bool small = ( h < maxhei ); | 341 | bool small = ( h < maxhei ); |
341 | if ( ! small ) | 342 | if ( ! small ) |
342 | paint->setFont(KOPrefs::instance()->mAgendaViewFont); | 343 | paint->setFont(KOPrefs::instance()->mAgendaViewFont); |
343 | else { | 344 | else { |
344 | QFont f = KOPrefs::instance()->mAgendaViewFont; | 345 | QFont f = KOPrefs::instance()->mAgendaViewFont; |
345 | f.setBold( false ); | 346 | f.setBold( false ); |
346 | int fh = f.pointSize(); | 347 | int fh = f.pointSize(); |
347 | nfh = (((float)height())/(float)(mFontPixelSize+4))*fh; | 348 | nfh = (((float)height())/(float)(mFontPixelSize+4))*fh; |
348 | if ( nfh < 6 ) | 349 | if ( nfh < 6 ) |
349 | nfh = 6; | 350 | nfh = 6; |
350 | f.setPointSize( nfh ); | 351 | f.setPointSize( nfh ); |
351 | paint->setFont(f); | 352 | paint->setFont(f); |
352 | } | 353 | } |
353 | paint->fillRect ( x, yy, w, h, mBackgroundColor ); | 354 | paint->fillRect ( x, yy, w, h, mBackgroundColor ); |
354 | static const QPixmap completedPxmp = SmallIcon("greenhook16"); | 355 | static const QPixmap completedPxmp = SmallIcon("greenhook16"); |
355 | static const QPixmap overduePxmp = SmallIcon("redcross16"); | 356 | static const QPixmap overduePxmp = SmallIcon("redcross16"); |
356 | if ( mIncidence->type() == "Todo" ) { | 357 | if ( mIncidence->type() == "Todo" ) { |
357 | Todo* tempTodo = static_cast<Todo*>(mIncidence); | 358 | Todo* tempTodo = static_cast<Todo*>(mIncidence); |
358 | int xx = pos().x()+(width()-completedPxmp.width()-3 ); | 359 | int xx = pos().x()+(width()-completedPxmp.width()-3 ); |
359 | int yyy = yy+3; | 360 | int yyy = yy+3; |
360 | if ( tempTodo->isCompleted() ) | 361 | if ( tempTodo->isCompleted() ) |
361 | paint->drawPixmap ( xx, yyy, completedPxmp ); | 362 | paint->drawPixmap ( xx, yyy, completedPxmp ); |
362 | else { | 363 | else { |
363 | paint->drawPixmap ( xx, yyy, overduePxmp ); | 364 | paint->drawPixmap ( xx, yyy, overduePxmp ); |
364 | 365 | ||
365 | } | 366 | } |
366 | } | 367 | } |
367 | bool addIcon = false; | 368 | bool addIcon = false; |
368 | if ( ! small || w > 3 * h || h > 3* w ) | 369 | if ( ! small || w > 3 * h || h > 3* w ) |
369 | addIcon = updateIcons( paint, horLayout ); | 370 | addIcon = updateIcons( paint, horLayout ); |
370 | 371 | ||
371 | qDrawShadePanel (paint, x, yy, w, h, mColorGroup, selected , 2, 0); | 372 | qDrawShadePanel (paint, x, yy, w, h, mColorGroup, selected , 2, 0); |
372 | //qDebug("draw rect %d %d %d %d ",x, yy, w, h ); | 373 | //qDebug("draw rect %d %d %d %d ",x, yy, w, h ); |
373 | if ( ! small ) { | 374 | if ( ! small ) { |
374 | x += 3; yy += 3;w -= 6; h-= 5; | 375 | x += 3; yy += 3;w -= 6; h-= 5; |
375 | } else { | 376 | } else { |
376 | x += 2; yy += 1;w -= 4; h-= 4; | 377 | x += 2; yy += 1;w -= 4; h-= 4; |
377 | if ( nfh < 6.01 ) { | 378 | if ( nfh < 6.01 ) { |
378 | yy -= 2; | 379 | yy -= 2; |
379 | h += 4; | 380 | h += 4; |
380 | } | 381 | } |
381 | else | 382 | else |
382 | if ( nfh < h -2 ) | 383 | if ( nfh < h -2 ) |
383 | ++yy; | 384 | ++yy; |
384 | } | 385 | } |
385 | int align; | 386 | int align; |
386 | #ifndef DESKTOP_VERSION | 387 | #ifndef DESKTOP_VERSION |
387 | align = ( AlignLeft|WordBreak|AlignTop); | 388 | align = ( AlignLeft|WordBreak|AlignTop); |
388 | #else | 389 | #else |
389 | align = ( AlignLeft|BreakAnywhere|WordBreak|AlignTop); | 390 | align = ( AlignLeft|BreakAnywhere|WordBreak|AlignTop); |
390 | #endif | 391 | #endif |
391 | if ( addIcon ) { | 392 | if ( addIcon ) { |
392 | if ( ! horLayout ) { | 393 | if ( ! horLayout ) { |
393 | x += AGENDA_ICON_SIZE+3; | 394 | x += AGENDA_ICON_SIZE+3; |
394 | w -= (AGENDA_ICON_SIZE+3); | 395 | w -= (AGENDA_ICON_SIZE+3); |
395 | } | 396 | } |
396 | else { | 397 | else { |
397 | yy+= AGENDA_ICON_SIZE+2; | 398 | yy+= AGENDA_ICON_SIZE+2; |
398 | h -=(AGENDA_ICON_SIZE+3); | 399 | h -=(AGENDA_ICON_SIZE+3); |
399 | } | 400 | } |
400 | } | 401 | } |
401 | int colsum = mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue(); | 402 | int colsum = mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue(); |
402 | if ( colsum < 250 ) | 403 | if ( colsum < 250 ) |
403 | paint->setPen ( white); | 404 | paint->setPen ( white); |
404 | if ( x < 0 ) { | 405 | if ( x < 0 ) { |
405 | w = w+x-3; | 406 | w = w+x-3; |
406 | x = 3; | 407 | x = 3; |
407 | if ( w > parentWidget()->width() ){ | 408 | if ( w > parentWidget()->width() ){ |
408 | w = parentWidget()->width() - 6; | 409 | w = parentWidget()->width() - 6; |
409 | #ifndef DESKTOP_VERSION | 410 | #ifndef DESKTOP_VERSION |
410 | align = ( AlignHCenter|WordBreak|AlignTop); | 411 | align = ( AlignHCenter|WordBreak|AlignTop); |
411 | #else | 412 | #else |
412 | align = ( AlignHCenter|BreakAnywhere|WordBreak|AlignTop); | 413 | align = ( AlignHCenter|BreakAnywhere|WordBreak|AlignTop); |
413 | #endif | 414 | #endif |
414 | 415 | ||
415 | } | 416 | } |
416 | } | 417 | } |
417 | QRect dr; | 418 | QRect dr; |
418 | if ( w + x > parentWidget()->width() ) | 419 | if ( w + x > parentWidget()->width() ) |
419 | w = parentWidget()->width()-x; | 420 | w = parentWidget()->width()-x; |
420 | paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr ); | 421 | paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr ); |
421 | //qDebug("%d %d %d %d ", x, yy, w, h ); | 422 | //qDebug("%d %d %d %d ", x, yy, w, h ); |
422 | if ( mIncidence->cancelled() ){ | 423 | if ( mIncidence->cancelled() ){ |
423 | if ( ! small ) { | 424 | if ( ! small ) { |
424 | QFontMetrics fm ( paint->font() ); | 425 | QFontMetrics fm ( paint->font() ); |
425 | paint->drawLine(dr.left(), yy+fm.height()/2, dr.right()-2, yy+fm.height()/2); | 426 | paint->drawLine(dr.left(), yy+fm.height()/2, dr.right()-2, yy+fm.height()/2); |
426 | } | 427 | } |
427 | 428 | ||
428 | } | 429 | } |
429 | pa.end(); | 430 | pa.end(); |
430 | 431 | ||
431 | } | 432 | } |
432 | void KOAgendaItem::resizePixmap( int w , int h ) | 433 | void KOAgendaItem::resizePixmap( int w , int h ) |
433 | { | 434 | { |
434 | paintPix()->resize( w, h ); | 435 | paintPix()->resize( w, h ); |
435 | paintPixSel()->resize( w, h ); | 436 | paintPixSel()->resize( w, h ); |
436 | 437 | ||
437 | } | 438 | } |
438 | QPixmap * KOAgendaItem::paintPix() | 439 | QPixmap * KOAgendaItem::paintPix() |
439 | { | 440 | { |
440 | static QPixmap* mPaintPix = 0; | 441 | static QPixmap* mPaintPix = 0; |
441 | if ( ! mPaintPix ) | 442 | if ( ! mPaintPix ) |
442 | mPaintPix = new QPixmap(1,1); | 443 | mPaintPix = new QPixmap(1,1); |
443 | return mPaintPix ; | 444 | return mPaintPix ; |
444 | } | 445 | } |
445 | QPixmap * KOAgendaItem::paintPixAllday() | 446 | QPixmap * KOAgendaItem::paintPixAllday() |
446 | { | 447 | { |
447 | static QPixmap* mPaintPixA = 0; | 448 | static QPixmap* mPaintPixA = 0; |
448 | if ( ! mPaintPixA ) | 449 | if ( ! mPaintPixA ) |
449 | mPaintPixA = new QPixmap(1,1); | 450 | mPaintPixA = new QPixmap(1,1); |
450 | return mPaintPixA ; | 451 | return mPaintPixA ; |
451 | } | 452 | } |
452 | QPixmap * KOAgendaItem::paintPixSel() | 453 | QPixmap * KOAgendaItem::paintPixSel() |
453 | { | 454 | { |
454 | static QPixmap* mPaintPixSel = 0; | 455 | static QPixmap* mPaintPixSel = 0; |
455 | if ( ! mPaintPixSel ) | 456 | if ( ! mPaintPixSel ) |
456 | mPaintPixSel = new QPixmap(1,1); | 457 | mPaintPixSel = new QPixmap(1,1); |
457 | return mPaintPixSel ; | 458 | return mPaintPixSel ; |
458 | } | 459 | } |
459 | void KOAgendaItem::paintEvent ( QPaintEvent *e ) | 460 | void KOAgendaItem::paintEvent ( QPaintEvent *e ) |
460 | { | 461 | { |
461 | 462 | ||
462 | if ( globalFlagBlockAgendaItemPaint ) | 463 | if ( globalFlagBlockAgendaItemPaint ) |
463 | return; | 464 | return; |
464 | if ( globalFlagBlockAgenda > 0 && globalFlagBlockAgenda < 5 ) | 465 | if ( globalFlagBlockAgenda > 0 && globalFlagBlockAgenda < 5 ) |
465 | return; | 466 | return; |
466 | int yy; | 467 | int yy; |
467 | if ( mAllDay ) | 468 | if ( mAllDay ) |
468 | yy = y(); | 469 | yy = y(); |
469 | else | 470 | else |
470 | yy = mCellYTop * ( height() / cellHeight() ); | 471 | yy = mCellYTop * ( height() / cellHeight() ); |
471 | int xx = x(); | 472 | int xx = x(); |
472 | if ( xPaintCoord != xx || yPaintCoord != yy || | 473 | if ( xPaintCoord != xx || yPaintCoord != yy || |
473 | wPaintCoord != width() || hPaintCoord != height()) { | 474 | wPaintCoord != width() || hPaintCoord != height()) { |
474 | xPaintCoord= xx; | 475 | xPaintCoord= xx; |
475 | yPaintCoord = yy; | 476 | yPaintCoord = yy; |
476 | wPaintCoord = width(); | 477 | wPaintCoord = width(); |
477 | hPaintCoord = height(); | 478 | hPaintCoord = height(); |
478 | globalFlagBlockAgendaItemUpdate = 0; | 479 | globalFlagBlockAgendaItemUpdate = 0; |
479 | paintMe( mSelected ); | 480 | paintMe( mSelected ); |
480 | //qDebug("calling paintMe "); | 481 | //qDebug("calling paintMe "); |
481 | globalFlagBlockAgendaItemUpdate = 1; | 482 | globalFlagBlockAgendaItemUpdate = 1; |
482 | } | 483 | } |
483 | int rx, ry, rw, rh; | 484 | int rx, ry, rw, rh; |
484 | rx = e->rect().x(); | 485 | rx = e->rect().x(); |
485 | ry = e->rect().y(); | 486 | ry = e->rect().y(); |
486 | rw = e->rect().width(); | 487 | rw = e->rect().width(); |
487 | rh = e->rect().height(); | 488 | rh = e->rect().height(); |
488 | //qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height()); | 489 | //qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height()); |
489 | 490 | ||
490 | QPixmap* paintFrom ; | 491 | QPixmap* paintFrom ; |
491 | if ( mSelected ) { | 492 | if ( mSelected ) { |
492 | paintFrom = paintPixSel(); | 493 | paintFrom = paintPixSel(); |
493 | } else { | 494 | } else { |
494 | if ( mAllDay ) | 495 | if ( mAllDay ) |
495 | paintFrom = paintPixAllday(); | 496 | paintFrom = paintPixAllday(); |
496 | else | 497 | else |
497 | paintFrom = paintPix(); | 498 | paintFrom = paintPix(); |
498 | } | 499 | } |
499 | bitBlt (this, rx, ry, paintFrom, x()+rx ,yPaintCoord+ry, rw, rh ,CopyROP); | 500 | bitBlt (this, rx, ry, paintFrom, x()+rx ,yPaintCoord+ry, rw, rh ,CopyROP); |
500 | } | 501 | } |
501 | void KOAgendaItem::computeText() | 502 | void KOAgendaItem::computeText() |
502 | { | 503 | { |
503 | 504 | ||
504 | mDisplayedText = mIncidence->summary(); | 505 | mDisplayedText = mIncidence->summary(); |
505 | if ( (mIncidence->type() == "Todo") ) { | 506 | if ( (mIncidence->type() == "Todo") ) { |
506 | if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) { | 507 | if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) { |
507 | if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() ) | 508 | if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() ) |
508 | mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")"; | 509 | mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")"; |
509 | else if ( !(mIncidence->doesFloat())) | 510 | else if ( !(mIncidence->doesFloat())) |
510 | mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")"; | 511 | mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")"; |
511 | } | 512 | } |
512 | } else { | 513 | } else { |
513 | if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda) | 514 | if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda) |
514 | mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + "-" + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ; | 515 | mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + "-" + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ; |
515 | 516 | ||
516 | if ( mAllDay ) { | 517 | if ( mAllDay ) { |
517 | if ( mIncidence->dtStart().date().addDays(3) < mIncidence->dtEnd().date() ) { | 518 | if ( mIncidence->dtStart().date().addDays(3) < mIncidence->dtEnd().date() ) { |
518 | mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtEnd().date(), true) ; | 519 | mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtEnd().date(), true) ; |
519 | } | 520 | } |
520 | } | 521 | } |
521 | 522 | ||