author | zautrix <zautrix> | 2005-01-31 23:43:35 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-31 23:43:35 (UTC) |
commit | fce3fd8accec495a2deda6fe3cd55375fac46432 (patch) (unidiff) | |
tree | 24231254fa729b1b546f0475759fcba24455e1f5 | |
parent | 336678d691a8c3346c92a4e561ac7938ed532003 (diff) | |
download | kdepimpi-fce3fd8accec495a2deda6fe3cd55375fac46432.zip kdepimpi-fce3fd8accec495a2deda6fe3cd55375fac46432.tar.gz kdepimpi-fce3fd8accec495a2deda6fe3cd55375fac46432.tar.bz2 |
mf
-rw-r--r-- | bin/kdepim/WhatsNew.txt | 7 | ||||
-rw-r--r-- | korganizer/kodaymatrix.cpp | 170 | ||||
-rw-r--r-- | korganizer/kodaymatrix.h | 2 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 6 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 17 | ||||
-rw-r--r-- | korganizer/kotodoview.h | 4 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 1 |
7 files changed, 116 insertions, 91 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index 178f92d..2858d9c 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt | |||
@@ -1,852 +1,859 @@ | |||
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 | KO/Pi: | ||
12 | Added a popup menu ( press pen and hold to get popup ) to the agenda view | 13 | Added a popup menu ( press pen and hold to get popup ) to the agenda view |
13 | with many useful items (add event/todo, show next week, two weeks, month, journal). | 14 | with many useful items (add event/todo, show next week, two weeks, month, journal). |
14 | 15 | ||
15 | Added items to the todolist popup menu for: | 16 | Added items to the todolist popup menu for: |
16 | Display all opened, all closed or all todos flat. | 17 | 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. | 18 | 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 | Made the reparenting of todos on the desktop possible via Drag&Drop. |
19 | Fixed several bugs in setting the completed datetime for todos. | 20 | Fixed several bugs in setting the completed datetime for todos. |
20 | Added info about completed datetime of todos to the todo viewer. | 21 | 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 | 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 | 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 | when what todo was completed. |
24 | Fixed behaviour of automatic setting completion of todos with sub-todos/parent todos. | 25 | Fixed behaviour of automatic setting completion of todos with sub-todos/parent todos. |
25 | Now the behaviour is: | 26 | Now the behaviour is: |
26 | Setting a parent to complete sets all (sub)childs to complete. | 27 | 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 parent to uncomplete does not change the childs. |
28 | Setting a child to uncomplete sets all parent to uncomplete. | 29 | Setting a child to uncomplete sets all parent to uncomplete. |
29 | Setting a child to complete does not change the parents. | 30 | Setting a child to complete does not change the parents. |
30 | 31 | ||
32 | Smart updating and double buffering of the daymatrix. | ||
33 | Showing holidays in the day matrix. | ||
34 | Many other small performance updates. | ||
35 | |||
36 | Made day labels in agenda clickable. By clicking a label, the day is displayed in single day mode. | ||
37 | |||
31 | Now the translation file usertranslation.txt is supposed to be in utf8 format. | 38 | Now the translation file usertranslation.txt is supposed to be in utf8 format. |
32 | If you want to translate a language from western europe, just change the germantranslation.txt file. Please read the updated Usertranslation HowTo in KO/Pi Help menu. | 39 | If you want to translate a language from western europe, just change the germantranslation.txt file. Please read the updated Usertranslation HowTo in KO/Pi Help menu. |
33 | 40 | ||
34 | 41 | ||
35 | ********** VERSION 2.0.0 ************ | 42 | ********** VERSION 2.0.0 ************ |
36 | 43 | ||
37 | Stable release 2.0.0! | 44 | Stable release 2.0.0! |
38 | 45 | ||
39 | KO/Pi: | 46 | KO/Pi: |
40 | Fixed problem in edit dialog recreation at startup. | 47 | Fixed problem in edit dialog recreation at startup. |
41 | Made "toggle view*" menu items enabled context sensitive. | 48 | Made "toggle view*" menu items enabled context sensitive. |
42 | Changed agenda size menu to items 1-10. | 49 | Changed agenda size menu to items 1-10. |
43 | Made it possible to change agenda size quickly by pressing mouse on timelabels in agenda view and move mouse up/down. | 50 | Made it possible to change agenda size quickly by pressing mouse on timelabels in agenda view and move mouse up/down. |
44 | Usebility enhancements in the KO/Pi menus. | 51 | Usebility enhancements in the KO/Pi menus. |
45 | Birthday import now adds year to summary. | 52 | Birthday import now adds year to summary. |
46 | What's Next view shows age in years for birthday. | 53 | What's Next view shows age in years for birthday. |
47 | 54 | ||
48 | OM/Pi: | 55 | OM/Pi: |
49 | Added three info lines to display subject, from and to of selected mails. | 56 | Added three info lines to display subject, from and to of selected mails. |
50 | 57 | ||
51 | KA/Pi: | 58 | KA/Pi: |
52 | Fixed jump bar behaviour on Zaurus. | 59 | Fixed jump bar behaviour on Zaurus. |
53 | Now KA/Pi search field supports searching for a range of starting characters. | 60 | Now KA/Pi search field supports searching for a range of starting characters. |
54 | E.g. to search for all contact beginning with b to n, type | 61 | E.g. to search for all contact beginning with b to n, type |
55 | b-n | 62 | b-n |
56 | in the search field. | 63 | in the search field. |
57 | 64 | ||
58 | ********** VERSION 1.9.20 ************ | 65 | ********** VERSION 1.9.20 ************ |
59 | 66 | ||
60 | KO/Pi: | 67 | KO/Pi: |
61 | Added for the "dislplay one day" agenda mode | 68 | Added for the "dislplay one day" agenda mode |
62 | info in the caption and in the day lables: | 69 | info in the caption and in the day lables: |
63 | Now it is displayed, if the selected day is from "day before yesterday" | 70 | Now it is displayed, if the selected day is from "day before yesterday" |
64 | to "day after tomorrow". | 71 | to "day after tomorrow". |
65 | Made it possible to delete a Todo, which has sub-todos. | 72 | Made it possible to delete a Todo, which has sub-todos. |
66 | Fixed two small problems in the todo view. | 73 | Fixed two small problems in the todo view. |
67 | Added missing German translation for filter edit and print dialog. | 74 | Added missing German translation for filter edit and print dialog. |
68 | Made search dialog closeable by cancel key. | 75 | Made search dialog closeable by cancel key. |
69 | 76 | ||
70 | Made it possible to select in the date picker the (ligt grey ) | 77 | Made it possible to select in the date picker the (ligt grey ) |
71 | dates of the prev./next month with the mouse. | 78 | dates of the prev./next month with the mouse. |
72 | 79 | ||
73 | OM/Pi: | 80 | OM/Pi: |
74 | "Delete mail" icon in main window now deletes all selected mails. | 81 | "Delete mail" icon in main window now deletes all selected mails. |
75 | Fixed the problem, that the state flag of imap mails was ignored. | 82 | Fixed the problem, that the state flag of imap mails was ignored. |
76 | Now mails with "FLAG_SEEN" on the imap server get no icon in the list view | 83 | Now mails with "FLAG_SEEN" on the imap server get no icon in the list view |
77 | to indecate that they are already seen. | 84 | to indecate that they are already seen. |
78 | Fixed the problem that the body of some mails was not displayed in the | 85 | Fixed the problem that the body of some mails was not displayed in the |
79 | mail viewer when fetching them from the imap server directly to read them. | 86 | mail viewer when fetching them from the imap server directly to read them. |
80 | Made it (configurable) possible to show the "To:" field in the list view. | 87 | Made it (configurable) possible to show the "To:" field in the list view. |
81 | Added to the mail viewer the option "View Source" to make it possible to see the raw mail data. | 88 | Added to the mail viewer the option "View Source" to make it possible to see the raw mail data. |
82 | Added a "Download Mail" button to the mail viewer to quickly download the viewed mail to the | 89 | Added a "Download Mail" button to the mail viewer to quickly download the viewed mail to the |
83 | local storage folder (specified in account settings) of the account of the mail. | 90 | local storage folder (specified in account settings) of the account of the mail. |
84 | Removed some memory leaks in OM/Pi. | 91 | Removed some memory leaks in OM/Pi. |
85 | 92 | ||
86 | 93 | ||
87 | ********** VERSION 1.9.19 ************ | 94 | ********** VERSION 1.9.19 ************ |
88 | 95 | ||
89 | Added a lot of missing translations to KA/Pi, | 96 | Added a lot of missing translations to KA/Pi, |
90 | Added some missing translations to KO/Pi and OM/Pi. | 97 | Added some missing translations to KO/Pi and OM/Pi. |
91 | 98 | ||
92 | Fixed some minor problems in KA/Pi + KO/Pi. | 99 | Fixed some minor problems in KA/Pi + KO/Pi. |
93 | 100 | ||
94 | Fixed a crash when closing PwM/Pi. | 101 | Fixed a crash when closing PwM/Pi. |
95 | Added German translation for PwM/Pi. | 102 | Added German translation for PwM/Pi. |
96 | 103 | ||
97 | Made view change and Month View update faster in KO/Pi. | 104 | Made view change and Month View update faster in KO/Pi. |
98 | 105 | ||
99 | 106 | ||
100 | ********** VERSION 1.9.18 ************ | 107 | ********** VERSION 1.9.18 ************ |
101 | 108 | ||
102 | FYI: The VERSION 1.9.17 was a testing release only. | 109 | FYI: The VERSION 1.9.17 was a testing release only. |
103 | Please read the changelog of VERSION 1.9.17 as well. | 110 | Please read the changelog of VERSION 1.9.17 as well. |
104 | 111 | ||
105 | Cleaned up the syncing config dialog. | 112 | Cleaned up the syncing config dialog. |
106 | Added sync config options for date range for events. | 113 | Added sync config options for date range for events. |
107 | Added sync config options for filters on incoming data. | 114 | Added sync config options for filters on incoming data. |
108 | Added sync config options for filters on outgoing data. | 115 | Added sync config options for filters on outgoing data. |
109 | Please read the updated SyncHowTo about the new filter settings. | 116 | Please read the updated SyncHowTo about the new filter settings. |
110 | These filter settings make it now possible to sync with shared | 117 | These filter settings make it now possible to sync with shared |
111 | calendars without writing back private or confidential data | 118 | calendars without writing back private or confidential data |
112 | (via the outgoing filters). | 119 | (via the outgoing filters). |
113 | To sync only with particular parts of a shared calendar, | 120 | To sync only with particular parts of a shared calendar, |
114 | the incoming filter settings can be used. | 121 | the incoming filter settings can be used. |
115 | An example can be found in the SyncHowTo. | 122 | An example can be found in the SyncHowTo. |
116 | Same for shared addressbooks. | 123 | Same for shared addressbooks. |
117 | 124 | ||
118 | Added a setting for the global kdepim data storage. | 125 | Added a setting for the global kdepim data storage. |
119 | Usually the data is stored in (yourhomedir/kdepim). | 126 | Usually the data is stored in (yourhomedir/kdepim). |
120 | Now you can set in the Global config dialog TAB, subTAB "Data storage path" | 127 | Now you can set in the Global config dialog TAB, subTAB "Data storage path" |
121 | a directory where all the kdepim data is stored. | 128 | a directory where all the kdepim data is stored. |
122 | That makes it easy to save all kdepim data on a SD card on the Z, for example. | 129 | That makes it easy to save all kdepim data on a SD card on the Z, for example. |
123 | 130 | ||
124 | KO/Pi: | 131 | KO/Pi: |
125 | The timeedit input has a pulldown list for times. | 132 | The timeedit input has a pulldown list for times. |
126 | If opened, this pulldown list should now has the right time highlighted. | 133 | If opened, this pulldown list should now has the right time highlighted. |
127 | Added the possibility to exclude events/todos/journals in a filter. | 134 | Added the possibility to exclude events/todos/journals in a filter. |
128 | You should exclude journals, if you do not want them to sync with a public calendar. | 135 | You should exclude journals, if you do not want them to sync with a public calendar. |
129 | 136 | ||
130 | KA/Pi: | 137 | KA/Pi: |
131 | Added the possibility to in/exclude public/private/confidential contacts to a filter. | 138 | Added the possibility to in/exclude public/private/confidential contacts to a filter. |
132 | 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 ... | 139 | 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 ... |
133 | Added printing of card view and details view on desktop. | 140 | Added printing of card view and details view on desktop. |
134 | Printing of list view is not working... | 141 | Printing of list view is not working... |
135 | Added button for removing pictures in contact editor. | 142 | Added button for removing pictures in contact editor. |
136 | Parsing data fix of KA/Pi version 1.9.17. | 143 | Parsing data fix of KA/Pi version 1.9.17. |
137 | Fixed the "parse name automatically" problem of KA/Pi version 1.9.17. | 144 | Fixed the "parse name automatically" problem of KA/Pi version 1.9.17. |
138 | Fixed some syncing merging problems. | 145 | Fixed some syncing merging problems. |
139 | 146 | ||
140 | 147 | ||
141 | ********** VERSION 1.9.17 ************ | 148 | ********** VERSION 1.9.17 ************ |
142 | 149 | ||
143 | KO/Pi: | 150 | KO/Pi: |
144 | Fixed that tooltips were not updated after moving an item in agenda view. | 151 | Fixed that tooltips were not updated after moving an item in agenda view. |
145 | Fixed a bug in sorting start date for recurring events in list view. | 152 | Fixed a bug in sorting start date for recurring events in list view. |
146 | Changed the left button in todo viewer from "Agenda" to "Set completed". | 153 | Changed the left button in todo viewer from "Agenda" to "Set completed". |
147 | 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. | 154 | 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. |
148 | Added more info in the todo viewer: Startdate, parent/sub todos. | 155 | Added more info in the todo viewer: Startdate, parent/sub todos. |
149 | 156 | ||
150 | 157 | ||
151 | KA/Pi: | 158 | KA/Pi: |
152 | All fields search does now actually search all the (possible) fields, | 159 | All fields search does now actually search all the (possible) fields, |
153 | not only those listed in the contact list. | 160 | not only those listed in the contact list. |
154 | Made is possible to inline a picture in a vcard on the Z. | 161 | Made is possible to inline a picture in a vcard on the Z. |
155 | This was only possible on the desktop, now is it possible on the Z as well. | 162 | This was only possible on the desktop, now is it possible on the Z as well. |
156 | Fixed of missing save settings after filter configuration. | 163 | Fixed of missing save settings after filter configuration. |
157 | Made saving of addressbook much faster. | 164 | Made saving of addressbook much faster. |
158 | Fixed extension widget layout problem. | 165 | Fixed extension widget layout problem. |
159 | Fixed saving of default formatted name settings. | 166 | Fixed saving of default formatted name settings. |
160 | Fixed formatted name handling in edit dialog. | 167 | Fixed formatted name handling in edit dialog. |
161 | Added an option for changing formatted names of many contacts | 168 | Added an option for changing formatted names of many contacts |
162 | (menu: File - Change - Set formatted name). | 169 | (menu: File - Change - Set formatted name). |
163 | 170 | ||
164 | QWhatsThis was not working on the Z ( only black rectangle was shown). | 171 | QWhatsThis was not working on the Z ( only black rectangle was shown). |
165 | This is Fixed. | 172 | This is Fixed. |
166 | 173 | ||
167 | KDE-Sync: | 174 | KDE-Sync: |
168 | Now readonly KDE resources are synced as well. | 175 | Now readonly KDE resources are synced as well. |
169 | (They are not changed in KDE itself, of course). | 176 | (They are not changed in KDE itself, of course). |
170 | 177 | ||
171 | 178 | ||
172 | 179 | ||
173 | ********** VERSION 1.9.16 ************ | 180 | ********** VERSION 1.9.16 ************ |
174 | 181 | ||
175 | KO/Pi: | 182 | KO/Pi: |
176 | Fixed search dialog size on Z 6000 (480x640 display). | 183 | Fixed search dialog size on Z 6000 (480x640 display). |
177 | Added setting to hide/show time in agenda items. | 184 | Added setting to hide/show time in agenda items. |
178 | Added setting to hide not running todos in todo view. | 185 | Added setting to hide not running todos in todo view. |
179 | Added columns for start date/time in todo view. | 186 | Added columns for start date/time in todo view. |
180 | Replaced the solid half-hour lines in agenda view by dot lines. | 187 | Replaced the solid half-hour lines in agenda view by dot lines. |
181 | Added possibility of printing the What's Next View on the desktop | 188 | Added possibility of printing the What's Next View on the desktop |
182 | (i.e. Windows and Linux). | 189 | (i.e. Windows and Linux). |
183 | Fixed a crash in KO/Pi when starting KO/Pi with What's Next view. | 190 | Fixed a crash in KO/Pi when starting KO/Pi with What's Next view. |
184 | Added tooltips in month view.(Tooltips only available on desktop) | 191 | Added tooltips in month view.(Tooltips only available on desktop) |
185 | 192 | ||
186 | Fixed a strange problem in KO/Pi alarm applet. | 193 | Fixed a strange problem in KO/Pi alarm applet. |
187 | Did not find the actual problem, | 194 | Did not find the actual problem, |
188 | such that now Qtopia reboots again if deinstalling the alarm applet. | 195 | such that now Qtopia reboots again if deinstalling the alarm applet. |
189 | But the alarm applet should work again. | 196 | But the alarm applet should work again. |
190 | 197 | ||
191 | KA/Pi: | 198 | KA/Pi: |
192 | Fixed the problem, that internal pictures were not saved. | 199 | Fixed the problem, that internal pictures were not saved. |
193 | 200 | ||
194 | Fixed a problem in the pi-sync mode by increasing the timeout for data transfer from 20 seconds to 5 minutes. | 201 | Fixed a problem in the pi-sync mode by increasing the timeout for data transfer from 20 seconds to 5 minutes. |
195 | 202 | ||
196 | Fixed some minor problems. (Like word wrap in help text windows). | 203 | Fixed some minor problems. (Like word wrap in help text windows). |
197 | 204 | ||
198 | Fixed a compiling problem in microkde/kresources. | 205 | Fixed a compiling problem in microkde/kresources. |
199 | 206 | ||
200 | KO/Pi is using zdbat (renamed to db2file) for syncing with Sharp DTM. | 207 | KO/Pi is using zdbat (renamed to db2file) for syncing with Sharp DTM. |
201 | This version now includes zdbat 1.0.0 (old version was zdbat 0.2.9) | 208 | This version now includes zdbat 1.0.0 (old version was zdbat 0.2.9) |
202 | such that now syncing KO/Pi with Sharp DTM should work on the | 209 | such that now syncing KO/Pi with Sharp DTM should work on the |
203 | Zaurus C 3000 model. | 210 | Zaurus C 3000 model. |
204 | 211 | ||
205 | ********** VERSION 1.9.15 ************ | 212 | ********** VERSION 1.9.15 ************ |
206 | 213 | ||
207 | Usebilty enhancements in KO/Pi: | 214 | Usebilty enhancements in KO/Pi: |
208 | When clicking on the date in a month view cell, the day view is shown. | 215 | When clicking on the date in a month view cell, the day view is shown. |
209 | Old behaviour was, that the "new event" dialog popped up. | 216 | Old behaviour was, that the "new event" dialog popped up. |
210 | 217 | ||
211 | Added a one step "undo delete" in KO/Pi (Accessable in the "Action" menu). | 218 | Added a one step "undo delete" in KO/Pi (Accessable in the "Action" menu). |
212 | That means, you can restore the latest | 219 | That means, you can restore the latest |
213 | event/todo/journal you have deleted. | 220 | event/todo/journal you have deleted. |
214 | A journal is deleted, if you clear all the text of the journal. | 221 | A journal is deleted, if you clear all the text of the journal. |
215 | 222 | ||
216 | Fixed the bug of the editor dialogs in KO/Pi of version 1.9.14. | 223 | Fixed the bug of the editor dialogs in KO/Pi of version 1.9.14. |
217 | 224 | ||
218 | KA/Pi starting in 480x640 resolution: | 225 | KA/Pi starting in 480x640 resolution: |
219 | Hide the filter action in toolbar | 226 | Hide the filter action in toolbar |
220 | and added icons for undo/delete/redo in toolbar. | 227 | and added icons for undo/delete/redo in toolbar. |
221 | 228 | ||
222 | Change in OM/Pi ViewMail dialog: | 229 | Change in OM/Pi ViewMail dialog: |
223 | When clicking on the "delete" icon the mail is deleted after confirmation as usual. | 230 | When clicking on the "delete" icon the mail is deleted after confirmation as usual. |
224 | But the edit dialog is not closed as before, now the next mail in the folder is shown automatically (if there is any). | 231 | But the edit dialog is not closed as before, now the next mail in the folder is shown automatically (if there is any). |
225 | 232 | ||
226 | Fixed a crash when deleting mail-accounts in OM/Pi. | 233 | Fixed a crash when deleting mail-accounts in OM/Pi. |
227 | 234 | ||
228 | 235 | ||
229 | ********** VERSION 1.9.14 ************ | 236 | ********** VERSION 1.9.14 ************ |
230 | 237 | ||
231 | Fixed some problems with the dialog sizes when switching | 238 | Fixed some problems with the dialog sizes when switching |
232 | portrait/landscape mode on 640x480 PDA display. | 239 | portrait/landscape mode on 640x480 PDA display. |
233 | 240 | ||
234 | Fixed some other small bugs in KA/Pi KO/Pi and OM/Pi and PwM/Pi. | 241 | Fixed some other small bugs in KA/Pi KO/Pi and OM/Pi and PwM/Pi. |
235 | 242 | ||
236 | Fixed an ugly bug in KOpieMail: | 243 | Fixed an ugly bug in KOpieMail: |
237 | KOpieMail was not able to write files (mails) to MSDOS file system, | 244 | KOpieMail was not able to write files (mails) to MSDOS file system, |
238 | like on an usual preformatted SD card. That should work now. | 245 | like on an usual preformatted SD card. That should work now. |
239 | To save your mail data on the Sd card do the following: | 246 | To save your mail data on the Sd card do the following: |
240 | Create a dir on the SD card: | 247 | Create a dir on the SD card: |
241 | mkdir /mnt/card/localmail | 248 | mkdir /mnt/card/localmail |
242 | Go to your home dir: | 249 | Go to your home dir: |
243 | cd | 250 | cd |
244 | Go to kopiemail data storage dir: | 251 | Go to kopiemail data storage dir: |
245 | cd kdepim/apps/kopiemail | 252 | cd kdepim/apps/kopiemail |
246 | Create a symlink to the SD card: | 253 | Create a symlink to the SD card: |
247 | ls -s /mnt/card/localmail | 254 | ls -s /mnt/card/localmail |
248 | Now KOpieMail will store all mails on the SD card. | 255 | Now KOpieMail will store all mails on the SD card. |
249 | 256 | ||
250 | KO/Pi Monthview: | 257 | KO/Pi Monthview: |
251 | Now "Go to Today" selects the current month from day 1-end, | 258 | Now "Go to Today" selects the current month from day 1-end, |
252 | not the current date + some days. | 259 | not the current date + some days. |
253 | I.e. "Go to Today" shows now always | 260 | I.e. "Go to Today" shows now always |
254 | the current month with first day of month in the first row. | 261 | the current month with first day of month in the first row. |
255 | 262 | ||
256 | Added missing German translation. | 263 | Added missing German translation. |
257 | 264 | ||
258 | Fixed icons of executeable on Wintendo. | 265 | Fixed icons of executeable on Wintendo. |
259 | 266 | ||
260 | Added a "Show next Mail" button to the OM/Pi | 267 | Added a "Show next Mail" button to the OM/Pi |
261 | mail viewer such that the mail below the current mail | 268 | mail viewer such that the mail below the current mail |
262 | in the mail list view of the current folder | 269 | in the mail list view of the current folder |
263 | can be read with a single click. | 270 | can be read with a single click. |
264 | 271 | ||
265 | 272 | ||
266 | ********** VERSION 1.9.13 ************ | 273 | ********** VERSION 1.9.13 ************ |
267 | 274 | ||
268 | Fixed nasty PwM/Pi file reading bug, when | 275 | Fixed nasty PwM/Pi file reading bug, when |
269 | the used hash algo of file is different then the global | 276 | the used hash algo of file is different then the global |
270 | hash algo. | 277 | hash algo. |
271 | 278 | ||
272 | Added KA/Pi support for opie mailit mailapplication. | 279 | Added KA/Pi support for opie mailit mailapplication. |
273 | 280 | ||
274 | Fixed some bugs in OM/Pi. | 281 | Fixed some bugs in OM/Pi. |
275 | Now character conversion tables are available for the Zaurus | 282 | Now character conversion tables are available for the Zaurus |
276 | to make OM/Pi working properly. | 283 | to make OM/Pi working properly. |
277 | To get the character conversion in OM/Pi working, please download | 284 | To get the character conversion in OM/Pi working, please download |
278 | at the sourceforge project site the package | 285 | at the sourceforge project site the package |
279 | sr-character-conversion_SharpROM_arm.ipk.zip | 286 | sr-character-conversion_SharpROM_arm.ipk.zip |
280 | (or oz-character-conversion_OZ-gcc3xx_arm.ipk.zip for OZ roms) | 287 | (or oz-character-conversion_OZ-gcc3xx_arm.ipk.zip for OZ roms) |
281 | from the section "general files for KDE/Pim" | 288 | from the section "general files for KDE/Pim" |
282 | Instructions how to install this package are in a ReadMe in this file. | 289 | Instructions how to install this package are in a ReadMe in this file. |
283 | 290 | ||
284 | 291 | ||
285 | Fixed the orientation change problem in KA/Pi when switching | 292 | Fixed the orientation change problem in KA/Pi when switching |
286 | portrait/landscape mode. | 293 | portrait/landscape mode. |
287 | 294 | ||
288 | French translation available for KA/Pi and OM/Pi. | 295 | French translation available for KA/Pi and OM/Pi. |
289 | 296 | ||
290 | Fixed some problems with categories in KO/Pi in DTM sync. | 297 | Fixed some problems with categories in KO/Pi in DTM sync. |
291 | 298 | ||
292 | Added selection dialog for export to phone in KA/Pi. | 299 | Added selection dialog for export to phone in KA/Pi. |
293 | 300 | ||
294 | If in KO/Pi is an attendee selected to add to a meeting and this | 301 | If in KO/Pi is an attendee selected to add to a meeting and this |
295 | attendee is already in the list of attendees, this person is not added | 302 | attendee is already in the list of attendees, this person is not added |
296 | again. | 303 | again. |
297 | 304 | ||
298 | Some menu cleanup in KA/Pi. | 305 | Some menu cleanup in KA/Pi. |
299 | 306 | ||
300 | ********** VERSION 1.9.12 ************ | 307 | ********** VERSION 1.9.12 ************ |
301 | 308 | ||
302 | Fix for the bug in KO/Pi What's Next view of version 1.9.11. | 309 | Fix for the bug in KO/Pi What's Next view of version 1.9.11. |
303 | 310 | ||
304 | Bugfix: Licence file is now shown again. | 311 | Bugfix: Licence file is now shown again. |
305 | 312 | ||
306 | OM/Pi now supports Unicode (utf8 charset). | 313 | OM/Pi now supports Unicode (utf8 charset). |
307 | Fixed some bugs in OM/Pi. | 314 | Fixed some bugs in OM/Pi. |
308 | 315 | ||
309 | KA/Pi has more German translation. | 316 | KA/Pi has more German translation. |
310 | 317 | ||
311 | 318 | ||
312 | ********** VERSION 1.9.11 ************ | 319 | ********** VERSION 1.9.11 ************ |
313 | 320 | ||
314 | Fixed several problems in PWM/Pi, like | 321 | Fixed several problems in PWM/Pi, like |
315 | asking the user, if unsaved changed are pending | 322 | asking the user, if unsaved changed are pending |
316 | when closing the app. | 323 | when closing the app. |
317 | And PwM/Pi handles now different texts for the | 324 | And PwM/Pi handles now different texts for the |
318 | fields Description, Username, Password, configurable per category. | 325 | fields Description, Username, Password, configurable per category. |
319 | 326 | ||
320 | Fixed a crash in KO/Pi , when importing/loading vcs files | 327 | Fixed a crash in KO/Pi , when importing/loading vcs files |
321 | which have an entry with an attendee with state: | 328 | which have an entry with an attendee with state: |
322 | NEEDS ACTION | 329 | NEEDS ACTION |
323 | 330 | ||
324 | Fixed some problems in the German translation of OM/Pi, | 331 | Fixed some problems in the German translation of OM/Pi, |
325 | which makes some dialogs not fitting on the screen | 332 | which makes some dialogs not fitting on the screen |
326 | of the Z 5500. | 333 | of the Z 5500. |
327 | 334 | ||
328 | Fixed Qtopia crash, when disabling/deinstalling | 335 | Fixed Qtopia crash, when disabling/deinstalling |
329 | KO/Pi alarm applet. | 336 | KO/Pi alarm applet. |
330 | 337 | ||
331 | Implemented direct KDE<->KA/Pi sync for KA/Pi running | 338 | Implemented direct KDE<->KA/Pi sync for KA/Pi running |
332 | on Linux desktop. | 339 | on Linux desktop. |
333 | 340 | ||
334 | Added feature "remove sync info" to sync menu. | 341 | Added feature "remove sync info" to sync menu. |
335 | 342 | ||
336 | Tweaked the KO/Pi What's next view a bit, added | 343 | Tweaked the KO/Pi What's next view a bit, added |
337 | setting to hide events that are done. | 344 | setting to hide events that are done. |
338 | 345 | ||
339 | Disabled "beam receive enabled" on startup to | 346 | Disabled "beam receive enabled" on startup to |
340 | avoid problems if Fastload is enabled. | 347 | avoid problems if Fastload is enabled. |
341 | Please set "beam receive enabled", | 348 | Please set "beam receive enabled", |
342 | if you want to receive data via IR. | 349 | if you want to receive data via IR. |
343 | 350 | ||
344 | Fixed bug in direct KDE<->KO/Pi sync for KO/Pi running | 351 | Fixed bug in direct KDE<->KO/Pi sync for KO/Pi running |
345 | on Linux desktop. | 352 | on Linux desktop. |
346 | 353 | ||
347 | Made in KA/Pi scrolling possible, if details view is selected. | 354 | Made in KA/Pi scrolling possible, if details view is selected. |
348 | (The keyboard focus is set automatically to the search line) | 355 | (The keyboard focus is set automatically to the search line) |
349 | 356 | ||
350 | Fixed a bug in DMT sync, that a new entry in DTM was added | 357 | Fixed a bug in DMT sync, that a new entry in DTM was added |
351 | on every sync to Kx/Pi. | 358 | on every sync to Kx/Pi. |
352 | 359 | ||
353 | Fixed missing writing of KA/Pi categories to DMT entries when syncing. | 360 | Fixed missing writing of KA/Pi categories to DMT entries when syncing. |
354 | 361 | ||
355 | Fixed a bug in DMT sync with todos created in KO/Pi containing | 362 | Fixed a bug in DMT sync with todos created in KO/Pi containing |
356 | non-latin1 characters. | 363 | non-latin1 characters. |
357 | 364 | ||
358 | Rearranged package contents of Sharp-ipks and made all | 365 | Rearranged package contents of Sharp-ipks and made all |
359 | packages installable on SD again. | 366 | packages installable on SD again. |
360 | 367 | ||
361 | Fixed the writing of addressbook data in DTM sync. | 368 | Fixed the writing of addressbook data in DTM sync. |
362 | Empty fields in KA/Pi were not removed. | 369 | Empty fields in KA/Pi were not removed. |
363 | 370 | ||
364 | Added better category handling in KA/Pi: | 371 | Added better category handling in KA/Pi: |
365 | Added item | 372 | Added item |
366 | Edit Categories and | 373 | Edit Categories and |
367 | Manage new categories | 374 | Manage new categories |
368 | to the settings menu. | 375 | to the settings menu. |
369 | Possible to configure a view to display categories. | 376 | Possible to configure a view to display categories. |
370 | 377 | ||
371 | Added detailed "KDE Sync Howto" and "Multi Sync Howto" to Help menu. | 378 | Added detailed "KDE Sync Howto" and "Multi Sync Howto" to Help menu. |
372 | 379 | ||
373 | Fixed displaying of "free" days and time in KO Monthview and Agendaview. | 380 | Fixed displaying of "free" days and time in KO Monthview and Agendaview. |
374 | 381 | ||
375 | ... and many other bugfixes. | 382 | ... and many other bugfixes. |
376 | 383 | ||
377 | ********** VERSION 1.9.10 ************ | 384 | ********** VERSION 1.9.10 ************ |
378 | 385 | ||
379 | Many internal small bugfixes. | 386 | Many internal small bugfixes. |
380 | And fix of the "big" bug in KO/Pi, | 387 | And fix of the "big" bug in KO/Pi, |
381 | that after Syncing the appointments had an offset by several hours. | 388 | that after Syncing the appointments had an offset by several hours. |
382 | That was a problem with the internal timezone setting, | 389 | That was a problem with the internal timezone setting, |
383 | introduced by the changed timezone configuration settings. | 390 | introduced by the changed timezone configuration settings. |
384 | 391 | ||
385 | German translation for OM/Pi is now available. | 392 | German translation for OM/Pi is now available. |
386 | 393 | ||
387 | 394 | ||
388 | ********** VERSION 1.9.9 ************ | 395 | ********** VERSION 1.9.9 ************ |
389 | 396 | ||
390 | KDE-Pim/Pi has a new Member! | 397 | KDE-Pim/Pi has a new Member! |
391 | It is called PWM/Pi (Passwordmanager/platform-independent) | 398 | It is called PWM/Pi (Passwordmanager/platform-independent) |
392 | and it is available for the Zaurus. | 399 | and it is available for the Zaurus. |
393 | It is planned, that it will be available later for Windows. | 400 | It is planned, that it will be available later for Windows. |
394 | (And for Linux, of course). | 401 | (And for Linux, of course). |
395 | It is a port of the Passwordmanager of KDE. | 402 | It is a port of the Passwordmanager of KDE. |
396 | It will need the MicroKDElibs to run. | 403 | It will need the MicroKDElibs to run. |
397 | 404 | ||
398 | Made loading of addressbooks in KA/Pi up to 7 times faster! | 405 | Made loading of addressbooks in KA/Pi up to 7 times faster! |
399 | The bigger your addressbook file, the more starting speed | 406 | The bigger your addressbook file, the more starting speed |
400 | will you gain. (relatively) | 407 | will you gain. (relatively) |
401 | 408 | ||
402 | The Qtopia addressbook connector is now platform independend | 409 | The Qtopia addressbook connector is now platform independend |
403 | as well and should work on any platform for importing/exporting | 410 | as well and should work on any platform for importing/exporting |
404 | Qtopia and Opie XML files. | 411 | Qtopia and Opie XML files. |
405 | 412 | ||
406 | Added a +30min feature to the timezone settings to make | 413 | Added a +30min feature to the timezone settings to make |
407 | KDE-Pim/Pi useable in Australia and other parts on the | 414 | KDE-Pim/Pi useable in Australia and other parts on the |
408 | world with strange timezones ;-) | 415 | world with strange timezones ;-) |
409 | 416 | ||
410 | German "Umlaute" should now be sorted correctly on the Z in KA/Pi. | 417 | German "Umlaute" should now be sorted correctly on the Z in KA/Pi. |
411 | 418 | ||
412 | It is now possible to disable the | 419 | It is now possible to disable the |
413 | "receive data via infrared" feature, such that syncing with | 420 | "receive data via infrared" feature, such that syncing with |
414 | Outlook is now possible again with Kx/Pi runing. | 421 | Outlook is now possible again with Kx/Pi runing. |
415 | Please disable it, before syncing Sharp DTM with Outlook. | 422 | Please disable it, before syncing Sharp DTM with Outlook. |
416 | For your convenience, the "receive data via infrared" feature | 423 | For your convenience, the "receive data via infrared" feature |
417 | is disabled automatically, if you sync Kx/Pi with DTM. | 424 | is disabled automatically, if you sync Kx/Pi with DTM. |
418 | You have to enable it again manually after syncing. | 425 | You have to enable it again manually after syncing. |
419 | Enabling this feature makes it impossible to start the | 426 | Enabling this feature makes it impossible to start the |
420 | Sharp DTM apps. If this feature is enabled, you will only get the | 427 | Sharp DTM apps. If this feature is enabled, you will only get the |
421 | alarm notification from KO/Pi and not from the Sharp calendar. | 428 | alarm notification from KO/Pi and not from the Sharp calendar. |
422 | This is very useful if you sync KO/Pi with Sharp DTM, | 429 | This is very useful if you sync KO/Pi with Sharp DTM, |
423 | because after syncing you usually would get notified about | 430 | because after syncing you usually would get notified about |
424 | an alarm by KO/Pi and the Sharp Calendar. | 431 | an alarm by KO/Pi and the Sharp Calendar. |
425 | 432 | ||
426 | Together with the Linux desktop version of KO/Pi | 433 | Together with the Linux desktop version of KO/Pi |
427 | it is now possible to sync KO/Pi on the Zaurus | 434 | it is now possible to sync KO/Pi on the Zaurus |
428 | with the complete KDE-desktop (3.3 or later) | 435 | with the complete KDE-desktop (3.3 or later) |
429 | calendar data easily. | 436 | calendar data easily. |
430 | That makes it possible to sync the Z with one | 437 | That makes it possible to sync the Z with one |
431 | click of a mouse with the KDE-Desktop. | 438 | click of a mouse with the KDE-Desktop. |
432 | This feature it available for all Zaurus platforms KO/Pi | 439 | This feature it available for all Zaurus platforms KO/Pi |
433 | is running on. | 440 | is running on. |
434 | The only thing needed is a running KO/Pi on Linux and | 441 | The only thing needed is a running KO/Pi on Linux and |
435 | a compiled version of the small | 442 | a compiled version of the small |
436 | KDE-Pim/Pi<->KDE-Desktop access command line program, | 443 | KDE-Pim/Pi<->KDE-Desktop access command line program, |
437 | which is in the KDE-Pim/Pi sources available. | 444 | which is in the KDE-Pim/Pi sources available. |
438 | 445 | ||
439 | The "KDE-desktop" syncing feature for KA/Pi will follow | 446 | The "KDE-desktop" syncing feature for KA/Pi will follow |
440 | in the next releases. | 447 | in the next releases. |
441 | 448 | ||
442 | Fixed the vcard export bug, which had the version 1.9.8. | 449 | Fixed the vcard export bug, which had the version 1.9.8. |
443 | 450 | ||
444 | Added missing GERMAN translation to KO/Pi. | 451 | Added missing GERMAN translation to KO/Pi. |
445 | Hi PsionX, could you add the missing french translation?Thx! | 452 | Hi PsionX, could you add the missing french translation?Thx! |
446 | 453 | ||
447 | Translation files for KA/Pi are available as well. | 454 | Translation files for KA/Pi are available as well. |
448 | GERMAN translation will be available in the next release. | 455 | GERMAN translation will be available in the next release. |
449 | PsionX ( yres, you again ;-) ), could you start translating | 456 | PsionX ( yres, you again ;-) ), could you start translating |
450 | KA/Pi? Thx! | 457 | KA/Pi? Thx! |
451 | 458 | ||
452 | You can download the version 1.9.9 at | 459 | You can download the version 1.9.9 at |
453 | 460 | ||
454 | http://sourceforge.net/project/showfiles.php?group_id=104103&package_id=112604 | 461 | http://sourceforge.net/project/showfiles.php?group_id=104103&package_id=112604 |
455 | 462 | ||
456 | Note: | 463 | Note: |
457 | To run the mail program OM/Pi you need libopenssl. | 464 | To run the mail program OM/Pi you need libopenssl. |
458 | A link to a download loaction is available at | 465 | A link to a download loaction is available at |
459 | ZSI at www.killefiz.de | 466 | ZSI at www.killefiz.de |
460 | 467 | ||
461 | 468 | ||
462 | ********** VERSION 1.9.8 ************ | 469 | ********** VERSION 1.9.8 ************ |
463 | 470 | ||
464 | Fixed character decoding in OM/Pi. | 471 | Fixed character decoding in OM/Pi. |
465 | (e.g. German "Umlaute" were not displayed properly.) | 472 | (e.g. German "Umlaute" were not displayed properly.) |
466 | 473 | ||
467 | Made is possible to reparent todos in KO/Pi. | 474 | Made is possible to reparent todos in KO/Pi. |
468 | Use contextmenu or keys (look at Help-Keys + Colors) for that. | 475 | Use contextmenu or keys (look at Help-Keys + Colors) for that. |
469 | 476 | ||
470 | Added the missing Sync-Howto and WhatsNew to the packages. | 477 | Added the missing Sync-Howto and WhatsNew to the packages. |
471 | 478 | ||
472 | KO/Pi on Linux desktop can now sync with KDE desktop. | 479 | KO/Pi on Linux desktop can now sync with KDE desktop. |
473 | That means: When using KO/Pi on Linux desktop for syncing with | 480 | That means: When using KO/Pi on Linux desktop for syncing with |
474 | KDE desktop and the Zaurus, the Zaurus can be synced now | 481 | KDE desktop and the Zaurus, the Zaurus can be synced now |
475 | with all KDE-Calendar resources, not only with one local file. | 482 | with all KDE-Calendar resources, not only with one local file. |
476 | (That makes it possible to sync the Zaurus with the | 483 | (That makes it possible to sync the Zaurus with the |
477 | calendar data on a Kolab server) | 484 | calendar data on a Kolab server) |
478 | 485 | ||
479 | KA/Pi syncing with KDE desktop will be available in the next version. | 486 | KA/Pi syncing with KDE desktop will be available in the next version. |
480 | 487 | ||
481 | 488 | ||
482 | ********** VERSION 1.9.7 ************ | 489 | ********** VERSION 1.9.7 ************ |
483 | 490 | ||
484 | KO/Pi - KA/Pi on Windows: | 491 | KO/Pi - KA/Pi on Windows: |
485 | Now a directory can be defined by the user, where the | 492 | Now a directory can be defined by the user, where the |
486 | application/config data should be saved. | 493 | application/config data should be saved. |
487 | Define your desired path in the evironment variable | 494 | Define your desired path in the evironment variable |
488 | MICROKDEHOME | 495 | MICROKDEHOME |
489 | before starting KO/Pi or KA/Pi. | 496 | before starting KO/Pi or KA/Pi. |
490 | 497 | ||
491 | An easy Kx/Pi to Kx/Pi syncing is now possible | 498 | An easy Kx/Pi to Kx/Pi syncing is now possible |
492 | (it is called Pi-Sync) via network. | 499 | (it is called Pi-Sync) via network. |
493 | Please look at the Sync Howto. | 500 | Please look at the Sync Howto. |
494 | 501 | ||
495 | Exporting of calendar data and contacts to mobile phones is now possible. | 502 | Exporting of calendar data and contacts to mobile phones is now possible. |
496 | The SyncHowto is updated with information howto | 503 | The SyncHowto is updated with information howto |
497 | access/sync mobile phones. | 504 | access/sync mobile phones. |
498 | Please look at the Sync Howto. | 505 | Please look at the Sync Howto. |
499 | 506 | ||
500 | Now KO/Pi and KA/Pi on the Zaurus can receive data via infrared directly. | 507 | Now KO/Pi and KA/Pi on the Zaurus can receive data via infrared directly. |
501 | Please disable Fastload for the original contact/calendar applications | 508 | Please disable Fastload for the original contact/calendar applications |
502 | and close them. | 509 | and close them. |
503 | KO/Pi and KA/Pi must be running in order to receive the data. | 510 | KO/Pi and KA/Pi must be running in order to receive the data. |
504 | (KO/Pi and KA/Pi are always running if Fastload for them is enabled!) | 511 | (KO/Pi and KA/Pi are always running if Fastload for them is enabled!) |
505 | 512 | ||
506 | In the KA/Pi details view are now the preferred tel. numbers displayed on top | 513 | In the KA/Pi details view are now the preferred tel. numbers displayed on top |
507 | of the other data ( emails/tel.numbers/addresses) | 514 | of the other data ( emails/tel.numbers/addresses) |
508 | 515 | ||
509 | Fixed some syncing problems in KA/Pi. | 516 | Fixed some syncing problems in KA/Pi. |
510 | 517 | ||
511 | Added font settings for the KA/Pi details view. | 518 | Added font settings for the KA/Pi details view. |
512 | Added fields "children's name" and "gender" to KA/Pi. | 519 | Added fields "children's name" and "gender" to KA/Pi. |
513 | 520 | ||
514 | Made searching in KA/Pi better: | 521 | Made searching in KA/Pi better: |
515 | Now the first item in a view is selected after a search automatically and | 522 | Now the first item in a view is selected after a search automatically and |
516 | the views can be scrolled up/down when the search input field has the keyboard focus. | 523 | the views can be scrolled up/down when the search input field has the keyboard focus. |
517 | 524 | ||
518 | And, of course, fixed a bunch of reported bugs in KO/Pi and KA/Pi. | 525 | And, of course, fixed a bunch of reported bugs in KO/Pi and KA/Pi. |
519 | 526 | ||
520 | 527 | ||
521 | ********** VERSION 1.9.6 ************ | 528 | ********** VERSION 1.9.6 ************ |
522 | 529 | ||
523 | Changes in the external application communication on the Zaurus | 530 | Changes in the external application communication on the Zaurus |
524 | in order to use less RAM when the apps are running. | 531 | in order to use less RAM when the apps are running. |
525 | First syncing of addressbooks (KA/Pi) is possible. | 532 | First syncing of addressbooks (KA/Pi) is possible. |
526 | 533 | ||
527 | 534 | ||
528 | ********** VERSION 1.9.5a ************ | 535 | ********** VERSION 1.9.5a ************ |
529 | 536 | ||
530 | Fixed a bug in KO/Pi in the SharpDTM sync of version 1.9.5. | 537 | Fixed a bug in KO/Pi in the SharpDTM sync of version 1.9.5. |
531 | Fixed some small bugs. | 538 | Fixed some small bugs. |
532 | KA/Pi shows now the birthday in summary view. | 539 | KA/Pi shows now the birthday in summary view. |
533 | Now OM/Pi and KA/Pi are using the date format defined in KO/Pi | 540 | Now OM/Pi and KA/Pi are using the date format defined in KO/Pi |
534 | for displaying dates. | 541 | for displaying dates. |
535 | 542 | ||
536 | 543 | ||
537 | ********** VERSION 1.9.5 ************ | 544 | ********** VERSION 1.9.5 ************ |
538 | 545 | ||
539 | There is still no Addressbook syncing! | 546 | There is still no Addressbook syncing! |
540 | 547 | ||
541 | New in 1.9.5: | 548 | New in 1.9.5: |
542 | 549 | ||
543 | Many bugfixes. | 550 | Many bugfixes. |
544 | Better searching in KA/Pi. | 551 | Better searching in KA/Pi. |
545 | You can configure in KA/Pi if you want to search only after | 552 | You can configure in KA/Pi if you want to search only after |
546 | <return> key pressed. | 553 | <return> key pressed. |
547 | 554 | ||
548 | Better mail downloading in OM/Pi. | 555 | Better mail downloading in OM/Pi. |
549 | 556 | ||
550 | First experimental alpha version of sync of KO/Pi with mobile phones. | 557 | First experimental alpha version of sync of KO/Pi with mobile phones. |
551 | See gammu documentation for supported phones. | 558 | See gammu documentation for supported phones. |
552 | You need to install the package kammu_1.9.5_arm.ipk for sync of KO/Pi with mobile phones. kammu_1.9.5_arm.ipk needs libbluetooth and libsdp. | 559 | You need to install the package kammu_1.9.5_arm.ipk for sync of KO/Pi with mobile phones. kammu_1.9.5_arm.ipk needs libbluetooth and libsdp. |
553 | Quick hint how to use: | 560 | Quick hint how to use: |
554 | NOTE: MOBILE PHONE SYNC IS EXPERIMENTAL! | 561 | NOTE: MOBILE PHONE SYNC IS EXPERIMENTAL! |
555 | Install kammu_1.9.5_arm.ipk , libbluetooth and libsdp. | 562 | Install kammu_1.9.5_arm.ipk , libbluetooth and libsdp. |
556 | Create syncprofile - mobile device | 563 | Create syncprofile - mobile device |
557 | Remove entry for model. (Leave empty ). | 564 | Remove entry for model. (Leave empty ). |
558 | Enable infrared on Zaurus and your Phone. | 565 | Enable infrared on Zaurus and your Phone. |
559 | Sync. | 566 | Sync. |
560 | To get a more detailed log, start kopi from konsole. | 567 | To get a more detailed log, start kopi from konsole. |
561 | 568 | ||
562 | ********** VERSION 1.9.4 ************ | 569 | ********** VERSION 1.9.4 ************ |
563 | 570 | ||
564 | This is the version 1.9.4 of KDE-Pim/Pi for the Zaurus. | 571 | This is the version 1.9.4 of KDE-Pim/Pi for the Zaurus. |
565 | 572 | ||
566 | WARNING: | 573 | WARNING: |
567 | PLEASE BACKUP ALL YOUR DATA! | 574 | PLEASE BACKUP ALL YOUR DATA! |
568 | We have changed a lot and maybe there are some unknown problems. | 575 | We have changed a lot and maybe there are some unknown problems. |
569 | 576 | ||
570 | SYNC HANDLING HAS CHANGED! | 577 | SYNC HANDLING HAS CHANGED! |
571 | Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. | 578 | Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. |
572 | (This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). | 579 | (This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). |
573 | 580 | ||
574 | You need the kmicrokdelibs_1.9.4_arm.ipk as a base for the other programs. | 581 | You need the kmicrokdelibs_1.9.4_arm.ipk as a base for the other programs. |
575 | If you get the error: "Install only possible in main memory", just try it again to install it on SD card. That worked for me. And it was reported that rebooting Qtopia did help in this case as well. | 582 | If you get the error: "Install only possible in main memory", just try it again to install it on SD card. That worked for me. And it was reported that rebooting Qtopia did help in this case as well. |
576 | 583 | ||
577 | As programs are available: | 584 | As programs are available: |
578 | KO/Pi (korganizer ipk) - a calendar program. | 585 | KO/Pi (korganizer ipk) - a calendar program. |
579 | KA/Pi (kaddressbook ipk ) - an addressbook | 586 | KA/Pi (kaddressbook ipk ) - an addressbook |
580 | OM/Pi (kopiemail ipk ) an email program with pop/smtp and IMAP support. | 587 | OM/Pi (kopiemail ipk ) an email program with pop/smtp and IMAP support. |
581 | 588 | ||
582 | An alarm notification program ( korganizer-alarm ipk ) for KO/Pi that notifies you about alarms, even if the Zaurus is in suspend mode. | 589 | An alarm notification program ( korganizer-alarm ipk ) for KO/Pi that notifies you about alarms, even if the Zaurus is in suspend mode. |
583 | (If you do not see an icon in the taskbar after installing korganizer-alarm, please restart Qtopia) | 590 | (If you do not see an icon in the taskbar after installing korganizer-alarm, please restart Qtopia) |
584 | 591 | ||
585 | All the applications are installed in a "Pim" TAB. | 592 | All the applications are installed in a "Pim" TAB. |
586 | If this TAB is new on your system, you can get an icon in this TAB by installing pim_TAB_icon_1.9.4_arm.ipk | 593 | If this TAB is new on your system, you can get an icon in this TAB by installing pim_TAB_icon_1.9.4_arm.ipk |
587 | 594 | ||
588 | All the application are integrated. | 595 | All the application are integrated. |
589 | Such that you can choose in KO/Pi the attendees of a meeting from the addresses in KA/Pi. When you click in KA/Pi on the email address, OM/Pi is started to write the mail. | 596 | Such that you can choose in KO/Pi the attendees of a meeting from the addresses in KA/Pi. When you click in KA/Pi on the email address, OM/Pi is started to write the mail. |
590 | 597 | ||
591 | HINT: | 598 | HINT: |
592 | If you install KPhone/Pi 0.9.7, it will be called, if you click in KA/Pi on a phone number. | 599 | If you install KPhone/Pi 0.9.7, it will be called, if you click in KA/Pi on a phone number. |
593 | 600 | ||
594 | What's new? | 601 | What's new? |
595 | 602 | ||
596 | SYNC HANDLING HAS CHANGED! | 603 | SYNC HANDLING HAS CHANGED! |
597 | Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. | 604 | Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. |
598 | (This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). | 605 | (This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). |
599 | 606 | ||
600 | New in OM/Pi: | 607 | New in OM/Pi: |
601 | When copying(i.e. downloading mails) , you can specify, that only mails of a given size should be downloaded. Added mail copy possibility for selected mails. | 608 | When copying(i.e. downloading mails) , you can specify, that only mails of a given size should be downloaded. Added mail copy possibility for selected mails. |
602 | 609 | ||
603 | New in KO/Pi: | 610 | New in KO/Pi: |
604 | French is now available for KO/Pi. | 611 | French is now available for KO/Pi. |
605 | Choose menu:Actions - Configure:TAB locale | 612 | Choose menu:Actions - Configure:TAB locale |
606 | Syncing has changed. | 613 | Syncing has changed. |
607 | Phone sync available soon. | 614 | Phone sync available soon. |
608 | Not much changes, I cannot remember them ... | 615 | Not much changes, I cannot remember them ... |
609 | 616 | ||
610 | New in KA/Pi: | 617 | New in KA/Pi: |
611 | Beaming possible. | 618 | Beaming possible. |
612 | Sharp DTM readonly access possible( create a new DTM resource ); | 619 | Sharp DTM readonly access possible( create a new DTM resource ); |
613 | Better searching possible. | 620 | Better searching possible. |
614 | Search is performed only after pressing the return key. | 621 | Search is performed only after pressing the return key. |
615 | Use wildcard * to specify parts of a name. | 622 | Use wildcard * to specify parts of a name. |
616 | 623 | ||
617 | Better name/email selection dialog (called from KO/Pi or OM/Pi). In this dialog, now searching is possible. Like in KA/Pi, use return key and wildcard * . | 624 | Better name/email selection dialog (called from KO/Pi or OM/Pi). In this dialog, now searching is possible. Like in KA/Pi, use return key and wildcard * . |
618 | 625 | ||
619 | A big improvement is the new management of the contact access. | 626 | A big improvement is the new management of the contact access. |
620 | In version 1.9.3, every application was using their own addressbook access data. | 627 | In version 1.9.3, every application was using their own addressbook access data. |
621 | That means, the addressbook was loaded up to three times in the memory, when accessed by KA/Pi, KO/Pi and OM/Pi. | 628 | That means, the addressbook was loaded up to three times in the memory, when accessed by KA/Pi, KO/Pi and OM/Pi. |
622 | That was wasting of memory, if you had several hundreds of contacts. | 629 | That was wasting of memory, if you had several hundreds of contacts. |
623 | 630 | ||
624 | Now only KA/Pi accesses the addressbook. | 631 | Now only KA/Pi accesses the addressbook. |
625 | If KO/Pi or OM/Pi want to get some name/email data, they request KA/Pi to open the name/email selection dialog and send it back to them. | 632 | If KO/Pi or OM/Pi want to get some name/email data, they request KA/Pi to open the name/email selection dialog and send it back to them. |
626 | If you click on an attendee in a meeting, its contact data is displayed in KA/Pi directly. | 633 | If you click on an attendee in a meeting, its contact data is displayed in KA/Pi directly. |
627 | That means, if KO/Pi or OM/Pi want to access contact data, KA/Pi is started first. | 634 | That means, if KO/Pi or OM/Pi want to access contact data, KA/Pi is started first. |
628 | 635 | ||
629 | New in the KO/Pi alarm applet: | 636 | New in the KO/Pi alarm applet: |
630 | Configure your own timer popup menu! | 637 | Configure your own timer popup menu! |
631 | (Text and minutes for timer countdown) | 638 | (Text and minutes for timer countdown) |
632 | Just edit the file | 639 | Just edit the file |
633 | (yourhomedir)/.kopialarmtimerrc | 640 | (yourhomedir)/.kopialarmtimerrc |
634 | and start/stop a timer to get a new menu with the data of this file. | 641 | and start/stop a timer to get a new menu with the data of this file. |
635 | 642 | ||
636 | ********** VERSION 1.9.3 ************ | 643 | ********** VERSION 1.9.3 ************ |
637 | 1) | 644 | 1) |
638 | Now KO/Pi on Windows imports directly the calendar data of | 645 | Now KO/Pi on Windows imports directly the calendar data of |
639 | an installed Outlook. Should work with OL version >= 2000. | 646 | an installed Outlook. Should work with OL version >= 2000. |
640 | 647 | ||
641 | ********** VERSION 1.9.2 ************ | 648 | ********** VERSION 1.9.2 ************ |
642 | 1) | 649 | 1) |
643 | KDE-Pim/Pi has got a new member: | 650 | KDE-Pim/Pi has got a new member: |
644 | KmicroMail (KM/Pi) is a mail program, | 651 | KmicroMail (KM/Pi) is a mail program, |
645 | which can handle IMAP and POP mail access. | 652 | which can handle IMAP and POP mail access. |
646 | It is based on Opie-Mail v3. | 653 | It is based on Opie-Mail v3. |
647 | All dependencies to the Opie libraries ar removed, | 654 | All dependencies to the Opie libraries ar removed, |
648 | such that no additional Opie lib is needed. | 655 | such that no additional Opie lib is needed. |
649 | It is already integrated in KO/Pi and KA/Pi. | 656 | It is already integrated in KO/Pi and KA/Pi. |
650 | It it now available for the Zaurus,probably it | 657 | It it now available for the Zaurus,probably it |
651 | will be available for other platforms later. | 658 | will be available for other platforms later. |
652 | Hint: | 659 | Hint: |
653 | Create your own contact (name + email) | 660 | Create your own contact (name + email) |
654 | in KA/Pi, select this contact and choose menu: | 661 | in KA/Pi, select this contact and choose menu: |
655 | Settings - Set Who Am I. | 662 | Settings - Set Who Am I. |
656 | Now the settings of this contact are used as | 663 | Now the settings of this contact are used as |
657 | the sender data in KM/Pi. | 664 | the sender data in KM/Pi. |
658 | 2) | 665 | 2) |
659 | KDE-Pim/Pi is split up in five different | 666 | KDE-Pim/Pi is split up in five different |
660 | packages now precompiled for Sharp Zaurus: | 667 | packages now precompiled for Sharp Zaurus: |
661 | --kmicrokdelibs_1.9.2_arm.ipk | 668 | --kmicrokdelibs_1.9.2_arm.ipk |
662 | The libs are needed for any | 669 | The libs are needed for any |
663 | of the following programs: | 670 | of the following programs: |
664 | --kaddressbook_1.9.2_arm.ipk | 671 | --kaddressbook_1.9.2_arm.ipk |
665 | --kmicromail_1.9.2_arm.ipk | 672 | --kmicromail_1.9.2_arm.ipk |
666 | --korganizer_1.9.2_arm.ipk | 673 | --korganizer_1.9.2_arm.ipk |
667 | Independ from that, there is the alarm applet | 674 | Independ from that, there is the alarm applet |
668 | available for KO/Pi, which also offers | 675 | available for KO/Pi, which also offers |
669 | quick access for a new mail or | 676 | quick access for a new mail or |
670 | showing the addressbook.: | 677 | showing the addressbook.: |
671 | --korganizer-alarm_1.9.2_arm.ipk | 678 | --korganizer-alarm_1.9.2_arm.ipk |
672 | Independend means, that the alarm applet | 679 | Independend means, that the alarm applet |
673 | does not need any of the libs or programs above to run. | 680 | does not need any of the libs or programs above to run. |
674 | But it would be quite useless without these programs. | 681 | But it would be quite useless without these programs. |
675 | NOTE: | 682 | NOTE: |
676 | If you get a | 683 | If you get a |
677 | "This application depends on other programs" | 684 | "This application depends on other programs" |
678 | during installation of | 685 | during installation of |
679 | --kmicrokdelibs_1.9.2_arm.ipk | 686 | --kmicrokdelibs_1.9.2_arm.ipk |
680 | you probably do not have to care about that. | 687 | you probably do not have to care about that. |
681 | kmicrokdelibs_1.9.2 will come with some | 688 | kmicrokdelibs_1.9.2 will come with some |
682 | resource plugins, which needs additional libraries. | 689 | resource plugins, which needs additional libraries. |
683 | (E.g. libopie1, if you want to use the | 690 | (E.g. libopie1, if you want to use the |
684 | opie resource connector in KA/Pi). | 691 | opie resource connector in KA/Pi). |
685 | If you do not have this libraries installed, | 692 | If you do not have this libraries installed, |
686 | you simply cannot use the resource. | 693 | you simply cannot use the resource. |
687 | To make it clear: | 694 | To make it clear: |
688 | If the libraries are missing, the applications | 695 | If the libraries are missing, the applications |
689 | using kmicrokdelibs will start, | 696 | using kmicrokdelibs will start, |
690 | because the resources are plugins. | 697 | because the resources are plugins. |
691 | 3) | 698 | 3) |
692 | KO/Pi and friends are now installable on SD-Card! | 699 | KO/Pi and friends are now installable on SD-Card! |
693 | It is recommended to install all libs and apps | 700 | It is recommended to install all libs and apps |
694 | on the SD card or all in the internal storage. | 701 | on the SD card or all in the internal storage. |
695 | There may be problems, if this is mixed. | 702 | There may be problems, if this is mixed. |
696 | 4) | 703 | 4) |
697 | Fixed two bugs in the alarm notification on Windows. | 704 | Fixed two bugs in the alarm notification on Windows. |
698 | 5) | 705 | 5) |
699 | Great improvement! | 706 | Great improvement! |
700 | KO/Pi uses now the latest version of libical. | 707 | KO/Pi uses now the latest version of libical. |
701 | Libical is the library which actually reads | 708 | Libical is the library which actually reads |
702 | the calendar files and extract the data from it. | 709 | the calendar files and extract the data from it. |
703 | With the old version, there were problems | 710 | With the old version, there were problems |
704 | (crashes or program hangs) when licical did read | 711 | (crashes or program hangs) when licical did read |
705 | files, which were not stored from KO/Pi. | 712 | files, which were not stored from KO/Pi. |
706 | I do not know, if the new libical works perfect, | 713 | I do not know, if the new libical works perfect, |
707 | but actually it works much better than | 714 | but actually it works much better than |
708 | the old version. | 715 | the old version. |
709 | There are no problems with compatibility with | 716 | There are no problems with compatibility with |
710 | old calendar files of KO/Pi, of course! | 717 | old calendar files of KO/Pi, of course! |
711 | 6) | 718 | 6) |
712 | New in KA/Pi: | 719 | New in KA/Pi: |
713 | Opie addressbook resource connector available! | 720 | Opie addressbook resource connector available! |
714 | You will need libopie1 and the opie addressbook, | 721 | You will need libopie1 and the opie addressbook, |
715 | of course. | 722 | of course. |
716 | With the Opie addressbook resource connector, | 723 | With the Opie addressbook resource connector, |
717 | you can access the Opie addressbook readonly in KA/Pi. | 724 | you can access the Opie addressbook readonly in KA/Pi. |
718 | If you want to edit or import the data into KA/Pi, | 725 | If you want to edit or import the data into KA/Pi, |
719 | do this: | 726 | do this: |
720 | a) Create an Opie resource. | 727 | a) Create an Opie resource. |
721 | (Menu: Settings-Configure Resources). | 728 | (Menu: Settings-Configure Resources). |
722 | After configuration and restarting KA/Pi you should see | 729 | After configuration and restarting KA/Pi you should see |
723 | the Opie contacts in KA/Pi. | 730 | the Opie contacts in KA/Pi. |
724 | b) Select some or all Opie contacts. | 731 | b) Select some or all Opie contacts. |
725 | (NOTE: +++++ | 732 | (NOTE: +++++ |
726 | To know exactly, what contacts are Opie contacts, | 733 | To know exactly, what contacts are Opie contacts, |
727 | do this: Choose menu: | 734 | do this: Choose menu: |
728 | View-Modify View - TAB Fields. | 735 | View-Modify View - TAB Fields. |
729 | Select in the above list "Resource" and click | 736 | Select in the above list "Resource" and click |
730 | down arrow to add it to the "Selected fields". | 737 | down arrow to add it to the "Selected fields". |
731 | Click OK. | 738 | Click OK. |
732 | Now you have a new column "Resource" in your list, | 739 | Now you have a new column "Resource" in your list, |
733 | where you can see, what an Opie resource is. | 740 | where you can see, what an Opie resource is. |
734 | ++++ NOTE end.) | 741 | ++++ NOTE end.) |
735 | Ok, we do have now some Opie contacts seleted. | 742 | Ok, we do have now some Opie contacts seleted. |
736 | (Use SHIFT or CTRL key in order to multiple select). | 743 | (Use SHIFT or CTRL key in order to multiple select). |
737 | c) Choose menu: Edit-Copy. | 744 | c) Choose menu: Edit-Copy. |
738 | d) Choose menu: Edit-Paste. | 745 | d) Choose menu: Edit-Paste. |
739 | e) Select the resource, you want to add the contacts to. | 746 | e) Select the resource, you want to add the contacts to. |
740 | Congrats! Now you have read/write access to the copied | 747 | Congrats! Now you have read/write access to the copied |
741 | opie contacts as "real" KA/Pi contacts. | 748 | opie contacts as "real" KA/Pi contacts. |
742 | 749 | ||
743 | 750 | ||
744 | ********** VERSION 1.9.1 ************ | 751 | ********** VERSION 1.9.1 ************ |
745 | 1) | 752 | 1) |
746 | +++ IMPORTANT 1 +++ | 753 | +++ IMPORTANT 1 +++ |
747 | 754 | ||
748 | The storing place of the default calendar | 755 | The storing place of the default calendar |
749 | file has changed! | 756 | file has changed! |
750 | The default calendar file was | 757 | The default calendar file was |
751 | Applications/korganizer/mycalendar.ics | 758 | Applications/korganizer/mycalendar.ics |
752 | on Zaurus and | 759 | on Zaurus and |
753 | (yourHomeDir)/korganizer/mycalendar.ics | 760 | (yourHomeDir)/korganizer/mycalendar.ics |
754 | on Windows/Linux desktop. Now it is | 761 | on Windows/Linux desktop. Now it is |
755 | (yourHomeDir)/kdepim/korganizer/mycalendar.ics | 762 | (yourHomeDir)/kdepim/korganizer/mycalendar.ics |
756 | on Zaurus, Windows and Linux. | 763 | on Zaurus, Windows and Linux. |
757 | To load the old file, choose menu | 764 | To load the old file, choose menu |
758 | File-Load calendar backup. | 765 | File-Load calendar backup. |
759 | (It should be loaded automatically | 766 | (It should be loaded automatically |
760 | at startup with a warning message displayed). | 767 | at startup with a warning message displayed). |
761 | The place of the configuration file has changed too. | 768 | The place of the configuration file has changed too. |
762 | If you want to use your old KO/Pi config, | 769 | If you want to use your old KO/Pi config, |
763 | copy it to | 770 | copy it to |
764 | (yourHomeDir)/kdepim/config/korganizerrc | 771 | (yourHomeDir)/kdepim/config/korganizerrc |
765 | Please read VERSION 1.9.0 - topic 3) as well! | 772 | Please read VERSION 1.9.0 - topic 3) as well! |
766 | 773 | ||
767 | +++ IMPORTANT 2 +++ | 774 | +++ IMPORTANT 2 +++ |
768 | 775 | ||
769 | Because of the new paths, you will need | 776 | Because of the new paths, you will need |
770 | a new version of the KO/Pi alarm applet | 777 | a new version of the KO/Pi alarm applet |
771 | for Zaurus. | 778 | for Zaurus. |
772 | Use version >= 1.9.1 | 779 | Use version >= 1.9.1 |
773 | 780 | ||
774 | 2) | 781 | 2) |
775 | Now the QWhat'sThis Icon works for items | 782 | Now the QWhat'sThis Icon works for items |
776 | in the month view as well. | 783 | in the month view as well. |
777 | (See VERSION 1.7.8 Topic 1) ). | 784 | (See VERSION 1.7.8 Topic 1) ). |
778 | 3) | 785 | 3) |
779 | You can import birtsdays/anniversaries | 786 | You can import birtsdays/anniversaries |
780 | from KA/Pi into KO/Pi. | 787 | from KA/Pi into KO/Pi. |
781 | Choose menu File-Import birthdays. | 788 | Choose menu File-Import birthdays. |
782 | If you import twice, already imported items | 789 | If you import twice, already imported items |
783 | will not be imported again, if they | 790 | will not be imported again, if they |
784 | have not been changed in KO/Pi. | 791 | have not been changed in KO/Pi. |
785 | 4) | 792 | 4) |
786 | When syncing with sharp DTM, now a progress | 793 | When syncing with sharp DTM, now a progress |
787 | is shown, when the data is written back. | 794 | is shown, when the data is written back. |
788 | If there is much data in KO/Pi and no data | 795 | If there is much data in KO/Pi and no data |
789 | in DTM, that can take a long time. | 796 | in DTM, that can take a long time. |
790 | (But only for the first time ). | 797 | (But only for the first time ). |
791 | 5) | 798 | 5) |
792 | In the search dialog, you can search | 799 | In the search dialog, you can search |
793 | now for the name/email of an attendee | 800 | now for the name/email of an attendee |
794 | of an event/todo. | 801 | of an event/todo. |
795 | To get more space for displaying | 802 | To get more space for displaying |
796 | search results, the buttons | 803 | search results, the buttons |
797 | for "search" and "close" on the | 804 | for "search" and "close" on the |
798 | bottom are removed in the PDA version. | 805 | bottom are removed in the PDA version. |
799 | You have to click OK in the top right | 806 | You have to click OK in the top right |
800 | corner to do a search. | 807 | corner to do a search. |
801 | 6) | 808 | 6) |
802 | Now it is possible to disable the displaying | 809 | Now it is possible to disable the displaying |
803 | of todo items in the Allday part of the Agenda. | 810 | of todo items in the Allday part of the Agenda. |
804 | Choose Menu Action-Configure, | 811 | Choose Menu Action-Configure, |
805 | TAB Todo View, checkbox | 812 | TAB Todo View, checkbox |
806 | "Allday Agenda view shows todos" | 813 | "Allday Agenda view shows todos" |
807 | 7) | 814 | 7) |
808 | If FastLoad is enabled, now the settings and the | 815 | If FastLoad is enabled, now the settings and the |
809 | calendar data are saved, when KO/Pi is closed. | 816 | calendar data are saved, when KO/Pi is closed. |
810 | (If no Fastload is enabled, KO/Pi saves | 817 | (If no Fastload is enabled, KO/Pi saves |
811 | the data as well, of course) | 818 | the data as well, of course) |
812 | 8) | 819 | 8) |
813 | The Agenda View has a minimize-splitter now, | 820 | The Agenda View has a minimize-splitter now, |
814 | such that the height of the allday part can be | 821 | such that the height of the allday part can be |
815 | changed quickly. | 822 | changed quickly. |
816 | 823 | ||
817 | ********** VERSION 1.9.0 ************ | 824 | ********** VERSION 1.9.0 ************ |
818 | 1) | 825 | 1) |
819 | KO/Pi is now merged with the new microKDE from KA/Pi. | 826 | KO/Pi is now merged with the new microKDE from KA/Pi. |
820 | KO/Pi accesses now KA/Pi as the addressbook. | 827 | KO/Pi accesses now KA/Pi as the addressbook. |
821 | The other ddressbook-plugins are not working any longer. | 828 | The other ddressbook-plugins are not working any longer. |
822 | (It is planned, that later KA/Pi itself uses these plugins) | 829 | (It is planned, that later KA/Pi itself uses these plugins) |
823 | New versions of KO/Pi are only available | 830 | New versions of KO/Pi are only available |
824 | together with KA/Pi as the KDE-Pim/Pi package. | 831 | together with KA/Pi as the KDE-Pim/Pi package. |
825 | 2) | 832 | 2) |
826 | If you click on an attendee of a meeting in the | 833 | If you click on an attendee of a meeting in the |
827 | event viewer, a detailed summary of the | 834 | event viewer, a detailed summary of the |
828 | attendee is shown. | 835 | attendee is shown. |
829 | 3) | 836 | 3) |
830 | The place of the configuration file has changed. | 837 | The place of the configuration file has changed. |
831 | If you want to use your old KO/Pi config, copy | 838 | If you want to use your old KO/Pi config, copy |
832 | Applications/korganizer/config_korganizerrc | 839 | Applications/korganizer/config_korganizerrc |
833 | to | 840 | to |
834 | Applications/korganizer/config/korganizerrc | 841 | Applications/korganizer/config/korganizerrc |
835 | 842 | ||
836 | ********** VERSION 1.7.8 ************ | 843 | ********** VERSION 1.7.8 ************ |
837 | 1) | 844 | 1) |
838 | Now the QWhat'sThis ist working. | 845 | Now the QWhat'sThis ist working. |
839 | Enable the QWhat'sThis icon in the toolbar. | 846 | Enable the QWhat'sThis icon in the toolbar. |
840 | (You have to restart to reload the changed toolbar config). | 847 | (You have to restart to reload the changed toolbar config). |
841 | Now click on the QWhat'sThis Icon | 848 | Now click on the QWhat'sThis Icon |
842 | in the top right corner of KO/Pi. | 849 | in the top right corner of KO/Pi. |
843 | Then click on an item in the Agenda View: | 850 | Then click on an item in the Agenda View: |
844 | You will get a detailed display of the items content. | 851 | You will get a detailed display of the items content. |
845 | 2) | 852 | 2) |
846 | Some other very minor changes. | 853 | Some other very minor changes. |
847 | But I have forgotten the details ... | 854 | But I have forgotten the details ... |
848 | For that reason I start this log here: | 855 | For that reason I start this log here: |
849 | To document my changes, when I am doing it. | 856 | To document my changes, when I am doing it. |
850 | 857 | ||
851 | ********** VERSION 1.7.7 ************ | 858 | ********** VERSION 1.7.7 ************ |
852 | Stable Version of KO/Pi | 859 | Stable Version of KO/Pi |
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index ca896b5..549ef2a 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp | |||
@@ -1,630 +1,628 @@ | |||
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 ode for Qt in the source distribution. | 22 | without including the source ode 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 | #include <qtimer.h> | 28 | #include <qtimer.h> |
29 | 29 | ||
30 | #include <kglobal.h> | 30 | #include <kglobal.h> |
31 | #include <kdebug.h> | 31 | #include <kdebug.h> |
32 | #include <klocale.h> | 32 | #include <klocale.h> |
33 | 33 | ||
34 | #include <libkcal/vcaldrag.h> | 34 | #include <libkcal/vcaldrag.h> |
35 | #include <libkcal/icaldrag.h> | 35 | #include <libkcal/icaldrag.h> |
36 | #include <libkcal/dndfactory.h> | 36 | #include <libkcal/dndfactory.h> |
37 | #include <libkcal/calendarresources.h> | 37 | #include <libkcal/calendarresources.h> |
38 | #include <libkcal/resourcecalendar.h> | 38 | #include <libkcal/resourcecalendar.h> |
39 | #include <kresources/resourceselectdialog.h> | 39 | #include <kresources/resourceselectdialog.h> |
40 | 40 | ||
41 | #include <kcalendarsystem.h> | 41 | #include <kcalendarsystem.h> |
42 | 42 | ||
43 | #ifndef KORG_NOPLUGINS | 43 | #ifndef KORG_NOPLUGINS |
44 | #include "kocore.h" | 44 | #include "kocore.h" |
45 | #endif | 45 | #endif |
46 | #include "koprefs.h" | 46 | #include "koprefs.h" |
47 | #include "koglobals.h" | 47 | #include "koglobals.h" |
48 | 48 | ||
49 | #include "kodaymatrix.h" | 49 | #include "kodaymatrix.h" |
50 | 50 | ||
51 | // ============================================================================ | 51 | // ============================================================================ |
52 | // D Y N A M I C T I P | 52 | // D Y N A M I C T I P |
53 | // ============================================================================ | 53 | // ============================================================================ |
54 | 54 | ||
55 | DynamicTip::DynamicTip( QWidget * parent ) | 55 | DynamicTip::DynamicTip( QWidget * parent ) |
56 | : QToolTip( parent ) | 56 | : QToolTip( parent ) |
57 | { | 57 | { |
58 | matrix = (KODayMatrix*)parent; | 58 | matrix = (KODayMatrix*)parent; |
59 | } | 59 | } |
60 | 60 | ||
61 | 61 | ||
62 | void DynamicTip::maybeTip( const QPoint &pos ) | 62 | void DynamicTip::maybeTip( const QPoint &pos ) |
63 | { | 63 | { |
64 | //calculate which cell of the matrix the mouse is in | 64 | //calculate which cell of the matrix the mouse is in |
65 | QRect sz = matrix->frameRect(); | 65 | QRect sz = matrix->frameRect(); |
66 | int dheight = sz.height()*7 / 42; | 66 | int dheight = sz.height()*7 / 42; |
67 | int dwidth = sz.width() / 7; | 67 | int dwidth = sz.width() / 7; |
68 | int row = pos.y()/dheight; | 68 | int row = pos.y()/dheight; |
69 | int col = pos.x()/dwidth; | 69 | int col = pos.x()/dwidth; |
70 | 70 | ||
71 | QRect rct(col*dwidth, row*dheight, dwidth, dheight); | 71 | QRect rct(col*dwidth, row*dheight, dwidth, dheight); |
72 | 72 | ||
73 | // kdDebug() << "DynamicTip::maybeTip matrix cell index [" << | 73 | // kdDebug() << "DynamicTip::maybeTip matrix cell index [" << |
74 | // col << "][" << row << "] => " <<(col+row*7) << endl; | 74 | // col << "][" << row << "] => " <<(col+row*7) << endl; |
75 | 75 | ||
76 | //show holiday names only | 76 | //show holiday names only |
77 | QString str = matrix->getHolidayLabel(col+row*7); | 77 | QString str = matrix->getHolidayLabel(col+row*7); |
78 | if (str.isEmpty()) return; | 78 | if (str.isEmpty()) return; |
79 | tip(rct, str); | 79 | tip(rct, str); |
80 | } | 80 | } |
81 | 81 | ||
82 | 82 | ||
83 | // ============================================================================ | 83 | // ============================================================================ |
84 | // K O D A Y M A T R I X | 84 | // K O D A Y M A T R I X |
85 | // ============================================================================ | 85 | // ============================================================================ |
86 | 86 | ||
87 | const int KODayMatrix::NOSELECTION = -1000; | 87 | const int KODayMatrix::NOSELECTION = -1000; |
88 | const int KODayMatrix::NUMDAYS = 42; | 88 | const int KODayMatrix::NUMDAYS = 42; |
89 | 89 | ||
90 | KODayMatrix::KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name) : | 90 | KODayMatrix::KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name) : |
91 | QFrame(parent, name) | 91 | QFrame(parent, name) |
92 | { | 92 | { |
93 | mCalendar = calendar; | 93 | mCalendar = calendar; |
94 | mPendingUpdateBeforeRepaint = false; | 94 | mPendingUpdateBeforeRepaint = false; |
95 | 95 | ||
96 | // initialize dynamic arrays | 96 | // initialize dynamic arrays |
97 | days = new QDate[NUMDAYS]; | 97 | days = new QDate[NUMDAYS]; |
98 | daylbls = new QString[NUMDAYS]; | 98 | daylbls = new QString[NUMDAYS]; |
99 | events = new int[NUMDAYS]; | 99 | events = new int[NUMDAYS]; |
100 | mToolTip = new DynamicTip(this); | 100 | mToolTip = new DynamicTip(this); |
101 | 101 | ||
102 | // set default values used for drawing the matrix | 102 | // set default values used for drawing the matrix |
103 | mDefaultBackColor = palette().active().base(); | 103 | mDefaultBackColor = palette().active().base(); |
104 | mDefaultTextColor = palette().active().foreground(); | 104 | mDefaultTextColor = palette().active().foreground(); |
105 | mDefaultTextColorShaded = getShadedColor(mDefaultTextColor); | 105 | mDefaultTextColorShaded = getShadedColor(mDefaultTextColor); |
106 | mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor); | 106 | mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor); |
107 | mSelectedDaysColor = QColor("white"); | 107 | mSelectedDaysColor = QColor("white"); |
108 | mTodayMarginWidth = 2; | 108 | mTodayMarginWidth = 2; |
109 | mSelEnd = mSelStart = NOSELECTION; | 109 | mSelEnd = mSelStart = NOSELECTION; |
110 | 110 | ||
111 | setAcceptDrops(true); | 111 | setAcceptDrops(true); |
112 | //setFont( QFont("Arial", 10) ); | 112 | //setFont( QFont("Arial", 10) ); |
113 | 113 | ||
114 | mUpdateTimer = new QTimer( this ); | 114 | mUpdateTimer = new QTimer( this ); |
115 | connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() )); | 115 | connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() )); |
116 | mRepaintTimer = new QTimer( this ); | 116 | mRepaintTimer = new QTimer( this ); |
117 | connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() )); | 117 | connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() )); |
118 | mDayChanged = false; | 118 | mDayChanged = false; |
119 | updateView(); | 119 | updateView(); |
120 | } | 120 | } |
121 | 121 | ||
122 | QColor KODayMatrix::getShadedColor(QColor color) | 122 | QColor KODayMatrix::getShadedColor(QColor color) |
123 | { | 123 | { |
124 | QColor shaded; | 124 | QColor shaded; |
125 | int h=0; | 125 | int h=0; |
126 | int s=0; | 126 | int s=0; |
127 | int v=0; | 127 | int v=0; |
128 | color.hsv(&h,&s,&v); | 128 | color.hsv(&h,&s,&v); |
129 | s = s/4; | 129 | s = s/4; |
130 | v = 192+v/4; | 130 | v = 192+v/4; |
131 | shaded.setHsv(h,s,v); | 131 | shaded.setHsv(h,s,v); |
132 | 132 | ||
133 | return shaded; | 133 | return shaded; |
134 | } | 134 | } |
135 | 135 | ||
136 | KODayMatrix::~KODayMatrix() | 136 | KODayMatrix::~KODayMatrix() |
137 | { | 137 | { |
138 | delete [] days; | 138 | delete [] days; |
139 | delete [] daylbls; | 139 | delete [] daylbls; |
140 | delete [] events; | 140 | delete [] events; |
141 | delete mToolTip; | 141 | delete mToolTip; |
142 | } | 142 | } |
143 | 143 | ||
144 | /* | 144 | /* |
145 | void KODayMatrix::setStartDate(QDate start) | 145 | void KODayMatrix::setStartDate(QDate start) |
146 | { | 146 | { |
147 | updateView(start); | 147 | updateView(start); |
148 | } | 148 | } |
149 | */ | 149 | */ |
150 | 150 | ||
151 | void KODayMatrix::addSelectedDaysTo(DateList& selDays) | 151 | void KODayMatrix::addSelectedDaysTo(DateList& selDays) |
152 | { | 152 | { |
153 | 153 | ||
154 | if (mSelStart == NOSELECTION) { | 154 | if (mSelStart == NOSELECTION) { |
155 | return; | 155 | return; |
156 | } | 156 | } |
157 | 157 | ||
158 | //cope with selection being out of matrix limits at top (< 0) | 158 | //cope with selection being out of matrix limits at top (< 0) |
159 | int i0 = mSelStart; | 159 | int i0 = mSelStart; |
160 | if (i0 < 0) { | 160 | if (i0 < 0) { |
161 | for (int i = i0; i < 0; i++) { | 161 | for (int i = i0; i < 0; i++) { |
162 | selDays.append(days[0].addDays(i)); | 162 | selDays.append(days[0].addDays(i)); |
163 | } | 163 | } |
164 | i0 = 0; | 164 | i0 = 0; |
165 | } | 165 | } |
166 | 166 | ||
167 | //cope with selection being out of matrix limits at bottom (> NUMDAYS-1) | 167 | //cope with selection being out of matrix limits at bottom (> NUMDAYS-1) |
168 | if (mSelEnd > NUMDAYS-1) { | 168 | if (mSelEnd > NUMDAYS-1) { |
169 | for (int i = i0; i <= NUMDAYS-1; i++) { | 169 | for (int i = i0; i <= NUMDAYS-1; i++) { |
170 | selDays.append(days[i]); | 170 | selDays.append(days[i]); |
171 | } | 171 | } |
172 | for (int i = NUMDAYS; i < mSelEnd; i++) { | 172 | for (int i = NUMDAYS; i < mSelEnd; i++) { |
173 | selDays.append(days[0].addDays(i)); | 173 | selDays.append(days[0].addDays(i)); |
174 | } | 174 | } |
175 | 175 | ||
176 | // apply normal routine to selection being entirely within matrix limits | 176 | // apply normal routine to selection being entirely within matrix limits |
177 | } else { | 177 | } else { |
178 | for (int i = i0; i <= mSelEnd; i++) { | 178 | for (int i = i0; i <= mSelEnd; i++) { |
179 | selDays.append(days[i]); | 179 | selDays.append(days[i]); |
180 | } | 180 | } |
181 | } | 181 | } |
182 | } | 182 | } |
183 | 183 | ||
184 | void KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end) | 184 | void KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end) |
185 | { | 185 | { |
186 | mSelStart = startdate.daysTo(start); | 186 | mSelStart = startdate.daysTo(start); |
187 | mSelEnd = startdate.daysTo(end); | 187 | mSelEnd = startdate.daysTo(end); |
188 | } | 188 | } |
189 | 189 | ||
190 | 190 | ||
191 | void KODayMatrix::recalculateToday() | 191 | void KODayMatrix::recalculateToday() |
192 | { | 192 | { |
193 | today = -1; | 193 | today = -1; |
194 | for (int i=0; i<NUMDAYS; i++) { | 194 | for (int i=0; i<NUMDAYS; i++) { |
195 | events[i] = 0; | 195 | events[i] = 0; |
196 | days[i] = startdate.addDays(i); | 196 | days[i] = startdate.addDays(i); |
197 | daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] )); | 197 | daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] )); |
198 | 198 | ||
199 | // if today is in the currently displayed month, hilight today | 199 | // if today is in the currently displayed month, hilight today |
200 | if (days[i].year() == QDate::currentDate().year() && | 200 | if (days[i].year() == QDate::currentDate().year() && |
201 | days[i].month() == QDate::currentDate().month() && | 201 | days[i].month() == QDate::currentDate().month() && |
202 | days[i].day() == QDate::currentDate().day()) { | 202 | days[i].day() == QDate::currentDate().day()) { |
203 | today = i; | 203 | today = i; |
204 | } | 204 | } |
205 | } | 205 | } |
206 | // qDebug(QString("Today is visible at %1.").arg(today)); | 206 | // qDebug(QString("Today is visible at %1.").arg(today)); |
207 | } | 207 | } |
208 | 208 | ||
209 | void KODayMatrix::updateView() | 209 | void KODayMatrix::updateView() |
210 | { | 210 | { |
211 | updateView(startdate); | 211 | updateView(startdate); |
212 | } | 212 | } |
213 | void KODayMatrix::repaintViewTimed() | 213 | void KODayMatrix::repaintViewTimed() |
214 | { | 214 | { |
215 | qDebug("KODayMatrix::repaintViewTimed "); | ||
216 | mRepaintTimer->stop(); | 215 | mRepaintTimer->stop(); |
217 | repaint(false); | 216 | repaint(false); |
218 | } | 217 | } |
219 | void KODayMatrix::updateViewTimed() | 218 | void KODayMatrix::updateViewTimed() |
220 | { | 219 | { |
221 | 220 | ||
222 | mUpdateTimer->stop(); | 221 | mUpdateTimer->stop(); |
223 | qDebug("KODayMatrix::updateView(QDate actdate)"); | ||
224 | for(int i = 0; i < NUMDAYS; i++) { | 222 | for(int i = 0; i < NUMDAYS; i++) { |
225 | |||
226 | // if events are set for the day then remember to draw it bold | 223 | // if events are set for the day then remember to draw it bold |
227 | QPtrList<Event> eventlist = mCalendar->events(days[i]); | 224 | QPtrList<Event> eventlist = mCalendar->events(days[i]); |
228 | Event *event; | 225 | Event *event; |
229 | int numEvents = eventlist.count(); | 226 | int numEvents = eventlist.count(); |
230 | 227 | QString holiStr = ""; | |
231 | for(event=eventlist.first();event != 0;event=eventlist.next()) { | 228 | for(event=eventlist.first();event != 0;event=eventlist.next()) { |
232 | ushort recurType = event->recurrence()->doesRecur(); | 229 | ushort recurType = event->recurrence()->doesRecur(); |
233 | |||
234 | if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || | 230 | if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || |
235 | (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { | 231 | (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { |
236 | numEvents--; | 232 | numEvents--; |
237 | } | 233 | } |
234 | if ( event->categories().contains( i18n("Holiday") ) || event->categories().contains( "Holiday" )) { | ||
235 | if ( !holiStr.isEmpty() ) | ||
236 | holiStr += "\n"; | ||
237 | holiStr += event->summary(); | ||
238 | } | ||
238 | } | 239 | } |
239 | events[i] = numEvents; | 240 | events[i] = numEvents; |
240 | |||
241 | //if it is a holy day then draw it red. Sundays are consider holidays, too | 241 | //if it is a holy day then draw it red. Sundays are consider holidays, too |
242 | #ifndef KORG_NOPLUGINS | ||
243 | QString holiStr = KOCore::self()->holiday(days[i]); | ||
244 | #else | ||
245 | QString holiStr = QString::null; | ||
246 | #endif | ||
247 | if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) || | 242 | if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) || |
248 | !holiStr.isEmpty()) { | 243 | !holiStr.isEmpty()) { |
249 | if (holiStr.isNull()) holiStr = ""; | ||
250 | mHolidays[i] = holiStr; | 244 | mHolidays[i] = holiStr; |
251 | |||
252 | } else { | 245 | } else { |
253 | mHolidays[i] = QString::null; | 246 | mHolidays[i] = QString::null; |
254 | } | 247 | } |
255 | } | 248 | } |
256 | if ( ! mPendingUpdateBeforeRepaint ) | 249 | if ( ! mPendingUpdateBeforeRepaint ) |
257 | repaint(false); | 250 | repaint(false); |
258 | } | 251 | } |
259 | void KODayMatrix::updateView(QDate actdate) | 252 | void KODayMatrix::updateView(QDate actdate) |
260 | { | 253 | { |
261 | 254 | ||
262 | if ( ! actdate.isValid() ) { | 255 | if ( ! actdate.isValid() ) { |
263 | //qDebug("date not valid "); | 256 | //qDebug("date not valid "); |
264 | return; | 257 | return; |
265 | } | 258 | } |
266 | mDayChanged = false; | 259 | mDayChanged = false; |
267 | //flag to indicate if the starting day of the matrix has changed by this call | 260 | //flag to indicate if the starting day of the matrix has changed by this call |
268 | //mDayChanged = false; | 261 | //mDayChanged = false; |
269 | // if a new startdate is to be set then apply Cornelius's calculation | 262 | // if a new startdate is to be set then apply Cornelius's calculation |
270 | // of the first day to be shown | 263 | // of the first day to be shown |
271 | if (actdate != startdate) { | 264 | if (actdate != startdate) { |
272 | // reset index of selection according to shift of starting date from startdate to actdate | 265 | // reset index of selection according to shift of starting date from startdate to actdate |
273 | if (mSelStart != NOSELECTION) { | 266 | if (mSelStart != NOSELECTION) { |
274 | int tmp = actdate.daysTo(startdate); | 267 | int tmp = actdate.daysTo(startdate); |
275 | //kdDebug() << "Shift of Selection1: " << mSelStart << " - " << mSelEnd << " -> " << tmp << "(" << offset << ")" << endl; | 268 | //kdDebug() << "Shift of Selection1: " << mSelStart << " - " << mSelEnd << " -> " << tmp << "(" << offset << ")" << endl; |
276 | // shift selection if new one would be visible at least partly ! | 269 | // shift selection if new one would be visible at least partly ! |
277 | 270 | ||
278 | if (mSelStart+tmp < NUMDAYS && mSelEnd+tmp >= 0) { | 271 | if (mSelStart+tmp < NUMDAYS && mSelEnd+tmp >= 0) { |
279 | // nested if is required for next X display pushed from a different month - correction required | 272 | // nested if is required for next X display pushed from a different month - correction required |
280 | // otherwise, for month forward and backward, it must be avoided | 273 | // otherwise, for month forward and backward, it must be avoided |
281 | if( mSelStart > NUMDAYS || mSelStart < 0 ) | 274 | if( mSelStart > NUMDAYS || mSelStart < 0 ) |
282 | mSelStart = mSelStart + tmp; | 275 | mSelStart = mSelStart + tmp; |
283 | if( mSelEnd > NUMDAYS || mSelEnd < 0 ) | 276 | if( mSelEnd > NUMDAYS || mSelEnd < 0 ) |
284 | mSelEnd = mSelEnd + tmp; | 277 | mSelEnd = mSelEnd + tmp; |
285 | } | 278 | } |
286 | } | 279 | } |
287 | startdate = actdate; | 280 | startdate = actdate; |
288 | mDayChanged = true; | 281 | mDayChanged = true; |
289 | recalculateToday(); | 282 | recalculateToday(); |
290 | } | 283 | } |
291 | qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() ); | 284 | //qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() ); |
292 | if ( !isVisible() ) { | 285 | if ( !isVisible() ) { |
293 | mPendingUpdateBeforeRepaint = true; | 286 | mPendingUpdateBeforeRepaint = true; |
294 | } else { | 287 | } else { |
295 | #ifdef DESKTOP_VERSION | 288 | #ifdef DESKTOP_VERSION |
296 | //mRepaintTimer->start( 250 ); | 289 | //mRepaintTimer->start( 250 ); |
297 | mUpdateTimer->start( 250 ); | 290 | mUpdateTimer->start( 250 ); |
298 | #else | 291 | #else |
299 | mRepaintTimer->start( 350 ); | 292 | mRepaintTimer->start( 350 ); |
300 | mUpdateTimer->start( 2000 ); | 293 | mUpdateTimer->start( 2000 ); |
301 | #endif | 294 | #endif |
302 | } | 295 | } |
303 | } | 296 | } |
304 | 297 | ||
305 | const QDate& KODayMatrix::getDate(int offset) | 298 | const QDate& KODayMatrix::getDate(int offset) |
306 | { | 299 | { |
307 | if (offset < 0 || offset > NUMDAYS-1) { | 300 | if (offset < 0 || offset > NUMDAYS-1) { |
308 | qDebug("Wrong offset2 "); | 301 | qDebug("Wrong offset2 "); |
309 | return days[0]; | 302 | return days[0]; |
310 | } | 303 | } |
311 | return days[offset]; | 304 | return days[offset]; |
312 | } | 305 | } |
313 | 306 | ||
314 | QString KODayMatrix::getHolidayLabel(int offset) | 307 | QString KODayMatrix::getHolidayLabel(int offset) |
315 | { | 308 | { |
316 | if (offset < 0 || offset > NUMDAYS-1) { | 309 | if (offset < 0 || offset > NUMDAYS-1) { |
317 | qDebug("Wrong offset1 "); | 310 | qDebug("Wrong offset1 "); |
318 | return 0; | 311 | return 0; |
319 | } | 312 | } |
320 | return mHolidays[offset]; | 313 | return mHolidays[offset]; |
321 | } | 314 | } |
322 | 315 | ||
323 | int KODayMatrix::getDayIndexFrom(int x, int y) | 316 | int KODayMatrix::getDayIndexFrom(int x, int y) |
324 | { | 317 | { |
325 | return 7*(y/daysize.height()) + (KOGlobals::self()->reverseLayout() ? | 318 | return 7*(y/daysize.height()) + (KOGlobals::self()->reverseLayout() ? |
326 | 6 - x/daysize.width() : x/daysize.width()); | 319 | 6 - x/daysize.width() : x/daysize.width()); |
327 | } | 320 | } |
328 | 321 | ||
329 | // ---------------------------------------------------------------------------- | 322 | // ---------------------------------------------------------------------------- |
330 | // M O U S E E V E N T H A N D L I N G | 323 | // M O U S E E V E N T H A N D L I N G |
331 | // ---------------------------------------------------------------------------- | 324 | // ---------------------------------------------------------------------------- |
332 | 325 | ||
333 | void KODayMatrix::mousePressEvent (QMouseEvent* e) | 326 | void KODayMatrix::mousePressEvent (QMouseEvent* e) |
334 | { | 327 | { |
335 | mSelStart = getDayIndexFrom(e->x(), e->y()); | 328 | mSelStart = getDayIndexFrom(e->x(), e->y()); |
336 | if (mSelStart > NUMDAYS-1) mSelStart=NUMDAYS-1; | 329 | if (mSelStart > NUMDAYS-1) mSelStart=NUMDAYS-1; |
337 | mSelInit = mSelStart; | 330 | mSelInit = mSelStart; |
338 | } | 331 | } |
339 | 332 | ||
340 | void KODayMatrix::mouseReleaseEvent (QMouseEvent* e) | 333 | void KODayMatrix::mouseReleaseEvent (QMouseEvent* e) |
341 | { | 334 | { |
342 | 335 | ||
343 | int tmp = getDayIndexFrom(e->x(), e->y()); | 336 | int tmp = getDayIndexFrom(e->x(), e->y()); |
344 | if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; | 337 | if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; |
345 | 338 | ||
346 | if (mSelInit > tmp) { | 339 | if (mSelInit > tmp) { |
347 | mSelEnd = mSelInit; | 340 | mSelEnd = mSelInit; |
348 | if (tmp != mSelStart) { | 341 | if (tmp != mSelStart) { |
349 | mSelStart = tmp; | 342 | mSelStart = tmp; |
350 | repaint(); | 343 | repaint(); |
351 | } | 344 | } |
352 | } else { | 345 | } else { |
353 | mSelStart = mSelInit; | 346 | mSelStart = mSelInit; |
354 | 347 | ||
355 | //repaint only if selection has changed | 348 | //repaint only if selection has changed |
356 | if (tmp != mSelEnd) { | 349 | if (tmp != mSelEnd) { |
357 | mSelEnd = tmp; | 350 | mSelEnd = tmp; |
358 | repaint(); | 351 | repaint(); |
359 | } | 352 | } |
360 | } | 353 | } |
361 | 354 | ||
362 | DateList daylist; | 355 | DateList daylist; |
363 | if ( mSelStart < 0 ) | 356 | if ( mSelStart < 0 ) |
364 | mSelStart = 0; | 357 | mSelStart = 0; |
365 | for (int i = mSelStart; i <= mSelEnd; i++) { | 358 | for (int i = mSelStart; i <= mSelEnd; i++) { |
366 | daylist.append(days[i]); | 359 | daylist.append(days[i]); |
367 | } | 360 | } |
368 | emit selected((const DateList)daylist); | 361 | emit selected((const DateList)daylist); |
369 | 362 | ||
370 | } | 363 | } |
371 | 364 | ||
372 | void KODayMatrix::mouseMoveEvent (QMouseEvent* e) | 365 | void KODayMatrix::mouseMoveEvent (QMouseEvent* e) |
373 | { | 366 | { |
374 | int tmp = getDayIndexFrom(e->x(), e->y()); | 367 | int tmp = getDayIndexFrom(e->x(), e->y()); |
375 | if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; | 368 | if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; |
376 | 369 | ||
377 | if (mSelInit > tmp) { | 370 | if (mSelInit > tmp) { |
378 | mSelEnd = mSelInit; | 371 | mSelEnd = mSelInit; |
379 | if (tmp != mSelStart) { | 372 | if (tmp != mSelStart) { |
380 | mSelStart = tmp; | 373 | mSelStart = tmp; |
381 | repaint(); | 374 | repaint(); |
382 | } | 375 | } |
383 | } else { | 376 | } else { |
384 | mSelStart = mSelInit; | 377 | mSelStart = mSelInit; |
385 | 378 | ||
386 | //repaint only if selection has changed | 379 | //repaint only if selection has changed |
387 | if (tmp != mSelEnd) { | 380 | if (tmp != mSelEnd) { |
388 | mSelEnd = tmp; | 381 | mSelEnd = tmp; |
389 | repaint(); | 382 | repaint(); |
390 | } | 383 | } |
391 | } | 384 | } |
392 | } | 385 | } |
393 | 386 | ||
394 | // ---------------------------------------------------------------------------- | 387 | // ---------------------------------------------------------------------------- |
395 | // D R A G ' N D R O P H A N D L I N G | 388 | // D R A G ' N D R O P H A N D L I N G |
396 | // ---------------------------------------------------------------------------- | 389 | // ---------------------------------------------------------------------------- |
397 | 390 | ||
398 | void KODayMatrix::dragEnterEvent(QDragEnterEvent *e) | 391 | void KODayMatrix::dragEnterEvent(QDragEnterEvent *e) |
399 | { | 392 | { |
400 | #ifndef KORG_NODND | 393 | #ifndef KORG_NODND |
401 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { | 394 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { |
402 | e->ignore(); | 395 | e->ignore(); |
403 | return; | 396 | return; |
404 | } | 397 | } |
405 | 398 | ||
406 | // some visual feedback | 399 | // some visual feedback |
407 | // oldPalette = palette(); | 400 | // oldPalette = palette(); |
408 | // setPalette(my_HilitePalette); | 401 | // setPalette(my_HilitePalette); |
409 | // update(); | 402 | // update(); |
410 | #endif | 403 | #endif |
411 | } | 404 | } |
412 | 405 | ||
413 | void KODayMatrix::dragMoveEvent(QDragMoveEvent *e) | 406 | void KODayMatrix::dragMoveEvent(QDragMoveEvent *e) |
414 | { | 407 | { |
415 | #ifndef KORG_NODND | 408 | #ifndef KORG_NODND |
416 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { | 409 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { |
417 | e->ignore(); | 410 | e->ignore(); |
418 | return; | 411 | return; |
419 | } | 412 | } |
420 | 413 | ||
421 | e->accept(); | 414 | e->accept(); |
422 | #endif | 415 | #endif |
423 | } | 416 | } |
424 | 417 | ||
425 | void KODayMatrix::dragLeaveEvent(QDragLeaveEvent */*dl*/) | 418 | void KODayMatrix::dragLeaveEvent(QDragLeaveEvent */*dl*/) |
426 | { | 419 | { |
427 | #ifndef KORG_NODND | 420 | #ifndef KORG_NODND |
428 | // setPalette(oldPalette); | 421 | // setPalette(oldPalette); |
429 | // update(); | 422 | // update(); |
430 | #endif | 423 | #endif |
431 | } | 424 | } |
432 | 425 | ||
433 | void KODayMatrix::dropEvent(QDropEvent *e) | 426 | void KODayMatrix::dropEvent(QDropEvent *e) |
434 | { | 427 | { |
435 | #ifndef KORG_NODND | 428 | #ifndef KORG_NODND |
436 | // kdDebug() << "KODayMatrix::dropEvent(e) begin" << endl; | 429 | // kdDebug() << "KODayMatrix::dropEvent(e) begin" << endl; |
437 | 430 | ||
438 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { | 431 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { |
439 | e->ignore(); | 432 | e->ignore(); |
440 | return; | 433 | return; |
441 | } | 434 | } |
442 | 435 | ||
443 | DndFactory factory( mCalendar ); | 436 | DndFactory factory( mCalendar ); |
444 | Event *event = factory.createDrop(e); | 437 | Event *event = factory.createDrop(e); |
445 | 438 | ||
446 | if (event) { | 439 | if (event) { |
447 | e->acceptAction(); | 440 | e->acceptAction(); |
448 | 441 | ||
449 | Event *existingEvent = mCalendar->event(event->uid()); | 442 | Event *existingEvent = mCalendar->event(event->uid()); |
450 | 443 | ||
451 | if(existingEvent) { | 444 | if(existingEvent) { |
452 | // uniquify event | 445 | // uniquify event |
453 | event->recreate(); | 446 | event->recreate(); |
454 | /* | 447 | /* |
455 | KMessageBox::sorry(this, | 448 | KMessageBox::sorry(this, |
456 | i18n("Event already exists in this calendar."), | 449 | i18n("Event already exists in this calendar."), |
457 | i18n("Drop Event")); | 450 | i18n("Drop Event")); |
458 | delete event; | 451 | delete event; |
459 | return; | 452 | return; |
460 | */ | 453 | */ |
461 | } | 454 | } |
462 | // kdDebug() << "Drop new Event" << endl; | 455 | // kdDebug() << "Drop new Event" << endl; |
463 | // Adjust date | 456 | // Adjust date |
464 | QDateTime start = event->dtStart(); | 457 | QDateTime start = event->dtStart(); |
465 | QDateTime end = event->dtEnd(); | 458 | QDateTime end = event->dtEnd(); |
466 | int duration = start.daysTo(end); | 459 | int duration = start.daysTo(end); |
467 | int idx = getDayIndexFrom(e->pos().x(), e->pos().y()); | 460 | int idx = getDayIndexFrom(e->pos().x(), e->pos().y()); |
468 | 461 | ||
469 | start.setDate(days[idx]); | 462 | start.setDate(days[idx]); |
470 | end.setDate(days[idx].addDays(duration)); | 463 | end.setDate(days[idx].addDays(duration)); |
471 | 464 | ||
472 | event->setDtStart(start); | 465 | event->setDtStart(start); |
473 | event->setDtEnd(end); | 466 | event->setDtEnd(end); |
474 | mCalendar->addEvent(event); | 467 | mCalendar->addEvent(event); |
475 | 468 | ||
476 | emit eventDropped(event); | 469 | emit eventDropped(event); |
477 | } else { | 470 | } else { |
478 | // kdDebug() << "KODayMatrix::dropEvent(): Event from drop not decodable" << endl; | 471 | // kdDebug() << "KODayMatrix::dropEvent(): Event from drop not decodable" << endl; |
479 | e->ignore(); | 472 | e->ignore(); |
480 | } | 473 | } |
481 | #endif | 474 | #endif |
482 | } | 475 | } |
483 | 476 | ||
484 | // ---------------------------------------------------------------------------- | 477 | // ---------------------------------------------------------------------------- |
485 | // P A I N T E V E N T H A N D L I N G | 478 | // P A I N T E V E N T H A N D L I N G |
486 | // ---------------------------------------------------------------------------- | 479 | // ---------------------------------------------------------------------------- |
487 | 480 | ||
488 | void KODayMatrix::paintEvent(QPaintEvent * pevent) | 481 | void KODayMatrix::paintEvent(QPaintEvent * pevent) |
489 | { | 482 | { |
490 | //kdDebug() << "KODayMatrix::paintEvent() BEGIN" << endl; | 483 | if ( width() <= 0 || height() <= 0 ) |
491 | if ( mPendingUpdateBeforeRepaint ) { | 484 | return; |
492 | updateViewTimed(); | 485 | if ( mPendingUpdateBeforeRepaint ) { |
493 | mPendingUpdateBeforeRepaint = false; | 486 | updateViewTimed(); |
487 | mPendingUpdateBeforeRepaint = false; | ||
488 | } | ||
489 | if ( myPix.width() != width() || myPix.height()!=height() ) { | ||
490 | myPix.resize(size() ); | ||
494 | } | 491 | } |
495 | QPainter p(this); | 492 | QPainter p(&myPix); |
496 | 493 | ||
497 | QRect sz = frameRect(); | 494 | QRect sz = frameRect(); |
498 | int dheight = daysize.height(); | 495 | int dheight = daysize.height(); |
499 | int dwidth = daysize.width(); | 496 | int dwidth = daysize.width(); |
500 | int row,col; | 497 | int row,col; |
501 | int selw, selh; | 498 | int selw, selh; |
502 | bool isRTL = KOGlobals::self()->reverseLayout(); | 499 | bool isRTL = KOGlobals::self()->reverseLayout(); |
503 | 500 | ||
504 | // draw background and topleft frame | 501 | // draw background and topleft frame |
505 | p.fillRect(pevent->rect(), mDefaultBackColor); | 502 | p.fillRect(pevent->rect(), mDefaultBackColor); |
506 | p.setPen(mDefaultTextColor); | 503 | p.setPen(mDefaultTextColor); |
507 | p.drawRect(0, 0, sz.width()+1, sz.height()+1); | 504 | p.drawRect(0, 0, sz.width()+1, sz.height()+1); |
508 | 505 | ||
509 | // draw selected days with highlighted background color | 506 | // draw selected days with highlighted background color |
510 | if (mSelStart != NOSELECTION) { | 507 | if (mSelStart != NOSELECTION) { |
511 | 508 | ||
512 | row = mSelStart/7; | 509 | row = mSelStart/7; |
513 | col = mSelStart -row*7; | 510 | col = mSelStart -row*7; |
514 | QColor selcol = KOPrefs::instance()->mHighlightColor; | 511 | QColor selcol = KOPrefs::instance()->mHighlightColor; |
515 | 512 | ||
516 | if (row == mSelEnd/7) { | 513 | if (row == mSelEnd/7) { |
517 | // Single row selection | 514 | // Single row selection |
518 | p.fillRect(isRTL ? (7 - (mSelEnd-mSelStart+1) - col)*dwidth : col*dwidth, | 515 | p.fillRect(isRTL ? (7 - (mSelEnd-mSelStart+1) - col)*dwidth : col*dwidth, |
519 | row*dheight, (mSelEnd-mSelStart+1)*dwidth, dheight, selcol); | 516 | row*dheight, (mSelEnd-mSelStart+1)*dwidth, dheight, selcol); |
520 | } else { | 517 | } else { |
521 | // draw first row to the right | 518 | // draw first row to the right |
522 | p.fillRect(isRTL ? 0 : col*dwidth, row*dheight, (7-col)*dwidth, | 519 | p.fillRect(isRTL ? 0 : col*dwidth, row*dheight, (7-col)*dwidth, |
523 | dheight, selcol); | 520 | dheight, selcol); |
524 | // draw full block till last line | 521 | // draw full block till last line |
525 | selh = mSelEnd/7-row; | 522 | selh = mSelEnd/7-row; |
526 | if (selh > 1) { | 523 | if (selh > 1) { |
527 | p.fillRect(0, (row+1)*dheight, 7*dwidth, (selh-1)*dheight,selcol); | 524 | p.fillRect(0, (row+1)*dheight, 7*dwidth, (selh-1)*dheight,selcol); |
528 | } | 525 | } |
529 | // draw last block from left to mSelEnd | 526 | // draw last block from left to mSelEnd |
530 | selw = mSelEnd-7*(mSelEnd/7)+1; | 527 | selw = mSelEnd-7*(mSelEnd/7)+1; |
531 | p.fillRect(isRTL ? (7-selw)*dwidth : 0, (row+selh)*dheight, | 528 | p.fillRect(isRTL ? (7-selw)*dwidth : 0, (row+selh)*dheight, |
532 | selw*dwidth, dheight, selcol); | 529 | selw*dwidth, dheight, selcol); |
533 | } | 530 | } |
534 | } | 531 | } |
535 | 532 | ||
536 | // iterate over all days in the matrix and draw the day label in appropriate colors | 533 | // iterate over all days in the matrix and draw the day label in appropriate colors |
537 | QColor actcol = mDefaultTextColorShaded; | 534 | QColor actcol = mDefaultTextColorShaded; |
538 | p.setPen(actcol); | 535 | p.setPen(actcol); |
539 | QPen tmppen; | 536 | QPen tmppen; |
540 | for(int i = 0; i < NUMDAYS; i++) { | 537 | for(int i = 0; i < NUMDAYS; i++) { |
541 | row = i/7; | 538 | row = i/7; |
542 | col = isRTL ? 6-(i-row*7) : i-row*7; | 539 | col = isRTL ? 6-(i-row*7) : i-row*7; |
543 | 540 | ||
544 | // if it is the first day of a month switch color from normal to shaded and vice versa | 541 | // if it is the first day of a month switch color from normal to shaded and vice versa |
545 | if ( KOGlobals::self()->calendarSystem()->day( days[i] ) == 1) { | 542 | if ( KOGlobals::self()->calendarSystem()->day( days[i] ) == 1) { |
546 | if (actcol == mDefaultTextColorShaded) { | 543 | if (actcol == mDefaultTextColorShaded) { |
547 | actcol = mDefaultTextColor; | 544 | actcol = mDefaultTextColor; |
548 | } else { | 545 | } else { |
549 | actcol = mDefaultTextColorShaded; | 546 | actcol = mDefaultTextColorShaded; |
547 | } | ||
548 | p.setPen(actcol); | ||
550 | } | 549 | } |
551 | p.setPen(actcol); | ||
552 | } | ||
553 | 550 | ||
554 | //Reset pen color after selected days block | 551 | //Reset pen color after selected days block |
555 | if (i == mSelEnd+1) { | 552 | if (i == mSelEnd+1) { |
556 | p.setPen(actcol); | 553 | p.setPen(actcol); |
557 | } | 554 | } |
555 | |||
556 | // if today then draw rectangle around day | ||
557 | if (today == i) { | ||
558 | tmppen = p.pen(); | ||
559 | QPen mTodayPen(p.pen()); | ||
560 | |||
561 | mTodayPen.setWidth(mTodayMarginWidth); | ||
562 | //draw red rectangle for holidays | ||
563 | if (!mHolidays[i].isNull()) { | ||
564 | if (actcol == mDefaultTextColor) { | ||
565 | mTodayPen.setColor(KOPrefs::instance()->mHolidayColor); | ||
566 | } else { | ||
567 | mTodayPen.setColor(mHolidayColorShaded); | ||
568 | } | ||
569 | } | ||
570 | //draw gray rectangle for today if in selection | ||
571 | if (i >= mSelStart && i <= mSelEnd) { | ||
572 | QColor grey("grey"); | ||
573 | mTodayPen.setColor(grey); | ||
574 | } | ||
575 | p.setPen(mTodayPen); | ||
576 | p.drawRect(col*dwidth, row*dheight, dwidth, dheight); | ||
577 | p.setPen(tmppen); | ||
578 | } | ||
558 | 579 | ||
559 | // if today then draw rectangle around day | 580 | // if any events are on that day then draw it using a bold font |
560 | if (today == i) { | 581 | if (events[i] > 0) { |
561 | tmppen = p.pen(); | 582 | QFont myFont = font(); |
562 | QPen mTodayPen(p.pen()); | 583 | myFont.setBold(true); |
584 | p.setFont(myFont); | ||
585 | } | ||
563 | 586 | ||
564 | mTodayPen.setWidth(mTodayMarginWidth); | 587 | // if it is a holiday then use the default holiday color |
565 | //draw red rectangle for holidays | ||
566 | if (!mHolidays[i].isNull()) { | 588 | if (!mHolidays[i].isNull()) { |
567 | if (actcol == mDefaultTextColor) { | 589 | if (actcol == mDefaultTextColor) { |
568 | mTodayPen.setColor(KOPrefs::instance()->mHolidayColor); | 590 | p.setPen(KOPrefs::instance()->mHolidayColor); |
569 | } else { | 591 | } else { |
570 | mTodayPen.setColor(mHolidayColorShaded); | 592 | p.setPen(mHolidayColorShaded); |
571 | } | 593 | } |
572 | } | 594 | } |
573 | //draw gray rectangle for today if in selection | 595 | |
596 | // draw selected days with special color | ||
597 | // DO NOT specially highlight holidays in selection ! | ||
574 | if (i >= mSelStart && i <= mSelEnd) { | 598 | if (i >= mSelStart && i <= mSelEnd) { |
575 | QColor grey("grey"); | 599 | p.setPen(mSelectedDaysColor); |
576 | mTodayPen.setColor(grey); | ||
577 | } | 600 | } |
578 | p.setPen(mTodayPen); | ||
579 | p.drawRect(col*dwidth, row*dheight, dwidth, dheight); | ||
580 | p.setPen(tmppen); | ||
581 | } | ||
582 | 601 | ||
583 | // if any events are on that day then draw it using a bold font | 602 | p.drawText(col*dwidth, row*dheight, dwidth, dheight, |
584 | if (events[i] > 0) { | 603 | Qt::AlignHCenter | Qt::AlignVCenter, daylbls[i]); |
585 | QFont myFont = font(); | ||
586 | myFont.setBold(true); | ||
587 | p.setFont(myFont); | ||
588 | } | ||
589 | 604 | ||
590 | // if it is a holiday then use the default holiday color | 605 | // reset color to actual color |
591 | if (!mHolidays[i].isNull()) { | 606 | if (!mHolidays[i].isNull()) { |
592 | if (actcol == mDefaultTextColor) { | 607 | p.setPen(actcol); |
593 | p.setPen(KOPrefs::instance()->mHolidayColor); | 608 | } |
594 | } else { | 609 | // reset bold font to plain font |
595 | p.setPen(mHolidayColorShaded); | 610 | if (events[i] > 0) { |
611 | QFont myFont = font(); | ||
612 | myFont.setBold(false); | ||
613 | p.setFont(myFont); | ||
596 | } | 614 | } |
597 | } | ||
598 | |||
599 | // draw selected days with special color | ||
600 | // DO NOT specially highlight holidays in selection ! | ||
601 | if (i >= mSelStart && i <= mSelEnd) { | ||
602 | p.setPen(mSelectedDaysColor); | ||
603 | } | ||
604 | |||
605 | p.drawText(col*dwidth, row*dheight, dwidth, dheight, | ||
606 | Qt::AlignHCenter | Qt::AlignVCenter, daylbls[i]); | ||
607 | |||
608 | // reset color to actual color | ||
609 | if (!mHolidays[i].isNull()) { | ||
610 | p.setPen(actcol); | ||
611 | } | ||
612 | // reset bold font to plain font | ||
613 | if (events[i] > 0) { | ||
614 | QFont myFont = font(); | ||
615 | myFont.setBold(false); | ||
616 | p.setFont(myFont); | ||
617 | } | ||
618 | } | 615 | } |
616 | bitBlt (this, 0, 0, &myPix, 0 ,0,width(), height() ,CopyROP); | ||
619 | } | 617 | } |
620 | 618 | ||
621 | // ---------------------------------------------------------------------------- | 619 | // ---------------------------------------------------------------------------- |
622 | // R E SI Z E E V E N T H A N D L I N G | 620 | // R E SI Z E E V E N T H A N D L I N G |
623 | // ---------------------------------------------------------------------------- | 621 | // ---------------------------------------------------------------------------- |
624 | 622 | ||
625 | void KODayMatrix::resizeEvent(QResizeEvent *) | 623 | void KODayMatrix::resizeEvent(QResizeEvent *) |
626 | { | 624 | { |
627 | QRect sz = frameRect(); | 625 | QRect sz = frameRect(); |
628 | daysize.setHeight(sz.height()*7 / NUMDAYS); | 626 | daysize.setHeight(sz.height()*7 / NUMDAYS); |
629 | daysize.setWidth(sz.width() / 7); | 627 | daysize.setWidth(sz.width() / 7); |
630 | } | 628 | } |
diff --git a/korganizer/kodaymatrix.h b/korganizer/kodaymatrix.h index ac2f59c..2dd112a 100644 --- a/korganizer/kodaymatrix.h +++ b/korganizer/kodaymatrix.h | |||
@@ -1,314 +1,316 @@ | |||
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 | #include <qpixmap.h> | ||
34 | 35 | ||
35 | #include <qmap.h> | 36 | #include <qmap.h> |
36 | 37 | ||
37 | class QDragEnterEvent; | 38 | class QDragEnterEvent; |
38 | class QDragMoveEvent; | 39 | class QDragMoveEvent; |
39 | class QDragLeaveEvent; | 40 | class QDragLeaveEvent; |
40 | class QDropEvent; | 41 | class QDropEvent; |
41 | 42 | ||
42 | class KODayMatrix; | 43 | class KODayMatrix; |
43 | 44 | ||
44 | using namespace KCal; | 45 | using namespace KCal; |
45 | 46 | ||
46 | 47 | ||
47 | /** | 48 | /** |
48 | * small helper class to dynamically show tooltips inside the day matrix. | 49 | * small helper class to dynamically show tooltips inside the day matrix. |
49 | * This class asks the day matrix object for a appropriate label which | 50 | * 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. | 51 | * is in our special case the name of the holiday or null if this day is no holiday. |
51 | */ | 52 | */ |
52 | class DynamicTip : public QToolTip | 53 | class DynamicTip : public QToolTip |
53 | { | 54 | { |
54 | public: | 55 | public: |
55 | 56 | ||
56 | /** | 57 | /** |
57 | * Constructor that expects a KODayMatrix object as parent. | 58 | * Constructor that expects a KODayMatrix object as parent. |
58 | * | 59 | * |
59 | * @param parent the parent KODayMatrix control. | 60 | * @param parent the parent KODayMatrix control. |
60 | */ | 61 | */ |
61 | DynamicTip(QWidget* parent ); | 62 | DynamicTip(QWidget* parent ); |
62 | 63 | ||
63 | protected: | 64 | protected: |
64 | 65 | ||
65 | /** | 66 | /** |
66 | * Qt's callback to ask the object to provide an approrpiate text for the | 67 | * Qt's callback to ask the object to provide an approrpiate text for the |
67 | * tooltip to be shown. | 68 | * tooltip to be shown. |
68 | * | 69 | * |
69 | * @param pos coordinates of the mouse. | 70 | * @param pos coordinates of the mouse. |
70 | */ | 71 | */ |
71 | void maybeTip( const QPoint & pos); | 72 | void maybeTip( const QPoint & pos); |
72 | 73 | ||
73 | private: | 74 | private: |
74 | 75 | ||
75 | /** the parent control this tooltip is designed for. */ | 76 | /** the parent control this tooltip is designed for. */ |
76 | KODayMatrix* matrix; | 77 | KODayMatrix* matrix; |
77 | }; | 78 | }; |
78 | 79 | ||
79 | /** | 80 | /** |
80 | * replacement for kdpdatebuton.cpp that used 42 widgets for the day matrix to be displayed. | 81 | * 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. | 82 | * 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 | 83 | * 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 | 84 | * that draws the labels and allows for dragging selection while maintaining nearly full |
84 | * compatibility in behaviour with its predecessor. | 85 | * compatibility in behaviour with its predecessor. |
85 | * | 86 | * |
86 | * The following functionality has been changed: | 87 | * The following functionality has been changed: |
87 | * | 88 | * |
88 | * o when shifting events in the agenda view from one day to another the day matrix is updated now | 89 | * 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. | 90 | * 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 | 91 | * 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 | 92 | * (This has not really been supported in the predecessor. It was not very intuitive nor was it |
92 | * user friendly.) | 93 | * user friendly.) |
93 | * This feature has been replaced with dragging a selection on the matrix. The matrix will | 94 | * 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 | 95 | * 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) | 96 | * 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 | 97 | * 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 | 98 | * 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 | 99 | * adjust the selection and leave some days undisplayed while scrolling through the months |
99 | * | 100 | * |
100 | * @short day matrix widget of the KDateNavigator | 101 | * @short day matrix widget of the KDateNavigator |
101 | * | 102 | * |
102 | * @author Eitzenberger Thomas | 103 | * @author Eitzenberger Thomas |
103 | */ | 104 | */ |
104 | class KODayMatrix: public QFrame { | 105 | class KODayMatrix: public QFrame { |
105 | 106 | ||
106 | Q_OBJECT | 107 | Q_OBJECT |
107 | 108 | ||
108 | public: | 109 | public: |
109 | 110 | ||
110 | /** constructor to create a day matrix widget. | 111 | /** constructor to create a day matrix widget. |
111 | * | 112 | * |
112 | * @param parent widget that is the parent of the day matrix. Normally this should | 113 | * @param parent widget that is the parent of the day matrix. Normally this should |
113 | * be a KDateNavigator | 114 | * be a KDateNavigator |
114 | * @param calendar instance of a calendar on which all calculations are based | 115 | * @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 | 116 | * @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. | 117 | * assumed that this date is the first week day to be shown in the matrix. |
117 | * @param name name of the widget | 118 | * @param name name of the widget |
118 | */ | 119 | */ |
119 | KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name ); | 120 | KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name ); |
120 | 121 | ||
121 | /** destructor that deallocates all dynamically allocated private members. | 122 | /** destructor that deallocates all dynamically allocated private members. |
122 | */ | 123 | */ |
123 | ~KODayMatrix(); | 124 | ~KODayMatrix(); |
124 | 125 | ||
125 | /** updates the day matrix to start with the given date. Does all the necessary | 126 | /** 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. | 127 | * 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. | 128 | * Does NOT update the view visually. Call repaint() for this. |
128 | * | 129 | * |
129 | * @param actdate recalculates the day matrix to show NUMDAYS starting from this | 130 | * @param actdate recalculates the day matrix to show NUMDAYS starting from this |
130 | * date. | 131 | * date. |
131 | */ | 132 | */ |
132 | void updateView(QDate actdate); | 133 | void updateView(QDate actdate); |
133 | 134 | ||
134 | /** returns the QDate object associated with day indexed by the | 135 | /** returns the QDate object associated with day indexed by the |
135 | * supplied offset. | 136 | * supplied offset. |
136 | */ | 137 | */ |
137 | const QDate& getDate(int offset); | 138 | const QDate& getDate(int offset); |
138 | 139 | ||
139 | /** returns the official name of this holy day or 0 if there is no label | 140 | /** returns the official name of this holy day or 0 if there is no label |
140 | * for this day. | 141 | * for this day. |
141 | */ | 142 | */ |
142 | QString getHolidayLabel(int offset); | 143 | QString getHolidayLabel(int offset); |
143 | 144 | ||
144 | /** adds all actual selected days from mSelStart to mSelEnd to the supplied | 145 | /** adds all actual selected days from mSelStart to mSelEnd to the supplied |
145 | * DateList. | 146 | * DateList. |
146 | */ | 147 | */ |
147 | void addSelectedDaysTo(DateList&); | 148 | void addSelectedDaysTo(DateList&); |
148 | 149 | ||
149 | /** sets the actual to be displayed selection in the day matrix starting from | 150 | /** 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 | 151 | * start and ending with end. Theview must be manually updated by calling |
151 | * repaint. (?) | 152 | * repaint. (?) |
152 | */ | 153 | */ |
153 | void setSelectedDaysFrom(const QDate& start, const QDate& end); | 154 | void setSelectedDaysFrom(const QDate& start, const QDate& end); |
154 | 155 | ||
155 | 156 | ||
156 | /** Is today visible in the view? Keep this in sync with | 157 | /** Is today visible in the view? Keep this in sync with |
157 | * the values today (below) can take. | 158 | * the values today (below) can take. |
158 | */ | 159 | */ |
159 | bool isTodayVisible() const { return today>=0; } ; | 160 | bool isTodayVisible() const { return today>=0; } ; |
160 | 161 | ||
161 | /** If today is visible, then we can find out if today is | 162 | /** If today is visible, then we can find out if today is |
162 | * near the beginning or the end of the month. | 163 | * near the beginning or the end of the month. |
163 | * This is dependent on today remaining the index | 164 | * This is dependent on today remaining the index |
164 | * in the array of visible dates and going from | 165 | * in the array of visible dates and going from |
165 | * top left (0) to bottom right (41). | 166 | * top left (0) to bottom right (41). |
166 | */ | 167 | */ |
167 | bool isBeginningOfMonth() const { return today<=8; } ; | 168 | bool isBeginningOfMonth() const { return today<=8; } ; |
168 | bool isEndOfMonth() const { return today>=27; } ; | 169 | bool isEndOfMonth() const { return today>=27; } ; |
169 | 170 | ||
170 | public slots: | 171 | public slots: |
171 | /** Recalculates all the flags of the days in the matrix like holidays or events | 172 | /** 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). | 173 | * on a day (Actually calls above method with the actual startdate). |
173 | */ | 174 | */ |
174 | void updateView(); | 175 | void updateView(); |
175 | void updateViewTimed(); | 176 | void updateViewTimed(); |
176 | void repaintViewTimed(); | 177 | void repaintViewTimed(); |
177 | 178 | ||
178 | /** | 179 | /** |
179 | * Calculate which square in the matrix should be | 180 | * Calculate which square in the matrix should be |
180 | * hilighted to indicate it's today. | 181 | * hilighted to indicate it's today. |
181 | */ | 182 | */ |
182 | void recalculateToday(); | 183 | void recalculateToday(); |
183 | 184 | ||
184 | /* | 185 | /* |
185 | void setStartDate(QDate); | 186 | void setStartDate(QDate); |
186 | */ | 187 | */ |
187 | 188 | ||
188 | signals: | 189 | signals: |
189 | 190 | ||
190 | /** emitted if the user selects a block of days with the mouse by dragging a rectangle | 191 | /** emitted if the user selects a block of days with the mouse by dragging a rectangle |
191 | * inside the matrix | 192 | * inside the matrix |
192 | * | 193 | * |
193 | * @param daylist list of days that have been selected by the user | 194 | * @param daylist list of days that have been selected by the user |
194 | */ | 195 | */ |
195 | void selected( const KCal::DateList &daylist ); | 196 | void selected( const KCal::DateList &daylist ); |
196 | 197 | ||
197 | /** emitted if the user has dropped an event inside the matrix | 198 | /** emitted if the user has dropped an event inside the matrix |
198 | * | 199 | * |
199 | * @param event the dropped calendar event | 200 | * @param event the dropped calendar event |
200 | */ | 201 | */ |
201 | void eventDropped(Event *event); | 202 | void eventDropped(Event *event); |
202 | 203 | ||
203 | protected: | 204 | protected: |
204 | 205 | ||
205 | void paintEvent(QPaintEvent *ev); | 206 | void paintEvent(QPaintEvent *ev); |
206 | 207 | ||
207 | void mousePressEvent (QMouseEvent* e); | 208 | void mousePressEvent (QMouseEvent* e); |
208 | 209 | ||
209 | void mouseReleaseEvent (QMouseEvent* e); | 210 | void mouseReleaseEvent (QMouseEvent* e); |
210 | 211 | ||
211 | void mouseMoveEvent (QMouseEvent* e); | 212 | void mouseMoveEvent (QMouseEvent* e); |
212 | 213 | ||
213 | void dragEnterEvent(QDragEnterEvent *); | 214 | void dragEnterEvent(QDragEnterEvent *); |
214 | 215 | ||
215 | void dragMoveEvent(QDragMoveEvent *); | 216 | void dragMoveEvent(QDragMoveEvent *); |
216 | 217 | ||
217 | void dragLeaveEvent(QDragLeaveEvent *); | 218 | void dragLeaveEvent(QDragLeaveEvent *); |
218 | 219 | ||
219 | void dropEvent(QDropEvent *); | 220 | void dropEvent(QDropEvent *); |
220 | 221 | ||
221 | void resizeEvent(QResizeEvent *); | 222 | void resizeEvent(QResizeEvent *); |
222 | 223 | ||
223 | private: | 224 | private: |
225 | QPixmap myPix; | ||
224 | QTimer* mUpdateTimer; | 226 | QTimer* mUpdateTimer; |
225 | QTimer* mRepaintTimer; | 227 | QTimer* mRepaintTimer; |
226 | bool mDayChanged; | 228 | bool mDayChanged; |
227 | bool mPendingUpdateBeforeRepaint; | 229 | bool mPendingUpdateBeforeRepaint; |
228 | 230 | ||
229 | /** returns the index of the day located at the matrix's widget (x,y) position. | 231 | /** returns the index of the day located at the matrix's widget (x,y) position. |
230 | * | 232 | * |
231 | * @param x horizontal coordinate | 233 | * @param x horizontal coordinate |
232 | * @param y vertical coordinate | 234 | * @param y vertical coordinate |
233 | */ | 235 | */ |
234 | int getDayIndexFrom(int x, int y); | 236 | int getDayIndexFrom(int x, int y); |
235 | 237 | ||
236 | /** calculates a "shaded" color from the supplied color object. | 238 | /** calculates a "shaded" color from the supplied color object. |
237 | * (Copied from Cornelius's kdpdatebutton.cpp) | 239 | * (Copied from Cornelius's kdpdatebutton.cpp) |
238 | * | 240 | * |
239 | * @param color source based on which a shaded color should be calculated. | 241 | * @param color source based on which a shaded color should be calculated. |
240 | */ | 242 | */ |
241 | QColor getShadedColor(QColor color); | 243 | QColor getShadedColor(QColor color); |
242 | 244 | ||
243 | /** number of days to be displayed. For now there is no support for any other number then 42. | 245 | /** number of days to be displayed. For now there is no support for any other number then 42. |
244 | so change it at your own risk :o) */ | 246 | so change it at your own risk :o) */ |
245 | static const int NUMDAYS; | 247 | static const int NUMDAYS; |
246 | 248 | ||
247 | /** calendar instance to be queried for holidays, events, ... */ | 249 | /** calendar instance to be queried for holidays, events, ... */ |
248 | Calendar *mCalendar; | 250 | Calendar *mCalendar; |
249 | 251 | ||
250 | /** starting date of the matrix */ | 252 | /** starting date of the matrix */ |
251 | QDate startdate; | 253 | QDate startdate; |
252 | 254 | ||
253 | /** array of day labels to optimeize drawing performance. */ | 255 | /** array of day labels to optimeize drawing performance. */ |
254 | QString *daylbls; | 256 | QString *daylbls; |
255 | 257 | ||
256 | /** array of days displayed to reduce memory consumption by | 258 | /** array of days displayed to reduce memory consumption by |
257 | subsequently calling QDate::addDays(). */ | 259 | subsequently calling QDate::addDays(). */ |
258 | QDate *days; | 260 | QDate *days; |
259 | 261 | ||
260 | /** array of storing the number of events on a given day. | 262 | /** array of storing the number of events on a given day. |
261 | * used for drawing a bold font if there is at least one event on that day. | 263 | * used for drawing a bold font if there is at least one event on that day. |
262 | */ | 264 | */ |
263 | int *events; | 265 | int *events; |
264 | 266 | ||
265 | /** stores holiday names of the days shown in the matrix. */ | 267 | /** stores holiday names of the days shown in the matrix. */ |
266 | QMap<int,QString> mHolidays; | 268 | QMap<int,QString> mHolidays; |
267 | 269 | ||
268 | /** indey of today or -1 if today is not visible in the matrix. */ | 270 | /** indey of today or -1 if today is not visible in the matrix. */ |
269 | int today; | 271 | int today; |
270 | 272 | ||
271 | /** index of day where dragged selection was initiated. | 273 | /** index of day where dragged selection was initiated. |
272 | used to detect "negative" timely selections */ | 274 | used to detect "negative" timely selections */ |
273 | int mSelInit; | 275 | int mSelInit; |
274 | 276 | ||
275 | /** if mSelStart has this value it indicates that there is no | 277 | /** if mSelStart has this value it indicates that there is no |
276 | actual selection in the matrix. */ | 278 | actual selection in the matrix. */ |
277 | static const int NOSELECTION; | 279 | static const int NOSELECTION; |
278 | 280 | ||
279 | /** index of first selected day. */ | 281 | /** index of first selected day. */ |
280 | int mSelStart; | 282 | int mSelStart; |
281 | 283 | ||
282 | /** index of last selected day. */ | 284 | /** index of last selected day. */ |
283 | int mSelEnd; | 285 | int mSelEnd; |
284 | 286 | ||
285 | /** dynamic tooltip to handle mouse dependent tips for each day in the matrix. */ | 287 | /** dynamic tooltip to handle mouse dependent tips for each day in the matrix. */ |
286 | DynamicTip* mToolTip; | 288 | DynamicTip* mToolTip; |
287 | 289 | ||
288 | 290 | ||
289 | /** default background colour of the matrix. */ | 291 | /** default background colour of the matrix. */ |
290 | QColor mDefaultBackColor; | 292 | QColor mDefaultBackColor; |
291 | 293 | ||
292 | /** default text color of the matrix. */ | 294 | /** default text color of the matrix. */ |
293 | QColor mDefaultTextColor; | 295 | QColor mDefaultTextColor; |
294 | 296 | ||
295 | /** default text color for days not in the actual month. */ | 297 | /** default text color for days not in the actual month. */ |
296 | QColor mDefaultTextColorShaded; | 298 | QColor mDefaultTextColorShaded; |
297 | 299 | ||
298 | /** default text color for holidays not in the actual month. */ | 300 | /** default text color for holidays not in the actual month. */ |
299 | QColor mHolidayColorShaded; | 301 | QColor mHolidayColorShaded; |
300 | 302 | ||
301 | /** text color for selected days. */ | 303 | /** text color for selected days. */ |
302 | QColor mSelectedDaysColor; | 304 | QColor mSelectedDaysColor; |
303 | 305 | ||
304 | /** default width of the frame drawn around today if it is visible in the matrix. */ | 306 | /** default width of the frame drawn around today if it is visible in the matrix. */ |
305 | int mTodayMarginWidth; | 307 | int mTodayMarginWidth; |
306 | 308 | ||
307 | /** stores actual size of each day in the widget so that I dont need to ask this data | 309 | /** stores actual size of each day in the widget so that I dont need to ask this data |
308 | * on every repaint. | 310 | * on every repaint. |
309 | */ | 311 | */ |
310 | QRect daysize; | 312 | QRect daysize; |
311 | 313 | ||
312 | }; | 314 | }; |
313 | 315 | ||
314 | #endif | 316 | #endif |
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 4cff23a..6411156 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -1,1269 +1,1269 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <qpopupmenu.h> | 20 | #include <qpopupmenu.h> |
21 | #include <qfont.h> | 21 | #include <qfont.h> |
22 | #include <qfontmetrics.h> | 22 | #include <qfontmetrics.h> |
23 | #include <qkeycode.h> | 23 | #include <qkeycode.h> |
24 | #include <qhbox.h> | 24 | #include <qhbox.h> |
25 | #include <qvbox.h> | 25 | #include <qvbox.h> |
26 | #include <qpushbutton.h> | 26 | #include <qpushbutton.h> |
27 | #include <qtooltip.h> | 27 | #include <qtooltip.h> |
28 | #include <qpainter.h> | 28 | #include <qpainter.h> |
29 | #include <qwhatsthis.h> | 29 | #include <qwhatsthis.h> |
30 | #ifndef DESKTOP_VERSION | 30 | #ifndef DESKTOP_VERSION |
31 | #include <qpe/qpeapplication.h> | 31 | #include <qpe/qpeapplication.h> |
32 | #else | 32 | #else |
33 | #include <qapplication.h> | 33 | #include <qapplication.h> |
34 | #endif | 34 | #endif |
35 | 35 | ||
36 | #include <kdebug.h> | 36 | #include <kdebug.h> |
37 | #include <klocale.h> | 37 | #include <klocale.h> |
38 | #include <kglobal.h> | 38 | #include <kglobal.h> |
39 | #include <kconfig.h> | 39 | #include <kconfig.h> |
40 | #include <kiconloader.h> | 40 | #include <kiconloader.h> |
41 | 41 | ||
42 | #include <kcalendarsystem.h> | 42 | #include <kcalendarsystem.h> |
43 | 43 | ||
44 | #ifndef KORG_NOPRINTER | 44 | #ifndef KORG_NOPRINTER |
45 | #include "calprinter.h" | 45 | #include "calprinter.h" |
46 | #endif | 46 | #endif |
47 | #include "koprefs.h" | 47 | #include "koprefs.h" |
48 | #ifndef KORG_NOPLUGINS | 48 | #ifndef KORG_NOPLUGINS |
49 | #include "kocore.h" | 49 | #include "kocore.h" |
50 | #endif | 50 | #endif |
51 | #include "koglobals.h" | 51 | #include "koglobals.h" |
52 | #include <libkcal/kincidenceformatter.h> | 52 | #include <libkcal/kincidenceformatter.h> |
53 | 53 | ||
54 | #include "komonthview.h" | 54 | #include "komonthview.h" |
55 | 55 | ||
56 | #define PIXMAP_SIZE 5 | 56 | #define PIXMAP_SIZE 5 |
57 | #ifdef DESKTOP_VERSION | 57 | #ifdef DESKTOP_VERSION |
58 | QToolTipGroup *MonthViewCell::mToolTipGroup = 0; | 58 | QToolTipGroup *MonthViewCell::mToolTipGroup = 0; |
59 | #endif | 59 | #endif |
60 | class KNOWhatsThis :public QWhatsThis | 60 | class KNOWhatsThis :public QWhatsThis |
61 | { | 61 | { |
62 | public: | 62 | public: |
63 | KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; | 63 | KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; |
64 | //~KNOWhatsThis( ) {qDebug("~KNOWhatsThis( ) "); }; | 64 | //~KNOWhatsThis( ) {qDebug("~KNOWhatsThis( ) "); }; |
65 | 65 | ||
66 | protected: | 66 | protected: |
67 | virtual QString text( const QPoint& p) | 67 | virtual QString text( const QPoint& p) |
68 | { | 68 | { |
69 | return _wid->getWhatsThisText(p) ; | 69 | return _wid->getWhatsThisText(p) ; |
70 | }; | 70 | }; |
71 | private: | 71 | private: |
72 | KNoScrollListBox* _wid; | 72 | KNoScrollListBox* _wid; |
73 | 73 | ||
74 | }; | 74 | }; |
75 | 75 | ||
76 | 76 | ||
77 | KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) | 77 | KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) |
78 | : QListBox(parent, name, WRepaintNoErase) | 78 | : QListBox(parent, name, WRepaintNoErase) |
79 | { | 79 | { |
80 | #ifndef DESKTOP_VERSION | 80 | #ifndef DESKTOP_VERSION |
81 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 81 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
82 | #endif | 82 | #endif |
83 | mWT = new KNOWhatsThis(this); | 83 | mWT = new KNOWhatsThis(this); |
84 | } | 84 | } |
85 | KNoScrollListBox::~KNoScrollListBox() | 85 | KNoScrollListBox::~KNoScrollListBox() |
86 | { | 86 | { |
87 | 87 | ||
88 | } | 88 | } |
89 | QString KNoScrollListBox::getWhatsThisText(QPoint p) | 89 | QString KNoScrollListBox::getWhatsThisText(QPoint p) |
90 | { | 90 | { |
91 | QListBoxItem* item = itemAt ( p ); | 91 | QListBoxItem* item = itemAt ( p ); |
92 | if ( ! item ) { | 92 | if ( ! item ) { |
93 | return i18n("Click in the cell\nto add an event!"); | 93 | return i18n("Click in the cell\nto add an event!"); |
94 | } | 94 | } |
95 | return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence()); | 95 | return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence()); |
96 | } | 96 | } |
97 | void KNoScrollListBox::keyPressEvent(QKeyEvent *e) | 97 | void KNoScrollListBox::keyPressEvent(QKeyEvent *e) |
98 | { | 98 | { |
99 | 99 | ||
100 | switch(e->key()) { | 100 | switch(e->key()) { |
101 | case Key_Right: | 101 | case Key_Right: |
102 | // if ( e->state() == Qt::ControlButton ) | 102 | // if ( e->state() == Qt::ControlButton ) |
103 | { | 103 | { |
104 | e->ignore(); | 104 | e->ignore(); |
105 | return; | 105 | return; |
106 | } | 106 | } |
107 | scrollBy(4,0); | 107 | scrollBy(4,0); |
108 | break; | 108 | break; |
109 | case Key_Left: | 109 | case Key_Left: |
110 | // if ( e->state() == Qt::ControlButton ) | 110 | // if ( e->state() == Qt::ControlButton ) |
111 | { | 111 | { |
112 | e->ignore(); | 112 | e->ignore(); |
113 | return; | 113 | return; |
114 | } | 114 | } |
115 | scrollBy(-4,0); | 115 | scrollBy(-4,0); |
116 | break; | 116 | break; |
117 | case Key_Up: | 117 | case Key_Up: |
118 | if(count() < 2) { | 118 | if(count() < 2) { |
119 | e->ignore(); | 119 | e->ignore(); |
120 | break; | 120 | break; |
121 | } | 121 | } |
122 | setCurrentItem((currentItem()+count()-1)%count()); | 122 | setCurrentItem((currentItem()+count()-1)%count()); |
123 | if(!itemVisible(currentItem())) { | 123 | if(!itemVisible(currentItem())) { |
124 | if((unsigned int) currentItem() == (count()-1)) { | 124 | if((unsigned int) currentItem() == (count()-1)) { |
125 | setTopItem(currentItem()-numItemsVisible()+1); | 125 | setTopItem(currentItem()-numItemsVisible()+1); |
126 | } else { | 126 | } else { |
127 | setTopItem(topItem()-1); | 127 | setTopItem(topItem()-1); |
128 | } | 128 | } |
129 | } | 129 | } |
130 | break; | 130 | break; |
131 | case Key_Down: | 131 | case Key_Down: |
132 | if(count() < 2) { | 132 | if(count() < 2) { |
133 | e->ignore(); | 133 | e->ignore(); |
134 | break; | 134 | break; |
135 | } | 135 | } |
136 | setCurrentItem((currentItem()+1)%count()); | 136 | setCurrentItem((currentItem()+1)%count()); |
137 | if(!itemVisible(currentItem())) { | 137 | if(!itemVisible(currentItem())) { |
138 | if(currentItem() == 0) { | 138 | if(currentItem() == 0) { |
139 | setTopItem(0); | 139 | setTopItem(0); |
140 | } else { | 140 | } else { |
141 | setTopItem(topItem()+1); | 141 | setTopItem(topItem()+1); |
142 | } | 142 | } |
143 | } | 143 | } |
144 | break; | 144 | break; |
145 | case Key_Shift: | 145 | case Key_Shift: |
146 | emit shiftDown(); | 146 | emit shiftDown(); |
147 | break; | 147 | break; |
148 | default: | 148 | default: |
149 | e->ignore(); | 149 | e->ignore(); |
150 | break; | 150 | break; |
151 | } | 151 | } |
152 | } | 152 | } |
153 | 153 | ||
154 | void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) | 154 | void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) |
155 | { | 155 | { |
156 | switch(e->key()) { | 156 | switch(e->key()) { |
157 | case Key_Shift: | 157 | case Key_Shift: |
158 | emit shiftUp(); | 158 | emit shiftUp(); |
159 | break; | 159 | break; |
160 | default: | 160 | default: |
161 | break; | 161 | break; |
162 | } | 162 | } |
163 | } | 163 | } |
164 | 164 | ||
165 | void KNoScrollListBox::mousePressEvent(QMouseEvent *e) | 165 | void KNoScrollListBox::mousePressEvent(QMouseEvent *e) |
166 | { | 166 | { |
167 | QListBox::mousePressEvent(e); | 167 | QListBox::mousePressEvent(e); |
168 | 168 | ||
169 | if(e->button() == RightButton) { | 169 | if(e->button() == RightButton) { |
170 | emit rightClick(); | 170 | emit rightClick(); |
171 | } | 171 | } |
172 | } | 172 | } |
173 | 173 | ||
174 | MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) | 174 | MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) |
175 | : QListBoxItem() | 175 | : QListBoxItem() |
176 | { | 176 | { |
177 | setText( s ); | 177 | setText( s ); |
178 | 178 | ||
179 | mIncidence = incidence; | 179 | mIncidence = incidence; |
180 | mDate = qd; | 180 | mDate = qd; |
181 | // QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); | 181 | // QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); |
182 | mRecur = false; | 182 | mRecur = false; |
183 | mAlarm = false; | 183 | mAlarm = false; |
184 | mReply = false; | 184 | mReply = false; |
185 | mInfo = false; | 185 | mInfo = false; |
186 | } | 186 | } |
187 | 187 | ||
188 | void MonthViewItem::paint(QPainter *p) | 188 | void MonthViewItem::paint(QPainter *p) |
189 | { | 189 | { |
190 | #if QT_VERSION >= 0x030000 | 190 | #if QT_VERSION >= 0x030000 |
191 | bool sel = isSelected(); | 191 | bool sel = isSelected(); |
192 | #else | 192 | #else |
193 | bool sel = selected(); | 193 | bool sel = selected(); |
194 | #endif | 194 | #endif |
195 | 195 | ||
196 | 196 | ||
197 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) | 197 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) |
198 | { | 198 | { |
199 | p->setBackgroundColor( palette().color( QPalette::Normal, \ | 199 | p->setBackgroundColor( palette().color( QPalette::Normal, \ |
200 | sel ? QColorGroup::Highlight : QColorGroup::Background ) ); | 200 | sel ? QColorGroup::Highlight : QColorGroup::Background ) ); |
201 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); | 201 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); |
202 | } | 202 | } |
203 | int x = 1; | 203 | int x = 1; |
204 | int y = 3;//(height() - mRecurPixmap.height()) /2; | 204 | int y = 3;//(height() - mRecurPixmap.height()) /2; |
205 | int size = PIXMAP_SIZE; | 205 | int size = PIXMAP_SIZE; |
206 | if ( QApplication::desktop()->width() < 300 ) | 206 | if ( QApplication::desktop()->width() < 300 ) |
207 | size = 3; | 207 | size = 3; |
208 | if ( KOPrefs::instance()->mMonthShowIcons ) { | 208 | if ( KOPrefs::instance()->mMonthShowIcons ) { |
209 | if ( mInfo ) { | 209 | if ( mInfo ) { |
210 | p->fillRect ( x, y,size,size, Qt::darkGreen ); | 210 | p->fillRect ( x, y,size,size, Qt::darkGreen ); |
211 | x += size + 1; | 211 | x += size + 1; |
212 | } | 212 | } |
213 | if ( mRecur ) { | 213 | if ( mRecur ) { |
214 | p->fillRect ( x, y,size,size, Qt::blue ); | 214 | p->fillRect ( x, y,size,size, Qt::blue ); |
215 | x += size + 1; | 215 | x += size + 1; |
216 | } | 216 | } |
217 | if ( mAlarm ) { | 217 | if ( mAlarm ) { |
218 | p->fillRect ( x, y,size,size, Qt::red ); | 218 | p->fillRect ( x, y,size,size, Qt::red ); |
219 | x += size + 1; | 219 | x += size + 1; |
220 | } | 220 | } |
221 | if ( mReply ) { | 221 | if ( mReply ) { |
222 | p->fillRect ( x, y,size,size, Qt::yellow ); | 222 | p->fillRect ( x, y,size,size, Qt::yellow ); |
223 | x += size + 1; | 223 | x += size + 1; |
224 | } | 224 | } |
225 | } | 225 | } |
226 | QFontMetrics fm = p->fontMetrics(); | 226 | QFontMetrics fm = p->fontMetrics(); |
227 | int yPos; | 227 | int yPos; |
228 | int pmheight = size; | 228 | int pmheight = size; |
229 | if( pmheight < fm.height() ) | 229 | if( pmheight < fm.height() ) |
230 | yPos = fm.ascent() + fm.leading()/2; | 230 | yPos = fm.ascent() + fm.leading()/2; |
231 | else | 231 | else |
232 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); | 232 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); |
233 | p->setPen( palette().color( QPalette::Normal, sel ? \ | 233 | p->setPen( palette().color( QPalette::Normal, sel ? \ |
234 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); | 234 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); |
235 | p->drawText( x, yPos, text() ); | 235 | p->drawText( x, yPos, text() ); |
236 | if ( mIncidence->cancelled() ) { | 236 | if ( mIncidence->cancelled() ) { |
237 | int wid = fm.width( text() ); | 237 | int wid = fm.width( text() ); |
238 | p->drawLine( x, yPos- fm.height()/2+2,x+wid, yPos- fm.height()/2 +2); | 238 | p->drawLine( x, yPos- fm.height()/2+2,x+wid, yPos- fm.height()/2 +2); |
239 | } | 239 | } |
240 | 240 | ||
241 | } | 241 | } |
242 | 242 | ||
243 | int MonthViewItem::height(const QListBox *lb) const | 243 | int MonthViewItem::height(const QListBox *lb) const |
244 | { | 244 | { |
245 | return lb->fontMetrics().lineSpacing()+1; | 245 | return lb->fontMetrics().lineSpacing()+1; |
246 | } | 246 | } |
247 | 247 | ||
248 | int MonthViewItem::width(const QListBox *lb) const | 248 | int MonthViewItem::width(const QListBox *lb) const |
249 | { | 249 | { |
250 | int size = PIXMAP_SIZE; | 250 | int size = PIXMAP_SIZE; |
251 | if ( QApplication::desktop()->width() < 300 ) | 251 | if ( QApplication::desktop()->width() < 300 ) |
252 | size = 3; | 252 | size = 3; |
253 | int x = 1; | 253 | int x = 1; |
254 | if ( mInfo ) { | 254 | if ( mInfo ) { |
255 | x += size + 1; | 255 | x += size + 1; |
256 | } | 256 | } |
257 | if( mRecur ) { | 257 | if( mRecur ) { |
258 | x += size+1; | 258 | x += size+1; |
259 | } | 259 | } |
260 | if( mAlarm ) { | 260 | if( mAlarm ) { |
261 | x += size+1; | 261 | x += size+1; |
262 | } | 262 | } |
263 | if( mReply ) { | 263 | if( mReply ) { |
264 | x += size+1; | 264 | x += size+1; |
265 | } | 265 | } |
266 | 266 | ||
267 | return( x + lb->fontMetrics().width( text() ) + 1 ); | 267 | return( x + lb->fontMetrics().width( text() ) + 1 ); |
268 | } | 268 | } |
269 | 269 | ||
270 | 270 | ||
271 | MonthViewCell::MonthViewCell( KOMonthView *parent) | 271 | MonthViewCell::MonthViewCell( KOMonthView *parent) |
272 | : QWidget( parent ), | 272 | : QWidget( parent ), |
273 | mMonthView( parent ) | 273 | mMonthView( parent ) |
274 | { | 274 | { |
275 | 275 | ||
276 | QVBoxLayout *topLayout = new QVBoxLayout( this ); | 276 | QVBoxLayout *topLayout = new QVBoxLayout( this ); |
277 | 277 | ||
278 | // mLabel = new QLabel( this );QPushButton | 278 | // mLabel = new QLabel( this );QPushButton |
279 | mLabel = new QPushButton( this ); | 279 | mLabel = new QPushButton( this ); |
280 | //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); | 280 | //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); |
281 | //mLabel->setLineWidth( 1 ); | 281 | //mLabel->setLineWidth( 1 ); |
282 | //mLabel->setAlignment( AlignCenter ); | 282 | //mLabel->setAlignment( AlignCenter ); |
283 | mLabel->setFlat( true ); | 283 | mLabel->setFlat( true ); |
284 | mItemList = new KNoScrollListBox( this ); | 284 | mItemList = new KNoScrollListBox( this ); |
285 | mItemList->setMinimumSize( 10, 10 ); | 285 | mItemList->setMinimumSize( 10, 10 ); |
286 | mItemList->setFrameStyle( QFrame::Panel | QFrame::Plain ); | 286 | mItemList->setFrameStyle( QFrame::Panel | QFrame::Plain ); |
287 | mItemList->setLineWidth( 1 ); | 287 | mItemList->setLineWidth( 1 ); |
288 | topLayout->addWidget( mItemList ); | 288 | topLayout->addWidget( mItemList ); |
289 | mLabel->raise(); | 289 | mLabel->raise(); |
290 | // QColor( 0,0,255 ) QColor( 160,1600,255 ) | 290 | // QColor( 0,0,255 ) QColor( 160,1600,255 ) |
291 | mStandardPalette = palette(); | 291 | mStandardPalette = palette(); |
292 | mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); | 292 | mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); |
293 | 293 | ||
294 | enableScrollBars( false ); | 294 | enableScrollBars( false ); |
295 | updateConfig(); | 295 | updateConfig(); |
296 | //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); | 296 | //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); |
297 | connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); | 297 | connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); |
298 | connect( mItemList, SIGNAL( doubleClicked( QListBoxItem *) ), | 298 | connect( mItemList, SIGNAL( doubleClicked( QListBoxItem *) ), |
299 | SLOT( defaultAction( QListBoxItem * ) ) ); | 299 | SLOT( defaultAction( QListBoxItem * ) ) ); |
300 | connect( mItemList, SIGNAL( rightButtonPressed( QListBoxItem *, | 300 | connect( mItemList, SIGNAL( rightButtonPressed( QListBoxItem *, |
301 | const QPoint &) ), | 301 | const QPoint &) ), |
302 | SLOT( contextMenu( QListBoxItem * ) ) ); | 302 | SLOT( contextMenu( QListBoxItem * ) ) ); |
303 | connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ), | 303 | connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ), |
304 | SLOT( selection( QListBoxItem * ) ) ); | 304 | SLOT( selection( QListBoxItem * ) ) ); |
305 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), | 305 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), |
306 | SLOT( cellClicked( QListBoxItem * ) ) ); | 306 | SLOT( cellClicked( QListBoxItem * ) ) ); |
307 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), | 307 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), |
308 | SLOT( selection( QListBoxItem * ) ) ); | 308 | SLOT( selection( QListBoxItem * ) ) ); |
309 | } | 309 | } |
310 | #ifdef DESKTOP_VERSION | 310 | #ifdef DESKTOP_VERSION |
311 | QToolTipGroup *MonthViewCell::toolTipGroup() | 311 | QToolTipGroup *MonthViewCell::toolTipGroup() |
312 | { | 312 | { |
313 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); | 313 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); |
314 | return mToolTipGroup; | 314 | return mToolTipGroup; |
315 | } | 315 | } |
316 | #endif | 316 | #endif |
317 | 317 | ||
318 | void MonthViewCell::setDate( const QDate &date ) | 318 | void MonthViewCell::setDate( const QDate &date ) |
319 | { | 319 | { |
320 | // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; | 320 | // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; |
321 | mDate = date; | 321 | mDate = date; |
322 | 322 | ||
323 | 323 | ||
324 | 324 | ||
325 | //resizeEvent( 0 ); | 325 | //resizeEvent( 0 ); |
326 | } | 326 | } |
327 | 327 | ||
328 | QDate MonthViewCell::date() const | 328 | QDate MonthViewCell::date() const |
329 | { | 329 | { |
330 | return mDate; | 330 | return mDate; |
331 | } | 331 | } |
332 | 332 | ||
333 | void MonthViewCell::setPrimary( bool primary ) | 333 | void MonthViewCell::setPrimary( bool primary ) |
334 | { | 334 | { |
335 | mPrimary = primary; | 335 | mPrimary = primary; |
336 | //setMyPalette(); | 336 | //setMyPalette(); |
337 | } | 337 | } |
338 | void MonthViewCell::setMyPalette() | 338 | void MonthViewCell::setMyPalette() |
339 | { | 339 | { |
340 | 340 | ||
341 | if ( mHoliday) { | 341 | if ( mHoliday) { |
342 | setPalette( mHolidayPalette ); | 342 | setPalette( mHolidayPalette ); |
343 | } else { | 343 | } else { |
344 | if ( mPrimary ) { | 344 | if ( mPrimary ) { |
345 | setPalette( mPrimaryPalette ); | 345 | setPalette( mPrimaryPalette ); |
346 | } else { | 346 | } else { |
347 | setPalette( mNonPrimaryPalette ); | 347 | setPalette( mNonPrimaryPalette ); |
348 | } | 348 | } |
349 | } | 349 | } |
350 | QPalette pal = palette(); | 350 | QPalette pal = palette(); |
351 | 351 | ||
352 | mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); | 352 | mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); |
353 | } | 353 | } |
354 | QPalette MonthViewCell::getPalette () | 354 | QPalette MonthViewCell::getPalette () |
355 | { | 355 | { |
356 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) | 356 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) |
357 | return mStandardPalette; | 357 | return mStandardPalette; |
358 | if ( mHoliday) { | 358 | if ( mHoliday) { |
359 | return mHolidayPalette ; | 359 | return mHolidayPalette ; |
360 | } else { | 360 | } else { |
361 | if ( mPrimary ) { | 361 | if ( mPrimary ) { |
362 | return mPrimaryPalette ; | 362 | return mPrimaryPalette ; |
363 | } | 363 | } |
364 | } | 364 | } |
365 | return mNonPrimaryPalette; | 365 | return mNonPrimaryPalette; |
366 | } | 366 | } |
367 | bool MonthViewCell::isPrimary() const | 367 | bool MonthViewCell::isPrimary() const |
368 | { | 368 | { |
369 | return mPrimary; | 369 | return mPrimary; |
370 | } | 370 | } |
371 | 371 | ||
372 | void MonthViewCell::setHoliday( bool holiday ) | 372 | void MonthViewCell::setHoliday( bool holiday ) |
373 | { | 373 | { |
374 | mHoliday = holiday; | 374 | mHoliday = holiday; |
375 | //setMyPalette(); | 375 | //setMyPalette(); |
376 | } | 376 | } |
377 | 377 | ||
378 | void MonthViewCell::setHoliday( const QString &holiday ) | 378 | void MonthViewCell::setHoliday( const QString &holiday ) |
379 | { | 379 | { |
380 | mHolidayString = holiday; | 380 | mHolidayString = holiday; |
381 | 381 | ||
382 | if ( !holiday.isEmpty() ) { | 382 | if ( !holiday.isEmpty() ) { |
383 | setHoliday( true ); | 383 | setHoliday( true ); |
384 | } | 384 | } |
385 | } | 385 | } |
386 | void MonthViewCell::keyPressEvent ( QKeyEvent * e ) | 386 | void MonthViewCell::keyPressEvent ( QKeyEvent * e ) |
387 | { | 387 | { |
388 | 388 | ||
389 | e->ignore(); | 389 | e->ignore(); |
390 | 390 | ||
391 | } | 391 | } |
392 | void MonthViewCell::clear() | 392 | void MonthViewCell::clear() |
393 | { | 393 | { |
394 | mItemList->clear(); | 394 | mItemList->clear(); |
395 | QApplication::removePostedEvents ( mItemList ); | 395 | QApplication::removePostedEvents ( mItemList ); |
396 | QApplication::removePostedEvents ( mLabel ); | 396 | QApplication::removePostedEvents ( mLabel ); |
397 | QApplication::removePostedEvents ( this ); | 397 | QApplication::removePostedEvents ( this ); |
398 | } | 398 | } |
399 | 399 | ||
400 | void MonthViewCell::startUpdateCell() | 400 | void MonthViewCell::startUpdateCell() |
401 | { | 401 | { |
402 | 402 | ||
403 | if ( !mMonthView->isUpdatePossible() ) | 403 | if ( !mMonthView->isUpdatePossible() ) |
404 | return; | 404 | return; |
405 | /* | 405 | /* |
406 | if ( !isVisible() ){ | 406 | if ( !isVisible() ){ |
407 | return; | 407 | return; |
408 | } | 408 | } |
409 | */ | 409 | */ |
410 | // qDebug("MonthViewCell::updateCell() "); | 410 | // qDebug("MonthViewCell::updateCell() "); |
411 | setPrimary( mDate.month()%2 ); | 411 | setPrimary( mDate.month()%2 ); |
412 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); | 412 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); |
413 | if ( mDate == QDate::currentDate() ) { | 413 | if ( mDate == QDate::currentDate() ) { |
414 | mItemList->setLineWidth( 3 ); | 414 | mItemList->setLineWidth( 3 ); |
415 | } else { | 415 | } else { |
416 | mItemList->setLineWidth( 1 ); | 416 | mItemList->setLineWidth( 1 ); |
417 | } | 417 | } |
418 | mItemList->clear(); | 418 | mItemList->clear(); |
419 | 419 | ||
420 | #ifdef DESKTOP_VERSION | 420 | #ifdef DESKTOP_VERSION |
421 | QToolTip::remove(this); | 421 | QToolTip::remove(this); |
422 | #endif | 422 | #endif |
423 | mToolTip = ""; | 423 | mToolTip = ""; |
424 | //qApp->processEvents(); | 424 | //qApp->processEvents(); |
425 | if ( !mHolidayString.isEmpty() ) { | 425 | if ( !mHolidayString.isEmpty() ) { |
426 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); | 426 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); |
427 | item->setPalette( mHolidayPalette ); | 427 | item->setPalette( mHolidayPalette ); |
428 | mItemList->insertItem( item ); | 428 | mItemList->insertItem( item ); |
429 | mToolTip += mHolidayString+"\n"; | 429 | mToolTip += mHolidayString+"\n"; |
430 | } | 430 | } |
431 | } | 431 | } |
432 | 432 | ||
433 | void MonthViewCell::insertEvent(Event *event) | 433 | void MonthViewCell::insertEvent(Event *event) |
434 | { | 434 | { |
435 | if ( !(event->doesRecur() == Recurrence::rNone) ) { | 435 | if ( !(event->doesRecur() == Recurrence::rNone) ) { |
436 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) | 436 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) |
437 | return; | 437 | return; |
438 | else | 438 | else |
439 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) | 439 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) |
440 | return; | 440 | return; |
441 | } | 441 | } |
442 | 442 | ||
443 | if ( event->categories().contains("Holiday") || | 443 | if ( event->categories().contains("Holiday") || |
444 | event->categories().contains(i18n("Holiday"))) { | 444 | event->categories().contains(i18n("Holiday"))) { |
445 | setHoliday( true ); | 445 | setHoliday( true ); |
446 | if ( mDate.dayOfWeek() == 7 ) | 446 | if ( mDate.dayOfWeek() == 7 ) |
447 | mItemList->setLineWidth( 3 ); | 447 | mItemList->setLineWidth( 3 ); |
448 | } | 448 | } |
449 | QString text; | 449 | QString text; |
450 | if (event->isMultiDay()) { | 450 | if (event->isMultiDay()) { |
451 | QString prefix = "<->"; | 451 | QString prefix = "<->"; |
452 | if ( event->doesRecur() ) { | 452 | if ( event->doesRecur() ) { |
453 | if ( event->recursOn( mDate) ) | 453 | if ( event->recursOn( mDate) ) |
454 | prefix ="->" ; | 454 | prefix ="->" ; |
455 | else { | 455 | else { |
456 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 456 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
457 | if ( event->recursOn( mDate.addDays( -days)) ) | 457 | if ( event->recursOn( mDate.addDays( -days)) ) |
458 | prefix ="<-" ; | 458 | prefix ="<-" ; |
459 | } | 459 | } |
460 | 460 | ||
461 | } else { | 461 | } else { |
462 | if (mDate == event->dtStart().date()) { | 462 | if (mDate == event->dtStart().date()) { |
463 | prefix ="->" ; | 463 | prefix ="->" ; |
464 | } else if (mDate == event->dtEnd().date()) { | 464 | } else if (mDate == event->dtEnd().date()) { |
465 | prefix ="<-" ; | 465 | prefix ="<-" ; |
466 | } | 466 | } |
467 | } | 467 | } |
468 | text = prefix + event->summary(); | 468 | text = prefix + event->summary(); |
469 | mToolTip += text; | 469 | mToolTip += text; |
470 | } else { | 470 | } else { |
471 | if (event->doesFloat()) { | 471 | if (event->doesFloat()) { |
472 | text = event->summary(); | 472 | text = event->summary(); |
473 | mToolTip += text; | 473 | mToolTip += text; |
474 | } | 474 | } |
475 | else { | 475 | else { |
476 | text = KGlobal::locale()->formatTime(event->dtStart().time()); | 476 | text = KGlobal::locale()->formatTime(event->dtStart().time()); |
477 | text += " " + event->summary(); | 477 | text += " " + event->summary(); |
478 | mToolTip += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); | 478 | mToolTip += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); |
479 | } | 479 | } |
480 | } | 480 | } |
481 | 481 | ||
482 | MonthViewItem *item = new MonthViewItem( event, mDate, text ); | 482 | MonthViewItem *item = new MonthViewItem( event, mDate, text ); |
483 | QPalette pal; | 483 | QPalette pal; |
484 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 484 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
485 | QStringList categories = event->categories(); | 485 | QStringList categories = event->categories(); |
486 | QString cat = categories.first(); | 486 | QString cat = categories.first(); |
487 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 487 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
488 | pal = getPalette(); | 488 | pal = getPalette(); |
489 | if (cat.isEmpty()) { | 489 | if (cat.isEmpty()) { |
490 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 490 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
491 | } else { | 491 | } else { |
492 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 492 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
493 | } | 493 | } |
494 | 494 | ||
495 | } else { | 495 | } else { |
496 | if (cat.isEmpty()) { | 496 | if (cat.isEmpty()) { |
497 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 497 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
498 | } else { | 498 | } else { |
499 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 499 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
500 | } | 500 | } |
501 | } | 501 | } |
502 | 502 | ||
503 | } else { | 503 | } else { |
504 | pal = mStandardPalette ; | 504 | pal = mStandardPalette ; |
505 | } | 505 | } |
506 | item->setPalette( pal ); | 506 | item->setPalette( pal ); |
507 | item->setRecur( event->recurrence()->doesRecur() ); | 507 | item->setRecur( event->recurrence()->doesRecur() ); |
508 | item->setAlarm( event->isAlarmEnabled() ); | 508 | item->setAlarm( event->isAlarmEnabled() ); |
509 | item->setMoreInfo( event->description().length() > 0 ); | 509 | item->setMoreInfo( event->description().length() > 0 ); |
510 | #ifdef DESKTOP_VERSION | 510 | #ifdef DESKTOP_VERSION |
511 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, | 511 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, |
512 | KOPrefs::instance()->email()); | 512 | KOPrefs::instance()->email()); |
513 | if ( me != 0 ) { | 513 | if ( me != 0 ) { |
514 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) | 514 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) |
515 | item->setReply(true); | 515 | item->setReply(true); |
516 | else | 516 | else |
517 | item->setReply(false); | 517 | item->setReply(false); |
518 | } else | 518 | } else |
519 | item->setReply(false); | 519 | item->setReply(false); |
520 | #endif | 520 | #endif |
521 | mItemList->insertItem( item ); | 521 | mItemList->insertItem( item ); |
522 | mToolTip += "\n"; | 522 | mToolTip += "\n"; |
523 | } | 523 | } |
524 | void MonthViewCell::insertTodo(Todo *todo) | 524 | void MonthViewCell::insertTodo(Todo *todo) |
525 | { | 525 | { |
526 | QString text; | 526 | QString text; |
527 | if (todo->hasDueDate()) { | 527 | if (todo->hasDueDate()) { |
528 | if (!todo->doesFloat()) { | 528 | if (!todo->doesFloat()) { |
529 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); | 529 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); |
530 | text += " "; | 530 | text += " "; |
531 | } | 531 | } |
532 | } | 532 | } |
533 | text += i18n("To-Do: %1").arg(todo->summary()); | 533 | text += i18n("To-Do: %1").arg(todo->summary()); |
534 | 534 | ||
535 | MonthViewItem *item = new MonthViewItem( todo, mDate, text ); | 535 | MonthViewItem *item = new MonthViewItem( todo, mDate, text ); |
536 | //item->setPalette( mStandardPalette ); | 536 | //item->setPalette( mStandardPalette ); |
537 | QPalette pal; | 537 | QPalette pal; |
538 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 538 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
539 | QStringList categories = todo->categories(); | 539 | QStringList categories = todo->categories(); |
540 | QString cat = categories.first(); | 540 | QString cat = categories.first(); |
541 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 541 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
542 | pal = getPalette(); | 542 | pal = getPalette(); |
543 | if (cat.isEmpty()) { | 543 | if (cat.isEmpty()) { |
544 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 544 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
545 | } else { | 545 | } else { |
546 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 546 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
547 | } | 547 | } |
548 | 548 | ||
549 | } else { | 549 | } else { |
550 | if (cat.isEmpty()) { | 550 | if (cat.isEmpty()) { |
551 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 551 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
552 | } else { | 552 | } else { |
553 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 553 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
554 | } | 554 | } |
555 | } | 555 | } |
556 | 556 | ||
557 | } else { | 557 | } else { |
558 | pal = mStandardPalette ; | 558 | pal = mStandardPalette ; |
559 | } | 559 | } |
560 | item->setPalette( pal ); | 560 | item->setPalette( pal ); |
561 | mItemList->insertItem( item ); | 561 | mItemList->insertItem( item ); |
562 | mToolTip += text+"\n"; | 562 | mToolTip += text+"\n"; |
563 | } | 563 | } |
564 | void MonthViewCell::finishUpdateCell() | 564 | void MonthViewCell::finishUpdateCell() |
565 | { | 565 | { |
566 | #ifdef DESKTOP_VERSION | 566 | #ifdef DESKTOP_VERSION |
567 | if (mToolTip != "") | 567 | if (mToolTip != "") |
568 | QToolTip::add(this,mToolTip,toolTipGroup(),""); | 568 | QToolTip::add(this,mToolTip,toolTipGroup(),""); |
569 | #endif | 569 | #endif |
570 | 570 | ||
571 | //setMyPalette(); | 571 | //setMyPalette(); |
572 | setMyPalette(); | 572 | setMyPalette(); |
573 | QString text; | 573 | QString text; |
574 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; | 574 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; |
575 | if ( KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { | 575 | if ( KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { |
576 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; | 576 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; |
577 | mLabel->resize( mLabelBigSize ); | 577 | mLabel->resize( mLabelBigSize ); |
578 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 578 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
579 | } else { | 579 | } else { |
580 | mLabel->resize( mLabelSize ); | 580 | mLabel->resize( mLabelSize ); |
581 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 581 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
582 | } | 582 | } |
583 | 583 | ||
584 | mLabel->setText( text ); | 584 | mLabel->setText( text ); |
585 | resizeEvent( 0 ); | 585 | resizeEvent( 0 ); |
586 | } | 586 | } |
587 | void MonthViewCell::updateCell() | 587 | void MonthViewCell::updateCell() |
588 | { | 588 | { |
589 | if ( !mMonthView->isUpdatePossible() ) | 589 | if ( !mMonthView->isUpdatePossible() ) |
590 | return; | 590 | return; |
591 | startUpdateCell(); | 591 | startUpdateCell(); |
592 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 592 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
593 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); | 593 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); |
594 | Event *event; | 594 | Event *event; |
595 | for( event = events.first(); event; event = events.next() ) { // for event | 595 | for( event = events.first(); event; event = events.next() ) { // for event |
596 | insertEvent(event); | 596 | insertEvent(event); |
597 | } | 597 | } |
598 | // insert due todos | 598 | // insert due todos |
599 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); | 599 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); |
600 | Todo *todo; | 600 | Todo *todo; |
601 | for(todo = todos.first(); todo; todo = todos.next()) { | 601 | for(todo = todos.first(); todo; todo = todos.next()) { |
602 | insertTodo( todo ); | 602 | insertTodo( todo ); |
603 | } | 603 | } |
604 | finishUpdateCell(); | 604 | finishUpdateCell(); |
605 | // if ( isVisible()) | 605 | // if ( isVisible()) |
606 | //qApp->processEvents(); | 606 | //qApp->processEvents(); |
607 | } | 607 | } |
608 | 608 | ||
609 | void MonthViewCell::updateConfig() | 609 | void MonthViewCell::updateConfig() |
610 | { | 610 | { |
611 | setFont( KOPrefs::instance()->mMonthViewFont ); | 611 | setFont( KOPrefs::instance()->mMonthViewFont ); |
612 | 612 | ||
613 | QFontMetrics fm( font() ); | 613 | QFontMetrics fm( font() ); |
614 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); | 614 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); |
615 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); | 615 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); |
616 | mHolidayPalette = mStandardPalette; | 616 | mHolidayPalette = mStandardPalette; |
617 | mPrimaryPalette = mStandardPalette; | 617 | mPrimaryPalette = mStandardPalette; |
618 | mNonPrimaryPalette = mStandardPalette; | 618 | mNonPrimaryPalette = mStandardPalette; |
619 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { | 619 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { |
620 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); | 620 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); |
621 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); | 621 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); |
622 | mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); | 622 | mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); |
623 | mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); | 623 | mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); |
624 | mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); | 624 | mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); |
625 | mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); | 625 | mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); |
626 | mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); | 626 | mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); |
627 | mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); | 627 | mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); |
628 | mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); | 628 | mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); |
629 | } | 629 | } |
630 | //updateCell(); | 630 | //updateCell(); |
631 | } | 631 | } |
632 | 632 | ||
633 | void MonthViewCell::enableScrollBars( bool enabled ) | 633 | void MonthViewCell::enableScrollBars( bool enabled ) |
634 | { | 634 | { |
635 | if ( enabled ) { | 635 | if ( enabled ) { |
636 | mItemList->setVScrollBarMode(QScrollView::Auto); | 636 | mItemList->setVScrollBarMode(QScrollView::Auto); |
637 | mItemList->setHScrollBarMode(QScrollView::Auto); | 637 | mItemList->setHScrollBarMode(QScrollView::Auto); |
638 | } else { | 638 | } else { |
639 | mItemList->setVScrollBarMode(QScrollView::AlwaysOff); | 639 | mItemList->setVScrollBarMode(QScrollView::AlwaysOff); |
640 | mItemList->setHScrollBarMode(QScrollView::AlwaysOff); | 640 | mItemList->setHScrollBarMode(QScrollView::AlwaysOff); |
641 | } | 641 | } |
642 | } | 642 | } |
643 | 643 | ||
644 | Incidence *MonthViewCell::selectedIncidence() | 644 | Incidence *MonthViewCell::selectedIncidence() |
645 | { | 645 | { |
646 | int index = mItemList->currentItem(); | 646 | int index = mItemList->currentItem(); |
647 | if ( index < 0 ) return 0; | 647 | if ( index < 0 ) return 0; |
648 | 648 | ||
649 | MonthViewItem *item = | 649 | MonthViewItem *item = |
650 | static_cast<MonthViewItem *>( mItemList->item( index ) ); | 650 | static_cast<MonthViewItem *>( mItemList->item( index ) ); |
651 | 651 | ||
652 | if ( !item ) return 0; | 652 | if ( !item ) return 0; |
653 | 653 | ||
654 | return item->incidence(); | 654 | return item->incidence(); |
655 | } | 655 | } |
656 | 656 | ||
657 | QDate MonthViewCell::selectedIncidenceDate() | 657 | QDate MonthViewCell::selectedIncidenceDate() |
658 | { | 658 | { |
659 | QDate qd; | 659 | QDate qd; |
660 | int index = mItemList->currentItem(); | 660 | int index = mItemList->currentItem(); |
661 | if ( index < 0 ) return qd; | 661 | if ( index < 0 ) return qd; |
662 | 662 | ||
663 | MonthViewItem *item = | 663 | MonthViewItem *item = |
664 | static_cast<MonthViewItem *>( mItemList->item( index ) ); | 664 | static_cast<MonthViewItem *>( mItemList->item( index ) ); |
665 | 665 | ||
666 | if ( !item ) return qd; | 666 | if ( !item ) return qd; |
667 | 667 | ||
668 | return item->incidenceDate(); | 668 | return item->incidenceDate(); |
669 | } | 669 | } |
670 | 670 | ||
671 | void MonthViewCell::deselect() | 671 | void MonthViewCell::deselect() |
672 | { | 672 | { |
673 | mItemList->clearSelection(); | 673 | mItemList->clearSelection(); |
674 | enableScrollBars( false ); | 674 | enableScrollBars( false ); |
675 | // updateCell(); | 675 | // updateCell(); |
676 | } | 676 | } |
677 | void MonthViewCell::select() | 677 | void MonthViewCell::select() |
678 | { | 678 | { |
679 | ;// updateCell(); | 679 | ;// updateCell(); |
680 | } | 680 | } |
681 | 681 | ||
682 | void MonthViewCell::resizeEvent ( QResizeEvent * ) | 682 | void MonthViewCell::resizeEvent ( QResizeEvent * ) |
683 | { | 683 | { |
684 | if ( !mMonthView->isUpdatePossible() ) | 684 | if ( !mMonthView->isUpdatePossible() ) |
685 | return; | 685 | return; |
686 | #ifndef DESKTOP_VERSION | 686 | #ifndef DESKTOP_VERSION |
687 | if ( !isVisible() ){ | 687 | if ( !isVisible() ){ |
688 | return; | 688 | return; |
689 | } | 689 | } |
690 | #endif | 690 | #endif |
691 | int size = height() - mLabel->height(); | 691 | int size = height() - mLabel->height(); |
692 | if ( size > 0 ) | 692 | if ( size > 0 ) |
693 | mItemList->verticalScrollBar()->setMaximumHeight( size ); | 693 | mItemList->verticalScrollBar()->setMaximumHeight( size ); |
694 | size = width() - mLabel->width(); | 694 | size = width() - mLabel->width(); |
695 | if ( size > 0 ) | 695 | if ( size > 0 ) |
696 | mItemList->horizontalScrollBar()->setMaximumWidth( size ); | 696 | mItemList->horizontalScrollBar()->setMaximumWidth( size ); |
697 | mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() ); | 697 | mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() ); |
698 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 698 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
699 | } | 699 | } |
700 | 700 | ||
701 | void MonthViewCell::defaultAction( QListBoxItem *item ) | 701 | void MonthViewCell::defaultAction( QListBoxItem *item ) |
702 | { | 702 | { |
703 | if ( !item ) return; | 703 | if ( !item ) return; |
704 | 704 | ||
705 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); | 705 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); |
706 | Incidence *incidence = eventItem->incidence(); | 706 | Incidence *incidence = eventItem->incidence(); |
707 | if ( incidence ) mMonthView->defaultAction( incidence ); | 707 | if ( incidence ) mMonthView->defaultAction( incidence ); |
708 | } | 708 | } |
709 | void MonthViewCell::showDay() | 709 | void MonthViewCell::showDay() |
710 | { | 710 | { |
711 | emit showDaySignal( date() ); | 711 | emit showDaySignal( date() ); |
712 | } | 712 | } |
713 | void MonthViewCell::newEvent() | 713 | void MonthViewCell::newEvent() |
714 | { | 714 | { |
715 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 715 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
716 | emit newEventSignal( dt ); | 716 | emit newEventSignal( dt ); |
717 | } | 717 | } |
718 | void MonthViewCell::cellClicked( QListBoxItem *item ) | 718 | void MonthViewCell::cellClicked( QListBoxItem *item ) |
719 | { | 719 | { |
720 | static QListBoxItem * lastClicked = 0; | 720 | static QListBoxItem * lastClicked = 0; |
721 | if ( item == 0 ) { | 721 | if ( item == 0 ) { |
722 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 722 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
723 | emit newEventSignal( dt ); | 723 | emit newEventSignal( dt ); |
724 | return; | 724 | return; |
725 | } | 725 | } |
726 | /* | 726 | /* |
727 | if ( lastClicked ) | 727 | if ( lastClicked ) |
728 | if ( ! item ) { | 728 | if ( ! item ) { |
729 | if ( lastClicked->listBox() != item->listBox() ) | 729 | if ( lastClicked->listBox() != item->listBox() ) |
730 | lastClicked->listBox()->clearSelection(); | 730 | lastClicked->listBox()->clearSelection(); |
731 | } | 731 | } |
732 | */ | 732 | */ |
733 | 733 | ||
734 | mMonthView->setSelectedCell( this ); | 734 | mMonthView->setSelectedCell( this ); |
735 | if( KOPrefs::instance()->mEnableMonthScroll ) enableScrollBars( true ); | 735 | if( KOPrefs::instance()->mEnableMonthScroll ) enableScrollBars( true ); |
736 | select(); | 736 | select(); |
737 | } | 737 | } |
738 | 738 | ||
739 | void MonthViewCell::contextMenu( QListBoxItem *item ) | 739 | void MonthViewCell::contextMenu( QListBoxItem *item ) |
740 | { | 740 | { |
741 | if ( !item ) return; | 741 | if ( !item ) return; |
742 | 742 | ||
743 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); | 743 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); |
744 | Incidence *incidence = eventItem->incidence(); | 744 | Incidence *incidence = eventItem->incidence(); |
745 | if ( incidence ) mMonthView->showContextMenu( incidence ); | 745 | if ( incidence ) mMonthView->showContextMenu( incidence ); |
746 | } | 746 | } |
747 | 747 | ||
748 | void MonthViewCell::selection( QListBoxItem *item ) | 748 | void MonthViewCell::selection( QListBoxItem *item ) |
749 | { | 749 | { |
750 | if ( !item ) return; | 750 | if ( !item ) return; |
751 | 751 | ||
752 | mMonthView->setSelectedCell( this ); | 752 | mMonthView->setSelectedCell( this ); |
753 | } | 753 | } |
754 | 754 | ||
755 | 755 | ||
756 | // ******************************************************************************* | 756 | // ******************************************************************************* |
757 | // ******************************************************************************* | 757 | // ******************************************************************************* |
758 | // ******************************************************************************* | 758 | // ******************************************************************************* |
759 | 759 | ||
760 | 760 | ||
761 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | 761 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) |
762 | : KOEventView( calendar, parent, name ), | 762 | : KOEventView( calendar, parent, name ), |
763 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), | 763 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), |
764 | mShortDayLabels( false ), mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) | 764 | mShortDayLabels( false ), mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) |
765 | { | 765 | { |
766 | 766 | ||
767 | updatePossible = false; | 767 | updatePossible = false; |
768 | mCells.setAutoDelete( true ); | 768 | mCells.setAutoDelete( true ); |
769 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; | 769 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; |
770 | // mDayLayout = new QGridLayout( this ); | 770 | // mDayLayout = new QGridLayout( this ); |
771 | // create the day of the week labels (Sun, Mon, etc) and add them to | 771 | // create the day of the week labels (Sun, Mon, etc) and add them to |
772 | // the layout. | 772 | // the layout. |
773 | mDayLabels.resize( mDaysPerWeek ); | 773 | mDayLabels.resize( mDaysPerWeek ); |
774 | QFont bfont = font(); | 774 | QFont bfont = font(); |
775 | if ( QApplication::desktop()->width() < 650 ) { | 775 | if ( QApplication::desktop()->width() < 650 ) { |
776 | bfont.setPointSize( bfont.pointSize() - 2 ); | 776 | bfont.setPointSize( bfont.pointSize() - 2 ); |
777 | } | 777 | } |
778 | bfont.setBold( true ); | 778 | bfont.setBold( true ); |
779 | int i; | 779 | int i; |
780 | 780 | ||
781 | for( i = 0; i < mDaysPerWeek; i++ ) { | 781 | for( i = 0; i < mDaysPerWeek; i++ ) { |
782 | QLabel *label = new QLabel( this ); | 782 | QLabel *label = new QLabel( this ); |
783 | label->setFont(bfont); | 783 | label->setFont(bfont); |
784 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 784 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
785 | label->setLineWidth(1); | 785 | label->setLineWidth(1); |
786 | label->setAlignment(AlignCenter); | 786 | label->setAlignment(AlignCenter); |
787 | mDayLabels.insert( i, label ); | 787 | mDayLabels.insert( i, label ); |
788 | } | 788 | } |
789 | 789 | ||
790 | bfont.setBold( false ); | 790 | bfont.setBold( false ); |
791 | mWeekLabels.resize( mNumWeeks+1 ); | 791 | mWeekLabels.resize( mNumWeeks+1 ); |
792 | for( i = 0; i < mNumWeeks+1; i++ ) { | 792 | for( i = 0; i < mNumWeeks+1; i++ ) { |
793 | KOWeekButton *label = new KOWeekButton( this ); | 793 | KOWeekButton *label = new KOWeekButton( this ); |
794 | label->setFont(bfont); | 794 | label->setFont(bfont); |
795 | connect( label, SIGNAL( selectWeekNum ( int )),this, SIGNAL( selectWeekNum ( int )) ); | 795 | connect( label, SIGNAL( selectWeekNum ( int )),this, SIGNAL( selectWeekNum ( int )) ); |
796 | label->setFlat(true); | 796 | label->setFlat(true); |
797 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week in agenda view")); | 797 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week in agenda view")); |
798 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 798 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
799 | //label->setLineWidth(1); | 799 | //label->setLineWidth(1); |
800 | //label->setAlignment(AlignCenter); | 800 | //label->setAlignment(AlignCenter); |
801 | mWeekLabels.insert( i, label ); | 801 | mWeekLabels.insert( i, label ); |
802 | } | 802 | } |
803 | mWeekLabels[mNumWeeks]->setText( i18n("W")); | 803 | mWeekLabels[mNumWeeks]->setText( i18n("W")); |
804 | int row, col; | 804 | int row, col; |
805 | mCells.resize( mNumCells ); | 805 | mCells.resize( mNumCells ); |
806 | for( row = 0; row < mNumWeeks; ++row ) { | 806 | for( row = 0; row < mNumWeeks; ++row ) { |
807 | for( col = 0; col < mDaysPerWeek; ++col ) { | 807 | for( col = 0; col < mDaysPerWeek; ++col ) { |
808 | MonthViewCell *cell = new MonthViewCell( this ); | 808 | MonthViewCell *cell = new MonthViewCell( this ); |
809 | mCells.insert( row * mDaysPerWeek + col, cell ); | 809 | mCells.insert( row * mDaysPerWeek + col, cell ); |
810 | 810 | ||
811 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), | 811 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), |
812 | SLOT( defaultAction( Incidence * ) ) ); | 812 | SLOT( defaultAction( Incidence * ) ) ); |
813 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), | 813 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), |
814 | SIGNAL( newEventSignal( QDateTime ) ) ); | 814 | SIGNAL( newEventSignal( QDateTime ) ) ); |
815 | connect( cell, SIGNAL( showDaySignal( QDate ) ), | 815 | connect( cell, SIGNAL( showDaySignal( QDate ) ), |
816 | SIGNAL( showDaySignal( QDate ) ) ); | 816 | SIGNAL( showDaySignal( QDate ) ) ); |
817 | } | 817 | } |
818 | } | 818 | } |
819 | 819 | ||
820 | mContextMenu = eventPopup(); | 820 | mContextMenu = eventPopup(); |
821 | // updateConfig(); //useless here | 821 | // updateConfig(); //useless here |
822 | 822 | ||
823 | emit incidenceSelected( 0 ); | 823 | emit incidenceSelected( 0 ); |
824 | } | 824 | } |
825 | 825 | ||
826 | KOMonthView::~KOMonthView() | 826 | KOMonthView::~KOMonthView() |
827 | { | 827 | { |
828 | delete mContextMenu; | 828 | delete mContextMenu; |
829 | } | 829 | } |
830 | 830 | ||
831 | int KOMonthView::maxDatesHint() | 831 | int KOMonthView::maxDatesHint() |
832 | { | 832 | { |
833 | return mNumCells; | 833 | return mNumCells; |
834 | } | 834 | } |
835 | 835 | ||
836 | int KOMonthView::currentDateCount() | 836 | int KOMonthView::currentDateCount() |
837 | { | 837 | { |
838 | return mNumCells; | 838 | return mNumCells; |
839 | } | 839 | } |
840 | 840 | ||
841 | QPtrList<Incidence> KOMonthView::selectedIncidences() | 841 | QPtrList<Incidence> KOMonthView::selectedIncidences() |
842 | { | 842 | { |
843 | QPtrList<Incidence> selected; | 843 | QPtrList<Incidence> selected; |
844 | 844 | ||
845 | if ( mSelectedCell ) { | 845 | if ( mSelectedCell ) { |
846 | Incidence *incidence = mSelectedCell->selectedIncidence(); | 846 | Incidence *incidence = mSelectedCell->selectedIncidence(); |
847 | if ( incidence ) selected.append( incidence ); | 847 | if ( incidence ) selected.append( incidence ); |
848 | } | 848 | } |
849 | 849 | ||
850 | return selected; | 850 | return selected; |
851 | } | 851 | } |
852 | 852 | ||
853 | DateList KOMonthView::selectedDates() | 853 | DateList KOMonthView::selectedDates() |
854 | { | 854 | { |
855 | DateList selected; | 855 | DateList selected; |
856 | 856 | ||
857 | if ( mSelectedCell ) { | 857 | if ( mSelectedCell ) { |
858 | QDate qd = mSelectedCell->selectedIncidenceDate(); | 858 | QDate qd = mSelectedCell->selectedIncidenceDate(); |
859 | if ( qd.isValid() ) selected.append( qd ); | 859 | if ( qd.isValid() ) selected.append( qd ); |
860 | } | 860 | } |
861 | 861 | ||
862 | return selected; | 862 | return selected; |
863 | } | 863 | } |
864 | 864 | ||
865 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 865 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
866 | const QDate &td) | 866 | const QDate &td) |
867 | { | 867 | { |
868 | #ifndef KORG_NOPRINTER | 868 | #ifndef KORG_NOPRINTER |
869 | calPrinter->preview(CalPrinter::Month, fd, td); | 869 | calPrinter->preview(CalPrinter::Month, fd, td); |
870 | #endif | 870 | #endif |
871 | } | 871 | } |
872 | 872 | ||
873 | void KOMonthView::updateConfig() | 873 | void KOMonthView::updateConfig() |
874 | { | 874 | { |
875 | 875 | ||
876 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); | 876 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); |
877 | 877 | ||
878 | QFontMetrics fontmetric(mDayLabels[0]->font()); | 878 | QFontMetrics fontmetric(mDayLabels[0]->font()); |
879 | mWidthLongDayLabel = 0; | 879 | mWidthLongDayLabel = 0; |
880 | 880 | ||
881 | for (int i = 0; i < 7; i++) { | 881 | for (int i = 0; i < 7; i++) { |
882 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); | 882 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); |
883 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; | 883 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; |
884 | } | 884 | } |
885 | bool temp = mShowSatSunComp ; | 885 | bool temp = mShowSatSunComp ; |
886 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; | 886 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; |
887 | if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) | 887 | if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) |
888 | computeLayout(); | 888 | computeLayout(); |
889 | updateDayLabels(); | 889 | updateDayLabels(); |
890 | //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); | 890 | //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); |
891 | int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; | 891 | int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; |
892 | //resizeEvent( 0 ); | 892 | //resizeEvent( 0 ); |
893 | for (uint i = 0; i < mCells.count(); ++i) { | 893 | for (uint i = 0; i < mCells.count(); ++i) { |
894 | mCells[i]->updateConfig(); | 894 | mCells[i]->updateConfig(); |
895 | } | 895 | } |
896 | #ifdef DESKTOP_VERSION | 896 | #ifdef DESKTOP_VERSION |
897 | MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); | 897 | MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); |
898 | #endif | 898 | #endif |
899 | updateView(); | 899 | updateView(); |
900 | } | 900 | } |
901 | 901 | ||
902 | void KOMonthView::updateDayLabels() | 902 | void KOMonthView::updateDayLabels() |
903 | { | 903 | { |
904 | 904 | ||
905 | for (int i = 0; i < 7; i++) { | 905 | for (int i = 0; i < 7; i++) { |
906 | if (mWeekStartsMonday) { | 906 | if (mWeekStartsMonday) { |
907 | bool show = mShortDayLabels; | 907 | bool show = mShortDayLabels; |
908 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > mDayLabels[i]->width() ) | 908 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > mDayLabels[i]->width() ) |
909 | show = true; | 909 | show = true; |
910 | mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); | 910 | mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); |
911 | } else { | 911 | } else { |
912 | if (i==0) mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabels)); | 912 | if (i==0) mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabels)); |
913 | else mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabels)); | 913 | else mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabels)); |
914 | 914 | ||
915 | } | 915 | } |
916 | } | 916 | } |
917 | } | 917 | } |
918 | 918 | ||
919 | void KOMonthView::showDates(const QDate &start, const QDate &) | 919 | void KOMonthView::showDates(const QDate &start, const QDate &) |
920 | { | 920 | { |
921 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; | 921 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; |
922 | 922 | ||
923 | 923 | ||
924 | mStartDate = start; | 924 | mStartDate = start; |
925 | 925 | ||
926 | int startWeekDay = mWeekStartsMonday ? 1 : 7; | 926 | int startWeekDay = mWeekStartsMonday ? 1 : 7; |
927 | 927 | ||
928 | while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { | 928 | while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { |
929 | mStartDate = mStartDate.addDays( -1 ); | 929 | mStartDate = mStartDate.addDays( -1 ); |
930 | } | 930 | } |
931 | 931 | ||
932 | bool primary = false; | 932 | bool primary = false; |
933 | uint i; | 933 | uint i; |
934 | for( i = 0; i < mCells.size(); ++i ) { | 934 | for( i = 0; i < mCells.size(); ++i ) { |
935 | QDate date = mStartDate.addDays( i ); | 935 | QDate date = mStartDate.addDays( i ); |
936 | mCells[i]->setDate( date ); | 936 | mCells[i]->setDate( date ); |
937 | 937 | ||
938 | #ifndef KORG_NOPLUGINS | 938 | #ifndef KORG_NOPLUGINS |
939 | // add holiday, if present | 939 | // add holiday, if present |
940 | QString hstring(KOCore::self()->holiday(date)); | 940 | QString hstring(KOCore::self()->holiday(date)); |
941 | mCells[i]->setHoliday( hstring ); | 941 | mCells[i]->setHoliday( hstring ); |
942 | #endif | 942 | #endif |
943 | 943 | ||
944 | } | 944 | } |
945 | QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); | 945 | QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); |
946 | for( i = 0; i < 6; ++i ) { | 946 | for( i = 0; i < 6; ++i ) { |
947 | int wno; | 947 | int wno; |
948 | // remember, according to ISO 8601, the first week of the year is the | 948 | // remember, according to ISO 8601, the first week of the year is the |
949 | // first week that contains a thursday. Thus we must subtract off 4, | 949 | // first week that contains a thursday. Thus we must subtract off 4, |
950 | // not just 1. | 950 | // not just 1. |
951 | int dayOfYear = date.dayOfYear(); | 951 | int dayOfYear = date.dayOfYear(); |
952 | if (dayOfYear % 7 != 0) | 952 | if (dayOfYear % 7 != 0) |
953 | wno = dayOfYear / 7 + 1; | 953 | wno = dayOfYear / 7 + 1; |
954 | else | 954 | else |
955 | wno =dayOfYear / 7; | 955 | wno =dayOfYear / 7; |
956 | mWeekLabels[i]->setWeekNum( wno ); | 956 | mWeekLabels[i]->setWeekNum( wno ); |
957 | date = date.addDays( 7 ); | 957 | date = date.addDays( 7 ); |
958 | } | 958 | } |
959 | updateView(); | 959 | updateView(); |
960 | } | 960 | } |
961 | 961 | ||
962 | void KOMonthView::showEvents(QPtrList<Event>) | 962 | void KOMonthView::showEvents(QPtrList<Event>) |
963 | { | 963 | { |
964 | qDebug("KOMonthView::selectEvents is not implemented yet. "); | 964 | qDebug("KOMonthView::selectEvents is not implemented yet. "); |
965 | } | 965 | } |
966 | 966 | ||
967 | void KOMonthView::changeEventDisplay(Event *, int) | 967 | void KOMonthView::changeEventDisplay(Event *, int) |
968 | { | 968 | { |
969 | // this should be re-written to be much more efficient, but this | 969 | // this should be re-written to be much more efficient, but this |
970 | // quick-and-dirty-hack gets the job done for right now. | 970 | // quick-and-dirty-hack gets the job done for right now. |
971 | updateView(); | 971 | updateView(); |
972 | } | 972 | } |
973 | 973 | ||
974 | void KOMonthView::updateView() | 974 | void KOMonthView::updateView() |
975 | { | 975 | { |
976 | 976 | ||
977 | if ( !updatePossible ) | 977 | if ( !updatePossible ) |
978 | return; | 978 | return; |
979 | QTime ti; | 979 | //QTime ti; |
980 | ti.start(); | 980 | //ti.start(); |
981 | #if 1 | 981 | #if 1 |
982 | int i; | 982 | int i; |
983 | for( i = 0; i < mCells.count(); ++i ) { | 983 | for( i = 0; i < mCells.count(); ++i ) { |
984 | mCells[i]->startUpdateCell(); | 984 | mCells[i]->startUpdateCell(); |
985 | } | 985 | } |
986 | 986 | ||
987 | QPtrList<Event> events = calendar()->events(); | 987 | QPtrList<Event> events = calendar()->events(); |
988 | Event *event; | 988 | Event *event; |
989 | QDateTime dt; | 989 | QDateTime dt; |
990 | bool ok; | 990 | bool ok; |
991 | int timeSpan = mCells.size()-1; | 991 | int timeSpan = mCells.size()-1; |
992 | QDate endDate = mStartDate.addDays( timeSpan ); | 992 | QDate endDate = mStartDate.addDays( timeSpan ); |
993 | for( event = events.first(); event; event = events.next() ) { // for event | 993 | for( event = events.first(); event; event = events.next() ) { // for event |
994 | if ( event->doesRecur() ) { | 994 | if ( event->doesRecur() ) { |
995 | bool last; | 995 | bool last; |
996 | QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); | 996 | QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); |
997 | QDateTime incidenceEnd; | 997 | QDateTime incidenceEnd; |
998 | int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 998 | int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
999 | bool invalid = false; | 999 | bool invalid = false; |
1000 | while( true ) { | 1000 | while( true ) { |
1001 | if ( incidenceStart.isValid() ) { | 1001 | if ( incidenceStart.isValid() ) { |
1002 | incidenceEnd = incidenceStart.addDays( eventlen ); | 1002 | incidenceEnd = incidenceStart.addDays( eventlen ); |
1003 | int st = incidenceStart.date().daysTo( endDate ); | 1003 | int st = incidenceStart.date().daysTo( endDate ); |
1004 | if ( st >= 0 ) { // start before timeend | 1004 | if ( st >= 0 ) { // start before timeend |
1005 | int end = mStartDate.daysTo( incidenceEnd.date() ); | 1005 | int end = mStartDate.daysTo( incidenceEnd.date() ); |
1006 | if ( end >= 0 ) { // end after timestart --- got one! | 1006 | if ( end >= 0 ) { // end after timestart --- got one! |
1007 | //normalize | 1007 | //normalize |
1008 | st = timeSpan - st; | 1008 | st = timeSpan - st; |
1009 | if ( st < 0 ) st = 0; | 1009 | if ( st < 0 ) st = 0; |
1010 | if ( end > timeSpan ) end = timeSpan; | 1010 | if ( end > timeSpan ) end = timeSpan; |
1011 | int iii; | 1011 | int iii; |
1012 | //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); | 1012 | //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); |
1013 | for ( iii = st;iii<= end;++iii) | 1013 | for ( iii = st;iii<= end;++iii) |
1014 | mCells[iii]->insertEvent( event ); | 1014 | mCells[iii]->insertEvent( event ); |
1015 | } | 1015 | } |
1016 | } | 1016 | } |
1017 | } else { | 1017 | } else { |
1018 | if ( invalid ) | 1018 | if ( invalid ) |
1019 | break; | 1019 | break; |
1020 | invalid = true; | 1020 | invalid = true; |
1021 | //qDebug("invalid %s", event->summary().latin1()); | 1021 | //qDebug("invalid %s", event->summary().latin1()); |
1022 | incidenceStart = QDateTime( mStartDate ); | 1022 | incidenceStart = QDateTime( mStartDate ); |
1023 | } | 1023 | } |
1024 | if ( last ) | 1024 | if ( last ) |
1025 | break; | 1025 | break; |
1026 | bool ok; | 1026 | bool ok; |
1027 | incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); | 1027 | incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); |
1028 | if ( ! ok ) | 1028 | if ( ! ok ) |
1029 | break; | 1029 | break; |
1030 | if ( incidenceStart.date() > endDate ) | 1030 | if ( incidenceStart.date() > endDate ) |
1031 | break; | 1031 | break; |
1032 | } | 1032 | } |
1033 | } else { // no recur | 1033 | } else { // no recur |
1034 | int st = event->dtStart().date().daysTo( endDate ); | 1034 | int st = event->dtStart().date().daysTo( endDate ); |
1035 | if ( st >= 0 ) { // start before timeend | 1035 | if ( st >= 0 ) { // start before timeend |
1036 | int end = mStartDate.daysTo( event->dtEnd().date() ); | 1036 | int end = mStartDate.daysTo( event->dtEnd().date() ); |
1037 | if ( end >= 0 ) { // end after timestart --- got one! | 1037 | if ( end >= 0 ) { // end after timestart --- got one! |
1038 | //normalize | 1038 | //normalize |
1039 | st = timeSpan - st; | 1039 | st = timeSpan - st; |
1040 | if ( st < 0 ) st = 0; | 1040 | if ( st < 0 ) st = 0; |
1041 | if ( end > timeSpan ) end = timeSpan; | 1041 | if ( end > timeSpan ) end = timeSpan; |
1042 | int iii; | 1042 | int iii; |
1043 | for ( iii = st;iii<= end;++iii) | 1043 | for ( iii = st;iii<= end;++iii) |
1044 | mCells[iii]->insertEvent( event ); | 1044 | mCells[iii]->insertEvent( event ); |
1045 | } | 1045 | } |
1046 | } | 1046 | } |
1047 | } | 1047 | } |
1048 | } | 1048 | } |
1049 | // insert due todos | 1049 | // insert due todos |
1050 | QPtrList<Todo> todos = calendar()->todos( ); | 1050 | QPtrList<Todo> todos = calendar()->todos( ); |
1051 | Todo *todo; | 1051 | Todo *todo; |
1052 | for(todo = todos.first(); todo; todo = todos.next()) { | 1052 | for(todo = todos.first(); todo; todo = todos.next()) { |
1053 | //insertTodo( todo ); | 1053 | //insertTodo( todo ); |
1054 | if ( todo->hasDueDate() ) { | 1054 | if ( todo->hasDueDate() ) { |
1055 | int day = mStartDate.daysTo( todo->dtDue().date() ); | 1055 | int day = mStartDate.daysTo( todo->dtDue().date() ); |
1056 | if ( day >= 0 && day < mCells.size() ) { | 1056 | if ( day >= 0 && day < mCells.size() ) { |
1057 | mCells[day]->insertTodo( todo ); | 1057 | mCells[day]->insertTodo( todo ); |
1058 | } | 1058 | } |
1059 | } | 1059 | } |
1060 | } | 1060 | } |
1061 | 1061 | ||
1062 | for( i = 0; i < mCells.count(); ++i ) { | 1062 | for( i = 0; i < mCells.count(); ++i ) { |
1063 | mCells[i]->finishUpdateCell(); | 1063 | mCells[i]->finishUpdateCell(); |
1064 | } | 1064 | } |
1065 | processSelectionChange(); | 1065 | processSelectionChange(); |
1066 | mCells[0]->setFocus(); | 1066 | mCells[0]->setFocus(); |
1067 | 1067 | ||
1068 | 1068 | ||
1069 | #else | 1069 | #else |
1070 | // old code | 1070 | // old code |
1071 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); | 1071 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); |
1072 | int i; | 1072 | int i; |
1073 | for( i = 0; i < mCells.count(); ++i ) { | 1073 | for( i = 0; i < mCells.count(); ++i ) { |
1074 | mCells[i]->updateCell(); | 1074 | mCells[i]->updateCell(); |
1075 | } | 1075 | } |
1076 | 1076 | ||
1077 | //qDebug("KOMonthView::updateView() "); | 1077 | //qDebug("KOMonthView::updateView() "); |
1078 | processSelectionChange(); | 1078 | processSelectionChange(); |
1079 | // qDebug("---------------------------------------------------------------------+ "); | 1079 | // qDebug("---------------------------------------------------------------------+ "); |
1080 | mCells[0]->setFocus(); | 1080 | mCells[0]->setFocus(); |
1081 | #endif | 1081 | #endif |
1082 | 1082 | ||
1083 | qDebug("update time %d ", ti.elapsed()); | 1083 | //qDebug("update time %d ", ti.elapsed()); |
1084 | } | 1084 | } |
1085 | 1085 | ||
1086 | void KOMonthView::resizeEvent(QResizeEvent * e) | 1086 | void KOMonthView::resizeEvent(QResizeEvent * e) |
1087 | { | 1087 | { |
1088 | computeLayout(); | 1088 | computeLayout(); |
1089 | mCells[0]->setFocus(); | 1089 | mCells[0]->setFocus(); |
1090 | } | 1090 | } |
1091 | void KOMonthView::computeLayout() | 1091 | void KOMonthView::computeLayout() |
1092 | { | 1092 | { |
1093 | // select the appropriate heading string size. E.g. "Wednesday" or "Wed". | 1093 | // select the appropriate heading string size. E.g. "Wednesday" or "Wed". |
1094 | // note this only changes the text if the requested size crosses the | 1094 | // note this only changes the text if the requested size crosses the |
1095 | // threshold between big enough to support the full name and not big | 1095 | // threshold between big enough to support the full name and not big |
1096 | // enough. | 1096 | // enough. |
1097 | 1097 | ||
1098 | int daysToShow = 7; | 1098 | int daysToShow = 7; |
1099 | bool combinedSatSun = false; | 1099 | bool combinedSatSun = false; |
1100 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { | 1100 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { |
1101 | daysToShow = 6; | 1101 | daysToShow = 6; |
1102 | combinedSatSun = true; | 1102 | combinedSatSun = true; |
1103 | } | 1103 | } |
1104 | int tWid = topLevelWidget()->size().width(); | 1104 | int tWid = topLevelWidget()->size().width(); |
1105 | int tHei = topLevelWidget()->size().height(); | 1105 | int tHei = topLevelWidget()->size().height(); |
1106 | 1106 | ||
1107 | int wid = size().width();//e | 1107 | int wid = size().width();//e |
1108 | int hei = size().height()-1; | 1108 | int hei = size().height()-1; |
1109 | 1109 | ||
1110 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) | 1110 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) |
1111 | return; | 1111 | return; |
1112 | //qDebug("KOMonthView::computeLayout()------------------------------------ "); | 1112 | //qDebug("KOMonthView::computeLayout()------------------------------------ "); |
1113 | QFontMetrics fm ( mWeekLabels[0]->font() ); | 1113 | QFontMetrics fm ( mWeekLabels[0]->font() ); |
1114 | int weeklabelwid = fm.width( "888" ); | 1114 | int weeklabelwid = fm.width( "888" ); |
1115 | wid -= weeklabelwid; | 1115 | wid -= weeklabelwid; |
1116 | 1116 | ||
1117 | int colWid = wid / daysToShow; | 1117 | int colWid = wid / daysToShow; |
1118 | int lastCol = wid - ( colWid*6 ); | 1118 | int lastCol = wid - ( colWid*6 ); |
1119 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); | 1119 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); |
1120 | int cellHei = (hei - dayLabelHei) /6; | 1120 | int cellHei = (hei - dayLabelHei) /6; |
1121 | int colModulo = wid % daysToShow; | 1121 | int colModulo = wid % daysToShow; |
1122 | int rowModulo = (hei- dayLabelHei) % 6; | 1122 | int rowModulo = (hei- dayLabelHei) % 6; |
1123 | //qDebug("rowmod %d ", rowModulo); | 1123 | //qDebug("rowmod %d ", rowModulo); |
1124 | int i; | 1124 | int i; |
1125 | int x,y,w,h; | 1125 | int x,y,w,h; |
1126 | x= 0; | 1126 | x= 0; |
1127 | y= 0; | 1127 | y= 0; |
1128 | w = colWid; | 1128 | w = colWid; |
1129 | h = dayLabelHei ; | 1129 | h = dayLabelHei ; |
1130 | for ( i = 0; i < 7; i++) { | 1130 | for ( i = 0; i < 7; i++) { |
1131 | if ( i == daysToShow-colModulo ) | 1131 | if ( i == daysToShow-colModulo ) |
1132 | ++w; | 1132 | ++w; |
1133 | if ( combinedSatSun ) { | 1133 | if ( combinedSatSun ) { |
1134 | if ( i >= daysToShow-1 ) { | 1134 | if ( i >= daysToShow-1 ) { |
1135 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); | 1135 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); |
1136 | x -= w/2 ; | 1136 | x -= w/2 ; |
1137 | } | 1137 | } |
1138 | else | 1138 | else |
1139 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); | 1139 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); |
1140 | } else | 1140 | } else |
1141 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); | 1141 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); |
1142 | x += w; | 1142 | x += w; |
1143 | } | 1143 | } |
1144 | x= 0; | 1144 | x= 0; |
1145 | y= dayLabelHei; | 1145 | y= dayLabelHei; |
1146 | w = colWid; | 1146 | w = colWid; |
1147 | h = cellHei ; | 1147 | h = cellHei ; |
1148 | for ( i = 0; i < mCells.count(); ++i) { | 1148 | for ( i = 0; i < mCells.count(); ++i) { |
1149 | 1149 | ||
1150 | w = colWid; | 1150 | w = colWid; |
1151 | if ( ((i) % 7) >= 7-colModulo ) { | 1151 | if ( ((i) % 7) >= 7-colModulo ) { |
1152 | ++w; | 1152 | ++w; |
1153 | } | 1153 | } |
1154 | if ( i == (6-rowModulo)*7) | 1154 | if ( i == (6-rowModulo)*7) |
1155 | ++h; | 1155 | ++h; |
1156 | if ( combinedSatSun ) { | 1156 | if ( combinedSatSun ) { |
1157 | if ( (i)%7 >= daysToShow-1 ) { | 1157 | if ( (i)%7 >= daysToShow-1 ) { |
1158 | if ( (i)%7 == daysToShow-1 ) { | 1158 | if ( (i)%7 == daysToShow-1 ) { |
1159 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); | 1159 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); |
1160 | x -= w ;y += h/2; | 1160 | x -= w ;y += h/2; |
1161 | } else { | 1161 | } else { |
1162 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); | 1162 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); |
1163 | y -= h/2; | 1163 | y -= h/2; |
1164 | } | 1164 | } |
1165 | } else | 1165 | } else |
1166 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1166 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1167 | 1167 | ||
1168 | } | 1168 | } |
1169 | else | 1169 | else |
1170 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1170 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1171 | x += w; | 1171 | x += w; |
1172 | if ( x + w/2 > wid ) { | 1172 | if ( x + w/2 > wid ) { |
1173 | x = 0; | 1173 | x = 0; |
1174 | y += h; | 1174 | y += h; |
1175 | } | 1175 | } |
1176 | } | 1176 | } |
1177 | y= dayLabelHei; | 1177 | y= dayLabelHei; |
1178 | h = cellHei ; | 1178 | h = cellHei ; |
1179 | for ( i = 0; i < 6; i++) { | 1179 | for ( i = 0; i < 6; i++) { |
1180 | if ( i == (6-rowModulo)) | 1180 | if ( i == (6-rowModulo)) |
1181 | ++h; | 1181 | ++h; |
1182 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); | 1182 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); |
1183 | y += h; | 1183 | y += h; |
1184 | } | 1184 | } |
1185 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); | 1185 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); |
1186 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); | 1186 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); |
1187 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); | 1187 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); |
1188 | mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ; | 1188 | mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ; |
1189 | updateDayLabels(); | 1189 | updateDayLabels(); |
1190 | bool forceUpdate = !updatePossible; | 1190 | bool forceUpdate = !updatePossible; |
1191 | updatePossible = true; | 1191 | updatePossible = true; |
1192 | if ( forceUpdate ) | 1192 | if ( forceUpdate ) |
1193 | updateView(); | 1193 | updateView(); |
1194 | } | 1194 | } |
1195 | 1195 | ||
1196 | void KOMonthView::showContextMenu( Incidence *incidence ) | 1196 | void KOMonthView::showContextMenu( Incidence *incidence ) |
1197 | { | 1197 | { |
1198 | mContextMenu->showIncidencePopup(incidence); | 1198 | mContextMenu->showIncidencePopup(incidence); |
1199 | /* | 1199 | /* |
1200 | if( incidence && incidence->type() == "Event" ) { | 1200 | if( incidence && incidence->type() == "Event" ) { |
1201 | Event *event = static_cast<Event *>(incidence); | 1201 | Event *event = static_cast<Event *>(incidence); |
1202 | mContextMenu->showEventPopup(event); | 1202 | mContextMenu->showEventPopup(event); |
1203 | } else { | 1203 | } else { |
1204 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; | 1204 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; |
1205 | } | 1205 | } |
1206 | */ | 1206 | */ |
1207 | } | 1207 | } |
1208 | MonthViewCell * KOMonthView::selectedCell( ) | 1208 | MonthViewCell * KOMonthView::selectedCell( ) |
1209 | { | 1209 | { |
1210 | return mSelectedCell; | 1210 | return mSelectedCell; |
1211 | } | 1211 | } |
1212 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) | 1212 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) |
1213 | { | 1213 | { |
1214 | // qDebug("KOMonthView::setSelectedCell "); | 1214 | // qDebug("KOMonthView::setSelectedCell "); |
1215 | if ( mSelectedCell && mSelectedCell != cell ) { | 1215 | if ( mSelectedCell && mSelectedCell != cell ) { |
1216 | MonthViewCell * mvc = mSelectedCell; | 1216 | MonthViewCell * mvc = mSelectedCell; |
1217 | mSelectedCell = cell; | 1217 | mSelectedCell = cell; |
1218 | mvc->deselect(); | 1218 | mvc->deselect(); |
1219 | } else | 1219 | } else |
1220 | mSelectedCell = cell; | 1220 | mSelectedCell = cell; |
1221 | // if ( mSelectedCell ) | 1221 | // if ( mSelectedCell ) |
1222 | // mSelectedCell->select(); | 1222 | // mSelectedCell->select(); |
1223 | if ( !mSelectedCell ) | 1223 | if ( !mSelectedCell ) |
1224 | emit incidenceSelected( 0 ); | 1224 | emit incidenceSelected( 0 ); |
1225 | else | 1225 | else |
1226 | emit incidenceSelected( mSelectedCell->selectedIncidence() ); | 1226 | emit incidenceSelected( mSelectedCell->selectedIncidence() ); |
1227 | } | 1227 | } |
1228 | 1228 | ||
1229 | void KOMonthView::processSelectionChange() | 1229 | void KOMonthView::processSelectionChange() |
1230 | { | 1230 | { |
1231 | QPtrList<Incidence> incidences = selectedIncidences(); | 1231 | QPtrList<Incidence> incidences = selectedIncidences(); |
1232 | if (incidences.count() > 0) { | 1232 | if (incidences.count() > 0) { |
1233 | emit incidenceSelected( incidences.first() ); | 1233 | emit incidenceSelected( incidences.first() ); |
1234 | } else { | 1234 | } else { |
1235 | emit incidenceSelected( 0 ); | 1235 | emit incidenceSelected( 0 ); |
1236 | } | 1236 | } |
1237 | } | 1237 | } |
1238 | 1238 | ||
1239 | void KOMonthView::clearSelection() | 1239 | void KOMonthView::clearSelection() |
1240 | { | 1240 | { |
1241 | if ( mSelectedCell ) { | 1241 | if ( mSelectedCell ) { |
1242 | mSelectedCell->deselect(); | 1242 | mSelectedCell->deselect(); |
1243 | mSelectedCell = 0; | 1243 | mSelectedCell = 0; |
1244 | } | 1244 | } |
1245 | } | 1245 | } |
1246 | void KOMonthView::keyPressEvent ( QKeyEvent * e ) | 1246 | void KOMonthView::keyPressEvent ( QKeyEvent * e ) |
1247 | { | 1247 | { |
1248 | //qDebug("KOMonthView::keyPressEvent "); | 1248 | //qDebug("KOMonthView::keyPressEvent "); |
1249 | switch(e->key()) { | 1249 | switch(e->key()) { |
1250 | case Key_Up: | 1250 | case Key_Up: |
1251 | { | 1251 | { |
1252 | emit prevMonth(); | 1252 | emit prevMonth(); |
1253 | mCells[0]->setFocus(); | 1253 | mCells[0]->setFocus(); |
1254 | } | 1254 | } |
1255 | e->accept(); | 1255 | e->accept(); |
1256 | break; | 1256 | break; |
1257 | case Key_Down: | 1257 | case Key_Down: |
1258 | { | 1258 | { |
1259 | emit nextMonth(); | 1259 | emit nextMonth(); |
1260 | mCells[0]->setFocus(); | 1260 | mCells[0]->setFocus(); |
1261 | 1261 | ||
1262 | } | 1262 | } |
1263 | e->accept(); | 1263 | e->accept(); |
1264 | break; | 1264 | break; |
1265 | default: | 1265 | default: |
1266 | e->ignore(); | 1266 | e->ignore(); |
1267 | break; | 1267 | break; |
1268 | } | 1268 | } |
1269 | } | 1269 | } |
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 82437d8..99402c4 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -1,1258 +1,1271 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qlayout.h> | 24 | #include <qlayout.h> |
25 | #include <qheader.h> | 25 | #include <qheader.h> |
26 | #include <qcursor.h> | 26 | #include <qcursor.h> |
27 | 27 | ||
28 | #include <qvbox.h> | 28 | #include <qvbox.h> |
29 | #include <kdebug.h> | 29 | #include <kdebug.h> |
30 | #include "koprefs.h" | 30 | #include "koprefs.h" |
31 | #include <klocale.h> | 31 | #include <klocale.h> |
32 | #include <kglobal.h> | 32 | #include <kglobal.h> |
33 | #include <kiconloader.h> | 33 | #include <kiconloader.h> |
34 | #include <kmessagebox.h> | 34 | #include <kmessagebox.h> |
35 | 35 | ||
36 | #include <libkcal/icaldrag.h> | 36 | #include <libkcal/icaldrag.h> |
37 | #include <libkcal/vcaldrag.h> | 37 | #include <libkcal/vcaldrag.h> |
38 | #include <libkcal/calfilter.h> | 38 | #include <libkcal/calfilter.h> |
39 | #include <libkcal/dndfactory.h> | 39 | #include <libkcal/dndfactory.h> |
40 | #include <libkcal/calendarresources.h> | 40 | #include <libkcal/calendarresources.h> |
41 | #include <libkcal/resourcecalendar.h> | 41 | #include <libkcal/resourcecalendar.h> |
42 | #include <kresources/resourceselectdialog.h> | 42 | #include <kresources/resourceselectdialog.h> |
43 | #ifndef DESKTOP_VERSION | 43 | #ifndef DESKTOP_VERSION |
44 | #include <qpe/qpeapplication.h> | 44 | #include <qpe/qpeapplication.h> |
45 | #else | 45 | #else |
46 | #include <qapplication.h> | 46 | #include <qapplication.h> |
47 | #endif | 47 | #endif |
48 | #ifndef KORG_NOPRINTER | 48 | #ifndef KORG_NOPRINTER |
49 | #include "calprinter.h" | 49 | #include "calprinter.h" |
50 | #endif | 50 | #endif |
51 | #include "docprefs.h" | 51 | #include "docprefs.h" |
52 | 52 | ||
53 | #include "kotodoview.h" | 53 | #include "kotodoview.h" |
54 | using namespace KOrg; | 54 | using namespace KOrg; |
55 | 55 | ||
56 | KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent, | 56 | KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent, |
57 | const char *name) : | 57 | const char *name) : |
58 | KListView(parent,name) | 58 | KListView(parent,name) |
59 | { | 59 | { |
60 | mName = QString ( name ); | 60 | mName = QString ( name ); |
61 | mCalendar = calendar; | 61 | mCalendar = calendar; |
62 | #ifndef DESKTOP_VERSION | 62 | #ifndef DESKTOP_VERSION |
63 | QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); | 63 | QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); |
64 | #endif | 64 | #endif |
65 | mOldCurrent = 0; | 65 | mOldCurrent = 0; |
66 | mMousePressed = false; | 66 | mMousePressed = false; |
67 | 67 | ||
68 | setAcceptDrops(true); | 68 | setAcceptDrops(true); |
69 | viewport()->setAcceptDrops(true); | 69 | viewport()->setAcceptDrops(true); |
70 | int size = 16; | 70 | int size = 16; |
71 | if (qApp->desktop()->width() < 300 ) | 71 | if (qApp->desktop()->width() < 300 ) |
72 | size = 12; | 72 | size = 12; |
73 | setTreeStepSize( size + 6 ); | 73 | setTreeStepSize( size + 6 ); |
74 | 74 | ||
75 | } | 75 | } |
76 | 76 | ||
77 | void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e) | 77 | void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e) |
78 | { | 78 | { |
79 | #ifndef KORG_NODND | 79 | #ifndef KORG_NODND |
80 | // kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl; | 80 | // kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl; |
81 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && | 81 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && |
82 | !QTextDrag::canDecode( e ) ) { | 82 | !QTextDrag::canDecode( e ) ) { |
83 | e->ignore(); | 83 | e->ignore(); |
84 | return; | 84 | return; |
85 | } | 85 | } |
86 | 86 | ||
87 | mOldCurrent = currentItem(); | 87 | mOldCurrent = currentItem(); |
88 | #endif | 88 | #endif |
89 | } | 89 | } |
90 | 90 | ||
91 | 91 | ||
92 | void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e) | 92 | void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e) |
93 | { | 93 | { |
94 | #ifndef KORG_NODND | 94 | #ifndef KORG_NODND |
95 | // kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl; | 95 | // kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl; |
96 | 96 | ||
97 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && | 97 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && |
98 | !QTextDrag::canDecode( e ) ) { | 98 | !QTextDrag::canDecode( e ) ) { |
99 | e->ignore(); | 99 | e->ignore(); |
100 | return; | 100 | return; |
101 | } | 101 | } |
102 | 102 | ||
103 | e->accept(); | 103 | e->accept(); |
104 | #endif | 104 | #endif |
105 | } | 105 | } |
106 | 106 | ||
107 | void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *) | 107 | void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *) |
108 | { | 108 | { |
109 | #ifndef KORG_NODND | 109 | #ifndef KORG_NODND |
110 | // kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl; | 110 | // kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl; |
111 | 111 | ||
112 | setCurrentItem(mOldCurrent); | 112 | setCurrentItem(mOldCurrent); |
113 | setSelected(mOldCurrent,true); | 113 | setSelected(mOldCurrent,true); |
114 | #endif | 114 | #endif |
115 | } | 115 | } |
116 | 116 | ||
117 | void KOTodoListView::contentsDropEvent(QDropEvent *e) | 117 | void KOTodoListView::contentsDropEvent(QDropEvent *e) |
118 | { | 118 | { |
119 | #ifndef KORG_NODND | 119 | #ifndef KORG_NODND |
120 | // kdDebug() << "KOTodoListView::contentsDropEvent" << endl; | 120 | // kdDebug() << "KOTodoListView::contentsDropEvent" << endl; |
121 | 121 | ||
122 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && | 122 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && |
123 | !QTextDrag::canDecode( e ) ) { | 123 | !QTextDrag::canDecode( e ) ) { |
124 | e->ignore(); | 124 | e->ignore(); |
125 | return; | 125 | return; |
126 | } | 126 | } |
127 | 127 | ||
128 | DndFactory factory( mCalendar ); | 128 | DndFactory factory( mCalendar ); |
129 | Todo *todo = factory.createDropTodo(e); | 129 | Todo *todo = factory.createDropTodo(e); |
130 | 130 | ||
131 | if (todo) { | 131 | if (todo) { |
132 | e->acceptAction(); | 132 | e->acceptAction(); |
133 | 133 | ||
134 | KOTodoViewItem *destination = | 134 | KOTodoViewItem *destination = |
135 | (KOTodoViewItem *)itemAt(contentsToViewport(e->pos())); | 135 | (KOTodoViewItem *)itemAt(contentsToViewport(e->pos())); |
136 | Todo *destinationEvent = 0; | 136 | Todo *destinationEvent = 0; |
137 | if (destination) destinationEvent = destination->todo(); | 137 | if (destination) destinationEvent = destination->todo(); |
138 | 138 | ||
139 | Todo *existingTodo = mCalendar->todo(todo->uid()); | 139 | Todo *existingTodo = mCalendar->todo(todo->uid()); |
140 | 140 | ||
141 | if(existingTodo) { | 141 | if(existingTodo) { |
142 | Incidence *to = destinationEvent; | 142 | Incidence *to = destinationEvent; |
143 | while(to) { | 143 | while(to) { |
144 | if (to->uid() == todo->uid()) { | 144 | if (to->uid() == todo->uid()) { |
145 | KMessageBox::sorry(this, | 145 | KMessageBox::sorry(this, |
146 | i18n("Cannot move To-Do to itself\nor a child of itself"), | 146 | i18n("Cannot move To-Do to itself\nor a child of itself"), |
147 | i18n("Drop To-Do")); | 147 | i18n("Drop To-Do")); |
148 | delete todo; | 148 | delete todo; |
149 | return; | 149 | return; |
150 | } | 150 | } |
151 | to = to->relatedTo(); | 151 | to = to->relatedTo(); |
152 | } | 152 | } |
153 | internalDrop = true; | 153 | internalDrop = true; |
154 | if ( destinationEvent ) | 154 | if ( destinationEvent ) |
155 | reparentTodoSignal( destinationEvent, existingTodo ); | 155 | reparentTodoSignal( destinationEvent, existingTodo ); |
156 | else | 156 | else |
157 | unparentTodoSignal(existingTodo); | 157 | unparentTodoSignal(existingTodo); |
158 | delete todo; | 158 | delete todo; |
159 | } else { | 159 | } else { |
160 | mCalendar->addTodo(todo); | 160 | mCalendar->addTodo(todo); |
161 | emit todoDropped(todo, KOGlobals::EVENTADDED); | 161 | emit todoDropped(todo, KOGlobals::EVENTADDED); |
162 | if ( destinationEvent ) | 162 | if ( destinationEvent ) |
163 | reparentTodoSignal( destinationEvent, todo ); | 163 | reparentTodoSignal( destinationEvent, todo ); |
164 | } | 164 | } |
165 | } | 165 | } |
166 | else { | 166 | else { |
167 | QString text; | 167 | QString text; |
168 | if (QTextDrag::decode(e,text)) { | 168 | if (QTextDrag::decode(e,text)) { |
169 | //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) ); | 169 | //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) ); |
170 | KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) )); | 170 | KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) )); |
171 | qDebug("Dropped : " + text); | 171 | qDebug("Dropped : " + text); |
172 | QStringList emails = QStringList::split(",",text); | 172 | QStringList emails = QStringList::split(",",text); |
173 | for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { | 173 | for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { |
174 | int pos = (*it).find("<"); | 174 | int pos = (*it).find("<"); |
175 | QString name = (*it).left(pos); | 175 | QString name = (*it).left(pos); |
176 | QString email = (*it).mid(pos); | 176 | QString email = (*it).mid(pos); |
177 | if (!email.isEmpty() && todoi) { | 177 | if (!email.isEmpty() && todoi) { |
178 | todoi->todo()->addAttendee(new Attendee(name,email)); | 178 | todoi->todo()->addAttendee(new Attendee(name,email)); |
179 | } | 179 | } |
180 | } | 180 | } |
181 | } | 181 | } |
182 | else { | 182 | else { |
183 | qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable "); | 183 | qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable "); |
184 | e->ignore(); | 184 | e->ignore(); |
185 | } | 185 | } |
186 | } | 186 | } |
187 | #endif | 187 | #endif |
188 | } | 188 | } |
189 | 189 | ||
190 | void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) | 190 | void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) |
191 | { | 191 | { |
192 | #ifndef KORG_NODND | 192 | #ifndef KORG_NODND |
193 | QPoint p(contentsToViewport(e->pos())); | 193 | QPoint p(contentsToViewport(e->pos())); |
194 | QListViewItem *i = itemAt(p); | 194 | QListViewItem *i = itemAt(p); |
195 | mMousePressed = false; | 195 | mMousePressed = false; |
196 | if (i) { | 196 | if (i) { |
197 | // if the user clicked into the root decoration of the item, don't | 197 | // if the user clicked into the root decoration of the item, don't |
198 | // try to start a drag! | 198 | // try to start a drag! |
199 | if (p.x() > header()->sectionPos(header()->mapToIndex(0)) + | 199 | if (p.x() > header()->sectionPos(header()->mapToIndex(0)) + |
200 | treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + | 200 | treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + |
201 | itemMargin() || | 201 | itemMargin() || |
202 | p.x() < header()->sectionPos(header()->mapToIndex(0))) { | 202 | p.x() < header()->sectionPos(header()->mapToIndex(0))) { |
203 | if (e->button()==Qt::LeftButton) { | 203 | if (e->button()==Qt::LeftButton) { |
204 | mPressPos = e->pos(); | 204 | mPressPos = e->pos(); |
205 | mMousePressed = true; | 205 | mMousePressed = true; |
206 | } | 206 | } |
207 | } | 207 | } |
208 | } | 208 | } |
209 | #endif | 209 | #endif |
210 | QListView::contentsMousePressEvent(e); | 210 | QListView::contentsMousePressEvent(e); |
211 | } | 211 | } |
212 | 212 | void KOTodoListView::paintEvent(QPaintEvent* e) | |
213 | { | ||
214 | emit paintNeeded(); | ||
215 | QListView::paintEvent( e); | ||
216 | } | ||
213 | void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) | 217 | void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) |
214 | { | 218 | { |
215 | 219 | ||
216 | #ifndef KORG_NODND | 220 | #ifndef KORG_NODND |
217 | QListView::contentsMouseMoveEvent(e); | 221 | QListView::contentsMouseMoveEvent(e); |
218 | if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > | 222 | if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > |
219 | QApplication::startDragDistance()) { | 223 | QApplication::startDragDistance()) { |
220 | mMousePressed = false; | 224 | mMousePressed = false; |
221 | QListViewItem *item = itemAt(contentsToViewport(mPressPos)); | 225 | QListViewItem *item = itemAt(contentsToViewport(mPressPos)); |
222 | if (item) { | 226 | if (item) { |
223 | DndFactory factory( mCalendar ); | 227 | DndFactory factory( mCalendar ); |
224 | ICalDrag *vd = factory.createDrag( | 228 | ICalDrag *vd = factory.createDrag( |
225 | ((KOTodoViewItem *)item)->todo(),viewport()); | 229 | ((KOTodoViewItem *)item)->todo(),viewport()); |
226 | internalDrop = false; | 230 | internalDrop = false; |
227 | // we cannot do any senseful here, because the DnD is still broken in Qt | 231 | // we cannot do any senseful here, because the DnD is still broken in Qt |
228 | if (vd->drag()) { | 232 | if (vd->drag()) { |
229 | if ( !internalDrop ) { | 233 | if ( !internalDrop ) { |
230 | //emit deleteTodo( ((KOTodoViewItem *)item)->todo() ); | 234 | //emit deleteTodo( ((KOTodoViewItem *)item)->todo() ); |
231 | qDebug("Dnd: External move: Delete drag source "); | 235 | qDebug("Dnd: External move: Delete drag source "); |
232 | } else | 236 | } else |
233 | qDebug("Dnd: Internal move "); | 237 | qDebug("Dnd: Internal move "); |
234 | 238 | ||
235 | } else { | 239 | } else { |
236 | if ( !internalDrop ) { | 240 | if ( !internalDrop ) { |
237 | qDebug("Dnd: External Copy"); | 241 | qDebug("Dnd: External Copy"); |
238 | } else | 242 | } else |
239 | qDebug("DnD: Internal copy: Copy pending"); | 243 | qDebug("DnD: Internal copy: Copy pending"); |
240 | } | 244 | } |
241 | } | 245 | } |
242 | } | 246 | } |
243 | #endif | 247 | #endif |
244 | } | 248 | } |
245 | void KOTodoListView::keyPressEvent ( QKeyEvent * e ) | 249 | void KOTodoListView::keyPressEvent ( QKeyEvent * e ) |
246 | { | 250 | { |
247 | 251 | ||
248 | QListViewItem* cn; | 252 | QListViewItem* cn; |
249 | if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) { | 253 | if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) { |
250 | cn = currentItem(); | 254 | cn = currentItem(); |
251 | if ( cn ) { | 255 | if ( cn ) { |
252 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); | 256 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); |
253 | if ( ci ){ | 257 | if ( ci ){ |
254 | if ( e->state() == ShiftButton ) | 258 | if ( e->state() == ShiftButton ) |
255 | ci->setOn( false ); | 259 | ci->setOn( false ); |
256 | else | 260 | else |
257 | ci->setOn( true ); | 261 | ci->setOn( true ); |
258 | cn = cn->itemBelow(); | 262 | cn = cn->itemBelow(); |
259 | if ( cn ) { | 263 | if ( cn ) { |
260 | setCurrentItem ( cn ); | 264 | setCurrentItem ( cn ); |
261 | ensureItemVisible ( cn ); | 265 | ensureItemVisible ( cn ); |
262 | } | 266 | } |
263 | 267 | ||
264 | } | 268 | } |
265 | } | 269 | } |
266 | 270 | ||
267 | return; | 271 | return; |
268 | } | 272 | } |
269 | 273 | ||
270 | // qDebug("KOTodoListView::keyPressEvent "); | 274 | // qDebug("KOTodoListView::keyPressEvent "); |
271 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { | 275 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { |
272 | switch ( e->key() ) { | 276 | switch ( e->key() ) { |
273 | case Qt::Key_Down: | 277 | case Qt::Key_Down: |
274 | case Qt::Key_Up: | 278 | case Qt::Key_Up: |
275 | QListView::keyPressEvent ( e ); | 279 | QListView::keyPressEvent ( e ); |
276 | break; | 280 | break; |
277 | case Qt::Key_Left: | 281 | case Qt::Key_Left: |
278 | case Qt::Key_Right: | 282 | case Qt::Key_Right: |
279 | QListView::keyPressEvent ( e ); | 283 | QListView::keyPressEvent ( e ); |
280 | e->accept(); | 284 | e->accept(); |
281 | return; | 285 | return; |
282 | break; | 286 | break; |
283 | default: | 287 | default: |
284 | e->ignore(); | 288 | e->ignore(); |
285 | break; | 289 | break; |
286 | } | 290 | } |
287 | return; | 291 | return; |
288 | } | 292 | } |
289 | e->ignore(); | 293 | e->ignore(); |
290 | } | 294 | } |
291 | void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) | 295 | void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) |
292 | { | 296 | { |
293 | QListView::contentsMouseReleaseEvent(e); | 297 | QListView::contentsMouseReleaseEvent(e); |
294 | mMousePressed = false; | 298 | mMousePressed = false; |
295 | } | 299 | } |
296 | 300 | ||
297 | void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) | 301 | void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) |
298 | { | 302 | { |
299 | if (!e) return; | 303 | if (!e) return; |
300 | 304 | ||
301 | QPoint vp = contentsToViewport(e->pos()); | 305 | QPoint vp = contentsToViewport(e->pos()); |
302 | 306 | ||
303 | QListViewItem *item = itemAt(vp); | 307 | QListViewItem *item = itemAt(vp); |
304 | 308 | ||
305 | emit double_Clicked(item); | 309 | emit double_Clicked(item); |
306 | if (!item) return; | 310 | if (!item) return; |
307 | 311 | ||
308 | emit doubleClicked(item,vp,0); | 312 | emit doubleClicked(item,vp,0); |
309 | } | 313 | } |
310 | 314 | ||
311 | ///////////////////////////////////////////////////////////////////////////// | 315 | ///////////////////////////////////////////////////////////////////////////// |
312 | 316 | ||
313 | KOQuickTodo::KOQuickTodo(QWidget *parent) : | 317 | KOQuickTodo::KOQuickTodo(QWidget *parent) : |
314 | QLineEdit(parent) | 318 | QLineEdit(parent) |
315 | { | 319 | { |
316 | setText(i18n("Click to add a new Todo")); | 320 | setText(i18n("Click to add a new Todo")); |
317 | } | 321 | } |
318 | 322 | ||
319 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) | 323 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) |
320 | { | 324 | { |
321 | if ( text()==i18n("Click to add a new Todo") ) | 325 | if ( text()==i18n("Click to add a new Todo") ) |
322 | setText(""); | 326 | setText(""); |
323 | QLineEdit::focusInEvent(ev); | 327 | QLineEdit::focusInEvent(ev); |
324 | } | 328 | } |
325 | 329 | ||
326 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) | 330 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) |
327 | { | 331 | { |
328 | setText(i18n("Click to add a new Todo")); | 332 | setText(i18n("Click to add a new Todo")); |
329 | QLineEdit::focusOutEvent(ev); | 333 | QLineEdit::focusOutEvent(ev); |
330 | } | 334 | } |
331 | 335 | ||
332 | ///////////////////////////////////////////////////////////////////////////// | 336 | ///////////////////////////////////////////////////////////////////////////// |
333 | 337 | ||
334 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | 338 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : |
335 | KOrg::BaseView(calendar,parent,name) | 339 | KOrg::BaseView(calendar,parent,name) |
336 | { | 340 | { |
337 | mPendingUpdateBeforeRepaint = false; | 341 | mPendingUpdateBeforeRepaint = false; |
338 | isFlatDisplay = false; | 342 | isFlatDisplay = false; |
339 | mNavigator = 0; | 343 | mNavigator = 0; |
340 | QBoxLayout *topLayout = new QVBoxLayout(this); | 344 | QBoxLayout *topLayout = new QVBoxLayout(this); |
341 | mName = QString ( name ); | 345 | mName = QString ( name ); |
342 | mBlockUpdate = false; | 346 | mBlockUpdate = false; |
343 | mQuickAdd = new KOQuickTodo(this); | 347 | mQuickAdd = new KOQuickTodo(this); |
344 | topLayout->addWidget(mQuickAdd); | 348 | topLayout->addWidget(mQuickAdd); |
345 | 349 | ||
346 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); | 350 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); |
347 | 351 | ||
348 | mTodoListView = new KOTodoListView(calendar,this, name ); | 352 | mTodoListView = new KOTodoListView(calendar,this, name ); |
349 | topLayout->addWidget(mTodoListView); | 353 | topLayout->addWidget(mTodoListView); |
350 | //mTodoListView->header()->setMaximumHeight(30); | 354 | //mTodoListView->header()->setMaximumHeight(30); |
351 | mTodoListView->setRootIsDecorated(true); | 355 | mTodoListView->setRootIsDecorated(true); |
352 | mTodoListView->setAllColumnsShowFocus(true); | 356 | mTodoListView->setAllColumnsShowFocus(true); |
353 | 357 | ||
354 | mTodoListView->setShowSortIndicator(true); | 358 | mTodoListView->setShowSortIndicator(true); |
355 | 359 | ||
356 | mTodoListView->addColumn(i18n("Todo")); | 360 | mTodoListView->addColumn(i18n("Todo")); |
357 | mTodoListView->addColumn(i18n("Prio")); | 361 | mTodoListView->addColumn(i18n("Prio")); |
358 | mTodoListView->setColumnAlignment(1,AlignHCenter); | 362 | mTodoListView->setColumnAlignment(1,AlignHCenter); |
359 | mTodoListView->addColumn(i18n("Complete")); | 363 | mTodoListView->addColumn(i18n("Complete")); |
360 | mTodoListView->setColumnAlignment(2,AlignCenter); | 364 | mTodoListView->setColumnAlignment(2,AlignCenter); |
361 | 365 | ||
362 | mTodoListView->addColumn(i18n("Due Date")); | 366 | mTodoListView->addColumn(i18n("Due Date")); |
363 | mTodoListView->setColumnAlignment(3,AlignLeft); | 367 | mTodoListView->setColumnAlignment(3,AlignLeft); |
364 | mTodoListView->addColumn(i18n("Due Time")); | 368 | mTodoListView->addColumn(i18n("Due Time")); |
365 | mTodoListView->setColumnAlignment(4,AlignHCenter); | 369 | mTodoListView->setColumnAlignment(4,AlignHCenter); |
366 | 370 | ||
367 | mTodoListView->addColumn(i18n("Start Date")); | 371 | mTodoListView->addColumn(i18n("Start Date")); |
368 | mTodoListView->setColumnAlignment(5,AlignLeft); | 372 | mTodoListView->setColumnAlignment(5,AlignLeft); |
369 | mTodoListView->addColumn(i18n("Start Time")); | 373 | mTodoListView->addColumn(i18n("Start Time")); |
370 | mTodoListView->setColumnAlignment(6,AlignHCenter); | 374 | mTodoListView->setColumnAlignment(6,AlignHCenter); |
371 | 375 | ||
372 | mTodoListView->addColumn(i18n("Cancelled")); | 376 | mTodoListView->addColumn(i18n("Cancelled")); |
373 | mTodoListView->addColumn(i18n("Categories")); | 377 | mTodoListView->addColumn(i18n("Categories")); |
374 | #if 0 | 378 | #if 0 |
375 | mTodoListView->addColumn(i18n("Sort Id")); | 379 | mTodoListView->addColumn(i18n("Sort Id")); |
376 | mTodoListView->setColumnAlignment(4,AlignHCenter); | 380 | mTodoListView->setColumnAlignment(4,AlignHCenter); |
377 | #endif | 381 | #endif |
378 | 382 | ||
379 | mTodoListView->setMinimumHeight( 60 ); | 383 | mTodoListView->setMinimumHeight( 60 ); |
380 | mTodoListView->setItemsRenameable( true ); | 384 | mTodoListView->setItemsRenameable( true ); |
381 | mTodoListView->setRenameable( 0 ); | 385 | mTodoListView->setRenameable( 0 ); |
382 | mTodoListView->setColumnWidth( 0, 120 ); | 386 | mTodoListView->setColumnWidth( 0, 120 ); |
383 | mTodoListView->setColumnWidthMode(0, QListView::Manual); | 387 | mTodoListView->setColumnWidthMode(0, QListView::Manual); |
384 | mTodoListView->setColumnWidthMode(1, QListView::Manual); | 388 | mTodoListView->setColumnWidthMode(1, QListView::Manual); |
385 | mTodoListView->setColumnWidthMode(2, QListView::Manual); | 389 | mTodoListView->setColumnWidthMode(2, QListView::Manual); |
386 | mTodoListView->setColumnWidthMode(3, QListView::Manual); | 390 | mTodoListView->setColumnWidthMode(3, QListView::Manual); |
387 | mTodoListView->setColumnWidthMode(4, QListView::Manual); | 391 | mTodoListView->setColumnWidthMode(4, QListView::Manual); |
388 | mTodoListView->setColumnWidthMode(5, QListView::Manual); | 392 | mTodoListView->setColumnWidthMode(5, QListView::Manual); |
389 | mTodoListView->setColumnWidthMode(6, QListView::Manual); | 393 | mTodoListView->setColumnWidthMode(6, QListView::Manual); |
390 | mTodoListView->setColumnWidthMode(7, QListView::Manual); | 394 | mTodoListView->setColumnWidthMode(7, QListView::Manual); |
391 | mTodoListView->setColumnWidthMode(8, QListView::Manual); | 395 | mTodoListView->setColumnWidthMode(8, QListView::Manual); |
392 | 396 | ||
393 | 397 | ||
394 | mPriorityPopupMenu = new QPopupMenu(this); | 398 | mPriorityPopupMenu = new QPopupMenu(this); |
395 | for (int i = 1; i <= 5; i++) { | 399 | for (int i = 1; i <= 5; i++) { |
396 | QString label = QString ("%1").arg (i); | 400 | QString label = QString ("%1").arg (i); |
397 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; | 401 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; |
398 | } | 402 | } |
399 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); | 403 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); |
400 | 404 | ||
401 | mPercentageCompletedPopupMenu = new QPopupMenu(this); | 405 | mPercentageCompletedPopupMenu = new QPopupMenu(this); |
402 | for (int i = 0; i <= 100; i+=20) { | 406 | for (int i = 0; i <= 100; i+=20) { |
403 | QString label = QString ("%1 %").arg (i); | 407 | QString label = QString ("%1 %").arg (i); |
404 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; | 408 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; |
405 | } | 409 | } |
406 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); | 410 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); |
407 | 411 | ||
408 | 412 | ||
409 | 413 | ||
410 | mItemPopupMenu = new QPopupMenu(this); | 414 | mItemPopupMenu = new QPopupMenu(this); |
411 | mItemPopupMenu->insertItem(i18n("Show..."), this, | 415 | mItemPopupMenu->insertItem(i18n("Show..."), this, |
412 | SLOT (showTodo())); | 416 | SLOT (showTodo())); |
413 | mItemPopupMenu->insertItem(i18n("Edit..."), this, | 417 | mItemPopupMenu->insertItem(i18n("Edit..."), this, |
414 | SLOT (editTodo())); | 418 | SLOT (editTodo())); |
415 | mItemPopupMenu->insertItem( i18n("Delete"), this, | 419 | mItemPopupMenu->insertItem( i18n("Delete"), this, |
416 | SLOT (deleteTodo())); | 420 | SLOT (deleteTodo())); |
417 | mItemPopupMenu->insertItem( i18n("Clone..."), this, | 421 | mItemPopupMenu->insertItem( i18n("Clone..."), this, |
418 | SLOT (cloneTodo())); | 422 | SLOT (cloneTodo())); |
419 | mItemPopupMenu->insertItem( i18n("Move..."), this, | 423 | mItemPopupMenu->insertItem( i18n("Move..."), this, |
420 | SLOT (moveTodo())); | 424 | SLOT (moveTodo())); |
421 | mItemPopupMenu->insertItem( i18n("Beam..."), this, | 425 | mItemPopupMenu->insertItem( i18n("Beam..."), this, |
422 | SLOT (beamTodo())); | 426 | SLOT (beamTodo())); |
423 | mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, | 427 | mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, |
424 | SLOT (cancelTodo())); | 428 | SLOT (cancelTodo())); |
425 | mItemPopupMenu->insertSeparator(); | 429 | mItemPopupMenu->insertSeparator(); |
426 | 430 | ||
427 | mItemPopupMenu->insertItem( i18n("New Todo..."), this, | 431 | mItemPopupMenu->insertItem( i18n("New Todo..."), this, |
428 | SLOT (newTodo())); | 432 | SLOT (newTodo())); |
429 | mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, | 433 | mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, |
430 | SLOT (newSubTodo())); | 434 | SLOT (newSubTodo())); |
431 | mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, | 435 | mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, |
432 | SLOT (unparentTodo()),0,21); | 436 | SLOT (unparentTodo()),0,21); |
433 | mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, | 437 | mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, |
434 | SLOT (reparentTodo()),0,22); | 438 | SLOT (reparentTodo()),0,22); |
435 | mItemPopupMenu->insertSeparator(); | 439 | mItemPopupMenu->insertSeparator(); |
436 | #if 0 | 440 | #if 0 |
437 | mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), | 441 | mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), |
438 | this, SLOT( purgeCompleted() ) ); | 442 | this, SLOT( purgeCompleted() ) ); |
439 | mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), | 443 | mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), |
440 | this, SLOT( toggleCompleted() ),0, 33 ); | 444 | this, SLOT( toggleCompleted() ),0, 33 ); |
441 | mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), | 445 | mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), |
442 | this, SLOT( toggleQuickTodo() ),0, 34 ); | 446 | this, SLOT( toggleQuickTodo() ),0, 34 ); |
443 | mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), | 447 | mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), |
444 | this, SLOT( toggleRunning() ),0, 35 ); | 448 | this, SLOT( toggleRunning() ),0, 35 ); |
445 | 449 | ||
446 | #endif | 450 | #endif |
447 | mPopupMenu = new QPopupMenu(this); | 451 | mPopupMenu = new QPopupMenu(this); |
448 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, | 452 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, |
449 | SLOT (newTodo()),0,1); | 453 | SLOT (newTodo()),0,1); |
450 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), | 454 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), |
451 | this, SLOT(purgeCompleted()),0,2); | 455 | this, SLOT(purgeCompleted()),0,2); |
452 | mPopupMenu->insertItem(i18n("Show Completed"), | 456 | mPopupMenu->insertItem(i18n("Show Completed"), |
453 | this, SLOT( toggleCompleted() ),0,3 ); | 457 | this, SLOT( toggleCompleted() ),0,3 ); |
454 | mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), | 458 | mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), |
455 | this, SLOT( toggleQuickTodo() ),0,4 ); | 459 | this, SLOT( toggleQuickTodo() ),0,4 ); |
456 | mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), | 460 | mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), |
457 | this, SLOT( toggleRunning() ),0,5 ); | 461 | this, SLOT( toggleRunning() ),0,5 ); |
458 | mPopupMenu->insertItem(i18n(" set all open","Display all opened"), | 462 | mPopupMenu->insertItem(i18n(" set all open","Display all opened"), |
459 | this, SLOT( setAllOpen() ),0,6 ); | 463 | this, SLOT( setAllOpen() ),0,6 ); |
460 | mPopupMenu->insertItem(i18n(" set all close","Display all closed"), | 464 | mPopupMenu->insertItem(i18n(" set all close","Display all closed"), |
461 | this, SLOT( setAllClose() ),0,7 ); | 465 | this, SLOT( setAllClose() ),0,7 ); |
462 | mPopupMenu->insertItem(i18n(" set all flat","Display all flat"), | 466 | mPopupMenu->insertItem(i18n(" set all flat","Display all flat"), |
463 | this, SLOT( setAllFlat() ),0,8 ); | 467 | this, SLOT( setAllFlat() ),0,8 ); |
464 | mDocPrefs = new DocPrefs( name ); | 468 | mDocPrefs = new DocPrefs( name ); |
465 | 469 | ||
466 | mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu ); | 470 | mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu ); |
467 | mPopupMenu->setCheckable( true ); | 471 | mPopupMenu->setCheckable( true ); |
468 | mItemPopupMenu->setCheckable( true ); | 472 | mItemPopupMenu->setCheckable( true ); |
469 | 473 | ||
470 | 474 | ||
471 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); | 475 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); |
472 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); | 476 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); |
473 | 477 | ||
474 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); | 478 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); |
475 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); | 479 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); |
476 | 480 | ||
477 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); | 481 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); |
478 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); | 482 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); |
479 | 483 | ||
480 | 484 | ||
481 | // Double clicking conflicts with opening/closing the subtree | 485 | // Double clicking conflicts with opening/closing the subtree |
482 | connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), | 486 | connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), |
483 | SLOT( editItem( QListViewItem *) ) ); | 487 | SLOT( editItem( QListViewItem *) ) ); |
484 | /* | 488 | /* |
485 | connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, | 489 | connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, |
486 | const QPoint &,int ) ), | 490 | const QPoint &,int ) ), |
487 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); | 491 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); |
488 | */ | 492 | */ |
489 | connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, | 493 | connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, |
490 | const QPoint &,int ) ), | 494 | const QPoint &,int ) ), |
491 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); | 495 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); |
492 | connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), | 496 | connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), |
493 | SLOT( itemClicked( QListViewItem * ) ) ); | 497 | SLOT( itemClicked( QListViewItem * ) ) ); |
494 | connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), | 498 | connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), |
495 | SLOT( itemDoubleClicked( QListViewItem * ) ) ); | 499 | SLOT( itemDoubleClicked( QListViewItem * ) ) ); |
496 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), | 500 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), |
497 | SLOT( updateView() ) ); | 501 | SLOT( updateView() ) ); |
498 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), | 502 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), |
499 | SLOT( todoModified(Todo *, int) ) ); | 503 | SLOT( todoModified(Todo *, int) ) ); |
500 | connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), | 504 | connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), |
501 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 505 | SLOT( itemStateChanged( QListViewItem * ) ) ); |
502 | connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), | 506 | connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), |
503 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 507 | SLOT( itemStateChanged( QListViewItem * ) ) ); |
508 | connect( mTodoListView, SIGNAL( paintNeeded() ), | ||
509 | SLOT( paintNeeded()) ); | ||
504 | 510 | ||
505 | #if 0 | 511 | #if 0 |
506 | connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), | 512 | connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), |
507 | SLOT(selectionChanged(QListViewItem *))); | 513 | SLOT(selectionChanged(QListViewItem *))); |
508 | connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), | 514 | connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), |
509 | SLOT(selectionChanged(QListViewItem *))); | 515 | SLOT(selectionChanged(QListViewItem *))); |
510 | connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), | 516 | connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), |
511 | SLOT(selectionChanged(QListViewItem *))); | 517 | SLOT(selectionChanged(QListViewItem *))); |
512 | #endif | 518 | #endif |
513 | 519 | ||
514 | connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); | 520 | connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); |
515 | connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); | 521 | connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); |
516 | connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); | 522 | connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); |
517 | 523 | ||
518 | connect( mTodoListView, SIGNAL(selectionChanged() ), | 524 | connect( mTodoListView, SIGNAL(selectionChanged() ), |
519 | SLOT( processSelectionChange() ) ); | 525 | SLOT( processSelectionChange() ) ); |
520 | connect( mQuickAdd, SIGNAL( returnPressed () ), | 526 | connect( mQuickAdd, SIGNAL( returnPressed () ), |
521 | SLOT( addQuickTodo() ) ); | 527 | SLOT( addQuickTodo() ) ); |
522 | 528 | ||
523 | } | 529 | } |
524 | 530 | ||
525 | KOTodoView::~KOTodoView() | 531 | KOTodoView::~KOTodoView() |
526 | { | 532 | { |
527 | delete mDocPrefs; | 533 | delete mDocPrefs; |
528 | } | 534 | } |
529 | 535 | ||
530 | void KOTodoView::jumpToDate () | 536 | void KOTodoView::jumpToDate () |
531 | { | 537 | { |
532 | // if (mActiveItem) { | 538 | // if (mActiveItem) { |
533 | // mActiveItem->todo()); | 539 | // mActiveItem->todo()); |
534 | // if ( mActiveItem->todo()->hasDueDate() ) | 540 | // if ( mActiveItem->todo()->hasDueDate() ) |
535 | // emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); | 541 | // emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); |
536 | } | 542 | } |
543 | void KOTodoView::paintNeeded() | ||
544 | { | ||
545 | if ( mPendingUpdateBeforeRepaint ) { | ||
546 | updateView(); | ||
547 | mPendingUpdateBeforeRepaint = false; | ||
548 | } | ||
549 | } | ||
537 | void KOTodoView::paintEvent(QPaintEvent * pevent) | 550 | void KOTodoView::paintEvent(QPaintEvent * pevent) |
538 | { | 551 | { |
539 | if ( mPendingUpdateBeforeRepaint ) { | 552 | if ( mPendingUpdateBeforeRepaint ) { |
540 | updateView(); | 553 | updateView(); |
541 | mPendingUpdateBeforeRepaint = false; | 554 | mPendingUpdateBeforeRepaint = false; |
542 | } | 555 | } |
543 | KOrg::BaseView::paintEvent( pevent); | 556 | KOrg::BaseView::paintEvent( pevent); |
544 | } | 557 | } |
545 | bool mPendingUpdateBeforeRepaint; | 558 | |
546 | void KOTodoView::updateView() | 559 | void KOTodoView::updateView() |
547 | { | 560 | { |
548 | pendingSubtodo = 0; | 561 | pendingSubtodo = 0; |
549 | if ( mBlockUpdate ) { | 562 | if ( mBlockUpdate ) { |
550 | return; | 563 | return; |
551 | } | 564 | } |
552 | if ( !isVisible() ) { | 565 | if ( !isVisible() ) { |
553 | mPendingUpdateBeforeRepaint = true; | 566 | mPendingUpdateBeforeRepaint = true; |
554 | return; | 567 | return; |
555 | } | 568 | } |
556 | //qDebug("KOTodoView::updateView() %x", this); | 569 | //qDebug("KOTodoView::updateView() %x", this); |
557 | if ( isFlatDisplay ) { | 570 | if ( isFlatDisplay ) { |
558 | setAllFlat(); | 571 | setAllFlat(); |
559 | return; | 572 | return; |
560 | } | 573 | } |
561 | //qDebug("update "); | 574 | //qDebug("update "); |
562 | // kdDebug() << "KOTodoView::updateView()" << endl; | 575 | // kdDebug() << "KOTodoView::updateView()" << endl; |
563 | QFont fo = KOPrefs::instance()->mTodoViewFont; | 576 | QFont fo = KOPrefs::instance()->mTodoViewFont; |
564 | mTodoListView->clear(); | 577 | mTodoListView->clear(); |
565 | if ( mName == "todolistsmall" ) { | 578 | if ( mName == "todolistsmall" ) { |
566 | if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { | 579 | if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { |
567 | int ps = fo.pointSize() -2; | 580 | int ps = fo.pointSize() -2; |
568 | if ( ps > 12 ) | 581 | if ( ps > 12 ) |
569 | ps -= 2; | 582 | ps -= 2; |
570 | fo.setPointSize( ps ); | 583 | fo.setPointSize( ps ); |
571 | } | 584 | } |
572 | } | 585 | } |
573 | 586 | ||
574 | mTodoListView->setFont( fo ); | 587 | mTodoListView->setFont( fo ); |
575 | // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); | 588 | // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); |
576 | //mTodoListView->header()->setMaximumHeight(fm.height()); | 589 | //mTodoListView->header()->setMaximumHeight(fm.height()); |
577 | QPtrList<Todo> todoList = calendar()->todos(); | 590 | QPtrList<Todo> todoList = calendar()->todos(); |
578 | 591 | ||
579 | /* | 592 | /* |
580 | kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; | 593 | kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; |
581 | Event *t; | 594 | Event *t; |
582 | for(t = todoList.first(); t; t = todoList.next()) { | 595 | for(t = todoList.first(); t; t = todoList.next()) { |
583 | kdDebug() << " " << t->getSummary() << endl; | 596 | kdDebug() << " " << t->getSummary() << endl; |
584 | 597 | ||
585 | if (t->getRelatedTo()) { | 598 | if (t->getRelatedTo()) { |
586 | kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; | 599 | kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; |
587 | } | 600 | } |
588 | 601 | ||
589 | QPtrList<Event> l = t->getRelations(); | 602 | QPtrList<Event> l = t->getRelations(); |
590 | Event *c; | 603 | Event *c; |
591 | for(c=l.first();c;c=l.next()) { | 604 | for(c=l.first();c;c=l.next()) { |
592 | kdDebug() << " - relation: " << c->getSummary() << endl; | 605 | kdDebug() << " - relation: " << c->getSummary() << endl; |
593 | } | 606 | } |
594 | } | 607 | } |
595 | */ | 608 | */ |
596 | 609 | ||
597 | // Put for each Event a KOTodoViewItem in the list view. Don't rely on a | 610 | // Put for each Event a KOTodoViewItem in the list view. Don't rely on a |
598 | // specific order of events. That means that we have to generate parent items | 611 | // specific order of events. That means that we have to generate parent items |
599 | // recursively for proper hierarchical display of Todos. | 612 | // recursively for proper hierarchical display of Todos. |
600 | mTodoMap.clear(); | 613 | mTodoMap.clear(); |
601 | Todo *todo; | 614 | Todo *todo; |
602 | todo = todoList.first();// todo; todo = todoList.next()) { | 615 | todo = todoList.first();// todo; todo = todoList.next()) { |
603 | while ( todo ) { | 616 | while ( todo ) { |
604 | bool next = true; | 617 | bool next = true; |
605 | // qDebug("todo %s ", todo->summary().latin1()); | 618 | // qDebug("todo %s ", todo->summary().latin1()); |
606 | Incidence *incidence = todo->relatedTo(); | 619 | Incidence *incidence = todo->relatedTo(); |
607 | while ( incidence ) { | 620 | while ( incidence ) { |
608 | if ( incidence->type() == "Todo") { | 621 | if ( incidence->type() == "Todo") { |
609 | //qDebug("related %s ",incidence->summary().latin1() ); | 622 | //qDebug("related %s ",incidence->summary().latin1() ); |
610 | if ( !(todoList.contains ( ((Todo* )incidence ) ) )) { | 623 | if ( !(todoList.contains ( ((Todo* )incidence ) ) )) { |
611 | //qDebug("related not found "); | 624 | //qDebug("related not found "); |
612 | todoList.remove( ); | 625 | todoList.remove( ); |
613 | todo = todoList.current(); | 626 | todo = todoList.current(); |
614 | next = false; | 627 | next = false; |
615 | incidence = 0; | 628 | incidence = 0; |
616 | 629 | ||
617 | } else { | 630 | } else { |
618 | //qDebug("related found "); | 631 | //qDebug("related found "); |
619 | incidence = incidence->relatedTo(); | 632 | incidence = incidence->relatedTo(); |
620 | } | 633 | } |
621 | } else | 634 | } else |
622 | incidence = 0; | 635 | incidence = 0; |
623 | } | 636 | } |
624 | if ( next ) | 637 | if ( next ) |
625 | todo = todoList.next(); | 638 | todo = todoList.next(); |
626 | } | 639 | } |
627 | // qDebug("again .... "); | 640 | // qDebug("again .... "); |
628 | // for(todo = todoList.first(); todo; todo = todoList.next()) { | 641 | // for(todo = todoList.first(); todo; todo = todoList.next()) { |
629 | 642 | ||
630 | // qDebug("yytodo %s ", todo->summary().latin1()); | 643 | // qDebug("yytodo %s ", todo->summary().latin1()); |
631 | // } | 644 | // } |
632 | //qDebug("for "); | 645 | //qDebug("for "); |
633 | for(todo = todoList.first(); todo; todo = todoList.next()) { | 646 | for(todo = todoList.first(); todo; todo = todoList.next()) { |
634 | if (!mTodoMap.contains(todo) && checkTodo( todo ) ) | 647 | if (!mTodoMap.contains(todo) && checkTodo( todo ) ) |
635 | { | 648 | { |
636 | insertTodoItem(todo); | 649 | insertTodoItem(todo); |
637 | } | 650 | } |
638 | } | 651 | } |
639 | //qDebug("for end "); | 652 | //qDebug("for end "); |
640 | // Restore opened/closed state | 653 | // Restore opened/closed state |
641 | mTodoListView->blockSignals( true ); | 654 | mTodoListView->blockSignals( true ); |
642 | if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); | 655 | if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); |
643 | mTodoListView->blockSignals( false ); | 656 | mTodoListView->blockSignals( false ); |
644 | mTodoListView->setFocus(); | 657 | mTodoListView->setFocus(); |
645 | processSelectionChange(); | 658 | processSelectionChange(); |
646 | } | 659 | } |
647 | 660 | ||
648 | bool KOTodoView::checkTodo( Todo * todo ) | 661 | bool KOTodoView::checkTodo( Todo * todo ) |
649 | { | 662 | { |
650 | 663 | ||
651 | if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() ) | 664 | if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() ) |
652 | return false; | 665 | return false; |
653 | if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) { | 666 | if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) { |
654 | if ( todo->hasStartDate() ) | 667 | if ( todo->hasStartDate() ) |
655 | if ( mNavigator->selectedDates().last() < todo->dtStart().date() ) | 668 | if ( mNavigator->selectedDates().last() < todo->dtStart().date() ) |
656 | return false; | 669 | return false; |
657 | if ( todo->hasDueDate() ) | 670 | if ( todo->hasDueDate() ) |
658 | if ( mNavigator->selectedDates().first() > todo->dtDue().date() ) | 671 | if ( mNavigator->selectedDates().first() > todo->dtDue().date() ) |
659 | return false; | 672 | return false; |
660 | } | 673 | } |
661 | return true; | 674 | return true; |
662 | } | 675 | } |
663 | 676 | ||
664 | void KOTodoView::restoreItemState( QListViewItem *item ) | 677 | void KOTodoView::restoreItemState( QListViewItem *item ) |
665 | { | 678 | { |
666 | pendingSubtodo = 0; | 679 | pendingSubtodo = 0; |
667 | while( item ) { | 680 | while( item ) { |
668 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 681 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
669 | todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); | 682 | todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); |
670 | if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); | 683 | if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); |
671 | item = item->nextSibling(); | 684 | item = item->nextSibling(); |
672 | } | 685 | } |
673 | } | 686 | } |
674 | 687 | ||
675 | 688 | ||
676 | QMap<Todo *,KOTodoViewItem *>::ConstIterator | 689 | QMap<Todo *,KOTodoViewItem *>::ConstIterator |
677 | KOTodoView::insertTodoItem(Todo *todo) | 690 | KOTodoView::insertTodoItem(Todo *todo) |
678 | { | 691 | { |
679 | 692 | ||
680 | // kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl; | 693 | // kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl; |
681 | // TODO: Check, if dynmaic cast is necessary | 694 | // TODO: Check, if dynmaic cast is necessary |
682 | 695 | ||
683 | pendingSubtodo = 0; | 696 | pendingSubtodo = 0; |
684 | Incidence *incidence = todo->relatedTo(); | 697 | Incidence *incidence = todo->relatedTo(); |
685 | if (incidence && incidence->type() == "Todo") { | 698 | if (incidence && incidence->type() == "Todo") { |
686 | Todo *relatedTodo = static_cast<Todo *>(incidence); | 699 | Todo *relatedTodo = static_cast<Todo *>(incidence); |
687 | 700 | ||
688 | // kdDebug() << " has Related" << endl; | 701 | // kdDebug() << " has Related" << endl; |
689 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; | 702 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; |
690 | itemIterator = mTodoMap.find(relatedTodo); | 703 | itemIterator = mTodoMap.find(relatedTodo); |
691 | if (itemIterator == mTodoMap.end()) { | 704 | if (itemIterator == mTodoMap.end()) { |
692 | // kdDebug() << " related not yet in list" << endl; | 705 | // kdDebug() << " related not yet in list" << endl; |
693 | itemIterator = insertTodoItem (relatedTodo); | 706 | itemIterator = insertTodoItem (relatedTodo); |
694 | } | 707 | } |
695 | // isn't this pretty stupid? We give one Todo to the KOTodoViewItem | 708 | // isn't this pretty stupid? We give one Todo to the KOTodoViewItem |
696 | // and one into the map. Sure finding is more easy but why? -zecke | 709 | // and one into the map. Sure finding is more easy but why? -zecke |
697 | KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this); | 710 | KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this); |
698 | return mTodoMap.insert(todo,todoItem); | 711 | return mTodoMap.insert(todo,todoItem); |
699 | } else { | 712 | } else { |
700 | // kdDebug() << " no Related" << endl; | 713 | // kdDebug() << " no Related" << endl; |
701 | // see above -zecke | 714 | // see above -zecke |
702 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); | 715 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); |
703 | return mTodoMap.insert(todo,todoItem); | 716 | return mTodoMap.insert(todo,todoItem); |
704 | } | 717 | } |
705 | } | 718 | } |
706 | 719 | ||
707 | 720 | ||
708 | void KOTodoView::updateConfig() | 721 | void KOTodoView::updateConfig() |
709 | { | 722 | { |
710 | updateView(); | 723 | updateView(); |
711 | mTodoListView->repaintContents(); | 724 | mTodoListView->repaintContents(); |
712 | } | 725 | } |
713 | 726 | ||
714 | QPtrList<Incidence> KOTodoView::selectedIncidences() | 727 | QPtrList<Incidence> KOTodoView::selectedIncidences() |
715 | { | 728 | { |
716 | QPtrList<Incidence> selected; | 729 | QPtrList<Incidence> selected; |
717 | 730 | ||
718 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); | 731 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); |
719 | // if (!item) item = mActiveItem; | 732 | // if (!item) item = mActiveItem; |
720 | if (item) selected.append(item->todo()); | 733 | if (item) selected.append(item->todo()); |
721 | 734 | ||
722 | return selected; | 735 | return selected; |
723 | } | 736 | } |
724 | 737 | ||
725 | QPtrList<Todo> KOTodoView::selectedTodos() | 738 | QPtrList<Todo> KOTodoView::selectedTodos() |
726 | { | 739 | { |
727 | QPtrList<Todo> selected; | 740 | QPtrList<Todo> selected; |
728 | 741 | ||
729 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); | 742 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); |
730 | // if (!item) item = mActiveItem; | 743 | // if (!item) item = mActiveItem; |
731 | if (item) selected.append(item->todo()); | 744 | if (item) selected.append(item->todo()); |
732 | 745 | ||
733 | return selected; | 746 | return selected; |
734 | } | 747 | } |
735 | 748 | ||
736 | void KOTodoView::changeEventDisplay(Event *, int) | 749 | void KOTodoView::changeEventDisplay(Event *, int) |
737 | { | 750 | { |
738 | updateView(); | 751 | updateView(); |
739 | } | 752 | } |
740 | 753 | ||
741 | void KOTodoView::showDates(const QDate &, const QDate &) | 754 | void KOTodoView::showDates(const QDate &, const QDate &) |
742 | { | 755 | { |
743 | } | 756 | } |
744 | 757 | ||
745 | void KOTodoView::showEvents(QPtrList<Event>) | 758 | void KOTodoView::showEvents(QPtrList<Event>) |
746 | { | 759 | { |
747 | kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl; | 760 | kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl; |
748 | } | 761 | } |
749 | 762 | ||
750 | void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 763 | void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
751 | const QDate &td) | 764 | const QDate &td) |
752 | { | 765 | { |
753 | #ifndef KORG_NOPRINTER | 766 | #ifndef KORG_NOPRINTER |
754 | calPrinter->preview(CalPrinter::Todolist, fd, td); | 767 | calPrinter->preview(CalPrinter::Todolist, fd, td); |
755 | #endif | 768 | #endif |
756 | } | 769 | } |
757 | 770 | ||
758 | void KOTodoView::editItem(QListViewItem *item ) | 771 | void KOTodoView::editItem(QListViewItem *item ) |
759 | { | 772 | { |
760 | // qDebug("editItem(QListViewItem *item ) "); | 773 | // qDebug("editItem(QListViewItem *item ) "); |
761 | emit editTodoSignal(((KOTodoViewItem *)item)->todo()); | 774 | emit editTodoSignal(((KOTodoViewItem *)item)->todo()); |
762 | } | 775 | } |
763 | 776 | ||
764 | void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) | 777 | void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) |
765 | { | 778 | { |
766 | emit showTodoSignal(((KOTodoViewItem *)item)->todo()); | 779 | emit showTodoSignal(((KOTodoViewItem *)item)->todo()); |
767 | } | 780 | } |
768 | 781 | ||
769 | void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column) | 782 | void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column) |
770 | { | 783 | { |
771 | pendingSubtodo = 0; | 784 | pendingSubtodo = 0; |
772 | mActiveItem = (KOTodoViewItem *)item; | 785 | mActiveItem = (KOTodoViewItem *)item; |
773 | if (item) { | 786 | if (item) { |
774 | switch (column){ | 787 | switch (column){ |
775 | case 1: | 788 | case 1: |
776 | mPriorityPopupMenu->popup(QCursor::pos ()); break; | 789 | mPriorityPopupMenu->popup(QCursor::pos ()); break; |
777 | case 2: | 790 | case 2: |
778 | mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break; | 791 | mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break; |
779 | case 3: | 792 | case 3: |
780 | moveTodo(); | 793 | moveTodo(); |
781 | break; | 794 | break; |
782 | case 8: | 795 | case 8: |
783 | getCategoryPopupMenu((KOTodoViewItem *)item)->popup(QCursor::pos ()); break; | 796 | getCategoryPopupMenu((KOTodoViewItem *)item)->popup(QCursor::pos ()); break; |
784 | default: | 797 | default: |
785 | mItemPopupMenu->popup(QCursor::pos()); | 798 | mItemPopupMenu->popup(QCursor::pos()); |
786 | } | 799 | } |
787 | } else mPopupMenu->popup(QCursor::pos()); | 800 | } else mPopupMenu->popup(QCursor::pos()); |
788 | } | 801 | } |
789 | void KOTodoView::newTodo() | 802 | void KOTodoView::newTodo() |
790 | { | 803 | { |
791 | emit newTodoSignal(); | 804 | emit newTodoSignal(); |
792 | } | 805 | } |
793 | 806 | ||
794 | void KOTodoView::newSubTodo() | 807 | void KOTodoView::newSubTodo() |
795 | { | 808 | { |
796 | if (mActiveItem) { | 809 | if (mActiveItem) { |
797 | emit newSubTodoSignal(mActiveItem->todo()); | 810 | emit newSubTodoSignal(mActiveItem->todo()); |
798 | } | 811 | } |
799 | } | 812 | } |
800 | void KOTodoView::unparentTodo() | 813 | void KOTodoView::unparentTodo() |
801 | { | 814 | { |
802 | if (mActiveItem) { | 815 | if (mActiveItem) { |
803 | emit unparentTodoSignal(mActiveItem->todo()); | 816 | emit unparentTodoSignal(mActiveItem->todo()); |
804 | } | 817 | } |
805 | } | 818 | } |
806 | 819 | ||
807 | void KOTodoView::reparentTodo() | 820 | void KOTodoView::reparentTodo() |
808 | { | 821 | { |
809 | if (mActiveItem) { | 822 | if (mActiveItem) { |
810 | qDebug("KOTodoView::reparentTodo() "); | 823 | qDebug("KOTodoView::reparentTodo() "); |
811 | topLevelWidget()->setCaption(i18n("Click on new parent item")); | 824 | topLevelWidget()->setCaption(i18n("Click on new parent item")); |
812 | pendingSubtodo = mActiveItem; | 825 | pendingSubtodo = mActiveItem; |
813 | } | 826 | } |
814 | } | 827 | } |
815 | void KOTodoView::editTodo() | 828 | void KOTodoView::editTodo() |
816 | { | 829 | { |
817 | if (mActiveItem) { | 830 | if (mActiveItem) { |
818 | emit editTodoSignal(mActiveItem->todo()); | 831 | emit editTodoSignal(mActiveItem->todo()); |
819 | } | 832 | } |
820 | } | 833 | } |
821 | void KOTodoView::cloneTodo() | 834 | void KOTodoView::cloneTodo() |
822 | { | 835 | { |
823 | if (mActiveItem) { | 836 | if (mActiveItem) { |
824 | emit cloneTodoSignal((Incidence*)mActiveItem->todo()); | 837 | emit cloneTodoSignal((Incidence*)mActiveItem->todo()); |
825 | } | 838 | } |
826 | } | 839 | } |
827 | void KOTodoView::cancelTodo() | 840 | void KOTodoView::cancelTodo() |
828 | { | 841 | { |
829 | if (mActiveItem) { | 842 | if (mActiveItem) { |
830 | emit cancelTodoSignal((Incidence*)mActiveItem->todo()); | 843 | emit cancelTodoSignal((Incidence*)mActiveItem->todo()); |
831 | } | 844 | } |
832 | } | 845 | } |
833 | void KOTodoView::moveTodo() | 846 | void KOTodoView::moveTodo() |
834 | { | 847 | { |
835 | if (mActiveItem) { | 848 | if (mActiveItem) { |
836 | emit moveTodoSignal((Incidence*)mActiveItem->todo()); | 849 | emit moveTodoSignal((Incidence*)mActiveItem->todo()); |
837 | } | 850 | } |
838 | } | 851 | } |
839 | void KOTodoView::beamTodo() | 852 | void KOTodoView::beamTodo() |
840 | { | 853 | { |
841 | if (mActiveItem) { | 854 | if (mActiveItem) { |
842 | emit beamTodoSignal((Incidence*)mActiveItem->todo()); | 855 | emit beamTodoSignal((Incidence*)mActiveItem->todo()); |
843 | } | 856 | } |
844 | } | 857 | } |
845 | 858 | ||
846 | 859 | ||
847 | void KOTodoView::showTodo() | 860 | void KOTodoView::showTodo() |
848 | { | 861 | { |
849 | if (mActiveItem) { | 862 | if (mActiveItem) { |
850 | emit showTodoSignal(mActiveItem->todo()); | 863 | emit showTodoSignal(mActiveItem->todo()); |
851 | } | 864 | } |
852 | } | 865 | } |
853 | 866 | ||
854 | void KOTodoView::deleteTodo() | 867 | void KOTodoView::deleteTodo() |
855 | { | 868 | { |
856 | if (mActiveItem) { | 869 | if (mActiveItem) { |
857 | emit deleteTodoSignal(mActiveItem->todo()); | 870 | emit deleteTodoSignal(mActiveItem->todo()); |
858 | } | 871 | } |
859 | } | 872 | } |
860 | 873 | ||
861 | void KOTodoView::setNewPriority(int index) | 874 | void KOTodoView::setNewPriority(int index) |
862 | { | 875 | { |
863 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 876 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
864 | mActiveItem->todo()->setPriority(mPriority[index]); | 877 | mActiveItem->todo()->setPriority(mPriority[index]); |
865 | mActiveItem->construct(); | 878 | mActiveItem->construct(); |
866 | todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED); | 879 | todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED); |
867 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 880 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
868 | } | 881 | } |
869 | } | 882 | } |
870 | 883 | ||
871 | void KOTodoView::setNewPercentage(int index) | 884 | void KOTodoView::setNewPercentage(int index) |
872 | { | 885 | { |
873 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 886 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
874 | 887 | ||
875 | if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) { | 888 | if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) { |
876 | mActiveItem->setOn( true ); | 889 | mActiveItem->setOn( true ); |
877 | return; | 890 | return; |
878 | } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) { | 891 | } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) { |
879 | KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent())); | 892 | KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent())); |
880 | if ( par && par->isOn() ) | 893 | if ( par && par->isOn() ) |
881 | par->setOn( false ); | 894 | par->setOn( false ); |
882 | } | 895 | } |
883 | if (mPercentage[index] == 100) { | 896 | if (mPercentage[index] == 100) { |
884 | mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); | 897 | mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); |
885 | } else { | 898 | } else { |
886 | mActiveItem->todo()->setCompleted(false); | 899 | mActiveItem->todo()->setCompleted(false); |
887 | } | 900 | } |
888 | mActiveItem->todo()->setPercentComplete(mPercentage[index]); | 901 | mActiveItem->todo()->setPercentComplete(mPercentage[index]); |
889 | mActiveItem->construct(); | 902 | mActiveItem->construct(); |
890 | todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); | 903 | todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); |
891 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 904 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
892 | } | 905 | } |
893 | } | 906 | } |
894 | 907 | ||
895 | 908 | ||
896 | QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) | 909 | QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) |
897 | { | 910 | { |
898 | QPopupMenu* tempMenu = new QPopupMenu (this); | 911 | QPopupMenu* tempMenu = new QPopupMenu (this); |
899 | QStringList checkedCategories = todoItem->todo()->categories (); | 912 | QStringList checkedCategories = todoItem->todo()->categories (); |
900 | 913 | ||
901 | tempMenu->setCheckable (true); | 914 | tempMenu->setCheckable (true); |
902 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); | 915 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); |
903 | it != KOPrefs::instance()->mCustomCategories.end (); | 916 | it != KOPrefs::instance()->mCustomCategories.end (); |
904 | ++it) { | 917 | ++it) { |
905 | int index = tempMenu->insertItem (*it); | 918 | int index = tempMenu->insertItem (*it); |
906 | mCategory[index] = *it; | 919 | mCategory[index] = *it; |
907 | if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true); | 920 | if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true); |
908 | } | 921 | } |
909 | 922 | ||
910 | connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); | 923 | connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); |
911 | return tempMenu; | 924 | return tempMenu; |
912 | 925 | ||
913 | 926 | ||
914 | } | 927 | } |
915 | void KOTodoView::changedCategories(int index) | 928 | void KOTodoView::changedCategories(int index) |
916 | { | 929 | { |
917 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 930 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
918 | QStringList categories = mActiveItem->todo()->categories (); | 931 | QStringList categories = mActiveItem->todo()->categories (); |
919 | if (categories.find (mCategory[index]) != categories.end ()) | 932 | if (categories.find (mCategory[index]) != categories.end ()) |
920 | categories.remove (mCategory[index]); | 933 | categories.remove (mCategory[index]); |
921 | else | 934 | else |
922 | categories.insert (categories.end(), mCategory[index]); | 935 | categories.insert (categories.end(), mCategory[index]); |
923 | categories.sort (); | 936 | categories.sort (); |
924 | mActiveItem->todo()->setCategories (categories); | 937 | mActiveItem->todo()->setCategories (categories); |
925 | mActiveItem->construct(); | 938 | mActiveItem->construct(); |
926 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 939 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
927 | todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); | 940 | todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); |
928 | } | 941 | } |
929 | } | 942 | } |
930 | void KOTodoView::itemDoubleClicked(QListViewItem *item) | 943 | void KOTodoView::itemDoubleClicked(QListViewItem *item) |
931 | { | 944 | { |
932 | if ( pendingSubtodo != 0 ) { | 945 | if ( pendingSubtodo != 0 ) { |
933 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); | 946 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); |
934 | } | 947 | } |
935 | pendingSubtodo = 0; | 948 | pendingSubtodo = 0; |
936 | if (!item) { | 949 | if (!item) { |
937 | newTodo(); | 950 | newTodo(); |
938 | return; | 951 | return; |
939 | } | 952 | } |
940 | if ( KOPrefs::instance()->mEditOnDoubleClick ) | 953 | if ( KOPrefs::instance()->mEditOnDoubleClick ) |
941 | editItem( item ); | 954 | editItem( item ); |
942 | else | 955 | else |
943 | showItem( item , QPoint(), 0 ); | 956 | showItem( item , QPoint(), 0 ); |
944 | } | 957 | } |
945 | void KOTodoView::itemClicked(QListViewItem *item) | 958 | void KOTodoView::itemClicked(QListViewItem *item) |
946 | { | 959 | { |
947 | 960 | ||
948 | if (!item) { | 961 | if (!item) { |
949 | if ( pendingSubtodo != 0 ) { | 962 | if ( pendingSubtodo != 0 ) { |
950 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); | 963 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); |
951 | } | 964 | } |
952 | pendingSubtodo = 0; | 965 | pendingSubtodo = 0; |
953 | return; | 966 | return; |
954 | } | 967 | } |
955 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 968 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
956 | if ( pendingSubtodo != 0 ) { | 969 | if ( pendingSubtodo != 0 ) { |
957 | bool allowReparent = true; | 970 | bool allowReparent = true; |
958 | QListViewItem *par = item; | 971 | QListViewItem *par = item; |
959 | while ( par ) { | 972 | while ( par ) { |
960 | if ( par == pendingSubtodo ) { | 973 | if ( par == pendingSubtodo ) { |
961 | allowReparent = false; | 974 | allowReparent = false; |
962 | break; | 975 | break; |
963 | } | 976 | } |
964 | par = par->parent(); | 977 | par = par->parent(); |
965 | } | 978 | } |
966 | if ( !allowReparent ) { | 979 | if ( !allowReparent ) { |
967 | topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); | 980 | topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); |
968 | qDebug("Recursive reparenting not possible "); | 981 | qDebug("Recursive reparenting not possible "); |
969 | pendingSubtodo = 0; | 982 | pendingSubtodo = 0; |
970 | } else { | 983 | } else { |
971 | Todo* newParent = todoItem->todo(); | 984 | Todo* newParent = todoItem->todo(); |
972 | Todo* newSub = pendingSubtodo->todo(); | 985 | Todo* newSub = pendingSubtodo->todo(); |
973 | pendingSubtodo = 0; | 986 | pendingSubtodo = 0; |
974 | emit reparentTodoSignal( newParent,newSub ); | 987 | emit reparentTodoSignal( newParent,newSub ); |
975 | return; | 988 | return; |
976 | } | 989 | } |
977 | } | 990 | } |
978 | #if 0 | 991 | #if 0 |
979 | // handled by the item itself | 992 | // handled by the item itself |
980 | bool completed = todoItem->todo()->isCompleted(); // Completed or not? | 993 | bool completed = todoItem->todo()->isCompleted(); // Completed or not? |
981 | qDebug("com %d ",completed ); | 994 | qDebug("com %d ",completed ); |
982 | qDebug("itemclicked "); | 995 | qDebug("itemclicked "); |
983 | if (todoItem->isOn()) { | 996 | if (todoItem->isOn()) { |
984 | qDebug("on "); | 997 | qDebug("on "); |
985 | if (!completed) { | 998 | if (!completed) { |
986 | qDebug("set true "); | 999 | qDebug("set true "); |
987 | todoItem->todo()->setCompleted(QDateTime::currentDateTime()); | 1000 | todoItem->todo()->setCompleted(QDateTime::currentDateTime()); |
988 | } | 1001 | } |
989 | } else { | 1002 | } else { |
990 | qDebug("not on "); | 1003 | qDebug("not on "); |
991 | if (completed) { | 1004 | if (completed) { |
992 | qDebug("set false "); | 1005 | qDebug("set false "); |
993 | todoItem->todo()->setCompleted(false); | 1006 | todoItem->todo()->setCompleted(false); |
994 | } | 1007 | } |
995 | } | 1008 | } |
996 | #endif | 1009 | #endif |
997 | } | 1010 | } |
998 | 1011 | ||
999 | void KOTodoView::setDocumentId( const QString &id ) | 1012 | void KOTodoView::setDocumentId( const QString &id ) |
1000 | { | 1013 | { |
1001 | kdDebug() << "KOTodoView::setDocumentId()" << endl; | 1014 | kdDebug() << "KOTodoView::setDocumentId()" << endl; |
1002 | 1015 | ||
1003 | mDocPrefs->setDoc( id ); | 1016 | mDocPrefs->setDoc( id ); |
1004 | } | 1017 | } |
1005 | 1018 | ||
1006 | void KOTodoView::itemStateChanged( QListViewItem *item ) | 1019 | void KOTodoView::itemStateChanged( QListViewItem *item ) |
1007 | { | 1020 | { |
1008 | if (!item) return; | 1021 | if (!item) return; |
1009 | 1022 | ||
1010 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 1023 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
1011 | 1024 | ||
1012 | // kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; | 1025 | // kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; |
1013 | 1026 | ||
1014 | if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); | 1027 | if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); |
1015 | } | 1028 | } |
1016 | 1029 | ||
1017 | void KOTodoView::saveLayout(KConfig *config, const QString &group) const | 1030 | void KOTodoView::saveLayout(KConfig *config, const QString &group) const |
1018 | { | 1031 | { |
1019 | mTodoListView->saveLayout(config,group); | 1032 | mTodoListView->saveLayout(config,group); |
1020 | } | 1033 | } |
1021 | 1034 | ||
1022 | void KOTodoView::restoreLayout(KConfig *config, const QString &group) | 1035 | void KOTodoView::restoreLayout(KConfig *config, const QString &group) |
1023 | { | 1036 | { |
1024 | mTodoListView->restoreLayout(config,group); | 1037 | mTodoListView->restoreLayout(config,group); |
1025 | } | 1038 | } |
1026 | 1039 | ||
1027 | void KOTodoView::processSelectionChange() | 1040 | void KOTodoView::processSelectionChange() |
1028 | { | 1041 | { |
1029 | // kdDebug() << "KOTodoView::processSelectionChange()" << endl; | 1042 | // kdDebug() << "KOTodoView::processSelectionChange()" << endl; |
1030 | 1043 | ||
1031 | KOTodoViewItem *item = | 1044 | KOTodoViewItem *item = |
1032 | static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() ); | 1045 | static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() ); |
1033 | 1046 | ||
1034 | if ( !item ) { | 1047 | if ( !item ) { |
1035 | emit incidenceSelected( 0 ); | 1048 | emit incidenceSelected( 0 ); |
1036 | } else { | 1049 | } else { |
1037 | emit incidenceSelected( item->todo() ); | 1050 | emit incidenceSelected( item->todo() ); |
1038 | } | 1051 | } |
1039 | } | 1052 | } |
1040 | 1053 | ||
1041 | void KOTodoView::modified(bool b) | 1054 | void KOTodoView::modified(bool b) |
1042 | { | 1055 | { |
1043 | emit isModified(b); | 1056 | emit isModified(b); |
1044 | } | 1057 | } |
1045 | void KOTodoView::setTodoModified( Todo* todo ) | 1058 | void KOTodoView::setTodoModified( Todo* todo ) |
1046 | { | 1059 | { |
1047 | todoModified( todo, KOGlobals::UNKNOWN_MODIFIED ); | 1060 | todoModified( todo, KOGlobals::UNKNOWN_MODIFIED ); |
1048 | } | 1061 | } |
1049 | void KOTodoView::clearSelection() | 1062 | void KOTodoView::clearSelection() |
1050 | { | 1063 | { |
1051 | mTodoListView->selectAll( false ); | 1064 | mTodoListView->selectAll( false ); |
1052 | } | 1065 | } |
1053 | void KOTodoView::setAllOpen() | 1066 | void KOTodoView::setAllOpen() |
1054 | { | 1067 | { |
1055 | if ( isFlatDisplay ) { | 1068 | if ( isFlatDisplay ) { |
1056 | isFlatDisplay = false; | 1069 | isFlatDisplay = false; |
1057 | mPopupMenu->setItemChecked( 8,false ); | 1070 | mPopupMenu->setItemChecked( 8,false ); |
1058 | updateView(); | 1071 | updateView(); |
1059 | } | 1072 | } |
1060 | setOpen(mTodoListView->firstChild(), true); | 1073 | setOpen(mTodoListView->firstChild(), true); |
1061 | } | 1074 | } |
1062 | void KOTodoView::setAllClose() | 1075 | void KOTodoView::setAllClose() |
1063 | { | 1076 | { |
1064 | if ( isFlatDisplay ) { | 1077 | if ( isFlatDisplay ) { |
1065 | isFlatDisplay = false; | 1078 | isFlatDisplay = false; |
1066 | mPopupMenu->setItemChecked( 8,false ); | 1079 | mPopupMenu->setItemChecked( 8,false ); |
1067 | updateView(); | 1080 | updateView(); |
1068 | } | 1081 | } |
1069 | setOpen(mTodoListView->firstChild(), false); | 1082 | setOpen(mTodoListView->firstChild(), false); |
1070 | } | 1083 | } |
1071 | void KOTodoView::setOpen( QListViewItem* item, bool setOpenI) | 1084 | void KOTodoView::setOpen( QListViewItem* item, bool setOpenI) |
1072 | { | 1085 | { |
1073 | 1086 | ||
1074 | while ( item ) { | 1087 | while ( item ) { |
1075 | setOpen( item->firstChild(), setOpenI ); | 1088 | setOpen( item->firstChild(), setOpenI ); |
1076 | item->setOpen( setOpenI ); | 1089 | item->setOpen( setOpenI ); |
1077 | item = item->nextSibling(); | 1090 | item = item->nextSibling(); |
1078 | } | 1091 | } |
1079 | } | 1092 | } |
1080 | 1093 | ||
1081 | void KOTodoView::setAllFlat() | 1094 | void KOTodoView::setAllFlat() |
1082 | { | 1095 | { |
1083 | if ( isFlatDisplay ) { | 1096 | if ( isFlatDisplay ) { |
1084 | isFlatDisplay = false; | 1097 | isFlatDisplay = false; |
1085 | mPopupMenu->setItemChecked( 8,false ); | 1098 | mPopupMenu->setItemChecked( 8,false ); |
1086 | updateView(); | 1099 | updateView(); |
1087 | return; | 1100 | return; |
1088 | } | 1101 | } |
1089 | pendingSubtodo = 0; | 1102 | pendingSubtodo = 0; |
1090 | if ( mBlockUpdate ) { | 1103 | if ( mBlockUpdate ) { |
1091 | return; | 1104 | return; |
1092 | } | 1105 | } |
1093 | mPopupMenu->setItemChecked( 8,true ); | 1106 | mPopupMenu->setItemChecked( 8,true ); |
1094 | isFlatDisplay = true; | 1107 | isFlatDisplay = true; |
1095 | QPtrList<Todo> todoList = calendar()->todos(); | 1108 | QPtrList<Todo> todoList = calendar()->todos(); |
1096 | mTodoMap.clear(); | 1109 | mTodoMap.clear(); |
1097 | mTodoListView->clear(); | 1110 | mTodoListView->clear(); |
1098 | Todo *todo; | 1111 | Todo *todo; |
1099 | for(todo = todoList.first(); todo; todo = todoList.next()) { | 1112 | for(todo = todoList.first(); todo; todo = todoList.next()) { |
1100 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); | 1113 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); |
1101 | mTodoMap.insert(todo,todoItem); | 1114 | mTodoMap.insert(todo,todoItem); |
1102 | } | 1115 | } |
1103 | mTodoListView->setFocus(); | 1116 | mTodoListView->setFocus(); |
1104 | processSelectionChange(); | 1117 | processSelectionChange(); |
1105 | } | 1118 | } |
1106 | 1119 | ||
1107 | void KOTodoView::purgeCompleted() | 1120 | void KOTodoView::purgeCompleted() |
1108 | { | 1121 | { |
1109 | emit purgeCompletedSignal(); | 1122 | emit purgeCompletedSignal(); |
1110 | } | 1123 | } |
1111 | void KOTodoView::toggleQuickTodo() | 1124 | void KOTodoView::toggleQuickTodo() |
1112 | { | 1125 | { |
1113 | if ( mQuickAdd->isVisible() ) { | 1126 | if ( mQuickAdd->isVisible() ) { |
1114 | mQuickAdd->hide(); | 1127 | mQuickAdd->hide(); |
1115 | KOPrefs::instance()->mEnableQuickTodo = false; | 1128 | KOPrefs::instance()->mEnableQuickTodo = false; |
1116 | } | 1129 | } |
1117 | else { | 1130 | else { |
1118 | mQuickAdd->show(); | 1131 | mQuickAdd->show(); |
1119 | KOPrefs::instance()->mEnableQuickTodo = true; | 1132 | KOPrefs::instance()->mEnableQuickTodo = true; |
1120 | } | 1133 | } |
1121 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); | 1134 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); |
1122 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); | 1135 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); |
1123 | } | 1136 | } |
1124 | 1137 | ||
1125 | void KOTodoView::toggleRunning() | 1138 | void KOTodoView::toggleRunning() |
1126 | { | 1139 | { |
1127 | KOPrefs::instance()->mHideNonStartedTodos = !KOPrefs::instance()->mHideNonStartedTodos; | 1140 | KOPrefs::instance()->mHideNonStartedTodos = !KOPrefs::instance()->mHideNonStartedTodos; |
1128 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); | 1141 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); |
1129 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); | 1142 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); |
1130 | updateView(); | 1143 | updateView(); |
1131 | } | 1144 | } |
1132 | 1145 | ||
1133 | void KOTodoView::toggleCompleted() | 1146 | void KOTodoView::toggleCompleted() |
1134 | { | 1147 | { |
1135 | KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo; | 1148 | KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo; |
1136 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); | 1149 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); |
1137 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); | 1150 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); |
1138 | updateView(); | 1151 | updateView(); |
1139 | } | 1152 | } |
1140 | 1153 | ||
1141 | void KOTodoView::addQuickTodo() | 1154 | void KOTodoView::addQuickTodo() |
1142 | { | 1155 | { |
1143 | Todo *todo = new Todo(); | 1156 | Todo *todo = new Todo(); |
1144 | todo->setSummary(mQuickAdd->text()); | 1157 | todo->setSummary(mQuickAdd->text()); |
1145 | todo->setOrganizer(KOPrefs::instance()->email()); | 1158 | todo->setOrganizer(KOPrefs::instance()->email()); |
1146 | CalFilter * cf = mCalendar->filter(); | 1159 | CalFilter * cf = mCalendar->filter(); |
1147 | if ( cf ) { | 1160 | if ( cf ) { |
1148 | if ( cf->isEnabled()&& cf->showCategories()) { | 1161 | if ( cf->isEnabled()&& cf->showCategories()) { |
1149 | todo->setCategories(cf->categoryList()); | 1162 | todo->setCategories(cf->categoryList()); |
1150 | } | 1163 | } |
1151 | if ( cf->isEnabled() ) | 1164 | if ( cf->isEnabled() ) |
1152 | todo->setSecrecy( cf->getSecrecy()); | 1165 | todo->setSecrecy( cf->getSecrecy()); |
1153 | } | 1166 | } |
1154 | mCalendar->addTodo(todo); | 1167 | mCalendar->addTodo(todo); |
1155 | mQuickAdd->setText(""); | 1168 | mQuickAdd->setText(""); |
1156 | todoModified (todo, KOGlobals::EVENTADDED ); | 1169 | todoModified (todo, KOGlobals::EVENTADDED ); |
1157 | updateView(); | 1170 | updateView(); |
1158 | } | 1171 | } |
1159 | void KOTodoView::keyPressEvent ( QKeyEvent * e ) | 1172 | void KOTodoView::keyPressEvent ( QKeyEvent * e ) |
1160 | { | 1173 | { |
1161 | // e->ignore(); | 1174 | // e->ignore(); |
1162 | //return; | 1175 | //return; |
1163 | //qDebug("KOTodoView::keyPressEvent "); | 1176 | //qDebug("KOTodoView::keyPressEvent "); |
1164 | switch ( e->key() ) { | 1177 | switch ( e->key() ) { |
1165 | case Qt::Key_Down: | 1178 | case Qt::Key_Down: |
1166 | case Qt::Key_Up: | 1179 | case Qt::Key_Up: |
1167 | QWidget::keyPressEvent ( e ); | 1180 | QWidget::keyPressEvent ( e ); |
1168 | break; | 1181 | break; |
1169 | 1182 | ||
1170 | case Qt::Key_Q: | 1183 | case Qt::Key_Q: |
1171 | toggleQuickTodo(); | 1184 | toggleQuickTodo(); |
1172 | break; | 1185 | break; |
1173 | case Qt::Key_U: | 1186 | case Qt::Key_U: |
1174 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { | 1187 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { |
1175 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | 1188 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); |
1176 | unparentTodo(); | 1189 | unparentTodo(); |
1177 | e->accept(); | 1190 | e->accept(); |
1178 | } else | 1191 | } else |
1179 | e->ignore(); | 1192 | e->ignore(); |
1180 | break; | 1193 | break; |
1181 | case Qt::Key_S: | 1194 | case Qt::Key_S: |
1182 | if ( e->state() == Qt::ControlButton ) { | 1195 | if ( e->state() == Qt::ControlButton ) { |
1183 | e->ignore(); | 1196 | e->ignore(); |
1184 | break; | 1197 | break; |
1185 | } | 1198 | } |
1186 | if ( e->state() == Qt::ShiftButton ) { | 1199 | if ( e->state() == Qt::ShiftButton ) { |
1187 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | 1200 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); |
1188 | reparentTodo(); | 1201 | reparentTodo(); |
1189 | e->accept(); | 1202 | e->accept(); |
1190 | } else | 1203 | } else |
1191 | e->ignore(); | 1204 | e->ignore(); |
1192 | break; | 1205 | break; |
1193 | case Qt::Key_P: | 1206 | case Qt::Key_P: |
1194 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { | 1207 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { |
1195 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | 1208 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); |
1196 | if ( pendingSubtodo ) | 1209 | if ( pendingSubtodo ) |
1197 | itemClicked(mActiveItem); | 1210 | itemClicked(mActiveItem); |
1198 | e->accept(); | 1211 | e->accept(); |
1199 | } else | 1212 | } else |
1200 | e->ignore(); | 1213 | e->ignore(); |
1201 | break; | 1214 | break; |
1202 | case Qt::Key_Escape: | 1215 | case Qt::Key_Escape: |
1203 | if ( pendingSubtodo ) { | 1216 | if ( pendingSubtodo ) { |
1204 | itemClicked(0); | 1217 | itemClicked(0); |
1205 | e->accept(); | 1218 | e->accept(); |
1206 | } else | 1219 | } else |
1207 | e->ignore(); | 1220 | e->ignore(); |
1208 | break; | 1221 | break; |
1209 | default: | 1222 | default: |
1210 | e->ignore(); | 1223 | e->ignore(); |
1211 | } | 1224 | } |
1212 | 1225 | ||
1213 | if ( true ) { | 1226 | if ( true ) { |
1214 | if ( e->key() == Qt::Key_I ) { | 1227 | if ( e->key() == Qt::Key_I ) { |
1215 | KOTodoViewItem*cn = (KOTodoViewItem*)mTodoListView->currentItem(); | 1228 | KOTodoViewItem*cn = (KOTodoViewItem*)mTodoListView->currentItem(); |
1216 | if ( cn ) { | 1229 | if ( cn ) { |
1217 | mActiveItem = cn; | 1230 | mActiveItem = cn; |
1218 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); | 1231 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); |
1219 | if ( ci ){ | 1232 | if ( ci ){ |
1220 | showTodo(); | 1233 | showTodo(); |
1221 | cn = (KOTodoViewItem*)cn->itemBelow(); | 1234 | cn = (KOTodoViewItem*)cn->itemBelow(); |
1222 | if ( cn ) { | 1235 | if ( cn ) { |
1223 | mTodoListView->setCurrentItem ( cn ); | 1236 | mTodoListView->setCurrentItem ( cn ); |
1224 | mTodoListView->ensureItemVisible ( cn ); | 1237 | mTodoListView->ensureItemVisible ( cn ); |
1225 | } | 1238 | } |
1226 | 1239 | ||
1227 | } | 1240 | } |
1228 | } | 1241 | } |
1229 | e->accept(); | 1242 | e->accept(); |
1230 | 1243 | ||
1231 | } | 1244 | } |
1232 | 1245 | ||
1233 | } | 1246 | } |
1234 | 1247 | ||
1235 | } | 1248 | } |
1236 | void KOTodoView::updateTodo( Todo * t, int type ) | 1249 | void KOTodoView::updateTodo( Todo * t, int type ) |
1237 | { | 1250 | { |
1238 | if ( mBlockUpdate) | 1251 | if ( mBlockUpdate) |
1239 | return; | 1252 | return; |
1240 | 1253 | ||
1241 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; | 1254 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; |
1242 | itemIterator = mTodoMap.find(t); | 1255 | itemIterator = mTodoMap.find(t); |
1243 | if (itemIterator != mTodoMap.end()) { | 1256 | if (itemIterator != mTodoMap.end()) { |
1244 | (*itemIterator)->construct(); | 1257 | (*itemIterator)->construct(); |
1245 | } else { | 1258 | } else { |
1246 | if ( type == KOGlobals::EVENTADDED ) { | 1259 | if ( type == KOGlobals::EVENTADDED ) { |
1247 | insertTodoItem( t ); | 1260 | insertTodoItem( t ); |
1248 | } | 1261 | } |
1249 | } | 1262 | } |
1250 | 1263 | ||
1251 | } | 1264 | } |
1252 | 1265 | ||
1253 | void KOTodoView::todoModified(Todo * t , int p ) | 1266 | void KOTodoView::todoModified(Todo * t , int p ) |
1254 | { | 1267 | { |
1255 | mBlockUpdate = true; | 1268 | mBlockUpdate = true; |
1256 | emit todoModifiedSignal ( t, p ); | 1269 | emit todoModifiedSignal ( t, p ); |
1257 | mBlockUpdate = false; | 1270 | mBlockUpdate = false; |
1258 | } | 1271 | } |
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h index 16bc133..2a9e737 100644 --- a/korganizer/kotodoview.h +++ b/korganizer/kotodoview.h | |||
@@ -1,249 +1,253 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000, 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000, 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | #ifndef KOTODOVIEW_H | 23 | #ifndef KOTODOVIEW_H |
24 | #define KOTODOVIEW_H | 24 | #define KOTODOVIEW_H |
25 | 25 | ||
26 | #include <qfont.h> | 26 | #include <qfont.h> |
27 | #include <qfontmetrics.h> | 27 | #include <qfontmetrics.h> |
28 | #include <qlineedit.h> | 28 | #include <qlineedit.h> |
29 | #include <qptrlist.h> | 29 | #include <qptrlist.h> |
30 | #include <qstrlist.h> | 30 | #include <qstrlist.h> |
31 | #include <qlistbox.h> | 31 | #include <qlistbox.h> |
32 | #include <qpopupmenu.h> | 32 | #include <qpopupmenu.h> |
33 | #include <qlabel.h> | 33 | #include <qlabel.h> |
34 | #include <qmap.h> | 34 | #include <qmap.h> |
35 | #include <qlistview.h> | 35 | #include <qlistview.h> |
36 | #include <klistview.h> | 36 | #include <klistview.h> |
37 | 37 | ||
38 | #include <libkcal/calendar.h> | 38 | #include <libkcal/calendar.h> |
39 | #include <libkcal/todo.h> | 39 | #include <libkcal/todo.h> |
40 | 40 | ||
41 | #include <korganizer/baseview.h> | 41 | #include <korganizer/baseview.h> |
42 | 42 | ||
43 | #include "kotodoviewitem.h" | 43 | #include "kotodoviewitem.h" |
44 | #include "koprefs.h" | 44 | #include "koprefs.h" |
45 | #include "koglobals.h" | 45 | #include "koglobals.h" |
46 | #include "datenavigator.h" | 46 | #include "datenavigator.h" |
47 | 47 | ||
48 | class QDragEnterEvent; | 48 | class QDragEnterEvent; |
49 | class QDragMoveEvent; | 49 | class QDragMoveEvent; |
50 | class QDragLeaveEvent; | 50 | class QDragLeaveEvent; |
51 | class QDropEvent; | 51 | class QDropEvent; |
52 | 52 | ||
53 | class DocPrefs; | 53 | class DocPrefs; |
54 | 54 | ||
55 | class KOTodoListView : public KListView | 55 | class KOTodoListView : public KListView |
56 | { | 56 | { |
57 | Q_OBJECT | 57 | Q_OBJECT |
58 | public: | 58 | public: |
59 | KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0); | 59 | KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0); |
60 | virtual ~KOTodoListView() {} | 60 | virtual ~KOTodoListView() {} |
61 | 61 | ||
62 | signals: | 62 | signals: |
63 | void paintNeeded(); | ||
63 | void todoDropped(Todo *, int); | 64 | void todoDropped(Todo *, int); |
64 | void double_Clicked(QListViewItem *item); | 65 | void double_Clicked(QListViewItem *item); |
65 | void reparentTodoSignal( Todo *,Todo * ); | 66 | void reparentTodoSignal( Todo *,Todo * ); |
66 | void unparentTodoSignal(Todo *); | 67 | void unparentTodoSignal(Todo *); |
67 | void deleteTodo( Todo * ); | 68 | void deleteTodo( Todo * ); |
68 | protected: | 69 | protected: |
69 | void contentsDragEnterEvent(QDragEnterEvent *); | 70 | void contentsDragEnterEvent(QDragEnterEvent *); |
70 | void contentsDragMoveEvent(QDragMoveEvent *); | 71 | void contentsDragMoveEvent(QDragMoveEvent *); |
71 | void contentsDragLeaveEvent(QDragLeaveEvent *); | 72 | void contentsDragLeaveEvent(QDragLeaveEvent *); |
72 | void contentsDropEvent(QDropEvent *); | 73 | void contentsDropEvent(QDropEvent *); |
73 | 74 | ||
74 | void contentsMousePressEvent(QMouseEvent *); | 75 | void contentsMousePressEvent(QMouseEvent *); |
75 | void contentsMouseMoveEvent(QMouseEvent *); | 76 | void contentsMouseMoveEvent(QMouseEvent *); |
76 | void contentsMouseReleaseEvent(QMouseEvent *); | 77 | void contentsMouseReleaseEvent(QMouseEvent *); |
77 | void contentsMouseDoubleClickEvent(QMouseEvent *); | 78 | void contentsMouseDoubleClickEvent(QMouseEvent *); |
78 | 79 | ||
79 | private: | 80 | private: |
81 | void paintEvent(QPaintEvent * pevent); | ||
80 | bool internalDrop; | 82 | bool internalDrop; |
81 | QString mName; | 83 | QString mName; |
82 | Calendar *mCalendar; | 84 | Calendar *mCalendar; |
83 | QPoint mPressPos; | 85 | QPoint mPressPos; |
84 | bool mMousePressed; | 86 | bool mMousePressed; |
85 | QListViewItem *mOldCurrent; | 87 | QListViewItem *mOldCurrent; |
86 | void keyPressEvent ( QKeyEvent * ) ; | 88 | void keyPressEvent ( QKeyEvent * ) ; |
87 | }; | 89 | }; |
88 | 90 | ||
89 | 91 | ||
90 | /** | 92 | /** |
91 | This is the line-edit on top of the todoview for fast addition of new todos | 93 | This is the line-edit on top of the todoview for fast addition of new todos |
92 | */ | 94 | */ |
93 | class KOQuickTodo : public QLineEdit | 95 | class KOQuickTodo : public QLineEdit |
94 | { | 96 | { |
95 | public: | 97 | public: |
96 | KOQuickTodo(QWidget *parent=0); | 98 | KOQuickTodo(QWidget *parent=0); |
97 | protected: | 99 | protected: |
98 | void focusInEvent(QFocusEvent *ev); | 100 | void focusInEvent(QFocusEvent *ev); |
99 | void focusOutEvent(QFocusEvent *ev); | 101 | void focusOutEvent(QFocusEvent *ev); |
100 | }; | 102 | }; |
101 | 103 | ||
102 | 104 | ||
103 | /** | 105 | /** |
104 | This class provides a multi-column list view of todo events. | 106 | This class provides a multi-column list view of todo events. |
105 | 107 | ||
106 | @short multi-column list view of todo events. | 108 | @short multi-column list view of todo events. |
107 | @author Cornelius Schumacher <schumacher@kde.org> | 109 | @author Cornelius Schumacher <schumacher@kde.org> |
108 | */ | 110 | */ |
109 | class KOTodoView : public KOrg::BaseView | 111 | class KOTodoView : public KOrg::BaseView |
110 | { | 112 | { |
111 | Q_OBJECT | 113 | Q_OBJECT |
112 | public: | 114 | public: |
113 | KOTodoView(Calendar *, QWidget* parent=0, const char* name=0 ); | 115 | KOTodoView(Calendar *, QWidget* parent=0, const char* name=0 ); |
114 | ~KOTodoView(); | 116 | ~KOTodoView(); |
115 | 117 | ||
116 | QPtrList<Incidence> selectedIncidences(); | 118 | QPtrList<Incidence> selectedIncidences(); |
117 | QPtrList<Todo> selectedTodos(); | 119 | QPtrList<Todo> selectedTodos(); |
118 | 120 | ||
119 | DateList selectedDates() | 121 | DateList selectedDates() |
120 | {DateList q; | 122 | {DateList q; |
121 | return q;} | 123 | return q;} |
122 | 124 | ||
123 | /** Return number of shown dates. TodoView does not show dates, */ | 125 | /** Return number of shown dates. TodoView does not show dates, */ |
124 | int currentDateCount() { return 0; } | 126 | int currentDateCount() { return 0; } |
125 | 127 | ||
126 | void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td); | 128 | void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td); |
127 | 129 | ||
128 | void setDocumentId( const QString & ); | 130 | void setDocumentId( const QString & ); |
129 | 131 | ||
130 | void saveLayout(KConfig *config, const QString &group) const; | 132 | void saveLayout(KConfig *config, const QString &group) const; |
131 | void restoreLayout(KConfig *config, const QString &group); | 133 | void restoreLayout(KConfig *config, const QString &group); |
132 | /** Create a popup menu to set categories */ | 134 | /** Create a popup menu to set categories */ |
133 | QPopupMenu *getCategoryPopupMenu (KOTodoViewItem *todoItem); | 135 | QPopupMenu *getCategoryPopupMenu (KOTodoViewItem *todoItem); |
134 | void setNavigator( DateNavigator* nav ) {mNavigator = nav;} | 136 | void setNavigator( DateNavigator* nav ) {mNavigator = nav;} |
135 | 137 | ||
136 | public slots: | 138 | public slots: |
137 | void updateView(); | 139 | void updateView(); |
138 | void updateConfig(); | 140 | void updateConfig(); |
139 | 141 | ||
140 | void changeEventDisplay(Event *, int); | 142 | void changeEventDisplay(Event *, int); |
141 | 143 | ||
142 | void showDates(const QDate &start, const QDate &end); | 144 | void showDates(const QDate &start, const QDate &end); |
143 | void showEvents(QPtrList<Event> eventList); | 145 | void showEvents(QPtrList<Event> eventList); |
144 | 146 | ||
145 | void clearSelection(); | 147 | void clearSelection(); |
146 | void jumpToDate (); | 148 | void jumpToDate (); |
147 | 149 | ||
148 | void editItem(QListViewItem *item); | 150 | void editItem(QListViewItem *item); |
149 | void showItem(QListViewItem *item,const QPoint &,int); | 151 | void showItem(QListViewItem *item,const QPoint &,int); |
150 | void popupMenu(QListViewItem *item,const QPoint &,int); | 152 | void popupMenu(QListViewItem *item,const QPoint &,int); |
151 | void newTodo(); | 153 | void newTodo(); |
152 | void newSubTodo(); | 154 | void newSubTodo(); |
153 | void unparentTodo(); | 155 | void unparentTodo(); |
154 | void reparentTodo(); | 156 | void reparentTodo(); |
155 | void showTodo(); | 157 | void showTodo(); |
156 | void editTodo(); | 158 | void editTodo(); |
157 | void cloneTodo(); | 159 | void cloneTodo(); |
158 | void cancelTodo(); | 160 | void cancelTodo(); |
159 | void moveTodo(); | 161 | void moveTodo(); |
160 | void beamTodo(); | 162 | void beamTodo(); |
161 | void deleteTodo(); | 163 | void deleteTodo(); |
162 | 164 | ||
163 | void setNewPriority(int); | 165 | void setNewPriority(int); |
164 | void setNewPercentage(int); | 166 | void setNewPercentage(int); |
165 | void changedCategories(int); | 167 | void changedCategories(int); |
166 | 168 | ||
167 | void setAllOpen(); | 169 | void setAllOpen(); |
168 | void setAllClose(); | 170 | void setAllClose(); |
169 | void setAllFlat(); | 171 | void setAllFlat(); |
170 | 172 | ||
171 | void purgeCompleted(); | 173 | void purgeCompleted(); |
172 | void toggleCompleted(); | 174 | void toggleCompleted(); |
173 | void toggleRunning(); | 175 | void toggleRunning(); |
174 | void toggleQuickTodo(); | 176 | void toggleQuickTodo(); |
175 | void updateTodo( Todo *, int ); | 177 | void updateTodo( Todo *, int ); |
176 | 178 | ||
177 | void itemClicked(QListViewItem *); | 179 | void itemClicked(QListViewItem *); |
178 | void itemStateChanged(QListViewItem *); | 180 | void itemStateChanged(QListViewItem *); |
179 | void modified(bool); | 181 | void modified(bool); |
180 | void itemDoubleClicked(QListViewItem *item); | 182 | void itemDoubleClicked(QListViewItem *item); |
181 | 183 | ||
182 | signals: | 184 | signals: |
183 | void newTodoSignal(); | 185 | void newTodoSignal(); |
184 | void newSubTodoSignal(Todo *); | 186 | void newSubTodoSignal(Todo *); |
185 | void unparentTodoSignal(Todo *); | 187 | void unparentTodoSignal(Todo *); |
186 | void reparentTodoSignal( Todo *,Todo * ); | 188 | void reparentTodoSignal( Todo *,Todo * ); |
187 | void showTodoSignal(Todo *); | 189 | void showTodoSignal(Todo *); |
188 | 190 | ||
189 | void editTodoSignal(Todo *); | 191 | void editTodoSignal(Todo *); |
190 | void deleteTodoSignal(Todo *); | 192 | void deleteTodoSignal(Todo *); |
191 | void todoModifiedSignal (Todo *, int); | 193 | void todoModifiedSignal (Todo *, int); |
192 | 194 | ||
193 | void isModified(bool); | 195 | void isModified(bool); |
194 | void cloneTodoSignal( Incidence * ); | 196 | void cloneTodoSignal( Incidence * ); |
195 | void cancelTodoSignal( Incidence * ); | 197 | void cancelTodoSignal( Incidence * ); |
196 | void moveTodoSignal( Incidence * ); | 198 | void moveTodoSignal( Incidence * ); |
197 | void beamTodoSignal( Incidence * ); | 199 | void beamTodoSignal( Incidence * ); |
198 | void purgeCompletedSignal(); | 200 | void purgeCompletedSignal(); |
199 | 201 | ||
200 | protected slots: | 202 | protected slots: |
203 | void paintNeeded(); | ||
201 | void processSelectionChange(); | 204 | void processSelectionChange(); |
202 | void addQuickTodo(); | 205 | void addQuickTodo(); |
203 | void setTodoModified( Todo* ); | 206 | void setTodoModified( Todo* ); |
204 | void todoModified(Todo *, int ); | 207 | void todoModified(Todo *, int ); |
205 | 208 | ||
206 | private: | 209 | private: |
207 | /* | 210 | /* |
208 | * the TodoEditor approach is rather unscaling in the long | 211 | * the TodoEditor approach is rather unscaling in the long |
209 | * run. | 212 | * run. |
210 | * Korganizer keeps it in memory and we need to update | 213 | * Korganizer keeps it in memory and we need to update |
211 | * 1. make KOTodoViewItem a QObject again? | 214 | * 1. make KOTodoViewItem a QObject again? |
212 | * 2. add a public method for setting one todo modified? | 215 | * 2. add a public method for setting one todo modified? |
213 | * 3. add a private method for setting a todo modified + friend here? | 216 | * 3. add a private method for setting a todo modified + friend here? |
214 | * -- zecke 2002-07-08 | 217 | * -- zecke 2002-07-08 |
215 | */ | 218 | */ |
219 | friend class KOTodoListView; | ||
216 | void paintEvent(QPaintEvent * pevent); | 220 | void paintEvent(QPaintEvent * pevent); |
217 | bool mPendingUpdateBeforeRepaint; | 221 | bool mPendingUpdateBeforeRepaint; |
218 | friend class KOTodoViewItem; | 222 | friend class KOTodoViewItem; |
219 | QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo); | 223 | QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo); |
220 | void restoreItemState( QListViewItem * ); | 224 | void restoreItemState( QListViewItem * ); |
221 | 225 | ||
222 | bool checkTodo( Todo * ); | 226 | bool checkTodo( Todo * ); |
223 | bool isFlatDisplay; | 227 | bool isFlatDisplay; |
224 | void setOpen( QListViewItem*, bool setOpen); | 228 | void setOpen( QListViewItem*, bool setOpen); |
225 | KOTodoListView *mTodoListView; | 229 | KOTodoListView *mTodoListView; |
226 | QPopupMenu *mItemPopupMenu; | 230 | QPopupMenu *mItemPopupMenu; |
227 | QPopupMenu *mPopupMenu; | 231 | QPopupMenu *mPopupMenu; |
228 | QPopupMenu *mPriorityPopupMenu; | 232 | QPopupMenu *mPriorityPopupMenu; |
229 | QPopupMenu *mPercentageCompletedPopupMenu; | 233 | QPopupMenu *mPercentageCompletedPopupMenu; |
230 | QPopupMenu *mCategoryPopupMenu; | 234 | QPopupMenu *mCategoryPopupMenu; |
231 | 235 | ||
232 | QMap<int, int> mPercentage; | 236 | QMap<int, int> mPercentage; |
233 | QMap<int, int> mPriority; | 237 | QMap<int, int> mPriority; |
234 | QMap<int, QString> mCategory; | 238 | QMap<int, QString> mCategory; |
235 | KOTodoViewItem *mActiveItem; | 239 | KOTodoViewItem *mActiveItem; |
236 | 240 | ||
237 | QMap<Todo *,KOTodoViewItem *> mTodoMap; | 241 | QMap<Todo *,KOTodoViewItem *> mTodoMap; |
238 | QString mName; | 242 | QString mName; |
239 | 243 | ||
240 | DocPrefs *mDocPrefs; | 244 | DocPrefs *mDocPrefs; |
241 | QString mCurrentDoc; | 245 | QString mCurrentDoc; |
242 | KOQuickTodo *mQuickAdd; | 246 | KOQuickTodo *mQuickAdd; |
243 | bool mBlockUpdate; | 247 | bool mBlockUpdate; |
244 | void keyPressEvent ( QKeyEvent * ) ; | 248 | void keyPressEvent ( QKeyEvent * ) ; |
245 | KOTodoViewItem * pendingSubtodo; | 249 | KOTodoViewItem * pendingSubtodo; |
246 | DateNavigator* mNavigator; | 250 | DateNavigator* mNavigator; |
247 | }; | 251 | }; |
248 | 252 | ||
249 | #endif | 253 | #endif |
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index 30f5fb1..188ad23 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp | |||
@@ -1,655 +1,656 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | 3 | ||
4 | Copyright (c) 2001 | 4 | Copyright (c) 2001 |
5 | Cornelius Schumacher <schumacher@kde.org> | 5 | Cornelius Schumacher <schumacher@kde.org> |
6 | 6 | ||
7 | This program is free software; you can redistribute it and/or modify | 7 | This program is free software; you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by | 8 | it under the terms of the GNU General Public License as published by |
9 | the Free Software Foundation; either version 2 of the License, or | 9 | the Free Software Foundation; either version 2 of the License, or |
10 | (at your option) any later version. | 10 | (at your option) any later version. |
11 | 11 | ||
12 | This program is distributed in the hope that it will be useful, | 12 | This program is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the |
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. |
16 | 16 | ||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License |
18 | along with this program; if not, write to the Free Software | 18 | along with this program; if not, write to the Free Software |
19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
20 | 20 | ||
21 | As a special exception, permission is given to link this program | 21 | As a special exception, permission is given to link this program |
22 | with any edition of Qt, and distribute the resulting executable, | 22 | with any edition of Qt, and distribute the resulting executable, |
23 | without including the source code for Qt in the source distribution. | 23 | without including the source code for Qt in the source distribution. |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <qwidgetstack.h> | 26 | #include <qwidgetstack.h> |
27 | 27 | ||
28 | #include <kconfig.h> | 28 | #include <kconfig.h> |
29 | #include <kglobal.h> | 29 | #include <kglobal.h> |
30 | #ifndef DESKTOP_VERSION | 30 | #ifndef DESKTOP_VERSION |
31 | #include <qpe/qpeapplication.h> | 31 | #include <qpe/qpeapplication.h> |
32 | #else | 32 | #else |
33 | #include <qapplication.h> | 33 | #include <qapplication.h> |
34 | #endif | 34 | #endif |
35 | #include <qdatetime.h> | 35 | #include <qdatetime.h> |
36 | #include "calendarview.h" | 36 | #include "calendarview.h" |
37 | #include "datenavigator.h" | 37 | #include "datenavigator.h" |
38 | #include "kotodoview.h" | 38 | #include "kotodoview.h" |
39 | #include "koagendaview.h" | 39 | #include "koagendaview.h" |
40 | #include "kodialogmanager.h" | 40 | #include "kodialogmanager.h" |
41 | #include "komonthview.h" | 41 | #include "komonthview.h" |
42 | #include "kolistview.h" | 42 | #include "kolistview.h" |
43 | #include "kowhatsnextview.h" | 43 | #include "kowhatsnextview.h" |
44 | #include "kojournalview.h" | 44 | #include "kojournalview.h" |
45 | #include "kotimespanview.h" | 45 | #include "kotimespanview.h" |
46 | #include "koprefs.h" | 46 | #include "koprefs.h" |
47 | #include "navigatorbar.h" | 47 | #include "navigatorbar.h" |
48 | #include "kdatenavigator.h" | 48 | #include "kdatenavigator.h" |
49 | 49 | ||
50 | #include "koviewmanager.h" | 50 | #include "koviewmanager.h" |
51 | //extern bool externFlagMonthviewBlockPainting; | 51 | //extern bool externFlagMonthviewBlockPainting; |
52 | 52 | ||
53 | //bool globalFlagBlockPainting = false; | 53 | //bool globalFlagBlockPainting = false; |
54 | int globalFlagBlockAgenda = 0; | 54 | int globalFlagBlockAgenda = 0; |
55 | int globalFlagBlockLabel = 0; | 55 | int globalFlagBlockLabel = 0; |
56 | int globalFlagBlockAgendaItemPaint = 1; | 56 | int globalFlagBlockAgendaItemPaint = 1; |
57 | int globalFlagBlockAgendaItemUpdate = 1; | 57 | int globalFlagBlockAgendaItemUpdate = 1; |
58 | 58 | ||
59 | 59 | ||
60 | KOViewManager::KOViewManager( CalendarView *mainView ) : | 60 | KOViewManager::KOViewManager( CalendarView *mainView ) : |
61 | QObject(), mMainView( mainView ) | 61 | QObject(), mMainView( mainView ) |
62 | { | 62 | { |
63 | mCurrentView = 0; | 63 | mCurrentView = 0; |
64 | 64 | ||
65 | mWhatsNextView = 0; | 65 | mWhatsNextView = 0; |
66 | mTodoView = 0; | 66 | mTodoView = 0; |
67 | mAgendaView = 0; | 67 | mAgendaView = 0; |
68 | mMonthView = 0; | 68 | mMonthView = 0; |
69 | mListView = 0; | 69 | mListView = 0; |
70 | mJournalView = 0; | 70 | mJournalView = 0; |
71 | mTimeSpanView = 0; | 71 | mTimeSpanView = 0; |
72 | mCurrentAgendaView = 0 ; | 72 | mCurrentAgendaView = 0 ; |
73 | mFlagShowNextxDays = false; | 73 | mFlagShowNextxDays = false; |
74 | } | 74 | } |
75 | 75 | ||
76 | KOViewManager::~KOViewManager() | 76 | KOViewManager::~KOViewManager() |
77 | { | 77 | { |
78 | } | 78 | } |
79 | 79 | ||
80 | 80 | ||
81 | KOrg::BaseView *KOViewManager::currentView() | 81 | KOrg::BaseView *KOViewManager::currentView() |
82 | { | 82 | { |
83 | return mCurrentView; | 83 | return mCurrentView; |
84 | } | 84 | } |
85 | 85 | ||
86 | void KOViewManager::readSettings(KConfig *config) | 86 | void KOViewManager::readSettings(KConfig *config) |
87 | { | 87 | { |
88 | config->setGroup("General"); | 88 | config->setGroup("General"); |
89 | QString view = config->readEntry("Current View"); | 89 | QString view = config->readEntry("Current View"); |
90 | if (view == "WhatsNext") showWhatsNextView(); | 90 | if (view == "WhatsNext") showWhatsNextView(); |
91 | else if (view == "Month") showMonthView(); | 91 | else if (view == "Month") showMonthView(); |
92 | else if (view == "List") showListView(); | 92 | else if (view == "List") showListView(); |
93 | else if (view == "Journal") showJournalView(); | 93 | else if (view == "Journal") showJournalView(); |
94 | else if (view == "TimeSpan") showTimeSpanView(); | 94 | else if (view == "TimeSpan") showTimeSpanView(); |
95 | else if (view == "Todo") showTodoView(); | 95 | else if (view == "Todo") showTodoView(); |
96 | else { | 96 | else { |
97 | showAgendaView(); | 97 | showAgendaView(); |
98 | } | 98 | } |
99 | } | 99 | } |
100 | 100 | ||
101 | 101 | ||
102 | void KOViewManager::showDateView( int view, QDate date) | 102 | void KOViewManager::showDateView( int view, QDate date) |
103 | { | 103 | { |
104 | 104 | ||
105 | //qDebug("date %d %s", view, date.toString().latin1()); | 105 | //qDebug("date %d %s", view, date.toString().latin1()); |
106 | #if 0 | 106 | #if 0 |
107 | mNewItemPopup->insertItem ( SmallIcon( pathString +"day" ), i18n("Day view"),3 ); | 107 | mNewItemPopup->insertItem ( SmallIcon( pathString +"day" ), i18n("Day view"),3 ); |
108 | mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next Week"),4 ); | 108 | mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next Week"),4 ); |
109 | mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("Next Two Weeks"),5 ); | 109 | mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("Next Two Weeks"),5 ); |
110 | mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("Next Month"),6 ); | 110 | mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("Next Month"),6 ); |
111 | mNewItemPopup->insertItem ( SmallIcon( pathString +"journal" ), i18n("Journal view"),7 ); | 111 | mNewItemPopup->insertItem ( SmallIcon( pathString +"journal" ), i18n("Journal view"),7 ); |
112 | #endif | 112 | #endif |
113 | if ( view == 3 ) { | 113 | if ( view == 3 ) { |
114 | //mCurrentAgendaView = 1 ; | 114 | //mCurrentAgendaView = 1 ; |
115 | mMainView->showDay( date ); | 115 | mMainView->showDay( date ); |
116 | } else if (view == 4 ) { | 116 | } else if (view == 4 ) { |
117 | mCurrentAgendaView = 7 ; | 117 | mCurrentAgendaView = 7 ; |
118 | mMainView->dateNavigator()->selectDates( date, 7 ); | 118 | mMainView->dateNavigator()->selectDates( date, 7 ); |
119 | } else if (view == 5 ) { | 119 | } else if (view == 5 ) { |
120 | mCurrentAgendaView = 14 ; | 120 | mCurrentAgendaView = 14 ; |
121 | mMainView->dateNavigator()->selectDates( date, 14); | 121 | mMainView->dateNavigator()->selectDates( date, 14); |
122 | } else if (view == 6 ) { | 122 | } else if (view == 6 ) { |
123 | mMainView->dateNavigator()->blockSignals( true ); | 123 | mMainView->dateNavigator()->blockSignals( true ); |
124 | showMonthView(); | 124 | showMonthView(); |
125 | mMainView->dateNavigator()->selectMonthByDate( date ); | 125 | mMainView->dateNavigator()->selectMonthByDate( date ); |
126 | mMainView->dateNavigator()->blockSignals( false ); | 126 | mMainView->dateNavigator()->blockSignals( false ); |
127 | mMainView->dateNavigator()->selectDate( date ); | 127 | mMainView->dateNavigator()->selectDate( date ); |
128 | } else if (view == 7 ) { | 128 | } else if (view == 7 ) { |
129 | mMainView->dateNavigator()->selectDate( date ); | 129 | mMainView->dateNavigator()->selectDate( date ); |
130 | showJournalView(); | 130 | showJournalView(); |
131 | } else if (view == 8 ) { | 131 | } else if (view == 8 ) { |
132 | globalFlagBlockAgenda = 1; | 132 | globalFlagBlockAgenda = 1; |
133 | if ( mCurrentAgendaView != 3 ) | 133 | if ( mCurrentAgendaView != 3 ) |
134 | mCurrentAgendaView = -1; | 134 | mCurrentAgendaView = -1; |
135 | showAgendaView(KOPrefs::instance()->mFullViewMonth); | 135 | showAgendaView(KOPrefs::instance()->mFullViewMonth); |
136 | globalFlagBlockAgenda = 2; | 136 | globalFlagBlockAgenda = 2; |
137 | mMainView->dateNavigator()->selectDates( date , | 137 | mMainView->dateNavigator()->selectDates( date , |
138 | KOPrefs::instance()->mNextXDays ); | 138 | KOPrefs::instance()->mNextXDays ); |
139 | mFlagShowNextxDays = true; | 139 | mFlagShowNextxDays = true; |
140 | mCurrentAgendaView = 3 ; | 140 | mCurrentAgendaView = 3 ; |
141 | } if (view == 9) { | 141 | } if (view == 9) { |
142 | showWeekView(); | 142 | showWeekView(); |
143 | } else if (view == 10) { | 143 | } else if (view == 10) { |
144 | mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() ); | 144 | mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() ); |
145 | } | 145 | } |
146 | 146 | ||
147 | #if 0 | 147 | #if 0 |
148 | dateNavigator()->blockSignals( true ); | 148 | dateNavigator()->blockSignals( true ); |
149 | dateNavigator()->selectDate( d ); | 149 | dateNavigator()->selectDate( d ); |
150 | dateNavigator()->blockSignals( false ); | 150 | dateNavigator()->blockSignals( false ); |
151 | mViewManager->showDayView(); | 151 | mViewManager->showDayView(); |
152 | #endif | 152 | #endif |
153 | 153 | ||
154 | } | 154 | } |
155 | 155 | ||
156 | 156 | ||
157 | 157 | ||
158 | void KOViewManager::writeSettings(KConfig *config) | 158 | void KOViewManager::writeSettings(KConfig *config) |
159 | { | 159 | { |
160 | config->setGroup("General"); | 160 | config->setGroup("General"); |
161 | 161 | ||
162 | QString view; | 162 | QString view; |
163 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; | 163 | if (mCurrentView == mWhatsNextView) view = "WhatsNext"; |
164 | else if (mCurrentView == mMonthView) view = "Month"; | 164 | else if (mCurrentView == mMonthView) view = "Month"; |
165 | else if (mCurrentView == mListView) view = "List"; | 165 | else if (mCurrentView == mListView) view = "List"; |
166 | else if (mCurrentView == mJournalView) view = "Journal"; | 166 | else if (mCurrentView == mJournalView) view = "Journal"; |
167 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; | 167 | else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; |
168 | else if (mCurrentView == mTodoView) view = "Todo"; | 168 | else if (mCurrentView == mTodoView) view = "Todo"; |
169 | else view = "Agenda"; | 169 | else view = "Agenda"; |
170 | 170 | ||
171 | config->writeEntry("Current View",view); | 171 | config->writeEntry("Current View",view); |
172 | 172 | ||
173 | if (mAgendaView) { | 173 | if (mAgendaView) { |
174 | mAgendaView->writeSettings(config); | 174 | mAgendaView->writeSettings(config); |
175 | } | 175 | } |
176 | if (mTimeSpanView) { | 176 | if (mTimeSpanView) { |
177 | mTimeSpanView->writeSettings(config); | 177 | mTimeSpanView->writeSettings(config); |
178 | } | 178 | } |
179 | if (mListView) { | 179 | if (mListView) { |
180 | mListView->writeSettings(config); | 180 | mListView->writeSettings(config); |
181 | } | 181 | } |
182 | if (mTodoView) { | 182 | if (mTodoView) { |
183 | mTodoView->saveLayout(config,"Todo View"); | 183 | mTodoView->saveLayout(config,"Todo View"); |
184 | } | 184 | } |
185 | } | 185 | } |
186 | 186 | ||
187 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) | 187 | void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) |
188 | { | 188 | { |
189 | 189 | ||
190 | //mFlagShowNextxDays = false; | 190 | //mFlagShowNextxDays = false; |
191 | //if(view == mCurrentView) return; | 191 | //if(view == mCurrentView) return; |
192 | if ( view == 0 ) { | 192 | if ( view == 0 ) { |
193 | view = mCurrentView; | 193 | view = mCurrentView; |
194 | if ( view == 0 ) | 194 | if ( view == 0 ) |
195 | return; | 195 | return; |
196 | } | 196 | } |
197 | bool full = fullScreen; | 197 | bool full = fullScreen; |
198 | if(view == mCurrentView && view != mWhatsNextView ) { | 198 | if(view == mCurrentView && view != mWhatsNextView ) { |
199 | if ( mCurrentAgendaView < 0 ) | 199 | if ( mCurrentAgendaView < 0 ) |
200 | return; | 200 | return; |
201 | full = mMainView->leftFrame()->isVisible(); | 201 | full = mMainView->leftFrame()->isVisible(); |
202 | } else { | 202 | } else { |
203 | mCurrentView = view; | 203 | mCurrentView = view; |
204 | // bool full = fullScreen; | 204 | // bool full = fullScreen; |
205 | bool isFull = !mMainView->leftFrame()->isVisible(); | 205 | bool isFull = !mMainView->leftFrame()->isVisible(); |
206 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) | 206 | if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) |
207 | full = true; | 207 | full = true; |
208 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) | 208 | if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) |
209 | full = false; | 209 | full = false; |
210 | } | 210 | } |
211 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); | 211 | if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); |
212 | //raiseCurrentView( full ); | 212 | //raiseCurrentView( full ); |
213 | mMainView->processIncidenceSelection( 0 ); | 213 | mMainView->processIncidenceSelection( 0 ); |
214 | //mMainView->updateView(); | 214 | //mMainView->updateView(); |
215 | raiseCurrentView( full, true ); | 215 | raiseCurrentView( full, true ); |
216 | mMainView->adaptNavigationUnits(); | 216 | mMainView->adaptNavigationUnits(); |
217 | } | 217 | } |
218 | 218 | ||
219 | void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) | 219 | void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) |
220 | { | 220 | { |
221 | mCurrentAgendaView = 0; | 221 | mCurrentAgendaView = 0; |
222 | int wid = mMainView->width() ; | 222 | int wid = mMainView->width() ; |
223 | int hei = mMainView->height(); | 223 | int hei = mMainView->height(); |
224 | if ( mCurrentView == mMonthView ) { | 224 | if ( mCurrentView == mMonthView ) { |
225 | mMainView->navigatorBar()->show(); | 225 | mMainView->navigatorBar()->show(); |
226 | hei -= mMainView->navigatorBar()->sizeHint().height(); | 226 | hei -= mMainView->navigatorBar()->sizeHint().height(); |
227 | //mMainView->navigatorBar()->hide(); | 227 | //mMainView->navigatorBar()->hide(); |
228 | } else { | 228 | } else { |
229 | mMainView->navigatorBar()->hide(); | 229 | mMainView->navigatorBar()->hide(); |
230 | } | 230 | } |
231 | if ( fullScreen ) { | 231 | if ( fullScreen ) { |
232 | mMainView->leftFrame()->hide(); | 232 | mMainView->leftFrame()->hide(); |
233 | } else { | 233 | } else { |
234 | mMainView->leftFrame()->show(); | 234 | mMainView->leftFrame()->show(); |
235 | if ( KOPrefs::instance()->mVerticalScreen ) | 235 | if ( KOPrefs::instance()->mVerticalScreen ) |
236 | hei -= mMainView->leftFrame()->height(); | 236 | hei -= mMainView->leftFrame()->height(); |
237 | else | 237 | else |
238 | wid -= mMainView->leftFrame()->width(); | 238 | wid -= mMainView->leftFrame()->width(); |
239 | } | 239 | } |
240 | emit signalFullScreen( !fullScreen ); | 240 | emit signalFullScreen( !fullScreen ); |
241 | if ( callUpdateView ) | 241 | if ( callUpdateView ) |
242 | mMainView->updateView(); | 242 | mMainView->updateView(); |
243 | 243 | ||
244 | if ( globalFlagBlockAgenda == 5 ) { | 244 | if ( globalFlagBlockAgenda == 5 ) { |
245 | globalFlagBlockAgenda = 4; | 245 | globalFlagBlockAgenda = 4; |
246 | globalFlagBlockAgendaItemPaint = 1; | 246 | globalFlagBlockAgendaItemPaint = 1; |
247 | } | 247 | } |
248 | mMainView->viewStack()->raiseWidget(mCurrentView); | 248 | mMainView->viewStack()->raiseWidget(mCurrentView); |
249 | if ( globalFlagBlockAgenda == 4 ) { | 249 | if ( globalFlagBlockAgenda == 4 ) { |
250 | if ( mCurrentView == mAgendaView ) { | 250 | if ( mCurrentView == mAgendaView ) { |
251 | //globalFlagBlockAgenda =1 ; | 251 | //globalFlagBlockAgenda =1 ; |
252 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) | 252 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) |
253 | mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); | 253 | mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); |
254 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) | 254 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) |
255 | mAgendaView->setStartHour( QTime::currentTime ().hour() ); | 255 | mAgendaView->setStartHour( QTime::currentTime ().hour() ); |
256 | qApp->processEvents(); | 256 | qApp->processEvents(); |
257 | //qDebug("qApp->processEvents() "); | 257 | //qDebug("qApp->processEvents() "); |
258 | globalFlagBlockAgenda = 0; | 258 | globalFlagBlockAgenda = 0; |
259 | mAgendaView->repaintAgenda(); | 259 | mAgendaView->repaintAgenda(); |
260 | 260 | ||
261 | } | 261 | } |
262 | globalFlagBlockAgenda = 0; | 262 | globalFlagBlockAgenda = 0; |
263 | } | 263 | } |
264 | emit signalAgendaView( mCurrentView == mAgendaView ); | 264 | emit signalAgendaView( mCurrentView == mAgendaView ); |
265 | //qDebug("raiseCurrentView ende "); | 265 | //qDebug("raiseCurrentView ende "); |
266 | 266 | ||
267 | } | 267 | } |
268 | 268 | ||
269 | void KOViewManager::updateView() | 269 | void KOViewManager::updateView() |
270 | { | 270 | { |
271 | // qDebug("KOViewManager::updateView() "); | 271 | // qDebug("KOViewManager::updateView() "); |
272 | // if we are updating mTodoView, we get endless recursion | 272 | // if we are updating mTodoView, we get endless recursion |
273 | if ( mTodoView == mCurrentView ) | 273 | if ( mTodoView == mCurrentView ) |
274 | return; | 274 | return; |
275 | if ( mCurrentView ) mCurrentView->updateView(); | 275 | if ( mCurrentView ) mCurrentView->updateView(); |
276 | 276 | ||
277 | } | 277 | } |
278 | 278 | ||
279 | void KOViewManager::updateView(const QDate &start, const QDate &end) | 279 | void KOViewManager::updateView(const QDate &start, const QDate &end) |
280 | { | 280 | { |
281 | // kdDebug() << "KOViewManager::updateView()" << endl; | 281 | // kdDebug() << "KOViewManager::updateView()" << endl; |
282 | 282 | ||
283 | if (mCurrentView) mCurrentView->showDates(start, end); | 283 | if (mCurrentView) mCurrentView->showDates(start, end); |
284 | 284 | ||
285 | if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView(); | 285 | if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView(); |
286 | } | 286 | } |
287 | 287 | ||
288 | 288 | ||
289 | void KOViewManager::updateWNview() | 289 | void KOViewManager::updateWNview() |
290 | { | 290 | { |
291 | if ( mCurrentView == mWhatsNextView && mWhatsNextView ) | 291 | if ( mCurrentView == mWhatsNextView && mWhatsNextView ) |
292 | mWhatsNextView->updateView(); | 292 | mWhatsNextView->updateView(); |
293 | 293 | ||
294 | } | 294 | } |
295 | void KOViewManager::showWhatsNextView() | 295 | void KOViewManager::showWhatsNextView() |
296 | { | 296 | { |
297 | if (!mWhatsNextView) { | 297 | if (!mWhatsNextView) { |
298 | mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), | 298 | mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), |
299 | "KOViewManager::WhatsNextView"); | 299 | "KOViewManager::WhatsNextView"); |
300 | mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); | 300 | mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); |
301 | connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); | 301 | connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); |
302 | addView(mWhatsNextView); | 302 | addView(mWhatsNextView); |
303 | connect(this, SIGNAL( printWNV() ), | 303 | connect(this, SIGNAL( printWNV() ), |
304 | mWhatsNextView, SLOT( printMe() ) ); | 304 | mWhatsNextView, SLOT( printMe() ) ); |
305 | } | 305 | } |
306 | globalFlagBlockAgenda = 1; | 306 | globalFlagBlockAgenda = 1; |
307 | showView(mWhatsNextView, true ); | 307 | showView(mWhatsNextView, true ); |
308 | //mWhatsNextView->updateView(); | 308 | //mWhatsNextView->updateView(); |
309 | 309 | ||
310 | } | 310 | } |
311 | 311 | ||
312 | void KOViewManager::showListView() | 312 | void KOViewManager::showListView() |
313 | { | 313 | { |
314 | if (!mListView) { | 314 | if (!mListView) { |
315 | mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); | 315 | mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); |
316 | addView(mListView); | 316 | addView(mListView); |
317 | 317 | ||
318 | connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), | 318 | connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), |
319 | mMainView, SLOT(showIncidence(Incidence *))); | 319 | mMainView, SLOT(showIncidence(Incidence *))); |
320 | connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), | 320 | connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), |
321 | mMainView, SLOT(editIncidence(Incidence *))); | 321 | mMainView, SLOT(editIncidence(Incidence *))); |
322 | connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 322 | connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
323 | mMainView, SLOT(deleteIncidence(Incidence *))); | 323 | mMainView, SLOT(deleteIncidence(Incidence *))); |
324 | connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), | 324 | connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), |
325 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 325 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
326 | connect( mListView, SIGNAL( signalNewEvent() ), | 326 | connect( mListView, SIGNAL( signalNewEvent() ), |
327 | mMainView, SLOT( newEvent() ) ); | 327 | mMainView, SLOT( newEvent() ) ); |
328 | connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); | 328 | connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); |
329 | connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), | 329 | connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), |
330 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 330 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
331 | connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), | 331 | connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), |
332 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 332 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
333 | connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 333 | connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
334 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 334 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
335 | connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 335 | connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
336 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 336 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
337 | } | 337 | } |
338 | // bool temp = mFlagShowNextxDays; | 338 | // bool temp = mFlagShowNextxDays; |
339 | //globalFlagBlockPainting = true; | 339 | //globalFlagBlockPainting = true; |
340 | globalFlagBlockAgenda = 1; | 340 | globalFlagBlockAgenda = 1; |
341 | if ( KOPrefs::instance()->mListViewMonthTimespan ) { | 341 | if ( KOPrefs::instance()->mListViewMonthTimespan ) { |
342 | mMainView->setBlockShowDates( true ); | 342 | mMainView->setBlockShowDates( true ); |
343 | mMainView->dateNavigator()->selectMonth(); | 343 | mMainView->dateNavigator()->selectMonth(); |
344 | mMainView->setBlockShowDates( false ); | 344 | mMainView->setBlockShowDates( false ); |
345 | } | 345 | } |
346 | showView(mListView, KOPrefs::instance()->mFullViewTodo); | 346 | showView(mListView, KOPrefs::instance()->mFullViewTodo); |
347 | //mFlagShowNextxDays = temp; | 347 | //mFlagShowNextxDays = temp; |
348 | } | 348 | } |
349 | 349 | ||
350 | void KOViewManager::showAgendaView( bool fullScreen ) | 350 | void KOViewManager::showAgendaView( bool fullScreen ) |
351 | { | 351 | { |
352 | 352 | ||
353 | mMainView->dialogManager()->hideSearchDialog(); | 353 | mMainView->dialogManager()->hideSearchDialog(); |
354 | // qDebug("KOViewManager::showAgendaView "); | 354 | // qDebug("KOViewManager::showAgendaView "); |
355 | bool full; | 355 | bool full; |
356 | full = fullScreen; | 356 | full = fullScreen; |
357 | if (!mAgendaView) { | 357 | if (!mAgendaView) { |
358 | full = false; | 358 | full = false; |
359 | mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); | 359 | mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); |
360 | addView(mAgendaView); | 360 | addView(mAgendaView); |
361 | #ifndef DESKTOP_VERSION | 361 | #ifndef DESKTOP_VERSION |
362 | QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); | 362 | QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); |
363 | #endif | 363 | #endif |
364 | connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), | 364 | connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), |
365 | mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); | 365 | mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); |
366 | 366 | ||
367 | // SIGNALS/SLOTS FOR DAY/WEEK VIEW | 367 | // SIGNALS/SLOTS FOR DAY/WEEK VIEW |
368 | 368 | ||
369 | connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate ))); | 369 | connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate ))); |
370 | 370 | ||
371 | connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)), | 371 | connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)), |
372 | mMainView, SLOT(newTodoDateTime(QDateTime,bool))); | 372 | mMainView, SLOT(newTodoDateTime(QDateTime,bool))); |
373 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), | 373 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), |
374 | mMainView, SLOT(newEvent(QDateTime))); | 374 | mMainView, SLOT(newEvent(QDateTime))); |
375 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), | 375 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), |
376 | mMainView, SLOT(newEvent(QDateTime,QDateTime))); | 376 | mMainView, SLOT(newEvent(QDateTime,QDateTime))); |
377 | connect(mAgendaView,SIGNAL(newEventSignal(QDate)), | 377 | connect(mAgendaView,SIGNAL(newEventSignal(QDate)), |
378 | mMainView, SLOT(newEvent(QDate))); | 378 | mMainView, SLOT(newEvent(QDate))); |
379 | 379 | ||
380 | connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), | 380 | connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), |
381 | mMainView, SLOT(editIncidence(Incidence *))); | 381 | mMainView, SLOT(editIncidence(Incidence *))); |
382 | connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), | 382 | connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), |
383 | mMainView, SLOT(showIncidence(Incidence *))); | 383 | mMainView, SLOT(showIncidence(Incidence *))); |
384 | connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 384 | connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
385 | mMainView, SLOT(deleteIncidence(Incidence *))); | 385 | mMainView, SLOT(deleteIncidence(Incidence *))); |
386 | 386 | ||
387 | connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), | 387 | connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), |
388 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 388 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
389 | 389 | ||
390 | connect(mAgendaView, SIGNAL( toggleExpand() ), | 390 | connect(mAgendaView, SIGNAL( toggleExpand() ), |
391 | mMainView, SLOT( toggleExpand() ) ); | 391 | mMainView, SLOT( toggleExpand() ) ); |
392 | 392 | ||
393 | connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ), | 393 | connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ), |
394 | mAgendaView, SLOT( setExpandedButton( bool ) ) ); | 394 | mAgendaView, SLOT( setExpandedButton( bool ) ) ); |
395 | connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), | 395 | connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), |
396 | mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; | 396 | mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; |
397 | connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), | 397 | connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), |
398 | mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; | 398 | mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; |
399 | connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); | 399 | connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); |
400 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, | 400 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, |
401 | SLOT( updateTodo( Todo *, int ) ) ); | 401 | SLOT( updateTodo( Todo *, int ) ) ); |
402 | connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), | 402 | connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), |
403 | mMainView, SIGNAL( todoModified( Todo *, int ))); | 403 | mMainView, SIGNAL( todoModified( Todo *, int ))); |
404 | connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 404 | connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
405 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 405 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
406 | connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 406 | connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
407 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 407 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
408 | mAgendaView->readSettings(); | 408 | mAgendaView->readSettings(); |
409 | mAgendaView->updateConfig(); | 409 | mAgendaView->updateConfig(); |
410 | } | 410 | } |
411 | 411 | ||
412 | showView( mAgendaView, full); | 412 | showView( mAgendaView, full); |
413 | 413 | ||
414 | } | 414 | } |
415 | 415 | ||
416 | void KOViewManager::showDayView() | 416 | void KOViewManager::showDayView() |
417 | { | 417 | { |
418 | mFlagShowNextxDays = false; | 418 | mFlagShowNextxDays = false; |
419 | globalFlagBlockLabel = 1; | 419 | globalFlagBlockLabel = 1; |
420 | globalFlagBlockAgenda = 1; | 420 | globalFlagBlockAgenda = 1; |
421 | if ( mCurrentAgendaView != 1 ) | 421 | if ( mCurrentAgendaView != 1 ) |
422 | mCurrentAgendaView = -1; | 422 | mCurrentAgendaView = -1; |
423 | showAgendaView(); | 423 | showAgendaView(); |
424 | qApp->processEvents(); | 424 | qApp->processEvents(); |
425 | globalFlagBlockAgenda = 2; | 425 | globalFlagBlockAgenda = 2; |
426 | globalFlagBlockLabel = 0; | 426 | globalFlagBlockLabel = 0; |
427 | mMainView->dateNavigator()->selectDates( 1 ); | 427 | mMainView->dateNavigator()->selectDates( 1 ); |
428 | mCurrentAgendaView = 1 ; | 428 | mCurrentAgendaView = 1 ; |
429 | 429 | ||
430 | } | 430 | } |
431 | 431 | ||
432 | void KOViewManager::showWorkWeekView() | 432 | void KOViewManager::showWorkWeekView() |
433 | { | 433 | { |
434 | mFlagShowNextxDays = false; | 434 | mFlagShowNextxDays = false; |
435 | globalFlagBlockAgenda = 1; | 435 | globalFlagBlockAgenda = 1; |
436 | globalFlagBlockLabel = 1; | 436 | globalFlagBlockLabel = 1; |
437 | if ( mCurrentAgendaView != 5 ) | 437 | if ( mCurrentAgendaView != 5 ) |
438 | mCurrentAgendaView = -1; | 438 | mCurrentAgendaView = -1; |
439 | showAgendaView(); | 439 | showAgendaView(); |
440 | qApp->processEvents(); | 440 | qApp->processEvents(); |
441 | globalFlagBlockAgenda = 2; | 441 | globalFlagBlockAgenda = 2; |
442 | globalFlagBlockLabel = 0; | 442 | globalFlagBlockLabel = 0; |
443 | mMainView->dateNavigator()->selectWorkWeek(); | 443 | mMainView->dateNavigator()->selectWorkWeek(); |
444 | mCurrentAgendaView = 5 ; | 444 | mCurrentAgendaView = 5 ; |
445 | 445 | ||
446 | } | 446 | } |
447 | 447 | ||
448 | void KOViewManager::showWeekView() | 448 | void KOViewManager::showWeekView() |
449 | { | 449 | { |
450 | /* | 450 | /* |
451 | globalFlagBlockAgenda = 2; | 451 | globalFlagBlockAgenda = 2; |
452 | qDebug("4globalFlagBlockAgenda = 2; "); | 452 | qDebug("4globalFlagBlockAgenda = 2; "); |
453 | //globalFlagBlockPainting = true; | 453 | //globalFlagBlockPainting = true; |
454 | mMainView->dateNavigator()->selectWeek(); | 454 | mMainView->dateNavigator()->selectWeek(); |
455 | showAgendaView(); | 455 | showAgendaView(); |
456 | */ | 456 | */ |
457 | 457 | ||
458 | 458 | ||
459 | mFlagShowNextxDays = false; | 459 | mFlagShowNextxDays = false; |
460 | globalFlagBlockAgenda = 1; | 460 | globalFlagBlockAgenda = 1; |
461 | globalFlagBlockLabel = 1; | 461 | globalFlagBlockLabel = 1; |
462 | if ( mCurrentAgendaView != 7 ) | 462 | if ( mCurrentAgendaView != 7 ) |
463 | mCurrentAgendaView = -1; | 463 | mCurrentAgendaView = -1; |
464 | showAgendaView(); | 464 | showAgendaView(); |
465 | qApp->processEvents(); | 465 | qApp->processEvents(); |
466 | globalFlagBlockAgenda = 2; | 466 | globalFlagBlockAgenda = 2; |
467 | globalFlagBlockLabel = 0; | 467 | globalFlagBlockLabel = 0; |
468 | mMainView->dateNavigator()->selectWeek(); | 468 | mMainView->dateNavigator()->selectWeek(); |
469 | mCurrentAgendaView = 7 ; | 469 | mCurrentAgendaView = 7 ; |
470 | } | 470 | } |
471 | 471 | ||
472 | void KOViewManager::showNextXView() | 472 | void KOViewManager::showNextXView() |
473 | { | 473 | { |
474 | 474 | ||
475 | globalFlagBlockAgenda = 1; | 475 | globalFlagBlockAgenda = 1; |
476 | if ( mCurrentAgendaView != 3 ) | 476 | if ( mCurrentAgendaView != 3 ) |
477 | mCurrentAgendaView = -1; | 477 | mCurrentAgendaView = -1; |
478 | showAgendaView(KOPrefs::instance()->mFullViewMonth); | 478 | showAgendaView(KOPrefs::instance()->mFullViewMonth); |
479 | globalFlagBlockAgenda = 2; | 479 | globalFlagBlockAgenda = 2; |
480 | mMainView->dateNavigator()->selectDates( QDate::currentDate(), | 480 | mMainView->dateNavigator()->selectDates( QDate::currentDate(), |
481 | KOPrefs::instance()->mNextXDays ); | 481 | KOPrefs::instance()->mNextXDays ); |
482 | mFlagShowNextxDays = true; | 482 | mFlagShowNextxDays = true; |
483 | mCurrentAgendaView = 3 ; | 483 | mCurrentAgendaView = 3 ; |
484 | } | 484 | } |
485 | bool KOViewManager::showsNextDays() | 485 | bool KOViewManager::showsNextDays() |
486 | { | 486 | { |
487 | return mFlagShowNextxDays; | 487 | return mFlagShowNextxDays; |
488 | } | 488 | } |
489 | void KOViewManager::showMonthView() | 489 | void KOViewManager::showMonthView() |
490 | { | 490 | { |
491 | if (!mMonthView) { | 491 | if (!mMonthView) { |
492 | mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); | 492 | mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); |
493 | 493 | ||
494 | addView(mMonthView); | 494 | addView(mMonthView); |
495 | // mMonthView->show(); | 495 | // mMonthView->show(); |
496 | // SIGNALS/SLOTS FOR MONTH VIEW | 496 | // SIGNALS/SLOTS FOR MONTH VIEW |
497 | connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), | 497 | connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), |
498 | mMainView, SLOT(newEvent(QDateTime))); | 498 | mMainView, SLOT(newEvent(QDateTime))); |
499 | 499 | ||
500 | connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), | 500 | connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), |
501 | mMainView, SLOT(showIncidence(Incidence *))); | 501 | mMainView, SLOT(showIncidence(Incidence *))); |
502 | connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), | 502 | connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), |
503 | mMainView, SLOT(editIncidence(Incidence *))); | 503 | mMainView, SLOT(editIncidence(Incidence *))); |
504 | connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 504 | connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
505 | mMainView, SLOT(deleteIncidence(Incidence *))); | 505 | mMainView, SLOT(deleteIncidence(Incidence *))); |
506 | 506 | ||
507 | connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), | 507 | connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), |
508 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 508 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
509 | connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), | 509 | connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), |
510 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 510 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
511 | connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), | 511 | connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), |
512 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 512 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
513 | 513 | ||
514 | connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 514 | connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
515 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 515 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
516 | connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 516 | connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
517 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 517 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
518 | connect( mMonthView, SIGNAL( selectWeekNum( int ) ), | 518 | connect( mMonthView, SIGNAL( selectWeekNum( int ) ), |
519 | mMainView, SLOT ( selectWeekNum( int ) ) ); | 519 | mMainView, SLOT ( selectWeekNum( int ) ) ); |
520 | connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), | 520 | connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), |
521 | mMainView, SLOT ( showDay( QDate ) ) ); | 521 | mMainView, SLOT ( showDay( QDate ) ) ); |
522 | connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); | 522 | connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); |
523 | connect( mMonthView, SIGNAL(nextMonth() ), | 523 | connect( mMonthView, SIGNAL(nextMonth() ), |
524 | mMainView->navigatorBar(), SIGNAL(goNextMonth() ) ); | 524 | mMainView->navigatorBar(), SIGNAL(goNextMonth() ) ); |
525 | connect( mMonthView, SIGNAL(prevMonth() ), | 525 | connect( mMonthView, SIGNAL(prevMonth() ), |
526 | mMainView->navigatorBar(), SIGNAL(goPrevMonth() ) ); | 526 | mMainView->navigatorBar(), SIGNAL(goPrevMonth() ) ); |
527 | mMonthView->updateConfig(); | 527 | mMonthView->updateConfig(); |
528 | } | 528 | } |
529 | 529 | ||
530 | globalFlagBlockAgenda = 1; | 530 | globalFlagBlockAgenda = 1; |
531 | //mFlagShowNextxDays = false; | 531 | //mFlagShowNextxDays = false; |
532 | // if(mMonthView == mCurrentView) return; | 532 | // if(mMonthView == mCurrentView) return; |
533 | mMainView->dateNavigator()->selectMonth(); | 533 | mMainView->dateNavigator()->selectMonth(); |
534 | 534 | ||
535 | showView(mMonthView, true ); | 535 | showView(mMonthView, true ); |
536 | 536 | ||
537 | } | 537 | } |
538 | 538 | ||
539 | void KOViewManager::showTodoView() | 539 | void KOViewManager::showTodoView() |
540 | { | 540 | { |
541 | //mFlagShowNextxDays = false; | 541 | //mFlagShowNextxDays = false; |
542 | if ( !mTodoView ) { | 542 | if ( !mTodoView ) { |
543 | mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), | 543 | mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), |
544 | "KOViewManager::TodoView" ); | 544 | "KOViewManager::TodoView" ); |
545 | 545 | ||
546 | addView( mTodoView ); | 546 | addView( mTodoView ); |
547 | // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); | 547 | // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); |
548 | 548 | ||
549 | // SIGNALS/SLOTS FOR TODO VIEW | 549 | // SIGNALS/SLOTS FOR TODO VIEW |
550 | connect( mTodoView, SIGNAL( newTodoSignal() ), | 550 | connect( mTodoView, SIGNAL( newTodoSignal() ), |
551 | mMainView, SLOT( newTodo() ) ); | 551 | mMainView, SLOT( newTodo() ) ); |
552 | connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), | 552 | connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), |
553 | mMainView, SLOT( newSubTodo( Todo *) ) ); | 553 | mMainView, SLOT( newSubTodo( Todo *) ) ); |
554 | connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), | 554 | connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), |
555 | mMainView, SLOT( showTodo( Todo * ) ) ); | 555 | mMainView, SLOT( showTodo( Todo * ) ) ); |
556 | connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), | 556 | connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), |
557 | mMainView, SLOT( editTodo( Todo * ) ) ); | 557 | mMainView, SLOT( editTodo( Todo * ) ) ); |
558 | connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), | 558 | connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), |
559 | mMainView, SLOT( deleteTodo( Todo * ) ) ); | 559 | mMainView, SLOT( deleteTodo( Todo * ) ) ); |
560 | connect( mTodoView, SIGNAL( purgeCompletedSignal() ), | 560 | connect( mTodoView, SIGNAL( purgeCompletedSignal() ), |
561 | mMainView, SLOT( purgeCompleted() ) ); | 561 | mMainView, SLOT( purgeCompleted() ) ); |
562 | 562 | ||
563 | connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), | 563 | connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), |
564 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 564 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
565 | 565 | ||
566 | connect( mMainView, SIGNAL( configChanged() ), mTodoView, | 566 | connect( mMainView, SIGNAL( configChanged() ), mTodoView, |
567 | SLOT( updateConfig() ) ); | 567 | SLOT( updateConfig() ) ); |
568 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, | 568 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, |
569 | SLOT( updateTodo( Todo *, int ) ) ); | 569 | SLOT( updateTodo( Todo *, int ) ) ); |
570 | connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 570 | connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
571 | mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); | 571 | mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); |
572 | connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), | 572 | connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), |
573 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 573 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
574 | connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), | 574 | connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), |
575 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 575 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
576 | connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), | 576 | connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), |
577 | mMainView, SLOT ( todo_unsub( Todo * ) ) ); | 577 | mMainView, SLOT ( todo_unsub( Todo * ) ) ); |
578 | connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), | 578 | connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), |
579 | mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); | 579 | mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); |
580 | connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), | 580 | connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), |
581 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 581 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
582 | connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), | 582 | connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), |
583 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 583 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
584 | KConfig *config = KOGlobals::config(); | 584 | KConfig *config = KOGlobals::config(); |
585 | mTodoView->restoreLayout(config,"Todo View"); | 585 | mTodoView->restoreLayout(config,"Todo View"); |
586 | mTodoView->setNavigator( mMainView->dateNavigator() ); | 586 | mTodoView->setNavigator( mMainView->dateNavigator() ); |
587 | } | 587 | } |
588 | 588 | ||
589 | globalFlagBlockAgenda = 1; | 589 | globalFlagBlockAgenda = 1; |
590 | showView( mTodoView, true ); | 590 | showView( mTodoView, true ); |
591 | 591 | ||
592 | } | 592 | } |
593 | 593 | ||
594 | void KOViewManager::showJournalView() | 594 | void KOViewManager::showJournalView() |
595 | { | 595 | { |
596 | //mFlagShowNextxDays = false; | 596 | //mFlagShowNextxDays = false; |
597 | if (!mJournalView) { | 597 | if (!mJournalView) { |
598 | mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), | 598 | mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), |
599 | "KOViewManager::JournalView"); | 599 | "KOViewManager::JournalView"); |
600 | connect( mMainView, SIGNAL( configChanged() ), mJournalView, | 600 | connect( mMainView, SIGNAL( configChanged() ), mJournalView, |
601 | SLOT( updateConfig() ) ); | 601 | SLOT( updateConfig() ) ); |
602 | connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); | 602 | connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); |
603 | addView(mJournalView); | 603 | addView(mJournalView); |
604 | } | 604 | } |
605 | 605 | ||
606 | showView(mJournalView); | 606 | showView(mJournalView); |
607 | mMainView->dateNavigator()->selectDates( 1 ); | ||
607 | } | 608 | } |
608 | 609 | ||
609 | void KOViewManager::showTimeSpanView() | 610 | void KOViewManager::showTimeSpanView() |
610 | { | 611 | { |
611 | //mFlagShowNextxDays = false; | 612 | //mFlagShowNextxDays = false; |
612 | if (!mTimeSpanView) { | 613 | if (!mTimeSpanView) { |
613 | mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(), | 614 | mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(), |
614 | "KOViewManager::TimeSpanView"); | 615 | "KOViewManager::TimeSpanView"); |
615 | addView(mTimeSpanView); | 616 | addView(mTimeSpanView); |
616 | 617 | ||
617 | mTimeSpanView->readSettings(); | 618 | mTimeSpanView->readSettings(); |
618 | } | 619 | } |
619 | 620 | ||
620 | showView(mTimeSpanView); | 621 | showView(mTimeSpanView); |
621 | } | 622 | } |
622 | 623 | ||
623 | Incidence *KOViewManager::currentSelection() | 624 | Incidence *KOViewManager::currentSelection() |
624 | { | 625 | { |
625 | if (!mCurrentView) return 0; | 626 | if (!mCurrentView) return 0; |
626 | if ( mCurrentView == mListView ) { | 627 | if ( mCurrentView == mListView ) { |
627 | if ( mListView->currentItem() ) | 628 | if ( mListView->currentItem() ) |
628 | return mListView->currentItem(); | 629 | return mListView->currentItem(); |
629 | } | 630 | } |
630 | return mCurrentView->selectedIncidences().first(); | 631 | return mCurrentView->selectedIncidences().first(); |
631 | } | 632 | } |
632 | 633 | ||
633 | QDate KOViewManager::currentSelectionDate() | 634 | QDate KOViewManager::currentSelectionDate() |
634 | { | 635 | { |
635 | QDate qd; | 636 | QDate qd; |
636 | if (mCurrentView) { | 637 | if (mCurrentView) { |
637 | DateList qvl = mCurrentView->selectedDates(); | 638 | DateList qvl = mCurrentView->selectedDates(); |
638 | if (!qvl.isEmpty()) qd = qvl.first(); | 639 | if (!qvl.isEmpty()) qd = qvl.first(); |
639 | } | 640 | } |
640 | return qd; | 641 | return qd; |
641 | } | 642 | } |
642 | 643 | ||
643 | void KOViewManager::addView(KOrg::BaseView *view) | 644 | void KOViewManager::addView(KOrg::BaseView *view) |
644 | { | 645 | { |
645 | #if QT_VERSION >= 0x030000 | 646 | #if QT_VERSION >= 0x030000 |
646 | mMainView->viewStack()->addWidget( view ); | 647 | mMainView->viewStack()->addWidget( view ); |
647 | #else | 648 | #else |
648 | mMainView->viewStack()->addWidget( view, 1 ); | 649 | mMainView->viewStack()->addWidget( view, 1 ); |
649 | #endif | 650 | #endif |
650 | } | 651 | } |
651 | 652 | ||
652 | void KOViewManager::setDocumentId( const QString &id ) | 653 | void KOViewManager::setDocumentId( const QString &id ) |
653 | { | 654 | { |
654 | if (mTodoView) mTodoView->setDocumentId( id ); | 655 | if (mTodoView) mTodoView->setDocumentId( id ); |
655 | } | 656 | } |