author | zautrix <zautrix> | 2005-02-06 15:21:01 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-06 15:21:01 (UTC) |
commit | 38898c49275bf27fb8c2df96d145f2a5abb62331 (patch) (unidiff) | |
tree | b96f0a336fccf4d6c67e6a4b5c1239b4d647b3b9 | |
parent | 26b0c69fb3b11c29475ec02b2cfe52e33eb24e5f (diff) | |
download | kdepimpi-38898c49275bf27fb8c2df96d145f2a5abb62331.zip kdepimpi-38898c49275bf27fb8c2df96d145f2a5abb62331.tar.gz kdepimpi-38898c49275bf27fb8c2df96d145f2a5abb62331.tar.bz2 |
fixxeess
-rw-r--r-- | bin/kdepim/WhatsNew.txt | 5 | ||||
-rw-r--r-- | korganizer/koeditorgeneraltodo.cpp | 2 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 96 | ||||
-rw-r--r-- | korganizer/komonthview.h | 3 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 3 |
5 files changed, 64 insertions, 45 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index 4251283..e21bb44 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt | |||
@@ -1,391 +1,396 @@ | |||
1 | Info about the changes in new versions of KDE-Pim/Pi | 1 | Info about the changes in new versions of KDE-Pim/Pi |
2 | 2 | ||
3 | ********** VERSION 2.0.4 ************ | 3 | ********** VERSION 2.0.4 ************ |
4 | 4 | ||
5 | KO/Pi: | 5 | KO/Pi: |
6 | Fixed problem loading translations for summary/location edit boxes in event/todo editor. | 6 | Fixed problem loading translations for summary/location edit boxes in event/todo editor. |
7 | 7 | ||
8 | Added a general "select week number" to the toolbar. | ||
9 | |||
10 | Fixed some small problem of the new features introduced in version 2.0.3. | ||
11 | |||
12 | |||
8 | ********** VERSION 2.0.3 ************ | 13 | ********** VERSION 2.0.3 ************ |
9 | 14 | ||
10 | KO/Pi: | 15 | KO/Pi: |
11 | Added feature for changing alarm settings for many items at once: | 16 | Added feature for changing alarm settings for many items at once: |
12 | Open list view (or search dialog), select the desired items and choose in | 17 | Open list view (or search dialog), select the desired items and choose in |
13 | the popup menu: Set alarm for selected... | 18 | the popup menu: Set alarm for selected... |
14 | 19 | ||
15 | Added to the event/todo viewer the option to send an email to | 20 | Added to the event/todo viewer the option to send an email to |
16 | all attendees or all selected (with RSVP) attendees. | 21 | all attendees or all selected (with RSVP) attendees. |
17 | 22 | ||
18 | Made the week-month mode changing in month view faster. | 23 | Made the week-month mode changing in month view faster. |
19 | 24 | ||
20 | Made month view better useable with keyboard. | 25 | Made month view better useable with keyboard. |
21 | Now TAB key jumps to next cell with an event/todo. | 26 | Now TAB key jumps to next cell with an event/todo. |
22 | Scroll in cell with coursor keys, scroll in time (next week) with | 27 | Scroll in cell with coursor keys, scroll in time (next week) with |
23 | Shift/Control + coursorkeys. | 28 | Shift/Control + coursorkeys. |
24 | 29 | ||
25 | Fixed bug that the todo view flat mode was reset after first view update. | 30 | Fixed bug that the todo view flat mode was reset after first view update. |
26 | 31 | ||
27 | If a todo is displayed closed in the todo view, | 32 | If a todo is displayed closed in the todo view, |
28 | it is now displayed in overdue/due today color depending on the subtodos overdue/due today properties. | 33 | it is now displayed in overdue/due today color depending on the subtodos overdue/due today properties. |
29 | 34 | ||
30 | Added info about the numbers of years to the caption (title) information about a birthday event. | 35 | Added info about the numbers of years to the caption (title) information about a birthday event. |
31 | 36 | ||
32 | Made completion date in todo editor editable. | 37 | Made completion date in todo editor editable. |
33 | 38 | ||
34 | Added possibility to save/load templates for journals. | 39 | Added possibility to save/load templates for journals. |
35 | (Which is just a simple "save text to file" or "insert text from file". | 40 | (Which is just a simple "save text to file" or "insert text from file". |
36 | 41 | ||
37 | ********** VERSION 2.0.2 ************ | 42 | ********** VERSION 2.0.2 ************ |
38 | 43 | ||
39 | KO/Pi: | 44 | KO/Pi: |
40 | Fixed the layout problem of the day label buttons | 45 | Fixed the layout problem of the day label buttons |
41 | of the agenda view introduced in version 2.0.1. | 46 | of the agenda view introduced in version 2.0.1. |
42 | 47 | ||
43 | Added WhatsThis support for the todo view and the list view. | 48 | Added WhatsThis support for the todo view and the list view. |
44 | 49 | ||
45 | Added a quite useful feature to the montview. | 50 | Added a quite useful feature to the montview. |
46 | Just click on the week numbers on the left. | 51 | Just click on the week numbers on the left. |
47 | And in the top right corner of month view/agenda view | 52 | And in the top right corner of month view/agenda view |
48 | there is now a "week number quick selector". | 53 | there is now a "week number quick selector". |
49 | (Click on the black triangle). | 54 | (Click on the black triangle). |
50 | 55 | ||
51 | Made the quite difficult timezone change in KO/Pi easy. | 56 | Made the quite difficult timezone change in KO/Pi easy. |
52 | 57 | ||
53 | OM/Pi: | 58 | OM/Pi: |
54 | Fixed too small icons on desktop. | 59 | Fixed too small icons on desktop. |
55 | Fixed non visible icons in mainwindow on Z with fastload enabled. | 60 | Fixed non visible icons in mainwindow on Z with fastload enabled. |
56 | Added signature file setting to smtp account config. | 61 | Added signature file setting to smtp account config. |
57 | And the signature can be edited and saved in the edit mail dialog. | 62 | And the signature can be edited and saved in the edit mail dialog. |
58 | That does mean: | 63 | That does mean: |
59 | Simply edit the signature for the selected smtp account in the | 64 | Simply edit the signature for the selected smtp account in the |
60 | edit new mail dialog and press the "save signature" button there. | 65 | edit new mail dialog and press the "save signature" button there. |
61 | Then the signature is saved to the file specified in the smtp account settings. | 66 | Then the signature is saved to the file specified in the smtp account settings. |
62 | If there is no file specified, it is saved automatically to the file | 67 | If there is no file specified, it is saved automatically to the file |
63 | kdepim/apps/kopiemail/<accountname>.sig. | 68 | kdepim/apps/kopiemail/<accountname>.sig. |
64 | 69 | ||
65 | 70 | ||
66 | 71 | ||
67 | ********** VERSION 2.0.1 ************ | 72 | ********** VERSION 2.0.1 ************ |
68 | 73 | ||
69 | Oooops ... I forgot to test on the Zaurus 5500 ... | 74 | Oooops ... I forgot to test on the Zaurus 5500 ... |
70 | 75 | ||
71 | Fixed many problems of new (english) strings (and german translations) | 76 | Fixed many problems of new (english) strings (and german translations) |
72 | introduced in the latest versions, where the text was not fitting on the | 77 | introduced in the latest versions, where the text was not fitting on the |
73 | 240x320 display of the Zaurus 5500. | 78 | 240x320 display of the Zaurus 5500. |
74 | 79 | ||
75 | KO/Pi: | 80 | KO/Pi: |
76 | Added a popup menu ( press pen and hold to get popup ) to the agenda view | 81 | Added a popup menu ( press pen and hold to get popup ) to the agenda view |
77 | with many useful items (add event/todo, show next week, two weeks, month, journal). | 82 | with many useful items (add event/todo, show next week, two weeks, month, journal). |
78 | 83 | ||
79 | Added items to the todolist popup menu for: | 84 | Added items to the todolist popup menu for: |
80 | Display all opened, all closed or all todos flat. | 85 | Display all opened, all closed or all todos flat. |
81 | The "flat" view makes is possible to sort all todos after ,e.g., prio or date. | 86 | The "flat" view makes is possible to sort all todos after ,e.g., prio or date. |
82 | Made the reparenting of todos on the desktop possible via Drag&Drop. | 87 | Made the reparenting of todos on the desktop possible via Drag&Drop. |
83 | Fixed several bugs in setting the completed datetime for todos. | 88 | Fixed several bugs in setting the completed datetime for todos. |
84 | Added info about completed datetime of todos to the todo viewer. | 89 | Added info about completed datetime of todos to the todo viewer. |
85 | Now displaying a completed todo (with completed datetime set) in the agenda view | 90 | Now displaying a completed todo (with completed datetime set) in the agenda view |
86 | at the time of the completion. Such that now it is possible to see in the agenda view | 91 | at the time of the completion. Such that now it is possible to see in the agenda view |
87 | when what todo was completed. | 92 | when what todo was completed. |
88 | Fixed behaviour of automatic setting completion of todos with sub-todos/parent todos. | 93 | Fixed behaviour of automatic setting completion of todos with sub-todos/parent todos. |
89 | Now the behaviour is: | 94 | Now the behaviour is: |
90 | Setting a parent to complete sets all (sub)childs to complete. | 95 | Setting a parent to complete sets all (sub)childs to complete. |
91 | Setting a parent to uncomplete does not change the childs. | 96 | Setting a parent to uncomplete does not change the childs. |
92 | Setting a child to uncomplete sets all parent to uncomplete. | 97 | Setting a child to uncomplete sets all parent to uncomplete. |
93 | Setting a child to complete does not change the parents. | 98 | Setting a child to complete does not change the parents. |
94 | 99 | ||
95 | Smart updating and double buffering of the daymatrix. | 100 | Smart updating and double buffering of the daymatrix. |
96 | Showing holidays in the day matrix. | 101 | Showing holidays in the day matrix. |
97 | Many other small performance updates. | 102 | Many other small performance updates. |
98 | 103 | ||
99 | Made day labels in agenda clickable. By clicking a label, the day is displayed in single day mode. | 104 | Made day labels in agenda clickable. By clicking a label, the day is displayed in single day mode. |
100 | 105 | ||
101 | Now the translation file usertranslation.txt is supposed to be in utf8 format. | 106 | Now the translation file usertranslation.txt is supposed to be in utf8 format. |
102 | 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. | 107 | 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. |
103 | 108 | ||
104 | 109 | ||
105 | ********** VERSION 2.0.0 ************ | 110 | ********** VERSION 2.0.0 ************ |
106 | 111 | ||
107 | Stable release 2.0.0! | 112 | Stable release 2.0.0! |
108 | 113 | ||
109 | KO/Pi: | 114 | KO/Pi: |
110 | Fixed problem in edit dialog recreation at startup. | 115 | Fixed problem in edit dialog recreation at startup. |
111 | Made "toggle view*" menu items enabled context sensitive. | 116 | Made "toggle view*" menu items enabled context sensitive. |
112 | Changed agenda size menu to items 1-10. | 117 | Changed agenda size menu to items 1-10. |
113 | Made it possible to change agenda size quickly by pressing mouse on timelabels in agenda view and move mouse up/down. | 118 | Made it possible to change agenda size quickly by pressing mouse on timelabels in agenda view and move mouse up/down. |
114 | Usebility enhancements in the KO/Pi menus. | 119 | Usebility enhancements in the KO/Pi menus. |
115 | Birthday import now adds year to summary. | 120 | Birthday import now adds year to summary. |
116 | What's Next view shows age in years for birthday. | 121 | What's Next view shows age in years for birthday. |
117 | 122 | ||
118 | OM/Pi: | 123 | OM/Pi: |
119 | Added three info lines to display subject, from and to of selected mails. | 124 | Added three info lines to display subject, from and to of selected mails. |
120 | 125 | ||
121 | KA/Pi: | 126 | KA/Pi: |
122 | Fixed jump bar behaviour on Zaurus. | 127 | Fixed jump bar behaviour on Zaurus. |
123 | Now KA/Pi search field supports searching for a range of starting characters. | 128 | Now KA/Pi search field supports searching for a range of starting characters. |
124 | E.g. to search for all contact beginning with b to n, type | 129 | E.g. to search for all contact beginning with b to n, type |
125 | b-n | 130 | b-n |
126 | in the search field. | 131 | in the search field. |
127 | 132 | ||
128 | ********** VERSION 1.9.20 ************ | 133 | ********** VERSION 1.9.20 ************ |
129 | 134 | ||
130 | KO/Pi: | 135 | KO/Pi: |
131 | Added for the "dislplay one day" agenda mode | 136 | Added for the "dislplay one day" agenda mode |
132 | info in the caption and in the day lables: | 137 | info in the caption and in the day lables: |
133 | Now it is displayed, if the selected day is from "day before yesterday" | 138 | Now it is displayed, if the selected day is from "day before yesterday" |
134 | to "day after tomorrow". | 139 | to "day after tomorrow". |
135 | Made it possible to delete a Todo, which has sub-todos. | 140 | Made it possible to delete a Todo, which has sub-todos. |
136 | Fixed two small problems in the todo view. | 141 | Fixed two small problems in the todo view. |
137 | Added missing German translation for filter edit and print dialog. | 142 | Added missing German translation for filter edit and print dialog. |
138 | Made search dialog closeable by cancel key. | 143 | Made search dialog closeable by cancel key. |
139 | 144 | ||
140 | Made it possible to select in the date picker the (ligt grey ) | 145 | Made it possible to select in the date picker the (ligt grey ) |
141 | dates of the prev./next month with the mouse. | 146 | dates of the prev./next month with the mouse. |
142 | 147 | ||
143 | OM/Pi: | 148 | OM/Pi: |
144 | "Delete mail" icon in main window now deletes all selected mails. | 149 | "Delete mail" icon in main window now deletes all selected mails. |
145 | Fixed the problem, that the state flag of imap mails was ignored. | 150 | Fixed the problem, that the state flag of imap mails was ignored. |
146 | Now mails with "FLAG_SEEN" on the imap server get no icon in the list view | 151 | Now mails with "FLAG_SEEN" on the imap server get no icon in the list view |
147 | to indecate that they are already seen. | 152 | to indecate that they are already seen. |
148 | Fixed the problem that the body of some mails was not displayed in the | 153 | Fixed the problem that the body of some mails was not displayed in the |
149 | mail viewer when fetching them from the imap server directly to read them. | 154 | mail viewer when fetching them from the imap server directly to read them. |
150 | Made it (configurable) possible to show the "To:" field in the list view. | 155 | Made it (configurable) possible to show the "To:" field in the list view. |
151 | Added to the mail viewer the option "View Source" to make it possible to see the raw mail data. | 156 | Added to the mail viewer the option "View Source" to make it possible to see the raw mail data. |
152 | Added a "Download Mail" button to the mail viewer to quickly download the viewed mail to the | 157 | Added a "Download Mail" button to the mail viewer to quickly download the viewed mail to the |
153 | local storage folder (specified in account settings) of the account of the mail. | 158 | local storage folder (specified in account settings) of the account of the mail. |
154 | Removed some memory leaks in OM/Pi. | 159 | Removed some memory leaks in OM/Pi. |
155 | 160 | ||
156 | 161 | ||
157 | ********** VERSION 1.9.19 ************ | 162 | ********** VERSION 1.9.19 ************ |
158 | 163 | ||
159 | Added a lot of missing translations to KA/Pi, | 164 | Added a lot of missing translations to KA/Pi, |
160 | Added some missing translations to KO/Pi and OM/Pi. | 165 | Added some missing translations to KO/Pi and OM/Pi. |
161 | 166 | ||
162 | Fixed some minor problems in KA/Pi + KO/Pi. | 167 | Fixed some minor problems in KA/Pi + KO/Pi. |
163 | 168 | ||
164 | Fixed a crash when closing PwM/Pi. | 169 | Fixed a crash when closing PwM/Pi. |
165 | Added German translation for PwM/Pi. | 170 | Added German translation for PwM/Pi. |
166 | 171 | ||
167 | Made view change and Month View update faster in KO/Pi. | 172 | Made view change and Month View update faster in KO/Pi. |
168 | 173 | ||
169 | 174 | ||
170 | ********** VERSION 1.9.18 ************ | 175 | ********** VERSION 1.9.18 ************ |
171 | 176 | ||
172 | FYI: The VERSION 1.9.17 was a testing release only. | 177 | FYI: The VERSION 1.9.17 was a testing release only. |
173 | Please read the changelog of VERSION 1.9.17 as well. | 178 | Please read the changelog of VERSION 1.9.17 as well. |
174 | 179 | ||
175 | Cleaned up the syncing config dialog. | 180 | Cleaned up the syncing config dialog. |
176 | Added sync config options for date range for events. | 181 | Added sync config options for date range for events. |
177 | Added sync config options for filters on incoming data. | 182 | Added sync config options for filters on incoming data. |
178 | Added sync config options for filters on outgoing data. | 183 | Added sync config options for filters on outgoing data. |
179 | Please read the updated SyncHowTo about the new filter settings. | 184 | Please read the updated SyncHowTo about the new filter settings. |
180 | These filter settings make it now possible to sync with shared | 185 | These filter settings make it now possible to sync with shared |
181 | calendars without writing back private or confidential data | 186 | calendars without writing back private or confidential data |
182 | (via the outgoing filters). | 187 | (via the outgoing filters). |
183 | To sync only with particular parts of a shared calendar, | 188 | To sync only with particular parts of a shared calendar, |
184 | the incoming filter settings can be used. | 189 | the incoming filter settings can be used. |
185 | An example can be found in the SyncHowTo. | 190 | An example can be found in the SyncHowTo. |
186 | Same for shared addressbooks. | 191 | Same for shared addressbooks. |
187 | 192 | ||
188 | Added a setting for the global kdepim data storage. | 193 | Added a setting for the global kdepim data storage. |
189 | Usually the data is stored in (yourhomedir/kdepim). | 194 | Usually the data is stored in (yourhomedir/kdepim). |
190 | Now you can set in the Global config dialog TAB, subTAB "Data storage path" | 195 | Now you can set in the Global config dialog TAB, subTAB "Data storage path" |
191 | a directory where all the kdepim data is stored. | 196 | a directory where all the kdepim data is stored. |
192 | That makes it easy to save all kdepim data on a SD card on the Z, for example. | 197 | That makes it easy to save all kdepim data on a SD card on the Z, for example. |
193 | 198 | ||
194 | KO/Pi: | 199 | KO/Pi: |
195 | The timeedit input has a pulldown list for times. | 200 | The timeedit input has a pulldown list for times. |
196 | If opened, this pulldown list should now has the right time highlighted. | 201 | If opened, this pulldown list should now has the right time highlighted. |
197 | Added the possibility to exclude events/todos/journals in a filter. | 202 | Added the possibility to exclude events/todos/journals in a filter. |
198 | You should exclude journals, if you do not want them to sync with a public calendar. | 203 | You should exclude journals, if you do not want them to sync with a public calendar. |
199 | 204 | ||
200 | KA/Pi: | 205 | KA/Pi: |
201 | Added the possibility to in/exclude public/private/confidential contacts to a filter. | 206 | Added the possibility to in/exclude public/private/confidential contacts to a filter. |
202 | 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 ... | 207 | 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 ... |
203 | Added printing of card view and details view on desktop. | 208 | Added printing of card view and details view on desktop. |
204 | Printing of list view is not working... | 209 | Printing of list view is not working... |
205 | Added button for removing pictures in contact editor. | 210 | Added button for removing pictures in contact editor. |
206 | Parsing data fix of KA/Pi version 1.9.17. | 211 | Parsing data fix of KA/Pi version 1.9.17. |
207 | Fixed the "parse name automatically" problem of KA/Pi version 1.9.17. | 212 | Fixed the "parse name automatically" problem of KA/Pi version 1.9.17. |
208 | Fixed some syncing merging problems. | 213 | Fixed some syncing merging problems. |
209 | 214 | ||
210 | 215 | ||
211 | ********** VERSION 1.9.17 ************ | 216 | ********** VERSION 1.9.17 ************ |
212 | 217 | ||
213 | KO/Pi: | 218 | KO/Pi: |
214 | Fixed that tooltips were not updated after moving an item in agenda view. | 219 | Fixed that tooltips were not updated after moving an item in agenda view. |
215 | Fixed a bug in sorting start date for recurring events in list view. | 220 | Fixed a bug in sorting start date for recurring events in list view. |
216 | Changed the left button in todo viewer from "Agenda" to "Set completed". | 221 | Changed the left button in todo viewer from "Agenda" to "Set completed". |
217 | 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. | 222 | 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. |
218 | Added more info in the todo viewer: Startdate, parent/sub todos. | 223 | Added more info in the todo viewer: Startdate, parent/sub todos. |
219 | 224 | ||
220 | 225 | ||
221 | KA/Pi: | 226 | KA/Pi: |
222 | All fields search does now actually search all the (possible) fields, | 227 | All fields search does now actually search all the (possible) fields, |
223 | not only those listed in the contact list. | 228 | not only those listed in the contact list. |
224 | Made is possible to inline a picture in a vcard on the Z. | 229 | Made is possible to inline a picture in a vcard on the Z. |
225 | This was only possible on the desktop, now is it possible on the Z as well. | 230 | This was only possible on the desktop, now is it possible on the Z as well. |
226 | Fixed of missing save settings after filter configuration. | 231 | Fixed of missing save settings after filter configuration. |
227 | Made saving of addressbook much faster. | 232 | Made saving of addressbook much faster. |
228 | Fixed extension widget layout problem. | 233 | Fixed extension widget layout problem. |
229 | Fixed saving of default formatted name settings. | 234 | Fixed saving of default formatted name settings. |
230 | Fixed formatted name handling in edit dialog. | 235 | Fixed formatted name handling in edit dialog. |
231 | Added an option for changing formatted names of many contacts | 236 | Added an option for changing formatted names of many contacts |
232 | (menu: File - Change - Set formatted name). | 237 | (menu: File - Change - Set formatted name). |
233 | 238 | ||
234 | QWhatsThis was not working on the Z ( only black rectangle was shown). | 239 | QWhatsThis was not working on the Z ( only black rectangle was shown). |
235 | This is Fixed. | 240 | This is Fixed. |
236 | 241 | ||
237 | KDE-Sync: | 242 | KDE-Sync: |
238 | Now readonly KDE resources are synced as well. | 243 | Now readonly KDE resources are synced as well. |
239 | (They are not changed in KDE itself, of course). | 244 | (They are not changed in KDE itself, of course). |
240 | 245 | ||
241 | 246 | ||
242 | 247 | ||
243 | ********** VERSION 1.9.16 ************ | 248 | ********** VERSION 1.9.16 ************ |
244 | 249 | ||
245 | KO/Pi: | 250 | KO/Pi: |
246 | Fixed search dialog size on Z 6000 (480x640 display). | 251 | Fixed search dialog size on Z 6000 (480x640 display). |
247 | Added setting to hide/show time in agenda items. | 252 | Added setting to hide/show time in agenda items. |
248 | Added setting to hide not running todos in todo view. | 253 | Added setting to hide not running todos in todo view. |
249 | Added columns for start date/time in todo view. | 254 | Added columns for start date/time in todo view. |
250 | Replaced the solid half-hour lines in agenda view by dot lines. | 255 | Replaced the solid half-hour lines in agenda view by dot lines. |
251 | Added possibility of printing the What's Next View on the desktop | 256 | Added possibility of printing the What's Next View on the desktop |
252 | (i.e. Windows and Linux). | 257 | (i.e. Windows and Linux). |
253 | Fixed a crash in KO/Pi when starting KO/Pi with What's Next view. | 258 | Fixed a crash in KO/Pi when starting KO/Pi with What's Next view. |
254 | Added tooltips in month view.(Tooltips only available on desktop) | 259 | Added tooltips in month view.(Tooltips only available on desktop) |
255 | 260 | ||
256 | Fixed a strange problem in KO/Pi alarm applet. | 261 | Fixed a strange problem in KO/Pi alarm applet. |
257 | Did not find the actual problem, | 262 | Did not find the actual problem, |
258 | such that now Qtopia reboots again if deinstalling the alarm applet. | 263 | such that now Qtopia reboots again if deinstalling the alarm applet. |
259 | But the alarm applet should work again. | 264 | But the alarm applet should work again. |
260 | 265 | ||
261 | KA/Pi: | 266 | KA/Pi: |
262 | Fixed the problem, that internal pictures were not saved. | 267 | Fixed the problem, that internal pictures were not saved. |
263 | 268 | ||
264 | Fixed a problem in the pi-sync mode by increasing the timeout for data transfer from 20 seconds to 5 minutes. | 269 | Fixed a problem in the pi-sync mode by increasing the timeout for data transfer from 20 seconds to 5 minutes. |
265 | 270 | ||
266 | Fixed some minor problems. (Like word wrap in help text windows). | 271 | Fixed some minor problems. (Like word wrap in help text windows). |
267 | 272 | ||
268 | Fixed a compiling problem in microkde/kresources. | 273 | Fixed a compiling problem in microkde/kresources. |
269 | 274 | ||
270 | KO/Pi is using zdbat (renamed to db2file) for syncing with Sharp DTM. | 275 | KO/Pi is using zdbat (renamed to db2file) for syncing with Sharp DTM. |
271 | This version now includes zdbat 1.0.0 (old version was zdbat 0.2.9) | 276 | This version now includes zdbat 1.0.0 (old version was zdbat 0.2.9) |
272 | such that now syncing KO/Pi with Sharp DTM should work on the | 277 | such that now syncing KO/Pi with Sharp DTM should work on the |
273 | Zaurus C 3000 model. | 278 | Zaurus C 3000 model. |
274 | 279 | ||
275 | ********** VERSION 1.9.15 ************ | 280 | ********** VERSION 1.9.15 ************ |
276 | 281 | ||
277 | Usebilty enhancements in KO/Pi: | 282 | Usebilty enhancements in KO/Pi: |
278 | When clicking on the date in a month view cell, the day view is shown. | 283 | When clicking on the date in a month view cell, the day view is shown. |
279 | Old behaviour was, that the "new event" dialog popped up. | 284 | Old behaviour was, that the "new event" dialog popped up. |
280 | 285 | ||
281 | Added a one step "undo delete" in KO/Pi (Accessable in the "Action" menu). | 286 | Added a one step "undo delete" in KO/Pi (Accessable in the "Action" menu). |
282 | That means, you can restore the latest | 287 | That means, you can restore the latest |
283 | event/todo/journal you have deleted. | 288 | event/todo/journal you have deleted. |
284 | A journal is deleted, if you clear all the text of the journal. | 289 | A journal is deleted, if you clear all the text of the journal. |
285 | 290 | ||
286 | Fixed the bug of the editor dialogs in KO/Pi of version 1.9.14. | 291 | Fixed the bug of the editor dialogs in KO/Pi of version 1.9.14. |
287 | 292 | ||
288 | KA/Pi starting in 480x640 resolution: | 293 | KA/Pi starting in 480x640 resolution: |
289 | Hide the filter action in toolbar | 294 | Hide the filter action in toolbar |
290 | and added icons for undo/delete/redo in toolbar. | 295 | and added icons for undo/delete/redo in toolbar. |
291 | 296 | ||
292 | Change in OM/Pi ViewMail dialog: | 297 | Change in OM/Pi ViewMail dialog: |
293 | When clicking on the "delete" icon the mail is deleted after confirmation as usual. | 298 | When clicking on the "delete" icon the mail is deleted after confirmation as usual. |
294 | But the edit dialog is not closed as before, now the next mail in the folder is shown automatically (if there is any). | 299 | But the edit dialog is not closed as before, now the next mail in the folder is shown automatically (if there is any). |
295 | 300 | ||
296 | Fixed a crash when deleting mail-accounts in OM/Pi. | 301 | Fixed a crash when deleting mail-accounts in OM/Pi. |
297 | 302 | ||
298 | 303 | ||
299 | ********** VERSION 1.9.14 ************ | 304 | ********** VERSION 1.9.14 ************ |
300 | 305 | ||
301 | Fixed some problems with the dialog sizes when switching | 306 | Fixed some problems with the dialog sizes when switching |
302 | portrait/landscape mode on 640x480 PDA display. | 307 | portrait/landscape mode on 640x480 PDA display. |
303 | 308 | ||
304 | Fixed some other small bugs in KA/Pi KO/Pi and OM/Pi and PwM/Pi. | 309 | Fixed some other small bugs in KA/Pi KO/Pi and OM/Pi and PwM/Pi. |
305 | 310 | ||
306 | Fixed an ugly bug in KOpieMail: | 311 | Fixed an ugly bug in KOpieMail: |
307 | KOpieMail was not able to write files (mails) to MSDOS file system, | 312 | KOpieMail was not able to write files (mails) to MSDOS file system, |
308 | like on an usual preformatted SD card. That should work now. | 313 | like on an usual preformatted SD card. That should work now. |
309 | To save your mail data on the Sd card do the following: | 314 | To save your mail data on the Sd card do the following: |
310 | Create a dir on the SD card: | 315 | Create a dir on the SD card: |
311 | mkdir /mnt/card/localmail | 316 | mkdir /mnt/card/localmail |
312 | Go to your home dir: | 317 | Go to your home dir: |
313 | cd | 318 | cd |
314 | Go to kopiemail data storage dir: | 319 | Go to kopiemail data storage dir: |
315 | cd kdepim/apps/kopiemail | 320 | cd kdepim/apps/kopiemail |
316 | Create a symlink to the SD card: | 321 | Create a symlink to the SD card: |
317 | ls -s /mnt/card/localmail | 322 | ls -s /mnt/card/localmail |
318 | Now KOpieMail will store all mails on the SD card. | 323 | Now KOpieMail will store all mails on the SD card. |
319 | 324 | ||
320 | KO/Pi Monthview: | 325 | KO/Pi Monthview: |
321 | Now "Go to Today" selects the current month from day 1-end, | 326 | Now "Go to Today" selects the current month from day 1-end, |
322 | not the current date + some days. | 327 | not the current date + some days. |
323 | I.e. "Go to Today" shows now always | 328 | I.e. "Go to Today" shows now always |
324 | the current month with first day of month in the first row. | 329 | the current month with first day of month in the first row. |
325 | 330 | ||
326 | Added missing German translation. | 331 | Added missing German translation. |
327 | 332 | ||
328 | Fixed icons of executeable on Wintendo. | 333 | Fixed icons of executeable on Wintendo. |
329 | 334 | ||
330 | Added a "Show next Mail" button to the OM/Pi | 335 | Added a "Show next Mail" button to the OM/Pi |
331 | mail viewer such that the mail below the current mail | 336 | mail viewer such that the mail below the current mail |
332 | in the mail list view of the current folder | 337 | in the mail list view of the current folder |
333 | can be read with a single click. | 338 | can be read with a single click. |
334 | 339 | ||
335 | 340 | ||
336 | ********** VERSION 1.9.13 ************ | 341 | ********** VERSION 1.9.13 ************ |
337 | 342 | ||
338 | Fixed nasty PwM/Pi file reading bug, when | 343 | Fixed nasty PwM/Pi file reading bug, when |
339 | the used hash algo of file is different then the global | 344 | the used hash algo of file is different then the global |
340 | hash algo. | 345 | hash algo. |
341 | 346 | ||
342 | Added KA/Pi support for opie mailit mailapplication. | 347 | Added KA/Pi support for opie mailit mailapplication. |
343 | 348 | ||
344 | Fixed some bugs in OM/Pi. | 349 | Fixed some bugs in OM/Pi. |
345 | Now character conversion tables are available for the Zaurus | 350 | Now character conversion tables are available for the Zaurus |
346 | to make OM/Pi working properly. | 351 | to make OM/Pi working properly. |
347 | To get the character conversion in OM/Pi working, please download | 352 | To get the character conversion in OM/Pi working, please download |
348 | at the sourceforge project site the package | 353 | at the sourceforge project site the package |
349 | sr-character-conversion_SharpROM_arm.ipk.zip | 354 | sr-character-conversion_SharpROM_arm.ipk.zip |
350 | (or oz-character-conversion_OZ-gcc3xx_arm.ipk.zip for OZ roms) | 355 | (or oz-character-conversion_OZ-gcc3xx_arm.ipk.zip for OZ roms) |
351 | from the section "general files for KDE/Pim" | 356 | from the section "general files for KDE/Pim" |
352 | Instructions how to install this package are in a ReadMe in this file. | 357 | Instructions how to install this package are in a ReadMe in this file. |
353 | 358 | ||
354 | 359 | ||
355 | Fixed the orientation change problem in KA/Pi when switching | 360 | Fixed the orientation change problem in KA/Pi when switching |
356 | portrait/landscape mode. | 361 | portrait/landscape mode. |
357 | 362 | ||
358 | French translation available for KA/Pi and OM/Pi. | 363 | French translation available for KA/Pi and OM/Pi. |
359 | 364 | ||
360 | Fixed some problems with categories in KO/Pi in DTM sync. | 365 | Fixed some problems with categories in KO/Pi in DTM sync. |
361 | 366 | ||
362 | Added selection dialog for export to phone in KA/Pi. | 367 | Added selection dialog for export to phone in KA/Pi. |
363 | 368 | ||
364 | If in KO/Pi is an attendee selected to add to a meeting and this | 369 | If in KO/Pi is an attendee selected to add to a meeting and this |
365 | attendee is already in the list of attendees, this person is not added | 370 | attendee is already in the list of attendees, this person is not added |
366 | again. | 371 | again. |
367 | 372 | ||
368 | Some menu cleanup in KA/Pi. | 373 | Some menu cleanup in KA/Pi. |
369 | 374 | ||
370 | ********** VERSION 1.9.12 ************ | 375 | ********** VERSION 1.9.12 ************ |
371 | 376 | ||
372 | Fix for the bug in KO/Pi What's Next view of version 1.9.11. | 377 | Fix for the bug in KO/Pi What's Next view of version 1.9.11. |
373 | 378 | ||
374 | Bugfix: Licence file is now shown again. | 379 | Bugfix: Licence file is now shown again. |
375 | 380 | ||
376 | OM/Pi now supports Unicode (utf8 charset). | 381 | OM/Pi now supports Unicode (utf8 charset). |
377 | Fixed some bugs in OM/Pi. | 382 | Fixed some bugs in OM/Pi. |
378 | 383 | ||
379 | KA/Pi has more German translation. | 384 | KA/Pi has more German translation. |
380 | 385 | ||
381 | 386 | ||
382 | ********** VERSION 1.9.11 ************ | 387 | ********** VERSION 1.9.11 ************ |
383 | 388 | ||
384 | Fixed several problems in PWM/Pi, like | 389 | Fixed several problems in PWM/Pi, like |
385 | asking the user, if unsaved changed are pending | 390 | asking the user, if unsaved changed are pending |
386 | when closing the app. | 391 | when closing the app. |
387 | And PwM/Pi handles now different texts for the | 392 | And PwM/Pi handles now different texts for the |
388 | fields Description, Username, Password, configurable per category. | 393 | fields Description, Username, Password, configurable per category. |
389 | 394 | ||
390 | Fixed a crash in KO/Pi , when importing/loading vcs files | 395 | Fixed a crash in KO/Pi , when importing/loading vcs files |
391 | which have an entry with an attendee with state: | 396 | which have an entry with an attendee with state: |
diff --git a/korganizer/koeditorgeneraltodo.cpp b/korganizer/koeditorgeneraltodo.cpp index ce66863..da5ef07 100644 --- a/korganizer/koeditorgeneraltodo.cpp +++ b/korganizer/koeditorgeneraltodo.cpp | |||
@@ -1,495 +1,495 @@ | |||
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 <qtooltip.h> | 24 | #include <qtooltip.h> |
25 | #include <qfiledialog.h> | 25 | #include <qfiledialog.h> |
26 | #include <qlayout.h> | 26 | #include <qlayout.h> |
27 | #include <qvbox.h> | 27 | #include <qvbox.h> |
28 | #include <qbuttongroup.h> | 28 | #include <qbuttongroup.h> |
29 | #include <qvgroupbox.h> | 29 | #include <qvgroupbox.h> |
30 | #include <qwidgetstack.h> | 30 | #include <qwidgetstack.h> |
31 | #include <qdatetime.h> | 31 | #include <qdatetime.h> |
32 | #include <qapplication.h> | 32 | #include <qapplication.h> |
33 | 33 | ||
34 | #include <kglobal.h> | 34 | #include <kglobal.h> |
35 | #include <klocale.h> | 35 | #include <klocale.h> |
36 | #include <kiconloader.h> | 36 | #include <kiconloader.h> |
37 | #include <kmessagebox.h> | 37 | #include <kmessagebox.h> |
38 | #include <kdebug.h> | 38 | #include <kdebug.h> |
39 | #include <krestrictedline.h> | 39 | #include <krestrictedline.h> |
40 | #include <kstandarddirs.h> | 40 | #include <kstandarddirs.h> |
41 | #include <kfiledialog.h> | 41 | #include <kfiledialog.h> |
42 | 42 | ||
43 | #include <libkcal/todo.h> | 43 | #include <libkcal/todo.h> |
44 | 44 | ||
45 | #include <libkdepim/kdateedit.h> | 45 | #include <libkdepim/kdateedit.h> |
46 | 46 | ||
47 | #include "koprefs.h" | 47 | #include "koprefs.h" |
48 | #include "ktimeedit.h" | 48 | #include "ktimeedit.h" |
49 | 49 | ||
50 | #include "koeditorgeneraltodo.h" | 50 | #include "koeditorgeneraltodo.h" |
51 | #include "kolocationbox.h" | 51 | #include "kolocationbox.h" |
52 | 52 | ||
53 | KOEditorGeneralTodo::KOEditorGeneralTodo(QObject* parent, | 53 | KOEditorGeneralTodo::KOEditorGeneralTodo(QObject* parent, |
54 | const char* name) | 54 | const char* name) |
55 | : KOEditorGeneral( parent, name) | 55 | : KOEditorGeneral( parent, name) |
56 | { | 56 | { |
57 | } | 57 | } |
58 | 58 | ||
59 | KOEditorGeneralTodo::~KOEditorGeneralTodo() | 59 | KOEditorGeneralTodo::~KOEditorGeneralTodo() |
60 | { | 60 | { |
61 | } | 61 | } |
62 | 62 | ||
63 | void KOEditorGeneralTodo::finishSetup() | 63 | void KOEditorGeneralTodo::finishSetup() |
64 | { | 64 | { |
65 | 65 | ||
66 | // QWidget::setTabOrder(mSummaryEdit, mLocationEdit); | 66 | // QWidget::setTabOrder(mSummaryEdit, mLocationEdit); |
67 | // QWidget::setTabOrder(mLocationEdit, mDueCheck); | 67 | // QWidget::setTabOrder(mLocationEdit, mDueCheck); |
68 | // QWidget::setTabOrder(mDueCheck, mDueDateEdit); | 68 | // QWidget::setTabOrder(mDueCheck, mDueDateEdit); |
69 | // QWidget::setTabOrder(mDueDateEdit, mDueTimeEdit); | 69 | // QWidget::setTabOrder(mDueDateEdit, mDueTimeEdit); |
70 | // QWidget::setTabOrder(mDueTimeEdit, mStartCheck); | 70 | // QWidget::setTabOrder(mDueTimeEdit, mStartCheck); |
71 | // QWidget::setTabOrder(mStartCheck, mStartDateEdit); | 71 | // QWidget::setTabOrder(mStartCheck, mStartDateEdit); |
72 | // QWidget::setTabOrder(mStartDateEdit, mStartTimeEdit); | 72 | // QWidget::setTabOrder(mStartDateEdit, mStartTimeEdit); |
73 | // QWidget::setTabOrder(mStartTimeEdit, mTimeButton); | 73 | // QWidget::setTabOrder(mStartTimeEdit, mTimeButton); |
74 | // QWidget::setTabOrder(mTimeButton, mCompletedCombo); | 74 | // QWidget::setTabOrder(mTimeButton, mCompletedCombo); |
75 | // QWidget::setTabOrder(mCompletedCombo, mPriorityCombo); | 75 | // QWidget::setTabOrder(mCompletedCombo, mPriorityCombo); |
76 | // QWidget::setTabOrder(mPriorityCombo, mAlarmButton); | 76 | // QWidget::setTabOrder(mPriorityCombo, mAlarmButton); |
77 | // QWidget::setTabOrder(mAlarmButton, mCategoriesButton); | 77 | // QWidget::setTabOrder(mAlarmButton, mCategoriesButton); |
78 | // QWidget::setTabOrder(mCategoriesButton, mSecrecyCombo); | 78 | // QWidget::setTabOrder(mCategoriesButton, mSecrecyCombo); |
79 | // QWidget::setTabOrder(mSecrecyCombo, mDescriptionEdit); | 79 | // QWidget::setTabOrder(mSecrecyCombo, mDescriptionEdit); |
80 | mSummaryEdit->load(KOLocationBox::SUMMARYTODO); | 80 | mSummaryEdit->load(KOLocationBox::SUMMARYTODO); |
81 | mSummaryEdit->setFocus(); | 81 | mSummaryEdit->setFocus(); |
82 | } | 82 | } |
83 | 83 | ||
84 | void KOEditorGeneralTodo::initTime(QWidget *parent,QBoxLayout *topLayout) | 84 | void KOEditorGeneralTodo::initTime(QWidget *parent,QBoxLayout *topLayout) |
85 | { | 85 | { |
86 | QBoxLayout *timeLayout = new QVBoxLayout(topLayout); | 86 | QBoxLayout *timeLayout = new QVBoxLayout(topLayout); |
87 | 87 | ||
88 | QGroupBox *timeGroupBox = new QGroupBox(1,QGroupBox::Horizontal, | 88 | QGroupBox *timeGroupBox = new QGroupBox(1,QGroupBox::Horizontal, |
89 | i18n("Date && Time"),parent); | 89 | i18n("Date && Time"),parent); |
90 | timeLayout->addWidget(timeGroupBox); | 90 | timeLayout->addWidget(timeGroupBox); |
91 | timeGroupBox->layout()->setSpacing( 0 ); | 91 | timeGroupBox->layout()->setSpacing( 0 ); |
92 | timeGroupBox->layout()->setMargin( 5 ); | 92 | timeGroupBox->layout()->setMargin( 5 ); |
93 | QFrame *timeBoxFrame = new QFrame(timeGroupBox); | 93 | QFrame *timeBoxFrame = new QFrame(timeGroupBox); |
94 | 94 | ||
95 | QGridLayout *layoutTimeBox = new QGridLayout(timeBoxFrame,3,3); | 95 | QGridLayout *layoutTimeBox = new QGridLayout(timeBoxFrame,3,3); |
96 | layoutTimeBox->setSpacing(topLayout->spacing()); | 96 | layoutTimeBox->setSpacing(topLayout->spacing()); |
97 | layoutTimeBox->setColStretch( 1, 1 ); | 97 | layoutTimeBox->setColStretch( 1, 1 ); |
98 | 98 | ||
99 | mDueCheck = new QCheckBox(i18n("Due:"),timeBoxFrame); | 99 | mDueCheck = new QCheckBox(i18n("Due:"),timeBoxFrame); |
100 | layoutTimeBox->addWidget(mDueCheck,0,0); | 100 | layoutTimeBox->addWidget(mDueCheck,0,0); |
101 | connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(enableDueEdit(bool))); | 101 | connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(enableDueEdit(bool))); |
102 | connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(showAlarm())); | 102 | connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(showAlarm())); |
103 | 103 | ||
104 | 104 | ||
105 | mDueDateEdit = new KDateEdit(timeBoxFrame); | 105 | mDueDateEdit = new KDateEdit(timeBoxFrame); |
106 | layoutTimeBox->addWidget(mDueDateEdit,0,1); | 106 | layoutTimeBox->addWidget(mDueDateEdit,0,1); |
107 | 107 | ||
108 | mDueTimeEdit = new KOTimeEdit(timeBoxFrame); | 108 | mDueTimeEdit = new KOTimeEdit(timeBoxFrame); |
109 | layoutTimeBox->addWidget(mDueTimeEdit,0,2); | 109 | layoutTimeBox->addWidget(mDueTimeEdit,0,2); |
110 | 110 | ||
111 | 111 | ||
112 | mStartCheck = new QCheckBox(i18n("Start:"),timeBoxFrame); | 112 | mStartCheck = new QCheckBox(i18n("Start:"),timeBoxFrame); |
113 | layoutTimeBox->addWidget(mStartCheck,1,0); | 113 | layoutTimeBox->addWidget(mStartCheck,1,0); |
114 | connect(mStartCheck,SIGNAL(toggled(bool)),SLOT(enableStartEdit(bool))); | 114 | connect(mStartCheck,SIGNAL(toggled(bool)),SLOT(enableStartEdit(bool))); |
115 | 115 | ||
116 | mStartDateEdit = new KDateEdit(timeBoxFrame); | 116 | mStartDateEdit = new KDateEdit(timeBoxFrame); |
117 | layoutTimeBox->addWidget(mStartDateEdit,1,1); | 117 | layoutTimeBox->addWidget(mStartDateEdit,1,1); |
118 | 118 | ||
119 | mStartTimeEdit = new KOTimeEdit(timeBoxFrame); | 119 | mStartTimeEdit = new KOTimeEdit(timeBoxFrame); |
120 | layoutTimeBox->addWidget(mStartTimeEdit,1,2); | 120 | layoutTimeBox->addWidget(mStartTimeEdit,1,2); |
121 | 121 | ||
122 | 122 | ||
123 | mTimeButton = new QCheckBox(i18n("Time associated"),timeBoxFrame); | 123 | mTimeButton = new QCheckBox(i18n("Time associated"),timeBoxFrame); |
124 | layoutTimeBox->addMultiCellWidget(mTimeButton,2,2,0,1); | 124 | layoutTimeBox->addMultiCellWidget(mTimeButton,2,2,0,1); |
125 | 125 | ||
126 | connect(mTimeButton,SIGNAL(toggled(bool)),SLOT(enableTimeEdits(bool))); | 126 | connect(mTimeButton,SIGNAL(toggled(bool)),SLOT(enableTimeEdits(bool))); |
127 | 127 | ||
128 | // some more layouting | 128 | // some more layouting |
129 | //layoutTimeBox->setColStretch(3,1); | 129 | //layoutTimeBox->setColStretch(3,1); |
130 | } | 130 | } |
131 | 131 | ||
132 | 132 | ||
133 | void KOEditorGeneralTodo::initCompletion(QWidget *parent, QBoxLayout *topLayout) | 133 | void KOEditorGeneralTodo::initCompletion(QWidget *parent, QBoxLayout *topLayout) |
134 | { | 134 | { |
135 | mCompletedCombo = new QComboBox(parent); | 135 | mCompletedCombo = new QComboBox(parent); |
136 | // xgettext:no-c-format | 136 | // xgettext:no-c-format |
137 | mCompletedCombo->insertItem(i18n(" 0 %")); | 137 | mCompletedCombo->insertItem(i18n(" 0 %")); |
138 | // xgettext:no-c-format | 138 | // xgettext:no-c-format |
139 | mCompletedCombo->insertItem(i18n(" 20 %")); | 139 | mCompletedCombo->insertItem(i18n(" 20 %")); |
140 | // xgettext:no-c-format | 140 | // xgettext:no-c-format |
141 | mCompletedCombo->insertItem(i18n(" 40 %")); | 141 | mCompletedCombo->insertItem(i18n(" 40 %")); |
142 | // xgettext:no-c-format | 142 | // xgettext:no-c-format |
143 | mCompletedCombo->insertItem(i18n(" 60 %")); | 143 | mCompletedCombo->insertItem(i18n(" 60 %")); |
144 | // xgettext:no-c-format | 144 | // xgettext:no-c-format |
145 | mCompletedCombo->insertItem(i18n(" 80 %")); | 145 | mCompletedCombo->insertItem(i18n(" 80 %")); |
146 | // xgettext:no-c-format | 146 | // xgettext:no-c-format |
147 | mCompletedCombo->insertItem(i18n("100 %")); | 147 | mCompletedCombo->insertItem(i18n("100 %")); |
148 | connect(mCompletedCombo,SIGNAL(activated(int)),SLOT(completedChanged(int))); | 148 | connect(mCompletedCombo,SIGNAL(activated(int)),SLOT(completedChanged(int))); |
149 | topLayout->addWidget(mCompletedCombo); | 149 | topLayout->addWidget(mCompletedCombo); |
150 | 150 | ||
151 | mCompletedLabel = new QLabel(i18n("completed"),parent); | 151 | mCompletedLabel = new QLabel(i18n("completed"),parent); |
152 | topLayout->addWidget(mCompletedLabel); | 152 | topLayout->addWidget(mCompletedLabel); |
153 | 153 | ||
154 | mCompleteDateEdit = new KDateEdit(parent); | 154 | mCompleteDateEdit = new KDateEdit(parent); |
155 | topLayout->addWidget(mCompleteDateEdit ); | 155 | topLayout->addWidget(mCompleteDateEdit ); |
156 | 156 | ||
157 | mCompleteTimeEdit = new KOTimeEdit(parent); | 157 | mCompleteTimeEdit = new KOTimeEdit(parent); |
158 | topLayout->addWidget( mCompleteTimeEdit); | 158 | topLayout->addWidget( mCompleteTimeEdit); |
159 | 159 | ||
160 | mCompletedCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred,QSizePolicy::Preferred) ); | 160 | mCompletedCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred,QSizePolicy::Preferred) ); |
161 | mCompletedLabel->setSizePolicy( QSizePolicy( QSizePolicy::Expanding,QSizePolicy::Preferred) ); | 161 | mCompletedLabel->setSizePolicy( QSizePolicy( QSizePolicy::Expanding,QSizePolicy::Preferred) ); |
162 | 162 | ||
163 | if ( QApplication::desktop()->width() <= 480 ) { | 163 | if ( QApplication::desktop()->width() <= 480 ) { |
164 | if ( QApplication::desktop()->width() < 320 ) | 164 | if ( QApplication::desktop()->width() < 320 ) |
165 | mCompleteDateEdit->setMaximumWidth( 85 ); | 165 | mCompleteDateEdit->setMaximumWidth( 85 ); |
166 | else | 166 | else |
167 | mCompleteDateEdit->setMaximumWidth( 130 ); | 167 | mCompleteDateEdit->setMaximumWidth( 140 ); |
168 | topLayout->setSpacing( 0 ); | 168 | topLayout->setSpacing( 0 ); |
169 | } | 169 | } |
170 | } | 170 | } |
171 | 171 | ||
172 | void KOEditorGeneralTodo::initPriority(QWidget *parent, QBoxLayout *topLayout) | 172 | void KOEditorGeneralTodo::initPriority(QWidget *parent, QBoxLayout *topLayout) |
173 | { | 173 | { |
174 | 174 | ||
175 | QHBox* h = new QHBox ( parent ); | 175 | QHBox* h = new QHBox ( parent ); |
176 | topLayout->addWidget( h ); | 176 | topLayout->addWidget( h ); |
177 | QLabel *priorityLabel = new QLabel(i18n("Priority:"), h); | 177 | QLabel *priorityLabel = new QLabel(i18n("Priority:"), h); |
178 | // topLayout->addWidget(priorityLabel); | 178 | // topLayout->addWidget(priorityLabel); |
179 | mPriorityCombo = new QComboBox( h ); | 179 | mPriorityCombo = new QComboBox( h ); |
180 | mPriorityCombo->insertItem(i18n("1 (high)")); | 180 | mPriorityCombo->insertItem(i18n("1 (high)")); |
181 | mPriorityCombo->insertItem(i18n("2")); | 181 | mPriorityCombo->insertItem(i18n("2")); |
182 | mPriorityCombo->insertItem(i18n("3")); | 182 | mPriorityCombo->insertItem(i18n("3")); |
183 | mPriorityCombo->insertItem(i18n("4")); | 183 | mPriorityCombo->insertItem(i18n("4")); |
184 | mPriorityCombo->insertItem(i18n("5 (low)")); | 184 | mPriorityCombo->insertItem(i18n("5 (low)")); |
185 | //topLayout->addWidget(mPriorityCombo); | 185 | //topLayout->addWidget(mPriorityCombo); |
186 | } | 186 | } |
187 | 187 | ||
188 | void KOEditorGeneralTodo::initStatus(QWidget *parent,QBoxLayout *topLayout) | 188 | void KOEditorGeneralTodo::initStatus(QWidget *parent,QBoxLayout *topLayout) |
189 | { | 189 | { |
190 | QBoxLayout *statusLayout = new QHBoxLayout(topLayout); | 190 | QBoxLayout *statusLayout = new QHBoxLayout(topLayout); |
191 | 191 | ||
192 | initCompletion( parent, statusLayout ); | 192 | initCompletion( parent, statusLayout ); |
193 | 193 | ||
194 | statusLayout->addStretch( 1 ); | 194 | statusLayout->addStretch( 1 ); |
195 | 195 | ||
196 | initPriority( parent, statusLayout ); | 196 | initPriority( parent, statusLayout ); |
197 | } | 197 | } |
198 | 198 | ||
199 | void KOEditorGeneralTodo::setDefaults(QDateTime due,bool allDay) | 199 | void KOEditorGeneralTodo::setDefaults(QDateTime due,bool allDay) |
200 | { | 200 | { |
201 | 201 | ||
202 | mSummaryEdit->load(KOLocationBox::SUMMARYTODO); | 202 | mSummaryEdit->load(KOLocationBox::SUMMARYTODO); |
203 | mLocationEdit->load(KOLocationBox::LOCATION); | 203 | mLocationEdit->load(KOLocationBox::LOCATION); |
204 | KOEditorGeneral::setDefaults(allDay); | 204 | KOEditorGeneral::setDefaults(allDay); |
205 | 205 | ||
206 | mTimeButton->setChecked( !allDay ); | 206 | mTimeButton->setChecked( !allDay ); |
207 | if(mTimeButton->isChecked()) { | 207 | if(mTimeButton->isChecked()) { |
208 | mTimeButton->setEnabled(true); | 208 | mTimeButton->setEnabled(true); |
209 | } | 209 | } |
210 | else { | 210 | else { |
211 | mTimeButton->setEnabled(false); | 211 | mTimeButton->setEnabled(false); |
212 | } | 212 | } |
213 | 213 | ||
214 | enableTimeEdits( !allDay ); | 214 | enableTimeEdits( !allDay ); |
215 | if ( due.isValid() ) { | 215 | if ( due.isValid() ) { |
216 | mDueCheck->setChecked(true); | 216 | mDueCheck->setChecked(true); |
217 | enableDueEdit(true); | 217 | enableDueEdit(true); |
218 | } else { | 218 | } else { |
219 | mDueCheck->setChecked(false); | 219 | mDueCheck->setChecked(false); |
220 | enableDueEdit(false); | 220 | enableDueEdit(false); |
221 | due = QDateTime::currentDateTime().addDays(7); | 221 | due = QDateTime::currentDateTime().addDays(7); |
222 | } | 222 | } |
223 | 223 | ||
224 | alarmDisable(true); | 224 | alarmDisable(true); |
225 | 225 | ||
226 | mStartCheck->setChecked(false); | 226 | mStartCheck->setChecked(false); |
227 | enableStartEdit(false); | 227 | enableStartEdit(false); |
228 | 228 | ||
229 | mDueDateEdit->setDate(due.date()); | 229 | mDueDateEdit->setDate(due.date()); |
230 | mDueTimeEdit->setTime(due.time()); | 230 | mDueTimeEdit->setTime(due.time()); |
231 | due = due.addDays(-7); | 231 | due = due.addDays(-7); |
232 | mStartDateEdit->setDate(due.date()); | 232 | mStartDateEdit->setDate(due.date()); |
233 | mStartTimeEdit->setTime(due.time()); | 233 | mStartTimeEdit->setTime(due.time()); |
234 | 234 | ||
235 | mPriorityCombo->setCurrentItem(2); | 235 | mPriorityCombo->setCurrentItem(2); |
236 | mCompletedLabel->setText(i18n("completed"));; | 236 | mCompletedLabel->setText(i18n("completed"));; |
237 | mCompletedCombo->setCurrentItem(0); | 237 | mCompletedCombo->setCurrentItem(0); |
238 | } | 238 | } |
239 | 239 | ||
240 | void KOEditorGeneralTodo::readTodo(Todo *todo) | 240 | void KOEditorGeneralTodo::readTodo(Todo *todo) |
241 | { | 241 | { |
242 | 242 | ||
243 | mSummaryEdit->load(KOLocationBox::SUMMARYTODO); | 243 | mSummaryEdit->load(KOLocationBox::SUMMARYTODO); |
244 | mLocationEdit->load(KOLocationBox::LOCATION); | 244 | mLocationEdit->load(KOLocationBox::LOCATION); |
245 | KOEditorGeneral::readIncidence(todo); | 245 | KOEditorGeneral::readIncidence(todo); |
246 | 246 | ||
247 | QDateTime dueDT; | 247 | QDateTime dueDT; |
248 | 248 | ||
249 | if (todo->hasDueDate()) { | 249 | if (todo->hasDueDate()) { |
250 | enableAlarmEdit(true); | 250 | enableAlarmEdit(true); |
251 | dueDT = todo->dtDue(); | 251 | dueDT = todo->dtDue(); |
252 | mDueDateEdit->setDate(todo->dtDue().date()); | 252 | mDueDateEdit->setDate(todo->dtDue().date()); |
253 | mDueTimeEdit->setTime(todo->dtDue().time()); | 253 | mDueTimeEdit->setTime(todo->dtDue().time()); |
254 | mDueCheck->setChecked(true); | 254 | mDueCheck->setChecked(true); |
255 | } else { | 255 | } else { |
256 | alarmDisable(true); | 256 | alarmDisable(true); |
257 | mDueDateEdit->setEnabled(false); | 257 | mDueDateEdit->setEnabled(false); |
258 | mDueTimeEdit->setEnabled(false); | 258 | mDueTimeEdit->setEnabled(false); |
259 | mDueDateEdit->setDate(QDate::currentDate()); | 259 | mDueDateEdit->setDate(QDate::currentDate()); |
260 | mDueTimeEdit->setTime(QTime::currentTime()); | 260 | mDueTimeEdit->setTime(QTime::currentTime()); |
261 | mDueCheck->setChecked(false); | 261 | mDueCheck->setChecked(false); |
262 | } | 262 | } |
263 | 263 | ||
264 | if (todo->hasStartDate()) { | 264 | if (todo->hasStartDate()) { |
265 | mStartDateEdit->setDate(todo->dtStart().date()); | 265 | mStartDateEdit->setDate(todo->dtStart().date()); |
266 | mStartTimeEdit->setTime(todo->dtStart().time()); | 266 | mStartTimeEdit->setTime(todo->dtStart().time()); |
267 | mStartCheck->setChecked(true); | 267 | mStartCheck->setChecked(true); |
268 | } else { | 268 | } else { |
269 | mStartDateEdit->setEnabled(false); | 269 | mStartDateEdit->setEnabled(false); |
270 | mStartTimeEdit->setEnabled(false); | 270 | mStartTimeEdit->setEnabled(false); |
271 | mStartDateEdit->setDate(QDate::currentDate()); | 271 | mStartDateEdit->setDate(QDate::currentDate()); |
272 | mStartTimeEdit->setTime(QTime::currentTime()); | 272 | mStartTimeEdit->setTime(QTime::currentTime()); |
273 | mStartCheck->setChecked(false); | 273 | mStartCheck->setChecked(false); |
274 | } | 274 | } |
275 | 275 | ||
276 | mTimeButton->setChecked( !todo->doesFloat() ); | 276 | mTimeButton->setChecked( !todo->doesFloat() ); |
277 | 277 | ||
278 | mCompletedCombo->setCurrentItem(todo->percentComplete() / 20); | 278 | mCompletedCombo->setCurrentItem(todo->percentComplete() / 20); |
279 | if (todo->isCompleted() && todo->hasCompletedDate()) { | 279 | if (todo->isCompleted() && todo->hasCompletedDate()) { |
280 | mCompleted = todo->completed(); | 280 | mCompleted = todo->completed(); |
281 | } | 281 | } |
282 | setCompletedDate(); | 282 | setCompletedDate(); |
283 | 283 | ||
284 | mPriorityCombo->setCurrentItem(todo->priority()-1); | 284 | mPriorityCombo->setCurrentItem(todo->priority()-1); |
285 | } | 285 | } |
286 | 286 | ||
287 | void KOEditorGeneralTodo::writeTodo(Todo *todo) | 287 | void KOEditorGeneralTodo::writeTodo(Todo *todo) |
288 | { | 288 | { |
289 | KOEditorGeneral::writeIncidence(todo); | 289 | KOEditorGeneral::writeIncidence(todo); |
290 | 290 | ||
291 | // temp. until something better happens. | 291 | // temp. until something better happens. |
292 | QString tmpStr; | 292 | QString tmpStr; |
293 | 293 | ||
294 | todo->setHasDueDate(mDueCheck->isChecked()); | 294 | todo->setHasDueDate(mDueCheck->isChecked()); |
295 | todo->setHasStartDate(mStartCheck->isChecked()); | 295 | todo->setHasStartDate(mStartCheck->isChecked()); |
296 | 296 | ||
297 | QDate tmpDate; | 297 | QDate tmpDate; |
298 | QTime tmpTime; | 298 | QTime tmpTime; |
299 | QDateTime tmpDT; | 299 | QDateTime tmpDT; |
300 | if ( mTimeButton->isChecked() ) { | 300 | if ( mTimeButton->isChecked() ) { |
301 | todo->setFloats(false); | 301 | todo->setFloats(false); |
302 | 302 | ||
303 | // set due date/time | 303 | // set due date/time |
304 | tmpDate = mDueDateEdit->date(); | 304 | tmpDate = mDueDateEdit->date(); |
305 | tmpTime = mDueTimeEdit->getTime(); | 305 | tmpTime = mDueTimeEdit->getTime(); |
306 | tmpDT.setDate(tmpDate); | 306 | tmpDT.setDate(tmpDate); |
307 | tmpDT.setTime(tmpTime); | 307 | tmpDT.setTime(tmpTime); |
308 | todo->setDtDue(tmpDT); | 308 | todo->setDtDue(tmpDT); |
309 | 309 | ||
310 | // set start date/time | 310 | // set start date/time |
311 | tmpDate = mStartDateEdit->date(); | 311 | tmpDate = mStartDateEdit->date(); |
312 | tmpTime = mStartTimeEdit->getTime(); | 312 | tmpTime = mStartTimeEdit->getTime(); |
313 | tmpDT.setDate(tmpDate); | 313 | tmpDT.setDate(tmpDate); |
314 | tmpDT.setTime(tmpTime); | 314 | tmpDT.setTime(tmpTime); |
315 | todo->setDtStart(tmpDT); | 315 | todo->setDtStart(tmpDT); |
316 | } else { | 316 | } else { |
317 | todo->setFloats(true); | 317 | todo->setFloats(true); |
318 | 318 | ||
319 | // need to change this. | 319 | // need to change this. |
320 | tmpDate = mDueDateEdit->date(); | 320 | tmpDate = mDueDateEdit->date(); |
321 | tmpTime.setHMS(0,0,0); | 321 | tmpTime.setHMS(0,0,0); |
322 | tmpDT.setDate(tmpDate); | 322 | tmpDT.setDate(tmpDate); |
323 | tmpDT.setTime(tmpTime); | 323 | tmpDT.setTime(tmpTime); |
324 | todo->setDtDue(tmpDT); | 324 | todo->setDtDue(tmpDT); |
325 | 325 | ||
326 | tmpDate = mStartDateEdit->date(); | 326 | tmpDate = mStartDateEdit->date(); |
327 | tmpTime.setHMS(0,0,0); | 327 | tmpTime.setHMS(0,0,0); |
328 | tmpDT.setDate(tmpDate); | 328 | tmpDT.setDate(tmpDate); |
329 | tmpDT.setTime(tmpTime); | 329 | tmpDT.setTime(tmpTime); |
330 | todo->setDtStart(tmpDT); | 330 | todo->setDtStart(tmpDT); |
331 | } | 331 | } |
332 | todo->setPriority(mPriorityCombo->currentItem()+1); | 332 | todo->setPriority(mPriorityCombo->currentItem()+1); |
333 | 333 | ||
334 | // set completion state | 334 | // set completion state |
335 | if ( mCompletedCombo->currentItem() == 5 ) { | 335 | if ( mCompletedCombo->currentItem() == 5 ) { |
336 | QDateTime comp ( mCompleteDateEdit->date(), mCompleteTimeEdit->getTime() ); | 336 | QDateTime comp ( mCompleteDateEdit->date(), mCompleteTimeEdit->getTime() ); |
337 | if ( comp.isValid () ) { | 337 | if ( comp.isValid () ) { |
338 | todo->setPercentComplete(0); | 338 | todo->setPercentComplete(0); |
339 | todo->setPercentComplete(100); | 339 | todo->setPercentComplete(100); |
340 | todo->setCompleted(comp); | 340 | todo->setCompleted(comp); |
341 | } else { | 341 | } else { |
342 | todo->setPercentComplete( 100 ); | 342 | todo->setPercentComplete( 100 ); |
343 | if ( mCompleted.isValid() ) | 343 | if ( mCompleted.isValid() ) |
344 | todo->setCompleted(mCompleted); | 344 | todo->setCompleted(mCompleted); |
345 | } | 345 | } |
346 | } else { | 346 | } else { |
347 | todo->setPercentComplete(mCompletedCombo->currentItem() * 20); | 347 | todo->setPercentComplete(mCompletedCombo->currentItem() * 20); |
348 | } | 348 | } |
349 | 349 | ||
350 | mSummaryEdit->save(KOLocationBox::SUMMARYTODO); | 350 | mSummaryEdit->save(KOLocationBox::SUMMARYTODO); |
351 | } | 351 | } |
352 | 352 | ||
353 | void KOEditorGeneralTodo::enableDueEdit(bool enable) | 353 | void KOEditorGeneralTodo::enableDueEdit(bool enable) |
354 | { | 354 | { |
355 | mDueDateEdit->setEnabled( enable ); | 355 | mDueDateEdit->setEnabled( enable ); |
356 | 356 | ||
357 | if(mDueCheck->isChecked() || mStartCheck->isChecked()) { | 357 | if(mDueCheck->isChecked() || mStartCheck->isChecked()) { |
358 | mTimeButton->setEnabled(true); | 358 | mTimeButton->setEnabled(true); |
359 | } | 359 | } |
360 | else { | 360 | else { |
361 | mTimeButton->setEnabled(false); | 361 | mTimeButton->setEnabled(false); |
362 | mTimeButton->setChecked(false); | 362 | mTimeButton->setChecked(false); |
363 | } | 363 | } |
364 | 364 | ||
365 | if (enable) { | 365 | if (enable) { |
366 | mDueTimeEdit->setEnabled( mTimeButton->isChecked() ); | 366 | mDueTimeEdit->setEnabled( mTimeButton->isChecked() ); |
367 | } else { | 367 | } else { |
368 | mDueTimeEdit->setEnabled( false ); | 368 | mDueTimeEdit->setEnabled( false ); |
369 | } | 369 | } |
370 | } | 370 | } |
371 | 371 | ||
372 | void KOEditorGeneralTodo::enableStartEdit( bool enable ) | 372 | void KOEditorGeneralTodo::enableStartEdit( bool enable ) |
373 | { | 373 | { |
374 | mStartDateEdit->setEnabled( enable ); | 374 | mStartDateEdit->setEnabled( enable ); |
375 | 375 | ||
376 | if(mDueCheck->isChecked() || mStartCheck->isChecked()) { | 376 | if(mDueCheck->isChecked() || mStartCheck->isChecked()) { |
377 | mTimeButton->setEnabled(true); | 377 | mTimeButton->setEnabled(true); |
378 | } | 378 | } |
379 | else { | 379 | else { |
380 | mTimeButton->setEnabled(false); | 380 | mTimeButton->setEnabled(false); |
381 | mTimeButton->setChecked(false); | 381 | mTimeButton->setChecked(false); |
382 | } | 382 | } |
383 | 383 | ||
384 | if (enable) { | 384 | if (enable) { |
385 | mStartTimeEdit->setEnabled( mTimeButton->isChecked() ); | 385 | mStartTimeEdit->setEnabled( mTimeButton->isChecked() ); |
386 | } else { | 386 | } else { |
387 | mStartTimeEdit->setEnabled( false ); | 387 | mStartTimeEdit->setEnabled( false ); |
388 | } | 388 | } |
389 | } | 389 | } |
390 | 390 | ||
391 | void KOEditorGeneralTodo::enableTimeEdits(bool enable) | 391 | void KOEditorGeneralTodo::enableTimeEdits(bool enable) |
392 | { | 392 | { |
393 | if(mStartCheck->isChecked()) { | 393 | if(mStartCheck->isChecked()) { |
394 | mStartTimeEdit->setEnabled( enable ); | 394 | mStartTimeEdit->setEnabled( enable ); |
395 | } | 395 | } |
396 | if(mDueCheck->isChecked()) { | 396 | if(mDueCheck->isChecked()) { |
397 | mDueTimeEdit->setEnabled( enable ); | 397 | mDueTimeEdit->setEnabled( enable ); |
398 | } | 398 | } |
399 | } | 399 | } |
400 | 400 | ||
401 | void KOEditorGeneralTodo::showAlarm() | 401 | void KOEditorGeneralTodo::showAlarm() |
402 | { | 402 | { |
403 | if ( mDueCheck->isChecked() ) { | 403 | if ( mDueCheck->isChecked() ) { |
404 | alarmDisable(false); | 404 | alarmDisable(false); |
405 | } | 405 | } |
406 | else { | 406 | else { |
407 | alarmDisable(true); | 407 | alarmDisable(true); |
408 | } | 408 | } |
409 | } | 409 | } |
410 | 410 | ||
411 | bool KOEditorGeneralTodo::validateInput() | 411 | bool KOEditorGeneralTodo::validateInput() |
412 | { | 412 | { |
413 | if (mDueCheck->isChecked()) { | 413 | if (mDueCheck->isChecked()) { |
414 | if (!mDueDateEdit->inputIsValid()) { | 414 | if (!mDueDateEdit->inputIsValid()) { |
415 | KMessageBox::sorry(0,i18n("Please specify a valid due date.")); | 415 | KMessageBox::sorry(0,i18n("Please specify a valid due date.")); |
416 | return false; | 416 | return false; |
417 | } | 417 | } |
418 | } | 418 | } |
419 | 419 | ||
420 | if (mStartCheck->isChecked()) { | 420 | if (mStartCheck->isChecked()) { |
421 | if (!mStartDateEdit->inputIsValid()) { | 421 | if (!mStartDateEdit->inputIsValid()) { |
422 | KMessageBox::sorry(0,i18n("Please specify a valid start date.")); | 422 | KMessageBox::sorry(0,i18n("Please specify a valid start date.")); |
423 | return false; | 423 | return false; |
424 | } | 424 | } |
425 | } | 425 | } |
426 | 426 | ||
427 | if (mStartCheck->isChecked() && mDueCheck->isChecked()) { | 427 | if (mStartCheck->isChecked() && mDueCheck->isChecked()) { |
428 | QDateTime startDate; | 428 | QDateTime startDate; |
429 | QDateTime dueDate; | 429 | QDateTime dueDate; |
430 | startDate.setDate(mStartDateEdit->date()); | 430 | startDate.setDate(mStartDateEdit->date()); |
431 | dueDate.setDate(mDueDateEdit->date()); | 431 | dueDate.setDate(mDueDateEdit->date()); |
432 | if (mTimeButton->isChecked()) { | 432 | if (mTimeButton->isChecked()) { |
433 | startDate.setTime(mStartTimeEdit->getTime()); | 433 | startDate.setTime(mStartTimeEdit->getTime()); |
434 | dueDate.setTime(mDueTimeEdit->getTime()); | 434 | dueDate.setTime(mDueTimeEdit->getTime()); |
435 | } | 435 | } |
436 | if (startDate > dueDate) { | 436 | if (startDate > dueDate) { |
437 | KMessageBox::sorry(0, | 437 | KMessageBox::sorry(0, |
438 | i18n("The start date cannot be after the due date.")); | 438 | i18n("The start date cannot be after the due date.")); |
439 | return false; | 439 | return false; |
440 | } | 440 | } |
441 | } | 441 | } |
442 | 442 | ||
443 | return KOEditorGeneral::validateInput(); | 443 | return KOEditorGeneral::validateInput(); |
444 | } | 444 | } |
445 | 445 | ||
446 | void KOEditorGeneralTodo::completedChanged(int index) | 446 | void KOEditorGeneralTodo::completedChanged(int index) |
447 | { | 447 | { |
448 | if (index == 5) { | 448 | if (index == 5) { |
449 | //get rid of milli sec | 449 | //get rid of milli sec |
450 | mCompleted = QDateTime::currentDateTime(); | 450 | mCompleted = QDateTime::currentDateTime(); |
451 | } | 451 | } |
452 | setCompletedDate(); | 452 | setCompletedDate(); |
453 | } | 453 | } |
454 | 454 | ||
455 | void KOEditorGeneralTodo::setCompletedDate() | 455 | void KOEditorGeneralTodo::setCompletedDate() |
456 | { | 456 | { |
457 | if (mCompletedCombo->currentItem() == 5 && mCompleted.isValid()) { | 457 | if (mCompletedCombo->currentItem() == 5 && mCompleted.isValid()) { |
458 | if ( QApplication::desktop()->width() < 480 ) { | 458 | if ( QApplication::desktop()->width() < 480 ) { |
459 | mCompletedLabel->setText(i18n(" on")); | 459 | mCompletedLabel->setText(i18n(" on")); |
460 | } | 460 | } |
461 | else | 461 | else |
462 | mCompletedLabel->setText(i18n(" completed on ")); | 462 | mCompletedLabel->setText(i18n(" completed on ")); |
463 | mCompleteDateEdit->show(); | 463 | mCompleteDateEdit->show(); |
464 | mCompleteTimeEdit->show(); | 464 | mCompleteTimeEdit->show(); |
465 | mCompleteTimeEdit->setTime( mCompleted.time() ); | 465 | mCompleteTimeEdit->setTime( mCompleted.time() ); |
466 | mCompleteDateEdit->setDate( mCompleted.date() ); | 466 | mCompleteDateEdit->setDate( mCompleted.date() ); |
467 | } else { | 467 | } else { |
468 | mCompletedLabel->setText(i18n("completed")); | 468 | mCompletedLabel->setText(i18n("completed")); |
469 | mCompleteDateEdit->hide(); | 469 | mCompleteDateEdit->hide(); |
470 | mCompleteTimeEdit->hide(); | 470 | mCompleteTimeEdit->hide(); |
471 | } | 471 | } |
472 | } | 472 | } |
473 | 473 | ||
474 | void KOEditorGeneralTodo::modified (Todo* todo, int modification) | 474 | void KOEditorGeneralTodo::modified (Todo* todo, int modification) |
475 | { | 475 | { |
476 | switch (modification) { | 476 | switch (modification) { |
477 | case KOGlobals::PRIORITY_MODIFIED: | 477 | case KOGlobals::PRIORITY_MODIFIED: |
478 | mPriorityCombo->setCurrentItem(todo->priority()-1); | 478 | mPriorityCombo->setCurrentItem(todo->priority()-1); |
479 | break; | 479 | break; |
480 | case KOGlobals::COMPLETION_MODIFIED: | 480 | case KOGlobals::COMPLETION_MODIFIED: |
481 | mCompletedCombo->setCurrentItem(todo->percentComplete() / 20); | 481 | mCompletedCombo->setCurrentItem(todo->percentComplete() / 20); |
482 | if (todo->isCompleted() && todo->hasCompletedDate()) { | 482 | if (todo->isCompleted() && todo->hasCompletedDate()) { |
483 | mCompleted = todo->completed(); | 483 | mCompleted = todo->completed(); |
484 | } | 484 | } |
485 | setCompletedDate(); | 485 | setCompletedDate(); |
486 | break; | 486 | break; |
487 | case KOGlobals::CATEGORY_MODIFIED: | 487 | case KOGlobals::CATEGORY_MODIFIED: |
488 | setCategories (todo->categoriesStr ()); | 488 | setCategories (todo->categoriesStr ()); |
489 | break; | 489 | break; |
490 | case KOGlobals::UNKNOWN_MODIFIED: // fall through | 490 | case KOGlobals::UNKNOWN_MODIFIED: // fall through |
491 | default: | 491 | default: |
492 | readTodo( todo ); | 492 | readTodo( todo ); |
493 | break; | 493 | break; |
494 | } | 494 | } |
495 | } | 495 | } |
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 5926abe..ffb2e1e 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -1,1576 +1,1588 @@ | |||
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 <qtimer.h> | 25 | #include <qtimer.h> |
26 | #include <qvbox.h> | 26 | #include <qvbox.h> |
27 | #include <qwidgetstack.h> | 27 | #include <qwidgetstack.h> |
28 | #include <qpushbutton.h> | 28 | #include <qpushbutton.h> |
29 | #include <qtooltip.h> | 29 | #include <qtooltip.h> |
30 | #include <qpainter.h> | 30 | #include <qpainter.h> |
31 | #include <qwhatsthis.h> | 31 | #include <qwhatsthis.h> |
32 | #ifndef DESKTOP_VERSION | 32 | #ifndef DESKTOP_VERSION |
33 | #include <qpe/qpeapplication.h> | 33 | #include <qpe/qpeapplication.h> |
34 | #else | 34 | #else |
35 | #include <qapplication.h> | 35 | #include <qapplication.h> |
36 | #endif | 36 | #endif |
37 | 37 | ||
38 | #include <kdebug.h> | 38 | #include <kdebug.h> |
39 | #include <klocale.h> | 39 | #include <klocale.h> |
40 | #include <kglobal.h> | 40 | #include <kglobal.h> |
41 | #include <kconfig.h> | 41 | #include <kconfig.h> |
42 | #include <kiconloader.h> | 42 | #include <kiconloader.h> |
43 | 43 | ||
44 | #include <kcalendarsystem.h> | 44 | #include <kcalendarsystem.h> |
45 | 45 | ||
46 | #ifndef KORG_NOPRINTER | 46 | #ifndef KORG_NOPRINTER |
47 | #include "calprinter.h" | 47 | #include "calprinter.h" |
48 | #endif | 48 | #endif |
49 | #include "koprefs.h" | 49 | #include "koprefs.h" |
50 | #ifndef KORG_NOPLUGINS | 50 | #ifndef KORG_NOPLUGINS |
51 | #include "kocore.h" | 51 | #include "kocore.h" |
52 | #endif | 52 | #endif |
53 | #include "koglobals.h" | 53 | #include "koglobals.h" |
54 | #include <libkcal/kincidenceformatter.h> | 54 | #include <libkcal/kincidenceformatter.h> |
55 | 55 | ||
56 | #include "komonthview.h" | 56 | #include "komonthview.h" |
57 | 57 | ||
58 | #define PIXMAP_SIZE 5 | 58 | #define PIXMAP_SIZE 5 |
59 | #ifdef DESKTOP_VERSION | 59 | #ifdef DESKTOP_VERSION |
60 | QToolTipGroup *MonthViewCell::mToolTipGroup = 0; | 60 | QToolTipGroup *MonthViewCell::mToolTipGroup = 0; |
61 | #endif | 61 | #endif |
62 | class KNOWhatsThis :public QWhatsThis | 62 | class KNOWhatsThis :public QWhatsThis |
63 | { | 63 | { |
64 | public: | 64 | public: |
65 | KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; | 65 | KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; |
66 | //~KNOWhatsThis( ) {qDebug("~KNOWhatsThis( ) "); }; | 66 | //~KNOWhatsThis( ) {qDebug("~KNOWhatsThis( ) "); }; |
67 | 67 | ||
68 | protected: | 68 | protected: |
69 | virtual QString text( const QPoint& p) | 69 | virtual QString text( const QPoint& p) |
70 | { | 70 | { |
71 | return _wid->getWhatsThisText(p) ; | 71 | return _wid->getWhatsThisText(p) ; |
72 | }; | 72 | }; |
73 | private: | 73 | private: |
74 | KNoScrollListBox* _wid; | 74 | KNoScrollListBox* _wid; |
75 | 75 | ||
76 | }; | 76 | }; |
77 | 77 | ||
78 | 78 | ||
79 | KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) | 79 | KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) |
80 | : QListBox(parent, name, WRepaintNoErase) | 80 | : QListBox(parent, name, WRepaintNoErase) |
81 | { | 81 | { |
82 | #ifndef DESKTOP_VERSION | 82 | #ifndef DESKTOP_VERSION |
83 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 83 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
84 | #endif | 84 | #endif |
85 | mWT = new KNOWhatsThis(this); | 85 | mWT = new KNOWhatsThis(this); |
86 | } | 86 | } |
87 | KNoScrollListBox::~KNoScrollListBox() | 87 | KNoScrollListBox::~KNoScrollListBox() |
88 | { | 88 | { |
89 | 89 | ||
90 | } | 90 | } |
91 | QString KNoScrollListBox::getWhatsThisText(QPoint p) | 91 | QString KNoScrollListBox::getWhatsThisText(QPoint p) |
92 | { | 92 | { |
93 | QListBoxItem* item = itemAt ( p ); | 93 | QListBoxItem* item = itemAt ( p ); |
94 | if ( ! item ) { | 94 | if ( ! item ) { |
95 | return i18n("Click in the cell\nto add an event!"); | 95 | return i18n("Click in the cell\nto add an event!"); |
96 | } | 96 | } |
97 | return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence()); | 97 | return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence()); |
98 | } | 98 | } |
99 | void KNoScrollListBox::keyPressEvent(QKeyEvent *e) | 99 | void KNoScrollListBox::keyPressEvent(QKeyEvent *e) |
100 | { | 100 | { |
101 | 101 | ||
102 | switch(e->key()) { | 102 | switch(e->key()) { |
103 | case Key_Right: | 103 | case Key_Right: |
104 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 104 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
105 | { | 105 | { |
106 | e->ignore(); | 106 | e->ignore(); |
107 | return; | 107 | return; |
108 | } | 108 | } |
109 | scrollBy(10,0); | 109 | scrollBy(10,0); |
110 | break; | 110 | break; |
111 | case Key_Left: | 111 | case Key_Left: |
112 | if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 112 | if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
113 | { | 113 | { |
114 | e->ignore(); | 114 | e->ignore(); |
115 | return; | 115 | return; |
116 | } | 116 | } |
117 | scrollBy(-10,0); | 117 | scrollBy(-10,0); |
118 | break; | 118 | break; |
119 | case Key_Up: | 119 | case Key_Up: |
120 | if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { | 120 | if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { |
121 | e->ignore(); | 121 | e->ignore(); |
122 | break; | 122 | break; |
123 | } | 123 | } |
124 | setCurrentItem((currentItem()+count()-1)%count()); | 124 | setCurrentItem((currentItem()+count()-1)%count()); |
125 | if(!itemVisible(currentItem())) { | 125 | if(!itemVisible(currentItem())) { |
126 | if((unsigned int) currentItem() == (count()-1)) { | 126 | if((unsigned int) currentItem() == (count()-1)) { |
127 | setTopItem(currentItem()-numItemsVisible()+1); | 127 | setTopItem(currentItem()-numItemsVisible()+1); |
128 | } else { | 128 | } else { |
129 | setTopItem(topItem()-1); | 129 | setTopItem(topItem()-1); |
130 | } | 130 | } |
131 | } | 131 | } |
132 | break; | 132 | break; |
133 | case Key_Down: | 133 | case Key_Down: |
134 | if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { | 134 | if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { |
135 | e->ignore(); | 135 | e->ignore(); |
136 | break; | 136 | break; |
137 | } | 137 | } |
138 | setCurrentItem((currentItem()+1)%count()); | 138 | setCurrentItem((currentItem()+1)%count()); |
139 | if(!itemVisible(currentItem())) { | 139 | if(!itemVisible(currentItem())) { |
140 | if(currentItem() == 0) { | 140 | if(currentItem() == 0) { |
141 | setTopItem(0); | 141 | setTopItem(0); |
142 | } else { | 142 | } else { |
143 | setTopItem(topItem()+1); | 143 | setTopItem(topItem()+1); |
144 | } | 144 | } |
145 | } | 145 | } |
146 | break; | 146 | break; |
147 | case Key_I: | 147 | case Key_I: |
148 | QTimer::singleShot( 11, this, SLOT ( oneDown() ) ); | 148 | QTimer::singleShot( 11, this, SLOT ( oneDown() ) ); |
149 | e->ignore(); | 149 | e->ignore(); |
150 | break; | 150 | break; |
151 | case Key_Shift: | 151 | case Key_Shift: |
152 | emit shiftDown(); | 152 | emit shiftDown(); |
153 | break; | 153 | break; |
154 | default: | 154 | default: |
155 | e->ignore(); | 155 | e->ignore(); |
156 | break; | 156 | break; |
157 | } | 157 | } |
158 | } | 158 | } |
159 | 159 | ||
160 | void KNoScrollListBox::oneDown() | 160 | void KNoScrollListBox::oneDown() |
161 | { | 161 | { |
162 | setCurrentItem((currentItem()+1)%count()); | 162 | setCurrentItem((currentItem()+1)%count()); |
163 | if(!itemVisible(currentItem())) { | 163 | if(!itemVisible(currentItem())) { |
164 | if(currentItem() == 0) { | 164 | if(currentItem() == 0) { |
165 | setTopItem(0); | 165 | setTopItem(0); |
166 | } else { | 166 | } else { |
167 | setTopItem(topItem()+1); | 167 | setTopItem(topItem()+1); |
168 | } | 168 | } |
169 | } | 169 | } |
170 | } | 170 | } |
171 | void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) | 171 | void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) |
172 | { | 172 | { |
173 | switch(e->key()) { | 173 | switch(e->key()) { |
174 | case Key_Shift: | 174 | case Key_Shift: |
175 | emit shiftUp(); | 175 | emit shiftUp(); |
176 | break; | 176 | break; |
177 | default: | 177 | default: |
178 | break; | 178 | break; |
179 | } | 179 | } |
180 | } | 180 | } |
181 | 181 | ||
182 | void KNoScrollListBox::mousePressEvent(QMouseEvent *e) | 182 | void KNoScrollListBox::mousePressEvent(QMouseEvent *e) |
183 | { | 183 | { |
184 | QListBox::mousePressEvent(e); | 184 | QListBox::mousePressEvent(e); |
185 | 185 | ||
186 | if(e->button() == RightButton) { | 186 | if(e->button() == RightButton) { |
187 | emit rightClick(); | 187 | emit rightClick(); |
188 | } | 188 | } |
189 | } | 189 | } |
190 | 190 | ||
191 | MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) | 191 | MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) |
192 | : QListBoxItem() | 192 | : QListBoxItem() |
193 | { | 193 | { |
194 | setText( s ); | 194 | setText( s ); |
195 | 195 | ||
196 | mIncidence = incidence; | 196 | mIncidence = incidence; |
197 | mDate = qd; | 197 | mDate = qd; |
198 | // QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); | 198 | // QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); |
199 | mRecur = false; | 199 | mRecur = false; |
200 | mAlarm = false; | 200 | mAlarm = false; |
201 | mReply = false; | 201 | mReply = false; |
202 | mInfo = false; | 202 | mInfo = false; |
203 | } | 203 | } |
204 | 204 | ||
205 | void MonthViewItem::paint(QPainter *p) | 205 | void MonthViewItem::paint(QPainter *p) |
206 | { | 206 | { |
207 | #if QT_VERSION >= 0x030000 | 207 | #if QT_VERSION >= 0x030000 |
208 | bool sel = isSelected(); | 208 | bool sel = isSelected(); |
209 | #else | 209 | #else |
210 | bool sel = selected(); | 210 | bool sel = selected(); |
211 | #endif | 211 | #endif |
212 | 212 | ||
213 | 213 | ||
214 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) | 214 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) |
215 | { | 215 | { |
216 | p->setBackgroundColor( palette().color( QPalette::Normal, \ | 216 | p->setBackgroundColor( palette().color( QPalette::Normal, \ |
217 | sel ? QColorGroup::Highlight : QColorGroup::Background ) ); | 217 | sel ? QColorGroup::Highlight : QColorGroup::Background ) ); |
218 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); | 218 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); |
219 | } | 219 | } |
220 | int x = 1; | 220 | int x = 1; |
221 | int y = 3;//(height() - mRecurPixmap.height()) /2; | 221 | int y = 3;//(height() - mRecurPixmap.height()) /2; |
222 | int size = PIXMAP_SIZE; | 222 | int size = PIXMAP_SIZE; |
223 | if ( QApplication::desktop()->width() < 300 ) | 223 | if ( QApplication::desktop()->width() < 300 ) |
224 | size = 3; | 224 | size = 3; |
225 | if ( KOPrefs::instance()->mMonthShowIcons ) { | 225 | if ( KOPrefs::instance()->mMonthShowIcons ) { |
226 | if ( mInfo ) { | 226 | if ( mInfo ) { |
227 | p->fillRect ( x, y,size,size, Qt::darkGreen ); | 227 | p->fillRect ( x, y,size,size, Qt::darkGreen ); |
228 | x += size + 1; | 228 | x += size + 1; |
229 | } | 229 | } |
230 | if ( mRecur ) { | 230 | if ( mRecur ) { |
231 | p->fillRect ( x, y,size,size, Qt::blue ); | 231 | p->fillRect ( x, y,size,size, Qt::blue ); |
232 | x += size + 1; | 232 | x += size + 1; |
233 | } | 233 | } |
234 | if ( mAlarm ) { | 234 | if ( mAlarm ) { |
235 | p->fillRect ( x, y,size,size, Qt::red ); | 235 | p->fillRect ( x, y,size,size, Qt::red ); |
236 | x += size + 1; | 236 | x += size + 1; |
237 | } | 237 | } |
238 | if ( mReply ) { | 238 | if ( mReply ) { |
239 | p->fillRect ( x, y,size,size, Qt::yellow ); | 239 | p->fillRect ( x, y,size,size, Qt::yellow ); |
240 | x += size + 1; | 240 | x += size + 1; |
241 | } | 241 | } |
242 | } | 242 | } |
243 | QFontMetrics fm = p->fontMetrics(); | 243 | QFontMetrics fm = p->fontMetrics(); |
244 | int yPos; | 244 | int yPos; |
245 | int pmheight = size; | 245 | int pmheight = size; |
246 | if( pmheight < fm.height() ) | 246 | if( pmheight < fm.height() ) |
247 | yPos = fm.ascent() + fm.leading()/2; | 247 | yPos = fm.ascent() + fm.leading()/2; |
248 | else | 248 | else |
249 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); | 249 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); |
250 | p->setPen( palette().color( QPalette::Normal, sel ? \ | 250 | p->setPen( palette().color( QPalette::Normal, sel ? \ |
251 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); | 251 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); |
252 | p->drawText( x, yPos, text() ); | 252 | p->drawText( x, yPos, text() ); |
253 | if ( mIncidence->cancelled() ) { | 253 | if ( mIncidence->cancelled() ) { |
254 | int wid = fm.width( text() ); | 254 | int wid = fm.width( text() ); |
255 | p->drawLine( x, yPos- fm.height()/2+3,x+wid, yPos- fm.height()/2 +3); | 255 | p->drawLine( x, yPos- fm.height()/2+3,x+wid, yPos- fm.height()/2 +3); |
256 | } | 256 | } |
257 | 257 | ||
258 | } | 258 | } |
259 | 259 | ||
260 | int MonthViewItem::height(const QListBox *lb) const | 260 | int MonthViewItem::height(const QListBox *lb) const |
261 | { | 261 | { |
262 | return lb->fontMetrics().lineSpacing()+1; | 262 | return lb->fontMetrics().lineSpacing()+1; |
263 | } | 263 | } |
264 | 264 | ||
265 | int MonthViewItem::width(const QListBox *lb) const | 265 | int MonthViewItem::width(const QListBox *lb) const |
266 | { | 266 | { |
267 | int size = PIXMAP_SIZE; | 267 | int size = PIXMAP_SIZE; |
268 | if ( QApplication::desktop()->width() < 300 ) | 268 | if ( QApplication::desktop()->width() < 300 ) |
269 | size = 3; | 269 | size = 3; |
270 | int x = 1; | 270 | int x = 1; |
271 | if ( mInfo ) { | 271 | if ( mInfo ) { |
272 | x += size + 1; | 272 | x += size + 1; |
273 | } | 273 | } |
274 | if( mRecur ) { | 274 | if( mRecur ) { |
275 | x += size+1; | 275 | x += size+1; |
276 | } | 276 | } |
277 | if( mAlarm ) { | 277 | if( mAlarm ) { |
278 | x += size+1; | 278 | x += size+1; |
279 | } | 279 | } |
280 | if( mReply ) { | 280 | if( mReply ) { |
281 | x += size+1; | 281 | x += size+1; |
282 | } | 282 | } |
283 | 283 | ||
284 | return( x + lb->fontMetrics().width( text() ) + 1 ); | 284 | return( x + lb->fontMetrics().width( text() ) + 1 ); |
285 | } | 285 | } |
286 | 286 | ||
287 | 287 | ||
288 | MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) | 288 | MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) |
289 | : QWidget( par ), | 289 | : QWidget( par ), |
290 | mMonthView( parent ) | 290 | mMonthView( parent ) |
291 | { | 291 | { |
292 | 292 | ||
293 | QVBoxLayout *topLayout = new QVBoxLayout( this ); | 293 | QVBoxLayout *topLayout = new QVBoxLayout( this ); |
294 | 294 | ||
295 | // mLabel = new QLabel( this );QPushButton | 295 | // mLabel = new QLabel( this );QPushButton |
296 | mLabel = new QPushButton( this ); | 296 | mLabel = new QPushButton( this ); |
297 | //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); | 297 | //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); |
298 | //mLabel->setLineWidth( 1 ); | 298 | //mLabel->setLineWidth( 1 ); |
299 | //mLabel->setAlignment( AlignCenter ); | 299 | //mLabel->setAlignment( AlignCenter ); |
300 | mLabel->setFlat( true ); | 300 | mLabel->setFlat( true ); |
301 | mLabel->setFocusPolicy(NoFocus); | 301 | mLabel->setFocusPolicy(NoFocus); |
302 | mItemList = new KNoScrollListBox( this ); | 302 | mItemList = new KNoScrollListBox( this ); |
303 | mItemList->setMinimumSize( 10, 10 ); | 303 | mItemList->setMinimumSize( 10, 10 ); |
304 | mItemList->setFrameStyle( QFrame::Panel | QFrame::Plain ); | 304 | mItemList->setFrameStyle( QFrame::Panel | QFrame::Plain ); |
305 | mItemList->setLineWidth( 1 ); | 305 | mItemList->setLineWidth( 1 ); |
306 | topLayout->addWidget( mItemList ); | 306 | topLayout->addWidget( mItemList ); |
307 | mLabel->raise(); | 307 | mLabel->raise(); |
308 | // QColor( 0,0,255 ) QColor( 160,1600,255 ) | 308 | // QColor( 0,0,255 ) QColor( 160,1600,255 ) |
309 | mStandardPalette = palette(); | 309 | mStandardPalette = palette(); |
310 | mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); | 310 | mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); |
311 | 311 | ||
312 | enableScrollBars( false ); | 312 | enableScrollBars( false ); |
313 | updateConfig(); | 313 | updateConfig(); |
314 | //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); | 314 | //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); |
315 | connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); | 315 | connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); |
316 | connect( mItemList, SIGNAL( doubleClicked( QListBoxItem *) ), | 316 | connect( mItemList, SIGNAL( doubleClicked( QListBoxItem *) ), |
317 | SLOT( defaultAction( QListBoxItem * ) ) ); | 317 | SLOT( defaultAction( QListBoxItem * ) ) ); |
318 | connect( mItemList, SIGNAL( rightButtonPressed( QListBoxItem *, | 318 | connect( mItemList, SIGNAL( rightButtonPressed( QListBoxItem *, |
319 | const QPoint &) ), | 319 | const QPoint &) ), |
320 | SLOT( contextMenu( QListBoxItem * ) ) ); | 320 | SLOT( contextMenu( QListBoxItem * ) ) ); |
321 | connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ), | 321 | connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ), |
322 | SLOT( selection( QListBoxItem * ) ) ); | 322 | SLOT( selection( QListBoxItem * ) ) ); |
323 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), | 323 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), |
324 | SLOT( cellClicked( QListBoxItem * ) ) ); | 324 | SLOT( cellClicked( QListBoxItem * ) ) ); |
325 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), | 325 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), |
326 | SLOT( selection( QListBoxItem * ) ) ); | 326 | SLOT( selection( QListBoxItem * ) ) ); |
327 | } | 327 | } |
328 | #ifdef DESKTOP_VERSION | 328 | #ifdef DESKTOP_VERSION |
329 | QToolTipGroup *MonthViewCell::toolTipGroup() | 329 | QToolTipGroup *MonthViewCell::toolTipGroup() |
330 | { | 330 | { |
331 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); | 331 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); |
332 | return mToolTipGroup; | 332 | return mToolTipGroup; |
333 | } | 333 | } |
334 | #endif | 334 | #endif |
335 | 335 | ||
336 | void MonthViewCell::setDate( const QDate &date ) | 336 | void MonthViewCell::setDate( const QDate &date ) |
337 | { | 337 | { |
338 | // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; | 338 | // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; |
339 | mDate = date; | 339 | mDate = date; |
340 | 340 | ||
341 | 341 | ||
342 | 342 | ||
343 | //resizeEvent( 0 ); | 343 | //resizeEvent( 0 ); |
344 | } | 344 | } |
345 | 345 | ||
346 | QDate MonthViewCell::date() const | 346 | QDate MonthViewCell::date() const |
347 | { | 347 | { |
348 | return mDate; | 348 | return mDate; |
349 | } | 349 | } |
350 | 350 | ||
351 | void MonthViewCell::setPrimary( bool primary ) | 351 | void MonthViewCell::setPrimary( bool primary ) |
352 | { | 352 | { |
353 | mPrimary = primary; | 353 | mPrimary = primary; |
354 | //setMyPalette(); | 354 | //setMyPalette(); |
355 | } | 355 | } |
356 | void MonthViewCell::setMyPalette() | 356 | void MonthViewCell::setMyPalette() |
357 | { | 357 | { |
358 | 358 | ||
359 | if ( mHoliday) { | 359 | if ( mHoliday) { |
360 | setPalette( mHolidayPalette ); | 360 | setPalette( mHolidayPalette ); |
361 | } else { | 361 | } else { |
362 | if ( mPrimary ) { | 362 | if ( mPrimary ) { |
363 | setPalette( mPrimaryPalette ); | 363 | setPalette( mPrimaryPalette ); |
364 | } else { | 364 | } else { |
365 | setPalette( mNonPrimaryPalette ); | 365 | setPalette( mNonPrimaryPalette ); |
366 | } | 366 | } |
367 | } | 367 | } |
368 | QPalette pal = palette(); | 368 | QPalette pal = palette(); |
369 | 369 | ||
370 | mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); | 370 | mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); |
371 | } | 371 | } |
372 | QPalette MonthViewCell::getPalette () | 372 | QPalette MonthViewCell::getPalette () |
373 | { | 373 | { |
374 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) | 374 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) |
375 | return mStandardPalette; | 375 | return mStandardPalette; |
376 | if ( mHoliday) { | 376 | if ( mHoliday) { |
377 | return mHolidayPalette ; | 377 | return mHolidayPalette ; |
378 | } else { | 378 | } else { |
379 | if ( mPrimary ) { | 379 | if ( mPrimary ) { |
380 | return mPrimaryPalette ; | 380 | return mPrimaryPalette ; |
381 | } | 381 | } |
382 | } | 382 | } |
383 | return mNonPrimaryPalette; | 383 | return mNonPrimaryPalette; |
384 | } | 384 | } |
385 | bool MonthViewCell::isPrimary() const | 385 | bool MonthViewCell::isPrimary() const |
386 | { | 386 | { |
387 | return mPrimary; | 387 | return mPrimary; |
388 | } | 388 | } |
389 | 389 | ||
390 | void MonthViewCell::setHoliday( bool holiday ) | 390 | void MonthViewCell::setHoliday( bool holiday ) |
391 | { | 391 | { |
392 | mHoliday = holiday; | 392 | mHoliday = holiday; |
393 | //setMyPalette(); | 393 | //setMyPalette(); |
394 | } | 394 | } |
395 | 395 | ||
396 | void MonthViewCell::setHoliday( const QString &holiday ) | 396 | void MonthViewCell::setHoliday( const QString &holiday ) |
397 | { | 397 | { |
398 | mHolidayString = holiday; | 398 | mHolidayString = holiday; |
399 | 399 | ||
400 | if ( !holiday.isEmpty() ) { | 400 | if ( !holiday.isEmpty() ) { |
401 | setHoliday( true ); | 401 | setHoliday( true ); |
402 | } | 402 | } |
403 | } | 403 | } |
404 | void MonthViewCell::keyPressEvent ( QKeyEvent * e ) | 404 | void MonthViewCell::keyPressEvent ( QKeyEvent * e ) |
405 | { | 405 | { |
406 | 406 | ||
407 | e->ignore(); | 407 | e->ignore(); |
408 | 408 | ||
409 | } | 409 | } |
410 | void MonthViewCell::clear() | 410 | void MonthViewCell::clear() |
411 | { | 411 | { |
412 | mItemList->clear(); | 412 | mItemList->clear(); |
413 | QApplication::removePostedEvents ( mItemList ); | 413 | QApplication::removePostedEvents ( mItemList ); |
414 | QApplication::removePostedEvents ( mLabel ); | 414 | QApplication::removePostedEvents ( mLabel ); |
415 | QApplication::removePostedEvents ( this ); | 415 | QApplication::removePostedEvents ( this ); |
416 | } | 416 | } |
417 | 417 | ||
418 | void MonthViewCell::startUpdateCell() | 418 | void MonthViewCell::startUpdateCell() |
419 | { | 419 | { |
420 | 420 | ||
421 | mItemList->setFocusPolicy(NoFocus); | 421 | mItemList->setFocusPolicy(NoFocus); |
422 | if ( !mMonthView->isUpdatePossible() ) | 422 | if ( !mMonthView->isUpdatePossible() ) |
423 | return; | 423 | return; |
424 | 424 | ||
425 | /* | 425 | /* |
426 | if ( !isVisible() ){ | 426 | if ( !isVisible() ){ |
427 | return; | 427 | return; |
428 | } | 428 | } |
429 | */ | 429 | */ |
430 | // qDebug("MonthViewCell::updateCell() "); | 430 | // qDebug("MonthViewCell::updateCell() "); |
431 | setPrimary( mDate.month()%2 ); | 431 | setPrimary( mDate.month()%2 ); |
432 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); | 432 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); |
433 | if ( mDate == QDate::currentDate() ) { | 433 | if ( mDate == QDate::currentDate() ) { |
434 | mItemList->setLineWidth( 3 ); | 434 | mItemList->setLineWidth( 3 ); |
435 | } else { | 435 | } else { |
436 | mItemList->setLineWidth( 1 ); | 436 | mItemList->setLineWidth( 1 ); |
437 | } | 437 | } |
438 | mItemList->clear(); | 438 | mItemList->clear(); |
439 | 439 | ||
440 | #ifdef DESKTOP_VERSION | 440 | #ifdef DESKTOP_VERSION |
441 | QToolTip::remove(this); | 441 | QToolTip::remove(this); |
442 | #endif | 442 | #endif |
443 | mToolTip = ""; | 443 | mToolTip = ""; |
444 | //qApp->processEvents(); | 444 | //qApp->processEvents(); |
445 | if ( !mHolidayString.isEmpty() ) { | 445 | if ( !mHolidayString.isEmpty() ) { |
446 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); | 446 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); |
447 | item->setPalette( mHolidayPalette ); | 447 | item->setPalette( mHolidayPalette ); |
448 | mItemList->insertItem( item ); | 448 | mItemList->insertItem( item ); |
449 | mToolTip += mHolidayString+"\n"; | 449 | mToolTip += mHolidayString+"\n"; |
450 | } | 450 | } |
451 | } | 451 | } |
452 | 452 | ||
453 | void MonthViewCell::insertEvent(Event *event) | 453 | void MonthViewCell::insertEvent(Event *event) |
454 | { | 454 | { |
455 | 455 | ||
456 | mItemList->setFocusPolicy(WheelFocus); | 456 | mItemList->setFocusPolicy(WheelFocus); |
457 | if ( !(event->doesRecur() == Recurrence::rNone) ) { | 457 | if ( !(event->doesRecur() == Recurrence::rNone) ) { |
458 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) | 458 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) |
459 | return; | 459 | return; |
460 | else | 460 | else |
461 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) | 461 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) |
462 | return; | 462 | return; |
463 | } | 463 | } |
464 | 464 | ||
465 | if ( event->categories().contains("Holiday") || | 465 | if ( event->categories().contains("Holiday") || |
466 | event->categories().contains(i18n("Holiday"))) { | 466 | event->categories().contains(i18n("Holiday"))) { |
467 | setHoliday( true ); | 467 | setHoliday( true ); |
468 | if ( mDate.dayOfWeek() == 7 ) | 468 | if ( mDate.dayOfWeek() == 7 ) |
469 | mItemList->setLineWidth( 3 ); | 469 | mItemList->setLineWidth( 3 ); |
470 | } | 470 | } |
471 | QString text; | 471 | QString text; |
472 | if (event->isMultiDay()) { | 472 | if (event->isMultiDay()) { |
473 | QString prefix = "<->"; | 473 | QString prefix = "<->"; |
474 | if ( event->doesRecur() ) { | 474 | if ( event->doesRecur() ) { |
475 | if ( event->recursOn( mDate) ) | 475 | if ( event->recursOn( mDate) ) |
476 | prefix ="->" ; | 476 | prefix ="->" ; |
477 | else { | 477 | else { |
478 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 478 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
479 | if ( event->recursOn( mDate.addDays( -days)) ) | 479 | if ( event->recursOn( mDate.addDays( -days)) ) |
480 | prefix ="<-" ; | 480 | prefix ="<-" ; |
481 | } | 481 | } |
482 | 482 | ||
483 | } else { | 483 | } else { |
484 | if (mDate == event->dtStart().date()) { | 484 | if (mDate == event->dtStart().date()) { |
485 | prefix ="->" ; | 485 | prefix ="->" ; |
486 | } else if (mDate == event->dtEnd().date()) { | 486 | } else if (mDate == event->dtEnd().date()) { |
487 | prefix ="<-" ; | 487 | prefix ="<-" ; |
488 | } | 488 | } |
489 | } | 489 | } |
490 | if ( !event->doesFloat() ) { | 490 | if ( !event->doesFloat() ) { |
491 | if ( mDate == event->dtStart().date () ) | 491 | if ( mDate == event->dtStart().date () ) |
492 | prefix += KGlobal::locale()->formatTime(event->dtStart().time())+" "; | 492 | prefix += KGlobal::locale()->formatTime(event->dtStart().time())+" "; |
493 | else if ( mDate == event->dtEnd().date () ) | 493 | else if ( mDate == event->dtEnd().date () ) |
494 | prefix += KGlobal::locale()->formatTime(event->dtEnd().time())+" "; | 494 | prefix += KGlobal::locale()->formatTime(event->dtEnd().time())+" "; |
495 | 495 | ||
496 | } | 496 | } |
497 | text = prefix + event->summary(); | 497 | text = prefix + event->summary(); |
498 | mToolTip += text; | 498 | mToolTip += text; |
499 | } else { | 499 | } else { |
500 | if (event->doesFloat()) { | 500 | if (event->doesFloat()) { |
501 | text = event->summary(); | 501 | text = event->summary(); |
502 | mToolTip += text; | 502 | mToolTip += text; |
503 | } | 503 | } |
504 | else { | 504 | else { |
505 | text = KGlobal::locale()->formatTime(event->dtStart().time()); | 505 | text = KGlobal::locale()->formatTime(event->dtStart().time()); |
506 | text += " " + event->summary(); | 506 | text += " " + event->summary(); |
507 | mToolTip += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); | 507 | mToolTip += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); |
508 | } | 508 | } |
509 | } | 509 | } |
510 | 510 | ||
511 | MonthViewItem *item = new MonthViewItem( event, mDate, text ); | 511 | MonthViewItem *item = new MonthViewItem( event, mDate, text ); |
512 | QPalette pal; | 512 | QPalette pal; |
513 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 513 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
514 | QStringList categories = event->categories(); | 514 | QStringList categories = event->categories(); |
515 | QString cat = categories.first(); | 515 | QString cat = categories.first(); |
516 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 516 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
517 | pal = getPalette(); | 517 | pal = getPalette(); |
518 | if (cat.isEmpty()) { | 518 | if (cat.isEmpty()) { |
519 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 519 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
520 | } else { | 520 | } else { |
521 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 521 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
522 | } | 522 | } |
523 | 523 | ||
524 | } else { | 524 | } else { |
525 | if (cat.isEmpty()) { | 525 | if (cat.isEmpty()) { |
526 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 526 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
527 | } else { | 527 | } else { |
528 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 528 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
529 | } | 529 | } |
530 | } | 530 | } |
531 | 531 | ||
532 | } else { | 532 | } else { |
533 | pal = mStandardPalette ; | 533 | pal = mStandardPalette ; |
534 | } | 534 | } |
535 | item->setPalette( pal ); | 535 | item->setPalette( pal ); |
536 | item->setRecur( event->recurrence()->doesRecur() ); | 536 | item->setRecur( event->recurrence()->doesRecur() ); |
537 | item->setAlarm( event->isAlarmEnabled() ); | 537 | item->setAlarm( event->isAlarmEnabled() ); |
538 | item->setMoreInfo( event->description().length() > 0 ); | 538 | item->setMoreInfo( event->description().length() > 0 ); |
539 | #ifdef DESKTOP_VERSION | 539 | #ifdef DESKTOP_VERSION |
540 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, | 540 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, |
541 | KOPrefs::instance()->email()); | 541 | KOPrefs::instance()->email()); |
542 | if ( me != 0 ) { | 542 | if ( me != 0 ) { |
543 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) | 543 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) |
544 | item->setReply(true); | 544 | item->setReply(true); |
545 | else | 545 | else |
546 | item->setReply(false); | 546 | item->setReply(false); |
547 | } else | 547 | } else |
548 | item->setReply(false); | 548 | item->setReply(false); |
549 | #endif | 549 | #endif |
550 | mItemList->insertItem( item ); | 550 | mItemList->insertItem( item ); |
551 | mToolTip += "\n"; | 551 | mToolTip += "\n"; |
552 | } | 552 | } |
553 | void MonthViewCell::insertTodo(Todo *todo) | 553 | void MonthViewCell::insertTodo(Todo *todo) |
554 | { | 554 | { |
555 | QString text; | 555 | QString text; |
556 | if (todo->hasDueDate()) { | 556 | mItemList->setFocusPolicy(WheelFocus); |
557 | if (!todo->doesFloat()) { | 557 | if (todo->hasDueDate()) { |
558 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); | 558 | if (!todo->doesFloat()) { |
559 | text += " "; | 559 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); |
560 | } | 560 | text += " "; |
561 | } | 561 | } |
562 | text += i18n("Td: %1").arg(todo->summary()); | 562 | } |
563 | 563 | text += i18n("T: %1").arg(todo->summary()); | |
564 | MonthViewItem *item = new MonthViewItem( todo, mDate, text ); | 564 | |
565 | //item->setPalette( mStandardPalette ); | 565 | MonthViewItem *item = new MonthViewItem( todo, mDate, text ); |
566 | QPalette pal; | 566 | //item->setPalette( mStandardPalette ); |
567 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 567 | QPalette pal; |
568 | QStringList categories = todo->categories(); | 568 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
569 | QString cat = categories.first(); | 569 | QStringList categories = todo->categories(); |
570 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 570 | QString cat = categories.first(); |
571 | pal = getPalette(); | 571 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
572 | if (cat.isEmpty()) { | 572 | pal = getPalette(); |
573 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 573 | if (cat.isEmpty()) { |
574 | } else { | 574 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
575 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | ||
576 | } | ||
577 | |||
578 | } else { | 575 | } else { |
579 | if (cat.isEmpty()) { | 576 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
580 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | ||
581 | } else { | ||
582 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | ||
583 | } | ||
584 | } | 577 | } |
585 | 578 | ||
586 | } else { | 579 | } else { |
587 | pal = mStandardPalette ; | 580 | if (cat.isEmpty()) { |
581 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | ||
582 | } else { | ||
583 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | ||
584 | } | ||
588 | } | 585 | } |
589 | item->setPalette( pal ); | 586 | |
590 | mItemList->insertItem( item ); | 587 | } else { |
591 | mToolTip += text+"\n"; | 588 | pal = mStandardPalette ; |
589 | } | ||
590 | item->setPalette( pal ); | ||
591 | mItemList->insertItem( item ); | ||
592 | mToolTip += text+"\n"; | ||
592 | } | 593 | } |
593 | void MonthViewCell::finishUpdateCell() | 594 | void MonthViewCell::finishUpdateCell() |
594 | { | 595 | { |
595 | #ifdef DESKTOP_VERSION | 596 | #ifdef DESKTOP_VERSION |
596 | if (mToolTip != "") | 597 | if (mToolTip != "") |
597 | QToolTip::add(this,mToolTip,toolTipGroup(),""); | 598 | QToolTip::add(this,mToolTip,toolTipGroup(),""); |
598 | #endif | 599 | #endif |
599 | mItemList->sort(); | 600 | mItemList->sort(); |
600 | //setMyPalette(); | 601 | //setMyPalette(); |
601 | setMyPalette(); | 602 | setMyPalette(); |
602 | QString text; | 603 | QString text; |
603 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; | 604 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; |
604 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { | 605 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { |
605 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; | 606 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; |
606 | mLabel->resize( mLabelBigSize ); | 607 | mLabel->resize( mLabelBigSize ); |
607 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 608 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
608 | } else { | 609 | } else { |
609 | mLabel->resize( mLabelSize ); | 610 | mLabel->resize( mLabelSize ); |
610 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 611 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
611 | } | 612 | } |
612 | 613 | ||
613 | mLabel->setText( text ); | 614 | mLabel->setText( text ); |
614 | resizeEvent( 0 ); | 615 | resizeEvent( 0 ); |
615 | } | 616 | } |
616 | void MonthViewCell::updateCell() | 617 | void MonthViewCell::updateCell() |
617 | { | 618 | { |
618 | if ( !mMonthView->isUpdatePossible() ) | 619 | if ( !mMonthView->isUpdatePossible() ) |
619 | return; | 620 | return; |
620 | startUpdateCell(); | 621 | startUpdateCell(); |
621 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 622 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
622 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); | 623 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); |
623 | Event *event; | 624 | Event *event; |
624 | for( event = events.first(); event; event = events.next() ) { // for event | 625 | for( event = events.first(); event; event = events.next() ) { // for event |
625 | insertEvent(event); | 626 | insertEvent(event); |
626 | } | 627 | } |
627 | // insert due todos | 628 | // insert due todos |
628 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); | 629 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); |
629 | Todo *todo; | 630 | Todo *todo; |
630 | for(todo = todos.first(); todo; todo = todos.next()) { | 631 | for(todo = todos.first(); todo; todo = todos.next()) { |
631 | insertTodo( todo ); | 632 | insertTodo( todo ); |
632 | } | 633 | } |
633 | finishUpdateCell(); | 634 | finishUpdateCell(); |
634 | // if ( isVisible()) | 635 | // if ( isVisible()) |
635 | //qApp->processEvents(); | 636 | //qApp->processEvents(); |
636 | } | 637 | } |
637 | 638 | ||
638 | void MonthViewCell::updateConfig( bool bigFont ) // = false | 639 | void MonthViewCell::updateConfig( bool bigFont ) // = false |
639 | { | 640 | { |
640 | 641 | ||
641 | if ( bigFont ) { | 642 | if ( bigFont ) { |
642 | QFont fo = KOPrefs::instance()->mMonthViewFont; | 643 | QFont fo = KOPrefs::instance()->mMonthViewFont; |
643 | int ps = fo.pointSize() + 2; | 644 | int ps = fo.pointSize() + 2; |
644 | if ( ps < 18 ) | 645 | if ( ps < 18 ) |
645 | ps += 2; | 646 | ps += 2; |
646 | fo.setPointSize( ps ); | 647 | fo.setPointSize( ps ); |
647 | setFont( fo ); | 648 | setFont( fo ); |
648 | } else | 649 | } else |
649 | setFont( KOPrefs::instance()->mMonthViewFont ); | 650 | setFont( KOPrefs::instance()->mMonthViewFont ); |
650 | 651 | ||
651 | QFontMetrics fm( font() ); | 652 | QFontMetrics fm( font() ); |
652 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); | 653 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); |
653 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); | 654 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); |
654 | mHolidayPalette = mStandardPalette; | 655 | mHolidayPalette = mStandardPalette; |
655 | mPrimaryPalette = mStandardPalette; | 656 | mPrimaryPalette = mStandardPalette; |
656 | mNonPrimaryPalette = mStandardPalette; | 657 | mNonPrimaryPalette = mStandardPalette; |
657 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { | 658 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { |
658 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); | 659 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); |
659 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); | 660 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); |
660 | mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); | 661 | mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); |
661 | mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); | 662 | mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); |
662 | mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); | 663 | mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); |
663 | mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); | 664 | mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); |
664 | mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); | 665 | mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); |
665 | mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); | 666 | mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); |
666 | mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); | 667 | mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); |
667 | } | 668 | } |
668 | //updateCell(); | 669 | //updateCell(); |
669 | } | 670 | } |
670 | 671 | ||
671 | void MonthViewCell::enableScrollBars( bool enabled ) | 672 | void MonthViewCell::enableScrollBars( bool enabled ) |
672 | { | 673 | { |
673 | if ( enabled ) { | 674 | if ( enabled ) { |
674 | mItemList->setVScrollBarMode(QScrollView::Auto); | 675 | mItemList->setVScrollBarMode(QScrollView::Auto); |
675 | mItemList->setHScrollBarMode(QScrollView::Auto); | 676 | mItemList->setHScrollBarMode(QScrollView::Auto); |
676 | } else { | 677 | } else { |
677 | mItemList->setVScrollBarMode(QScrollView::AlwaysOff); | 678 | mItemList->setVScrollBarMode(QScrollView::AlwaysOff); |
678 | mItemList->setHScrollBarMode(QScrollView::AlwaysOff); | 679 | mItemList->setHScrollBarMode(QScrollView::AlwaysOff); |
679 | } | 680 | } |
680 | } | 681 | } |
681 | 682 | ||
682 | Incidence *MonthViewCell::selectedIncidence() | 683 | Incidence *MonthViewCell::selectedIncidence() |
683 | { | 684 | { |
684 | int index = mItemList->currentItem(); | 685 | int index = mItemList->currentItem(); |
685 | if ( index < 0 ) return 0; | 686 | if ( index < 0 ) return 0; |
686 | 687 | ||
687 | MonthViewItem *item = | 688 | MonthViewItem *item = |
688 | static_cast<MonthViewItem *>( mItemList->item( index ) ); | 689 | static_cast<MonthViewItem *>( mItemList->item( index ) ); |
689 | 690 | ||
690 | if ( !item ) return 0; | 691 | if ( !item ) return 0; |
691 | 692 | ||
692 | return item->incidence(); | 693 | return item->incidence(); |
693 | } | 694 | } |
694 | 695 | ||
695 | QDate MonthViewCell::selectedIncidenceDate() | 696 | QDate MonthViewCell::selectedIncidenceDate() |
696 | { | 697 | { |
697 | QDate qd; | 698 | QDate qd; |
698 | int index = mItemList->currentItem(); | 699 | int index = mItemList->currentItem(); |
699 | if ( index < 0 ) return qd; | 700 | if ( index < 0 ) return qd; |
700 | 701 | ||
701 | MonthViewItem *item = | 702 | MonthViewItem *item = |
702 | static_cast<MonthViewItem *>( mItemList->item( index ) ); | 703 | static_cast<MonthViewItem *>( mItemList->item( index ) ); |
703 | 704 | ||
704 | if ( !item ) return qd; | 705 | if ( !item ) return qd; |
705 | 706 | ||
706 | return item->incidenceDate(); | 707 | return item->incidenceDate(); |
707 | } | 708 | } |
708 | 709 | ||
709 | void MonthViewCell::deselect() | 710 | void MonthViewCell::deselect() |
710 | { | 711 | { |
711 | mItemList->clearSelection(); | 712 | mItemList->clearSelection(); |
712 | enableScrollBars( false ); | 713 | enableScrollBars( false ); |
713 | // updateCell(); | 714 | // updateCell(); |
714 | } | 715 | } |
715 | void MonthViewCell::select() | 716 | void MonthViewCell::select() |
716 | { | 717 | { |
717 | ;// updateCell(); | 718 | ;// updateCell(); |
718 | } | 719 | } |
719 | 720 | ||
720 | void MonthViewCell::resizeEvent ( QResizeEvent * ) | 721 | void MonthViewCell::resizeEvent ( QResizeEvent * ) |
721 | { | 722 | { |
722 | if ( !mMonthView->isUpdatePossible() ) | 723 | if ( !mMonthView->isUpdatePossible() ) |
723 | return; | 724 | return; |
724 | 725 | ||
725 | int size = height() - mLabel->height() - 2; | 726 | int size = height() - mLabel->height() - 2; |
726 | if ( size > 0 ) | 727 | if ( size > 0 ) |
727 | mItemList->verticalScrollBar()->setMaximumHeight( size ); | 728 | mItemList->verticalScrollBar()->setMaximumHeight( size ); |
728 | size = width() - mLabel->width() -2; | 729 | size = width() - mLabel->width() -2; |
729 | if ( size > 0 ) | 730 | if ( size > 0 ) |
730 | mItemList->horizontalScrollBar()->setMaximumWidth( size ); | 731 | mItemList->horizontalScrollBar()->setMaximumWidth( size ); |
731 | mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() ); | 732 | mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() ); |
732 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 733 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
733 | } | 734 | } |
734 | 735 | ||
735 | void MonthViewCell::defaultAction( QListBoxItem *item ) | 736 | void MonthViewCell::defaultAction( QListBoxItem *item ) |
736 | { | 737 | { |
737 | if ( !item ) return; | 738 | if ( !item ) return; |
738 | 739 | ||
739 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); | 740 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); |
740 | Incidence *incidence = eventItem->incidence(); | 741 | Incidence *incidence = eventItem->incidence(); |
741 | if ( incidence ) mMonthView->defaultAction( incidence ); | 742 | if ( incidence ) mMonthView->defaultAction( incidence ); |
742 | } | 743 | } |
743 | void MonthViewCell::showDay() | 744 | void MonthViewCell::showDay() |
744 | { | 745 | { |
745 | emit showDaySignal( date() ); | 746 | emit showDaySignal( date() ); |
746 | } | 747 | } |
747 | void MonthViewCell::newEvent() | 748 | void MonthViewCell::newEvent() |
748 | { | 749 | { |
749 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 750 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
750 | emit newEventSignal( dt ); | 751 | emit newEventSignal( dt ); |
751 | } | 752 | } |
752 | void MonthViewCell::cellClicked( QListBoxItem *item ) | 753 | void MonthViewCell::cellClicked( QListBoxItem *item ) |
753 | { | 754 | { |
754 | static QListBoxItem * lastClicked = 0; | 755 | static QListBoxItem * lastClicked = 0; |
755 | if ( item == 0 ) { | 756 | if ( item == 0 ) { |
756 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 757 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
757 | emit newEventSignal( dt ); | 758 | emit newEventSignal( dt ); |
758 | return; | 759 | return; |
759 | } | 760 | } |
760 | /* | 761 | /* |
761 | if ( lastClicked ) | 762 | if ( lastClicked ) |
762 | if ( ! item ) { | 763 | if ( ! item ) { |
763 | if ( lastClicked->listBox() != item->listBox() ) | 764 | if ( lastClicked->listBox() != item->listBox() ) |
764 | lastClicked->listBox()->clearSelection(); | 765 | lastClicked->listBox()->clearSelection(); |
765 | } | 766 | } |
766 | */ | 767 | */ |
767 | 768 | ||
768 | mMonthView->setSelectedCell( this ); | 769 | mMonthView->setSelectedCell( this ); |
769 | if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) enableScrollBars( true ); | 770 | if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) enableScrollBars( true ); |
770 | select(); | 771 | select(); |
771 | } | 772 | } |
772 | 773 | ||
773 | void MonthViewCell::contextMenu( QListBoxItem *item ) | 774 | void MonthViewCell::contextMenu( QListBoxItem *item ) |
774 | { | 775 | { |
775 | if ( !item ) return; | 776 | if ( !item ) return; |
776 | 777 | ||
777 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); | 778 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); |
778 | Incidence *incidence = eventItem->incidence(); | 779 | Incidence *incidence = eventItem->incidence(); |
779 | if ( incidence ) mMonthView->showContextMenu( incidence ); | 780 | if ( incidence ) mMonthView->showContextMenu( incidence ); |
780 | } | 781 | } |
781 | 782 | ||
782 | void MonthViewCell::selection( QListBoxItem *item ) | 783 | void MonthViewCell::selection( QListBoxItem *item ) |
783 | { | 784 | { |
784 | if ( !item ) return; | 785 | if ( !item ) return; |
785 | |||
786 | mMonthView->setSelectedCell( this ); | 786 | mMonthView->setSelectedCell( this ); |
787 | } | 787 | } |
788 | 788 | ||
789 | 789 | ||
790 | // ******************************************************************************* | 790 | // ******************************************************************************* |
791 | // ******************************************************************************* | 791 | // ******************************************************************************* |
792 | // ******************************************************************************* | 792 | // ******************************************************************************* |
793 | 793 | ||
794 | 794 | ||
795 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | 795 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) |
796 | : KOEventView( calendar, parent, name ), | 796 | : KOEventView( calendar, parent, name ), |
797 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), | 797 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), |
798 | mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) | 798 | mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) |
799 | { | 799 | { |
800 | ignoreResizeEvent = 0; | 800 | ignoreResizeEvent = 0; |
801 | mShortDayLabelsW = false; | 801 | mShortDayLabelsW = false; |
802 | mShortDayLabelsM = false; | 802 | mShortDayLabelsM = false; |
803 | clPending = true; | 803 | clPending = true; |
804 | mWidStack = new QWidgetStack( this ); | 804 | mWidStack = new QWidgetStack( this ); |
805 | QHBoxLayout* hb = new QHBoxLayout( this ); | 805 | QHBoxLayout* hb = new QHBoxLayout( this ); |
806 | mMonthView = new QWidget( mWidStack ); | 806 | mMonthView = new QWidget( mWidStack ); |
807 | mWeekView = new QWidget( mWidStack ); | 807 | mWeekView = new QWidget( mWidStack ); |
808 | #if QT_VERSION >= 0x030000 | 808 | #if QT_VERSION >= 0x030000 |
809 | mWidStack->addWidget(mMonthView ); | 809 | mWidStack->addWidget(mMonthView ); |
810 | mWidStack->addWidget(mWeekView ); | 810 | mWidStack->addWidget(mWeekView ); |
811 | #else | 811 | #else |
812 | mWidStack->addWidget( mMonthView, 1 ); | 812 | mWidStack->addWidget( mMonthView, 1 ); |
813 | mWidStack->addWidget( mWeekView , 1 ); | 813 | mWidStack->addWidget( mWeekView , 1 ); |
814 | #endif | 814 | #endif |
815 | hb->addWidget( mWidStack ); | 815 | hb->addWidget( mWidStack ); |
816 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); | 816 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); |
817 | mShowWeekView = KOPrefs::instance()->mMonthViewWeek; | 817 | mShowWeekView = KOPrefs::instance()->mMonthViewWeek; |
818 | if ( mShowWeekView ) | 818 | if ( mShowWeekView ) |
819 | mWeekStartsMonday = true; | 819 | mWeekStartsMonday = true; |
820 | updatePossible = false; | 820 | updatePossible = false; |
821 | mCells.setAutoDelete( true ); | 821 | mCells.setAutoDelete( true ); |
822 | mDayLabels.resize( mDaysPerWeek ); | 822 | mDayLabels.resize( mDaysPerWeek ); |
823 | mDayLabelsW.resize( mDaysPerWeek ); | 823 | mDayLabelsW.resize( mDaysPerWeek ); |
824 | QFont bfont = font(); | 824 | QFont bfont = font(); |
825 | if ( QApplication::desktop()->width() < 650 ) { | 825 | if ( QApplication::desktop()->width() < 650 ) { |
826 | bfont.setPointSize( bfont.pointSize() - 2 ); | 826 | bfont.setPointSize( bfont.pointSize() - 2 ); |
827 | } | 827 | } |
828 | bfont.setBold( true ); | 828 | bfont.setBold( true ); |
829 | int i; | 829 | int i; |
830 | 830 | ||
831 | for( i = 0; i < mDaysPerWeek; i++ ) { | 831 | for( i = 0; i < mDaysPerWeek; i++ ) { |
832 | QLabel *label = new QLabel( mMonthView ); | 832 | QLabel *label = new QLabel( mMonthView ); |
833 | label->setFont(bfont); | 833 | label->setFont(bfont); |
834 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 834 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
835 | label->setLineWidth(1); | 835 | label->setLineWidth(1); |
836 | label->setAlignment(AlignCenter); | 836 | label->setAlignment(AlignCenter); |
837 | mDayLabels.insert( i, label ); | 837 | mDayLabels.insert( i, label ); |
838 | label = new QLabel( mWeekView ); | 838 | label = new QLabel( mWeekView ); |
839 | label->setFont(bfont); | 839 | label->setFont(bfont); |
840 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 840 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
841 | label->setLineWidth(1); | 841 | label->setLineWidth(1); |
842 | label->setAlignment(AlignCenter); | 842 | label->setAlignment(AlignCenter); |
843 | mDayLabelsW.insert( i, label ); | 843 | mDayLabelsW.insert( i, label ); |
844 | } | 844 | } |
845 | 845 | ||
846 | bfont.setBold( false ); | 846 | bfont.setBold( false ); |
847 | mWeekLabels.resize( mNumWeeks+1 ); | 847 | mWeekLabels.resize( mNumWeeks+1 ); |
848 | mWeekLabelsW.resize( 2 ); | 848 | mWeekLabelsW.resize( 2 ); |
849 | for( i = 0; i < mNumWeeks+1; i++ ) { | 849 | for( i = 0; i < mNumWeeks+1; i++ ) { |
850 | KOWeekButton *label = new KOWeekButton( mMonthView ); | 850 | KOWeekButton *label = new KOWeekButton( mMonthView ); |
851 | label->setFocusPolicy(NoFocus); | 851 | label->setFocusPolicy(NoFocus); |
852 | label->setFont(bfont); | 852 | label->setFont(bfont); |
853 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); | 853 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); |
854 | label->setFlat(true); | 854 | label->setFlat(true); |
855 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); | 855 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); |
856 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 856 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
857 | //label->setLineWidth(1); | 857 | //label->setLineWidth(1); |
858 | //label->setAlignment(AlignCenter); | 858 | //label->setAlignment(AlignCenter); |
859 | mWeekLabels.insert( i, label ); | 859 | mWeekLabels.insert( i, label ); |
860 | } | 860 | } |
861 | mWeekLabels[mNumWeeks]->setText( i18n("W")); | 861 | mWeekLabels[mNumWeeks]->setText( i18n("W")); |
862 | QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); | 862 | QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); |
863 | 863 | ||
864 | for( i = 0; i < 1+1; i++ ) { | 864 | for( i = 0; i < 1+1; i++ ) { |
865 | KOWeekButton *label = new KOWeekButton( mWeekView ); | 865 | KOWeekButton *label = new KOWeekButton( mWeekView ); |
866 | label->setFocusPolicy(NoFocus); | 866 | label->setFocusPolicy(NoFocus); |
867 | label->setFont(bfont); | 867 | label->setFont(bfont); |
868 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); | 868 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); |
869 | label->setFlat(true); | 869 | label->setFlat(true); |
870 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); | 870 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); |
871 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 871 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
872 | //label->setLineWidth(1); | 872 | //label->setLineWidth(1); |
873 | //label->setAlignment(AlignCenter); | 873 | //label->setAlignment(AlignCenter); |
874 | mWeekLabelsW.insert( i, label ); | 874 | mWeekLabelsW.insert( i, label ); |
875 | } | 875 | } |
876 | mWeekLabelsW[1]->setText( i18n("W")); | 876 | mWeekLabelsW[1]->setText( i18n("W")); |
877 | 877 | ||
878 | 878 | ||
879 | int row, col; | 879 | int row, col; |
880 | mCells.resize( mNumCells ); | 880 | mCells.resize( mNumCells ); |
881 | for( row = 0; row < mNumWeeks; ++row ) { | 881 | for( row = 0; row < mNumWeeks; ++row ) { |
882 | for( col = 0; col < mDaysPerWeek; ++col ) { | 882 | for( col = 0; col < mDaysPerWeek; ++col ) { |
883 | MonthViewCell *cell = new MonthViewCell( this, mMonthView ); | 883 | MonthViewCell *cell = new MonthViewCell( this, mMonthView ); |
884 | mCells.insert( row * mDaysPerWeek + col, cell ); | 884 | mCells.insert( row * mDaysPerWeek + col, cell ); |
885 | 885 | ||
886 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), | 886 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), |
887 | SLOT( defaultAction( Incidence * ) ) ); | 887 | SLOT( defaultAction( Incidence * ) ) ); |
888 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), | 888 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), |
889 | SIGNAL( newEventSignal( QDateTime ) ) ); | 889 | SIGNAL( newEventSignal( QDateTime ) ) ); |
890 | connect( cell, SIGNAL( showDaySignal( QDate ) ), | 890 | connect( cell, SIGNAL( showDaySignal( QDate ) ), |
891 | SIGNAL( showDaySignal( QDate ) ) ); | 891 | SIGNAL( showDaySignal( QDate ) ) ); |
892 | } | 892 | } |
893 | } | 893 | } |
894 | mCellsW.resize( mDaysPerWeek ); | 894 | mCellsW.resize( mDaysPerWeek ); |
895 | for( col = 0; col < mDaysPerWeek; ++col ) { | 895 | for( col = 0; col < mDaysPerWeek; ++col ) { |
896 | MonthViewCell *cell = new MonthViewCell( this, mWeekView ); | 896 | MonthViewCell *cell = new MonthViewCell( this, mWeekView ); |
897 | mCellsW.insert( col, cell ); | 897 | mCellsW.insert( col, cell ); |
898 | 898 | ||
899 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), | 899 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), |
900 | SLOT( defaultAction( Incidence * ) ) ); | 900 | SLOT( defaultAction( Incidence * ) ) ); |
901 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), | 901 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), |
902 | SIGNAL( newEventSignal( QDateTime ) ) ); | 902 | SIGNAL( newEventSignal( QDateTime ) ) ); |
903 | connect( cell, SIGNAL( showDaySignal( QDate ) ), | 903 | connect( cell, SIGNAL( showDaySignal( QDate ) ), |
904 | SIGNAL( showDaySignal( QDate ) ) ); | 904 | SIGNAL( showDaySignal( QDate ) ) ); |
905 | cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); | 905 | cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); |
906 | } | 906 | } |
907 | 907 | ||
908 | //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); | 908 | //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); |
909 | mContextMenu = eventPopup(); | 909 | mContextMenu = eventPopup(); |
910 | updateConfig(); //useless here | 910 | updateConfig(); //useless here |
911 | 911 | ||
912 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); | 912 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); |
913 | 913 | ||
914 | if ( mShowWeekView ) | 914 | if ( mShowWeekView ) |
915 | mWidStack->raiseWidget( mWeekView ); | 915 | mWidStack->raiseWidget( mWeekView ); |
916 | else | 916 | else |
917 | mWidStack->raiseWidget( mMonthView ); | 917 | mWidStack->raiseWidget( mMonthView ); |
918 | 918 | ||
919 | emit incidenceSelected( 0 ); | 919 | emit incidenceSelected( 0 ); |
920 | } | 920 | } |
921 | 921 | ||
922 | KOMonthView::~KOMonthView() | 922 | KOMonthView::~KOMonthView() |
923 | { | 923 | { |
924 | delete mContextMenu; | 924 | delete mContextMenu; |
925 | } | 925 | } |
926 | 926 | ||
927 | void KOMonthView::selectInternalWeekNum ( int n ) | 927 | void KOMonthView::selectInternalWeekNum ( int n ) |
928 | { | 928 | { |
929 | switchView(); | 929 | switchView(); |
930 | emit selectWeekNum ( n ); | 930 | emit selectWeekNum ( n ); |
931 | } | 931 | } |
932 | 932 | ||
933 | int KOMonthView::currentWeek() | 933 | int KOMonthView::currentWeek() |
934 | { | 934 | { |
935 | if ( mShowWeekView ) | 935 | if ( mShowWeekView ) |
936 | return mWeekLabelsW[0]->getWeekNum(); | 936 | return mWeekLabelsW[0]->getWeekNum(); |
937 | return mWeekLabels[0]->getWeekNum(); | 937 | return mWeekLabels[0]->getWeekNum(); |
938 | } | 938 | } |
939 | void KOMonthView::switchView() | 939 | void KOMonthView::switchView() |
940 | { | 940 | { |
941 | 941 | ||
942 | if ( selectedCell( ) ) | 942 | if ( selectedCell( ) ) |
943 | selectedCell()->deselect(); | 943 | selectedCell()->deselect(); |
944 | mShowWeekView = !mShowWeekView; | 944 | mShowWeekView = !mShowWeekView; |
945 | KOPrefs::instance()->mMonthViewWeek = mShowWeekView; | 945 | KOPrefs::instance()->mMonthViewWeek = mShowWeekView; |
946 | //emit showNavigator( !mShowWeekView ); | 946 | //emit showNavigator( !mShowWeekView ); |
947 | if ( clPending ) { | 947 | if ( clPending ) { |
948 | computeLayout(); | 948 | computeLayout(); |
949 | updateConfig(); | 949 | updateConfig(); |
950 | } | 950 | } |
951 | if ( mShowWeekView ) | 951 | if ( mShowWeekView ) |
952 | mWidStack->raiseWidget( mWeekView ); | 952 | mWidStack->raiseWidget( mWeekView ); |
953 | else | 953 | else |
954 | mWidStack->raiseWidget( mMonthView ); | 954 | mWidStack->raiseWidget( mMonthView ); |
955 | clPending = false; | 955 | clPending = false; |
956 | } | 956 | } |
957 | 957 | ||
958 | int KOMonthView::maxDatesHint() | 958 | int KOMonthView::maxDatesHint() |
959 | { | 959 | { |
960 | return mNumCells; | 960 | return mNumCells; |
961 | } | 961 | } |
962 | 962 | ||
963 | int KOMonthView::currentDateCount() | 963 | int KOMonthView::currentDateCount() |
964 | { | 964 | { |
965 | return mNumCells; | 965 | return mNumCells; |
966 | } | 966 | } |
967 | 967 | ||
968 | QPtrList<Incidence> KOMonthView::selectedIncidences() | 968 | QPtrList<Incidence> KOMonthView::selectedIncidences() |
969 | { | 969 | { |
970 | QPtrList<Incidence> selected; | 970 | QPtrList<Incidence> selected; |
971 | 971 | ||
972 | if ( mSelectedCell ) { | 972 | if ( mSelectedCell ) { |
973 | Incidence *incidence = mSelectedCell->selectedIncidence(); | 973 | Incidence *incidence = mSelectedCell->selectedIncidence(); |
974 | if ( incidence ) selected.append( incidence ); | 974 | if ( incidence ) selected.append( incidence ); |
975 | } | 975 | } |
976 | 976 | ||
977 | return selected; | 977 | return selected; |
978 | } | 978 | } |
979 | 979 | ||
980 | DateList KOMonthView::selectedDates() | 980 | DateList KOMonthView::selectedDates() |
981 | { | 981 | { |
982 | DateList selected; | 982 | DateList selected; |
983 | 983 | ||
984 | if ( mSelectedCell ) { | 984 | if ( mSelectedCell ) { |
985 | QDate qd = mSelectedCell->selectedIncidenceDate(); | 985 | QDate qd = mSelectedCell->selectedIncidenceDate(); |
986 | if ( qd.isValid() ) selected.append( qd ); | 986 | if ( qd.isValid() ) selected.append( qd ); |
987 | } | 987 | } |
988 | 988 | ||
989 | return selected; | 989 | return selected; |
990 | } | 990 | } |
991 | 991 | ||
992 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 992 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
993 | const QDate &td) | 993 | const QDate &td) |
994 | { | 994 | { |
995 | #ifndef KORG_NOPRINTER | 995 | #ifndef KORG_NOPRINTER |
996 | calPrinter->preview(CalPrinter::Month, fd, td); | 996 | calPrinter->preview(CalPrinter::Month, fd, td); |
997 | #endif | 997 | #endif |
998 | } | 998 | } |
999 | 999 | ||
1000 | void KOMonthView::updateConfig() | 1000 | void KOMonthView::updateConfig() |
1001 | { | 1001 | { |
1002 | 1002 | ||
1003 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); | 1003 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); |
1004 | 1004 | ||
1005 | if ( mShowWeekView ) { | 1005 | if ( mShowWeekView ) { |
1006 | mWeekStartsMonday = true; | 1006 | mWeekStartsMonday = true; |
1007 | } | 1007 | } |
1008 | QFontMetrics fontmetric(mDayLabels[0]->font()); | 1008 | QFontMetrics fontmetric(mDayLabels[0]->font()); |
1009 | mWidthLongDayLabel = 0; | 1009 | mWidthLongDayLabel = 0; |
1010 | qDebug("KOMonthView::updateConfig() "); | 1010 | qDebug("KOMonthView::updateConfig() "); |
1011 | for (int i = 0; i < 7; i++) { | 1011 | for (int i = 0; i < 7; i++) { |
1012 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); | 1012 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); |
1013 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; | 1013 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; |
1014 | } | 1014 | } |
1015 | if ( ! mShowWeekView ) { | 1015 | if ( ! mShowWeekView ) { |
1016 | computeLayout(); | 1016 | computeLayout(); |
1017 | } | 1017 | } |
1018 | updateDayLabels(); | 1018 | updateDayLabels(); |
1019 | //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); | 1019 | //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); |
1020 | //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; | 1020 | //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; |
1021 | //resizeEvent( 0 ); | 1021 | //resizeEvent( 0 ); |
1022 | for (uint i = 0; i < mCells.count(); ++i) { | 1022 | for (uint i = 0; i < mCells.count(); ++i) { |
1023 | mCells[i]->updateConfig(); | 1023 | mCells[i]->updateConfig(); |
1024 | } | 1024 | } |
1025 | 1025 | ||
1026 | for (uint i = 0; i < mCellsW.count(); ++i) { | 1026 | for (uint i = 0; i < mCellsW.count(); ++i) { |
1027 | mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont); | 1027 | mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont); |
1028 | } | 1028 | } |
1029 | #ifdef DESKTOP_VERSION | 1029 | #ifdef DESKTOP_VERSION |
1030 | MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); | 1030 | MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); |
1031 | #endif | 1031 | #endif |
1032 | updateView(); | 1032 | updateView(); |
1033 | } | 1033 | } |
1034 | 1034 | ||
1035 | void KOMonthView::updateDayLabels() | 1035 | void KOMonthView::updateDayLabels() |
1036 | { | 1036 | { |
1037 | 1037 | ||
1038 | QPtrVector<QLabel> *mDayLabelsT; | 1038 | QPtrVector<QLabel> *mDayLabelsT; |
1039 | #if 0 | 1039 | #if 0 |
1040 | if (mShowWeekView ) | 1040 | if (mShowWeekView ) |
1041 | mDayLabelsT = &mDayLabelsW; | 1041 | mDayLabelsT = &mDayLabelsW; |
1042 | else | 1042 | else |
1043 | mDayLabelsT = &mDayLabels; | 1043 | mDayLabelsT = &mDayLabels; |
1044 | #endif | 1044 | #endif |
1045 | qDebug("updateDayLabels W %d M %d ",mShortDayLabelsW ,mShortDayLabelsM); | 1045 | qDebug("updateDayLabels W %d M %d ",mShortDayLabelsW ,mShortDayLabelsM); |
1046 | mDayLabelsT = &mDayLabelsW; | 1046 | mDayLabelsT = &mDayLabelsW; |
1047 | for (int i = 0; i < 7; i++) { | 1047 | for (int i = 0; i < 7; i++) { |
1048 | if (mWeekStartsMonday) { | 1048 | if (mWeekStartsMonday) { |
1049 | bool show = mShortDayLabelsW; | 1049 | bool show = mShortDayLabelsW; |
1050 | if ( i > 4 && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) | 1050 | if ( i > 4 && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) |
1051 | show = true; | 1051 | show = true; |
1052 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); | 1052 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); |
1053 | } else { | 1053 | } else { |
1054 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsW)); | 1054 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsW)); |
1055 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsW)); | 1055 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsW)); |
1056 | 1056 | ||
1057 | } | 1057 | } |
1058 | } | 1058 | } |
1059 | mDayLabelsT = &mDayLabels; | 1059 | mDayLabelsT = &mDayLabels; |
1060 | for (int i = 0; i < 7; i++) { | 1060 | for (int i = 0; i < 7; i++) { |
1061 | if (mWeekStartsMonday) { | 1061 | if (mWeekStartsMonday) { |
1062 | bool show = mShortDayLabelsM; | 1062 | bool show = mShortDayLabelsM; |
1063 | if ( i > 4 && KOPrefs::instance()->mMonthViewSatSunTog && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) | 1063 | if ( i > 4 && KOPrefs::instance()->mMonthViewSatSunTog && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) |
1064 | show = true; | 1064 | show = true; |
1065 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); | 1065 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); |
1066 | } else { | 1066 | } else { |
1067 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsM)); | 1067 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsM)); |
1068 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsM)); | 1068 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsM)); |
1069 | 1069 | ||
1070 | } | 1070 | } |
1071 | } | 1071 | } |
1072 | 1072 | ||
1073 | } | 1073 | } |
1074 | 1074 | ||
1075 | void KOMonthView::showDates(const QDate &start, const QDate &) | 1075 | void KOMonthView::showDates(const QDate &start, const QDate &) |
1076 | { | 1076 | { |
1077 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; | 1077 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; |
1078 | 1078 | ||
1079 | QPtrVector<MonthViewCell> *cells; | 1079 | QPtrVector<MonthViewCell> *cells; |
1080 | QPtrVector<QLabel> *dayLabels; | 1080 | QPtrVector<QLabel> *dayLabels; |
1081 | QPtrVector<KOWeekButton> *weekLabels; | 1081 | QPtrVector<KOWeekButton> *weekLabels; |
1082 | int weekNum = 6; | 1082 | int weekNum = 6; |
1083 | if ( mShowWeekView ) { | 1083 | if ( mShowWeekView ) { |
1084 | weekNum = 1; | 1084 | weekNum = 1; |
1085 | cells = &mCellsW; | 1085 | cells = &mCellsW; |
1086 | dayLabels = &mDayLabelsW; | 1086 | dayLabels = &mDayLabelsW; |
1087 | weekLabels = &mWeekLabelsW; | 1087 | weekLabels = &mWeekLabelsW; |
1088 | } else { | 1088 | } else { |
1089 | cells = &mCells; | 1089 | cells = &mCells; |
1090 | dayLabels = &mDayLabels; | 1090 | dayLabels = &mDayLabels; |
1091 | weekLabels = &mWeekLabels; | 1091 | weekLabels = &mWeekLabels; |
1092 | } | 1092 | } |
1093 | 1093 | ||
1094 | mStartDate = start; | 1094 | mStartDate = start; |
1095 | 1095 | ||
1096 | int startWeekDay = mWeekStartsMonday ? 1 : 7; | 1096 | int startWeekDay = mWeekStartsMonday ? 1 : 7; |
1097 | 1097 | ||
1098 | while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { | 1098 | while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { |
1099 | mStartDate = mStartDate.addDays( -1 ); | 1099 | mStartDate = mStartDate.addDays( -1 ); |
1100 | } | 1100 | } |
1101 | 1101 | ||
1102 | bool primary = false; | 1102 | bool primary = false; |
1103 | uint i; | 1103 | uint i; |
1104 | for( i = 0; i < (*cells).size(); ++i ) { | 1104 | for( i = 0; i < (*cells).size(); ++i ) { |
1105 | QDate date = mStartDate.addDays( i ); | 1105 | QDate date = mStartDate.addDays( i ); |
1106 | (*cells)[i]->setDate( date ); | 1106 | (*cells)[i]->setDate( date ); |
1107 | 1107 | ||
1108 | #ifndef KORG_NOPLUGINS | 1108 | #ifndef KORG_NOPLUGINS |
1109 | // add holiday, if present | 1109 | // add holiday, if present |
1110 | QString hstring(KOCore::self()->holiday(date)); | 1110 | QString hstring(KOCore::self()->holiday(date)); |
1111 | (*cells)[i]->setHoliday( hstring ); | 1111 | (*cells)[i]->setHoliday( hstring ); |
1112 | #endif | 1112 | #endif |
1113 | 1113 | ||
1114 | } | 1114 | } |
1115 | QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); | 1115 | QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); |
1116 | for( i = 0; i < weekNum; ++i ) { | 1116 | for( i = 0; i < weekNum; ++i ) { |
1117 | int wno; | 1117 | int wno; |
1118 | // remember, according to ISO 8601, the first week of the year is the | 1118 | // remember, according to ISO 8601, the first week of the year is the |
1119 | // first week that contains a thursday. Thus we must subtract off 4, | 1119 | // first week that contains a thursday. Thus we must subtract off 4, |
1120 | // not just 1. | 1120 | // not just 1. |
1121 | int dayOfYear = date.dayOfYear(); | 1121 | int dayOfYear = date.dayOfYear(); |
1122 | if (dayOfYear % 7 != 0) | 1122 | if (dayOfYear % 7 != 0) |
1123 | wno = dayOfYear / 7 + 1; | 1123 | wno = dayOfYear / 7 + 1; |
1124 | else | 1124 | else |
1125 | wno =dayOfYear / 7; | 1125 | wno =dayOfYear / 7; |
1126 | (*weekLabels)[i]->setWeekNum( wno ); | 1126 | (*weekLabels)[i]->setWeekNum( wno ); |
1127 | date = date.addDays( 7 ); | 1127 | date = date.addDays( 7 ); |
1128 | } | 1128 | } |
1129 | updateView(); | 1129 | updateView(); |
1130 | } | 1130 | } |
1131 | 1131 | ||
1132 | void KOMonthView::showEvents(QPtrList<Event>) | 1132 | void KOMonthView::showEvents(QPtrList<Event>) |
1133 | { | 1133 | { |
1134 | qDebug("KOMonthView::selectEvents is not implemented yet. "); | 1134 | qDebug("KOMonthView::selectEvents is not implemented yet. "); |
1135 | } | 1135 | } |
1136 | 1136 | ||
1137 | void KOMonthView::changeEventDisplay(Event *, int) | 1137 | void KOMonthView::changeEventDisplay(Event *, int) |
1138 | { | 1138 | { |
1139 | // this should be re-written to be much more efficient, but this | 1139 | // this should be re-written to be much more efficient, but this |
1140 | // quick-and-dirty-hack gets the job done for right now. | 1140 | // quick-and-dirty-hack gets the job done for right now. |
1141 | updateView(); | 1141 | updateView(); |
1142 | } | 1142 | } |
1143 | 1143 | ||
1144 | void KOMonthView::updateView() | 1144 | void KOMonthView::updateView() |
1145 | { | 1145 | { |
1146 | 1146 | ||
1147 | if ( !updatePossible ) | 1147 | if ( !updatePossible ) |
1148 | return; | 1148 | return; |
1149 | //QTime ti; | 1149 | //QTime ti; |
1150 | //ti.start(); | 1150 | //ti.start(); |
1151 | QPtrVector<MonthViewCell> *cells; | 1151 | QPtrVector<MonthViewCell> *cells; |
1152 | if ( mShowWeekView ) { | 1152 | if ( mShowWeekView ) { |
1153 | cells = &mCellsW; | 1153 | cells = &mCellsW; |
1154 | } else { | 1154 | } else { |
1155 | cells = &mCells; | 1155 | cells = &mCells; |
1156 | } | 1156 | } |
1157 | #if 1 | 1157 | #if 1 |
1158 | int i; | 1158 | int i; |
1159 | int timeSpan = (*cells).size()-1; | 1159 | int timeSpan = (*cells).size()-1; |
1160 | if ( KOPrefs::instance()->mMonthViewWeek ) | 1160 | if ( KOPrefs::instance()->mMonthViewWeek ) |
1161 | timeSpan = 6; | 1161 | timeSpan = 6; |
1162 | for( i = 0; i < timeSpan + 1; ++i ) { | 1162 | for( i = 0; i < timeSpan + 1; ++i ) { |
1163 | (*cells)[i]->startUpdateCell(); | 1163 | (*cells)[i]->startUpdateCell(); |
1164 | } | 1164 | } |
1165 | 1165 | ||
1166 | QPtrList<Event> events = calendar()->events(); | 1166 | QPtrList<Event> events = calendar()->events(); |
1167 | Event *event; | 1167 | Event *event; |
1168 | QDateTime dt; | 1168 | QDateTime dt; |
1169 | bool ok; | 1169 | bool ok; |
1170 | QDate endDate = mStartDate.addDays( timeSpan ); | 1170 | QDate endDate = mStartDate.addDays( timeSpan ); |
1171 | for( event = events.first(); event; event = events.next() ) { // for event | 1171 | for( event = events.first(); event; event = events.next() ) { // for event |
1172 | if ( event->doesRecur() ) { | 1172 | if ( event->doesRecur() ) { |
1173 | bool last; | 1173 | bool last; |
1174 | QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); | 1174 | QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); |
1175 | QDateTime incidenceEnd; | 1175 | QDateTime incidenceEnd; |
1176 | int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 1176 | int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
1177 | bool invalid = false; | 1177 | bool invalid = false; |
1178 | while( true ) { | 1178 | while( true ) { |
1179 | if ( incidenceStart.isValid() ) { | 1179 | if ( incidenceStart.isValid() ) { |
1180 | incidenceEnd = incidenceStart.addDays( eventlen ); | 1180 | incidenceEnd = incidenceStart.addDays( eventlen ); |
1181 | int st = incidenceStart.date().daysTo( endDate ); | 1181 | int st = incidenceStart.date().daysTo( endDate ); |
1182 | if ( st >= 0 ) { // start before timeend | 1182 | if ( st >= 0 ) { // start before timeend |
1183 | int end = mStartDate.daysTo( incidenceEnd.date() ); | 1183 | int end = mStartDate.daysTo( incidenceEnd.date() ); |
1184 | if ( end >= 0 ) { // end after timestart --- got one! | 1184 | if ( end >= 0 ) { // end after timestart --- got one! |
1185 | //normalize | 1185 | //normalize |
1186 | st = timeSpan - st; | 1186 | st = timeSpan - st; |
1187 | if ( st < 0 ) st = 0; | 1187 | if ( st < 0 ) st = 0; |
1188 | if ( end > timeSpan ) end = timeSpan; | 1188 | if ( end > timeSpan ) end = timeSpan; |
1189 | int iii; | 1189 | int iii; |
1190 | //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); | 1190 | //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); |
1191 | for ( iii = st;iii<= end;++iii) | 1191 | for ( iii = st;iii<= end;++iii) |
1192 | (*cells)[iii]->insertEvent( event ); | 1192 | (*cells)[iii]->insertEvent( event ); |
1193 | } | 1193 | } |
1194 | } | 1194 | } |
1195 | } else { | 1195 | } else { |
1196 | if ( invalid ) | 1196 | if ( invalid ) |
1197 | break; | 1197 | break; |
1198 | invalid = true; | 1198 | invalid = true; |
1199 | //qDebug("invalid %s", event->summary().latin1()); | 1199 | //qDebug("invalid %s", event->summary().latin1()); |
1200 | incidenceStart = QDateTime( mStartDate ).addSecs( -2 );; | 1200 | incidenceStart = QDateTime( mStartDate ).addSecs( -2 );; |
1201 | } | 1201 | } |
1202 | if ( last ) | 1202 | if ( last ) |
1203 | break; | 1203 | break; |
1204 | bool ok; | 1204 | bool ok; |
1205 | incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); | 1205 | incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); |
1206 | if ( ! ok ) | 1206 | if ( ! ok ) |
1207 | break; | 1207 | break; |
1208 | if ( incidenceStart.date() > endDate ) | 1208 | if ( incidenceStart.date() > endDate ) |
1209 | break; | 1209 | break; |
1210 | } | 1210 | } |
1211 | } else { // no recur | 1211 | } else { // no recur |
1212 | int st = event->dtStart().date().daysTo( endDate ); | 1212 | int st = event->dtStart().date().daysTo( endDate ); |
1213 | if ( st >= 0 ) { // start before timeend | 1213 | if ( st >= 0 ) { // start before timeend |
1214 | int end = mStartDate.daysTo( event->dtEnd().date() ); | 1214 | int end = mStartDate.daysTo( event->dtEnd().date() ); |
1215 | if ( end >= 0 ) { // end after timestart --- got one! | 1215 | if ( end >= 0 ) { // end after timestart --- got one! |
1216 | //normalize | 1216 | //normalize |
1217 | st = timeSpan - st; | 1217 | st = timeSpan - st; |
1218 | if ( st < 0 ) st = 0; | 1218 | if ( st < 0 ) st = 0; |
1219 | if ( end > timeSpan ) end = timeSpan; | 1219 | if ( end > timeSpan ) end = timeSpan; |
1220 | int iii; | 1220 | int iii; |
1221 | for ( iii = st;iii<= end;++iii) | 1221 | for ( iii = st;iii<= end;++iii) |
1222 | (*cells)[iii]->insertEvent( event ); | 1222 | (*cells)[iii]->insertEvent( event ); |
1223 | } | 1223 | } |
1224 | } | 1224 | } |
1225 | } | 1225 | } |
1226 | } | 1226 | } |
1227 | // insert due todos | 1227 | // insert due todos |
1228 | QPtrList<Todo> todos = calendar()->todos( ); | 1228 | QPtrList<Todo> todos = calendar()->todos( ); |
1229 | Todo *todo; | 1229 | Todo *todo; |
1230 | for(todo = todos.first(); todo; todo = todos.next()) { | 1230 | for(todo = todos.first(); todo; todo = todos.next()) { |
1231 | //insertTodo( todo ); | 1231 | //insertTodo( todo ); |
1232 | if ( todo->hasDueDate() ) { | 1232 | if ( todo->hasDueDate() ) { |
1233 | int day = mStartDate.daysTo( todo->dtDue().date() ); | 1233 | int day = mStartDate.daysTo( todo->dtDue().date() ); |
1234 | if ( day >= 0 && day < timeSpan + 1) { | 1234 | if ( day >= 0 && day < timeSpan + 1) { |
1235 | (*cells)[day]->insertTodo( todo ); | 1235 | (*cells)[day]->insertTodo( todo ); |
1236 | } | 1236 | } |
1237 | } | 1237 | } |
1238 | } | 1238 | } |
1239 | 1239 | ||
1240 | for( i = 0; i < timeSpan+1; ++i ) { | 1240 | for( i = 0; i < timeSpan+1; ++i ) { |
1241 | (*cells)[i]->finishUpdateCell(); | 1241 | (*cells)[i]->finishUpdateCell(); |
1242 | } | 1242 | } |
1243 | processSelectionChange(); | 1243 | processSelectionChange(); |
1244 | (*cells)[0]->setFocus(); | 1244 | (*cells)[0]->setFocus(); |
1245 | 1245 | ||
1246 | 1246 | ||
1247 | #else | 1247 | #else |
1248 | // old code | 1248 | // old code |
1249 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); | 1249 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); |
1250 | int i; | 1250 | int i; |
1251 | for( i = 0; i < (*cells).count(); ++i ) { | 1251 | for( i = 0; i < (*cells).count(); ++i ) { |
1252 | (*cells)[i]->updateCell(); | 1252 | (*cells)[i]->updateCell(); |
1253 | } | 1253 | } |
1254 | 1254 | ||
1255 | //qDebug("KOMonthView::updateView() "); | 1255 | //qDebug("KOMonthView::updateView() "); |
1256 | processSelectionChange(); | 1256 | processSelectionChange(); |
1257 | // qDebug("---------------------------------------------------------------------+ "); | 1257 | // qDebug("---------------------------------------------------------------------+ "); |
1258 | (*cells)[0]->setFocus(); | 1258 | (*cells)[0]->setFocus(); |
1259 | #endif | 1259 | #endif |
1260 | 1260 | ||
1261 | //qDebug("update time %d ", ti.elapsed()); | 1261 | //qDebug("update time %d ", ti.elapsed()); |
1262 | } | 1262 | } |
1263 | 1263 | ||
1264 | void KOMonthView::resizeEvent(QResizeEvent * e) | 1264 | void KOMonthView::resizeEvent(QResizeEvent * e) |
1265 | { | 1265 | { |
1266 | qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); | 1266 | qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); |
1267 | if ( ignoreResizeEvent ) { | 1267 | if ( ignoreResizeEvent ) { |
1268 | qDebug("KOMonthView::resizeEvent ignored "); | 1268 | int diff = e->size().height() - e->oldSize().height(); |
1269 | --ignoreResizeEvent; | 1269 | if ( diff < 0 ) |
1270 | return; | 1270 | diff = diff * (-1); |
1271 | if ( diff == ignoreResizeEventHeight ) { | ||
1272 | qDebug("KOMonthView::resizeEvent ignored "); | ||
1273 | --ignoreResizeEvent; | ||
1274 | return; | ||
1275 | } | ||
1276 | ignoreResizeEvent = 0; | ||
1271 | } | 1277 | } |
1272 | if ( e->size().width()+ e->size().height() < 240 ) | 1278 | if ( e->size().width()+ e->size().height() < 240 ) |
1273 | return; | 1279 | return; |
1274 | computeLayout(); | 1280 | computeLayout(); |
1275 | clPending = true; | 1281 | clPending = true; |
1276 | if ( mShowWeekView ) | 1282 | if ( mShowWeekView ) |
1277 | mCellsW[0]->setFocus(); | 1283 | mCellsW[0]->setFocus(); |
1278 | else | 1284 | else |
1279 | mCells[0]->setFocus(); | 1285 | mCells[0]->setFocus(); |
1280 | } | 1286 | } |
1281 | void KOMonthView::computeLayoutWeek() | 1287 | void KOMonthView::computeLayoutWeek() |
1282 | { | 1288 | { |
1283 | 1289 | ||
1284 | int daysToShow; | 1290 | int daysToShow; |
1285 | int tWid = topLevelWidget()->size().width(); | 1291 | int tWid = topLevelWidget()->size().width(); |
1286 | int tHei = topLevelWidget()->size().height(); | 1292 | int tHei = topLevelWidget()->size().height(); |
1287 | 1293 | ||
1288 | int wid = size().width();//e | 1294 | int wid = size().width();//e |
1289 | int hei = size().height()-1; | 1295 | int hei = size().height()-1; |
1290 | 1296 | ||
1291 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) | 1297 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) |
1292 | return; | 1298 | return; |
1293 | 1299 | ||
1294 | if ( wid < hei ) | 1300 | if ( wid < hei ) |
1295 | daysToShow = 2; | 1301 | daysToShow = 2; |
1296 | else | 1302 | else |
1297 | daysToShow = 3; | 1303 | daysToShow = 3; |
1298 | bool combinedSatSun = true; | 1304 | bool combinedSatSun = true; |
1299 | 1305 | ||
1300 | //qDebug("KOMonthView::computeLayout()------------------------------------ "); | 1306 | //qDebug("KOMonthView::computeLayout()------------------------------------ "); |
1301 | QFontMetrics fm ( mWeekLabels[0]->font() ); | 1307 | QFontMetrics fm ( mWeekLabels[0]->font() ); |
1302 | int weeklabelwid = fm.width( "888" ); | 1308 | int weeklabelwid = fm.width( "888" ); |
1303 | wid -= weeklabelwid; | 1309 | wid -= weeklabelwid; |
1304 | 1310 | ||
1305 | int colWid = wid / daysToShow; | 1311 | int colWid = wid / daysToShow; |
1306 | int lastCol = wid - ( colWid*6 ); | 1312 | int lastCol = wid - ( colWid*6 ); |
1307 | int dayLabelHei = mDayLabelsW[0]->sizeHint().height(); | 1313 | int dayLabelHei = mDayLabelsW[0]->sizeHint().height(); |
1308 | int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); | 1314 | int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); |
1309 | int colModulo = wid % daysToShow; | 1315 | int colModulo = wid % daysToShow; |
1310 | int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; | 1316 | int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; |
1311 | //qDebug("rowmod %d ", rowModulo); | 1317 | //qDebug("rowmod %d ", rowModulo); |
1312 | int i; | 1318 | int i; |
1313 | int x,y,w,h; | 1319 | int x,y,w,h; |
1314 | x= 0; | 1320 | x= 0; |
1315 | y= 0; | 1321 | y= 0; |
1316 | w = colWid; | 1322 | w = colWid; |
1317 | h = dayLabelHei ; | 1323 | h = dayLabelHei ; |
1318 | for ( i = 0; i < 7; i++) { | 1324 | for ( i = 0; i < 7; i++) { |
1319 | if ( i && !( i % daysToShow) && i < 6) { | 1325 | if ( i && !( i % daysToShow) && i < 6) { |
1320 | y += hei/(5-daysToShow); | 1326 | y += hei/(5-daysToShow); |
1321 | x = 0; | 1327 | x = 0; |
1322 | w = colWid; | 1328 | w = colWid; |
1323 | } | 1329 | } |
1324 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { | 1330 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { |
1325 | ++w; | 1331 | ++w; |
1326 | } | 1332 | } |
1327 | if ( i >= 5 ) { | 1333 | if ( i >= 5 ) { |
1328 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w/2+w%2,h); | 1334 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w/2+w%2,h); |
1329 | x -= (w/2 ); | 1335 | x -= (w/2 ); |
1330 | } | 1336 | } |
1331 | else | 1337 | else |
1332 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w,h); | 1338 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w,h); |
1333 | x += w; | 1339 | x += w; |
1334 | } | 1340 | } |
1335 | x= 0; | 1341 | x= 0; |
1336 | y= dayLabelHei; | 1342 | y= dayLabelHei; |
1337 | w = colWid; | 1343 | w = colWid; |
1338 | h = cellHei; | 1344 | h = cellHei; |
1339 | for ( i = 0; i < mCellsW.count(); ++i) { | 1345 | for ( i = 0; i < mCellsW.count(); ++i) { |
1340 | if ( i > 6 ) { | 1346 | if ( i > 6 ) { |
1341 | mCellsW[i]->hide(); | 1347 | mCellsW[i]->hide(); |
1342 | continue; | 1348 | continue; |
1343 | } | 1349 | } |
1344 | 1350 | ||
1345 | w = colWid; | 1351 | w = colWid; |
1346 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { | 1352 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { |
1347 | ++w; | 1353 | ++w; |
1348 | } | 1354 | } |
1349 | if ( i == (daysToShow-1-rowModulo)*7) | 1355 | if ( i == (daysToShow-1-rowModulo)*7) |
1350 | ++h; | 1356 | ++h; |
1351 | 1357 | ||
1352 | if ( i >= 5 ) { | 1358 | if ( i >= 5 ) { |
1353 | if ( i ==5 ) { | 1359 | if ( i ==5 ) { |
1354 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); | 1360 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); |
1355 | x -= w ;y += h/2; | 1361 | x -= w ;y += h/2; |
1356 | } else { | 1362 | } else { |
1357 | if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) { | 1363 | if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) { |
1358 | ++w; | 1364 | ++w; |
1359 | } | 1365 | } |
1360 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); | 1366 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); |
1361 | y -= h/2; | 1367 | y -= h/2; |
1362 | } | 1368 | } |
1363 | } else | 1369 | } else |
1364 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1370 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1365 | 1371 | ||
1366 | 1372 | ||
1367 | x += w; | 1373 | x += w; |
1368 | if ( x + w/2 > wid ) { | 1374 | if ( x + w/2 > wid ) { |
1369 | x = 0; | 1375 | x = 0; |
1370 | y += h+dayLabelHei ; | 1376 | y += h+dayLabelHei ; |
1371 | } | 1377 | } |
1372 | } | 1378 | } |
1373 | y= dayLabelHei; | 1379 | y= dayLabelHei; |
1374 | h = cellHei ; | 1380 | h = cellHei ; |
1375 | mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei); | 1381 | mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei); |
1376 | mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei); | 1382 | mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei); |
1377 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); | 1383 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); |
1378 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); | 1384 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); |
1379 | mShortDayLabelsW = mDayLabelsW[0]->width() < mWidthLongDayLabel ; | 1385 | mShortDayLabelsW = mDayLabelsW[0]->width() < mWidthLongDayLabel ; |
1380 | updateDayLabels(); | 1386 | updateDayLabels(); |
1381 | bool forceUpdate = !updatePossible; | 1387 | bool forceUpdate = !updatePossible; |
1382 | updatePossible = true; | 1388 | updatePossible = true; |
1383 | //mWeekLabels[mNumWeeks]->setText( i18n("M")); | 1389 | //mWeekLabels[mNumWeeks]->setText( i18n("M")); |
1384 | if ( forceUpdate ) | 1390 | if ( forceUpdate ) |
1385 | updateView(); | 1391 | updateView(); |
1386 | } | 1392 | } |
1387 | void KOMonthView::computeLayout() | 1393 | void KOMonthView::computeLayout() |
1388 | { | 1394 | { |
1389 | // select the appropriate heading string size. E.g. "Wednesday" or "Wed". | 1395 | // select the appropriate heading string size. E.g. "Wednesday" or "Wed". |
1390 | // note this only changes the text if the requested size crosses the | 1396 | // note this only changes the text if the requested size crosses the |
1391 | // threshold between big enough to support the full name and not big | 1397 | // threshold between big enough to support the full name and not big |
1392 | // enough. | 1398 | // enough. |
1393 | if ( mShowWeekView ){ | 1399 | if ( mShowWeekView ){ |
1394 | computeLayoutWeek(); | 1400 | computeLayoutWeek(); |
1395 | return; | 1401 | return; |
1396 | } | 1402 | } |
1397 | int daysToShow = 7; | 1403 | int daysToShow = 7; |
1398 | bool combinedSatSun = false; | 1404 | bool combinedSatSun = false; |
1399 | if (KOPrefs::instance()->mMonthViewSatSunTog ) { | 1405 | if (KOPrefs::instance()->mMonthViewSatSunTog ) { |
1400 | daysToShow = 6; | 1406 | daysToShow = 6; |
1401 | combinedSatSun = true; | 1407 | combinedSatSun = true; |
1402 | } | 1408 | } |
1403 | int tWid = topLevelWidget()->size().width(); | 1409 | int tWid = topLevelWidget()->size().width(); |
1404 | int tHei = topLevelWidget()->size().height(); | 1410 | int tHei = topLevelWidget()->size().height(); |
1405 | 1411 | ||
1406 | int wid = size().width();//e | 1412 | int wid = size().width();//e |
1407 | int hei = size().height()-1; | 1413 | int hei = size().height()-1; |
1408 | 1414 | ||
1409 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) | 1415 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) |
1410 | return; | 1416 | return; |
1411 | //qDebug("KOMonthView::computeLayout()------------------------------------ "); | 1417 | //qDebug("KOMonthView::computeLayout()------------------------------------ "); |
1412 | QFontMetrics fm ( mWeekLabels[0]->font() ); | 1418 | QFontMetrics fm ( mWeekLabels[0]->font() ); |
1413 | int weeklabelwid = fm.width( "888" ); | 1419 | int weeklabelwid = fm.width( "888" ); |
1414 | wid -= weeklabelwid; | 1420 | wid -= weeklabelwid; |
1415 | 1421 | ||
1416 | int colWid = wid / daysToShow; | 1422 | int colWid = wid / daysToShow; |
1417 | int lastCol = wid - ( colWid*6 ); | 1423 | int lastCol = wid - ( colWid*6 ); |
1418 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); | 1424 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); |
1419 | int cellHei = (hei - dayLabelHei) /6; | 1425 | int cellHei = (hei - dayLabelHei) /6; |
1420 | int colModulo = wid % daysToShow; | 1426 | int colModulo = wid % daysToShow; |
1421 | int rowModulo = (hei- dayLabelHei) % 6; | 1427 | int rowModulo = (hei- dayLabelHei) % 6; |
1422 | //qDebug("rowmod %d ", rowModulo); | 1428 | //qDebug("rowmod %d ", rowModulo); |
1423 | int i; | 1429 | int i; |
1424 | int x,y,w,h; | 1430 | int x,y,w,h; |
1425 | x= 0; | 1431 | x= 0; |
1426 | y= 0; | 1432 | y= 0; |
1427 | w = colWid; | 1433 | w = colWid; |
1428 | h = dayLabelHei ; | 1434 | h = dayLabelHei ; |
1429 | for ( i = 0; i < 7; i++) { | 1435 | for ( i = 0; i < 7; i++) { |
1430 | if ( i == daysToShow-colModulo ) | 1436 | if ( i == daysToShow-colModulo ) |
1431 | ++w; | 1437 | ++w; |
1432 | if ( combinedSatSun ) { | 1438 | if ( combinedSatSun ) { |
1433 | if ( i >= daysToShow-1 ) { | 1439 | if ( i >= daysToShow-1 ) { |
1434 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); | 1440 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); |
1435 | x -= w/2 ; | 1441 | x -= w/2 ; |
1436 | } | 1442 | } |
1437 | else | 1443 | else |
1438 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); | 1444 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); |
1439 | } else | 1445 | } else |
1440 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); | 1446 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); |
1441 | x += w; | 1447 | x += w; |
1442 | } | 1448 | } |
1443 | x= 0; | 1449 | x= 0; |
1444 | y= dayLabelHei; | 1450 | y= dayLabelHei; |
1445 | w = colWid; | 1451 | w = colWid; |
1446 | h = cellHei ; | 1452 | h = cellHei ; |
1447 | for ( i = 0; i < mCells.count(); ++i) { | 1453 | for ( i = 0; i < mCells.count(); ++i) { |
1448 | w = colWid; | 1454 | w = colWid; |
1449 | if ( ((i) % 7) >= 7-colModulo ) { | 1455 | if ( ((i) % 7) >= 7-colModulo ) { |
1450 | ++w; | 1456 | ++w; |
1451 | } | 1457 | } |
1452 | if ( i == (6-rowModulo)*7) | 1458 | if ( i == (6-rowModulo)*7) |
1453 | ++h; | 1459 | ++h; |
1454 | if ( combinedSatSun ) { | 1460 | if ( combinedSatSun ) { |
1455 | if ( (i)%7 >= daysToShow-1 ) { | 1461 | if ( (i)%7 >= daysToShow-1 ) { |
1456 | if ( (i)%7 == daysToShow-1 ) { | 1462 | if ( (i)%7 == daysToShow-1 ) { |
1457 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); | 1463 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); |
1458 | x -= w ;y += h/2; | 1464 | x -= w ;y += h/2; |
1459 | } else { | 1465 | } else { |
1460 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); | 1466 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); |
1461 | y -= h/2; | 1467 | y -= h/2; |
1462 | } | 1468 | } |
1463 | } else | 1469 | } else |
1464 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1470 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1465 | 1471 | ||
1466 | } | 1472 | } |
1467 | else | 1473 | else |
1468 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1474 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1469 | x += w; | 1475 | x += w; |
1470 | if ( x + w/2 > wid ) { | 1476 | if ( x + w/2 > wid ) { |
1471 | x = 0; | 1477 | x = 0; |
1472 | y += h; | 1478 | y += h; |
1473 | } | 1479 | } |
1474 | } | 1480 | } |
1475 | y= dayLabelHei; | 1481 | y= dayLabelHei; |
1476 | h = cellHei ; | 1482 | h = cellHei ; |
1477 | for ( i = 0; i < 6; i++) { | 1483 | for ( i = 0; i < 6; i++) { |
1478 | if ( i == (6-rowModulo)) | 1484 | if ( i == (6-rowModulo)) |
1479 | ++h; | 1485 | ++h; |
1480 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); | 1486 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); |
1481 | y += h; | 1487 | y += h; |
1482 | } | 1488 | } |
1483 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); | 1489 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); |
1484 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); | 1490 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); |
1485 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); | 1491 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); |
1486 | mShortDayLabelsM = mDayLabels[0]->width() < mWidthLongDayLabel ; | 1492 | mShortDayLabelsM = mDayLabels[0]->width() < mWidthLongDayLabel ; |
1487 | qDebug("dlwid %d %d ",mDayLabels[0]->width() , mWidthLongDayLabel); | 1493 | qDebug("dlwid %d %d ",mDayLabels[0]->width() , mWidthLongDayLabel); |
1488 | updateDayLabels(); | 1494 | updateDayLabels(); |
1489 | bool forceUpdate = !updatePossible; | 1495 | bool forceUpdate = !updatePossible; |
1490 | updatePossible = true; | 1496 | updatePossible = true; |
1491 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); | 1497 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); |
1492 | if ( forceUpdate ) | 1498 | if ( forceUpdate ) |
1493 | updateView(); | 1499 | updateView(); |
1494 | } | 1500 | } |
1495 | 1501 | ||
1496 | void KOMonthView::showContextMenu( Incidence *incidence ) | 1502 | void KOMonthView::showContextMenu( Incidence *incidence ) |
1497 | { | 1503 | { |
1498 | mContextMenu->showIncidencePopup(incidence); | 1504 | mContextMenu->showIncidencePopup(incidence); |
1499 | /* | 1505 | /* |
1500 | if( incidence && incidence->type() == "Event" ) { | 1506 | if( incidence && incidence->type() == "Event" ) { |
1501 | Event *event = static_cast<Event *>(incidence); | 1507 | Event *event = static_cast<Event *>(incidence); |
1502 | mContextMenu->showEventPopup(event); | 1508 | mContextMenu->showEventPopup(event); |
1503 | } else { | 1509 | } else { |
1504 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; | 1510 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; |
1505 | } | 1511 | } |
1506 | */ | 1512 | */ |
1507 | } | 1513 | } |
1508 | MonthViewCell * KOMonthView::selectedCell( ) | 1514 | MonthViewCell * KOMonthView::selectedCell( ) |
1509 | { | 1515 | { |
1510 | return mSelectedCell; | 1516 | return mSelectedCell; |
1511 | } | 1517 | } |
1512 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) | 1518 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) |
1513 | { | 1519 | { |
1514 | // qDebug("KOMonthView::setSelectedCell "); | 1520 | //qDebug("KOMonthView::setSelectedCell %x ", cell); |
1515 | if ( mSelectedCell && mSelectedCell != cell ) { | 1521 | if ( mSelectedCell && mSelectedCell != cell ) { |
1516 | MonthViewCell * mvc = mSelectedCell; | 1522 | MonthViewCell * mvc = mSelectedCell; |
1517 | mSelectedCell = cell; | 1523 | mSelectedCell = cell; |
1518 | mvc->deselect(); | 1524 | mvc->deselect(); |
1519 | } else | 1525 | } else |
1520 | mSelectedCell = cell; | 1526 | mSelectedCell = cell; |
1521 | // if ( mSelectedCell ) | 1527 | // if ( mSelectedCell ) |
1522 | // mSelectedCell->select(); | 1528 | // mSelectedCell->select(); |
1523 | if ( !mSelectedCell ) | 1529 | if ( !mSelectedCell ) |
1524 | emit incidenceSelected( 0 ); | 1530 | emit incidenceSelected( 0 ); |
1525 | else | 1531 | else |
1526 | emit incidenceSelected( mSelectedCell->selectedIncidence() ); | 1532 | emit incidenceSelected( mSelectedCell->selectedIncidence() ); |
1527 | } | 1533 | } |
1528 | 1534 | ||
1529 | void KOMonthView::processSelectionChange() | 1535 | void KOMonthView::processSelectionChange() |
1530 | { | 1536 | { |
1531 | QPtrList<Incidence> incidences = selectedIncidences(); | 1537 | QPtrList<Incidence> incidences = selectedIncidences(); |
1532 | if (incidences.count() > 0) { | 1538 | if (incidences.count() > 0) { |
1533 | emit incidenceSelected( incidences.first() ); | 1539 | emit incidenceSelected( incidences.first() ); |
1534 | } else { | 1540 | } else { |
1535 | emit incidenceSelected( 0 ); | 1541 | emit incidenceSelected( 0 ); |
1536 | } | 1542 | } |
1537 | } | 1543 | } |
1538 | 1544 | ||
1539 | void KOMonthView::clearSelection() | 1545 | void KOMonthView::clearSelection() |
1540 | { | 1546 | { |
1541 | if ( mSelectedCell ) { | 1547 | if ( mSelectedCell ) { |
1542 | mSelectedCell->deselect(); | 1548 | mSelectedCell->deselect(); |
1543 | mSelectedCell = 0; | 1549 | mSelectedCell = 0; |
1544 | } | 1550 | } |
1545 | } | 1551 | } |
1546 | void KOMonthView::keyPressEvent ( QKeyEvent * e ) | 1552 | void KOMonthView::keyPressEvent ( QKeyEvent * e ) |
1547 | { | 1553 | { |
1548 | //qDebug("KOMonthView::keyPressEvent "); | 1554 | //qDebug("KOMonthView::keyPressEvent "); |
1549 | switch(e->key()) { | 1555 | switch(e->key()) { |
1550 | case Key_Up: | 1556 | case Key_Up: |
1551 | { | 1557 | { |
1552 | emit prevMonth(); | 1558 | emit prevMonth(); |
1553 | mCells[0]->setFocus(); | 1559 | if ( mShowWeekView ) |
1560 | mCellsW[0]->setFocus(); | ||
1561 | else | ||
1562 | mCells[0]->setFocus(); | ||
1554 | } | 1563 | } |
1555 | e->accept(); | 1564 | e->accept(); |
1556 | break; | 1565 | break; |
1557 | case Key_Down: | 1566 | case Key_Down: |
1558 | { | 1567 | { |
1559 | emit nextMonth(); | 1568 | emit nextMonth(); |
1560 | mCells[0]->setFocus(); | 1569 | if ( mShowWeekView ) |
1561 | 1570 | mCellsW[0]->setFocus(); | |
1571 | else | ||
1572 | mCells[0]->setFocus(); | ||
1573 | |||
1562 | } | 1574 | } |
1563 | e->accept(); | 1575 | e->accept(); |
1564 | break; | 1576 | break; |
1565 | case Key_Return: | 1577 | case Key_Return: |
1566 | case Key_Enter: | 1578 | case Key_Enter: |
1567 | { | 1579 | { |
1568 | selectInternalWeekNum ( currentWeek() ); | 1580 | selectInternalWeekNum ( currentWeek() ); |
1569 | } | 1581 | } |
1570 | e->accept(); | 1582 | e->accept(); |
1571 | break; | 1583 | break; |
1572 | default: | 1584 | default: |
1573 | e->ignore(); | 1585 | e->ignore(); |
1574 | break; | 1586 | break; |
1575 | } | 1587 | } |
1576 | } | 1588 | } |
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index 9dbe319..d70cda1 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h | |||
@@ -1,297 +1,298 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #ifndef _KOMONTHVIEW_H | 20 | #ifndef _KOMONTHVIEW_H |
21 | #define _KOMONTHVIEW_H | 21 | #define _KOMONTHVIEW_H |
22 | 22 | ||
23 | #include <qlabel.h> | 23 | #include <qlabel.h> |
24 | #include <qframe.h> | 24 | #include <qframe.h> |
25 | #include <qdatetime.h> | 25 | #include <qdatetime.h> |
26 | #include <qlistbox.h> | 26 | #include <qlistbox.h> |
27 | #include <qpoint.h> | 27 | #include <qpoint.h> |
28 | #include <qwidgetstack.h> | 28 | #include <qwidgetstack.h> |
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | #include <qintdict.h> | 30 | #include <qintdict.h> |
31 | #include <qpushbutton.h> | 31 | #include <qpushbutton.h> |
32 | #include <qvaluelist.h> | 32 | #include <qvaluelist.h> |
33 | #include <qptrvector.h> | 33 | #include <qptrvector.h> |
34 | 34 | ||
35 | #include <libkcal/calendar.h> | 35 | #include <libkcal/calendar.h> |
36 | #include <libkcal/event.h> | 36 | #include <libkcal/event.h> |
37 | 37 | ||
38 | #include "koeventview.h" | 38 | #include "koeventview.h" |
39 | 39 | ||
40 | #ifdef DESKTOP_VERSION | 40 | #ifdef DESKTOP_VERSION |
41 | class QToolTipGroup; | 41 | class QToolTipGroup; |
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | class KNOWhatsThis; | 44 | class KNOWhatsThis; |
45 | class KOWeekButton : public QPushButton | 45 | class KOWeekButton : public QPushButton |
46 | { | 46 | { |
47 | Q_OBJECT | 47 | Q_OBJECT |
48 | public: | 48 | public: |
49 | KOWeekButton( QWidget *parent=0, const char *name=0 ) : | 49 | KOWeekButton( QWidget *parent=0, const char *name=0 ) : |
50 | QPushButton( parent, name) | 50 | QPushButton( parent, name) |
51 | { | 51 | { |
52 | connect( this, SIGNAL( clicked() ), | 52 | connect( this, SIGNAL( clicked() ), |
53 | SLOT( bottonClicked() )); | 53 | SLOT( bottonClicked() )); |
54 | mNumber = -1; | 54 | mNumber = -1; |
55 | } | 55 | } |
56 | void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));} | 56 | void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));} |
57 | int getWeekNum() { return mNumber;} | 57 | int getWeekNum() { return mNumber;} |
58 | signals: | 58 | signals: |
59 | void selectWeekNum ( int ); | 59 | void selectWeekNum ( int ); |
60 | private: | 60 | private: |
61 | int mNumber; | 61 | int mNumber; |
62 | private slots : | 62 | private slots : |
63 | void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } | 63 | void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } |
64 | }; | 64 | }; |
65 | 65 | ||
66 | class KNoScrollListBox: public QListBox | 66 | class KNoScrollListBox: public QListBox |
67 | { | 67 | { |
68 | Q_OBJECT | 68 | Q_OBJECT |
69 | public: | 69 | public: |
70 | KNoScrollListBox(QWidget *parent=0, const char *name=0); | 70 | KNoScrollListBox(QWidget *parent=0, const char *name=0); |
71 | ~KNoScrollListBox(); | 71 | ~KNoScrollListBox(); |
72 | QString getWhatsThisText(QPoint p) ; | 72 | QString getWhatsThisText(QPoint p) ; |
73 | 73 | ||
74 | signals: | 74 | signals: |
75 | void shiftDown(); | 75 | void shiftDown(); |
76 | void shiftUp(); | 76 | void shiftUp(); |
77 | void rightClick(); | 77 | void rightClick(); |
78 | 78 | ||
79 | protected slots: | 79 | protected slots: |
80 | void oneDown(); | 80 | void oneDown(); |
81 | void keyPressEvent(QKeyEvent *); | 81 | void keyPressEvent(QKeyEvent *); |
82 | void keyReleaseEvent(QKeyEvent *); | 82 | void keyReleaseEvent(QKeyEvent *); |
83 | void mousePressEvent(QMouseEvent *); | 83 | void mousePressEvent(QMouseEvent *); |
84 | 84 | ||
85 | private: | 85 | private: |
86 | KNOWhatsThis * mWT; | 86 | KNOWhatsThis * mWT; |
87 | }; | 87 | }; |
88 | 88 | ||
89 | 89 | ||
90 | class MonthViewItem: public QListBoxItem | 90 | class MonthViewItem: public QListBoxItem |
91 | { | 91 | { |
92 | public: | 92 | public: |
93 | MonthViewItem( Incidence *, QDate qd, const QString & title ); | 93 | MonthViewItem( Incidence *, QDate qd, const QString & title ); |
94 | 94 | ||
95 | void setRecur(bool on) { mRecur = on; } | 95 | void setRecur(bool on) { mRecur = on; } |
96 | void setAlarm(bool on) { mAlarm = on; } | 96 | void setAlarm(bool on) { mAlarm = on; } |
97 | void setReply(bool on) { mReply = on; } | 97 | void setReply(bool on) { mReply = on; } |
98 | void setMoreInfo(bool on) { mInfo = on; } | 98 | void setMoreInfo(bool on) { mInfo = on; } |
99 | 99 | ||
100 | 100 | ||
101 | void setPalette(const QPalette &p) { mPalette = p; } | 101 | void setPalette(const QPalette &p) { mPalette = p; } |
102 | QPalette palette() const { return mPalette; } | 102 | QPalette palette() const { return mPalette; } |
103 | 103 | ||
104 | Incidence *incidence() const { return mIncidence; } | 104 | Incidence *incidence() const { return mIncidence; } |
105 | QDate incidenceDate() { return mDate; } | 105 | QDate incidenceDate() { return mDate; } |
106 | 106 | ||
107 | protected: | 107 | protected: |
108 | virtual void paint(QPainter *); | 108 | virtual void paint(QPainter *); |
109 | virtual int height(const QListBox *) const; | 109 | virtual int height(const QListBox *) const; |
110 | virtual int width(const QListBox *) const; | 110 | virtual int width(const QListBox *) const; |
111 | 111 | ||
112 | private: | 112 | private: |
113 | bool mRecur; | 113 | bool mRecur; |
114 | bool mAlarm; | 114 | bool mAlarm; |
115 | bool mReply; | 115 | bool mReply; |
116 | bool mInfo; | 116 | bool mInfo; |
117 | 117 | ||
118 | QPalette mPalette; | 118 | QPalette mPalette; |
119 | QDate mDate; | 119 | QDate mDate; |
120 | 120 | ||
121 | Incidence *mIncidence; | 121 | Incidence *mIncidence; |
122 | }; | 122 | }; |
123 | 123 | ||
124 | 124 | ||
125 | class KOMonthView; | 125 | class KOMonthView; |
126 | 126 | ||
127 | class MonthViewCell : public QWidget | 127 | class MonthViewCell : public QWidget |
128 | { | 128 | { |
129 | Q_OBJECT | 129 | Q_OBJECT |
130 | public: | 130 | public: |
131 | MonthViewCell(KOMonthView *,QWidget* ); | 131 | MonthViewCell(KOMonthView *,QWidget* ); |
132 | 132 | ||
133 | void setDate( const QDate & ); | 133 | void setDate( const QDate & ); |
134 | QDate date() const; | 134 | QDate date() const; |
135 | 135 | ||
136 | void setPrimary( bool ); | 136 | void setPrimary( bool ); |
137 | bool isPrimary() const; | 137 | bool isPrimary() const; |
138 | 138 | ||
139 | void setHoliday( bool ); | 139 | void setHoliday( bool ); |
140 | void setHoliday( const QString & ); | 140 | void setHoliday( const QString & ); |
141 | 141 | ||
142 | void updateCell(); | 142 | void updateCell(); |
143 | void startUpdateCell(); | 143 | void startUpdateCell(); |
144 | void finishUpdateCell(); | 144 | void finishUpdateCell(); |
145 | void insertEvent(Event *); | 145 | void insertEvent(Event *); |
146 | void insertTodo(Todo *); | 146 | void insertTodo(Todo *); |
147 | 147 | ||
148 | void updateConfig( bool bigFont = false ); | 148 | void updateConfig( bool bigFont = false ); |
149 | 149 | ||
150 | void enableScrollBars( bool ); | 150 | void enableScrollBars( bool ); |
151 | 151 | ||
152 | Incidence *selectedIncidence(); | 152 | Incidence *selectedIncidence(); |
153 | QDate selectedIncidenceDate(); | 153 | QDate selectedIncidenceDate(); |
154 | 154 | ||
155 | void deselect(); | 155 | void deselect(); |
156 | void select(); | 156 | void select(); |
157 | void clear(); | 157 | void clear(); |
158 | 158 | ||
159 | #ifdef DESKTOP_VERSION | 159 | #ifdef DESKTOP_VERSION |
160 | static QToolTipGroup *toolTipGroup(); | 160 | static QToolTipGroup *toolTipGroup(); |
161 | #endif | 161 | #endif |
162 | signals: | 162 | signals: |
163 | void defaultAction( Incidence * ); | 163 | void defaultAction( Incidence * ); |
164 | void newEventSignal( QDateTime ); | 164 | void newEventSignal( QDateTime ); |
165 | void showDaySignal( QDate ); | 165 | void showDaySignal( QDate ); |
166 | 166 | ||
167 | protected: | 167 | protected: |
168 | QString mToolTip; | 168 | QString mToolTip; |
169 | void resizeEvent( QResizeEvent * ); | 169 | void resizeEvent( QResizeEvent * ); |
170 | 170 | ||
171 | protected slots: | 171 | protected slots: |
172 | void defaultAction( QListBoxItem * ); | 172 | void defaultAction( QListBoxItem * ); |
173 | void contextMenu( QListBoxItem * ); | 173 | void contextMenu( QListBoxItem * ); |
174 | void selection( QListBoxItem * ); | 174 | void selection( QListBoxItem * ); |
175 | void cellClicked( QListBoxItem * ); | 175 | void cellClicked( QListBoxItem * ); |
176 | void newEvent(); | 176 | void newEvent(); |
177 | void showDay(); | 177 | void showDay(); |
178 | 178 | ||
179 | private: | 179 | private: |
180 | KOMonthView *mMonthView; | 180 | KOMonthView *mMonthView; |
181 | 181 | ||
182 | QDate mDate; | 182 | QDate mDate; |
183 | bool mPrimary; | 183 | bool mPrimary; |
184 | bool mHoliday; | 184 | bool mHoliday; |
185 | QString mHolidayString; | 185 | QString mHolidayString; |
186 | 186 | ||
187 | //QLabel *mLabel; | 187 | //QLabel *mLabel; |
188 | QPushButton *mLabel; | 188 | QPushButton *mLabel; |
189 | QListBox *mItemList; | 189 | QListBox *mItemList; |
190 | #ifdef DESKTOP_VERSION | 190 | #ifdef DESKTOP_VERSION |
191 | static QToolTipGroup *mToolTipGroup; | 191 | static QToolTipGroup *mToolTipGroup; |
192 | #endif | 192 | #endif |
193 | QSize mLabelSize; | 193 | QSize mLabelSize; |
194 | QSize mLabelBigSize; | 194 | QSize mLabelBigSize; |
195 | QPalette mHolidayPalette; | 195 | QPalette mHolidayPalette; |
196 | QPalette mStandardPalette; | 196 | QPalette mStandardPalette; |
197 | QPalette mPrimaryPalette; | 197 | QPalette mPrimaryPalette; |
198 | QPalette mNonPrimaryPalette; | 198 | QPalette mNonPrimaryPalette; |
199 | void setMyPalette(); | 199 | void setMyPalette(); |
200 | QPalette getPalette (); | 200 | QPalette getPalette (); |
201 | void keyPressEvent ( QKeyEvent * ) ; | 201 | void keyPressEvent ( QKeyEvent * ) ; |
202 | 202 | ||
203 | }; | 203 | }; |
204 | 204 | ||
205 | 205 | ||
206 | class KOMonthView: public KOEventView | 206 | class KOMonthView: public KOEventView |
207 | { | 207 | { |
208 | Q_OBJECT | 208 | Q_OBJECT |
209 | public: | 209 | public: |
210 | KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); | 210 | KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); |
211 | ~KOMonthView(); | 211 | ~KOMonthView(); |
212 | 212 | ||
213 | /** Returns maximum number of days supported by the komonthview */ | 213 | /** Returns maximum number of days supported by the komonthview */ |
214 | virtual int maxDatesHint(); | 214 | virtual int maxDatesHint(); |
215 | 215 | ||
216 | /** Returns number of currently shown dates. */ | 216 | /** Returns number of currently shown dates. */ |
217 | virtual int currentDateCount(); | 217 | virtual int currentDateCount(); |
218 | 218 | ||
219 | /** returns the currently selected events */ | 219 | /** returns the currently selected events */ |
220 | virtual QPtrList<Incidence> selectedIncidences(); | 220 | virtual QPtrList<Incidence> selectedIncidences(); |
221 | 221 | ||
222 | /** returns dates of the currently selected events */ | 222 | /** returns dates of the currently selected events */ |
223 | virtual DateList selectedDates(); | 223 | virtual DateList selectedDates(); |
224 | 224 | ||
225 | virtual void printPreview(CalPrinter *calPrinter, | 225 | virtual void printPreview(CalPrinter *calPrinter, |
226 | const QDate &, const QDate &); | 226 | const QDate &, const QDate &); |
227 | bool isMonthView() { return true; } | 227 | bool isMonthView() { return true; } |
228 | bool isUpdatePossible() { return updatePossible; } | 228 | bool isUpdatePossible() { return updatePossible; } |
229 | void setIgnoreResizeEvent( int c ) { ignoreResizeEvent = c ;} | 229 | void setIgnoreResizeEvent( int c, int h ) { ignoreResizeEvent = c ;ignoreResizeEventHeight = h;} |
230 | 230 | ||
231 | MonthViewCell * selectedCell(); | 231 | MonthViewCell * selectedCell(); |
232 | public slots: | 232 | public slots: |
233 | virtual void updateView(); | 233 | virtual void updateView(); |
234 | virtual void updateConfig(); | 234 | virtual void updateConfig(); |
235 | virtual void showDates(const QDate &start, const QDate &end); | 235 | virtual void showDates(const QDate &start, const QDate &end); |
236 | virtual void showEvents(QPtrList<Event> eventList); | 236 | virtual void showEvents(QPtrList<Event> eventList); |
237 | 237 | ||
238 | void changeEventDisplay(Event *, int); | 238 | void changeEventDisplay(Event *, int); |
239 | 239 | ||
240 | void clearSelection(); | 240 | void clearSelection(); |
241 | 241 | ||
242 | void showContextMenu( Incidence * ); | 242 | void showContextMenu( Incidence * ); |
243 | 243 | ||
244 | void setSelectedCell( MonthViewCell * ); | 244 | void setSelectedCell( MonthViewCell * ); |
245 | 245 | ||
246 | protected slots: | 246 | protected slots: |
247 | void selectInternalWeekNum ( int ); | 247 | void selectInternalWeekNum ( int ); |
248 | void switchView(); | 248 | void switchView(); |
249 | void processSelectionChange(); | 249 | void processSelectionChange(); |
250 | signals: | 250 | signals: |
251 | void nextMonth(); | 251 | void nextMonth(); |
252 | void prevMonth(); | 252 | void prevMonth(); |
253 | void showNavigator( bool ); | 253 | void showNavigator( bool ); |
254 | void selectWeekNum ( int ); | 254 | void selectWeekNum ( int ); |
255 | void showDaySignal( QDate ); | 255 | void showDaySignal( QDate ); |
256 | protected: | 256 | protected: |
257 | void resizeEvent(QResizeEvent *); | 257 | void resizeEvent(QResizeEvent *); |
258 | void viewChanged(); | 258 | void viewChanged(); |
259 | void updateDayLabels(); | 259 | void updateDayLabels(); |
260 | 260 | ||
261 | private: | 261 | private: |
262 | int ignoreResizeEvent; | 262 | int ignoreResizeEvent; |
263 | int ignoreResizeEventHeight; | ||
263 | int currentWeek(); | 264 | int currentWeek(); |
264 | bool clPending; | 265 | bool clPending; |
265 | QWidgetStack * mWidStack; | 266 | QWidgetStack * mWidStack; |
266 | QWidget* mMonthView; | 267 | QWidget* mMonthView; |
267 | QWidget* mWeekView; | 268 | QWidget* mWeekView; |
268 | bool mShowWeekView; | 269 | bool mShowWeekView; |
269 | bool updatePossible; | 270 | bool updatePossible; |
270 | int mDaysPerWeek; | 271 | int mDaysPerWeek; |
271 | int mNumWeeks; | 272 | int mNumWeeks; |
272 | int mNumCells; | 273 | int mNumCells; |
273 | bool mWeekStartsMonday; | 274 | bool mWeekStartsMonday; |
274 | void computeLayout(); | 275 | void computeLayout(); |
275 | void computeLayoutWeek(); | 276 | void computeLayoutWeek(); |
276 | 277 | ||
277 | QPtrVector<MonthViewCell> mCells; | 278 | QPtrVector<MonthViewCell> mCells; |
278 | QPtrVector<QLabel> mDayLabels; | 279 | QPtrVector<QLabel> mDayLabels; |
279 | QPtrVector<KOWeekButton> mWeekLabels; | 280 | QPtrVector<KOWeekButton> mWeekLabels; |
280 | QPtrVector<MonthViewCell> mCellsW; | 281 | QPtrVector<MonthViewCell> mCellsW; |
281 | QPtrVector<QLabel> mDayLabelsW; | 282 | QPtrVector<QLabel> mDayLabelsW; |
282 | QPtrVector<KOWeekButton> mWeekLabelsW; | 283 | QPtrVector<KOWeekButton> mWeekLabelsW; |
283 | 284 | ||
284 | bool mShortDayLabelsM; | 285 | bool mShortDayLabelsM; |
285 | bool mShortDayLabelsW; | 286 | bool mShortDayLabelsW; |
286 | int mWidthLongDayLabel; | 287 | int mWidthLongDayLabel; |
287 | 288 | ||
288 | QDate mStartDate; | 289 | QDate mStartDate; |
289 | 290 | ||
290 | MonthViewCell *mSelectedCell; | 291 | MonthViewCell *mSelectedCell; |
291 | 292 | ||
292 | KOEventPopupMenu *mContextMenu; | 293 | KOEventPopupMenu *mContextMenu; |
293 | void keyPressEvent ( QKeyEvent * ) ; | 294 | void keyPressEvent ( QKeyEvent * ) ; |
294 | 295 | ||
295 | }; | 296 | }; |
296 | 297 | ||
297 | #endif | 298 | #endif |
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index dcb51dc..c35de0a 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp | |||
@@ -1,610 +1,611 @@ | |||
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 | void KOViewManager::showDateView( int view, QDate date) | 101 | void KOViewManager::showDateView( int view, QDate date) |
102 | { | 102 | { |
103 | static int lastMode = 0; | 103 | static int lastMode = 0; |
104 | static int lastCount = 0; | 104 | static int lastCount = 0; |
105 | static bool lastNDMode = false; | 105 | static bool lastNDMode = false; |
106 | static QDate lastDate; | 106 | static QDate lastDate; |
107 | //qDebug("date %d %s", view, date.toString().latin1()); | 107 | //qDebug("date %d %s", view, date.toString().latin1()); |
108 | 108 | ||
109 | //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays ); | 109 | //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays ); |
110 | bool savemFlagShowNextxDays = mFlagShowNextxDays; | 110 | bool savemFlagShowNextxDays = mFlagShowNextxDays; |
111 | mFlagShowNextxDays = false; | 111 | mFlagShowNextxDays = false; |
112 | if ( view == 3 ) { | 112 | if ( view == 3 ) { |
113 | //mCurrentAgendaView = 1 ; | 113 | //mCurrentAgendaView = 1 ; |
114 | lastDate = mMainView->dateNavigator()->selectedDates().first(); | 114 | lastDate = mMainView->dateNavigator()->selectedDates().first(); |
115 | lastCount = mMainView->dateNavigator()->selectedDates().count(); | 115 | lastCount = mMainView->dateNavigator()->selectedDates().count(); |
116 | lastNDMode = savemFlagShowNextxDays; | 116 | lastNDMode = savemFlagShowNextxDays; |
117 | mMainView->showDay( date ); | 117 | mMainView->showDay( date ); |
118 | } else if (view == 4 ) { | 118 | } else if (view == 4 ) { |
119 | mCurrentAgendaView = 7 ; | 119 | mCurrentAgendaView = 7 ; |
120 | mMainView->dateNavigator()->selectDates( date, 7 ); | 120 | mMainView->dateNavigator()->selectDates( date, 7 ); |
121 | } else if (view == 5 ) { | 121 | } else if (view == 5 ) { |
122 | mCurrentAgendaView = 14 ; | 122 | mCurrentAgendaView = 14 ; |
123 | mMainView->dateNavigator()->selectDates( date, 14); | 123 | mMainView->dateNavigator()->selectDates( date, 14); |
124 | } else if (view == 6 ) { | 124 | } else if (view == 6 ) { |
125 | //mMainView->dateNavigator()->selectDates( date, 7 ); | 125 | //mMainView->dateNavigator()->selectDates( date, 7 ); |
126 | showMonthView(); | 126 | showMonthView(); |
127 | } else if (view == 7 ) { | 127 | } else if (view == 7 ) { |
128 | mMainView->dateNavigator()->selectDate( date ); | 128 | mMainView->dateNavigator()->selectDate( date ); |
129 | showJournalView(); | 129 | showJournalView(); |
130 | } else if (view == 8 ) { | 130 | } else if (view == 8 ) { |
131 | globalFlagBlockAgenda = 1; | 131 | globalFlagBlockAgenda = 1; |
132 | if ( mCurrentAgendaView != 3 ) | 132 | if ( mCurrentAgendaView != 3 ) |
133 | mCurrentAgendaView = -1; | 133 | mCurrentAgendaView = -1; |
134 | showAgendaView(KOPrefs::instance()->mFullViewMonth); | 134 | showAgendaView(KOPrefs::instance()->mFullViewMonth); |
135 | globalFlagBlockAgenda = 2; | 135 | globalFlagBlockAgenda = 2; |
136 | mMainView->dateNavigator()->selectDates( date , | 136 | mMainView->dateNavigator()->selectDates( date , |
137 | KOPrefs::instance()->mNextXDays ); | 137 | KOPrefs::instance()->mNextXDays ); |
138 | mFlagShowNextxDays = true; | 138 | mFlagShowNextxDays = true; |
139 | mCurrentAgendaView = 3 ; | 139 | mCurrentAgendaView = 3 ; |
140 | } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode ) | 140 | } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode ) |
141 | if ( lastMode ) { | 141 | if ( lastMode ) { |
142 | mCurrentAgendaView = lastCount ; | 142 | mCurrentAgendaView = lastCount ; |
143 | mMainView->dateNavigator()->selectDates( lastDate, lastCount); | 143 | mMainView->dateNavigator()->selectDates( lastDate, lastCount); |
144 | mFlagShowNextxDays = lastNDMode; | 144 | mFlagShowNextxDays = lastNDMode; |
145 | if ( mFlagShowNextxDays ) { | 145 | if ( mFlagShowNextxDays ) { |
146 | mCurrentAgendaView = 3 ; | 146 | mCurrentAgendaView = 3 ; |
147 | } | 147 | } |
148 | } else | 148 | } else |
149 | showWeekView(); | 149 | showWeekView(); |
150 | } else if (view == 10) { | 150 | } else if (view == 10) { |
151 | mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() ); | 151 | mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() ); |
152 | } | 152 | } |
153 | lastMode = view; | 153 | lastMode = view; |
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 | if ( true /* !KOPrefs::instance()->mMonthViewWeek*/ ) { | 225 | if ( true /* !KOPrefs::instance()->mMonthViewWeek*/ ) { |
226 | mMonthView->setIgnoreResizeEvent( 2 ); | 226 | |
227 | mMonthView->setIgnoreResizeEvent( 2 ,mMainView->navigatorBar()->height()); | ||
227 | mMainView->navigatorBar()->show(); | 228 | mMainView->navigatorBar()->show(); |
228 | hei -= mMainView->navigatorBar()->sizeHint().height(); | 229 | hei -= mMainView->navigatorBar()->sizeHint().height(); |
229 | } | 230 | } |
230 | //mMainView->navigatorBar()->hide(); | 231 | //mMainView->navigatorBar()->hide(); |
231 | } else { | 232 | } else { |
232 | mMainView->navigatorBar()->hide(); | 233 | mMainView->navigatorBar()->hide(); |
233 | } | 234 | } |
234 | if ( fullScreen ) { | 235 | if ( fullScreen ) { |
235 | mMainView->leftFrame()->hide(); | 236 | mMainView->leftFrame()->hide(); |
236 | } else { | 237 | } else { |
237 | mMainView->leftFrame()->show(); | 238 | mMainView->leftFrame()->show(); |
238 | if ( KOPrefs::instance()->mVerticalScreen ) | 239 | if ( KOPrefs::instance()->mVerticalScreen ) |
239 | hei -= mMainView->leftFrame()->height(); | 240 | hei -= mMainView->leftFrame()->height(); |
240 | else | 241 | else |
241 | wid -= mMainView->leftFrame()->width(); | 242 | wid -= mMainView->leftFrame()->width(); |
242 | } | 243 | } |
243 | emit signalFullScreen( !fullScreen ); | 244 | emit signalFullScreen( !fullScreen ); |
244 | if ( callUpdateView ) | 245 | if ( callUpdateView ) |
245 | mMainView->updateView(); | 246 | mMainView->updateView(); |
246 | 247 | ||
247 | if ( globalFlagBlockAgenda == 5 ) { | 248 | if ( globalFlagBlockAgenda == 5 ) { |
248 | globalFlagBlockAgenda = 4; | 249 | globalFlagBlockAgenda = 4; |
249 | globalFlagBlockAgendaItemPaint = 1; | 250 | globalFlagBlockAgendaItemPaint = 1; |
250 | } | 251 | } |
251 | mMainView->viewStack()->raiseWidget(mCurrentView); | 252 | mMainView->viewStack()->raiseWidget(mCurrentView); |
252 | if ( globalFlagBlockAgenda == 4 ) { | 253 | if ( globalFlagBlockAgenda == 4 ) { |
253 | if ( mCurrentView == mAgendaView ) { | 254 | if ( mCurrentView == mAgendaView ) { |
254 | //globalFlagBlockAgenda =1 ; | 255 | //globalFlagBlockAgenda =1 ; |
255 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) | 256 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) |
256 | mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); | 257 | mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); |
257 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) | 258 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) |
258 | mAgendaView->setStartHour( QTime::currentTime ().hour() ); | 259 | mAgendaView->setStartHour( QTime::currentTime ().hour() ); |
259 | qApp->processEvents(); | 260 | qApp->processEvents(); |
260 | //qDebug("qApp->processEvents() "); | 261 | //qDebug("qApp->processEvents() "); |
261 | globalFlagBlockAgenda = 0; | 262 | globalFlagBlockAgenda = 0; |
262 | mAgendaView->repaintAgenda(); | 263 | mAgendaView->repaintAgenda(); |
263 | 264 | ||
264 | } | 265 | } |
265 | globalFlagBlockAgenda = 0; | 266 | globalFlagBlockAgenda = 0; |
266 | } | 267 | } |
267 | emit signalAgendaView( mCurrentView == mAgendaView ); | 268 | emit signalAgendaView( mCurrentView == mAgendaView ); |
268 | //qDebug("raiseCurrentView ende "); | 269 | //qDebug("raiseCurrentView ende "); |
269 | 270 | ||
270 | } | 271 | } |
271 | 272 | ||
272 | void KOViewManager::updateView() | 273 | void KOViewManager::updateView() |
273 | { | 274 | { |
274 | // qDebug("KOViewManager::updateView() "); | 275 | // qDebug("KOViewManager::updateView() "); |
275 | // if we are updating mTodoView, we get endless recursion | 276 | // if we are updating mTodoView, we get endless recursion |
276 | if ( mTodoView == mCurrentView ) | 277 | if ( mTodoView == mCurrentView ) |
277 | return; | 278 | return; |
278 | if ( mCurrentView ) mCurrentView->updateView(); | 279 | if ( mCurrentView ) mCurrentView->updateView(); |
279 | 280 | ||
280 | } | 281 | } |
281 | 282 | ||
282 | void KOViewManager::updateView(const QDate &start, const QDate &end) | 283 | void KOViewManager::updateView(const QDate &start, const QDate &end) |
283 | { | 284 | { |
284 | // kdDebug() << "KOViewManager::updateView()" << endl; | 285 | // kdDebug() << "KOViewManager::updateView()" << endl; |
285 | 286 | ||
286 | if (mCurrentView) mCurrentView->showDates(start, end); | 287 | if (mCurrentView) mCurrentView->showDates(start, end); |
287 | 288 | ||
288 | if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView(); | 289 | if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView(); |
289 | } | 290 | } |
290 | 291 | ||
291 | 292 | ||
292 | void KOViewManager::updateWNview() | 293 | void KOViewManager::updateWNview() |
293 | { | 294 | { |
294 | if ( mCurrentView == mWhatsNextView && mWhatsNextView ) | 295 | if ( mCurrentView == mWhatsNextView && mWhatsNextView ) |
295 | mWhatsNextView->updateView(); | 296 | mWhatsNextView->updateView(); |
296 | 297 | ||
297 | } | 298 | } |
298 | void KOViewManager::showWhatsNextView() | 299 | void KOViewManager::showWhatsNextView() |
299 | { | 300 | { |
300 | if (!mWhatsNextView) { | 301 | if (!mWhatsNextView) { |
301 | mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), | 302 | mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), |
302 | "KOViewManager::WhatsNextView"); | 303 | "KOViewManager::WhatsNextView"); |
303 | mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); | 304 | mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); |
304 | connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); | 305 | connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); |
305 | addView(mWhatsNextView); | 306 | addView(mWhatsNextView); |
306 | connect(this, SIGNAL( printWNV() ), | 307 | connect(this, SIGNAL( printWNV() ), |
307 | mWhatsNextView, SLOT( printMe() ) ); | 308 | mWhatsNextView, SLOT( printMe() ) ); |
308 | } | 309 | } |
309 | globalFlagBlockAgenda = 1; | 310 | globalFlagBlockAgenda = 1; |
310 | showView(mWhatsNextView, true ); | 311 | showView(mWhatsNextView, true ); |
311 | //mWhatsNextView->updateView(); | 312 | //mWhatsNextView->updateView(); |
312 | 313 | ||
313 | } | 314 | } |
314 | 315 | ||
315 | void KOViewManager::showListView() | 316 | void KOViewManager::showListView() |
316 | { | 317 | { |
317 | if (!mListView) { | 318 | if (!mListView) { |
318 | mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); | 319 | mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); |
319 | addView(mListView); | 320 | addView(mListView); |
320 | 321 | ||
321 | connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), | 322 | connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), |
322 | mMainView, SLOT(showIncidence(Incidence *))); | 323 | mMainView, SLOT(showIncidence(Incidence *))); |
323 | connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), | 324 | connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), |
324 | mMainView, SLOT(editIncidence(Incidence *))); | 325 | mMainView, SLOT(editIncidence(Incidence *))); |
325 | connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 326 | connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
326 | mMainView, SLOT(deleteIncidence(Incidence *))); | 327 | mMainView, SLOT(deleteIncidence(Incidence *))); |
327 | connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), | 328 | connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), |
328 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 329 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
329 | connect( mListView, SIGNAL( signalNewEvent() ), | 330 | connect( mListView, SIGNAL( signalNewEvent() ), |
330 | mMainView, SLOT( newEvent() ) ); | 331 | mMainView, SLOT( newEvent() ) ); |
331 | connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); | 332 | connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); |
332 | connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), | 333 | connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), |
333 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 334 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
334 | connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), | 335 | connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), |
335 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 336 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
336 | connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 337 | connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
337 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 338 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
338 | connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 339 | connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
339 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 340 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
340 | } | 341 | } |
341 | // bool temp = mFlagShowNextxDays; | 342 | // bool temp = mFlagShowNextxDays; |
342 | //globalFlagBlockPainting = true; | 343 | //globalFlagBlockPainting = true; |
343 | globalFlagBlockAgenda = 1; | 344 | globalFlagBlockAgenda = 1; |
344 | if ( KOPrefs::instance()->mListViewMonthTimespan ) { | 345 | if ( KOPrefs::instance()->mListViewMonthTimespan ) { |
345 | mMainView->setBlockShowDates( true ); | 346 | mMainView->setBlockShowDates( true ); |
346 | mMainView->dateNavigator()->selectMonth(); | 347 | mMainView->dateNavigator()->selectMonth(); |
347 | mMainView->setBlockShowDates( false ); | 348 | mMainView->setBlockShowDates( false ); |
348 | } | 349 | } |
349 | showView(mListView, KOPrefs::instance()->mFullViewTodo); | 350 | showView(mListView, KOPrefs::instance()->mFullViewTodo); |
350 | //mFlagShowNextxDays = temp; | 351 | //mFlagShowNextxDays = temp; |
351 | } | 352 | } |
352 | 353 | ||
353 | void KOViewManager::showAgendaView( bool fullScreen ) | 354 | void KOViewManager::showAgendaView( bool fullScreen ) |
354 | { | 355 | { |
355 | 356 | ||
356 | mMainView->dialogManager()->hideSearchDialog(); | 357 | mMainView->dialogManager()->hideSearchDialog(); |
357 | // qDebug("KOViewManager::showAgendaView "); | 358 | // qDebug("KOViewManager::showAgendaView "); |
358 | bool full; | 359 | bool full; |
359 | full = fullScreen; | 360 | full = fullScreen; |
360 | if (!mAgendaView) { | 361 | if (!mAgendaView) { |
361 | full = false; | 362 | full = false; |
362 | mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); | 363 | mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); |
363 | addView(mAgendaView); | 364 | addView(mAgendaView); |
364 | #ifndef DESKTOP_VERSION | 365 | #ifndef DESKTOP_VERSION |
365 | QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); | 366 | QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); |
366 | #endif | 367 | #endif |
367 | connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), | 368 | connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), |
368 | mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); | 369 | mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); |
369 | 370 | ||
370 | // SIGNALS/SLOTS FOR DAY/WEEK VIEW | 371 | // SIGNALS/SLOTS FOR DAY/WEEK VIEW |
371 | 372 | ||
372 | connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate ))); | 373 | connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate ))); |
373 | 374 | ||
374 | connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)), | 375 | connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)), |
375 | mMainView, SLOT(newTodoDateTime(QDateTime,bool))); | 376 | mMainView, SLOT(newTodoDateTime(QDateTime,bool))); |
376 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), | 377 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime)), |
377 | mMainView, SLOT(newEvent(QDateTime))); | 378 | mMainView, SLOT(newEvent(QDateTime))); |
378 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), | 379 | connect(mAgendaView,SIGNAL(newEventSignal(QDateTime,QDateTime)), |
379 | mMainView, SLOT(newEvent(QDateTime,QDateTime))); | 380 | mMainView, SLOT(newEvent(QDateTime,QDateTime))); |
380 | connect(mAgendaView,SIGNAL(newEventSignal(QDate)), | 381 | connect(mAgendaView,SIGNAL(newEventSignal(QDate)), |
381 | mMainView, SLOT(newEvent(QDate))); | 382 | mMainView, SLOT(newEvent(QDate))); |
382 | 383 | ||
383 | connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), | 384 | connect(mAgendaView, SIGNAL(editIncidenceSignal(Incidence *)), |
384 | mMainView, SLOT(editIncidence(Incidence *))); | 385 | mMainView, SLOT(editIncidence(Incidence *))); |
385 | connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), | 386 | connect(mAgendaView, SIGNAL(showIncidenceSignal(Incidence *)), |
386 | mMainView, SLOT(showIncidence(Incidence *))); | 387 | mMainView, SLOT(showIncidence(Incidence *))); |
387 | connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 388 | connect(mAgendaView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
388 | mMainView, SLOT(deleteIncidence(Incidence *))); | 389 | mMainView, SLOT(deleteIncidence(Incidence *))); |
389 | 390 | ||
390 | connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), | 391 | connect( mAgendaView, SIGNAL( incidenceSelected( Incidence * ) ), |
391 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 392 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
392 | 393 | ||
393 | connect(mAgendaView, SIGNAL( toggleExpand() ), | 394 | connect(mAgendaView, SIGNAL( toggleExpand() ), |
394 | mMainView, SLOT( toggleExpand() ) ); | 395 | mMainView, SLOT( toggleExpand() ) ); |
395 | 396 | ||
396 | connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ), | 397 | connect(mMainView, SIGNAL( calendarViewExpanded( bool ) ), |
397 | mAgendaView, SLOT( setExpandedButton( bool ) ) ); | 398 | mAgendaView, SLOT( setExpandedButton( bool ) ) ); |
398 | connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), | 399 | connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), |
399 | mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; | 400 | mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; |
400 | connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), | 401 | connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), |
401 | mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; | 402 | mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; |
402 | connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); | 403 | connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); |
403 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, | 404 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, |
404 | SLOT( updateTodo( Todo *, int ) ) ); | 405 | SLOT( updateTodo( Todo *, int ) ) ); |
405 | connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), | 406 | connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), |
406 | mMainView, SIGNAL( todoModified( Todo *, int ))); | 407 | mMainView, SIGNAL( todoModified( Todo *, int ))); |
407 | connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 408 | connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
408 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 409 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
409 | connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 410 | connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
410 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 411 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
411 | connect( mAgendaView, SIGNAL( selectWeekNum( int ) ), | 412 | connect( mAgendaView, SIGNAL( selectWeekNum( int ) ), |
412 | mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) ); | 413 | mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) ); |
413 | mAgendaView->readSettings(); | 414 | mAgendaView->readSettings(); |
414 | mAgendaView->updateConfig(); | 415 | mAgendaView->updateConfig(); |
415 | } | 416 | } |
416 | 417 | ||
417 | showView( mAgendaView, full); | 418 | showView( mAgendaView, full); |
418 | 419 | ||
419 | } | 420 | } |
420 | 421 | ||
421 | void KOViewManager::showDayView() | 422 | void KOViewManager::showDayView() |
422 | { | 423 | { |
423 | mFlagShowNextxDays = false; | 424 | mFlagShowNextxDays = false; |
424 | globalFlagBlockLabel = 1; | 425 | globalFlagBlockLabel = 1; |
425 | globalFlagBlockAgenda = 1; | 426 | globalFlagBlockAgenda = 1; |
426 | if ( mCurrentAgendaView != 1 ) | 427 | if ( mCurrentAgendaView != 1 ) |
427 | mCurrentAgendaView = -1; | 428 | mCurrentAgendaView = -1; |
428 | showAgendaView(); | 429 | showAgendaView(); |
429 | qApp->processEvents(); | 430 | qApp->processEvents(); |
430 | globalFlagBlockAgenda = 2; | 431 | globalFlagBlockAgenda = 2; |
431 | globalFlagBlockLabel = 0; | 432 | globalFlagBlockLabel = 0; |
432 | mMainView->dateNavigator()->selectDates( 1 ); | 433 | mMainView->dateNavigator()->selectDates( 1 ); |
433 | mCurrentAgendaView = 1 ; | 434 | mCurrentAgendaView = 1 ; |
434 | 435 | ||
435 | } | 436 | } |
436 | 437 | ||
437 | void KOViewManager::showWorkWeekView() | 438 | void KOViewManager::showWorkWeekView() |
438 | { | 439 | { |
439 | mFlagShowNextxDays = false; | 440 | mFlagShowNextxDays = false; |
440 | globalFlagBlockAgenda = 1; | 441 | globalFlagBlockAgenda = 1; |
441 | globalFlagBlockLabel = 1; | 442 | globalFlagBlockLabel = 1; |
442 | if ( mCurrentAgendaView != 5 ) | 443 | if ( mCurrentAgendaView != 5 ) |
443 | mCurrentAgendaView = -1; | 444 | mCurrentAgendaView = -1; |
444 | showAgendaView(); | 445 | showAgendaView(); |
445 | qApp->processEvents(); | 446 | qApp->processEvents(); |
446 | globalFlagBlockAgenda = 2; | 447 | globalFlagBlockAgenda = 2; |
447 | globalFlagBlockLabel = 0; | 448 | globalFlagBlockLabel = 0; |
448 | mMainView->dateNavigator()->selectWorkWeek(); | 449 | mMainView->dateNavigator()->selectWorkWeek(); |
449 | mCurrentAgendaView = 5 ; | 450 | mCurrentAgendaView = 5 ; |
450 | 451 | ||
451 | } | 452 | } |
452 | 453 | ||
453 | void KOViewManager::showWeekView() | 454 | void KOViewManager::showWeekView() |
454 | { | 455 | { |
455 | /* | 456 | /* |
456 | globalFlagBlockAgenda = 2; | 457 | globalFlagBlockAgenda = 2; |
457 | qDebug("4globalFlagBlockAgenda = 2; "); | 458 | qDebug("4globalFlagBlockAgenda = 2; "); |
458 | //globalFlagBlockPainting = true; | 459 | //globalFlagBlockPainting = true; |
459 | mMainView->dateNavigator()->selectWeek(); | 460 | mMainView->dateNavigator()->selectWeek(); |
460 | showAgendaView(); | 461 | showAgendaView(); |
461 | */ | 462 | */ |
462 | 463 | ||
463 | 464 | ||
464 | mFlagShowNextxDays = false; | 465 | mFlagShowNextxDays = false; |
465 | globalFlagBlockAgenda = 1; | 466 | globalFlagBlockAgenda = 1; |
466 | globalFlagBlockLabel = 1; | 467 | globalFlagBlockLabel = 1; |
467 | if ( mCurrentAgendaView != 7 ) | 468 | if ( mCurrentAgendaView != 7 ) |
468 | mCurrentAgendaView = -1; | 469 | mCurrentAgendaView = -1; |
469 | showAgendaView(); | 470 | showAgendaView(); |
470 | qApp->processEvents(); | 471 | qApp->processEvents(); |
471 | globalFlagBlockAgenda = 2; | 472 | globalFlagBlockAgenda = 2; |
472 | globalFlagBlockLabel = 0; | 473 | globalFlagBlockLabel = 0; |
473 | mMainView->dateNavigator()->selectWeek(); | 474 | mMainView->dateNavigator()->selectWeek(); |
474 | mCurrentAgendaView = 7 ; | 475 | mCurrentAgendaView = 7 ; |
475 | } | 476 | } |
476 | 477 | ||
477 | void KOViewManager::showNextXView() | 478 | void KOViewManager::showNextXView() |
478 | { | 479 | { |
479 | 480 | ||
480 | globalFlagBlockAgenda = 1; | 481 | globalFlagBlockAgenda = 1; |
481 | if ( mCurrentAgendaView != 3 ) | 482 | if ( mCurrentAgendaView != 3 ) |
482 | mCurrentAgendaView = -1; | 483 | mCurrentAgendaView = -1; |
483 | showAgendaView(KOPrefs::instance()->mFullViewMonth); | 484 | showAgendaView(KOPrefs::instance()->mFullViewMonth); |
484 | globalFlagBlockAgenda = 2; | 485 | globalFlagBlockAgenda = 2; |
485 | mMainView->dateNavigator()->selectDates( QDate::currentDate(), | 486 | mMainView->dateNavigator()->selectDates( QDate::currentDate(), |
486 | KOPrefs::instance()->mNextXDays ); | 487 | KOPrefs::instance()->mNextXDays ); |
487 | mFlagShowNextxDays = true; | 488 | mFlagShowNextxDays = true; |
488 | mCurrentAgendaView = 3 ; | 489 | mCurrentAgendaView = 3 ; |
489 | } | 490 | } |
490 | bool KOViewManager::showsNextDays() | 491 | bool KOViewManager::showsNextDays() |
491 | { | 492 | { |
492 | return mFlagShowNextxDays; | 493 | return mFlagShowNextxDays; |
493 | } | 494 | } |
494 | void KOViewManager::showMonthView() | 495 | void KOViewManager::showMonthView() |
495 | { | 496 | { |
496 | if (!mMonthView) { | 497 | if (!mMonthView) { |
497 | mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); | 498 | mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); |
498 | 499 | ||
499 | addView(mMonthView); | 500 | addView(mMonthView); |
500 | // mMonthView->show(); | 501 | // mMonthView->show(); |
501 | // SIGNALS/SLOTS FOR MONTH VIEW | 502 | // SIGNALS/SLOTS FOR MONTH VIEW |
502 | connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), | 503 | connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), |
503 | mMainView, SLOT(newEvent(QDateTime))); | 504 | mMainView, SLOT(newEvent(QDateTime))); |
504 | 505 | ||
505 | connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), | 506 | connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), |
506 | mMainView, SLOT(showIncidence(Incidence *))); | 507 | mMainView, SLOT(showIncidence(Incidence *))); |
507 | connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), | 508 | connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), |
508 | mMainView, SLOT(editIncidence(Incidence *))); | 509 | mMainView, SLOT(editIncidence(Incidence *))); |
509 | connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), | 510 | connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), |
510 | mMainView, SLOT(deleteIncidence(Incidence *))); | 511 | mMainView, SLOT(deleteIncidence(Incidence *))); |
511 | 512 | ||
512 | connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), | 513 | connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), |
513 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 514 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
514 | connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), | 515 | connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), |
515 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 516 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
516 | connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), | 517 | connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), |
517 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 518 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
518 | 519 | ||
519 | connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 520 | connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
520 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 521 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
521 | connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 522 | connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
522 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 523 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
523 | connect( mMonthView, SIGNAL( selectWeekNum( int ) ), | 524 | connect( mMonthView, SIGNAL( selectWeekNum( int ) ), |
524 | mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) ); | 525 | mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) ); |
525 | connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), | 526 | connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), |
526 | mMainView, SLOT ( showDay( QDate ) ) ); | 527 | mMainView, SLOT ( showDay( QDate ) ) ); |
527 | connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); | 528 | connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); |
528 | connect( mMonthView, SIGNAL(nextMonth() ), | 529 | connect( mMonthView, SIGNAL(nextMonth() ), |
529 | mMainView->navigatorBar(), SIGNAL(goNextMonth() ) ); | 530 | mMainView->navigatorBar(), SIGNAL(goNextMonth() ) ); |
530 | connect( mMonthView, SIGNAL(prevMonth() ), | 531 | connect( mMonthView, SIGNAL(prevMonth() ), |
531 | mMainView->navigatorBar(), SIGNAL(goPrevMonth() ) ); | 532 | mMainView->navigatorBar(), SIGNAL(goPrevMonth() ) ); |
532 | connect( mMonthView, SIGNAL( showNavigator(bool) ), | 533 | connect( mMonthView, SIGNAL( showNavigator(bool) ), |
533 | mMainView, SLOT ( showNavigatorBar(bool) ) ); | 534 | mMainView, SLOT ( showNavigatorBar(bool) ) ); |
534 | } | 535 | } |
535 | 536 | ||
536 | globalFlagBlockAgenda = 1; | 537 | globalFlagBlockAgenda = 1; |
537 | //mFlagShowNextxDays = false; | 538 | //mFlagShowNextxDays = false; |
538 | // if(mMonthView == mCurrentView) return; | 539 | // if(mMonthView == mCurrentView) return; |
539 | if ( KOPrefs::instance()->mMonthViewWeek ) | 540 | if ( KOPrefs::instance()->mMonthViewWeek ) |
540 | mMainView->dateNavigator()->selectWeek(); | 541 | mMainView->dateNavigator()->selectWeek(); |
541 | else | 542 | else |
542 | mMainView->dateNavigator()->selectMonth(); | 543 | mMainView->dateNavigator()->selectMonth(); |
543 | 544 | ||
544 | showView(mMonthView, true ); | 545 | showView(mMonthView, true ); |
545 | 546 | ||
546 | } | 547 | } |
547 | 548 | ||
548 | void KOViewManager::showTodoView() | 549 | void KOViewManager::showTodoView() |
549 | { | 550 | { |
550 | //mFlagShowNextxDays = false; | 551 | //mFlagShowNextxDays = false; |
551 | if ( !mTodoView ) { | 552 | if ( !mTodoView ) { |
552 | mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), | 553 | mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), |
553 | "KOViewManager::TodoView" ); | 554 | "KOViewManager::TodoView" ); |
554 | 555 | ||
555 | addView( mTodoView ); | 556 | addView( mTodoView ); |
556 | // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); | 557 | // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); |
557 | 558 | ||
558 | // SIGNALS/SLOTS FOR TODO VIEW | 559 | // SIGNALS/SLOTS FOR TODO VIEW |
559 | connect( mTodoView, SIGNAL( newTodoSignal() ), | 560 | connect( mTodoView, SIGNAL( newTodoSignal() ), |
560 | mMainView, SLOT( newTodo() ) ); | 561 | mMainView, SLOT( newTodo() ) ); |
561 | connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), | 562 | connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), |
562 | mMainView, SLOT( newSubTodo( Todo *) ) ); | 563 | mMainView, SLOT( newSubTodo( Todo *) ) ); |
563 | connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), | 564 | connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), |
564 | mMainView, SLOT( showTodo( Todo * ) ) ); | 565 | mMainView, SLOT( showTodo( Todo * ) ) ); |
565 | connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), | 566 | connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), |
566 | mMainView, SLOT( editTodo( Todo * ) ) ); | 567 | mMainView, SLOT( editTodo( Todo * ) ) ); |
567 | connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), | 568 | connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), |
568 | mMainView, SLOT( deleteTodo( Todo * ) ) ); | 569 | mMainView, SLOT( deleteTodo( Todo * ) ) ); |
569 | connect( mTodoView, SIGNAL( purgeCompletedSignal() ), | 570 | connect( mTodoView, SIGNAL( purgeCompletedSignal() ), |
570 | mMainView, SLOT( purgeCompleted() ) ); | 571 | mMainView, SLOT( purgeCompleted() ) ); |
571 | 572 | ||
572 | connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), | 573 | connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), |
573 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 574 | mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
574 | 575 | ||
575 | connect( mMainView, SIGNAL( configChanged() ), mTodoView, | 576 | connect( mMainView, SIGNAL( configChanged() ), mTodoView, |
576 | SLOT( updateConfig() ) ); | 577 | SLOT( updateConfig() ) ); |
577 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, | 578 | connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, |
578 | SLOT( updateTodo( Todo *, int ) ) ); | 579 | SLOT( updateTodo( Todo *, int ) ) ); |
579 | connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 580 | connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
580 | mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); | 581 | mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); |
581 | connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), | 582 | connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), |
582 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); | 583 | mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); |
583 | connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), | 584 | connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), |
584 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); | 585 | mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); |
585 | connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), | 586 | connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), |
586 | mMainView, SLOT ( todo_unsub( Todo * ) ) ); | 587 | mMainView, SLOT ( todo_unsub( Todo * ) ) ); |
587 | connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), | 588 | connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), |
588 | mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); | 589 | mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); |
589 | connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), | 590 | connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), |
590 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 591 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
591 | connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), | 592 | connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), |
592 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 593 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
593 | KConfig *config = KOGlobals::config(); | 594 | KConfig *config = KOGlobals::config(); |
594 | mTodoView->restoreLayout(config,"Todo View"); | 595 | mTodoView->restoreLayout(config,"Todo View"); |
595 | mTodoView->setNavigator( mMainView->dateNavigator() ); | 596 | mTodoView->setNavigator( mMainView->dateNavigator() ); |
596 | } | 597 | } |
597 | 598 | ||
598 | globalFlagBlockAgenda = 1; | 599 | globalFlagBlockAgenda = 1; |
599 | showView( mTodoView, true ); | 600 | showView( mTodoView, true ); |
600 | 601 | ||
601 | } | 602 | } |
602 | 603 | ||
603 | void KOViewManager::showJournalView() | 604 | void KOViewManager::showJournalView() |
604 | { | 605 | { |
605 | //mFlagShowNextxDays = false; | 606 | //mFlagShowNextxDays = false; |
606 | if (!mJournalView) { | 607 | if (!mJournalView) { |
607 | mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), | 608 | mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), |
608 | "KOViewManager::JournalView"); | 609 | "KOViewManager::JournalView"); |
609 | connect( mMainView, SIGNAL( configChanged() ), mJournalView, | 610 | connect( mMainView, SIGNAL( configChanged() ), mJournalView, |
610 | SLOT( updateConfig() ) ); | 611 | SLOT( updateConfig() ) ); |