author | zautrix <zautrix> | 2005-01-30 14:15:42 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-30 14:15:42 (UTC) |
commit | 8d543aa1d1d1ed20001c8b18352d1d29c2979e48 (patch) (unidiff) | |
tree | 9ca05f4d3bc1de81bcf0446a2f7471d552089c87 | |
parent | 1bcef8b3f53419e7155e0862ad61e3e419763d70 (diff) | |
download | kdepimpi-8d543aa1d1d1ed20001c8b18352d1d29c2979e48.zip kdepimpi-8d543aa1d1d1ed20001c8b18352d1d29c2979e48.tar.gz kdepimpi-8d543aa1d1d1ed20001c8b18352d1d29c2979e48.tar.bz2 |
many fixes
-rw-r--r-- | bin/kdepim/WhatsNew.txt | 14 | ||||
-rw-r--r-- | korganizer/kdatenavigator.cpp | 4 | ||||
-rw-r--r-- | korganizer/koagendaitem.cpp | 13 | ||||
-rw-r--r-- | korganizer/kodaymatrix.cpp | 148 | ||||
-rw-r--r-- | korganizer/kodaymatrix.h | 5 |
5 files changed, 119 insertions, 65 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index 6c9daad..05aa8fe 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt | |||
@@ -1,401 +1,413 @@ | |||
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 | 3 | ||
4 | ********** VERSION 2.0.1 ************ | 4 | ********** VERSION 2.0.1 ************ |
5 | 5 | ||
6 | Oooops ... I forgot to test on the Zaurus 5500 ... | 6 | Oooops ... I forgot to test on the Zaurus 5500 ... |
7 | 7 | ||
8 | Fixed many problems of new (english) strings (and german translations) | 8 | Fixed many problems of new (english) strings (and german translations) |
9 | introduced in the latest versions, where the text was not fitting on the | 9 | introduced in the latest versions, where the text was not fitting on the |
10 | 240x320 display of the Zaurus 5500. | 10 | 240x320 display of the Zaurus 5500. |
11 | 11 | ||
12 | Added a popup menu ( press pen and hold to get popup ) to the agenda view | 12 | Added a popup menu ( press pen and hold to get popup ) to the agenda view |
13 | with may useful items. | 13 | with many useful items (add event/todo, show next week, two weeks, month, journal). |
14 | 14 | ||
15 | Added items to the todolist popup menu for: | 15 | Added items to the todolist popup menu for: |
16 | Display all opened, all closed or all todos flat. | 16 | Display all opened, all closed or all todos flat. |
17 | The "flat" view makes is possible to sort all todos after ,e.g., prio or date. | 17 | The "flat" view makes is possible to sort all todos after ,e.g., prio or date. |
18 | Made the reparenting of todos on the desktop possible via Drag&Drop. | ||
19 | Fixed several bugs in setting the completed datetime for todos. | ||
20 | Added info about completed datetime of todos to the todo viewer. | ||
21 | Now displaying a completed todo (with completed datetime set) in the agenda view | ||
22 | at the time of the completion. Such that now it is possible to see in the agenda view | ||
23 | when what todo was completed. | ||
24 | Fixed behaviour of automatic setting completion of todos with sub-todos/parent todos. | ||
25 | Now the behaviour is: | ||
26 | Setting a parent to complete sets all (sub)childs to complete. | ||
27 | Setting a parent to uncomplete does not change the childs. | ||
28 | Setting a child to uncomplete sets all parent to uncomplete. | ||
29 | Setting a child to complete does not change the parents. | ||
18 | 30 | ||
19 | 31 | ||
20 | ********** VERSION 2.0.0 ************ | 32 | ********** VERSION 2.0.0 ************ |
21 | 33 | ||
22 | Stable release 2.0.0! | 34 | Stable release 2.0.0! |
23 | 35 | ||
24 | KO/Pi: | 36 | KO/Pi: |
25 | Fixed problem in edit dialog recreation at startup. | 37 | Fixed problem in edit dialog recreation at startup. |
26 | Made "toggle view*" menu items enabled context sensitive. | 38 | Made "toggle view*" menu items enabled context sensitive. |
27 | Changed agenda size menu to items 1-10. | 39 | Changed agenda size menu to items 1-10. |
28 | Made it possible to change agenda size quickly by pressing mouse on timelabels in agenda view and move mouse up/down. | 40 | Made it possible to change agenda size quickly by pressing mouse on timelabels in agenda view and move mouse up/down. |
29 | Usebility enhancements in the KO/Pi menus. | 41 | Usebility enhancements in the KO/Pi menus. |
30 | Birthday import now adds year to summary. | 42 | Birthday import now adds year to summary. |
31 | What's Next view shows age in years for birthday. | 43 | What's Next view shows age in years for birthday. |
32 | 44 | ||
33 | OM/Pi: | 45 | OM/Pi: |
34 | Added three info lines to display subject, from and to of selected mails. | 46 | Added three info lines to display subject, from and to of selected mails. |
35 | 47 | ||
36 | KA/Pi: | 48 | KA/Pi: |
37 | Fixed jump bar behaviour on Zaurus. | 49 | Fixed jump bar behaviour on Zaurus. |
38 | Now KA/Pi search field supports searching for a range of starting characters. | 50 | Now KA/Pi search field supports searching for a range of starting characters. |
39 | E.g. to search for all contact beginning with b to n, type | 51 | E.g. to search for all contact beginning with b to n, type |
40 | b-n | 52 | b-n |
41 | in the search field. | 53 | in the search field. |
42 | 54 | ||
43 | ********** VERSION 1.9.20 ************ | 55 | ********** VERSION 1.9.20 ************ |
44 | 56 | ||
45 | KO/Pi: | 57 | KO/Pi: |
46 | Added for the "dislplay one day" agenda mode | 58 | Added for the "dislplay one day" agenda mode |
47 | info in the caption and in the day lables: | 59 | info in the caption and in the day lables: |
48 | Now it is displayed, if the selected day is from "day before yesterday" | 60 | Now it is displayed, if the selected day is from "day before yesterday" |
49 | to "day after tomorrow". | 61 | to "day after tomorrow". |
50 | Made it possible to delete a Todo, which has sub-todos. | 62 | Made it possible to delete a Todo, which has sub-todos. |
51 | Fixed two small problems in the todo view. | 63 | Fixed two small problems in the todo view. |
52 | Added missing German translation for filter edit and print dialog. | 64 | Added missing German translation for filter edit and print dialog. |
53 | Made search dialog closeable by cancel key. | 65 | Made search dialog closeable by cancel key. |
54 | 66 | ||
55 | Made it possible to select in the date picker the (ligt grey ) | 67 | Made it possible to select in the date picker the (ligt grey ) |
56 | dates of the prev./next month with the mouse. | 68 | dates of the prev./next month with the mouse. |
57 | 69 | ||
58 | OM/Pi: | 70 | OM/Pi: |
59 | "Delete mail" icon in main window now deletes all selected mails. | 71 | "Delete mail" icon in main window now deletes all selected mails. |
60 | Fixed the problem, that the state flag of imap mails was ignored. | 72 | Fixed the problem, that the state flag of imap mails was ignored. |
61 | Now mails with "FLAG_SEEN" on the imap server get no icon in the list view | 73 | Now mails with "FLAG_SEEN" on the imap server get no icon in the list view |
62 | to indecate that they are already seen. | 74 | to indecate that they are already seen. |
63 | Fixed the problem that the body of some mails was not displayed in the | 75 | Fixed the problem that the body of some mails was not displayed in the |
64 | mail viewer when fetching them from the imap server directly to read them. | 76 | mail viewer when fetching them from the imap server directly to read them. |
65 | Made it (configurable) possible to show the "To:" field in the list view. | 77 | Made it (configurable) possible to show the "To:" field in the list view. |
66 | Added to the mail viewer the option "View Source" to make it possible to see the raw mail data. | 78 | Added to the mail viewer the option "View Source" to make it possible to see the raw mail data. |
67 | Added a "Download Mail" button to the mail viewer to quickly download the viewed mail to the | 79 | Added a "Download Mail" button to the mail viewer to quickly download the viewed mail to the |
68 | local storage folder (specified in account settings) of the account of the mail. | 80 | local storage folder (specified in account settings) of the account of the mail. |
69 | Removed some memory leaks in OM/Pi. | 81 | Removed some memory leaks in OM/Pi. |
70 | 82 | ||
71 | 83 | ||
72 | ********** VERSION 1.9.19 ************ | 84 | ********** VERSION 1.9.19 ************ |
73 | 85 | ||
74 | Added a lot of missing translations to KA/Pi, | 86 | Added a lot of missing translations to KA/Pi, |
75 | Added some missing translations to KO/Pi and OM/Pi. | 87 | Added some missing translations to KO/Pi and OM/Pi. |
76 | 88 | ||
77 | Fixed some minor problems in KA/Pi + KO/Pi. | 89 | Fixed some minor problems in KA/Pi + KO/Pi. |
78 | 90 | ||
79 | Fixed a crash when closing PwM/Pi. | 91 | Fixed a crash when closing PwM/Pi. |
80 | Added German translation for PwM/Pi. | 92 | Added German translation for PwM/Pi. |
81 | 93 | ||
82 | Made view change and Month View update faster in KO/Pi. | 94 | Made view change and Month View update faster in KO/Pi. |
83 | 95 | ||
84 | 96 | ||
85 | ********** VERSION 1.9.18 ************ | 97 | ********** VERSION 1.9.18 ************ |
86 | 98 | ||
87 | FYI: The VERSION 1.9.17 was a testing release only. | 99 | FYI: The VERSION 1.9.17 was a testing release only. |
88 | Please read the changelog of VERSION 1.9.17 as well. | 100 | Please read the changelog of VERSION 1.9.17 as well. |
89 | 101 | ||
90 | Cleaned up the syncing config dialog. | 102 | Cleaned up the syncing config dialog. |
91 | Added sync config options for date range for events. | 103 | Added sync config options for date range for events. |
92 | Added sync config options for filters on incoming data. | 104 | Added sync config options for filters on incoming data. |
93 | Added sync config options for filters on outgoing data. | 105 | Added sync config options for filters on outgoing data. |
94 | Please read the updated SyncHowTo about the new filter settings. | 106 | Please read the updated SyncHowTo about the new filter settings. |
95 | These filter settings make it now possible to sync with shared | 107 | These filter settings make it now possible to sync with shared |
96 | calendars without writing back private or confidential data | 108 | calendars without writing back private or confidential data |
97 | (via the outgoing filters). | 109 | (via the outgoing filters). |
98 | To sync only with particular parts of a shared calendar, | 110 | To sync only with particular parts of a shared calendar, |
99 | the incoming filter settings can be used. | 111 | the incoming filter settings can be used. |
100 | An example can be found in the SyncHowTo. | 112 | An example can be found in the SyncHowTo. |
101 | Same for shared addressbooks. | 113 | Same for shared addressbooks. |
102 | 114 | ||
103 | Added a setting for the global kdepim data storage. | 115 | Added a setting for the global kdepim data storage. |
104 | Usually the data is stored in (yourhomedir/kdepim). | 116 | Usually the data is stored in (yourhomedir/kdepim). |
105 | Now you can set in the Global config dialog TAB, subTAB "Data storage path" | 117 | Now you can set in the Global config dialog TAB, subTAB "Data storage path" |
106 | a directory where all the kdepim data is stored. | 118 | a directory where all the kdepim data is stored. |
107 | That makes it easy to save all kdepim data on a SD card on the Z, for example. | 119 | That makes it easy to save all kdepim data on a SD card on the Z, for example. |
108 | 120 | ||
109 | KO/Pi: | 121 | KO/Pi: |
110 | The timeedit input has a pulldown list for times. | 122 | The timeedit input has a pulldown list for times. |
111 | If opened, this pulldown list should now has the right time highlighted. | 123 | If opened, this pulldown list should now has the right time highlighted. |
112 | Added the possibility to exclude events/todos/journals in a filter. | 124 | Added the possibility to exclude events/todos/journals in a filter. |
113 | You should exclude journals, if you do not want them to sync with a public calendar. | 125 | You should exclude journals, if you do not want them to sync with a public calendar. |
114 | 126 | ||
115 | KA/Pi: | 127 | KA/Pi: |
116 | Added the possibility to in/exclude public/private/confidential contacts to a filter. | 128 | Added the possibility to in/exclude public/private/confidential contacts to a filter. |
117 | 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 ... | 129 | 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 ... |
118 | Added printing of card view and details view on desktop. | 130 | Added printing of card view and details view on desktop. |
119 | Printing of list view is not working... | 131 | Printing of list view is not working... |
120 | Added button for removing pictures in contact editor. | 132 | Added button for removing pictures in contact editor. |
121 | Parsing data fix of KA/Pi version 1.9.17. | 133 | Parsing data fix of KA/Pi version 1.9.17. |
122 | Fixed the "parse name automatically" problem of KA/Pi version 1.9.17. | 134 | Fixed the "parse name automatically" problem of KA/Pi version 1.9.17. |
123 | Fixed some syncing merging problems. | 135 | Fixed some syncing merging problems. |
124 | 136 | ||
125 | 137 | ||
126 | ********** VERSION 1.9.17 ************ | 138 | ********** VERSION 1.9.17 ************ |
127 | 139 | ||
128 | KO/Pi: | 140 | KO/Pi: |
129 | Fixed that tooltips were not updated after moving an item in agenda view. | 141 | Fixed that tooltips were not updated after moving an item in agenda view. |
130 | Fixed a bug in sorting start date for recurring events in list view. | 142 | Fixed a bug in sorting start date for recurring events in list view. |
131 | Changed the left button in todo viewer from "Agenda" to "Set completed". | 143 | Changed the left button in todo viewer from "Agenda" to "Set completed". |
132 | 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. | 144 | 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. |
133 | Added more info in the todo viewer: Startdate, parent/sub todos. | 145 | Added more info in the todo viewer: Startdate, parent/sub todos. |
134 | 146 | ||
135 | 147 | ||
136 | KA/Pi: | 148 | KA/Pi: |
137 | All fields search does now actually search all the (possible) fields, | 149 | All fields search does now actually search all the (possible) fields, |
138 | not only those listed in the contact list. | 150 | not only those listed in the contact list. |
139 | Made is possible to inline a picture in a vcard on the Z. | 151 | Made is possible to inline a picture in a vcard on the Z. |
140 | This was only possible on the desktop, now is it possible on the Z as well. | 152 | This was only possible on the desktop, now is it possible on the Z as well. |
141 | Fixed of missing save settings after filter configuration. | 153 | Fixed of missing save settings after filter configuration. |
142 | Made saving of addressbook much faster. | 154 | Made saving of addressbook much faster. |
143 | Fixed extension widget layout problem. | 155 | Fixed extension widget layout problem. |
144 | Fixed saving of default formatted name settings. | 156 | Fixed saving of default formatted name settings. |
145 | Fixed formatted name handling in edit dialog. | 157 | Fixed formatted name handling in edit dialog. |
146 | Added an option for changing formatted names of many contacts | 158 | Added an option for changing formatted names of many contacts |
147 | (menu: File - Change - Set formatted name). | 159 | (menu: File - Change - Set formatted name). |
148 | 160 | ||
149 | QWhatsThis was not working on the Z ( only black rectangle was shown). | 161 | QWhatsThis was not working on the Z ( only black rectangle was shown). |
150 | This is Fixed. | 162 | This is Fixed. |
151 | 163 | ||
152 | KDE-Sync: | 164 | KDE-Sync: |
153 | Now readonly KDE resources are synced as well. | 165 | Now readonly KDE resources are synced as well. |
154 | (They are not changed in KDE itself, of course). | 166 | (They are not changed in KDE itself, of course). |
155 | 167 | ||
156 | 168 | ||
157 | 169 | ||
158 | ********** VERSION 1.9.16 ************ | 170 | ********** VERSION 1.9.16 ************ |
159 | 171 | ||
160 | KO/Pi: | 172 | KO/Pi: |
161 | Fixed search dialog size on Z 6000 (480x640 display). | 173 | Fixed search dialog size on Z 6000 (480x640 display). |
162 | Added setting to hide/show time in agenda items. | 174 | Added setting to hide/show time in agenda items. |
163 | Added setting to hide not running todos in todo view. | 175 | Added setting to hide not running todos in todo view. |
164 | Added columns for start date/time in todo view. | 176 | Added columns for start date/time in todo view. |
165 | Replaced the solid half-hour lines in agenda view by dot lines. | 177 | Replaced the solid half-hour lines in agenda view by dot lines. |
166 | Added possibility of printing the What's Next View on the desktop | 178 | Added possibility of printing the What's Next View on the desktop |
167 | (i.e. Windows and Linux). | 179 | (i.e. Windows and Linux). |
168 | Fixed a crash in KO/Pi when starting KO/Pi with What's Next view. | 180 | Fixed a crash in KO/Pi when starting KO/Pi with What's Next view. |
169 | Added tooltips in month view.(Tooltips only available on desktop) | 181 | Added tooltips in month view.(Tooltips only available on desktop) |
170 | 182 | ||
171 | Fixed a strange problem in KO/Pi alarm applet. | 183 | Fixed a strange problem in KO/Pi alarm applet. |
172 | Did not find the actual problem, | 184 | Did not find the actual problem, |
173 | such that now Qtopia reboots again if deinstalling the alarm applet. | 185 | such that now Qtopia reboots again if deinstalling the alarm applet. |
174 | But the alarm applet should work again. | 186 | But the alarm applet should work again. |
175 | 187 | ||
176 | KA/Pi: | 188 | KA/Pi: |
177 | Fixed the problem, that internal pictures were not saved. | 189 | Fixed the problem, that internal pictures were not saved. |
178 | 190 | ||
179 | Fixed a problem in the pi-sync mode by increasing the timeout for data transfer from 20 seconds to 5 minutes. | 191 | Fixed a problem in the pi-sync mode by increasing the timeout for data transfer from 20 seconds to 5 minutes. |
180 | 192 | ||
181 | Fixed some minor problems. (Like word wrap in help text windows). | 193 | Fixed some minor problems. (Like word wrap in help text windows). |
182 | 194 | ||
183 | Fixed a compiling problem in microkde/kresources. | 195 | Fixed a compiling problem in microkde/kresources. |
184 | 196 | ||
185 | KO/Pi is using zdbat (renamed to db2file) for syncing with Sharp DTM. | 197 | KO/Pi is using zdbat (renamed to db2file) for syncing with Sharp DTM. |
186 | This version now includes zdbat 1.0.0 (old version was zdbat 0.2.9) | 198 | This version now includes zdbat 1.0.0 (old version was zdbat 0.2.9) |
187 | such that now syncing KO/Pi with Sharp DTM should work on the | 199 | such that now syncing KO/Pi with Sharp DTM should work on the |
188 | Zaurus C 3000 model. | 200 | Zaurus C 3000 model. |
189 | 201 | ||
190 | ********** VERSION 1.9.15 ************ | 202 | ********** VERSION 1.9.15 ************ |
191 | 203 | ||
192 | Usebilty enhancements in KO/Pi: | 204 | Usebilty enhancements in KO/Pi: |
193 | When clicking on the date in a month view cell, the day view is shown. | 205 | When clicking on the date in a month view cell, the day view is shown. |
194 | Old behaviour was, that the "new event" dialog popped up. | 206 | Old behaviour was, that the "new event" dialog popped up. |
195 | 207 | ||
196 | Added a one step "undo delete" in KO/Pi (Accessable in the "Action" menu). | 208 | Added a one step "undo delete" in KO/Pi (Accessable in the "Action" menu). |
197 | That means, you can restore the latest | 209 | That means, you can restore the latest |
198 | event/todo/journal you have deleted. | 210 | event/todo/journal you have deleted. |
199 | A journal is deleted, if you clear all the text of the journal. | 211 | A journal is deleted, if you clear all the text of the journal. |
200 | 212 | ||
201 | Fixed the bug of the editor dialogs in KO/Pi of version 1.9.14. | 213 | Fixed the bug of the editor dialogs in KO/Pi of version 1.9.14. |
202 | 214 | ||
203 | KA/Pi starting in 480x640 resolution: | 215 | KA/Pi starting in 480x640 resolution: |
204 | Hide the filter action in toolbar | 216 | Hide the filter action in toolbar |
205 | and added icons for undo/delete/redo in toolbar. | 217 | and added icons for undo/delete/redo in toolbar. |
206 | 218 | ||
207 | Change in OM/Pi ViewMail dialog: | 219 | Change in OM/Pi ViewMail dialog: |
208 | When clicking on the "delete" icon the mail is deleted after confirmation as usual. | 220 | When clicking on the "delete" icon the mail is deleted after confirmation as usual. |
209 | But the edit dialog is not closed as before, now the next mail in the folder is shown automatically (if there is any). | 221 | But the edit dialog is not closed as before, now the next mail in the folder is shown automatically (if there is any). |
210 | 222 | ||
211 | Fixed a crash when deleting mail-accounts in OM/Pi. | 223 | Fixed a crash when deleting mail-accounts in OM/Pi. |
212 | 224 | ||
213 | 225 | ||
214 | ********** VERSION 1.9.14 ************ | 226 | ********** VERSION 1.9.14 ************ |
215 | 227 | ||
216 | Fixed some problems with the dialog sizes when switching | 228 | Fixed some problems with the dialog sizes when switching |
217 | portrait/landscape mode on 640x480 PDA display. | 229 | portrait/landscape mode on 640x480 PDA display. |
218 | 230 | ||
219 | Fixed some other small bugs in KA/Pi KO/Pi and OM/Pi and PwM/Pi. | 231 | Fixed some other small bugs in KA/Pi KO/Pi and OM/Pi and PwM/Pi. |
220 | 232 | ||
221 | Fixed an ugly bug in KOpieMail: | 233 | Fixed an ugly bug in KOpieMail: |
222 | KOpieMail was not able to write files (mails) to MSDOS file system, | 234 | KOpieMail was not able to write files (mails) to MSDOS file system, |
223 | like on an usual preformatted SD card. That should work now. | 235 | like on an usual preformatted SD card. That should work now. |
224 | To save your mail data on the Sd card do the following: | 236 | To save your mail data on the Sd card do the following: |
225 | Create a dir on the SD card: | 237 | Create a dir on the SD card: |
226 | mkdir /mnt/card/localmail | 238 | mkdir /mnt/card/localmail |
227 | Go to your home dir: | 239 | Go to your home dir: |
228 | cd | 240 | cd |
229 | Go to kopiemail data storage dir: | 241 | Go to kopiemail data storage dir: |
230 | cd kdepim/apps/kopiemail | 242 | cd kdepim/apps/kopiemail |
231 | Create a symlink to the SD card: | 243 | Create a symlink to the SD card: |
232 | ls -s /mnt/card/localmail | 244 | ls -s /mnt/card/localmail |
233 | Now KOpieMail will store all mails on the SD card. | 245 | Now KOpieMail will store all mails on the SD card. |
234 | 246 | ||
235 | KO/Pi Monthview: | 247 | KO/Pi Monthview: |
236 | Now "Go to Today" selects the current month from day 1-end, | 248 | Now "Go to Today" selects the current month from day 1-end, |
237 | not the current date + some days. | 249 | not the current date + some days. |
238 | I.e. "Go to Today" shows now always | 250 | I.e. "Go to Today" shows now always |
239 | the current month with first day of month in the first row. | 251 | the current month with first day of month in the first row. |
240 | 252 | ||
241 | Added missing German translation. | 253 | Added missing German translation. |
242 | 254 | ||
243 | Fixed icons of executeable on Wintendo. | 255 | Fixed icons of executeable on Wintendo. |
244 | 256 | ||
245 | Added a "Show next Mail" button to the OM/Pi | 257 | Added a "Show next Mail" button to the OM/Pi |
246 | mail viewer such that the mail below the current mail | 258 | mail viewer such that the mail below the current mail |
247 | in the mail list view of the current folder | 259 | in the mail list view of the current folder |
248 | can be read with a single click. | 260 | can be read with a single click. |
249 | 261 | ||
250 | 262 | ||
251 | ********** VERSION 1.9.13 ************ | 263 | ********** VERSION 1.9.13 ************ |
252 | 264 | ||
253 | Fixed nasty PwM/Pi file reading bug, when | 265 | Fixed nasty PwM/Pi file reading bug, when |
254 | the used hash algo of file is different then the global | 266 | the used hash algo of file is different then the global |
255 | hash algo. | 267 | hash algo. |
256 | 268 | ||
257 | Added KA/Pi support for opie mailit mailapplication. | 269 | Added KA/Pi support for opie mailit mailapplication. |
258 | 270 | ||
259 | Fixed some bugs in OM/Pi. | 271 | Fixed some bugs in OM/Pi. |
260 | Now character conversion tables are available for the Zaurus | 272 | Now character conversion tables are available for the Zaurus |
261 | to make OM/Pi working properly. | 273 | to make OM/Pi working properly. |
262 | To get the character conversion in OM/Pi working, please download | 274 | To get the character conversion in OM/Pi working, please download |
263 | at the sourceforge project site the package | 275 | at the sourceforge project site the package |
264 | sr-character-conversion_SharpROM_arm.ipk.zip | 276 | sr-character-conversion_SharpROM_arm.ipk.zip |
265 | (or oz-character-conversion_OZ-gcc3xx_arm.ipk.zip for OZ roms) | 277 | (or oz-character-conversion_OZ-gcc3xx_arm.ipk.zip for OZ roms) |
266 | from the section "general files for KDE/Pim" | 278 | from the section "general files for KDE/Pim" |
267 | Instructions how to install this package are in a ReadMe in this file. | 279 | Instructions how to install this package are in a ReadMe in this file. |
268 | 280 | ||
269 | 281 | ||
270 | Fixed the orientation change problem in KA/Pi when switching | 282 | Fixed the orientation change problem in KA/Pi when switching |
271 | portrait/landscape mode. | 283 | portrait/landscape mode. |
272 | 284 | ||
273 | French translation available for KA/Pi and OM/Pi. | 285 | French translation available for KA/Pi and OM/Pi. |
274 | 286 | ||
275 | Fixed some problems with categories in KO/Pi in DTM sync. | 287 | Fixed some problems with categories in KO/Pi in DTM sync. |
276 | 288 | ||
277 | Added selection dialog for export to phone in KA/Pi. | 289 | Added selection dialog for export to phone in KA/Pi. |
278 | 290 | ||
279 | If in KO/Pi is an attendee selected to add to a meeting and this | 291 | If in KO/Pi is an attendee selected to add to a meeting and this |
280 | attendee is already in the list of attendees, this person is not added | 292 | attendee is already in the list of attendees, this person is not added |
281 | again. | 293 | again. |
282 | 294 | ||
283 | Some menu cleanup in KA/Pi. | 295 | Some menu cleanup in KA/Pi. |
284 | 296 | ||
285 | ********** VERSION 1.9.12 ************ | 297 | ********** VERSION 1.9.12 ************ |
286 | 298 | ||
287 | Fix for the bug in KO/Pi What's Next view of version 1.9.11. | 299 | Fix for the bug in KO/Pi What's Next view of version 1.9.11. |
288 | 300 | ||
289 | Bugfix: Licence file is now shown again. | 301 | Bugfix: Licence file is now shown again. |
290 | 302 | ||
291 | OM/Pi now supports Unicode (utf8 charset). | 303 | OM/Pi now supports Unicode (utf8 charset). |
292 | Fixed some bugs in OM/Pi. | 304 | Fixed some bugs in OM/Pi. |
293 | 305 | ||
294 | KA/Pi has more German translation. | 306 | KA/Pi has more German translation. |
295 | 307 | ||
296 | 308 | ||
297 | ********** VERSION 1.9.11 ************ | 309 | ********** VERSION 1.9.11 ************ |
298 | 310 | ||
299 | Fixed several problems in PWM/Pi, like | 311 | Fixed several problems in PWM/Pi, like |
300 | asking the user, if unsaved changed are pending | 312 | asking the user, if unsaved changed are pending |
301 | when closing the app. | 313 | when closing the app. |
302 | And PwM/Pi handles now different texts for the | 314 | And PwM/Pi handles now different texts for the |
303 | fields Description, Username, Password, configurable per category. | 315 | fields Description, Username, Password, configurable per category. |
304 | 316 | ||
305 | Fixed a crash in KO/Pi , when importing/loading vcs files | 317 | Fixed a crash in KO/Pi , when importing/loading vcs files |
306 | which have an entry with an attendee with state: | 318 | which have an entry with an attendee with state: |
307 | NEEDS ACTION | 319 | NEEDS ACTION |
308 | 320 | ||
309 | Fixed some problems in the German translation of OM/Pi, | 321 | Fixed some problems in the German translation of OM/Pi, |
310 | which makes some dialogs not fitting on the screen | 322 | which makes some dialogs not fitting on the screen |
311 | of the Z 5500. | 323 | of the Z 5500. |
312 | 324 | ||
313 | Fixed Qtopia crash, when disabling/deinstalling | 325 | Fixed Qtopia crash, when disabling/deinstalling |
314 | KO/Pi alarm applet. | 326 | KO/Pi alarm applet. |
315 | 327 | ||
316 | Implemented direct KDE<->KA/Pi sync for KA/Pi running | 328 | Implemented direct KDE<->KA/Pi sync for KA/Pi running |
317 | on Linux desktop. | 329 | on Linux desktop. |
318 | 330 | ||
319 | Added feature "remove sync info" to sync menu. | 331 | Added feature "remove sync info" to sync menu. |
320 | 332 | ||
321 | Tweaked the KO/Pi What's next view a bit, added | 333 | Tweaked the KO/Pi What's next view a bit, added |
322 | setting to hide events that are done. | 334 | setting to hide events that are done. |
323 | 335 | ||
324 | Disabled "beam receive enabled" on startup to | 336 | Disabled "beam receive enabled" on startup to |
325 | avoid problems if Fastload is enabled. | 337 | avoid problems if Fastload is enabled. |
326 | Please set "beam receive enabled", | 338 | Please set "beam receive enabled", |
327 | if you want to receive data via IR. | 339 | if you want to receive data via IR. |
328 | 340 | ||
329 | Fixed bug in direct KDE<->KO/Pi sync for KO/Pi running | 341 | Fixed bug in direct KDE<->KO/Pi sync for KO/Pi running |
330 | on Linux desktop. | 342 | on Linux desktop. |
331 | 343 | ||
332 | Made in KA/Pi scrolling possible, if details view is selected. | 344 | Made in KA/Pi scrolling possible, if details view is selected. |
333 | (The keyboard focus is set automatically to the search line) | 345 | (The keyboard focus is set automatically to the search line) |
334 | 346 | ||
335 | Fixed a bug in DMT sync, that a new entry in DTM was added | 347 | Fixed a bug in DMT sync, that a new entry in DTM was added |
336 | on every sync to Kx/Pi. | 348 | on every sync to Kx/Pi. |
337 | 349 | ||
338 | Fixed missing writing of KA/Pi categories to DMT entries when syncing. | 350 | Fixed missing writing of KA/Pi categories to DMT entries when syncing. |
339 | 351 | ||
340 | Fixed a bug in DMT sync with todos created in KO/Pi containing | 352 | Fixed a bug in DMT sync with todos created in KO/Pi containing |
341 | non-latin1 characters. | 353 | non-latin1 characters. |
342 | 354 | ||
343 | Rearranged package contents of Sharp-ipks and made all | 355 | Rearranged package contents of Sharp-ipks and made all |
344 | packages installable on SD again. | 356 | packages installable on SD again. |
345 | 357 | ||
346 | Fixed the writing of addressbook data in DTM sync. | 358 | Fixed the writing of addressbook data in DTM sync. |
347 | Empty fields in KA/Pi were not removed. | 359 | Empty fields in KA/Pi were not removed. |
348 | 360 | ||
349 | Added better category handling in KA/Pi: | 361 | Added better category handling in KA/Pi: |
350 | Added item | 362 | Added item |
351 | Edit Categories and | 363 | Edit Categories and |
352 | Manage new categories | 364 | Manage new categories |
353 | to the settings menu. | 365 | to the settings menu. |
354 | Possible to configure a view to display categories. | 366 | Possible to configure a view to display categories. |
355 | 367 | ||
356 | Added detailed "KDE Sync Howto" and "Multi Sync Howto" to Help menu. | 368 | Added detailed "KDE Sync Howto" and "Multi Sync Howto" to Help menu. |
357 | 369 | ||
358 | Fixed displaying of "free" days and time in KO Monthview and Agendaview. | 370 | Fixed displaying of "free" days and time in KO Monthview and Agendaview. |
359 | 371 | ||
360 | ... and many other bugfixes. | 372 | ... and many other bugfixes. |
361 | 373 | ||
362 | ********** VERSION 1.9.10 ************ | 374 | ********** VERSION 1.9.10 ************ |
363 | 375 | ||
364 | Many internal small bugfixes. | 376 | Many internal small bugfixes. |
365 | And fix of the "big" bug in KO/Pi, | 377 | And fix of the "big" bug in KO/Pi, |
366 | that after Syncing the appointments had an offset by several hours. | 378 | that after Syncing the appointments had an offset by several hours. |
367 | That was a problem with the internal timezone setting, | 379 | That was a problem with the internal timezone setting, |
368 | introduced by the changed timezone configuration settings. | 380 | introduced by the changed timezone configuration settings. |
369 | 381 | ||
370 | German translation for OM/Pi is now available. | 382 | German translation for OM/Pi is now available. |
371 | 383 | ||
372 | 384 | ||
373 | ********** VERSION 1.9.9 ************ | 385 | ********** VERSION 1.9.9 ************ |
374 | 386 | ||
375 | KDE-Pim/Pi has a new Member! | 387 | KDE-Pim/Pi has a new Member! |
376 | It is called PWM/Pi (Passwordmanager/platform-independent) | 388 | It is called PWM/Pi (Passwordmanager/platform-independent) |
377 | and it is available for the Zaurus. | 389 | and it is available for the Zaurus. |
378 | It is planned, that it will be available later for Windows. | 390 | It is planned, that it will be available later for Windows. |
379 | (And for Linux, of course). | 391 | (And for Linux, of course). |
380 | It is a port of the Passwordmanager of KDE. | 392 | It is a port of the Passwordmanager of KDE. |
381 | It will need the MicroKDElibs to run. | 393 | It will need the MicroKDElibs to run. |
382 | 394 | ||
383 | Made loading of addressbooks in KA/Pi up to 7 times faster! | 395 | Made loading of addressbooks in KA/Pi up to 7 times faster! |
384 | The bigger your addressbook file, the more starting speed | 396 | The bigger your addressbook file, the more starting speed |
385 | will you gain. (relatively) | 397 | will you gain. (relatively) |
386 | 398 | ||
387 | The Qtopia addressbook connector is now platform independend | 399 | The Qtopia addressbook connector is now platform independend |
388 | as well and should work on any platform for importing/exporting | 400 | as well and should work on any platform for importing/exporting |
389 | Qtopia and Opie XML files. | 401 | Qtopia and Opie XML files. |
390 | 402 | ||
391 | Added a +30min feature to the timezone settings to make | 403 | Added a +30min feature to the timezone settings to make |
392 | KDE-Pim/Pi useable in Australia and other parts on the | 404 | KDE-Pim/Pi useable in Australia and other parts on the |
393 | world with strange timezones ;-) | 405 | world with strange timezones ;-) |
394 | 406 | ||
395 | German "Umlaute" should now be sorted correctly on the Z in KA/Pi. | 407 | German "Umlaute" should now be sorted correctly on the Z in KA/Pi. |
396 | 408 | ||
397 | It is now possible to disable the | 409 | It is now possible to disable the |
398 | "receive data via infrared" feature, such that syncing with | 410 | "receive data via infrared" feature, such that syncing with |
399 | Outlook is now possible again with Kx/Pi runing. | 411 | Outlook is now possible again with Kx/Pi runing. |
400 | Please disable it, before syncing Sharp DTM with Outlook. | 412 | Please disable it, before syncing Sharp DTM with Outlook. |
401 | For your convenience, the "receive data via infrared" feature | 413 | For your convenience, the "receive data via infrared" feature |
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp index b420351..f31e50a 100644 --- a/korganizer/kdatenavigator.cpp +++ b/korganizer/kdatenavigator.cpp | |||
@@ -1,367 +1,367 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001,2002 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001,2002 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qstring.h> | 24 | #include <qstring.h> |
25 | #include <qkeycode.h> | 25 | #include <qkeycode.h> |
26 | #include <qlayout.h> | 26 | #include <qlayout.h> |
27 | #include <qtimer.h> | 27 | #include <qtimer.h> |
28 | #include <qframe.h> | 28 | #include <qframe.h> |
29 | #include <qlabel.h> | 29 | #include <qlabel.h> |
30 | #include <qapplication.h> | 30 | #include <qapplication.h> |
31 | 31 | ||
32 | #include <kdebug.h> | 32 | #include <kdebug.h> |
33 | #include <klocale.h> | 33 | #include <klocale.h> |
34 | #include <kglobal.h> | 34 | #include <kglobal.h> |
35 | 35 | ||
36 | #include "koglobals.h" | 36 | #include "koglobals.h" |
37 | #include "koprefs.h" | 37 | #include "koprefs.h" |
38 | #ifndef KORG_NOPLUGINS | 38 | #ifndef KORG_NOPLUGINS |
39 | #include "kocore.h" | 39 | #include "kocore.h" |
40 | #endif | 40 | #endif |
41 | 41 | ||
42 | #include <kcalendarsystem.h> | 42 | #include <kcalendarsystem.h> |
43 | 43 | ||
44 | #include "navigatorbar.h" | 44 | #include "navigatorbar.h" |
45 | 45 | ||
46 | #include "kdatenavigator.h" | 46 | #include "kdatenavigator.h" |
47 | 47 | ||
48 | KDateNavigator::KDateNavigator( QWidget *parent, Calendar *calendar, | 48 | KDateNavigator::KDateNavigator( QWidget *parent, Calendar *calendar, |
49 | bool show_week_nums, const char *name, | 49 | bool show_week_nums, const char *name, |
50 | QDate startDate ) | 50 | QDate startDate ) |
51 | : QFrame(parent, name), | 51 | : QFrame(parent, name), |
52 | updateTimer(0L) | 52 | updateTimer(0L) |
53 | { | 53 | { |
54 | mCalendar = calendar; | 54 | mCalendar = calendar; |
55 | 55 | ||
56 | setFrameStyle(QFrame::NoFrame); | 56 | setFrameStyle(QFrame::NoFrame); |
57 | 57 | ||
58 | QGridLayout *topLayout = new QGridLayout(this,8,8); | 58 | QGridLayout *topLayout = new QGridLayout(this,8,8); |
59 | 59 | ||
60 | if (! startDate.isValid()) { | 60 | if (! startDate.isValid()) { |
61 | kdDebug() << "KDateNavigator::KDateNavigator(): an invalid date was passed as a parameter!" << endl; | 61 | kdDebug() << "KDateNavigator::KDateNavigator(): an invalid date was passed as a parameter!" << endl; |
62 | startDate = QDate::currentDate(); | 62 | startDate = QDate::currentDate(); |
63 | } | 63 | } |
64 | 64 | ||
65 | mSelectedDates.append(startDate); | 65 | mSelectedDates.append(startDate); |
66 | m_MthYr = startDate; | 66 | m_MthYr = startDate; |
67 | m_bShowWeekNums = show_week_nums; | 67 | m_bShowWeekNums = show_week_nums; |
68 | 68 | ||
69 | setFont( KOPrefs::instance()->mDateNavigatorFont ); | 69 | setFont( KOPrefs::instance()->mDateNavigatorFont ); |
70 | mNavigatorBar = new NavigatorBar( startDate, this ); | 70 | mNavigatorBar = new NavigatorBar( startDate, this ); |
71 | topLayout->addMultiCellWidget( mNavigatorBar, 0, 0, 0, 7 ); | 71 | topLayout->addMultiCellWidget( mNavigatorBar, 0, 0, 0, 7 ); |
72 | //mNavigatorBar->resize( 1,1); | 72 | //mNavigatorBar->resize( 1,1); |
73 | connect( mNavigatorBar, SIGNAL( goPrevYear() ), SIGNAL( goPrevYear() ) ); | 73 | connect( mNavigatorBar, SIGNAL( goPrevYear() ), SIGNAL( goPrevYear() ) ); |
74 | connect( mNavigatorBar, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) ); | 74 | connect( mNavigatorBar, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) ); |
75 | connect( mNavigatorBar, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) ); | 75 | connect( mNavigatorBar, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) ); |
76 | connect( mNavigatorBar, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) ); | 76 | connect( mNavigatorBar, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) ); |
77 | connect( mNavigatorBar, SIGNAL( monthSelected( int ) ), SIGNAL( monthSelected( int ) ) ); | 77 | connect( mNavigatorBar, SIGNAL( monthSelected( int ) ), SIGNAL( monthSelected( int ) ) ); |
78 | 78 | ||
79 | // get the day of the week on the first day | 79 | // get the day of the week on the first day |
80 | QDate dayone(m_MthYr.year(), m_MthYr.month(), 1); | 80 | QDate dayone(m_MthYr.year(), m_MthYr.month(), 1); |
81 | m_fstDayOfWk = dayone.dayOfWeek(); | 81 | m_fstDayOfWk = dayone.dayOfWeek(); |
82 | 82 | ||
83 | int i; | 83 | int i; |
84 | 84 | ||
85 | // Set up the heading fields. | 85 | // Set up the heading fields. |
86 | for( i = 0; i < 7; i++ ) { | 86 | for( i = 0; i < 7; i++ ) { |
87 | headings[i] = new QLabel("",this); | 87 | headings[i] = new QLabel("",this); |
88 | //headings[i]->setFont(QFont("Arial", 10, QFont::Bold)); | 88 | //headings[i]->setFont(QFont("Arial", 10, QFont::Bold)); |
89 | headings[i]->setAlignment(AlignCenter); | 89 | headings[i]->setAlignment(AlignCenter); |
90 | 90 | ||
91 | topLayout->addWidget(headings[i],1,i+1); | 91 | topLayout->addWidget(headings[i],1,i+1); |
92 | } | 92 | } |
93 | 93 | ||
94 | // Create the weeknumber labels | 94 | // Create the weeknumber labels |
95 | for( i = 0; i < 6; i++ ) { | 95 | for( i = 0; i < 6; i++ ) { |
96 | weeknos[i] = new QLabel(this); | 96 | weeknos[i] = new QLabel(this); |
97 | weeknos[i]->setAlignment(AlignCenter); | 97 | weeknos[i]->setAlignment(AlignCenter); |
98 | //weeknos[i]->setFont(QFont("Arial", 10)); | 98 | //weeknos[i]->setFont(QFont("Arial", 10)); |
99 | if(!show_week_nums) { | 99 | if(!show_week_nums) { |
100 | weeknos[i]->hide(); | 100 | weeknos[i]->hide(); |
101 | } | 101 | } |
102 | weeknos[i]->installEventFilter(this); | 102 | weeknos[i]->installEventFilter(this); |
103 | 103 | ||
104 | topLayout->addWidget(weeknos[i],i+2,0); | 104 | topLayout->addWidget(weeknos[i],i+2,0); |
105 | } | 105 | } |
106 | 106 | ||
107 | daymatrix = new KODayMatrix( this, mCalendar, dayone, | 107 | daymatrix = new KODayMatrix( this, mCalendar, dayone, |
108 | "KDateNavigator::DayMatrix"); | 108 | "KDateNavigator::DayMatrix"); |
109 | daymatrix->setFrameStyle(QFrame::Panel|QFrame::Sunken); | 109 | daymatrix->setFrameStyle(QFrame::Panel|QFrame::Sunken); |
110 | daymatrix->setLineWidth(1); | 110 | daymatrix->setLineWidth(1); |
111 | 111 | ||
112 | connect( daymatrix, SIGNAL( selected( const KCal::DateList & ) ), | 112 | connect( daymatrix, SIGNAL( selected( const KCal::DateList & ) ), |
113 | SIGNAL( datesSelected( const KCal::DateList & ) ) ); | 113 | SIGNAL( datesSelected( const KCal::DateList & ) ) ); |
114 | 114 | ||
115 | connect( daymatrix, SIGNAL( eventDropped( Event * ) ), | 115 | connect( daymatrix, SIGNAL( eventDropped( Event * ) ), |
116 | SIGNAL( eventDropped( Event * ) ) ); | 116 | SIGNAL( eventDropped( Event * ) ) ); |
117 | 117 | ||
118 | topLayout->addMultiCellWidget(daymatrix,2,7,1,7); | 118 | topLayout->addMultiCellWidget(daymatrix,2,7,1,7); |
119 | 119 | ||
120 | // read settings from configuration file. | 120 | // read settings from configuration file. |
121 | updateConfig(); | 121 | updateConfig(); |
122 | enableRollover(FollowMonth); | 122 | enableRollover(FollowMonth); |
123 | setFixedSize ( sizeHint() ); | 123 | setFixedSize ( sizeHint() ); |
124 | } | 124 | } |
125 | 125 | ||
126 | void KDateNavigator::enableRollover(RolloverType r) | 126 | void KDateNavigator::enableRollover(RolloverType r) |
127 | { | 127 | { |
128 | switch(r) | 128 | switch(r) |
129 | { | 129 | { |
130 | case None : | 130 | case None : |
131 | if (updateTimer) | 131 | if (updateTimer) |
132 | { | 132 | { |
133 | updateTimer->stop(); | 133 | updateTimer->stop(); |
134 | delete updateTimer; | 134 | delete updateTimer; |
135 | updateTimer=0L; | 135 | updateTimer=0L; |
136 | } | 136 | } |
137 | break; | 137 | break; |
138 | case FollowDay : | 138 | case FollowDay : |
139 | case FollowMonth : | 139 | case FollowMonth : |
140 | if (!updateTimer) | 140 | if (!updateTimer) |
141 | { | 141 | { |
142 | updateTimer = new QTimer(this); | 142 | updateTimer = new QTimer(this); |
143 | QObject::connect(updateTimer,SIGNAL(timeout()), | 143 | QObject::connect(updateTimer,SIGNAL(timeout()), |
144 | this,SLOT(possiblyPastMidnight())); | 144 | this,SLOT(possiblyPastMidnight())); |
145 | } | 145 | } |
146 | updateTimer->start(0,true); | 146 | updateTimer->start(0,true); |
147 | lastDayChecked = QDate::currentDate(); | 147 | lastDayChecked = QDate::currentDate(); |
148 | } | 148 | } |
149 | updateRollover=r; | 149 | updateRollover=r; |
150 | } | 150 | } |
151 | 151 | ||
152 | 152 | ||
153 | KDateNavigator::~KDateNavigator() | 153 | KDateNavigator::~KDateNavigator() |
154 | { | 154 | { |
155 | } | 155 | } |
156 | 156 | ||
157 | 157 | ||
158 | void KDateNavigator::passedMidnight() | 158 | void KDateNavigator::passedMidnight() |
159 | { | 159 | { |
160 | QDate today = QDate::currentDate(); | 160 | QDate today = QDate::currentDate(); |
161 | bool emitMonth = false; | 161 | bool emitMonth = false; |
162 | 162 | ||
163 | if (today.month() != lastDayChecked.month()) | 163 | if (today.month() != lastDayChecked.month()) |
164 | { | 164 | { |
165 | if (updateRollover==FollowMonth && | 165 | if (updateRollover==FollowMonth && |
166 | daymatrix->isEndOfMonth()) { | 166 | daymatrix->isEndOfMonth()) { |
167 | goNextMonth(); | 167 | goNextMonth(); |
168 | emitMonth=true; | 168 | emitMonth=true; |
169 | } | 169 | } |
170 | } | 170 | } |
171 | daymatrix->recalculateToday(); | 171 | daymatrix->recalculateToday(); |
172 | daymatrix->repaint(); | 172 | daymatrix->repaint(); |
173 | emit dayPassed(today); | 173 | emit dayPassed(today); |
174 | if (emitMonth) { emit monthPassed(today); } | 174 | if (emitMonth) { emit monthPassed(today); } |
175 | } | 175 | } |
176 | 176 | ||
177 | /* slot */ void KDateNavigator::possiblyPastMidnight() | 177 | /* slot */ void KDateNavigator::possiblyPastMidnight() |
178 | { | 178 | { |
179 | if (lastDayChecked!=QDate::currentDate()) | 179 | if (lastDayChecked!=QDate::currentDate()) |
180 | { | 180 | { |
181 | passedMidnight(); | 181 | passedMidnight(); |
182 | lastDayChecked=QDate::currentDate(); | 182 | lastDayChecked=QDate::currentDate(); |
183 | } | 183 | } |
184 | // Set the timer to go off 1 second after midnight | 184 | // Set the timer to go off 1 second after midnight |
185 | // or after 8 minutes, whichever comes first. | 185 | // or after 8 minutes, whichever comes first. |
186 | if (updateTimer) | 186 | if (updateTimer) |
187 | { | 187 | { |
188 | QTime now = QTime::currentTime(); | 188 | QTime now = QTime::currentTime(); |
189 | QTime midnight = QTime(23,59,59); | 189 | QTime midnight = QTime(23,59,59); |
190 | int msecsWait = QMIN(480000,now.msecsTo(midnight)+2000); | 190 | int msecsWait = QMIN(480000,now.msecsTo(midnight)+2000); |
191 | 191 | ||
192 | // qDebug(QString("Waiting %1 msec from %2 to %3.").arg(msecsWait)) | 192 | // qDebug(QString("Waiting %1 msec from %2 to %3.").arg(msecsWait)) |
193 | //.arg(now.toString()).arg(midnight.toString())); | 193 | //.arg(now.toString()).arg(midnight.toString())); |
194 | 194 | ||
195 | updateTimer->stop(); | 195 | updateTimer->stop(); |
196 | updateTimer->start(msecsWait,true); | 196 | updateTimer->start(msecsWait,true); |
197 | } | 197 | } |
198 | } | 198 | } |
199 | 199 | ||
200 | void KDateNavigator::updateDates() | 200 | void KDateNavigator::updateDates() |
201 | { | 201 | { |
202 | // Find the first day of the week of the current month. | 202 | // Find the first day of the week of the current month. |
203 | //int d1 = KOGlobals::self()->calendarSystem()->day( m_MthYr ); | 203 | //int d1 = KOGlobals::self()->calendarSystem()->day( m_MthYr ); |
204 | QDate dayone( m_MthYr.year(), m_MthYr.month(), m_MthYr.day() ); | 204 | QDate dayone( m_MthYr.year(), m_MthYr.month(), m_MthYr.day() ); |
205 | int d2 = KOGlobals::self()->calendarSystem()->day( dayone ); | 205 | int d2 = KOGlobals::self()->calendarSystem()->day( dayone ); |
206 | //int di = d1 - d2 + 1; | 206 | //int di = d1 - d2 + 1; |
207 | dayone = dayone.addDays( -d2 + 1 ); | 207 | dayone = dayone.addDays( -d2 + 1 ); |
208 | 208 | ||
209 | int m_fstDayOfWkCalsys = KOGlobals::self()->calendarSystem()->dayOfWeek( dayone ); | 209 | int m_fstDayOfWkCalsys = KOGlobals::self()->calendarSystem()->dayOfWeek( dayone ); |
210 | 210 | ||
211 | // If month begins on Monday and Monday is first day of week, | 211 | // If month begins on Monday and Monday is first day of week, |
212 | // month should begin on second line. Sunday doesn't have this problem. | 212 | // month should begin on second line. Sunday doesn't have this problem. |
213 | int nextLine = ( ( m_fstDayOfWkCalsys == 1) && | 213 | int nextLine = ( ( m_fstDayOfWkCalsys == 1) && |
214 | ( KGlobal::locale()->weekStartsMonday() == 1 ) ) ? 7 : 0; | 214 | ( KGlobal::locale()->weekStartsMonday() == 1 ) ) ? 7 : 0; |
215 | 215 | ||
216 | // update the matrix dates | 216 | // update the matrix dates |
217 | int index = (KGlobal::locale()->weekStartsMonday() ? 1 : 0) - m_fstDayOfWkCalsys - nextLine; | 217 | int index = (KGlobal::locale()->weekStartsMonday() ? 1 : 0) - m_fstDayOfWkCalsys - nextLine; |
218 | 218 | ||
219 | 219 | ||
220 | daymatrix->updateView(dayone.addDays(index)); | 220 | daymatrix->updateView(dayone.addDays(index)); |
221 | //each updateDates is followed by an updateView -> repaint is issued there ! | 221 | //each updateDates is followed by an updateView -> repaint is issued there ! |
222 | // daymatrix->repaint(); | 222 | // daymatrix->repaint(); |
223 | } | 223 | } |
224 | 224 | ||
225 | void KDateNavigator::updateDayMatrix() | 225 | void KDateNavigator::updateDayMatrix() |
226 | { | 226 | { |
227 | daymatrix->updateView(); | 227 | daymatrix->updateView(); |
228 | daymatrix->repaint(); | 228 | //daymatrix->repaint(); |
229 | } | 229 | } |
230 | 230 | ||
231 | 231 | ||
232 | void KDateNavigator::updateView() | 232 | void KDateNavigator::updateView() |
233 | { | 233 | { |
234 | 234 | ||
235 | setUpdatesEnabled( false ); | 235 | setUpdatesEnabled( false ); |
236 | 236 | ||
237 | int i; | 237 | int i; |
238 | 238 | ||
239 | // kdDebug() << "updateView() -> daymatrix->updateView()" << endl; | 239 | // kdDebug() << "updateView() -> daymatrix->updateView()" << endl; |
240 | daymatrix->updateView(); | 240 | daymatrix->updateView(); |
241 | 241 | ||
242 | // set the week numbers. | 242 | // set the week numbers. |
243 | for(i = 0; i < 6; i++) { | 243 | for(i = 0; i < 6; i++) { |
244 | QString weeknum; | 244 | QString weeknum; |
245 | // remember, according to ISO 8601, the first week of the year is the | 245 | // remember, according to ISO 8601, the first week of the year is the |
246 | // first week that contains a thursday. Thus we must subtract off 4, | 246 | // first week that contains a thursday. Thus we must subtract off 4, |
247 | // not just 1. | 247 | // not just 1. |
248 | 248 | ||
249 | //ET int dayOfYear = buttons[(i + 1) * 7 - 4]->date().dayOfYear(); | 249 | //ET int dayOfYear = buttons[(i + 1) * 7 - 4]->date().dayOfYear(); |
250 | int dayOfYear = KOGlobals::self()->calendarSystem()->dayOfYear((daymatrix->getDate((i+1)*7-4))); | 250 | int dayOfYear = KOGlobals::self()->calendarSystem()->dayOfYear((daymatrix->getDate((i+1)*7-4))); |
251 | 251 | ||
252 | int add = 0; | 252 | int add = 0; |
253 | if ( ! KGlobal::locale()->weekStartsMonday() ) | 253 | if ( ! KGlobal::locale()->weekStartsMonday() ) |
254 | ++add; | 254 | ++add; |
255 | if (dayOfYear % 7 != 0) | 255 | if (dayOfYear % 7 != 0) |
256 | weeknum.setNum(dayOfYear / 7 + 1+add); | 256 | weeknum.setNum(dayOfYear / 7 + 1+add); |
257 | else | 257 | else |
258 | weeknum.setNum(dayOfYear / 7 +add); | 258 | weeknum.setNum(dayOfYear / 7 +add); |
259 | weeknos[i]->setText(weeknum); | 259 | weeknos[i]->setText(weeknum); |
260 | } | 260 | } |
261 | 261 | ||
262 | setUpdatesEnabled( true ); | 262 | setUpdatesEnabled( true ); |
263 | // kdDebug() << "updateView() -> repaint()" << endl; | 263 | // kdDebug() << "updateView() -> repaint()" << endl; |
264 | repaint(); | 264 | repaint(); |
265 | daymatrix->repaint(); | 265 | // daymatrix->repaint(); |
266 | } | 266 | } |
267 | 267 | ||
268 | void KDateNavigator::updateConfig() | 268 | void KDateNavigator::updateConfig() |
269 | { | 269 | { |
270 | int day; | 270 | int day; |
271 | for(int i=0; i<7; i++) { | 271 | for(int i=0; i<7; i++) { |
272 | // take the first letter of the day name to be the abbreviation | 272 | // take the first letter of the day name to be the abbreviation |
273 | if (KGlobal::locale()->weekStartsMonday()) { | 273 | if (KGlobal::locale()->weekStartsMonday()) { |
274 | day = i+1; | 274 | day = i+1; |
275 | } else { | 275 | } else { |
276 | if (i==0) day = 7; | 276 | if (i==0) day = 7; |
277 | else day = i; | 277 | else day = i; |
278 | } | 278 | } |
279 | QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( day, | 279 | QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( day, |
280 | true ); | 280 | true ); |
281 | if ( KOPrefs::instance()->mCompactDialogs ) dayName = dayName.left( 1 ); | 281 | if ( KOPrefs::instance()->mCompactDialogs ) dayName = dayName.left( 1 ); |
282 | headings[i]->setText( dayName ); | 282 | headings[i]->setText( dayName ); |
283 | } | 283 | } |
284 | updateDates(); | 284 | updateDates(); |
285 | updateView(); | 285 | updateView(); |
286 | } | 286 | } |
287 | 287 | ||
288 | void KDateNavigator::setShowWeekNums(bool enabled) | 288 | void KDateNavigator::setShowWeekNums(bool enabled) |
289 | { | 289 | { |
290 | m_bShowWeekNums = enabled; | 290 | m_bShowWeekNums = enabled; |
291 | for(int i=0; i<6; i++) { | 291 | for(int i=0; i<6; i++) { |
292 | if(enabled) | 292 | if(enabled) |
293 | weeknos[i]->show(); | 293 | weeknos[i]->show(); |
294 | else | 294 | else |
295 | weeknos[i]->hide(); | 295 | weeknos[i]->hide(); |
296 | } | 296 | } |
297 | resize(size()); | 297 | resize(size()); |
298 | } | 298 | } |
299 | 299 | ||
300 | void KDateNavigator::selectDates(const DateList& dateList) | 300 | void KDateNavigator::selectDates(const DateList& dateList) |
301 | { | 301 | { |
302 | 302 | ||
303 | if (dateList.count() > 0) { | 303 | if (dateList.count() > 0) { |
304 | mNavigatorBar->selectDates( dateList ); | 304 | mNavigatorBar->selectDates( dateList ); |
305 | mSelectedDates = dateList; | 305 | mSelectedDates = dateList; |
306 | 306 | ||
307 | // set our record of the month and year that this datetbl is | 307 | // set our record of the month and year that this datetbl is |
308 | // displaying. | 308 | // displaying. |
309 | m_MthYr = mSelectedDates.first(); | 309 | m_MthYr = mSelectedDates.first(); |
310 | 310 | ||
311 | 311 | ||
312 | // set our record of the first day of the week of the current | 312 | // set our record of the first day of the week of the current |
313 | // month. This needs to be done before calling dayToIndex, since it | 313 | // month. This needs to be done before calling dayToIndex, since it |
314 | // relies on this information being up to date. | 314 | // relies on this information being up to date. |
315 | QDate dayone(m_MthYr.year(), m_MthYr.month(), 1); | 315 | QDate dayone(m_MthYr.year(), m_MthYr.month(), 1); |
316 | m_fstDayOfWk = dayone.dayOfWeek(); | 316 | m_fstDayOfWk = dayone.dayOfWeek(); |
317 | 317 | ||
318 | updateDates(); | 318 | updateDates(); |
319 | 319 | ||
320 | daymatrix->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end())); | 320 | daymatrix->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end())); |
321 | 321 | ||
322 | updateView(); | 322 | updateView(); |
323 | } | 323 | } |
324 | } | 324 | } |
325 | 325 | ||
326 | int KDateNavigator::dayNum(int row, int col) | 326 | int KDateNavigator::dayNum(int row, int col) |
327 | { | 327 | { |
328 | return 7 * (row - 1) + (col + 1) - m_fstDayOfWk; | 328 | return 7 * (row - 1) + (col + 1) - m_fstDayOfWk; |
329 | } | 329 | } |
330 | 330 | ||
331 | int KDateNavigator::dayToIndex(int dayNum) | 331 | int KDateNavigator::dayToIndex(int dayNum) |
332 | { | 332 | { |
333 | int row, col; | 333 | int row, col; |
334 | 334 | ||
335 | row = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) / 7; | 335 | row = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) / 7; |
336 | if (KGlobal::locale()->weekStartsMonday() && (m_fstDayOfWk == 1)) | 336 | if (KGlobal::locale()->weekStartsMonday() && (m_fstDayOfWk == 1)) |
337 | row++; | 337 | row++; |
338 | col = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) % 7; | 338 | col = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) % 7; |
339 | return row * 7 + col; | 339 | return row * 7 + col; |
340 | } | 340 | } |
341 | 341 | ||
342 | void KDateNavigator::wheelEvent (QWheelEvent *e) | 342 | void KDateNavigator::wheelEvent (QWheelEvent *e) |
343 | { | 343 | { |
344 | if(e->delta()>0) emit goPrevious(); | 344 | if(e->delta()>0) emit goPrevious(); |
345 | else emit goNext(); | 345 | else emit goNext(); |
346 | 346 | ||
347 | e->accept(); | 347 | e->accept(); |
348 | } | 348 | } |
349 | 349 | ||
350 | bool KDateNavigator::eventFilter (QObject *o,QEvent *e) | 350 | bool KDateNavigator::eventFilter (QObject *o,QEvent *e) |
351 | { | 351 | { |
352 | if (e->type() == QEvent::MouseButtonPress) { | 352 | if (e->type() == QEvent::MouseButtonPress) { |
353 | int i; | 353 | int i; |
354 | for(i=0;i<6;++i) { | 354 | for(i=0;i<6;++i) { |
355 | if (o == weeknos[i]) { | 355 | if (o == weeknos[i]) { |
356 | QDate weekstart = daymatrix->getDate(i*7); | 356 | QDate weekstart = daymatrix->getDate(i*7); |
357 | emit weekClicked(weekstart); | 357 | emit weekClicked(weekstart); |
358 | break; | 358 | break; |
359 | } | 359 | } |
360 | } | 360 | } |
361 | return true; | 361 | return true; |
362 | } else { | 362 | } else { |
363 | return false; | 363 | return false; |
364 | } | 364 | } |
365 | } | 365 | } |
366 | 366 | ||
367 | //#include "kdatenavigator.moc" | 367 | //#include "kdatenavigator.moc" |
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index 39355b4..ee9f39a 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp | |||
@@ -88,644 +88,643 @@ void KOAgendaItem::init ( Incidence *incidence, QDate qd ) | |||
88 | if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date()) | 88 | if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date()) |
89 | mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; | 89 | mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; |
90 | else | 90 | else |
91 | mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; | 91 | mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; |
92 | } | 92 | } |
93 | else { | 93 | else { |
94 | QStringList categories = mIncidence->categories(); | 94 | QStringList categories = mIncidence->categories(); |
95 | QString cat = categories.first(); | 95 | QString cat = categories.first(); |
96 | if (cat.isEmpty()) { | 96 | if (cat.isEmpty()) { |
97 | mBackgroundColor =KOPrefs::instance()->mEventColor; | 97 | mBackgroundColor =KOPrefs::instance()->mEventColor; |
98 | } else { | 98 | } else { |
99 | mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); | 99 | mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); |
100 | } | 100 | } |
101 | } | 101 | } |
102 | mColorGroup = QColorGroup( mBackgroundColor.light(), | 102 | mColorGroup = QColorGroup( mBackgroundColor.light(), |
103 | mBackgroundColor.dark(),mBackgroundColor.light(), | 103 | mBackgroundColor.dark(),mBackgroundColor.light(), |
104 | mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ; | 104 | mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ; |
105 | setBackgroundColor( mBackgroundColor ); | 105 | setBackgroundColor( mBackgroundColor ); |
106 | 106 | ||
107 | setCellXY(0,0,1); | 107 | setCellXY(0,0,1); |
108 | setCellXWidth(0); | 108 | setCellXWidth(0); |
109 | setSubCell(0); | 109 | setSubCell(0); |
110 | setSubCells(1); | 110 | setSubCells(1); |
111 | setMultiItem(0,0,0); | 111 | setMultiItem(0,0,0); |
112 | startMove(); | 112 | startMove(); |
113 | mSelected = true; | 113 | mSelected = true; |
114 | select(false); | 114 | select(false); |
115 | QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); | 115 | QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); |
116 | mFontPixelSize = fontinf.height();; | 116 | mFontPixelSize = fontinf.height();; |
117 | hide(); | 117 | hide(); |
118 | xPaintCoord = -1; | 118 | xPaintCoord = -1; |
119 | yPaintCoord = -1; | 119 | yPaintCoord = -1; |
120 | } | 120 | } |
121 | 121 | ||
122 | 122 | ||
123 | KOAgendaItem::~KOAgendaItem() | 123 | KOAgendaItem::~KOAgendaItem() |
124 | { | 124 | { |
125 | // qDebug("deleteKOAgendaItem::~KOAgendaItem( "); | 125 | // qDebug("deleteKOAgendaItem::~KOAgendaItem( "); |
126 | 126 | ||
127 | } | 127 | } |
128 | 128 | ||
129 | void KOAgendaItem::recreateIncidence() | 129 | void KOAgendaItem::recreateIncidence() |
130 | { | 130 | { |
131 | #if 0 | 131 | #if 0 |
132 | Incidence* newInc = mIncidence->clone(); | 132 | Incidence* newInc = mIncidence->clone(); |
133 | newInc->recreate(); | 133 | newInc->recreate(); |
134 | if ( mIncidence->doesRecur() ) { | 134 | if ( mIncidence->doesRecur() ) { |
135 | mIncidence->addExDate( mDate ); | 135 | mIncidence->addExDate( mDate ); |
136 | newInc->recurrence()->unsetRecurs(); | 136 | newInc->recurrence()->unsetRecurs(); |
137 | int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); | 137 | int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); |
138 | QTime tim = mIncidence->dtStart().time(); | 138 | QTime tim = mIncidence->dtStart().time(); |
139 | newInc->setDtStart( QDateTime(mDate, tim) ); | 139 | newInc->setDtStart( QDateTime(mDate, tim) ); |
140 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); | 140 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); |
141 | } | 141 | } |
142 | #endif | 142 | #endif |
143 | mIncidence = mIncidence->recreateCloneException( mDate ); | 143 | mIncidence = mIncidence->recreateCloneException( mDate ); |
144 | } | 144 | } |
145 | bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) | 145 | bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) |
146 | { | 146 | { |
147 | int size = AGENDA_ICON_SIZE; | 147 | int size = AGENDA_ICON_SIZE; |
148 | 148 | ||
149 | int yOff = 0; | 149 | int yOff = 0; |
150 | int xOff = 0; | 150 | int xOff = 0; |
151 | int x = pos().x() +3; | 151 | int x = pos().x() +3; |
152 | int y; | 152 | int y; |
153 | if ( mAllDay ) | 153 | if ( mAllDay ) |
154 | y = pos().y()+3; | 154 | y = pos().y()+3; |
155 | else | 155 | else |
156 | y = mCellYTop * ( height() / cellHeight() ) +3; | 156 | y = mCellYTop * ( height() / cellHeight() ) +3; |
157 | if (mIncidence->cancelled()) { | 157 | if (mIncidence->cancelled()) { |
158 | int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x; | 158 | int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x; |
159 | int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y; | 159 | int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y; |
160 | p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 ); | 160 | p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 ); |
161 | p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos ); | 161 | p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos ); |
162 | if ( horLayout ) | 162 | if ( horLayout ) |
163 | ++xOff; | 163 | ++xOff; |
164 | else | 164 | else |
165 | ++yOff; | 165 | ++yOff; |
166 | } | 166 | } |
167 | if (mIncidence->isAlarmEnabled()) { | 167 | if (mIncidence->isAlarmEnabled()) { |
168 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red ); | 168 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red ); |
169 | if ( horLayout ) | 169 | if ( horLayout ) |
170 | ++xOff; | 170 | ++xOff; |
171 | else | 171 | else |
172 | ++yOff; | 172 | ++yOff; |
173 | } | 173 | } |
174 | if (mIncidence->recurrence()->doesRecur()) { | 174 | if (mIncidence->recurrence()->doesRecur()) { |
175 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue ); | 175 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue ); |
176 | if ( horLayout ) | 176 | if ( horLayout ) |
177 | ++xOff; | 177 | ++xOff; |
178 | else | 178 | else |
179 | ++yOff; | 179 | ++yOff; |
180 | } | 180 | } |
181 | if (mIncidence->description().length() > 0) { | 181 | if (mIncidence->description().length() > 0) { |
182 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen ); | 182 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen ); |
183 | if ( horLayout ) | 183 | if ( horLayout ) |
184 | ++xOff; | 184 | ++xOff; |
185 | else | 185 | else |
186 | ++yOff; | 186 | ++yOff; |
187 | } | 187 | } |
188 | if (mIncidence->isReadOnly()) { | 188 | if (mIncidence->isReadOnly()) { |
189 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white ); | 189 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white ); |
190 | if ( horLayout ) | 190 | if ( horLayout ) |
191 | ++xOff; | 191 | ++xOff; |
192 | else | 192 | else |
193 | ++yOff; | 193 | ++yOff; |
194 | } | 194 | } |
195 | 195 | ||
196 | if (mIncidence->attendeeCount()>0) { | 196 | if (mIncidence->attendeeCount()>0) { |
197 | 197 | ||
198 | if (mIncidence->organizer() == KOPrefs::instance()->email()) { | 198 | if (mIncidence->organizer() == KOPrefs::instance()->email()) { |
199 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black ); | 199 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black ); |
200 | if ( horLayout ) | 200 | if ( horLayout ) |
201 | ++xOff; | 201 | ++xOff; |
202 | else | 202 | else |
203 | ++yOff; | 203 | ++yOff; |
204 | } else { | 204 | } else { |
205 | Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); | 205 | Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); |
206 | if (me!=0) { | 206 | if (me!=0) { |
207 | 207 | ||
208 | 208 | ||
209 | } else { | 209 | } else { |
210 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow ); | 210 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow ); |
211 | if ( horLayout ) | 211 | if ( horLayout ) |
212 | ++xOff; | 212 | ++xOff; |
213 | else | 213 | else |
214 | ++yOff; | 214 | ++yOff; |
215 | 215 | ||
216 | } | 216 | } |
217 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow ); | 217 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow ); |
218 | if ( horLayout ) | 218 | if ( horLayout ) |
219 | ++xOff; | 219 | ++xOff; |
220 | else | 220 | else |
221 | ++yOff; | 221 | ++yOff; |
222 | 222 | ||
223 | } | 223 | } |
224 | 224 | ||
225 | } | 225 | } |
226 | return ( yOff || xOff ); | 226 | return ( yOff || xOff ); |
227 | } | 227 | } |
228 | 228 | ||
229 | 229 | ||
230 | void KOAgendaItem::select(bool selected) | 230 | void KOAgendaItem::select(bool selected) |
231 | { | 231 | { |
232 | //qDebug("select %d %d",firstMultiItem(), nextMultiItem() ); | 232 | //qDebug("select %d %d",firstMultiItem(), nextMultiItem() ); |
233 | if (mSelected == selected) return; | 233 | if (mSelected == selected) return; |
234 | mSelected = selected; | 234 | mSelected = selected; |
235 | if ( ! isVisible() ) | 235 | if ( ! isVisible() ) |
236 | return; | 236 | return; |
237 | if ( firstMultiItem() ) | 237 | if ( firstMultiItem() ) |
238 | firstMultiItem()->select( selected ); | 238 | firstMultiItem()->select( selected ); |
239 | if ( !firstMultiItem() && nextMultiItem() ) { | 239 | if ( !firstMultiItem() && nextMultiItem() ) { |
240 | KOAgendaItem * placeItem = nextMultiItem(); | 240 | KOAgendaItem * placeItem = nextMultiItem(); |
241 | while ( placeItem ) { | 241 | while ( placeItem ) { |
242 | placeItem->select( selected ); | 242 | placeItem->select( selected ); |
243 | placeItem = placeItem->nextMultiItem(); | 243 | placeItem = placeItem->nextMultiItem(); |
244 | } | 244 | } |
245 | } | 245 | } |
246 | globalFlagBlockAgendaItemUpdate = 0; | 246 | globalFlagBlockAgendaItemUpdate = 0; |
247 | paintMe( selected ); | 247 | paintMe( selected ); |
248 | globalFlagBlockAgendaItemUpdate = 1; | 248 | globalFlagBlockAgendaItemUpdate = 1; |
249 | repaint( false ); | 249 | repaint( false ); |
250 | } | 250 | } |
251 | 251 | ||
252 | 252 | ||
253 | /* | 253 | /* |
254 | The eventFilter has to filter the mouse events of the agenda item childs. The | 254 | The eventFilter has to filter the mouse events of the agenda item childs. The |
255 | events are fed into the event handling method of KOAgendaItem. This allows the | 255 | events are fed into the event handling method of KOAgendaItem. This allows the |
256 | KOAgenda to handle the KOAgendaItems by using an eventFilter. | 256 | KOAgenda to handle the KOAgendaItems by using an eventFilter. |
257 | */ | 257 | */ |
258 | bool KOAgendaItem::eventFilter ( QObject *object, QEvent *e ) | 258 | bool KOAgendaItem::eventFilter ( QObject *object, QEvent *e ) |
259 | { | 259 | { |
260 | if (e->type() == QEvent::MouseButtonPress || | 260 | if (e->type() == QEvent::MouseButtonPress || |
261 | e->type() == QEvent::MouseButtonDblClick || | 261 | e->type() == QEvent::MouseButtonDblClick || |
262 | e->type() == QEvent::MouseButtonRelease || | 262 | e->type() == QEvent::MouseButtonRelease || |
263 | e->type() == QEvent::MouseMove) { | 263 | e->type() == QEvent::MouseMove) { |
264 | QMouseEvent *me = (QMouseEvent *)e; | 264 | QMouseEvent *me = (QMouseEvent *)e; |
265 | QPoint itemPos = this->mapFromGlobal(((QWidget *)object)-> | 265 | QPoint itemPos = this->mapFromGlobal(((QWidget *)object)-> |
266 | mapToGlobal(me->pos())); | 266 | mapToGlobal(me->pos())); |
267 | QMouseEvent returnEvent (e->type(),itemPos,me->button(),me->state()); | 267 | QMouseEvent returnEvent (e->type(),itemPos,me->button(),me->state()); |
268 | return event(&returnEvent); | 268 | return event(&returnEvent); |
269 | } else { | 269 | } else { |
270 | return false; | 270 | return false; |
271 | } | 271 | } |
272 | } | 272 | } |
273 | void KOAgendaItem::repaintMe( ) | 273 | void KOAgendaItem::repaintMe( ) |
274 | { | 274 | { |
275 | paintMe ( mSelected ); | 275 | paintMe ( mSelected ); |
276 | } | 276 | } |
277 | void KOAgendaItem::paintMe( bool selected, QPainter* paint ) | 277 | void KOAgendaItem::paintMe( bool selected, QPainter* paint ) |
278 | { | 278 | { |
279 | if ( globalFlagBlockAgendaItemUpdate && ! selected) | 279 | if ( globalFlagBlockAgendaItemUpdate && ! selected) |
280 | return; | 280 | return; |
281 | QPainter pa; | 281 | QPainter pa; |
282 | 282 | ||
283 | if ( mSelected ) { | 283 | if ( mSelected ) { |
284 | pa.begin( paintPixSel() ); | 284 | pa.begin( paintPixSel() ); |
285 | } else { | 285 | } else { |
286 | if ( mAllDay ) | 286 | if ( mAllDay ) |
287 | pa.begin( paintPixAllday() ); | 287 | pa.begin( paintPixAllday() ); |
288 | else | 288 | else |
289 | pa.begin( paintPix() ); | 289 | pa.begin( paintPix() ); |
290 | } | 290 | } |
291 | int x, yy, w, h; | 291 | int x, yy, w, h; |
292 | float nfh; | 292 | float nfh; |
293 | x = pos().x(); w = width(); h = height (); | 293 | x = pos().x(); w = width(); h = height (); |
294 | if ( mAllDay ) | 294 | if ( mAllDay ) |
295 | yy = y(); | 295 | yy = y(); |
296 | else | 296 | else |
297 | yy = mCellYTop * ( height() / cellHeight() ); | 297 | yy = mCellYTop * ( height() / cellHeight() ); |
298 | xPaintCoord= x; | 298 | xPaintCoord= x; |
299 | yPaintCoord = yy; | 299 | yPaintCoord = yy; |
300 | wPaintCoord = width(); | 300 | wPaintCoord = width(); |
301 | hPaintCoord = height(); | 301 | hPaintCoord = height(); |
302 | //qDebug("paintMe %s %d %d %d %d",incidence()->summary().latin1(), x, yy, width(), height()); | 302 | //qDebug("paintMe %s %d %d %d %d",incidence()->summary().latin1(), x, yy, width(), height()); |
303 | if ( paint == 0 ) | 303 | if ( paint == 0 ) |
304 | paint = &pa; | 304 | paint = &pa; |
305 | bool horLayout = ( w < h ); | 305 | bool horLayout = ( w < h ); |
306 | int maxhei = mFontPixelSize+4; | 306 | int maxhei = mFontPixelSize+4; |
307 | if ( horLayout ) | 307 | if ( horLayout ) |
308 | maxhei += AGENDA_ICON_SIZE -4; | 308 | maxhei += AGENDA_ICON_SIZE -4; |
309 | bool small = ( h < maxhei ); | 309 | bool small = ( h < maxhei ); |
310 | if ( ! small ) | 310 | if ( ! small ) |
311 | paint->setFont(KOPrefs::instance()->mAgendaViewFont); | 311 | paint->setFont(KOPrefs::instance()->mAgendaViewFont); |
312 | else { | 312 | else { |
313 | QFont f = KOPrefs::instance()->mAgendaViewFont; | 313 | QFont f = KOPrefs::instance()->mAgendaViewFont; |
314 | f.setBold( false ); | 314 | f.setBold( false ); |
315 | int fh = f.pointSize(); | 315 | int fh = f.pointSize(); |
316 | nfh = (((float)height())/(float)(mFontPixelSize+4))*fh; | 316 | nfh = (((float)height())/(float)(mFontPixelSize+4))*fh; |
317 | if ( nfh < 6 ) | 317 | if ( nfh < 6 ) |
318 | nfh = 6; | 318 | nfh = 6; |
319 | f.setPointSize( nfh ); | 319 | f.setPointSize( nfh ); |
320 | paint->setFont(f); | 320 | paint->setFont(f); |
321 | } | 321 | } |
322 | paint->fillRect ( x, yy, w, h, mBackgroundColor ); | 322 | paint->fillRect ( x, yy, w, h, mBackgroundColor ); |
323 | static const QPixmap completedPxmp = SmallIcon("greenhook16"); | 323 | static const QPixmap completedPxmp = SmallIcon("greenhook16"); |
324 | static const QPixmap overduePxmp = SmallIcon("redcross16"); | 324 | static const QPixmap overduePxmp = SmallIcon("redcross16"); |
325 | if ( mIncidence->type() == "Todo" ) { | 325 | if ( mIncidence->type() == "Todo" ) { |
326 | Todo* tempTodo = static_cast<Todo*>(mIncidence); | 326 | Todo* tempTodo = static_cast<Todo*>(mIncidence); |
327 | int xx = pos().x()+(width()-completedPxmp.width()-3 ); | 327 | int xx = pos().x()+(width()-completedPxmp.width()-3 ); |
328 | int yyy = yy+3; | 328 | int yyy = yy+3; |
329 | if ( tempTodo->isCompleted() ) | 329 | if ( tempTodo->isCompleted() ) |
330 | paint->drawPixmap ( xx, yyy, completedPxmp ); | 330 | paint->drawPixmap ( xx, yyy, completedPxmp ); |
331 | else { | 331 | else { |
332 | paint->drawPixmap ( xx, yyy, overduePxmp ); | 332 | paint->drawPixmap ( xx, yyy, overduePxmp ); |
333 | 333 | ||
334 | } | 334 | } |
335 | } | 335 | } |
336 | bool addIcon = false; | 336 | bool addIcon = false; |
337 | if ( ! small || w > 3 * h || h > 3* w ) | 337 | if ( ! small || w > 3 * h || h > 3* w ) |
338 | addIcon = updateIcons( paint, horLayout ); | 338 | addIcon = updateIcons( paint, horLayout ); |
339 | 339 | ||
340 | qDrawShadePanel (paint, x, yy, w, h, mColorGroup, selected , 2, 0); | 340 | qDrawShadePanel (paint, x, yy, w, h, mColorGroup, selected , 2, 0); |
341 | //qDebug("draw rect %d %d %d %d ",x, yy, w, h ); | 341 | //qDebug("draw rect %d %d %d %d ",x, yy, w, h ); |
342 | if ( ! small ) { | 342 | if ( ! small ) { |
343 | x += 3; yy += 3;w -= 6; h-= 5; | 343 | x += 3; yy += 3;w -= 6; h-= 5; |
344 | } else { | 344 | } else { |
345 | x += 2; yy += 1;w -= 4; h-= 4; | 345 | x += 2; yy += 1;w -= 4; h-= 4; |
346 | if ( nfh < 6.01 ) { | 346 | if ( nfh < 6.01 ) { |
347 | yy -= 2; | 347 | yy -= 2; |
348 | h += 4; | 348 | h += 4; |
349 | } | 349 | } |
350 | else | 350 | else |
351 | if ( nfh < h -2 ) | 351 | if ( nfh < h -2 ) |
352 | ++yy; | 352 | ++yy; |
353 | } | 353 | } |
354 | int align; | 354 | int align; |
355 | #ifndef DESKTOP_VERSION | 355 | #ifndef DESKTOP_VERSION |
356 | align = ( AlignLeft|WordBreak|AlignTop); | 356 | align = ( AlignLeft|WordBreak|AlignTop); |
357 | #else | 357 | #else |
358 | align = ( AlignLeft|BreakAnywhere|WordBreak|AlignTop); | 358 | align = ( AlignLeft|BreakAnywhere|WordBreak|AlignTop); |
359 | #endif | 359 | #endif |
360 | if ( addIcon ) { | 360 | if ( addIcon ) { |
361 | if ( ! horLayout ) { | 361 | if ( ! horLayout ) { |
362 | x += AGENDA_ICON_SIZE+3; | 362 | x += AGENDA_ICON_SIZE+3; |
363 | w -= (AGENDA_ICON_SIZE+3); | 363 | w -= (AGENDA_ICON_SIZE+3); |
364 | } | 364 | } |
365 | else { | 365 | else { |
366 | yy+= AGENDA_ICON_SIZE+2; | 366 | yy+= AGENDA_ICON_SIZE+2; |
367 | h -=(AGENDA_ICON_SIZE+3); | 367 | h -=(AGENDA_ICON_SIZE+3); |
368 | } | 368 | } |
369 | } | 369 | } |
370 | int colsum = mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue(); | 370 | int colsum = mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue(); |
371 | if ( colsum < 250 ) | 371 | if ( colsum < 250 ) |
372 | paint->setPen ( white); | 372 | paint->setPen ( white); |
373 | if ( x < 0 ) { | 373 | if ( x < 0 ) { |
374 | w = w+x-3; | 374 | w = w+x-3; |
375 | x = 3; | 375 | x = 3; |
376 | if ( w > parentWidget()->width() ){ | 376 | if ( w > parentWidget()->width() ){ |
377 | w = parentWidget()->width() - 6; | 377 | w = parentWidget()->width() - 6; |
378 | #ifndef DESKTOP_VERSION | 378 | #ifndef DESKTOP_VERSION |
379 | align = ( AlignCenter|WordBreak); | 379 | align = ( AlignCenter|WordBreak); |
380 | #else | 380 | #else |
381 | align = ( AlignCenter|BreakAnywhere|WordBreak); | 381 | align = ( AlignCenter|BreakAnywhere|WordBreak); |
382 | #endif | 382 | #endif |
383 | 383 | ||
384 | } | 384 | } |
385 | } | 385 | } |
386 | QRect dr; | 386 | QRect dr; |
387 | paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr ); | 387 | paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr ); |
388 | if ( mIncidence->cancelled() ){ | 388 | if ( mIncidence->cancelled() ){ |
389 | if ( ! small ) { | 389 | if ( ! small ) { |
390 | QFontMetrics fm ( paint->font() ); | 390 | QFontMetrics fm ( paint->font() ); |
391 | paint->drawLine(dr.left(), yy+fm.height()/2, dr.right()-2, yy+fm.height()/2); | 391 | paint->drawLine(dr.left(), yy+fm.height()/2, dr.right()-2, yy+fm.height()/2); |
392 | } | 392 | } |
393 | 393 | ||
394 | } | 394 | } |
395 | pa.end(); | 395 | pa.end(); |
396 | 396 | ||
397 | } | 397 | } |
398 | void KOAgendaItem::resizePixmap( int w , int h ) | 398 | void KOAgendaItem::resizePixmap( int w , int h ) |
399 | { | 399 | { |
400 | paintPix()->resize( w, h ); | 400 | paintPix()->resize( w, h ); |
401 | paintPixSel()->resize( w, h ); | 401 | paintPixSel()->resize( w, h ); |
402 | 402 | ||
403 | } | 403 | } |
404 | QPixmap * KOAgendaItem::paintPix() | 404 | QPixmap * KOAgendaItem::paintPix() |
405 | { | 405 | { |
406 | static QPixmap* mPaintPix = 0; | 406 | static QPixmap* mPaintPix = 0; |
407 | if ( ! mPaintPix ) | 407 | if ( ! mPaintPix ) |
408 | mPaintPix = new QPixmap(1,1); | 408 | mPaintPix = new QPixmap(1,1); |
409 | return mPaintPix ; | 409 | return mPaintPix ; |
410 | } | 410 | } |
411 | QPixmap * KOAgendaItem::paintPixAllday() | 411 | QPixmap * KOAgendaItem::paintPixAllday() |
412 | { | 412 | { |
413 | static QPixmap* mPaintPixA = 0; | 413 | static QPixmap* mPaintPixA = 0; |
414 | if ( ! mPaintPixA ) | 414 | if ( ! mPaintPixA ) |
415 | mPaintPixA = new QPixmap(1,1); | 415 | mPaintPixA = new QPixmap(1,1); |
416 | return mPaintPixA ; | 416 | return mPaintPixA ; |
417 | } | 417 | } |
418 | QPixmap * KOAgendaItem::paintPixSel() | 418 | QPixmap * KOAgendaItem::paintPixSel() |
419 | { | 419 | { |
420 | static QPixmap* mPaintPixSel = 0; | 420 | static QPixmap* mPaintPixSel = 0; |
421 | if ( ! mPaintPixSel ) | 421 | if ( ! mPaintPixSel ) |
422 | mPaintPixSel = new QPixmap(1,1); | 422 | mPaintPixSel = new QPixmap(1,1); |
423 | return mPaintPixSel ; | 423 | return mPaintPixSel ; |
424 | } | 424 | } |
425 | void KOAgendaItem::paintEvent ( QPaintEvent *e ) | 425 | void KOAgendaItem::paintEvent ( QPaintEvent *e ) |
426 | { | 426 | { |
427 | 427 | ||
428 | if ( globalFlagBlockAgendaItemPaint ) | 428 | if ( globalFlagBlockAgendaItemPaint ) |
429 | return; | 429 | return; |
430 | if ( globalFlagBlockAgenda > 0 && globalFlagBlockAgenda < 5 ) | 430 | if ( globalFlagBlockAgenda > 0 && globalFlagBlockAgenda < 5 ) |
431 | return; | 431 | return; |
432 | int yy; | 432 | int yy; |
433 | if ( mAllDay ) | 433 | if ( mAllDay ) |
434 | yy = y(); | 434 | yy = y(); |
435 | else | 435 | else |
436 | yy = mCellYTop * ( height() / cellHeight() ); | 436 | yy = mCellYTop * ( height() / cellHeight() ); |
437 | int xx = x(); | 437 | int xx = x(); |
438 | if ( xPaintCoord != xx || yPaintCoord != yy || | 438 | if ( xPaintCoord != xx || yPaintCoord != yy || |
439 | wPaintCoord != width() || hPaintCoord != height()) { | 439 | wPaintCoord != width() || hPaintCoord != height()) { |
440 | xPaintCoord= xx; | 440 | xPaintCoord= xx; |
441 | yPaintCoord = yy; | 441 | yPaintCoord = yy; |
442 | wPaintCoord = width(); | 442 | wPaintCoord = width(); |
443 | hPaintCoord = height(); | 443 | hPaintCoord = height(); |
444 | globalFlagBlockAgendaItemUpdate = 0; | 444 | globalFlagBlockAgendaItemUpdate = 0; |
445 | paintMe( mSelected ); | 445 | paintMe( mSelected ); |
446 | //qDebug("calling paintMe "); | 446 | //qDebug("calling paintMe "); |
447 | globalFlagBlockAgendaItemUpdate = 1; | 447 | globalFlagBlockAgendaItemUpdate = 1; |
448 | } | 448 | } |
449 | int rx, ry, rw, rh; | 449 | int rx, ry, rw, rh; |
450 | rx = e->rect().x(); | 450 | rx = e->rect().x(); |
451 | ry = e->rect().y(); | 451 | ry = e->rect().y(); |
452 | rw = e->rect().width(); | 452 | rw = e->rect().width(); |
453 | rh = e->rect().height(); | 453 | rh = e->rect().height(); |
454 | //qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height()); | 454 | //qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height()); |
455 | 455 | ||
456 | QPixmap* paintFrom ; | 456 | QPixmap* paintFrom ; |
457 | if ( mSelected ) { | 457 | if ( mSelected ) { |
458 | paintFrom = paintPixSel(); | 458 | paintFrom = paintPixSel(); |
459 | } else { | 459 | } else { |
460 | if ( mAllDay ) | 460 | if ( mAllDay ) |
461 | paintFrom = paintPixAllday(); | 461 | paintFrom = paintPixAllday(); |
462 | else | 462 | else |
463 | paintFrom = paintPix(); | 463 | paintFrom = paintPix(); |
464 | } | 464 | } |
465 | bitBlt (this, rx, ry, paintFrom, x()+rx ,yPaintCoord+ry, rw, rh ,CopyROP); | 465 | bitBlt (this, rx, ry, paintFrom, x()+rx ,yPaintCoord+ry, rw, rh ,CopyROP); |
466 | } | 466 | } |
467 | void KOAgendaItem::computeText() | 467 | void KOAgendaItem::computeText() |
468 | { | 468 | { |
469 | 469 | ||
470 | mDisplayedText = mIncidence->summary(); | 470 | mDisplayedText = mIncidence->summary(); |
471 | if ( (mIncidence->type() == "Todo") ) { | 471 | if ( (mIncidence->type() == "Todo") ) { |
472 | if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() ) | 472 | if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) { |
473 | mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")"; | 473 | if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() ) |
474 | else if ( !(mIncidence->doesFloat())) | 474 | mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")"; |
475 | mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")"; | 475 | else if ( !(mIncidence->doesFloat())) |
476 | 476 | mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")"; | |
477 | 477 | } | |
478 | |||
479 | } else { | 478 | } else { |
480 | if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda) | 479 | if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda) |
481 | mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + "-" + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ; | 480 | mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + "-" + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ; |
482 | 481 | ||
483 | if ( mAllDay ) { | 482 | if ( mAllDay ) { |
484 | if ( mIncidence->dtStart().date().addDays(3) < mIncidence->dtEnd().date() ) { | 483 | if ( mIncidence->dtStart().date().addDays(3) < mIncidence->dtEnd().date() ) { |
485 | mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtEnd().date(), true) ; | 484 | mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtEnd().date(), true) ; |
486 | } | 485 | } |
487 | } | 486 | } |
488 | 487 | ||
489 | } | 488 | } |
490 | 489 | ||
491 | if ( !mIncidence->location().isEmpty() ) { | 490 | if ( !mIncidence->location().isEmpty() ) { |
492 | if ( mAllDay ) | 491 | if ( mAllDay ) |
493 | mDisplayedText += " ("; | 492 | mDisplayedText += " ("; |
494 | else | 493 | else |
495 | mDisplayedText += "\n("; | 494 | mDisplayedText += "\n("; |
496 | mDisplayedText += mIncidence->location() +")"; | 495 | mDisplayedText += mIncidence->location() +")"; |
497 | } | 496 | } |
498 | 497 | ||
499 | QString tipText = mIncidence->summary(); | 498 | QString tipText = mIncidence->summary(); |
500 | QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); | 499 | QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); |
501 | if ( !mIncidence->doesFloat() ) { | 500 | if ( !mIncidence->doesFloat() ) { |
502 | if ( mIncidence->type() == "Event" ) { | 501 | if ( mIncidence->type() == "Event" ) { |
503 | if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) { | 502 | if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) { |
504 | tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr(); | 503 | tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr(); |
505 | tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr(); | 504 | tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr(); |
506 | } | 505 | } |
507 | else { | 506 | else { |
508 | tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr(); | 507 | tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr(); |
509 | tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr(); | 508 | tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr(); |
510 | } | 509 | } |
511 | } | 510 | } |
512 | else if ( mIncidence->type() == "Todo" ) { | 511 | else if ( mIncidence->type() == "Todo" ) { |
513 | if (mIncidence->hasStartDate()) | 512 | if (mIncidence->hasStartDate()) |
514 | tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartStr(); | 513 | tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartStr(); |
515 | tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueStr(); | 514 | tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueStr(); |
516 | } | 515 | } |
517 | } else if ( mIncidence->type() == "Todo" ) { | 516 | } else if ( mIncidence->type() == "Todo" ) { |
518 | if (mIncidence->hasStartDate()) | 517 | if (mIncidence->hasStartDate()) |
519 | tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartDateStr(); | 518 | tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartDateStr(); |
520 | tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueDateStr(); | 519 | tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueDateStr(); |
521 | } | 520 | } |
522 | 521 | ||
523 | if (!mIncidence->location().isEmpty()) { | 522 | if (!mIncidence->location().isEmpty()) { |
524 | tipText += "\n"+i18n("Location: ")+mIncidence->location(); | 523 | tipText += "\n"+i18n("Location: ")+mIncidence->location(); |
525 | } | 524 | } |
526 | QToolTip::add(this,tipText,toolTipGroup(),""); | 525 | QToolTip::add(this,tipText,toolTipGroup(),""); |
527 | 526 | ||
528 | } | 527 | } |
529 | void KOAgendaItem::updateItem() | 528 | void KOAgendaItem::updateItem() |
530 | { | 529 | { |
531 | computeText(); | 530 | computeText(); |
532 | 531 | ||
533 | //qDebug("KOAgendaItem:: updateItem() %s %d %d ",incidence()->summary().latin1(), x(), y()); | 532 | //qDebug("KOAgendaItem:: updateItem() %s %d %d ",incidence()->summary().latin1(), x(), y()); |
534 | paintMe( mSelected ); | 533 | paintMe( mSelected ); |
535 | repaint( false); | 534 | repaint( false); |
536 | } | 535 | } |
537 | 536 | ||
538 | void KOAgendaItem::resizeEvent ( QResizeEvent *ev ) | 537 | void KOAgendaItem::resizeEvent ( QResizeEvent *ev ) |
539 | { | 538 | { |
540 | //qDebug("KOAgendaItem::resizeEvent %s ", mIncidence->summary().latin1()); | 539 | //qDebug("KOAgendaItem::resizeEvent %s ", mIncidence->summary().latin1()); |
541 | paintMe( mSelected ); | 540 | paintMe( mSelected ); |
542 | repaint( false ); | 541 | repaint( false ); |
543 | } | 542 | } |
544 | 543 | ||
545 | /* | 544 | /* |
546 | Return height of item in units of agenda cells | 545 | Return height of item in units of agenda cells |
547 | */ | 546 | */ |
548 | int KOAgendaItem::cellHeight() | 547 | int KOAgendaItem::cellHeight() |
549 | { | 548 | { |
550 | int ret = mCellYBottom - mCellYTop + 1; | 549 | int ret = mCellYBottom - mCellYTop + 1; |
551 | if ( ret <= 0 ) { | 550 | if ( ret <= 0 ) { |
552 | ret = 1; | 551 | ret = 1; |
553 | mCellYBottom = 0; | 552 | mCellYBottom = 0; |
554 | mCellYTop = 0; | 553 | mCellYTop = 0; |
555 | } | 554 | } |
556 | return ret; | 555 | return ret; |
557 | } | 556 | } |
558 | 557 | ||
559 | /* | 558 | /* |
560 | Return height of item in units of agenda cells | 559 | Return height of item in units of agenda cells |
561 | */ | 560 | */ |
562 | int KOAgendaItem::cellWidth() | 561 | int KOAgendaItem::cellWidth() |
563 | { | 562 | { |
564 | return mCellXWidth - mCellX + 1; | 563 | return mCellXWidth - mCellX + 1; |
565 | } | 564 | } |
566 | 565 | ||
567 | void KOAgendaItem::setItemDate(QDate qd) | 566 | void KOAgendaItem::setItemDate(QDate qd) |
568 | { | 567 | { |
569 | mDate = qd; | 568 | mDate = qd; |
570 | } | 569 | } |
571 | 570 | ||
572 | void KOAgendaItem::setCellXY(int X, int YTop, int YBottom) | 571 | void KOAgendaItem::setCellXY(int X, int YTop, int YBottom) |
573 | { | 572 | { |
574 | mCellX = X; | 573 | mCellX = X; |
575 | mCellYTop = YTop; | 574 | mCellYTop = YTop; |
576 | mCellYBottom = YBottom; | 575 | mCellYBottom = YBottom; |
577 | } | 576 | } |
578 | 577 | ||
579 | void KOAgendaItem::setCellXWidth(int xwidth) | 578 | void KOAgendaItem::setCellXWidth(int xwidth) |
580 | { | 579 | { |
581 | mCellXWidth = xwidth; | 580 | mCellXWidth = xwidth; |
582 | } | 581 | } |
583 | 582 | ||
584 | void KOAgendaItem::setCellX(int XLeft, int XRight) | 583 | void KOAgendaItem::setCellX(int XLeft, int XRight) |
585 | { | 584 | { |
586 | mCellX = XLeft; | 585 | mCellX = XLeft; |
587 | mCellXWidth = XRight; | 586 | mCellXWidth = XRight; |
588 | } | 587 | } |
589 | 588 | ||
590 | void KOAgendaItem::setCellY(int YTop, int YBottom) | 589 | void KOAgendaItem::setCellY(int YTop, int YBottom) |
591 | { | 590 | { |
592 | mCellYTop = YTop; | 591 | mCellYTop = YTop; |
593 | mCellYBottom = YBottom; | 592 | mCellYBottom = YBottom; |
594 | } | 593 | } |
595 | 594 | ||
596 | void KOAgendaItem::setSubCell(int subCell) | 595 | void KOAgendaItem::setSubCell(int subCell) |
597 | { | 596 | { |
598 | mSubCell = subCell; | 597 | mSubCell = subCell; |
599 | } | 598 | } |
600 | 599 | ||
601 | void KOAgendaItem::setSubCells(int subCells) | 600 | void KOAgendaItem::setSubCells(int subCells) |
602 | { | 601 | { |
603 | mSubCells = subCells; | 602 | mSubCells = subCells; |
604 | } | 603 | } |
605 | 604 | ||
606 | void KOAgendaItem::setMultiItem(KOAgendaItem *first,KOAgendaItem *next, | 605 | void KOAgendaItem::setMultiItem(KOAgendaItem *first,KOAgendaItem *next, |
607 | KOAgendaItem *last) | 606 | KOAgendaItem *last) |
608 | { | 607 | { |
609 | mFirstMultiItem = first; | 608 | mFirstMultiItem = first; |
610 | mNextMultiItem = next; | 609 | mNextMultiItem = next; |
611 | mLastMultiItem = last; | 610 | mLastMultiItem = last; |
612 | } | 611 | } |
613 | 612 | ||
614 | void KOAgendaItem::startMove() | 613 | void KOAgendaItem::startMove() |
615 | { | 614 | { |
616 | mStartCellX = mCellX; | 615 | mStartCellX = mCellX; |
617 | mStartCellXWidth = mCellXWidth; | 616 | mStartCellXWidth = mCellXWidth; |
618 | mStartCellYTop = mCellYTop; | 617 | mStartCellYTop = mCellYTop; |
619 | mStartCellYBottom = mCellYBottom; | 618 | mStartCellYBottom = mCellYBottom; |
620 | } | 619 | } |
621 | 620 | ||
622 | void KOAgendaItem::resetMove() | 621 | void KOAgendaItem::resetMove() |
623 | { | 622 | { |
624 | mCellX = mStartCellX; | 623 | mCellX = mStartCellX; |
625 | mCellXWidth = mStartCellXWidth; | 624 | mCellXWidth = mStartCellXWidth; |
626 | mCellYTop = mStartCellYTop; | 625 | mCellYTop = mStartCellYTop; |
627 | mCellYBottom = mStartCellYBottom; | 626 | mCellYBottom = mStartCellYBottom; |
628 | } | 627 | } |
629 | 628 | ||
630 | void KOAgendaItem::moveRelative(int dx, int dy) | 629 | void KOAgendaItem::moveRelative(int dx, int dy) |
631 | { | 630 | { |
632 | int newX = cellX() + dx; | 631 | int newX = cellX() + dx; |
633 | int newXWidth = cellXWidth() + dx; | 632 | int newXWidth = cellXWidth() + dx; |
634 | int newYTop = cellYTop() + dy; | 633 | int newYTop = cellYTop() + dy; |
635 | int newYBottom = cellYBottom() + dy; | 634 | int newYBottom = cellYBottom() + dy; |
636 | setCellXY(newX,newYTop,newYBottom); | 635 | setCellXY(newX,newYTop,newYBottom); |
637 | setCellXWidth(newXWidth); | 636 | setCellXWidth(newXWidth); |
638 | } | 637 | } |
639 | 638 | ||
640 | void KOAgendaItem::expandTop(int dy) | 639 | void KOAgendaItem::expandTop(int dy) |
641 | { | 640 | { |
642 | int newYTop = cellYTop() + dy; | 641 | int newYTop = cellYTop() + dy; |
643 | int newYBottom = cellYBottom(); | 642 | int newYBottom = cellYBottom(); |
644 | if (newYTop > newYBottom) newYTop = newYBottom; | 643 | if (newYTop > newYBottom) newYTop = newYBottom; |
645 | setCellY(newYTop, newYBottom); | 644 | setCellY(newYTop, newYBottom); |
646 | } | 645 | } |
647 | 646 | ||
648 | void KOAgendaItem::expandBottom(int dy) | 647 | void KOAgendaItem::expandBottom(int dy) |
649 | { | 648 | { |
650 | int newYTop = cellYTop(); | 649 | int newYTop = cellYTop(); |
651 | int newYBottom = cellYBottom() + dy; | 650 | int newYBottom = cellYBottom() + dy; |
652 | if (newYBottom < newYTop) newYBottom = newYTop; | 651 | if (newYBottom < newYTop) newYBottom = newYTop; |
653 | setCellY(newYTop, newYBottom); | 652 | setCellY(newYTop, newYBottom); |
654 | } | 653 | } |
655 | 654 | ||
656 | void KOAgendaItem::expandLeft(int dx) | 655 | void KOAgendaItem::expandLeft(int dx) |
657 | { | 656 | { |
658 | int newX = cellX() + dx; | 657 | int newX = cellX() + dx; |
659 | int newXWidth = cellXWidth(); | 658 | int newXWidth = cellXWidth(); |
660 | if (newX > newXWidth) newX = newXWidth; | 659 | if (newX > newXWidth) newX = newXWidth; |
661 | setCellX(newX,newXWidth); | 660 | setCellX(newX,newXWidth); |
662 | } | 661 | } |
663 | 662 | ||
664 | void KOAgendaItem::expandRight(int dx) | 663 | void KOAgendaItem::expandRight(int dx) |
665 | { | 664 | { |
666 | int newX = cellX(); | 665 | int newX = cellX(); |
667 | int newXWidth = cellXWidth() + dx; | 666 | int newXWidth = cellXWidth() + dx; |
668 | if (newXWidth < newX) newXWidth = newX; | 667 | if (newXWidth < newX) newXWidth = newX; |
669 | setCellX(newX,newXWidth); | 668 | setCellX(newX,newXWidth); |
670 | } | 669 | } |
671 | 670 | ||
672 | QToolTipGroup *KOAgendaItem::toolTipGroup() | 671 | QToolTipGroup *KOAgendaItem::toolTipGroup() |
673 | { | 672 | { |
674 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); | 673 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); |
675 | return mToolTipGroup; | 674 | return mToolTipGroup; |
676 | } | 675 | } |
677 | 676 | ||
678 | void KOAgendaItem::dragEnterEvent( QDragEnterEvent *e ) | 677 | void KOAgendaItem::dragEnterEvent( QDragEnterEvent *e ) |
679 | { | 678 | { |
680 | #ifndef KORG_NODND | 679 | #ifndef KORG_NODND |
681 | if ( ICalDrag::canDecode( e ) || VCalDrag::canDecode( e ) || | 680 | if ( ICalDrag::canDecode( e ) || VCalDrag::canDecode( e ) || |
682 | !QTextDrag::canDecode( e ) ) { | 681 | !QTextDrag::canDecode( e ) ) { |
683 | e->ignore(); | 682 | e->ignore(); |
684 | return; | 683 | return; |
685 | } | 684 | } |
686 | e->accept(); | 685 | e->accept(); |
687 | #endif | 686 | #endif |
688 | } | 687 | } |
689 | 688 | ||
690 | void KOAgendaItem::dropEvent( QDropEvent *e ) | 689 | void KOAgendaItem::dropEvent( QDropEvent *e ) |
691 | { | 690 | { |
692 | #ifndef KORG_NODND | 691 | #ifndef KORG_NODND |
693 | QString text; | 692 | QString text; |
694 | if(QTextDrag::decode(e,text)) | 693 | if(QTextDrag::decode(e,text)) |
695 | { | 694 | { |
696 | kdDebug() << "Dropped : " << text << endl; | 695 | kdDebug() << "Dropped : " << text << endl; |
697 | QStringList emails = QStringList::split(",",text); | 696 | QStringList emails = QStringList::split(",",text); |
698 | for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { | 697 | for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { |
699 | kdDebug() << " Email: " << (*it) << endl; | 698 | kdDebug() << " Email: " << (*it) << endl; |
700 | int pos = (*it).find("<"); | 699 | int pos = (*it).find("<"); |
701 | QString name = (*it).left(pos); | 700 | QString name = (*it).left(pos); |
702 | QString email = (*it).mid(pos); | 701 | QString email = (*it).mid(pos); |
703 | if (!email.isEmpty()) { | 702 | if (!email.isEmpty()) { |
704 | mIncidence->addAttendee(new Attendee(name,email)); | 703 | mIncidence->addAttendee(new Attendee(name,email)); |
705 | } | 704 | } |
706 | } | 705 | } |
707 | } | 706 | } |
708 | #endif | 707 | #endif |
709 | } | 708 | } |
710 | 709 | ||
711 | 710 | ||
712 | QPtrList<KOAgendaItem> KOAgendaItem::conflictItems() | 711 | QPtrList<KOAgendaItem> KOAgendaItem::conflictItems() |
713 | { | 712 | { |
714 | return mConflictItems; | 713 | return mConflictItems; |
715 | } | 714 | } |
716 | 715 | ||
717 | void KOAgendaItem::setConflictItems(QPtrList<KOAgendaItem> ci) | 716 | void KOAgendaItem::setConflictItems(QPtrList<KOAgendaItem> ci) |
718 | { | 717 | { |
719 | mConflictItems = ci; | 718 | mConflictItems = ci; |
720 | KOAgendaItem *item; | 719 | KOAgendaItem *item; |
721 | for ( item=mConflictItems.first(); item != 0; | 720 | for ( item=mConflictItems.first(); item != 0; |
722 | item=mConflictItems.next() ) { | 721 | item=mConflictItems.next() ) { |
723 | item->addConflictItem(this); | 722 | item->addConflictItem(this); |
724 | } | 723 | } |
725 | } | 724 | } |
726 | 725 | ||
727 | void KOAgendaItem::addConflictItem(KOAgendaItem *ci) | 726 | void KOAgendaItem::addConflictItem(KOAgendaItem *ci) |
728 | { | 727 | { |
729 | if (mConflictItems.find(ci)<0) | 728 | if (mConflictItems.find(ci)<0) |
730 | mConflictItems.append(ci); | 729 | mConflictItems.append(ci); |
731 | } | 730 | } |
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index fc00828..060b4c4 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp | |||
@@ -1,596 +1,634 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Eitzenberger Thomas <thomas.eitzenberger@siemens.at> | 3 | Copyright (c) 2001 Eitzenberger Thomas <thomas.eitzenberger@siemens.at> |
4 | Parts of the source code have been copied from kdpdatebutton.cpp | 4 | Parts of the source code have been copied from kdpdatebutton.cpp |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <qevent.h> | 25 | #include <qevent.h> |
26 | #include <qpainter.h> | 26 | #include <qpainter.h> |
27 | #include <qptrlist.h> | 27 | #include <qptrlist.h> |
28 | 28 | ||
29 | #include <kglobal.h> | 29 | #include <kglobal.h> |
30 | #include <kdebug.h> | 30 | #include <kdebug.h> |
31 | #include <klocale.h> | 31 | #include <klocale.h> |
32 | 32 | ||
33 | #include <libkcal/vcaldrag.h> | 33 | #include <libkcal/vcaldrag.h> |
34 | #include <libkcal/icaldrag.h> | 34 | #include <libkcal/icaldrag.h> |
35 | #include <libkcal/dndfactory.h> | 35 | #include <libkcal/dndfactory.h> |
36 | #include <libkcal/calendarresources.h> | 36 | #include <libkcal/calendarresources.h> |
37 | #include <libkcal/resourcecalendar.h> | 37 | #include <libkcal/resourcecalendar.h> |
38 | #include <kresources/resourceselectdialog.h> | 38 | #include <kresources/resourceselectdialog.h> |
39 | 39 | ||
40 | #include <kcalendarsystem.h> | 40 | #include <kcalendarsystem.h> |
41 | 41 | ||
42 | #ifndef KORG_NOPLUGINS | 42 | #ifndef KORG_NOPLUGINS |
43 | #include "kocore.h" | 43 | #include "kocore.h" |
44 | #endif | 44 | #endif |
45 | #include "koprefs.h" | 45 | #include "koprefs.h" |
46 | #include "koglobals.h" | 46 | #include "koglobals.h" |
47 | 47 | ||
48 | #include "kodaymatrix.h" | 48 | #include "kodaymatrix.h" |
49 | 49 | ||
50 | // ============================================================================ | 50 | // ============================================================================ |
51 | // D Y N A M I C T I P | 51 | // D Y N A M I C T I P |
52 | // ============================================================================ | 52 | // ============================================================================ |
53 | 53 | ||
54 | DynamicTip::DynamicTip( QWidget * parent ) | 54 | DynamicTip::DynamicTip( QWidget * parent ) |
55 | : QToolTip( parent ) | 55 | : QToolTip( parent ) |
56 | { | 56 | { |
57 | matrix = (KODayMatrix*)parent; | 57 | matrix = (KODayMatrix*)parent; |
58 | } | 58 | } |
59 | 59 | ||
60 | 60 | ||
61 | void DynamicTip::maybeTip( const QPoint &pos ) | 61 | void DynamicTip::maybeTip( const QPoint &pos ) |
62 | { | 62 | { |
63 | //calculate which cell of the matrix the mouse is in | 63 | //calculate which cell of the matrix the mouse is in |
64 | QRect sz = matrix->frameRect(); | 64 | QRect sz = matrix->frameRect(); |
65 | int dheight = sz.height()*7 / 42; | 65 | int dheight = sz.height()*7 / 42; |
66 | int dwidth = sz.width() / 7; | 66 | int dwidth = sz.width() / 7; |
67 | int row = pos.y()/dheight; | 67 | int row = pos.y()/dheight; |
68 | int col = pos.x()/dwidth; | 68 | int col = pos.x()/dwidth; |
69 | 69 | ||
70 | QRect rct(col*dwidth, row*dheight, dwidth, dheight); | 70 | QRect rct(col*dwidth, row*dheight, dwidth, dheight); |
71 | 71 | ||
72 | // kdDebug() << "DynamicTip::maybeTip matrix cell index [" << | 72 | // kdDebug() << "DynamicTip::maybeTip matrix cell index [" << |
73 | // col << "][" << row << "] => " <<(col+row*7) << endl; | 73 | // col << "][" << row << "] => " <<(col+row*7) << endl; |
74 | 74 | ||
75 | //show holiday names only | 75 | //show holiday names only |
76 | QString str = matrix->getHolidayLabel(col+row*7); | 76 | QString str = matrix->getHolidayLabel(col+row*7); |
77 | if (str.isEmpty()) return; | 77 | if (str.isEmpty()) return; |
78 | tip(rct, str); | 78 | tip(rct, str); |
79 | } | 79 | } |
80 | 80 | ||
81 | 81 | ||
82 | // ============================================================================ | 82 | // ============================================================================ |
83 | // K O D A Y M A T R I X | 83 | // K O D A Y M A T R I X |
84 | // ============================================================================ | 84 | // ============================================================================ |
85 | 85 | ||
86 | const int KODayMatrix::NOSELECTION = -1000; | 86 | const int KODayMatrix::NOSELECTION = -1000; |
87 | const int KODayMatrix::NUMDAYS = 42; | 87 | const int KODayMatrix::NUMDAYS = 42; |
88 | 88 | ||
89 | KODayMatrix::KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name) : | 89 | KODayMatrix::KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name) : |
90 | QFrame(parent, name) | 90 | QFrame(parent, name) |
91 | { | 91 | { |
92 | mCalendar = calendar; | 92 | mCalendar = calendar; |
93 | 93 | ||
94 | // initialize dynamic arrays | 94 | // initialize dynamic arrays |
95 | days = new QDate[NUMDAYS]; | 95 | days = new QDate[NUMDAYS]; |
96 | daylbls = new QString[NUMDAYS]; | 96 | daylbls = new QString[NUMDAYS]; |
97 | events = new int[NUMDAYS]; | 97 | events = new int[NUMDAYS]; |
98 | mToolTip = new DynamicTip(this); | 98 | mToolTip = new DynamicTip(this); |
99 | 99 | ||
100 | // set default values used for drawing the matrix | 100 | // set default values used for drawing the matrix |
101 | mDefaultBackColor = palette().active().base(); | 101 | mDefaultBackColor = palette().active().base(); |
102 | mDefaultTextColor = palette().active().foreground(); | 102 | mDefaultTextColor = palette().active().foreground(); |
103 | mDefaultTextColorShaded = getShadedColor(mDefaultTextColor); | 103 | mDefaultTextColorShaded = getShadedColor(mDefaultTextColor); |
104 | mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor); | 104 | mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor); |
105 | mSelectedDaysColor = QColor("white"); | 105 | mSelectedDaysColor = QColor("white"); |
106 | mTodayMarginWidth = 2; | 106 | mTodayMarginWidth = 2; |
107 | mSelEnd = mSelStart = NOSELECTION; | 107 | mSelEnd = mSelStart = NOSELECTION; |
108 | 108 | ||
109 | setAcceptDrops(true); | 109 | setAcceptDrops(true); |
110 | //setFont( QFont("Arial", 10) ); | 110 | //setFont( QFont("Arial", 10) ); |
111 | updateView(date); | 111 | |
112 | mUpdateTimer = new QTimer( this ); | ||
113 | connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() )); | ||
114 | mRepaintTimer = new QTimer( this ); | ||
115 | connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() )); | ||
116 | mDayChanged = false; | ||
117 | updateView(); | ||
112 | } | 118 | } |
113 | 119 | ||
114 | QColor KODayMatrix::getShadedColor(QColor color) | 120 | QColor KODayMatrix::getShadedColor(QColor color) |
115 | { | 121 | { |
116 | QColor shaded; | 122 | QColor shaded; |
117 | int h=0; | 123 | int h=0; |
118 | int s=0; | 124 | int s=0; |
119 | int v=0; | 125 | int v=0; |
120 | color.hsv(&h,&s,&v); | 126 | color.hsv(&h,&s,&v); |
121 | s = s/4; | 127 | s = s/4; |
122 | v = 192+v/4; | 128 | v = 192+v/4; |
123 | shaded.setHsv(h,s,v); | 129 | shaded.setHsv(h,s,v); |
124 | 130 | ||
125 | return shaded; | 131 | return shaded; |
126 | } | 132 | } |
127 | 133 | ||
128 | KODayMatrix::~KODayMatrix() | 134 | KODayMatrix::~KODayMatrix() |
129 | { | 135 | { |
130 | delete [] days; | 136 | delete [] days; |
131 | delete [] daylbls; | 137 | delete [] daylbls; |
132 | delete [] events; | 138 | delete [] events; |
133 | delete mToolTip; | 139 | delete mToolTip; |
134 | } | 140 | } |
135 | 141 | ||
136 | /* | 142 | /* |
137 | void KODayMatrix::setStartDate(QDate start) | 143 | void KODayMatrix::setStartDate(QDate start) |
138 | { | 144 | { |
139 | updateView(start); | 145 | updateView(start); |
140 | } | 146 | } |
141 | */ | 147 | */ |
142 | 148 | ||
143 | void KODayMatrix::addSelectedDaysTo(DateList& selDays) | 149 | void KODayMatrix::addSelectedDaysTo(DateList& selDays) |
144 | { | 150 | { |
145 | kdDebug() << "KODayMatrix::addSelectedDaysTo() - " << "mSelStart:" << mSelStart << endl; | 151 | kdDebug() << "KODayMatrix::addSelectedDaysTo() - " << "mSelStart:" << mSelStart << endl; |
146 | 152 | ||
147 | if (mSelStart == NOSELECTION) { | 153 | if (mSelStart == NOSELECTION) { |
148 | return; | 154 | return; |
149 | } | 155 | } |
150 | 156 | ||
151 | //cope with selection being out of matrix limits at top (< 0) | 157 | //cope with selection being out of matrix limits at top (< 0) |
152 | int i0 = mSelStart; | 158 | int i0 = mSelStart; |
153 | if (i0 < 0) { | 159 | if (i0 < 0) { |
154 | for (int i = i0; i < 0; i++) { | 160 | for (int i = i0; i < 0; i++) { |
155 | selDays.append(days[0].addDays(i)); | 161 | selDays.append(days[0].addDays(i)); |
156 | } | 162 | } |
157 | i0 = 0; | 163 | i0 = 0; |
158 | } | 164 | } |
159 | 165 | ||
160 | //cope with selection being out of matrix limits at bottom (> NUMDAYS-1) | 166 | //cope with selection being out of matrix limits at bottom (> NUMDAYS-1) |
161 | if (mSelEnd > NUMDAYS-1) { | 167 | if (mSelEnd > NUMDAYS-1) { |
162 | for (int i = i0; i <= NUMDAYS-1; i++) { | 168 | for (int i = i0; i <= NUMDAYS-1; i++) { |
163 | selDays.append(days[i]); | 169 | selDays.append(days[i]); |
164 | } | 170 | } |
165 | for (int i = NUMDAYS; i < mSelEnd; i++) { | 171 | for (int i = NUMDAYS; i < mSelEnd; i++) { |
166 | selDays.append(days[0].addDays(i)); | 172 | selDays.append(days[0].addDays(i)); |
167 | } | 173 | } |
168 | 174 | ||
169 | // apply normal routine to selection being entirely within matrix limits | 175 | // apply normal routine to selection being entirely within matrix limits |
170 | } else { | 176 | } else { |
171 | for (int i = i0; i <= mSelEnd; i++) { | 177 | for (int i = i0; i <= mSelEnd; i++) { |
172 | selDays.append(days[i]); | 178 | selDays.append(days[i]); |
173 | } | 179 | } |
174 | } | 180 | } |
175 | } | 181 | } |
176 | 182 | ||
177 | void KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end) | 183 | void KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end) |
178 | { | 184 | { |
179 | mSelStart = startdate.daysTo(start); | 185 | mSelStart = startdate.daysTo(start); |
180 | mSelEnd = startdate.daysTo(end); | 186 | mSelEnd = startdate.daysTo(end); |
181 | } | 187 | } |
182 | 188 | ||
183 | 189 | ||
184 | void KODayMatrix::recalculateToday() | 190 | void KODayMatrix::recalculateToday() |
185 | { | 191 | { |
186 | today = -1; | 192 | today = -1; |
187 | for (int i=0; i<NUMDAYS; i++) { | 193 | for (int i=0; i<NUMDAYS; i++) { |
188 | days[i] = startdate.addDays(i); | 194 | days[i] = startdate.addDays(i); |
189 | daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] )); | 195 | daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] )); |
190 | 196 | ||
191 | // if today is in the currently displayed month, hilight today | 197 | // if today is in the currently displayed month, hilight today |
192 | if (days[i].year() == QDate::currentDate().year() && | 198 | if (days[i].year() == QDate::currentDate().year() && |
193 | days[i].month() == QDate::currentDate().month() && | 199 | days[i].month() == QDate::currentDate().month() && |
194 | days[i].day() == QDate::currentDate().day()) { | 200 | days[i].day() == QDate::currentDate().day()) { |
195 | today = i; | 201 | today = i; |
196 | } | 202 | } |
197 | } | 203 | } |
198 | // qDebug(QString("Today is visible at %1.").arg(today)); | 204 | // qDebug(QString("Today is visible at %1.").arg(today)); |
199 | } | 205 | } |
200 | 206 | ||
201 | void KODayMatrix::updateView() | 207 | void KODayMatrix::updateView() |
202 | { | 208 | { |
203 | updateView(startdate); | 209 | updateView(startdate); |
204 | } | 210 | } |
205 | 211 | void KODayMatrix::repaintViewTimed() | |
206 | void KODayMatrix::updateView(QDate actdate) | 212 | { |
213 | qDebug("KODayMatrix::repaintViewTimed "); | ||
214 | mRepaintTimer->stop(); | ||
215 | repaint(false); | ||
216 | } | ||
217 | void KODayMatrix::updateViewTimed() | ||
207 | { | 218 | { |
208 | |||
209 | // kdDebug() << "KODayMatrix::updateView() " << actdate.toString() << endl; | ||
210 | |||
211 | //flag to indicate if the starting day of the matrix has changed by this call | ||
212 | bool daychanged = false; | ||
213 | // if a new startdate is to be set then apply Cornelius's calculation | ||
214 | // of the first day to be shown | ||
215 | if (actdate != startdate) { | ||
216 | // reset index of selection according to shift of starting date from startdate to actdate | ||
217 | if (mSelStart != NOSELECTION) { | ||
218 | int tmp = actdate.daysTo(startdate); | ||
219 | //kdDebug() << "Shift of Selection1: " << mSelStart << " - " << mSelEnd << " -> " << tmp << "(" << offset << ")" << endl; | ||
220 | // shift selection if new one would be visible at least partly ! | ||
221 | |||
222 | if (mSelStart+tmp < NUMDAYS && mSelEnd+tmp >= 0) { | ||
223 | // nested if is required for next X display pushed from a different month - correction required | ||
224 | // otherwise, for month forward and backward, it must be avoided | ||
225 | if( mSelStart > NUMDAYS || mSelStart < 0 ) | ||
226 | mSelStart = mSelStart + tmp; | ||
227 | if( mSelEnd > NUMDAYS || mSelEnd < 0 ) | ||
228 | mSelEnd = mSelEnd + tmp; | ||
229 | } | ||
230 | } | ||
231 | 219 | ||
232 | startdate = actdate; | 220 | mUpdateTimer->stop(); |
233 | daychanged = true; | 221 | //QDate actdate = mPendingNewDate; |
234 | } | ||
235 | 222 | ||
236 | if (daychanged) { | 223 | static int iii = 0; |
237 | recalculateToday(); | 224 | qDebug("KODayMatrix::updateView(QDate actdate) %d", ++iii ); |
238 | } | 225 | |
226 | if (mDayChanged) { | ||
227 | recalculateToday(); | ||
228 | mDayChanged = false; | ||
229 | } | ||
239 | 230 | ||
240 | for(int i = 0; i < NUMDAYS; i++) { | 231 | for(int i = 0; i < NUMDAYS; i++) { |
241 | 232 | ||
242 | // if events are set for the day then remember to draw it bold | 233 | // if events are set for the day then remember to draw it bold |
243 | QPtrList<Event> eventlist = mCalendar->events(days[i]); | 234 | QPtrList<Event> eventlist = mCalendar->events(days[i]); |
244 | Event *event; | 235 | Event *event; |
245 | int numEvents = eventlist.count(); | 236 | int numEvents = eventlist.count(); |
246 | 237 | ||
247 | for(event=eventlist.first();event != 0;event=eventlist.next()) { | 238 | for(event=eventlist.first();event != 0;event=eventlist.next()) { |
248 | ushort recurType = event->recurrence()->doesRecur(); | 239 | ushort recurType = event->recurrence()->doesRecur(); |
249 | 240 | ||
250 | if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || | 241 | if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || |
251 | (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { | 242 | (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { |
252 | numEvents--; | 243 | numEvents--; |
253 | } | 244 | } |
254 | } | 245 | } |
255 | events[i] = numEvents; | 246 | events[i] = numEvents; |
256 | 247 | ||
257 | //if it is a holy day then draw it red. Sundays are consider holidays, too | 248 | //if it is a holy day then draw it red. Sundays are consider holidays, too |
258 | #ifndef KORG_NOPLUGINS | 249 | #ifndef KORG_NOPLUGINS |
259 | QString holiStr = KOCore::self()->holiday(days[i]); | 250 | QString holiStr = KOCore::self()->holiday(days[i]); |
260 | #else | 251 | #else |
261 | QString holiStr = QString::null; | 252 | QString holiStr = QString::null; |
262 | #endif | 253 | #endif |
263 | if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) || | 254 | if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) || |
264 | !holiStr.isEmpty()) { | 255 | !holiStr.isEmpty()) { |
265 | if (holiStr.isNull()) holiStr = ""; | 256 | if (holiStr.isNull()) holiStr = ""; |
266 | mHolidays[i] = holiStr; | 257 | mHolidays[i] = holiStr; |
267 | 258 | ||
259 | } else { | ||
260 | mHolidays[i] = QString::null; | ||
261 | } | ||
262 | } | ||
263 | repaint(false); | ||
264 | } | ||
265 | void KODayMatrix::updateView(QDate actdate) | ||
266 | { | ||
267 | |||
268 | //flag to indicate if the starting day of the matrix has changed by this call | ||
269 | //mDayChanged = false; | ||
270 | // if a new startdate is to be set then apply Cornelius's calculation | ||
271 | // of the first day to be shown | ||
272 | if (actdate != startdate) { | ||
273 | // reset index of selection according to shift of starting date from startdate to actdate | ||
274 | if (mSelStart != NOSELECTION) { | ||
275 | int tmp = actdate.daysTo(startdate); | ||
276 | //kdDebug() << "Shift of Selection1: " << mSelStart << " - " << mSelEnd << " -> " << tmp << "(" << offset << ")" << endl; | ||
277 | // shift selection if new one would be visible at least partly ! | ||
278 | |||
279 | if (mSelStart+tmp < NUMDAYS && mSelEnd+tmp >= 0) { | ||
280 | // nested if is required for next X display pushed from a different month - correction required | ||
281 | // otherwise, for month forward and backward, it must be avoided | ||
282 | if( mSelStart > NUMDAYS || mSelStart < 0 ) | ||
283 | mSelStart = mSelStart + tmp; | ||
284 | if( mSelEnd > NUMDAYS || mSelEnd < 0 ) | ||
285 | mSelEnd = mSelEnd + tmp; | ||
286 | } | ||
287 | } | ||
288 | |||
289 | startdate = actdate; | ||
290 | mDayChanged = true; | ||
291 | } | ||
292 | qDebug("restart Timer %d", mDayChanged ); | ||
293 | static int iii = 0; | ||
294 | if ( iii < 5 ) { | ||
295 | ++iii; | ||
296 | updateViewTimed(); | ||
268 | } else { | 297 | } else { |
269 | mHolidays[i] = QString::null; | 298 | if ( !isVisible() ) { |
299 | mUpdateTimer->start( 2000 ); | ||
300 | } else { | ||
301 | if ( mDayChanged ) { | ||
302 | mUpdateTimer->start( 250 ); | ||
303 | } else { | ||
304 | mRepaintTimer->start( 250 ); | ||
305 | mUpdateTimer->start( 2000 ); | ||
306 | } | ||
307 | } | ||
270 | } | 308 | } |
271 | } | 309 | |
272 | } | 310 | } |
273 | 311 | ||
274 | const QDate& KODayMatrix::getDate(int offset) | 312 | const QDate& KODayMatrix::getDate(int offset) |
275 | { | 313 | { |
276 | if (offset < 0 || offset > NUMDAYS-1) { | 314 | if (offset < 0 || offset > NUMDAYS-1) { |
277 | kdDebug() << "Wrong offset (" << offset << ") in KODayMatrix::getDate(int)" << endl; | 315 | qDebug("Wrong offset2 "); |
278 | return days[0]; | 316 | return days[0]; |
279 | } | 317 | } |
280 | return days[offset]; | 318 | return days[offset]; |
281 | } | 319 | } |
282 | 320 | ||
283 | QString KODayMatrix::getHolidayLabel(int offset) | 321 | QString KODayMatrix::getHolidayLabel(int offset) |
284 | { | 322 | { |
285 | if (offset < 0 || offset > NUMDAYS-1) { | 323 | if (offset < 0 || offset > NUMDAYS-1) { |
286 | kdDebug() << "Wrong offset (" << offset << ") in KODayMatrix::getHolidayLabel(int)" << endl; | 324 | qDebug("Wrong offset1 "); |
287 | return 0; | 325 | return 0; |
288 | } | 326 | } |
289 | return mHolidays[offset]; | 327 | return mHolidays[offset]; |
290 | } | 328 | } |
291 | 329 | ||
292 | int KODayMatrix::getDayIndexFrom(int x, int y) | 330 | int KODayMatrix::getDayIndexFrom(int x, int y) |
293 | { | 331 | { |
294 | return 7*(y/daysize.height()) + (KOGlobals::self()->reverseLayout() ? | 332 | return 7*(y/daysize.height()) + (KOGlobals::self()->reverseLayout() ? |
295 | 6 - x/daysize.width() : x/daysize.width()); | 333 | 6 - x/daysize.width() : x/daysize.width()); |
296 | } | 334 | } |
297 | 335 | ||
298 | // ---------------------------------------------------------------------------- | 336 | // ---------------------------------------------------------------------------- |
299 | // M O U S E E V E N T H A N D L I N G | 337 | // M O U S E E V E N T H A N D L I N G |
300 | // ---------------------------------------------------------------------------- | 338 | // ---------------------------------------------------------------------------- |
301 | 339 | ||
302 | void KODayMatrix::mousePressEvent (QMouseEvent* e) | 340 | void KODayMatrix::mousePressEvent (QMouseEvent* e) |
303 | { | 341 | { |
304 | mSelStart = getDayIndexFrom(e->x(), e->y()); | 342 | mSelStart = getDayIndexFrom(e->x(), e->y()); |
305 | if (mSelStart > NUMDAYS-1) mSelStart=NUMDAYS-1; | 343 | if (mSelStart > NUMDAYS-1) mSelStart=NUMDAYS-1; |
306 | mSelInit = mSelStart; | 344 | mSelInit = mSelStart; |
307 | } | 345 | } |
308 | 346 | ||
309 | void KODayMatrix::mouseReleaseEvent (QMouseEvent* e) | 347 | void KODayMatrix::mouseReleaseEvent (QMouseEvent* e) |
310 | { | 348 | { |
311 | 349 | ||
312 | int tmp = getDayIndexFrom(e->x(), e->y()); | 350 | int tmp = getDayIndexFrom(e->x(), e->y()); |
313 | if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; | 351 | if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; |
314 | 352 | ||
315 | if (mSelInit > tmp) { | 353 | if (mSelInit > tmp) { |
316 | mSelEnd = mSelInit; | 354 | mSelEnd = mSelInit; |
317 | if (tmp != mSelStart) { | 355 | if (tmp != mSelStart) { |
318 | mSelStart = tmp; | 356 | mSelStart = tmp; |
319 | repaint(); | 357 | repaint(); |
320 | } | 358 | } |
321 | } else { | 359 | } else { |
322 | mSelStart = mSelInit; | 360 | mSelStart = mSelInit; |
323 | 361 | ||
324 | //repaint only if selection has changed | 362 | //repaint only if selection has changed |
325 | if (tmp != mSelEnd) { | 363 | if (tmp != mSelEnd) { |
326 | mSelEnd = tmp; | 364 | mSelEnd = tmp; |
327 | repaint(); | 365 | repaint(); |
328 | } | 366 | } |
329 | } | 367 | } |
330 | 368 | ||
331 | DateList daylist; | 369 | DateList daylist; |
332 | if ( mSelStart < 0 ) | 370 | if ( mSelStart < 0 ) |
333 | mSelStart = 0; | 371 | mSelStart = 0; |
334 | for (int i = mSelStart; i <= mSelEnd; i++) { | 372 | for (int i = mSelStart; i <= mSelEnd; i++) { |
335 | daylist.append(days[i]); | 373 | daylist.append(days[i]); |
336 | } | 374 | } |
337 | emit selected((const DateList)daylist); | 375 | emit selected((const DateList)daylist); |
338 | 376 | ||
339 | } | 377 | } |
340 | 378 | ||
341 | void KODayMatrix::mouseMoveEvent (QMouseEvent* e) | 379 | void KODayMatrix::mouseMoveEvent (QMouseEvent* e) |
342 | { | 380 | { |
343 | int tmp = getDayIndexFrom(e->x(), e->y()); | 381 | int tmp = getDayIndexFrom(e->x(), e->y()); |
344 | if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; | 382 | if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; |
345 | 383 | ||
346 | if (mSelInit > tmp) { | 384 | if (mSelInit > tmp) { |
347 | mSelEnd = mSelInit; | 385 | mSelEnd = mSelInit; |
348 | if (tmp != mSelStart) { | 386 | if (tmp != mSelStart) { |
349 | mSelStart = tmp; | 387 | mSelStart = tmp; |
350 | repaint(); | 388 | repaint(); |
351 | } | 389 | } |
352 | } else { | 390 | } else { |
353 | mSelStart = mSelInit; | 391 | mSelStart = mSelInit; |
354 | 392 | ||
355 | //repaint only if selection has changed | 393 | //repaint only if selection has changed |
356 | if (tmp != mSelEnd) { | 394 | if (tmp != mSelEnd) { |
357 | mSelEnd = tmp; | 395 | mSelEnd = tmp; |
358 | repaint(); | 396 | repaint(); |
359 | } | 397 | } |
360 | } | 398 | } |
361 | } | 399 | } |
362 | 400 | ||
363 | // ---------------------------------------------------------------------------- | 401 | // ---------------------------------------------------------------------------- |
364 | // D R A G ' N D R O P H A N D L I N G | 402 | // D R A G ' N D R O P H A N D L I N G |
365 | // ---------------------------------------------------------------------------- | 403 | // ---------------------------------------------------------------------------- |
366 | 404 | ||
367 | void KODayMatrix::dragEnterEvent(QDragEnterEvent *e) | 405 | void KODayMatrix::dragEnterEvent(QDragEnterEvent *e) |
368 | { | 406 | { |
369 | #ifndef KORG_NODND | 407 | #ifndef KORG_NODND |
370 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { | 408 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { |
371 | e->ignore(); | 409 | e->ignore(); |
372 | return; | 410 | return; |
373 | } | 411 | } |
374 | 412 | ||
375 | // some visual feedback | 413 | // some visual feedback |
376 | // oldPalette = palette(); | 414 | // oldPalette = palette(); |
377 | // setPalette(my_HilitePalette); | 415 | // setPalette(my_HilitePalette); |
378 | // update(); | 416 | // update(); |
379 | #endif | 417 | #endif |
380 | } | 418 | } |
381 | 419 | ||
382 | void KODayMatrix::dragMoveEvent(QDragMoveEvent *e) | 420 | void KODayMatrix::dragMoveEvent(QDragMoveEvent *e) |
383 | { | 421 | { |
384 | #ifndef KORG_NODND | 422 | #ifndef KORG_NODND |
385 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { | 423 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { |
386 | e->ignore(); | 424 | e->ignore(); |
387 | return; | 425 | return; |
388 | } | 426 | } |
389 | 427 | ||
390 | e->accept(); | 428 | e->accept(); |
391 | #endif | 429 | #endif |
392 | } | 430 | } |
393 | 431 | ||
394 | void KODayMatrix::dragLeaveEvent(QDragLeaveEvent */*dl*/) | 432 | void KODayMatrix::dragLeaveEvent(QDragLeaveEvent */*dl*/) |
395 | { | 433 | { |
396 | #ifndef KORG_NODND | 434 | #ifndef KORG_NODND |
397 | // setPalette(oldPalette); | 435 | // setPalette(oldPalette); |
398 | // update(); | 436 | // update(); |
399 | #endif | 437 | #endif |
400 | } | 438 | } |
401 | 439 | ||
402 | void KODayMatrix::dropEvent(QDropEvent *e) | 440 | void KODayMatrix::dropEvent(QDropEvent *e) |
403 | { | 441 | { |
404 | #ifndef KORG_NODND | 442 | #ifndef KORG_NODND |
405 | // kdDebug() << "KODayMatrix::dropEvent(e) begin" << endl; | 443 | // kdDebug() << "KODayMatrix::dropEvent(e) begin" << endl; |
406 | 444 | ||
407 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { | 445 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { |
408 | e->ignore(); | 446 | e->ignore(); |
409 | return; | 447 | return; |
410 | } | 448 | } |
411 | 449 | ||
412 | DndFactory factory( mCalendar ); | 450 | DndFactory factory( mCalendar ); |
413 | Event *event = factory.createDrop(e); | 451 | Event *event = factory.createDrop(e); |
414 | 452 | ||
415 | if (event) { | 453 | if (event) { |
416 | e->acceptAction(); | 454 | e->acceptAction(); |
417 | 455 | ||
418 | Event *existingEvent = mCalendar->event(event->uid()); | 456 | Event *existingEvent = mCalendar->event(event->uid()); |
419 | 457 | ||
420 | if(existingEvent) { | 458 | if(existingEvent) { |
421 | // uniquify event | 459 | // uniquify event |
422 | event->recreate(); | 460 | event->recreate(); |
423 | /* | 461 | /* |
424 | KMessageBox::sorry(this, | 462 | KMessageBox::sorry(this, |
425 | i18n("Event already exists in this calendar."), | 463 | i18n("Event already exists in this calendar."), |
426 | i18n("Drop Event")); | 464 | i18n("Drop Event")); |
427 | delete event; | 465 | delete event; |
428 | return; | 466 | return; |
429 | */ | 467 | */ |
430 | } | 468 | } |
431 | // kdDebug() << "Drop new Event" << endl; | 469 | // kdDebug() << "Drop new Event" << endl; |
432 | // Adjust date | 470 | // Adjust date |
433 | QDateTime start = event->dtStart(); | 471 | QDateTime start = event->dtStart(); |
434 | QDateTime end = event->dtEnd(); | 472 | QDateTime end = event->dtEnd(); |
435 | int duration = start.daysTo(end); | 473 | int duration = start.daysTo(end); |
436 | int idx = getDayIndexFrom(e->pos().x(), e->pos().y()); | 474 | int idx = getDayIndexFrom(e->pos().x(), e->pos().y()); |
437 | 475 | ||
438 | start.setDate(days[idx]); | 476 | start.setDate(days[idx]); |
439 | end.setDate(days[idx].addDays(duration)); | 477 | end.setDate(days[idx].addDays(duration)); |
440 | 478 | ||
441 | event->setDtStart(start); | 479 | event->setDtStart(start); |
442 | event->setDtEnd(end); | 480 | event->setDtEnd(end); |
443 | mCalendar->addEvent(event); | 481 | mCalendar->addEvent(event); |
444 | 482 | ||
445 | emit eventDropped(event); | 483 | emit eventDropped(event); |
446 | } else { | 484 | } else { |
447 | // kdDebug() << "KODayMatrix::dropEvent(): Event from drop not decodable" << endl; | 485 | // kdDebug() << "KODayMatrix::dropEvent(): Event from drop not decodable" << endl; |
448 | e->ignore(); | 486 | e->ignore(); |
449 | } | 487 | } |
450 | #endif | 488 | #endif |
451 | } | 489 | } |
452 | 490 | ||
453 | // ---------------------------------------------------------------------------- | 491 | // ---------------------------------------------------------------------------- |
454 | // P A I N T E V E N T H A N D L I N G | 492 | // P A I N T E V E N T H A N D L I N G |
455 | // ---------------------------------------------------------------------------- | 493 | // ---------------------------------------------------------------------------- |
456 | 494 | ||
457 | void KODayMatrix::paintEvent(QPaintEvent * pevent) | 495 | void KODayMatrix::paintEvent(QPaintEvent * pevent) |
458 | { | 496 | { |
459 | //kdDebug() << "KODayMatrix::paintEvent() BEGIN" << endl; | 497 | //kdDebug() << "KODayMatrix::paintEvent() BEGIN" << endl; |
460 | 498 | ||
461 | QPainter p(this); | 499 | QPainter p(this); |
462 | 500 | ||
463 | QRect sz = frameRect(); | 501 | QRect sz = frameRect(); |
464 | int dheight = daysize.height(); | 502 | int dheight = daysize.height(); |
465 | int dwidth = daysize.width(); | 503 | int dwidth = daysize.width(); |
466 | int row,col; | 504 | int row,col; |
467 | int selw, selh; | 505 | int selw, selh; |
468 | bool isRTL = KOGlobals::self()->reverseLayout(); | 506 | bool isRTL = KOGlobals::self()->reverseLayout(); |
469 | 507 | ||
470 | // draw background and topleft frame | 508 | // draw background and topleft frame |
471 | p.fillRect(pevent->rect(), mDefaultBackColor); | 509 | p.fillRect(pevent->rect(), mDefaultBackColor); |
472 | p.setPen(mDefaultTextColor); | 510 | p.setPen(mDefaultTextColor); |
473 | p.drawRect(0, 0, sz.width()+1, sz.height()+1); | 511 | p.drawRect(0, 0, sz.width()+1, sz.height()+1); |
474 | 512 | ||
475 | // draw selected days with highlighted background color | 513 | // draw selected days with highlighted background color |
476 | if (mSelStart != NOSELECTION) { | 514 | if (mSelStart != NOSELECTION) { |
477 | 515 | ||
478 | row = mSelStart/7; | 516 | row = mSelStart/7; |
479 | col = mSelStart -row*7; | 517 | col = mSelStart -row*7; |
480 | QColor selcol = KOPrefs::instance()->mHighlightColor; | 518 | QColor selcol = KOPrefs::instance()->mHighlightColor; |
481 | 519 | ||
482 | if (row == mSelEnd/7) { | 520 | if (row == mSelEnd/7) { |
483 | // Single row selection | 521 | // Single row selection |
484 | p.fillRect(isRTL ? (7 - (mSelEnd-mSelStart+1) - col)*dwidth : col*dwidth, | 522 | p.fillRect(isRTL ? (7 - (mSelEnd-mSelStart+1) - col)*dwidth : col*dwidth, |
485 | row*dheight, (mSelEnd-mSelStart+1)*dwidth, dheight, selcol); | 523 | row*dheight, (mSelEnd-mSelStart+1)*dwidth, dheight, selcol); |
486 | } else { | 524 | } else { |
487 | // draw first row to the right | 525 | // draw first row to the right |
488 | p.fillRect(isRTL ? 0 : col*dwidth, row*dheight, (7-col)*dwidth, | 526 | p.fillRect(isRTL ? 0 : col*dwidth, row*dheight, (7-col)*dwidth, |
489 | dheight, selcol); | 527 | dheight, selcol); |
490 | // draw full block till last line | 528 | // draw full block till last line |
491 | selh = mSelEnd/7-row; | 529 | selh = mSelEnd/7-row; |
492 | if (selh > 1) { | 530 | if (selh > 1) { |
493 | p.fillRect(0, (row+1)*dheight, 7*dwidth, (selh-1)*dheight,selcol); | 531 | p.fillRect(0, (row+1)*dheight, 7*dwidth, (selh-1)*dheight,selcol); |
494 | } | 532 | } |
495 | // draw last block from left to mSelEnd | 533 | // draw last block from left to mSelEnd |
496 | selw = mSelEnd-7*(mSelEnd/7)+1; | 534 | selw = mSelEnd-7*(mSelEnd/7)+1; |
497 | p.fillRect(isRTL ? (7-selw)*dwidth : 0, (row+selh)*dheight, | 535 | p.fillRect(isRTL ? (7-selw)*dwidth : 0, (row+selh)*dheight, |
498 | selw*dwidth, dheight, selcol); | 536 | selw*dwidth, dheight, selcol); |
499 | } | 537 | } |
500 | } | 538 | } |
501 | 539 | ||
502 | // iterate over all days in the matrix and draw the day label in appropriate colors | 540 | // iterate over all days in the matrix and draw the day label in appropriate colors |
503 | QColor actcol = mDefaultTextColorShaded; | 541 | QColor actcol = mDefaultTextColorShaded; |
504 | p.setPen(actcol); | 542 | p.setPen(actcol); |
505 | QPen tmppen; | 543 | QPen tmppen; |
506 | for(int i = 0; i < NUMDAYS; i++) { | 544 | for(int i = 0; i < NUMDAYS; i++) { |
507 | row = i/7; | 545 | row = i/7; |
508 | col = isRTL ? 6-(i-row*7) : i-row*7; | 546 | col = isRTL ? 6-(i-row*7) : i-row*7; |
509 | 547 | ||
510 | // if it is the first day of a month switch color from normal to shaded and vice versa | 548 | // if it is the first day of a month switch color from normal to shaded and vice versa |
511 | if ( KOGlobals::self()->calendarSystem()->day( days[i] ) == 1) { | 549 | if ( KOGlobals::self()->calendarSystem()->day( days[i] ) == 1) { |
512 | if (actcol == mDefaultTextColorShaded) { | 550 | if (actcol == mDefaultTextColorShaded) { |
513 | actcol = mDefaultTextColor; | 551 | actcol = mDefaultTextColor; |
514 | } else { | 552 | } else { |
515 | actcol = mDefaultTextColorShaded; | 553 | actcol = mDefaultTextColorShaded; |
516 | } | 554 | } |
517 | p.setPen(actcol); | 555 | p.setPen(actcol); |
518 | } | 556 | } |
519 | 557 | ||
520 | //Reset pen color after selected days block | 558 | //Reset pen color after selected days block |
521 | if (i == mSelEnd+1) { | 559 | if (i == mSelEnd+1) { |
522 | p.setPen(actcol); | 560 | p.setPen(actcol); |
523 | } | 561 | } |
524 | 562 | ||
525 | // if today then draw rectangle around day | 563 | // if today then draw rectangle around day |
526 | if (today == i) { | 564 | if (today == i) { |
527 | tmppen = p.pen(); | 565 | tmppen = p.pen(); |
528 | QPen mTodayPen(p.pen()); | 566 | QPen mTodayPen(p.pen()); |
529 | 567 | ||
530 | mTodayPen.setWidth(mTodayMarginWidth); | 568 | mTodayPen.setWidth(mTodayMarginWidth); |
531 | //draw red rectangle for holidays | 569 | //draw red rectangle for holidays |
532 | if (!mHolidays[i].isNull()) { | 570 | if (!mHolidays[i].isNull()) { |
533 | if (actcol == mDefaultTextColor) { | 571 | if (actcol == mDefaultTextColor) { |
534 | mTodayPen.setColor(KOPrefs::instance()->mHolidayColor); | 572 | mTodayPen.setColor(KOPrefs::instance()->mHolidayColor); |
535 | } else { | 573 | } else { |
536 | mTodayPen.setColor(mHolidayColorShaded); | 574 | mTodayPen.setColor(mHolidayColorShaded); |
537 | } | 575 | } |
538 | } | 576 | } |
539 | //draw gray rectangle for today if in selection | 577 | //draw gray rectangle for today if in selection |
540 | if (i >= mSelStart && i <= mSelEnd) { | 578 | if (i >= mSelStart && i <= mSelEnd) { |
541 | QColor grey("grey"); | 579 | QColor grey("grey"); |
542 | mTodayPen.setColor(grey); | 580 | mTodayPen.setColor(grey); |
543 | } | 581 | } |
544 | p.setPen(mTodayPen); | 582 | p.setPen(mTodayPen); |
545 | p.drawRect(col*dwidth, row*dheight, dwidth, dheight); | 583 | p.drawRect(col*dwidth, row*dheight, dwidth, dheight); |
546 | p.setPen(tmppen); | 584 | p.setPen(tmppen); |
547 | } | 585 | } |
548 | 586 | ||
549 | // if any events are on that day then draw it using a bold font | 587 | // if any events are on that day then draw it using a bold font |
550 | if (events[i] > 0) { | 588 | if (events[i] > 0) { |
551 | QFont myFont = font(); | 589 | QFont myFont = font(); |
552 | myFont.setBold(true); | 590 | myFont.setBold(true); |
553 | p.setFont(myFont); | 591 | p.setFont(myFont); |
554 | } | 592 | } |
555 | 593 | ||
556 | // if it is a holiday then use the default holiday color | 594 | // if it is a holiday then use the default holiday color |
557 | if (!mHolidays[i].isNull()) { | 595 | if (!mHolidays[i].isNull()) { |
558 | if (actcol == mDefaultTextColor) { | 596 | if (actcol == mDefaultTextColor) { |
559 | p.setPen(KOPrefs::instance()->mHolidayColor); | 597 | p.setPen(KOPrefs::instance()->mHolidayColor); |
560 | } else { | 598 | } else { |
561 | p.setPen(mHolidayColorShaded); | 599 | p.setPen(mHolidayColorShaded); |
562 | } | 600 | } |
563 | } | 601 | } |
564 | 602 | ||
565 | // draw selected days with special color | 603 | // draw selected days with special color |
566 | // DO NOT specially highlight holidays in selection ! | 604 | // DO NOT specially highlight holidays in selection ! |
567 | if (i >= mSelStart && i <= mSelEnd) { | 605 | if (i >= mSelStart && i <= mSelEnd) { |
568 | p.setPen(mSelectedDaysColor); | 606 | p.setPen(mSelectedDaysColor); |
569 | } | 607 | } |
570 | 608 | ||
571 | p.drawText(col*dwidth, row*dheight, dwidth, dheight, | 609 | p.drawText(col*dwidth, row*dheight, dwidth, dheight, |
572 | Qt::AlignHCenter | Qt::AlignVCenter, daylbls[i]); | 610 | Qt::AlignHCenter | Qt::AlignVCenter, daylbls[i]); |
573 | 611 | ||
574 | // reset color to actual color | 612 | // reset color to actual color |
575 | if (!mHolidays[i].isNull()) { | 613 | if (!mHolidays[i].isNull()) { |
576 | p.setPen(actcol); | 614 | p.setPen(actcol); |
577 | } | 615 | } |
578 | // reset bold font to plain font | 616 | // reset bold font to plain font |
579 | if (events[i] > 0) { | 617 | if (events[i] > 0) { |
580 | QFont myFont = font(); | 618 | QFont myFont = font(); |
581 | myFont.setBold(false); | 619 | myFont.setBold(false); |
582 | p.setFont(myFont); | 620 | p.setFont(myFont); |
583 | } | 621 | } |
584 | } | 622 | } |
585 | } | 623 | } |
586 | 624 | ||
587 | // ---------------------------------------------------------------------------- | 625 | // ---------------------------------------------------------------------------- |
588 | // R E SI Z E E V E N T H A N D L I N G | 626 | // R E SI Z E E V E N T H A N D L I N G |
589 | // ---------------------------------------------------------------------------- | 627 | // ---------------------------------------------------------------------------- |
590 | 628 | ||
591 | void KODayMatrix::resizeEvent(QResizeEvent *) | 629 | void KODayMatrix::resizeEvent(QResizeEvent *) |
592 | { | 630 | { |
593 | QRect sz = frameRect(); | 631 | QRect sz = frameRect(); |
594 | daysize.setHeight(sz.height()*7 / NUMDAYS); | 632 | daysize.setHeight(sz.height()*7 / NUMDAYS); |
595 | daysize.setWidth(sz.width() / 7); | 633 | daysize.setWidth(sz.width() / 7); |
596 | } | 634 | } |
diff --git a/korganizer/kodaymatrix.h b/korganizer/kodaymatrix.h index b4eb2a8..0e9640a 100644 --- a/korganizer/kodaymatrix.h +++ b/korganizer/kodaymatrix.h | |||
@@ -1,308 +1,313 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Eitzenberger Thomas <thomas.eitzenberger@siemens.at> | 3 | Copyright (c) 2001 Eitzenberger Thomas <thomas.eitzenberger@siemens.at> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | #ifndef _KODAYMAT_H | 23 | #ifndef _KODAYMAT_H |
24 | #define _KODAYMAT_H | 24 | #define _KODAYMAT_H |
25 | 25 | ||
26 | #include <libkcal/calendar.h> | 26 | #include <libkcal/calendar.h> |
27 | 27 | ||
28 | #include <qstring.h> | 28 | #include <qstring.h> |
29 | #include <qframe.h> | 29 | #include <qframe.h> |
30 | #include <qcolor.h> | 30 | #include <qcolor.h> |
31 | #include <qpen.h> | 31 | #include <qpen.h> |
32 | #include <qdatetime.h> | 32 | #include <qdatetime.h> |
33 | #include <qtooltip.h> | 33 | #include <qtooltip.h> |
34 | 34 | ||
35 | #include <qmap.h> | 35 | #include <qmap.h> |
36 | 36 | ||
37 | class QDragEnterEvent; | 37 | class QDragEnterEvent; |
38 | class QDragMoveEvent; | 38 | class QDragMoveEvent; |
39 | class QDragLeaveEvent; | 39 | class QDragLeaveEvent; |
40 | class QDropEvent; | 40 | class QDropEvent; |
41 | 41 | ||
42 | class KODayMatrix; | 42 | class KODayMatrix; |
43 | 43 | ||
44 | using namespace KCal; | 44 | using namespace KCal; |
45 | 45 | ||
46 | 46 | ||
47 | /** | 47 | /** |
48 | * small helper class to dynamically show tooltips inside the day matrix. | 48 | * small helper class to dynamically show tooltips inside the day matrix. |
49 | * This class asks the day matrix object for a appropriate label which | 49 | * This class asks the day matrix object for a appropriate label which |
50 | * is in our special case the name of the holiday or null if this day is no holiday. | 50 | * is in our special case the name of the holiday or null if this day is no holiday. |
51 | */ | 51 | */ |
52 | class DynamicTip : public QToolTip | 52 | class DynamicTip : public QToolTip |
53 | { | 53 | { |
54 | public: | 54 | public: |
55 | 55 | ||
56 | /** | 56 | /** |
57 | * Constructor that expects a KODayMatrix object as parent. | 57 | * Constructor that expects a KODayMatrix object as parent. |
58 | * | 58 | * |
59 | * @param parent the parent KODayMatrix control. | 59 | * @param parent the parent KODayMatrix control. |
60 | */ | 60 | */ |
61 | DynamicTip(QWidget* parent ); | 61 | DynamicTip(QWidget* parent ); |
62 | 62 | ||
63 | protected: | 63 | protected: |
64 | 64 | ||
65 | /** | 65 | /** |
66 | * Qt's callback to ask the object to provide an approrpiate text for the | 66 | * Qt's callback to ask the object to provide an approrpiate text for the |
67 | * tooltip to be shown. | 67 | * tooltip to be shown. |
68 | * | 68 | * |
69 | * @param pos coordinates of the mouse. | 69 | * @param pos coordinates of the mouse. |
70 | */ | 70 | */ |
71 | void maybeTip( const QPoint & pos); | 71 | void maybeTip( const QPoint & pos); |
72 | 72 | ||
73 | private: | 73 | private: |
74 | 74 | ||
75 | /** the parent control this tooltip is designed for. */ | 75 | /** the parent control this tooltip is designed for. */ |
76 | KODayMatrix* matrix; | 76 | KODayMatrix* matrix; |
77 | }; | 77 | }; |
78 | 78 | ||
79 | /** | 79 | /** |
80 | * replacement for kdpdatebuton.cpp that used 42 widgets for the day matrix to be displayed. | 80 | * replacement for kdpdatebuton.cpp that used 42 widgets for the day matrix to be displayed. |
81 | * Cornelius thought this was a waste of memory and a lot of overhead. | 81 | * Cornelius thought this was a waste of memory and a lot of overhead. |
82 | * In addition the selection was not very intuitive so I decided to rewrite it using a QFrame | 82 | * In addition the selection was not very intuitive so I decided to rewrite it using a QFrame |
83 | * that draws the labels and allows for dragging selection while maintaining nearly full | 83 | * that draws the labels and allows for dragging selection while maintaining nearly full |
84 | * compatibility in behaviour with its predecessor. | 84 | * compatibility in behaviour with its predecessor. |
85 | * | 85 | * |
86 | * The following functionality has been changed: | 86 | * The following functionality has been changed: |
87 | * | 87 | * |
88 | * o when shifting events in the agenda view from one day to another the day matrix is updated now | 88 | * o when shifting events in the agenda view from one day to another the day matrix is updated now |
89 | * o TODO ET dragging an event to the matrix will MOVE not COPY the event to the new date. | 89 | * o TODO ET dragging an event to the matrix will MOVE not COPY the event to the new date. |
90 | * o no support for Ctrl+click to create groups of dates | 90 | * o no support for Ctrl+click to create groups of dates |
91 | * (This has not really been supported in the predecessor. It was not very intuitive nor was it | 91 | * (This has not really been supported in the predecessor. It was not very intuitive nor was it |
92 | * user friendly.) | 92 | * user friendly.) |
93 | * This feature has been replaced with dragging a selection on the matrix. The matrix will | 93 | * This feature has been replaced with dragging a selection on the matrix. The matrix will |
94 | * automatically choose the appropriate selection (e.g. you are not any longer able to select | 94 | * automatically choose the appropriate selection (e.g. you are not any longer able to select |
95 | * two distinct groups of date selections as in the old class) | 95 | * two distinct groups of date selections as in the old class) |
96 | * o now that you can select more then a week it can happen that not all selected days are | 96 | * o now that you can select more then a week it can happen that not all selected days are |
97 | * displayed in the matrix. However this is preferred to the alternative which would mean to | 97 | * displayed in the matrix. However this is preferred to the alternative which would mean to |
98 | * adjust the selection and leave some days undisplayed while scrolling through the months | 98 | * adjust the selection and leave some days undisplayed while scrolling through the months |
99 | * | 99 | * |
100 | * @short day matrix widget of the KDateNavigator | 100 | * @short day matrix widget of the KDateNavigator |
101 | * | 101 | * |
102 | * @author Eitzenberger Thomas | 102 | * @author Eitzenberger Thomas |
103 | */ | 103 | */ |
104 | class KODayMatrix: public QFrame { | 104 | class KODayMatrix: public QFrame { |
105 | 105 | ||
106 | Q_OBJECT | 106 | Q_OBJECT |
107 | 107 | ||
108 | public: | 108 | public: |
109 | 109 | ||
110 | /** constructor to create a day matrix widget. | 110 | /** constructor to create a day matrix widget. |
111 | * | 111 | * |
112 | * @param parent widget that is the parent of the day matrix. Normally this should | 112 | * @param parent widget that is the parent of the day matrix. Normally this should |
113 | * be a KDateNavigator | 113 | * be a KDateNavigator |
114 | * @param calendar instance of a calendar on which all calculations are based | 114 | * @param calendar instance of a calendar on which all calculations are based |
115 | * @param date start date of the matrix (is expected to be already fixed). It is | 115 | * @param date start date of the matrix (is expected to be already fixed). It is |
116 | * assumed that this date is the first week day to be shown in the matrix. | 116 | * assumed that this date is the first week day to be shown in the matrix. |
117 | * @param name name of the widget | 117 | * @param name name of the widget |
118 | */ | 118 | */ |
119 | KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name ); | 119 | KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name ); |
120 | 120 | ||
121 | /** destructor that deallocates all dynamically allocated private members. | 121 | /** destructor that deallocates all dynamically allocated private members. |
122 | */ | 122 | */ |
123 | ~KODayMatrix(); | 123 | ~KODayMatrix(); |
124 | 124 | ||
125 | /** updates the day matrix to start with the given date. Does all the necessary | 125 | /** updates the day matrix to start with the given date. Does all the necessary |
126 | * checks for holidays or events on a day and stores them for display later on. | 126 | * checks for holidays or events on a day and stores them for display later on. |
127 | * Does NOT update the view visually. Call repaint() for this. | 127 | * Does NOT update the view visually. Call repaint() for this. |
128 | * | 128 | * |
129 | * @param actdate recalculates the day matrix to show NUMDAYS starting from this | 129 | * @param actdate recalculates the day matrix to show NUMDAYS starting from this |
130 | * date. | 130 | * date. |
131 | */ | 131 | */ |
132 | void updateView(QDate actdate); | 132 | void updateView(QDate actdate); |
133 | 133 | ||
134 | /** returns the QDate object associated with day indexed by the | 134 | /** returns the QDate object associated with day indexed by the |
135 | * supplied offset. | 135 | * supplied offset. |
136 | */ | 136 | */ |
137 | const QDate& getDate(int offset); | 137 | const QDate& getDate(int offset); |
138 | 138 | ||
139 | /** returns the official name of this holy day or 0 if there is no label | 139 | /** returns the official name of this holy day or 0 if there is no label |
140 | * for this day. | 140 | * for this day. |
141 | */ | 141 | */ |
142 | QString getHolidayLabel(int offset); | 142 | QString getHolidayLabel(int offset); |
143 | 143 | ||
144 | /** adds all actual selected days from mSelStart to mSelEnd to the supplied | 144 | /** adds all actual selected days from mSelStart to mSelEnd to the supplied |
145 | * DateList. | 145 | * DateList. |
146 | */ | 146 | */ |
147 | void addSelectedDaysTo(DateList&); | 147 | void addSelectedDaysTo(DateList&); |
148 | 148 | ||
149 | /** sets the actual to be displayed selection in the day matrix starting from | 149 | /** sets the actual to be displayed selection in the day matrix starting from |
150 | * start and ending with end. Theview must be manually updated by calling | 150 | * start and ending with end. Theview must be manually updated by calling |
151 | * repaint. (?) | 151 | * repaint. (?) |
152 | */ | 152 | */ |
153 | void setSelectedDaysFrom(const QDate& start, const QDate& end); | 153 | void setSelectedDaysFrom(const QDate& start, const QDate& end); |
154 | 154 | ||
155 | 155 | ||
156 | /** Is today visible in the view? Keep this in sync with | 156 | /** Is today visible in the view? Keep this in sync with |
157 | * the values today (below) can take. | 157 | * the values today (below) can take. |
158 | */ | 158 | */ |
159 | bool isTodayVisible() const { return today>=0; } ; | 159 | bool isTodayVisible() const { return today>=0; } ; |
160 | 160 | ||
161 | /** If today is visible, then we can find out if today is | 161 | /** If today is visible, then we can find out if today is |
162 | * near the beginning or the end of the month. | 162 | * near the beginning or the end of the month. |
163 | * This is dependent on today remaining the index | 163 | * This is dependent on today remaining the index |
164 | * in the array of visible dates and going from | 164 | * in the array of visible dates and going from |
165 | * top left (0) to bottom right (41). | 165 | * top left (0) to bottom right (41). |
166 | */ | 166 | */ |
167 | bool isBeginningOfMonth() const { return today<=8; } ; | 167 | bool isBeginningOfMonth() const { return today<=8; } ; |
168 | bool isEndOfMonth() const { return today>=27; } ; | 168 | bool isEndOfMonth() const { return today>=27; } ; |
169 | 169 | ||
170 | public slots: | 170 | public slots: |
171 | /** Recalculates all the flags of the days in the matrix like holidays or events | 171 | /** Recalculates all the flags of the days in the matrix like holidays or events |
172 | * on a day (Actually calls above method with the actual startdate). | 172 | * on a day (Actually calls above method with the actual startdate). |
173 | */ | 173 | */ |
174 | void updateView(); | 174 | void updateView(); |
175 | void updateViewTimed(); | ||
176 | void repaintViewTimed(); | ||
175 | 177 | ||
176 | /** | 178 | /** |
177 | * Calculate which square in the matrix should be | 179 | * Calculate which square in the matrix should be |
178 | * hilighted to indicate it's today. | 180 | * hilighted to indicate it's today. |
179 | */ | 181 | */ |
180 | void recalculateToday(); | 182 | void recalculateToday(); |
181 | 183 | ||
182 | /* | 184 | /* |
183 | void setStartDate(QDate); | 185 | void setStartDate(QDate); |
184 | */ | 186 | */ |
185 | 187 | ||
186 | signals: | 188 | signals: |
187 | 189 | ||
188 | /** emitted if the user selects a block of days with the mouse by dragging a rectangle | 190 | /** emitted if the user selects a block of days with the mouse by dragging a rectangle |
189 | * inside the matrix | 191 | * inside the matrix |
190 | * | 192 | * |
191 | * @param daylist list of days that have been selected by the user | 193 | * @param daylist list of days that have been selected by the user |
192 | */ | 194 | */ |
193 | void selected( const KCal::DateList &daylist ); | 195 | void selected( const KCal::DateList &daylist ); |
194 | 196 | ||
195 | /** emitted if the user has dropped an event inside the matrix | 197 | /** emitted if the user has dropped an event inside the matrix |
196 | * | 198 | * |
197 | * @param event the dropped calendar event | 199 | * @param event the dropped calendar event |
198 | */ | 200 | */ |
199 | void eventDropped(Event *event); | 201 | void eventDropped(Event *event); |
200 | 202 | ||
201 | protected: | 203 | protected: |
202 | 204 | ||
203 | void paintEvent(QPaintEvent *ev); | 205 | void paintEvent(QPaintEvent *ev); |
204 | 206 | ||
205 | void mousePressEvent (QMouseEvent* e); | 207 | void mousePressEvent (QMouseEvent* e); |
206 | 208 | ||
207 | void mouseReleaseEvent (QMouseEvent* e); | 209 | void mouseReleaseEvent (QMouseEvent* e); |
208 | 210 | ||
209 | void mouseMoveEvent (QMouseEvent* e); | 211 | void mouseMoveEvent (QMouseEvent* e); |
210 | 212 | ||
211 | void dragEnterEvent(QDragEnterEvent *); | 213 | void dragEnterEvent(QDragEnterEvent *); |
212 | 214 | ||
213 | void dragMoveEvent(QDragMoveEvent *); | 215 | void dragMoveEvent(QDragMoveEvent *); |
214 | 216 | ||
215 | void dragLeaveEvent(QDragLeaveEvent *); | 217 | void dragLeaveEvent(QDragLeaveEvent *); |
216 | 218 | ||
217 | void dropEvent(QDropEvent *); | 219 | void dropEvent(QDropEvent *); |
218 | 220 | ||
219 | void resizeEvent(QResizeEvent *); | 221 | void resizeEvent(QResizeEvent *); |
220 | 222 | ||
221 | private: | 223 | private: |
224 | QTimer* mUpdateTimer; | ||
225 | QTimer* mRepaintTimer; | ||
226 | bool mDayChanged; | ||
222 | 227 | ||
223 | /** returns the index of the day located at the matrix's widget (x,y) position. | 228 | /** returns the index of the day located at the matrix's widget (x,y) position. |
224 | * | 229 | * |
225 | * @param x horizontal coordinate | 230 | * @param x horizontal coordinate |
226 | * @param y vertical coordinate | 231 | * @param y vertical coordinate |
227 | */ | 232 | */ |
228 | int getDayIndexFrom(int x, int y); | 233 | int getDayIndexFrom(int x, int y); |
229 | 234 | ||
230 | /** calculates a "shaded" color from the supplied color object. | 235 | /** calculates a "shaded" color from the supplied color object. |
231 | * (Copied from Cornelius's kdpdatebutton.cpp) | 236 | * (Copied from Cornelius's kdpdatebutton.cpp) |
232 | * | 237 | * |
233 | * @param color source based on which a shaded color should be calculated. | 238 | * @param color source based on which a shaded color should be calculated. |
234 | */ | 239 | */ |
235 | QColor getShadedColor(QColor color); | 240 | QColor getShadedColor(QColor color); |
236 | 241 | ||
237 | /** number of days to be displayed. For now there is no support for any other number then 42. | 242 | /** number of days to be displayed. For now there is no support for any other number then 42. |
238 | so change it at your own risk :o) */ | 243 | so change it at your own risk :o) */ |
239 | static const int NUMDAYS; | 244 | static const int NUMDAYS; |
240 | 245 | ||
241 | /** calendar instance to be queried for holidays, events, ... */ | 246 | /** calendar instance to be queried for holidays, events, ... */ |
242 | Calendar *mCalendar; | 247 | Calendar *mCalendar; |
243 | 248 | ||
244 | /** starting date of the matrix */ | 249 | /** starting date of the matrix */ |
245 | QDate startdate; | 250 | QDate startdate; |
246 | 251 | ||
247 | /** array of day labels to optimeize drawing performance. */ | 252 | /** array of day labels to optimeize drawing performance. */ |
248 | QString *daylbls; | 253 | QString *daylbls; |
249 | 254 | ||
250 | /** array of days displayed to reduce memory consumption by | 255 | /** array of days displayed to reduce memory consumption by |
251 | subsequently calling QDate::addDays(). */ | 256 | subsequently calling QDate::addDays(). */ |
252 | QDate *days; | 257 | QDate *days; |
253 | 258 | ||
254 | /** array of storing the number of events on a given day. | 259 | /** array of storing the number of events on a given day. |
255 | * used for drawing a bold font if there is at least one event on that day. | 260 | * used for drawing a bold font if there is at least one event on that day. |
256 | */ | 261 | */ |
257 | int *events; | 262 | int *events; |
258 | 263 | ||
259 | /** stores holiday names of the days shown in the matrix. */ | 264 | /** stores holiday names of the days shown in the matrix. */ |
260 | QMap<int,QString> mHolidays; | 265 | QMap<int,QString> mHolidays; |
261 | 266 | ||
262 | /** indey of today or -1 if today is not visible in the matrix. */ | 267 | /** indey of today or -1 if today is not visible in the matrix. */ |
263 | int today; | 268 | int today; |
264 | 269 | ||
265 | /** index of day where dragged selection was initiated. | 270 | /** index of day where dragged selection was initiated. |
266 | used to detect "negative" timely selections */ | 271 | used to detect "negative" timely selections */ |
267 | int mSelInit; | 272 | int mSelInit; |
268 | 273 | ||
269 | /** if mSelStart has this value it indicates that there is no | 274 | /** if mSelStart has this value it indicates that there is no |
270 | actual selection in the matrix. */ | 275 | actual selection in the matrix. */ |
271 | static const int NOSELECTION; | 276 | static const int NOSELECTION; |
272 | 277 | ||
273 | /** index of first selected day. */ | 278 | /** index of first selected day. */ |
274 | int mSelStart; | 279 | int mSelStart; |
275 | 280 | ||
276 | /** index of last selected day. */ | 281 | /** index of last selected day. */ |
277 | int mSelEnd; | 282 | int mSelEnd; |
278 | 283 | ||
279 | /** dynamic tooltip to handle mouse dependent tips for each day in the matrix. */ | 284 | /** dynamic tooltip to handle mouse dependent tips for each day in the matrix. */ |
280 | DynamicTip* mToolTip; | 285 | DynamicTip* mToolTip; |
281 | 286 | ||
282 | 287 | ||
283 | /** default background colour of the matrix. */ | 288 | /** default background colour of the matrix. */ |
284 | QColor mDefaultBackColor; | 289 | QColor mDefaultBackColor; |
285 | 290 | ||
286 | /** default text color of the matrix. */ | 291 | /** default text color of the matrix. */ |
287 | QColor mDefaultTextColor; | 292 | QColor mDefaultTextColor; |
288 | 293 | ||
289 | /** default text color for days not in the actual month. */ | 294 | /** default text color for days not in the actual month. */ |
290 | QColor mDefaultTextColorShaded; | 295 | QColor mDefaultTextColorShaded; |
291 | 296 | ||
292 | /** default text color for holidays not in the actual month. */ | 297 | /** default text color for holidays not in the actual month. */ |
293 | QColor mHolidayColorShaded; | 298 | QColor mHolidayColorShaded; |
294 | 299 | ||
295 | /** text color for selected days. */ | 300 | /** text color for selected days. */ |
296 | QColor mSelectedDaysColor; | 301 | QColor mSelectedDaysColor; |
297 | 302 | ||
298 | /** default width of the frame drawn around today if it is visible in the matrix. */ | 303 | /** default width of the frame drawn around today if it is visible in the matrix. */ |
299 | int mTodayMarginWidth; | 304 | int mTodayMarginWidth; |
300 | 305 | ||
301 | /** stores actual size of each day in the widget so that I dont need to ask this data | 306 | /** stores actual size of each day in the widget so that I dont need to ask this data |
302 | * on every repaint. | 307 | * on every repaint. |
303 | */ | 308 | */ |
304 | QRect daysize; | 309 | QRect daysize; |
305 | 310 | ||
306 | }; | 311 | }; |
307 | 312 | ||
308 | #endif | 313 | #endif |