-rw-r--r-- | bin/kdepim/WhatsNew.txt | 4 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 2 | ||||
-rw-r--r-- | korganizer/kotodoviewitem.cpp | 26 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 11 | ||||
-rw-r--r-- | libkcal/incidence.h | 2 | ||||
-rw-r--r-- | libkcal/todo.cpp | 32 | ||||
-rw-r--r-- | libkcal/todo.h | 12 |
7 files changed, 69 insertions, 20 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index 14dcdac..9ba4f3e 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt | |||
@@ -1,907 +1,909 @@ | |||
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.3 ************ | 3 | ********** VERSION 2.0.3 ************ |
4 | 4 | ||
5 | KO/Pi: | 5 | KO/Pi: |
6 | Added feature for changing alarm settings for many items at once: | 6 | Added feature for changing alarm settings for many items at once: |
7 | Open list view (or search dialog), select the desired items and choose in | 7 | Open list view (or search dialog), select the desired items and choose in |
8 | the popup menu: Set alarm for selected... | 8 | the popup menu: Set alarm for selected... |
9 | 9 | ||
10 | Added to the event/todo viewer the option to send an email to | 10 | Added to the event/todo viewer the option to send an email to |
11 | all attendees or all selected (with RSVP) attendees. | 11 | all attendees or all selected (with RSVP) attendees. |
12 | 12 | ||
13 | Made the week-month mode changing in month view faster. | 13 | Made the week-month mode changing in month view faster. |
14 | 14 | ||
15 | Made month view better useable with keyboard. | 15 | Made month view better useable with keyboard. |
16 | Now TAB key jumps to next cell with an event/todo. | 16 | Now TAB key jumps to next cell with an event/todo. |
17 | Scroll in cell with coursor keys, scroll in time (next week) with | 17 | Scroll in cell with coursor keys, scroll in time (next week) with |
18 | Shift/Control + coursorkeys. | 18 | Shift/Control + coursorkeys. |
19 | 19 | ||
20 | Fixeg bug that the todo view flat mode was reset after first view update. | 20 | Fixed bug that the todo view flat mode was reset after first view update. |
21 | |||
22 | If a todo is displayed closed in the todo view, it is now displayed in overdue/due today color depending on the subtodos overdue/due today properties. | ||
21 | 23 | ||
22 | ********** VERSION 2.0.2 ************ | 24 | ********** VERSION 2.0.2 ************ |
23 | 25 | ||
24 | KO/Pi: | 26 | KO/Pi: |
25 | Fixed the layout problem of the day label buttons | 27 | Fixed the layout problem of the day label buttons |
26 | of the agenda view introduced in version 2.0.1. | 28 | of the agenda view introduced in version 2.0.1. |
27 | 29 | ||
28 | Added WhatsThis support for the todo view and the list view. | 30 | Added WhatsThis support for the todo view and the list view. |
29 | 31 | ||
30 | Added a quite useful feature to the montview. | 32 | Added a quite useful feature to the montview. |
31 | Just click on the week numbers on the left. | 33 | Just click on the week numbers on the left. |
32 | And in the top right corner of month view/agenda view | 34 | And in the top right corner of month view/agenda view |
33 | there is now a "week number quick selector". | 35 | there is now a "week number quick selector". |
34 | (Click on the black triangle). | 36 | (Click on the black triangle). |
35 | 37 | ||
36 | Made the quite difficult timezone change in KO/Pi easy. | 38 | Made the quite difficult timezone change in KO/Pi easy. |
37 | 39 | ||
38 | OM/Pi: | 40 | OM/Pi: |
39 | Fixed too small icons on desktop. | 41 | Fixed too small icons on desktop. |
40 | Fixed non visible icons in mainwindow on Z with fastload enabled. | 42 | Fixed non visible icons in mainwindow on Z with fastload enabled. |
41 | Added signature file setting to smtp account config. | 43 | Added signature file setting to smtp account config. |
42 | And the signature can be edited and saved in the edit mail dialog. | 44 | And the signature can be edited and saved in the edit mail dialog. |
43 | That does mean: | 45 | That does mean: |
44 | Simply edit the signature for the selected smtp account in the | 46 | Simply edit the signature for the selected smtp account in the |
45 | edit new mail dialog and press the "save signature" button there. | 47 | edit new mail dialog and press the "save signature" button there. |
46 | Then the signature is saved to the file specified in the smtp account settings. | 48 | Then the signature is saved to the file specified in the smtp account settings. |
47 | If there is no file specified, it is saved automatically to the file | 49 | If there is no file specified, it is saved automatically to the file |
48 | kdepim/apps/kopiemail/<accountname>.sig. | 50 | kdepim/apps/kopiemail/<accountname>.sig. |
49 | 51 | ||
50 | 52 | ||
51 | 53 | ||
52 | ********** VERSION 2.0.1 ************ | 54 | ********** VERSION 2.0.1 ************ |
53 | 55 | ||
54 | Oooops ... I forgot to test on the Zaurus 5500 ... | 56 | Oooops ... I forgot to test on the Zaurus 5500 ... |
55 | 57 | ||
56 | Fixed many problems of new (english) strings (and german translations) | 58 | Fixed many problems of new (english) strings (and german translations) |
57 | introduced in the latest versions, where the text was not fitting on the | 59 | introduced in the latest versions, where the text was not fitting on the |
58 | 240x320 display of the Zaurus 5500. | 60 | 240x320 display of the Zaurus 5500. |
59 | 61 | ||
60 | KO/Pi: | 62 | KO/Pi: |
61 | Added a popup menu ( press pen and hold to get popup ) to the agenda view | 63 | Added a popup menu ( press pen and hold to get popup ) to the agenda view |
62 | with many useful items (add event/todo, show next week, two weeks, month, journal). | 64 | with many useful items (add event/todo, show next week, two weeks, month, journal). |
63 | 65 | ||
64 | Added items to the todolist popup menu for: | 66 | Added items to the todolist popup menu for: |
65 | Display all opened, all closed or all todos flat. | 67 | Display all opened, all closed or all todos flat. |
66 | The "flat" view makes is possible to sort all todos after ,e.g., prio or date. | 68 | The "flat" view makes is possible to sort all todos after ,e.g., prio or date. |
67 | Made the reparenting of todos on the desktop possible via Drag&Drop. | 69 | Made the reparenting of todos on the desktop possible via Drag&Drop. |
68 | Fixed several bugs in setting the completed datetime for todos. | 70 | Fixed several bugs in setting the completed datetime for todos. |
69 | Added info about completed datetime of todos to the todo viewer. | 71 | Added info about completed datetime of todos to the todo viewer. |
70 | Now displaying a completed todo (with completed datetime set) in the agenda view | 72 | Now displaying a completed todo (with completed datetime set) in the agenda view |
71 | at the time of the completion. Such that now it is possible to see in the agenda view | 73 | at the time of the completion. Such that now it is possible to see in the agenda view |
72 | when what todo was completed. | 74 | when what todo was completed. |
73 | Fixed behaviour of automatic setting completion of todos with sub-todos/parent todos. | 75 | Fixed behaviour of automatic setting completion of todos with sub-todos/parent todos. |
74 | Now the behaviour is: | 76 | Now the behaviour is: |
75 | Setting a parent to complete sets all (sub)childs to complete. | 77 | Setting a parent to complete sets all (sub)childs to complete. |
76 | Setting a parent to uncomplete does not change the childs. | 78 | Setting a parent to uncomplete does not change the childs. |
77 | Setting a child to uncomplete sets all parent to uncomplete. | 79 | Setting a child to uncomplete sets all parent to uncomplete. |
78 | Setting a child to complete does not change the parents. | 80 | Setting a child to complete does not change the parents. |
79 | 81 | ||
80 | Smart updating and double buffering of the daymatrix. | 82 | Smart updating and double buffering of the daymatrix. |
81 | Showing holidays in the day matrix. | 83 | Showing holidays in the day matrix. |
82 | Many other small performance updates. | 84 | Many other small performance updates. |
83 | 85 | ||
84 | Made day labels in agenda clickable. By clicking a label, the day is displayed in single day mode. | 86 | Made day labels in agenda clickable. By clicking a label, the day is displayed in single day mode. |
85 | 87 | ||
86 | Now the translation file usertranslation.txt is supposed to be in utf8 format. | 88 | Now the translation file usertranslation.txt is supposed to be in utf8 format. |
87 | 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. | 89 | 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. |
88 | 90 | ||
89 | 91 | ||
90 | ********** VERSION 2.0.0 ************ | 92 | ********** VERSION 2.0.0 ************ |
91 | 93 | ||
92 | Stable release 2.0.0! | 94 | Stable release 2.0.0! |
93 | 95 | ||
94 | KO/Pi: | 96 | KO/Pi: |
95 | Fixed problem in edit dialog recreation at startup. | 97 | Fixed problem in edit dialog recreation at startup. |
96 | Made "toggle view*" menu items enabled context sensitive. | 98 | Made "toggle view*" menu items enabled context sensitive. |
97 | Changed agenda size menu to items 1-10. | 99 | Changed agenda size menu to items 1-10. |
98 | Made it possible to change agenda size quickly by pressing mouse on timelabels in agenda view and move mouse up/down. | 100 | Made it possible to change agenda size quickly by pressing mouse on timelabels in agenda view and move mouse up/down. |
99 | Usebility enhancements in the KO/Pi menus. | 101 | Usebility enhancements in the KO/Pi menus. |
100 | Birthday import now adds year to summary. | 102 | Birthday import now adds year to summary. |
101 | What's Next view shows age in years for birthday. | 103 | What's Next view shows age in years for birthday. |
102 | 104 | ||
103 | OM/Pi: | 105 | OM/Pi: |
104 | Added three info lines to display subject, from and to of selected mails. | 106 | Added three info lines to display subject, from and to of selected mails. |
105 | 107 | ||
106 | KA/Pi: | 108 | KA/Pi: |
107 | Fixed jump bar behaviour on Zaurus. | 109 | Fixed jump bar behaviour on Zaurus. |
108 | Now KA/Pi search field supports searching for a range of starting characters. | 110 | Now KA/Pi search field supports searching for a range of starting characters. |
109 | E.g. to search for all contact beginning with b to n, type | 111 | E.g. to search for all contact beginning with b to n, type |
110 | b-n | 112 | b-n |
111 | in the search field. | 113 | in the search field. |
112 | 114 | ||
113 | ********** VERSION 1.9.20 ************ | 115 | ********** VERSION 1.9.20 ************ |
114 | 116 | ||
115 | KO/Pi: | 117 | KO/Pi: |
116 | Added for the "dislplay one day" agenda mode | 118 | Added for the "dislplay one day" agenda mode |
117 | info in the caption and in the day lables: | 119 | info in the caption and in the day lables: |
118 | Now it is displayed, if the selected day is from "day before yesterday" | 120 | Now it is displayed, if the selected day is from "day before yesterday" |
119 | to "day after tomorrow". | 121 | to "day after tomorrow". |
120 | Made it possible to delete a Todo, which has sub-todos. | 122 | Made it possible to delete a Todo, which has sub-todos. |
121 | Fixed two small problems in the todo view. | 123 | Fixed two small problems in the todo view. |
122 | Added missing German translation for filter edit and print dialog. | 124 | Added missing German translation for filter edit and print dialog. |
123 | Made search dialog closeable by cancel key. | 125 | Made search dialog closeable by cancel key. |
124 | 126 | ||
125 | Made it possible to select in the date picker the (ligt grey ) | 127 | Made it possible to select in the date picker the (ligt grey ) |
126 | dates of the prev./next month with the mouse. | 128 | dates of the prev./next month with the mouse. |
127 | 129 | ||
128 | OM/Pi: | 130 | OM/Pi: |
129 | "Delete mail" icon in main window now deletes all selected mails. | 131 | "Delete mail" icon in main window now deletes all selected mails. |
130 | Fixed the problem, that the state flag of imap mails was ignored. | 132 | Fixed the problem, that the state flag of imap mails was ignored. |
131 | Now mails with "FLAG_SEEN" on the imap server get no icon in the list view | 133 | Now mails with "FLAG_SEEN" on the imap server get no icon in the list view |
132 | to indecate that they are already seen. | 134 | to indecate that they are already seen. |
133 | Fixed the problem that the body of some mails was not displayed in the | 135 | Fixed the problem that the body of some mails was not displayed in the |
134 | mail viewer when fetching them from the imap server directly to read them. | 136 | mail viewer when fetching them from the imap server directly to read them. |
135 | Made it (configurable) possible to show the "To:" field in the list view. | 137 | Made it (configurable) possible to show the "To:" field in the list view. |
136 | Added to the mail viewer the option "View Source" to make it possible to see the raw mail data. | 138 | Added to the mail viewer the option "View Source" to make it possible to see the raw mail data. |
137 | Added a "Download Mail" button to the mail viewer to quickly download the viewed mail to the | 139 | Added a "Download Mail" button to the mail viewer to quickly download the viewed mail to the |
138 | local storage folder (specified in account settings) of the account of the mail. | 140 | local storage folder (specified in account settings) of the account of the mail. |
139 | Removed some memory leaks in OM/Pi. | 141 | Removed some memory leaks in OM/Pi. |
140 | 142 | ||
141 | 143 | ||
142 | ********** VERSION 1.9.19 ************ | 144 | ********** VERSION 1.9.19 ************ |
143 | 145 | ||
144 | Added a lot of missing translations to KA/Pi, | 146 | Added a lot of missing translations to KA/Pi, |
145 | Added some missing translations to KO/Pi and OM/Pi. | 147 | Added some missing translations to KO/Pi and OM/Pi. |
146 | 148 | ||
147 | Fixed some minor problems in KA/Pi + KO/Pi. | 149 | Fixed some minor problems in KA/Pi + KO/Pi. |
148 | 150 | ||
149 | Fixed a crash when closing PwM/Pi. | 151 | Fixed a crash when closing PwM/Pi. |
150 | Added German translation for PwM/Pi. | 152 | Added German translation for PwM/Pi. |
151 | 153 | ||
152 | Made view change and Month View update faster in KO/Pi. | 154 | Made view change and Month View update faster in KO/Pi. |
153 | 155 | ||
154 | 156 | ||
155 | ********** VERSION 1.9.18 ************ | 157 | ********** VERSION 1.9.18 ************ |
156 | 158 | ||
157 | FYI: The VERSION 1.9.17 was a testing release only. | 159 | FYI: The VERSION 1.9.17 was a testing release only. |
158 | Please read the changelog of VERSION 1.9.17 as well. | 160 | Please read the changelog of VERSION 1.9.17 as well. |
159 | 161 | ||
160 | Cleaned up the syncing config dialog. | 162 | Cleaned up the syncing config dialog. |
161 | Added sync config options for date range for events. | 163 | Added sync config options for date range for events. |
162 | Added sync config options for filters on incoming data. | 164 | Added sync config options for filters on incoming data. |
163 | Added sync config options for filters on outgoing data. | 165 | Added sync config options for filters on outgoing data. |
164 | Please read the updated SyncHowTo about the new filter settings. | 166 | Please read the updated SyncHowTo about the new filter settings. |
165 | These filter settings make it now possible to sync with shared | 167 | These filter settings make it now possible to sync with shared |
166 | calendars without writing back private or confidential data | 168 | calendars without writing back private or confidential data |
167 | (via the outgoing filters). | 169 | (via the outgoing filters). |
168 | To sync only with particular parts of a shared calendar, | 170 | To sync only with particular parts of a shared calendar, |
169 | the incoming filter settings can be used. | 171 | the incoming filter settings can be used. |
170 | An example can be found in the SyncHowTo. | 172 | An example can be found in the SyncHowTo. |
171 | Same for shared addressbooks. | 173 | Same for shared addressbooks. |
172 | 174 | ||
173 | Added a setting for the global kdepim data storage. | 175 | Added a setting for the global kdepim data storage. |
174 | Usually the data is stored in (yourhomedir/kdepim). | 176 | Usually the data is stored in (yourhomedir/kdepim). |
175 | Now you can set in the Global config dialog TAB, subTAB "Data storage path" | 177 | Now you can set in the Global config dialog TAB, subTAB "Data storage path" |
176 | a directory where all the kdepim data is stored. | 178 | a directory where all the kdepim data is stored. |
177 | That makes it easy to save all kdepim data on a SD card on the Z, for example. | 179 | That makes it easy to save all kdepim data on a SD card on the Z, for example. |
178 | 180 | ||
179 | KO/Pi: | 181 | KO/Pi: |
180 | The timeedit input has a pulldown list for times. | 182 | The timeedit input has a pulldown list for times. |
181 | If opened, this pulldown list should now has the right time highlighted. | 183 | If opened, this pulldown list should now has the right time highlighted. |
182 | Added the possibility to exclude events/todos/journals in a filter. | 184 | Added the possibility to exclude events/todos/journals in a filter. |
183 | You should exclude journals, if you do not want them to sync with a public calendar. | 185 | You should exclude journals, if you do not want them to sync with a public calendar. |
184 | 186 | ||
185 | KA/Pi: | 187 | KA/Pi: |
186 | Added the possibility to in/exclude public/private/confidential contacts to a filter. | 188 | Added the possibility to in/exclude public/private/confidential contacts to a filter. |
187 | 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 ... | 189 | 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 ... |
188 | Added printing of card view and details view on desktop. | 190 | Added printing of card view and details view on desktop. |
189 | Printing of list view is not working... | 191 | Printing of list view is not working... |
190 | Added button for removing pictures in contact editor. | 192 | Added button for removing pictures in contact editor. |
191 | Parsing data fix of KA/Pi version 1.9.17. | 193 | Parsing data fix of KA/Pi version 1.9.17. |
192 | Fixed the "parse name automatically" problem of KA/Pi version 1.9.17. | 194 | Fixed the "parse name automatically" problem of KA/Pi version 1.9.17. |
193 | Fixed some syncing merging problems. | 195 | Fixed some syncing merging problems. |
194 | 196 | ||
195 | 197 | ||
196 | ********** VERSION 1.9.17 ************ | 198 | ********** VERSION 1.9.17 ************ |
197 | 199 | ||
198 | KO/Pi: | 200 | KO/Pi: |
199 | Fixed that tooltips were not updated after moving an item in agenda view. | 201 | Fixed that tooltips were not updated after moving an item in agenda view. |
200 | Fixed a bug in sorting start date for recurring events in list view. | 202 | Fixed a bug in sorting start date for recurring events in list view. |
201 | Changed the left button in todo viewer from "Agenda" to "Set completed". | 203 | Changed the left button in todo viewer from "Agenda" to "Set completed". |
202 | 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. | 204 | 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. |
203 | Added more info in the todo viewer: Startdate, parent/sub todos. | 205 | Added more info in the todo viewer: Startdate, parent/sub todos. |
204 | 206 | ||
205 | 207 | ||
206 | KA/Pi: | 208 | KA/Pi: |
207 | All fields search does now actually search all the (possible) fields, | 209 | All fields search does now actually search all the (possible) fields, |
208 | not only those listed in the contact list. | 210 | not only those listed in the contact list. |
209 | Made is possible to inline a picture in a vcard on the Z. | 211 | Made is possible to inline a picture in a vcard on the Z. |
210 | This was only possible on the desktop, now is it possible on the Z as well. | 212 | This was only possible on the desktop, now is it possible on the Z as well. |
211 | Fixed of missing save settings after filter configuration. | 213 | Fixed of missing save settings after filter configuration. |
212 | Made saving of addressbook much faster. | 214 | Made saving of addressbook much faster. |
213 | Fixed extension widget layout problem. | 215 | Fixed extension widget layout problem. |
214 | Fixed saving of default formatted name settings. | 216 | Fixed saving of default formatted name settings. |
215 | Fixed formatted name handling in edit dialog. | 217 | Fixed formatted name handling in edit dialog. |
216 | Added an option for changing formatted names of many contacts | 218 | Added an option for changing formatted names of many contacts |
217 | (menu: File - Change - Set formatted name). | 219 | (menu: File - Change - Set formatted name). |
218 | 220 | ||
219 | QWhatsThis was not working on the Z ( only black rectangle was shown). | 221 | QWhatsThis was not working on the Z ( only black rectangle was shown). |
220 | This is Fixed. | 222 | This is Fixed. |
221 | 223 | ||
222 | KDE-Sync: | 224 | KDE-Sync: |
223 | Now readonly KDE resources are synced as well. | 225 | Now readonly KDE resources are synced as well. |
224 | (They are not changed in KDE itself, of course). | 226 | (They are not changed in KDE itself, of course). |
225 | 227 | ||
226 | 228 | ||
227 | 229 | ||
228 | ********** VERSION 1.9.16 ************ | 230 | ********** VERSION 1.9.16 ************ |
229 | 231 | ||
230 | KO/Pi: | 232 | KO/Pi: |
231 | Fixed search dialog size on Z 6000 (480x640 display). | 233 | Fixed search dialog size on Z 6000 (480x640 display). |
232 | Added setting to hide/show time in agenda items. | 234 | Added setting to hide/show time in agenda items. |
233 | Added setting to hide not running todos in todo view. | 235 | Added setting to hide not running todos in todo view. |
234 | Added columns for start date/time in todo view. | 236 | Added columns for start date/time in todo view. |
235 | Replaced the solid half-hour lines in agenda view by dot lines. | 237 | Replaced the solid half-hour lines in agenda view by dot lines. |
236 | Added possibility of printing the What's Next View on the desktop | 238 | Added possibility of printing the What's Next View on the desktop |
237 | (i.e. Windows and Linux). | 239 | (i.e. Windows and Linux). |
238 | Fixed a crash in KO/Pi when starting KO/Pi with What's Next view. | 240 | Fixed a crash in KO/Pi when starting KO/Pi with What's Next view. |
239 | Added tooltips in month view.(Tooltips only available on desktop) | 241 | Added tooltips in month view.(Tooltips only available on desktop) |
240 | 242 | ||
241 | Fixed a strange problem in KO/Pi alarm applet. | 243 | Fixed a strange problem in KO/Pi alarm applet. |
242 | Did not find the actual problem, | 244 | Did not find the actual problem, |
243 | such that now Qtopia reboots again if deinstalling the alarm applet. | 245 | such that now Qtopia reboots again if deinstalling the alarm applet. |
244 | But the alarm applet should work again. | 246 | But the alarm applet should work again. |
245 | 247 | ||
246 | KA/Pi: | 248 | KA/Pi: |
247 | Fixed the problem, that internal pictures were not saved. | 249 | Fixed the problem, that internal pictures were not saved. |
248 | 250 | ||
249 | Fixed a problem in the pi-sync mode by increasing the timeout for data transfer from 20 seconds to 5 minutes. | 251 | Fixed a problem in the pi-sync mode by increasing the timeout for data transfer from 20 seconds to 5 minutes. |
250 | 252 | ||
251 | Fixed some minor problems. (Like word wrap in help text windows). | 253 | Fixed some minor problems. (Like word wrap in help text windows). |
252 | 254 | ||
253 | Fixed a compiling problem in microkde/kresources. | 255 | Fixed a compiling problem in microkde/kresources. |
254 | 256 | ||
255 | KO/Pi is using zdbat (renamed to db2file) for syncing with Sharp DTM. | 257 | KO/Pi is using zdbat (renamed to db2file) for syncing with Sharp DTM. |
256 | This version now includes zdbat 1.0.0 (old version was zdbat 0.2.9) | 258 | This version now includes zdbat 1.0.0 (old version was zdbat 0.2.9) |
257 | such that now syncing KO/Pi with Sharp DTM should work on the | 259 | such that now syncing KO/Pi with Sharp DTM should work on the |
258 | Zaurus C 3000 model. | 260 | Zaurus C 3000 model. |
259 | 261 | ||
260 | ********** VERSION 1.9.15 ************ | 262 | ********** VERSION 1.9.15 ************ |
261 | 263 | ||
262 | Usebilty enhancements in KO/Pi: | 264 | Usebilty enhancements in KO/Pi: |
263 | When clicking on the date in a month view cell, the day view is shown. | 265 | When clicking on the date in a month view cell, the day view is shown. |
264 | Old behaviour was, that the "new event" dialog popped up. | 266 | Old behaviour was, that the "new event" dialog popped up. |
265 | 267 | ||
266 | Added a one step "undo delete" in KO/Pi (Accessable in the "Action" menu). | 268 | Added a one step "undo delete" in KO/Pi (Accessable in the "Action" menu). |
267 | That means, you can restore the latest | 269 | That means, you can restore the latest |
268 | event/todo/journal you have deleted. | 270 | event/todo/journal you have deleted. |
269 | A journal is deleted, if you clear all the text of the journal. | 271 | A journal is deleted, if you clear all the text of the journal. |
270 | 272 | ||
271 | Fixed the bug of the editor dialogs in KO/Pi of version 1.9.14. | 273 | Fixed the bug of the editor dialogs in KO/Pi of version 1.9.14. |
272 | 274 | ||
273 | KA/Pi starting in 480x640 resolution: | 275 | KA/Pi starting in 480x640 resolution: |
274 | Hide the filter action in toolbar | 276 | Hide the filter action in toolbar |
275 | and added icons for undo/delete/redo in toolbar. | 277 | and added icons for undo/delete/redo in toolbar. |
276 | 278 | ||
277 | Change in OM/Pi ViewMail dialog: | 279 | Change in OM/Pi ViewMail dialog: |
278 | When clicking on the "delete" icon the mail is deleted after confirmation as usual. | 280 | When clicking on the "delete" icon the mail is deleted after confirmation as usual. |
279 | But the edit dialog is not closed as before, now the next mail in the folder is shown automatically (if there is any). | 281 | But the edit dialog is not closed as before, now the next mail in the folder is shown automatically (if there is any). |
280 | 282 | ||
281 | Fixed a crash when deleting mail-accounts in OM/Pi. | 283 | Fixed a crash when deleting mail-accounts in OM/Pi. |
282 | 284 | ||
283 | 285 | ||
284 | ********** VERSION 1.9.14 ************ | 286 | ********** VERSION 1.9.14 ************ |
285 | 287 | ||
286 | Fixed some problems with the dialog sizes when switching | 288 | Fixed some problems with the dialog sizes when switching |
287 | portrait/landscape mode on 640x480 PDA display. | 289 | portrait/landscape mode on 640x480 PDA display. |
288 | 290 | ||
289 | Fixed some other small bugs in KA/Pi KO/Pi and OM/Pi and PwM/Pi. | 291 | Fixed some other small bugs in KA/Pi KO/Pi and OM/Pi and PwM/Pi. |
290 | 292 | ||
291 | Fixed an ugly bug in KOpieMail: | 293 | Fixed an ugly bug in KOpieMail: |
292 | KOpieMail was not able to write files (mails) to MSDOS file system, | 294 | KOpieMail was not able to write files (mails) to MSDOS file system, |
293 | like on an usual preformatted SD card. That should work now. | 295 | like on an usual preformatted SD card. That should work now. |
294 | To save your mail data on the Sd card do the following: | 296 | To save your mail data on the Sd card do the following: |
295 | Create a dir on the SD card: | 297 | Create a dir on the SD card: |
296 | mkdir /mnt/card/localmail | 298 | mkdir /mnt/card/localmail |
297 | Go to your home dir: | 299 | Go to your home dir: |
298 | cd | 300 | cd |
299 | Go to kopiemail data storage dir: | 301 | Go to kopiemail data storage dir: |
300 | cd kdepim/apps/kopiemail | 302 | cd kdepim/apps/kopiemail |
301 | Create a symlink to the SD card: | 303 | Create a symlink to the SD card: |
302 | ls -s /mnt/card/localmail | 304 | ls -s /mnt/card/localmail |
303 | Now KOpieMail will store all mails on the SD card. | 305 | Now KOpieMail will store all mails on the SD card. |
304 | 306 | ||
305 | KO/Pi Monthview: | 307 | KO/Pi Monthview: |
306 | Now "Go to Today" selects the current month from day 1-end, | 308 | Now "Go to Today" selects the current month from day 1-end, |
307 | not the current date + some days. | 309 | not the current date + some days. |
308 | I.e. "Go to Today" shows now always | 310 | I.e. "Go to Today" shows now always |
309 | the current month with first day of month in the first row. | 311 | the current month with first day of month in the first row. |
310 | 312 | ||
311 | Added missing German translation. | 313 | Added missing German translation. |
312 | 314 | ||
313 | Fixed icons of executeable on Wintendo. | 315 | Fixed icons of executeable on Wintendo. |
314 | 316 | ||
315 | Added a "Show next Mail" button to the OM/Pi | 317 | Added a "Show next Mail" button to the OM/Pi |
316 | mail viewer such that the mail below the current mail | 318 | mail viewer such that the mail below the current mail |
317 | in the mail list view of the current folder | 319 | in the mail list view of the current folder |
318 | can be read with a single click. | 320 | can be read with a single click. |
319 | 321 | ||
320 | 322 | ||
321 | ********** VERSION 1.9.13 ************ | 323 | ********** VERSION 1.9.13 ************ |
322 | 324 | ||
323 | Fixed nasty PwM/Pi file reading bug, when | 325 | Fixed nasty PwM/Pi file reading bug, when |
324 | the used hash algo of file is different then the global | 326 | the used hash algo of file is different then the global |
325 | hash algo. | 327 | hash algo. |
326 | 328 | ||
327 | Added KA/Pi support for opie mailit mailapplication. | 329 | Added KA/Pi support for opie mailit mailapplication. |
328 | 330 | ||
329 | Fixed some bugs in OM/Pi. | 331 | Fixed some bugs in OM/Pi. |
330 | Now character conversion tables are available for the Zaurus | 332 | Now character conversion tables are available for the Zaurus |
331 | to make OM/Pi working properly. | 333 | to make OM/Pi working properly. |
332 | To get the character conversion in OM/Pi working, please download | 334 | To get the character conversion in OM/Pi working, please download |
333 | at the sourceforge project site the package | 335 | at the sourceforge project site the package |
334 | sr-character-conversion_SharpROM_arm.ipk.zip | 336 | sr-character-conversion_SharpROM_arm.ipk.zip |
335 | (or oz-character-conversion_OZ-gcc3xx_arm.ipk.zip for OZ roms) | 337 | (or oz-character-conversion_OZ-gcc3xx_arm.ipk.zip for OZ roms) |
336 | from the section "general files for KDE/Pim" | 338 | from the section "general files for KDE/Pim" |
337 | Instructions how to install this package are in a ReadMe in this file. | 339 | Instructions how to install this package are in a ReadMe in this file. |
338 | 340 | ||
339 | 341 | ||
340 | Fixed the orientation change problem in KA/Pi when switching | 342 | Fixed the orientation change problem in KA/Pi when switching |
341 | portrait/landscape mode. | 343 | portrait/landscape mode. |
342 | 344 | ||
343 | French translation available for KA/Pi and OM/Pi. | 345 | French translation available for KA/Pi and OM/Pi. |
344 | 346 | ||
345 | Fixed some problems with categories in KO/Pi in DTM sync. | 347 | Fixed some problems with categories in KO/Pi in DTM sync. |
346 | 348 | ||
347 | Added selection dialog for export to phone in KA/Pi. | 349 | Added selection dialog for export to phone in KA/Pi. |
348 | 350 | ||
349 | If in KO/Pi is an attendee selected to add to a meeting and this | 351 | If in KO/Pi is an attendee selected to add to a meeting and this |
350 | attendee is already in the list of attendees, this person is not added | 352 | attendee is already in the list of attendees, this person is not added |
351 | again. | 353 | again. |
352 | 354 | ||
353 | Some menu cleanup in KA/Pi. | 355 | Some menu cleanup in KA/Pi. |
354 | 356 | ||
355 | ********** VERSION 1.9.12 ************ | 357 | ********** VERSION 1.9.12 ************ |
356 | 358 | ||
357 | Fix for the bug in KO/Pi What's Next view of version 1.9.11. | 359 | Fix for the bug in KO/Pi What's Next view of version 1.9.11. |
358 | 360 | ||
359 | Bugfix: Licence file is now shown again. | 361 | Bugfix: Licence file is now shown again. |
360 | 362 | ||
361 | OM/Pi now supports Unicode (utf8 charset). | 363 | OM/Pi now supports Unicode (utf8 charset). |
362 | Fixed some bugs in OM/Pi. | 364 | Fixed some bugs in OM/Pi. |
363 | 365 | ||
364 | KA/Pi has more German translation. | 366 | KA/Pi has more German translation. |
365 | 367 | ||
366 | 368 | ||
367 | ********** VERSION 1.9.11 ************ | 369 | ********** VERSION 1.9.11 ************ |
368 | 370 | ||
369 | Fixed several problems in PWM/Pi, like | 371 | Fixed several problems in PWM/Pi, like |
370 | asking the user, if unsaved changed are pending | 372 | asking the user, if unsaved changed are pending |
371 | when closing the app. | 373 | when closing the app. |
372 | And PwM/Pi handles now different texts for the | 374 | And PwM/Pi handles now different texts for the |
373 | fields Description, Username, Password, configurable per category. | 375 | fields Description, Username, Password, configurable per category. |
374 | 376 | ||
375 | Fixed a crash in KO/Pi , when importing/loading vcs files | 377 | Fixed a crash in KO/Pi , when importing/loading vcs files |
376 | which have an entry with an attendee with state: | 378 | which have an entry with an attendee with state: |
377 | NEEDS ACTION | 379 | NEEDS ACTION |
378 | 380 | ||
379 | Fixed some problems in the German translation of OM/Pi, | 381 | Fixed some problems in the German translation of OM/Pi, |
380 | which makes some dialogs not fitting on the screen | 382 | which makes some dialogs not fitting on the screen |
381 | of the Z 5500. | 383 | of the Z 5500. |
382 | 384 | ||
383 | Fixed Qtopia crash, when disabling/deinstalling | 385 | Fixed Qtopia crash, when disabling/deinstalling |
384 | KO/Pi alarm applet. | 386 | KO/Pi alarm applet. |
385 | 387 | ||
386 | Implemented direct KDE<->KA/Pi sync for KA/Pi running | 388 | Implemented direct KDE<->KA/Pi sync for KA/Pi running |
387 | on Linux desktop. | 389 | on Linux desktop. |
388 | 390 | ||
389 | Added feature "remove sync info" to sync menu. | 391 | Added feature "remove sync info" to sync menu. |
390 | 392 | ||
391 | Tweaked the KO/Pi What's next view a bit, added | 393 | Tweaked the KO/Pi What's next view a bit, added |
392 | setting to hide events that are done. | 394 | setting to hide events that are done. |
393 | 395 | ||
394 | Disabled "beam receive enabled" on startup to | 396 | Disabled "beam receive enabled" on startup to |
395 | avoid problems if Fastload is enabled. | 397 | avoid problems if Fastload is enabled. |
396 | Please set "beam receive enabled", | 398 | Please set "beam receive enabled", |
397 | if you want to receive data via IR. | 399 | if you want to receive data via IR. |
398 | 400 | ||
399 | Fixed bug in direct KDE<->KO/Pi sync for KO/Pi running | 401 | Fixed bug in direct KDE<->KO/Pi sync for KO/Pi running |
400 | on Linux desktop. | 402 | on Linux desktop. |
401 | 403 | ||
402 | Made in KA/Pi scrolling possible, if details view is selected. | 404 | Made in KA/Pi scrolling possible, if details view is selected. |
403 | (The keyboard focus is set automatically to the search line) | 405 | (The keyboard focus is set automatically to the search line) |
404 | 406 | ||
405 | Fixed a bug in DMT sync, that a new entry in DTM was added | 407 | Fixed a bug in DMT sync, that a new entry in DTM was added |
406 | on every sync to Kx/Pi. | 408 | on every sync to Kx/Pi. |
407 | 409 | ||
408 | Fixed missing writing of KA/Pi categories to DMT entries when syncing. | 410 | Fixed missing writing of KA/Pi categories to DMT entries when syncing. |
409 | 411 | ||
410 | Fixed a bug in DMT sync with todos created in KO/Pi containing | 412 | Fixed a bug in DMT sync with todos created in KO/Pi containing |
411 | non-latin1 characters. | 413 | non-latin1 characters. |
412 | 414 | ||
413 | Rearranged package contents of Sharp-ipks and made all | 415 | Rearranged package contents of Sharp-ipks and made all |
414 | packages installable on SD again. | 416 | packages installable on SD again. |
415 | 417 | ||
416 | Fixed the writing of addressbook data in DTM sync. | 418 | Fixed the writing of addressbook data in DTM sync. |
417 | Empty fields in KA/Pi were not removed. | 419 | Empty fields in KA/Pi were not removed. |
418 | 420 | ||
419 | Added better category handling in KA/Pi: | 421 | Added better category handling in KA/Pi: |
420 | Added item | 422 | Added item |
421 | Edit Categories and | 423 | Edit Categories and |
422 | Manage new categories | 424 | Manage new categories |
423 | to the settings menu. | 425 | to the settings menu. |
424 | Possible to configure a view to display categories. | 426 | Possible to configure a view to display categories. |
425 | 427 | ||
426 | Added detailed "KDE Sync Howto" and "Multi Sync Howto" to Help menu. | 428 | Added detailed "KDE Sync Howto" and "Multi Sync Howto" to Help menu. |
427 | 429 | ||
428 | Fixed displaying of "free" days and time in KO Monthview and Agendaview. | 430 | Fixed displaying of "free" days and time in KO Monthview and Agendaview. |
429 | 431 | ||
430 | ... and many other bugfixes. | 432 | ... and many other bugfixes. |
431 | 433 | ||
432 | ********** VERSION 1.9.10 ************ | 434 | ********** VERSION 1.9.10 ************ |
433 | 435 | ||
434 | Many internal small bugfixes. | 436 | Many internal small bugfixes. |
435 | And fix of the "big" bug in KO/Pi, | 437 | And fix of the "big" bug in KO/Pi, |
436 | that after Syncing the appointments had an offset by several hours. | 438 | that after Syncing the appointments had an offset by several hours. |
437 | That was a problem with the internal timezone setting, | 439 | That was a problem with the internal timezone setting, |
438 | introduced by the changed timezone configuration settings. | 440 | introduced by the changed timezone configuration settings. |
439 | 441 | ||
440 | German translation for OM/Pi is now available. | 442 | German translation for OM/Pi is now available. |
441 | 443 | ||
442 | 444 | ||
443 | ********** VERSION 1.9.9 ************ | 445 | ********** VERSION 1.9.9 ************ |
444 | 446 | ||
445 | KDE-Pim/Pi has a new Member! | 447 | KDE-Pim/Pi has a new Member! |
446 | It is called PWM/Pi (Passwordmanager/platform-independent) | 448 | It is called PWM/Pi (Passwordmanager/platform-independent) |
447 | and it is available for the Zaurus. | 449 | and it is available for the Zaurus. |
448 | It is planned, that it will be available later for Windows. | 450 | It is planned, that it will be available later for Windows. |
449 | (And for Linux, of course). | 451 | (And for Linux, of course). |
450 | It is a port of the Passwordmanager of KDE. | 452 | It is a port of the Passwordmanager of KDE. |
451 | It will need the MicroKDElibs to run. | 453 | It will need the MicroKDElibs to run. |
452 | 454 | ||
453 | Made loading of addressbooks in KA/Pi up to 7 times faster! | 455 | Made loading of addressbooks in KA/Pi up to 7 times faster! |
454 | The bigger your addressbook file, the more starting speed | 456 | The bigger your addressbook file, the more starting speed |
455 | will you gain. (relatively) | 457 | will you gain. (relatively) |
456 | 458 | ||
457 | The Qtopia addressbook connector is now platform independend | 459 | The Qtopia addressbook connector is now platform independend |
458 | as well and should work on any platform for importing/exporting | 460 | as well and should work on any platform for importing/exporting |
459 | Qtopia and Opie XML files. | 461 | Qtopia and Opie XML files. |
460 | 462 | ||
461 | Added a +30min feature to the timezone settings to make | 463 | Added a +30min feature to the timezone settings to make |
462 | KDE-Pim/Pi useable in Australia and other parts on the | 464 | KDE-Pim/Pi useable in Australia and other parts on the |
463 | world with strange timezones ;-) | 465 | world with strange timezones ;-) |
464 | 466 | ||
465 | German "Umlaute" should now be sorted correctly on the Z in KA/Pi. | 467 | German "Umlaute" should now be sorted correctly on the Z in KA/Pi. |
466 | 468 | ||
467 | It is now possible to disable the | 469 | It is now possible to disable the |
468 | "receive data via infrared" feature, such that syncing with | 470 | "receive data via infrared" feature, such that syncing with |
469 | Outlook is now possible again with Kx/Pi runing. | 471 | Outlook is now possible again with Kx/Pi runing. |
470 | Please disable it, before syncing Sharp DTM with Outlook. | 472 | Please disable it, before syncing Sharp DTM with Outlook. |
471 | For your convenience, the "receive data via infrared" feature | 473 | For your convenience, the "receive data via infrared" feature |
472 | is disabled automatically, if you sync Kx/Pi with DTM. | 474 | is disabled automatically, if you sync Kx/Pi with DTM. |
473 | You have to enable it again manually after syncing. | 475 | You have to enable it again manually after syncing. |
474 | Enabling this feature makes it impossible to start the | 476 | Enabling this feature makes it impossible to start the |
475 | Sharp DTM apps. If this feature is enabled, you will only get the | 477 | Sharp DTM apps. If this feature is enabled, you will only get the |
476 | alarm notification from KO/Pi and not from the Sharp calendar. | 478 | alarm notification from KO/Pi and not from the Sharp calendar. |
477 | This is very useful if you sync KO/Pi with Sharp DTM, | 479 | This is very useful if you sync KO/Pi with Sharp DTM, |
478 | because after syncing you usually would get notified about | 480 | because after syncing you usually would get notified about |
479 | an alarm by KO/Pi and the Sharp Calendar. | 481 | an alarm by KO/Pi and the Sharp Calendar. |
480 | 482 | ||
481 | Together with the Linux desktop version of KO/Pi | 483 | Together with the Linux desktop version of KO/Pi |
482 | it is now possible to sync KO/Pi on the Zaurus | 484 | it is now possible to sync KO/Pi on the Zaurus |
483 | with the complete KDE-desktop (3.3 or later) | 485 | with the complete KDE-desktop (3.3 or later) |
484 | calendar data easily. | 486 | calendar data easily. |
485 | That makes it possible to sync the Z with one | 487 | That makes it possible to sync the Z with one |
486 | click of a mouse with the KDE-Desktop. | 488 | click of a mouse with the KDE-Desktop. |
487 | This feature it available for all Zaurus platforms KO/Pi | 489 | This feature it available for all Zaurus platforms KO/Pi |
488 | is running on. | 490 | is running on. |
489 | The only thing needed is a running KO/Pi on Linux and | 491 | The only thing needed is a running KO/Pi on Linux and |
490 | a compiled version of the small | 492 | a compiled version of the small |
491 | KDE-Pim/Pi<->KDE-Desktop access command line program, | 493 | KDE-Pim/Pi<->KDE-Desktop access command line program, |
492 | which is in the KDE-Pim/Pi sources available. | 494 | which is in the KDE-Pim/Pi sources available. |
493 | 495 | ||
494 | The "KDE-desktop" syncing feature for KA/Pi will follow | 496 | The "KDE-desktop" syncing feature for KA/Pi will follow |
495 | in the next releases. | 497 | in the next releases. |
496 | 498 | ||
497 | Fixed the vcard export bug, which had the version 1.9.8. | 499 | Fixed the vcard export bug, which had the version 1.9.8. |
498 | 500 | ||
499 | Added missing GERMAN translation to KO/Pi. | 501 | Added missing GERMAN translation to KO/Pi. |
500 | Hi PsionX, could you add the missing french translation?Thx! | 502 | Hi PsionX, could you add the missing french translation?Thx! |
501 | 503 | ||
502 | Translation files for KA/Pi are available as well. | 504 | Translation files for KA/Pi are available as well. |
503 | GERMAN translation will be available in the next release. | 505 | GERMAN translation will be available in the next release. |
504 | PsionX ( yres, you again ;-) ), could you start translating | 506 | PsionX ( yres, you again ;-) ), could you start translating |
505 | KA/Pi? Thx! | 507 | KA/Pi? Thx! |
506 | 508 | ||
507 | You can download the version 1.9.9 at | 509 | You can download the version 1.9.9 at |
508 | 510 | ||
509 | http://sourceforge.net/project/showfiles.php?group_id=104103&package_id=112604 | 511 | http://sourceforge.net/project/showfiles.php?group_id=104103&package_id=112604 |
510 | 512 | ||
511 | Note: | 513 | Note: |
512 | To run the mail program OM/Pi you need libopenssl. | 514 | To run the mail program OM/Pi you need libopenssl. |
513 | A link to a download loaction is available at | 515 | A link to a download loaction is available at |
514 | ZSI at www.killefiz.de | 516 | ZSI at www.killefiz.de |
515 | 517 | ||
516 | 518 | ||
517 | ********** VERSION 1.9.8 ************ | 519 | ********** VERSION 1.9.8 ************ |
518 | 520 | ||
519 | Fixed character decoding in OM/Pi. | 521 | Fixed character decoding in OM/Pi. |
520 | (e.g. German "Umlaute" were not displayed properly.) | 522 | (e.g. German "Umlaute" were not displayed properly.) |
521 | 523 | ||
522 | Made is possible to reparent todos in KO/Pi. | 524 | Made is possible to reparent todos in KO/Pi. |
523 | Use contextmenu or keys (look at Help-Keys + Colors) for that. | 525 | Use contextmenu or keys (look at Help-Keys + Colors) for that. |
524 | 526 | ||
525 | Added the missing Sync-Howto and WhatsNew to the packages. | 527 | Added the missing Sync-Howto and WhatsNew to the packages. |
526 | 528 | ||
527 | KO/Pi on Linux desktop can now sync with KDE desktop. | 529 | KO/Pi on Linux desktop can now sync with KDE desktop. |
528 | That means: When using KO/Pi on Linux desktop for syncing with | 530 | That means: When using KO/Pi on Linux desktop for syncing with |
529 | KDE desktop and the Zaurus, the Zaurus can be synced now | 531 | KDE desktop and the Zaurus, the Zaurus can be synced now |
530 | with all KDE-Calendar resources, not only with one local file. | 532 | with all KDE-Calendar resources, not only with one local file. |
531 | (That makes it possible to sync the Zaurus with the | 533 | (That makes it possible to sync the Zaurus with the |
532 | calendar data on a Kolab server) | 534 | calendar data on a Kolab server) |
533 | 535 | ||
534 | KA/Pi syncing with KDE desktop will be available in the next version. | 536 | KA/Pi syncing with KDE desktop will be available in the next version. |
535 | 537 | ||
536 | 538 | ||
537 | ********** VERSION 1.9.7 ************ | 539 | ********** VERSION 1.9.7 ************ |
538 | 540 | ||
539 | KO/Pi - KA/Pi on Windows: | 541 | KO/Pi - KA/Pi on Windows: |
540 | Now a directory can be defined by the user, where the | 542 | Now a directory can be defined by the user, where the |
541 | application/config data should be saved. | 543 | application/config data should be saved. |
542 | Define your desired path in the evironment variable | 544 | Define your desired path in the evironment variable |
543 | MICROKDEHOME | 545 | MICROKDEHOME |
544 | before starting KO/Pi or KA/Pi. | 546 | before starting KO/Pi or KA/Pi. |
545 | 547 | ||
546 | An easy Kx/Pi to Kx/Pi syncing is now possible | 548 | An easy Kx/Pi to Kx/Pi syncing is now possible |
547 | (it is called Pi-Sync) via network. | 549 | (it is called Pi-Sync) via network. |
548 | Please look at the Sync Howto. | 550 | Please look at the Sync Howto. |
549 | 551 | ||
550 | Exporting of calendar data and contacts to mobile phones is now possible. | 552 | Exporting of calendar data and contacts to mobile phones is now possible. |
551 | The SyncHowto is updated with information howto | 553 | The SyncHowto is updated with information howto |
552 | access/sync mobile phones. | 554 | access/sync mobile phones. |
553 | Please look at the Sync Howto. | 555 | Please look at the Sync Howto. |
554 | 556 | ||
555 | Now KO/Pi and KA/Pi on the Zaurus can receive data via infrared directly. | 557 | Now KO/Pi and KA/Pi on the Zaurus can receive data via infrared directly. |
556 | Please disable Fastload for the original contact/calendar applications | 558 | Please disable Fastload for the original contact/calendar applications |
557 | and close them. | 559 | and close them. |
558 | KO/Pi and KA/Pi must be running in order to receive the data. | 560 | KO/Pi and KA/Pi must be running in order to receive the data. |
559 | (KO/Pi and KA/Pi are always running if Fastload for them is enabled!) | 561 | (KO/Pi and KA/Pi are always running if Fastload for them is enabled!) |
560 | 562 | ||
561 | In the KA/Pi details view are now the preferred tel. numbers displayed on top | 563 | In the KA/Pi details view are now the preferred tel. numbers displayed on top |
562 | of the other data ( emails/tel.numbers/addresses) | 564 | of the other data ( emails/tel.numbers/addresses) |
563 | 565 | ||
564 | Fixed some syncing problems in KA/Pi. | 566 | Fixed some syncing problems in KA/Pi. |
565 | 567 | ||
566 | Added font settings for the KA/Pi details view. | 568 | Added font settings for the KA/Pi details view. |
567 | Added fields "children's name" and "gender" to KA/Pi. | 569 | Added fields "children's name" and "gender" to KA/Pi. |
568 | 570 | ||
569 | Made searching in KA/Pi better: | 571 | Made searching in KA/Pi better: |
570 | Now the first item in a view is selected after a search automatically and | 572 | Now the first item in a view is selected after a search automatically and |
571 | the views can be scrolled up/down when the search input field has the keyboard focus. | 573 | the views can be scrolled up/down when the search input field has the keyboard focus. |
572 | 574 | ||
573 | And, of course, fixed a bunch of reported bugs in KO/Pi and KA/Pi. | 575 | And, of course, fixed a bunch of reported bugs in KO/Pi and KA/Pi. |
574 | 576 | ||
575 | 577 | ||
576 | ********** VERSION 1.9.6 ************ | 578 | ********** VERSION 1.9.6 ************ |
577 | 579 | ||
578 | Changes in the external application communication on the Zaurus | 580 | Changes in the external application communication on the Zaurus |
579 | in order to use less RAM when the apps are running. | 581 | in order to use less RAM when the apps are running. |
580 | First syncing of addressbooks (KA/Pi) is possible. | 582 | First syncing of addressbooks (KA/Pi) is possible. |
581 | 583 | ||
582 | 584 | ||
583 | ********** VERSION 1.9.5a ************ | 585 | ********** VERSION 1.9.5a ************ |
584 | 586 | ||
585 | Fixed a bug in KO/Pi in the SharpDTM sync of version 1.9.5. | 587 | Fixed a bug in KO/Pi in the SharpDTM sync of version 1.9.5. |
586 | Fixed some small bugs. | 588 | Fixed some small bugs. |
587 | KA/Pi shows now the birthday in summary view. | 589 | KA/Pi shows now the birthday in summary view. |
588 | Now OM/Pi and KA/Pi are using the date format defined in KO/Pi | 590 | Now OM/Pi and KA/Pi are using the date format defined in KO/Pi |
589 | for displaying dates. | 591 | for displaying dates. |
590 | 592 | ||
591 | 593 | ||
592 | ********** VERSION 1.9.5 ************ | 594 | ********** VERSION 1.9.5 ************ |
593 | 595 | ||
594 | There is still no Addressbook syncing! | 596 | There is still no Addressbook syncing! |
595 | 597 | ||
596 | New in 1.9.5: | 598 | New in 1.9.5: |
597 | 599 | ||
598 | Many bugfixes. | 600 | Many bugfixes. |
599 | Better searching in KA/Pi. | 601 | Better searching in KA/Pi. |
600 | You can configure in KA/Pi if you want to search only after | 602 | You can configure in KA/Pi if you want to search only after |
601 | <return> key pressed. | 603 | <return> key pressed. |
602 | 604 | ||
603 | Better mail downloading in OM/Pi. | 605 | Better mail downloading in OM/Pi. |
604 | 606 | ||
605 | First experimental alpha version of sync of KO/Pi with mobile phones. | 607 | First experimental alpha version of sync of KO/Pi with mobile phones. |
606 | See gammu documentation for supported phones. | 608 | See gammu documentation for supported phones. |
607 | You need to install the package kammu_1.9.5_arm.ipk for sync of KO/Pi with mobile phones. kammu_1.9.5_arm.ipk needs libbluetooth and libsdp. | 609 | You need to install the package kammu_1.9.5_arm.ipk for sync of KO/Pi with mobile phones. kammu_1.9.5_arm.ipk needs libbluetooth and libsdp. |
608 | Quick hint how to use: | 610 | Quick hint how to use: |
609 | NOTE: MOBILE PHONE SYNC IS EXPERIMENTAL! | 611 | NOTE: MOBILE PHONE SYNC IS EXPERIMENTAL! |
610 | Install kammu_1.9.5_arm.ipk , libbluetooth and libsdp. | 612 | Install kammu_1.9.5_arm.ipk , libbluetooth and libsdp. |
611 | Create syncprofile - mobile device | 613 | Create syncprofile - mobile device |
612 | Remove entry for model. (Leave empty ). | 614 | Remove entry for model. (Leave empty ). |
613 | Enable infrared on Zaurus and your Phone. | 615 | Enable infrared on Zaurus and your Phone. |
614 | Sync. | 616 | Sync. |
615 | To get a more detailed log, start kopi from konsole. | 617 | To get a more detailed log, start kopi from konsole. |
616 | 618 | ||
617 | ********** VERSION 1.9.4 ************ | 619 | ********** VERSION 1.9.4 ************ |
618 | 620 | ||
619 | This is the version 1.9.4 of KDE-Pim/Pi for the Zaurus. | 621 | This is the version 1.9.4 of KDE-Pim/Pi for the Zaurus. |
620 | 622 | ||
621 | WARNING: | 623 | WARNING: |
622 | PLEASE BACKUP ALL YOUR DATA! | 624 | PLEASE BACKUP ALL YOUR DATA! |
623 | We have changed a lot and maybe there are some unknown problems. | 625 | We have changed a lot and maybe there are some unknown problems. |
624 | 626 | ||
625 | SYNC HANDLING HAS CHANGED! | 627 | SYNC HANDLING HAS CHANGED! |
626 | Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. | 628 | Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. |
627 | (This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). | 629 | (This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). |
628 | 630 | ||
629 | You need the kmicrokdelibs_1.9.4_arm.ipk as a base for the other programs. | 631 | You need the kmicrokdelibs_1.9.4_arm.ipk as a base for the other programs. |
630 | If you get the error: "Install only possible in main memory", just try it again to install it on SD card. That worked for me. And it was reported that rebooting Qtopia did help in this case as well. | 632 | If you get the error: "Install only possible in main memory", just try it again to install it on SD card. That worked for me. And it was reported that rebooting Qtopia did help in this case as well. |
631 | 633 | ||
632 | As programs are available: | 634 | As programs are available: |
633 | KO/Pi (korganizer ipk) - a calendar program. | 635 | KO/Pi (korganizer ipk) - a calendar program. |
634 | KA/Pi (kaddressbook ipk ) - an addressbook | 636 | KA/Pi (kaddressbook ipk ) - an addressbook |
635 | OM/Pi (kopiemail ipk ) an email program with pop/smtp and IMAP support. | 637 | OM/Pi (kopiemail ipk ) an email program with pop/smtp and IMAP support. |
636 | 638 | ||
637 | An alarm notification program ( korganizer-alarm ipk ) for KO/Pi that notifies you about alarms, even if the Zaurus is in suspend mode. | 639 | An alarm notification program ( korganizer-alarm ipk ) for KO/Pi that notifies you about alarms, even if the Zaurus is in suspend mode. |
638 | (If you do not see an icon in the taskbar after installing korganizer-alarm, please restart Qtopia) | 640 | (If you do not see an icon in the taskbar after installing korganizer-alarm, please restart Qtopia) |
639 | 641 | ||
640 | All the applications are installed in a "Pim" TAB. | 642 | All the applications are installed in a "Pim" TAB. |
641 | If this TAB is new on your system, you can get an icon in this TAB by installing pim_TAB_icon_1.9.4_arm.ipk | 643 | If this TAB is new on your system, you can get an icon in this TAB by installing pim_TAB_icon_1.9.4_arm.ipk |
642 | 644 | ||
643 | All the application are integrated. | 645 | All the application are integrated. |
644 | Such that you can choose in KO/Pi the attendees of a meeting from the addresses in KA/Pi. When you click in KA/Pi on the email address, OM/Pi is started to write the mail. | 646 | Such that you can choose in KO/Pi the attendees of a meeting from the addresses in KA/Pi. When you click in KA/Pi on the email address, OM/Pi is started to write the mail. |
645 | 647 | ||
646 | HINT: | 648 | HINT: |
647 | If you install KPhone/Pi 0.9.7, it will be called, if you click in KA/Pi on a phone number. | 649 | If you install KPhone/Pi 0.9.7, it will be called, if you click in KA/Pi on a phone number. |
648 | 650 | ||
649 | What's new? | 651 | What's new? |
650 | 652 | ||
651 | SYNC HANDLING HAS CHANGED! | 653 | SYNC HANDLING HAS CHANGED! |
652 | Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. | 654 | Such that, if you sync now with an already synded device, you will duplicated entries after the first sync. |
653 | (This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). | 655 | (This change was introduced to make it possible to sync with mobile phones, which will be available later (maybe in 4 weeks). |
654 | 656 | ||
655 | New in OM/Pi: | 657 | New in OM/Pi: |
656 | When copying(i.e. downloading mails) , you can specify, that only mails of a given size should be downloaded. Added mail copy possibility for selected mails. | 658 | When copying(i.e. downloading mails) , you can specify, that only mails of a given size should be downloaded. Added mail copy possibility for selected mails. |
657 | 659 | ||
658 | New in KO/Pi: | 660 | New in KO/Pi: |
659 | French is now available for KO/Pi. | 661 | French is now available for KO/Pi. |
660 | Choose menu:Actions - Configure:TAB locale | 662 | Choose menu:Actions - Configure:TAB locale |
661 | Syncing has changed. | 663 | Syncing has changed. |
662 | Phone sync available soon. | 664 | Phone sync available soon. |
663 | Not much changes, I cannot remember them ... | 665 | Not much changes, I cannot remember them ... |
664 | 666 | ||
665 | New in KA/Pi: | 667 | New in KA/Pi: |
666 | Beaming possible. | 668 | Beaming possible. |
667 | Sharp DTM readonly access possible( create a new DTM resource ); | 669 | Sharp DTM readonly access possible( create a new DTM resource ); |
668 | Better searching possible. | 670 | Better searching possible. |
669 | Search is performed only after pressing the return key. | 671 | Search is performed only after pressing the return key. |
670 | Use wildcard * to specify parts of a name. | 672 | Use wildcard * to specify parts of a name. |
671 | 673 | ||
672 | Better name/email selection dialog (called from KO/Pi or OM/Pi). In this dialog, now searching is possible. Like in KA/Pi, use return key and wildcard * . | 674 | Better name/email selection dialog (called from KO/Pi or OM/Pi). In this dialog, now searching is possible. Like in KA/Pi, use return key and wildcard * . |
673 | 675 | ||
674 | A big improvement is the new management of the contact access. | 676 | A big improvement is the new management of the contact access. |
675 | In version 1.9.3, every application was using their own addressbook access data. | 677 | In version 1.9.3, every application was using their own addressbook access data. |
676 | That means, the addressbook was loaded up to three times in the memory, when accessed by KA/Pi, KO/Pi and OM/Pi. | 678 | That means, the addressbook was loaded up to three times in the memory, when accessed by KA/Pi, KO/Pi and OM/Pi. |
677 | That was wasting of memory, if you had several hundreds of contacts. | 679 | That was wasting of memory, if you had several hundreds of contacts. |
678 | 680 | ||
679 | Now only KA/Pi accesses the addressbook. | 681 | Now only KA/Pi accesses the addressbook. |
680 | If KO/Pi or OM/Pi want to get some name/email data, they request KA/Pi to open the name/email selection dialog and send it back to them. | 682 | If KO/Pi or OM/Pi want to get some name/email data, they request KA/Pi to open the name/email selection dialog and send it back to them. |
681 | If you click on an attendee in a meeting, its contact data is displayed in KA/Pi directly. | 683 | If you click on an attendee in a meeting, its contact data is displayed in KA/Pi directly. |
682 | That means, if KO/Pi or OM/Pi want to access contact data, KA/Pi is started first. | 684 | That means, if KO/Pi or OM/Pi want to access contact data, KA/Pi is started first. |
683 | 685 | ||
684 | New in the KO/Pi alarm applet: | 686 | New in the KO/Pi alarm applet: |
685 | Configure your own timer popup menu! | 687 | Configure your own timer popup menu! |
686 | (Text and minutes for timer countdown) | 688 | (Text and minutes for timer countdown) |
687 | Just edit the file | 689 | Just edit the file |
688 | (yourhomedir)/.kopialarmtimerrc | 690 | (yourhomedir)/.kopialarmtimerrc |
689 | and start/stop a timer to get a new menu with the data of this file. | 691 | and start/stop a timer to get a new menu with the data of this file. |
690 | 692 | ||
691 | ********** VERSION 1.9.3 ************ | 693 | ********** VERSION 1.9.3 ************ |
692 | 1) | 694 | 1) |
693 | Now KO/Pi on Windows imports directly the calendar data of | 695 | Now KO/Pi on Windows imports directly the calendar data of |
694 | an installed Outlook. Should work with OL version >= 2000. | 696 | an installed Outlook. Should work with OL version >= 2000. |
695 | 697 | ||
696 | ********** VERSION 1.9.2 ************ | 698 | ********** VERSION 1.9.2 ************ |
697 | 1) | 699 | 1) |
698 | KDE-Pim/Pi has got a new member: | 700 | KDE-Pim/Pi has got a new member: |
699 | KmicroMail (KM/Pi) is a mail program, | 701 | KmicroMail (KM/Pi) is a mail program, |
700 | which can handle IMAP and POP mail access. | 702 | which can handle IMAP and POP mail access. |
701 | It is based on Opie-Mail v3. | 703 | It is based on Opie-Mail v3. |
702 | All dependencies to the Opie libraries ar removed, | 704 | All dependencies to the Opie libraries ar removed, |
703 | such that no additional Opie lib is needed. | 705 | such that no additional Opie lib is needed. |
704 | It is already integrated in KO/Pi and KA/Pi. | 706 | It is already integrated in KO/Pi and KA/Pi. |
705 | It it now available for the Zaurus,probably it | 707 | It it now available for the Zaurus,probably it |
706 | will be available for other platforms later. | 708 | will be available for other platforms later. |
707 | Hint: | 709 | Hint: |
708 | Create your own contact (name + email) | 710 | Create your own contact (name + email) |
709 | in KA/Pi, select this contact and choose menu: | 711 | in KA/Pi, select this contact and choose menu: |
710 | Settings - Set Who Am I. | 712 | Settings - Set Who Am I. |
711 | Now the settings of this contact are used as | 713 | Now the settings of this contact are used as |
712 | the sender data in KM/Pi. | 714 | the sender data in KM/Pi. |
713 | 2) | 715 | 2) |
714 | KDE-Pim/Pi is split up in five different | 716 | KDE-Pim/Pi is split up in five different |
715 | packages now precompiled for Sharp Zaurus: | 717 | packages now precompiled for Sharp Zaurus: |
716 | --kmicrokdelibs_1.9.2_arm.ipk | 718 | --kmicrokdelibs_1.9.2_arm.ipk |
717 | The libs are needed for any | 719 | The libs are needed for any |
718 | of the following programs: | 720 | of the following programs: |
719 | --kaddressbook_1.9.2_arm.ipk | 721 | --kaddressbook_1.9.2_arm.ipk |
720 | --kmicromail_1.9.2_arm.ipk | 722 | --kmicromail_1.9.2_arm.ipk |
721 | --korganizer_1.9.2_arm.ipk | 723 | --korganizer_1.9.2_arm.ipk |
722 | Independ from that, there is the alarm applet | 724 | Independ from that, there is the alarm applet |
723 | available for KO/Pi, which also offers | 725 | available for KO/Pi, which also offers |
724 | quick access for a new mail or | 726 | quick access for a new mail or |
725 | showing the addressbook.: | 727 | showing the addressbook.: |
726 | --korganizer-alarm_1.9.2_arm.ipk | 728 | --korganizer-alarm_1.9.2_arm.ipk |
727 | Independend means, that the alarm applet | 729 | Independend means, that the alarm applet |
728 | does not need any of the libs or programs above to run. | 730 | does not need any of the libs or programs above to run. |
729 | But it would be quite useless without these programs. | 731 | But it would be quite useless without these programs. |
730 | NOTE: | 732 | NOTE: |
731 | If you get a | 733 | If you get a |
732 | "This application depends on other programs" | 734 | "This application depends on other programs" |
733 | during installation of | 735 | during installation of |
734 | --kmicrokdelibs_1.9.2_arm.ipk | 736 | --kmicrokdelibs_1.9.2_arm.ipk |
735 | you probably do not have to care about that. | 737 | you probably do not have to care about that. |
736 | kmicrokdelibs_1.9.2 will come with some | 738 | kmicrokdelibs_1.9.2 will come with some |
737 | resource plugins, which needs additional libraries. | 739 | resource plugins, which needs additional libraries. |
738 | (E.g. libopie1, if you want to use the | 740 | (E.g. libopie1, if you want to use the |
739 | opie resource connector in KA/Pi). | 741 | opie resource connector in KA/Pi). |
740 | If you do not have this libraries installed, | 742 | If you do not have this libraries installed, |
741 | you simply cannot use the resource. | 743 | you simply cannot use the resource. |
742 | To make it clear: | 744 | To make it clear: |
743 | If the libraries are missing, the applications | 745 | If the libraries are missing, the applications |
744 | using kmicrokdelibs will start, | 746 | using kmicrokdelibs will start, |
745 | because the resources are plugins. | 747 | because the resources are plugins. |
746 | 3) | 748 | 3) |
747 | KO/Pi and friends are now installable on SD-Card! | 749 | KO/Pi and friends are now installable on SD-Card! |
748 | It is recommended to install all libs and apps | 750 | It is recommended to install all libs and apps |
749 | on the SD card or all in the internal storage. | 751 | on the SD card or all in the internal storage. |
750 | There may be problems, if this is mixed. | 752 | There may be problems, if this is mixed. |
751 | 4) | 753 | 4) |
752 | Fixed two bugs in the alarm notification on Windows. | 754 | Fixed two bugs in the alarm notification on Windows. |
753 | 5) | 755 | 5) |
754 | Great improvement! | 756 | Great improvement! |
755 | KO/Pi uses now the latest version of libical. | 757 | KO/Pi uses now the latest version of libical. |
756 | Libical is the library which actually reads | 758 | Libical is the library which actually reads |
757 | the calendar files and extract the data from it. | 759 | the calendar files and extract the data from it. |
758 | With the old version, there were problems | 760 | With the old version, there were problems |
759 | (crashes or program hangs) when licical did read | 761 | (crashes or program hangs) when licical did read |
760 | files, which were not stored from KO/Pi. | 762 | files, which were not stored from KO/Pi. |
761 | I do not know, if the new libical works perfect, | 763 | I do not know, if the new libical works perfect, |
762 | but actually it works much better than | 764 | but actually it works much better than |
763 | the old version. | 765 | the old version. |
764 | There are no problems with compatibility with | 766 | There are no problems with compatibility with |
765 | old calendar files of KO/Pi, of course! | 767 | old calendar files of KO/Pi, of course! |
766 | 6) | 768 | 6) |
767 | New in KA/Pi: | 769 | New in KA/Pi: |
768 | Opie addressbook resource connector available! | 770 | Opie addressbook resource connector available! |
769 | You will need libopie1 and the opie addressbook, | 771 | You will need libopie1 and the opie addressbook, |
770 | of course. | 772 | of course. |
771 | With the Opie addressbook resource connector, | 773 | With the Opie addressbook resource connector, |
772 | you can access the Opie addressbook readonly in KA/Pi. | 774 | you can access the Opie addressbook readonly in KA/Pi. |
773 | If you want to edit or import the data into KA/Pi, | 775 | If you want to edit or import the data into KA/Pi, |
774 | do this: | 776 | do this: |
775 | a) Create an Opie resource. | 777 | a) Create an Opie resource. |
776 | (Menu: Settings-Configure Resources). | 778 | (Menu: Settings-Configure Resources). |
777 | After configuration and restarting KA/Pi you should see | 779 | After configuration and restarting KA/Pi you should see |
778 | the Opie contacts in KA/Pi. | 780 | the Opie contacts in KA/Pi. |
779 | b) Select some or all Opie contacts. | 781 | b) Select some or all Opie contacts. |
780 | (NOTE: +++++ | 782 | (NOTE: +++++ |
781 | To know exactly, what contacts are Opie contacts, | 783 | To know exactly, what contacts are Opie contacts, |
782 | do this: Choose menu: | 784 | do this: Choose menu: |
783 | View-Modify View - TAB Fields. | 785 | View-Modify View - TAB Fields. |
784 | Select in the above list "Resource" and click | 786 | Select in the above list "Resource" and click |
785 | down arrow to add it to the "Selected fields". | 787 | down arrow to add it to the "Selected fields". |
786 | Click OK. | 788 | Click OK. |
787 | Now you have a new column "Resource" in your list, | 789 | Now you have a new column "Resource" in your list, |
788 | where you can see, what an Opie resource is. | 790 | where you can see, what an Opie resource is. |
789 | ++++ NOTE end.) | 791 | ++++ NOTE end.) |
790 | Ok, we do have now some Opie contacts seleted. | 792 | Ok, we do have now some Opie contacts seleted. |
791 | (Use SHIFT or CTRL key in order to multiple select). | 793 | (Use SHIFT or CTRL key in order to multiple select). |
792 | c) Choose menu: Edit-Copy. | 794 | c) Choose menu: Edit-Copy. |
793 | d) Choose menu: Edit-Paste. | 795 | d) Choose menu: Edit-Paste. |
794 | e) Select the resource, you want to add the contacts to. | 796 | e) Select the resource, you want to add the contacts to. |
795 | Congrats! Now you have read/write access to the copied | 797 | Congrats! Now you have read/write access to the copied |
796 | opie contacts as "real" KA/Pi contacts. | 798 | opie contacts as "real" KA/Pi contacts. |
797 | 799 | ||
798 | 800 | ||
799 | ********** VERSION 1.9.1 ************ | 801 | ********** VERSION 1.9.1 ************ |
800 | 1) | 802 | 1) |
801 | +++ IMPORTANT 1 +++ | 803 | +++ IMPORTANT 1 +++ |
802 | 804 | ||
803 | The storing place of the default calendar | 805 | The storing place of the default calendar |
804 | file has changed! | 806 | file has changed! |
805 | The default calendar file was | 807 | The default calendar file was |
806 | Applications/korganizer/mycalendar.ics | 808 | Applications/korganizer/mycalendar.ics |
807 | on Zaurus and | 809 | on Zaurus and |
808 | (yourHomeDir)/korganizer/mycalendar.ics | 810 | (yourHomeDir)/korganizer/mycalendar.ics |
809 | on Windows/Linux desktop. Now it is | 811 | on Windows/Linux desktop. Now it is |
810 | (yourHomeDir)/kdepim/korganizer/mycalendar.ics | 812 | (yourHomeDir)/kdepim/korganizer/mycalendar.ics |
811 | on Zaurus, Windows and Linux. | 813 | on Zaurus, Windows and Linux. |
812 | To load the old file, choose menu | 814 | To load the old file, choose menu |
813 | File-Load calendar backup. | 815 | File-Load calendar backup. |
814 | (It should be loaded automatically | 816 | (It should be loaded automatically |
815 | at startup with a warning message displayed). | 817 | at startup with a warning message displayed). |
816 | The place of the configuration file has changed too. | 818 | The place of the configuration file has changed too. |
817 | If you want to use your old KO/Pi config, | 819 | If you want to use your old KO/Pi config, |
818 | copy it to | 820 | copy it to |
819 | (yourHomeDir)/kdepim/config/korganizerrc | 821 | (yourHomeDir)/kdepim/config/korganizerrc |
820 | Please read VERSION 1.9.0 - topic 3) as well! | 822 | Please read VERSION 1.9.0 - topic 3) as well! |
821 | 823 | ||
822 | +++ IMPORTANT 2 +++ | 824 | +++ IMPORTANT 2 +++ |
823 | 825 | ||
824 | Because of the new paths, you will need | 826 | Because of the new paths, you will need |
825 | a new version of the KO/Pi alarm applet | 827 | a new version of the KO/Pi alarm applet |
826 | for Zaurus. | 828 | for Zaurus. |
827 | Use version >= 1.9.1 | 829 | Use version >= 1.9.1 |
828 | 830 | ||
829 | 2) | 831 | 2) |
830 | Now the QWhat'sThis Icon works for items | 832 | Now the QWhat'sThis Icon works for items |
831 | in the month view as well. | 833 | in the month view as well. |
832 | (See VERSION 1.7.8 Topic 1) ). | 834 | (See VERSION 1.7.8 Topic 1) ). |
833 | 3) | 835 | 3) |
834 | You can import birtsdays/anniversaries | 836 | You can import birtsdays/anniversaries |
835 | from KA/Pi into KO/Pi. | 837 | from KA/Pi into KO/Pi. |
836 | Choose menu File-Import birthdays. | 838 | Choose menu File-Import birthdays. |
837 | If you import twice, already imported items | 839 | If you import twice, already imported items |
838 | will not be imported again, if they | 840 | will not be imported again, if they |
839 | have not been changed in KO/Pi. | 841 | have not been changed in KO/Pi. |
840 | 4) | 842 | 4) |
841 | When syncing with sharp DTM, now a progress | 843 | When syncing with sharp DTM, now a progress |
842 | is shown, when the data is written back. | 844 | is shown, when the data is written back. |
843 | If there is much data in KO/Pi and no data | 845 | If there is much data in KO/Pi and no data |
844 | in DTM, that can take a long time. | 846 | in DTM, that can take a long time. |
845 | (But only for the first time ). | 847 | (But only for the first time ). |
846 | 5) | 848 | 5) |
847 | In the search dialog, you can search | 849 | In the search dialog, you can search |
848 | now for the name/email of an attendee | 850 | now for the name/email of an attendee |
849 | of an event/todo. | 851 | of an event/todo. |
850 | To get more space for displaying | 852 | To get more space for displaying |
851 | search results, the buttons | 853 | search results, the buttons |
852 | for "search" and "close" on the | 854 | for "search" and "close" on the |
853 | bottom are removed in the PDA version. | 855 | bottom are removed in the PDA version. |
854 | You have to click OK in the top right | 856 | You have to click OK in the top right |
855 | corner to do a search. | 857 | corner to do a search. |
856 | 6) | 858 | 6) |
857 | Now it is possible to disable the displaying | 859 | Now it is possible to disable the displaying |
858 | of todo items in the Allday part of the Agenda. | 860 | of todo items in the Allday part of the Agenda. |
859 | Choose Menu Action-Configure, | 861 | Choose Menu Action-Configure, |
860 | TAB Todo View, checkbox | 862 | TAB Todo View, checkbox |
861 | "Allday Agenda view shows todos" | 863 | "Allday Agenda view shows todos" |
862 | 7) | 864 | 7) |
863 | If FastLoad is enabled, now the settings and the | 865 | If FastLoad is enabled, now the settings and the |
864 | calendar data are saved, when KO/Pi is closed. | 866 | calendar data are saved, when KO/Pi is closed. |
865 | (If no Fastload is enabled, KO/Pi saves | 867 | (If no Fastload is enabled, KO/Pi saves |
866 | the data as well, of course) | 868 | the data as well, of course) |
867 | 8) | 869 | 8) |
868 | The Agenda View has a minimize-splitter now, | 870 | The Agenda View has a minimize-splitter now, |
869 | such that the height of the allday part can be | 871 | such that the height of the allday part can be |
870 | changed quickly. | 872 | changed quickly. |
871 | 873 | ||
872 | ********** VERSION 1.9.0 ************ | 874 | ********** VERSION 1.9.0 ************ |
873 | 1) | 875 | 1) |
874 | KO/Pi is now merged with the new microKDE from KA/Pi. | 876 | KO/Pi is now merged with the new microKDE from KA/Pi. |
875 | KO/Pi accesses now KA/Pi as the addressbook. | 877 | KO/Pi accesses now KA/Pi as the addressbook. |
876 | The other ddressbook-plugins are not working any longer. | 878 | The other ddressbook-plugins are not working any longer. |
877 | (It is planned, that later KA/Pi itself uses these plugins) | 879 | (It is planned, that later KA/Pi itself uses these plugins) |
878 | New versions of KO/Pi are only available | 880 | New versions of KO/Pi are only available |
879 | together with KA/Pi as the KDE-Pim/Pi package. | 881 | together with KA/Pi as the KDE-Pim/Pi package. |
880 | 2) | 882 | 2) |
881 | If you click on an attendee of a meeting in the | 883 | If you click on an attendee of a meeting in the |
882 | event viewer, a detailed summary of the | 884 | event viewer, a detailed summary of the |
883 | attendee is shown. | 885 | attendee is shown. |
884 | 3) | 886 | 3) |
885 | The place of the configuration file has changed. | 887 | The place of the configuration file has changed. |
886 | If you want to use your old KO/Pi config, copy | 888 | If you want to use your old KO/Pi config, copy |
887 | Applications/korganizer/config_korganizerrc | 889 | Applications/korganizer/config_korganizerrc |
888 | to | 890 | to |
889 | Applications/korganizer/config/korganizerrc | 891 | Applications/korganizer/config/korganizerrc |
890 | 892 | ||
891 | ********** VERSION 1.7.8 ************ | 893 | ********** VERSION 1.7.8 ************ |
892 | 1) | 894 | 1) |
893 | Now the QWhat'sThis ist working. | 895 | Now the QWhat'sThis ist working. |
894 | Enable the QWhat'sThis icon in the toolbar. | 896 | Enable the QWhat'sThis icon in the toolbar. |
895 | (You have to restart to reload the changed toolbar config). | 897 | (You have to restart to reload the changed toolbar config). |
896 | Now click on the QWhat'sThis Icon | 898 | Now click on the QWhat'sThis Icon |
897 | in the top right corner of KO/Pi. | 899 | in the top right corner of KO/Pi. |
898 | Then click on an item in the Agenda View: | 900 | Then click on an item in the Agenda View: |
899 | You will get a detailed display of the items content. | 901 | You will get a detailed display of the items content. |
900 | 2) | 902 | 2) |
901 | Some other very minor changes. | 903 | Some other very minor changes. |
902 | But I have forgotten the details ... | 904 | But I have forgotten the details ... |
903 | For that reason I start this log here: | 905 | For that reason I start this log here: |
904 | To document my changes, when I am doing it. | 906 | To document my changes, when I am doing it. |
905 | 907 | ||
906 | ********** VERSION 1.7.7 ************ | 908 | ********** VERSION 1.7.7 ************ |
907 | Stable Version of KO/Pi | 909 | Stable Version of KO/Pi |
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 31c5659..cb519b2 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -1,1578 +1,1578 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <qpopupmenu.h> | 20 | #include <qpopupmenu.h> |
21 | #include <qfont.h> | 21 | #include <qfont.h> |
22 | #include <qfontmetrics.h> | 22 | #include <qfontmetrics.h> |
23 | #include <qkeycode.h> | 23 | #include <qkeycode.h> |
24 | #include <qhbox.h> | 24 | #include <qhbox.h> |
25 | #include <qvbox.h> | 25 | #include <qvbox.h> |
26 | #include <qwidgetstack.h> | 26 | #include <qwidgetstack.h> |
27 | #include <qpushbutton.h> | 27 | #include <qpushbutton.h> |
28 | #include <qtooltip.h> | 28 | #include <qtooltip.h> |
29 | #include <qpainter.h> | 29 | #include <qpainter.h> |
30 | #include <qwhatsthis.h> | 30 | #include <qwhatsthis.h> |
31 | #ifndef DESKTOP_VERSION | 31 | #ifndef DESKTOP_VERSION |
32 | #include <qpe/qpeapplication.h> | 32 | #include <qpe/qpeapplication.h> |
33 | #else | 33 | #else |
34 | #include <qapplication.h> | 34 | #include <qapplication.h> |
35 | #endif | 35 | #endif |
36 | 36 | ||
37 | #include <kdebug.h> | 37 | #include <kdebug.h> |
38 | #include <klocale.h> | 38 | #include <klocale.h> |
39 | #include <kglobal.h> | 39 | #include <kglobal.h> |
40 | #include <kconfig.h> | 40 | #include <kconfig.h> |
41 | #include <kiconloader.h> | 41 | #include <kiconloader.h> |
42 | 42 | ||
43 | #include <kcalendarsystem.h> | 43 | #include <kcalendarsystem.h> |
44 | 44 | ||
45 | #ifndef KORG_NOPRINTER | 45 | #ifndef KORG_NOPRINTER |
46 | #include "calprinter.h" | 46 | #include "calprinter.h" |
47 | #endif | 47 | #endif |
48 | #include "koprefs.h" | 48 | #include "koprefs.h" |
49 | #ifndef KORG_NOPLUGINS | 49 | #ifndef KORG_NOPLUGINS |
50 | #include "kocore.h" | 50 | #include "kocore.h" |
51 | #endif | 51 | #endif |
52 | #include "koglobals.h" | 52 | #include "koglobals.h" |
53 | #include <libkcal/kincidenceformatter.h> | 53 | #include <libkcal/kincidenceformatter.h> |
54 | 54 | ||
55 | #include "komonthview.h" | 55 | #include "komonthview.h" |
56 | 56 | ||
57 | #define PIXMAP_SIZE 5 | 57 | #define PIXMAP_SIZE 5 |
58 | #ifdef DESKTOP_VERSION | 58 | #ifdef DESKTOP_VERSION |
59 | QToolTipGroup *MonthViewCell::mToolTipGroup = 0; | 59 | QToolTipGroup *MonthViewCell::mToolTipGroup = 0; |
60 | #endif | 60 | #endif |
61 | class KNOWhatsThis :public QWhatsThis | 61 | class KNOWhatsThis :public QWhatsThis |
62 | { | 62 | { |
63 | public: | 63 | public: |
64 | KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; | 64 | KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; |
65 | //~KNOWhatsThis( ) {qDebug("~KNOWhatsThis( ) "); }; | 65 | //~KNOWhatsThis( ) {qDebug("~KNOWhatsThis( ) "); }; |
66 | 66 | ||
67 | protected: | 67 | protected: |
68 | virtual QString text( const QPoint& p) | 68 | virtual QString text( const QPoint& p) |
69 | { | 69 | { |
70 | return _wid->getWhatsThisText(p) ; | 70 | return _wid->getWhatsThisText(p) ; |
71 | }; | 71 | }; |
72 | private: | 72 | private: |
73 | KNoScrollListBox* _wid; | 73 | KNoScrollListBox* _wid; |
74 | 74 | ||
75 | }; | 75 | }; |
76 | 76 | ||
77 | 77 | ||
78 | KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) | 78 | KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) |
79 | : QListBox(parent, name, WRepaintNoErase) | 79 | : QListBox(parent, name, WRepaintNoErase) |
80 | { | 80 | { |
81 | #ifndef DESKTOP_VERSION | 81 | #ifndef DESKTOP_VERSION |
82 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 82 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
83 | #endif | 83 | #endif |
84 | mWT = new KNOWhatsThis(this); | 84 | mWT = new KNOWhatsThis(this); |
85 | } | 85 | } |
86 | KNoScrollListBox::~KNoScrollListBox() | 86 | KNoScrollListBox::~KNoScrollListBox() |
87 | { | 87 | { |
88 | 88 | ||
89 | } | 89 | } |
90 | QString KNoScrollListBox::getWhatsThisText(QPoint p) | 90 | QString KNoScrollListBox::getWhatsThisText(QPoint p) |
91 | { | 91 | { |
92 | QListBoxItem* item = itemAt ( p ); | 92 | QListBoxItem* item = itemAt ( p ); |
93 | if ( ! item ) { | 93 | if ( ! item ) { |
94 | return i18n("Click in the cell\nto add an event!"); | 94 | return i18n("Click in the cell\nto add an event!"); |
95 | } | 95 | } |
96 | return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence()); | 96 | return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence()); |
97 | } | 97 | } |
98 | void KNoScrollListBox::keyPressEvent(QKeyEvent *e) | 98 | void KNoScrollListBox::keyPressEvent(QKeyEvent *e) |
99 | { | 99 | { |
100 | 100 | ||
101 | switch(e->key()) { | 101 | switch(e->key()) { |
102 | case Key_Right: | 102 | case Key_Right: |
103 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 103 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
104 | { | 104 | { |
105 | e->ignore(); | 105 | e->ignore(); |
106 | return; | 106 | return; |
107 | } | 107 | } |
108 | scrollBy(10,0); | 108 | scrollBy(10,0); |
109 | break; | 109 | break; |
110 | case Key_Left: | 110 | case Key_Left: |
111 | if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 111 | if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
112 | { | 112 | { |
113 | e->ignore(); | 113 | e->ignore(); |
114 | return; | 114 | return; |
115 | } | 115 | } |
116 | scrollBy(-10,0); | 116 | scrollBy(-10,0); |
117 | break; | 117 | break; |
118 | case Key_Up: | 118 | case Key_Up: |
119 | if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { | 119 | if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { |
120 | e->ignore(); | 120 | e->ignore(); |
121 | break; | 121 | break; |
122 | } | 122 | } |
123 | setCurrentItem((currentItem()+count()-1)%count()); | 123 | setCurrentItem((currentItem()+count()-1)%count()); |
124 | if(!itemVisible(currentItem())) { | 124 | if(!itemVisible(currentItem())) { |
125 | if((unsigned int) currentItem() == (count()-1)) { | 125 | if((unsigned int) currentItem() == (count()-1)) { |
126 | setTopItem(currentItem()-numItemsVisible()+1); | 126 | setTopItem(currentItem()-numItemsVisible()+1); |
127 | } else { | 127 | } else { |
128 | setTopItem(topItem()-1); | 128 | setTopItem(topItem()-1); |
129 | } | 129 | } |
130 | } | 130 | } |
131 | break; | 131 | break; |
132 | case Key_Down: | 132 | case Key_Down: |
133 | if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { | 133 | if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { |
134 | e->ignore(); | 134 | e->ignore(); |
135 | break; | 135 | break; |
136 | } | 136 | } |
137 | setCurrentItem((currentItem()+1)%count()); | 137 | setCurrentItem((currentItem()+1)%count()); |
138 | if(!itemVisible(currentItem())) { | 138 | if(!itemVisible(currentItem())) { |
139 | if(currentItem() == 0) { | 139 | if(currentItem() == 0) { |
140 | setTopItem(0); | 140 | setTopItem(0); |
141 | } else { | 141 | } else { |
142 | setTopItem(topItem()+1); | 142 | setTopItem(topItem()+1); |
143 | } | 143 | } |
144 | } | 144 | } |
145 | break; | 145 | break; |
146 | case Key_I: | 146 | case Key_I: |
147 | QTimer::singleShot( 11, this, SLOT ( oneDown() ) ); | 147 | QTimer::singleShot( 11, this, SLOT ( oneDown() ) ); |
148 | e->ignore(); | 148 | e->ignore(); |
149 | break; | 149 | break; |
150 | case Key_Shift: | 150 | case Key_Shift: |
151 | emit shiftDown(); | 151 | emit shiftDown(); |
152 | break; | 152 | break; |
153 | default: | 153 | default: |
154 | e->ignore(); | 154 | e->ignore(); |
155 | break; | 155 | break; |
156 | } | 156 | } |
157 | } | 157 | } |
158 | 158 | ||
159 | void KNoScrollListBox::oneDown() | 159 | void KNoScrollListBox::oneDown() |
160 | { | 160 | { |
161 | setCurrentItem((currentItem()+1)%count()); | 161 | setCurrentItem((currentItem()+1)%count()); |
162 | if(!itemVisible(currentItem())) { | 162 | if(!itemVisible(currentItem())) { |
163 | if(currentItem() == 0) { | 163 | if(currentItem() == 0) { |
164 | setTopItem(0); | 164 | setTopItem(0); |
165 | } else { | 165 | } else { |
166 | setTopItem(topItem()+1); | 166 | setTopItem(topItem()+1); |
167 | } | 167 | } |
168 | } | 168 | } |
169 | } | 169 | } |
170 | void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) | 170 | void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) |
171 | { | 171 | { |
172 | switch(e->key()) { | 172 | switch(e->key()) { |
173 | case Key_Shift: | 173 | case Key_Shift: |
174 | emit shiftUp(); | 174 | emit shiftUp(); |
175 | break; | 175 | break; |
176 | default: | 176 | default: |
177 | break; | 177 | break; |
178 | } | 178 | } |
179 | } | 179 | } |
180 | 180 | ||
181 | void KNoScrollListBox::mousePressEvent(QMouseEvent *e) | 181 | void KNoScrollListBox::mousePressEvent(QMouseEvent *e) |
182 | { | 182 | { |
183 | QListBox::mousePressEvent(e); | 183 | QListBox::mousePressEvent(e); |
184 | 184 | ||
185 | if(e->button() == RightButton) { | 185 | if(e->button() == RightButton) { |
186 | emit rightClick(); | 186 | emit rightClick(); |
187 | } | 187 | } |
188 | } | 188 | } |
189 | 189 | ||
190 | MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) | 190 | MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) |
191 | : QListBoxItem() | 191 | : QListBoxItem() |
192 | { | 192 | { |
193 | setText( s ); | 193 | setText( s ); |
194 | 194 | ||
195 | mIncidence = incidence; | 195 | mIncidence = incidence; |
196 | mDate = qd; | 196 | mDate = qd; |
197 | // QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); | 197 | // QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); |
198 | mRecur = false; | 198 | mRecur = false; |
199 | mAlarm = false; | 199 | mAlarm = false; |
200 | mReply = false; | 200 | mReply = false; |
201 | mInfo = false; | 201 | mInfo = false; |
202 | } | 202 | } |
203 | 203 | ||
204 | void MonthViewItem::paint(QPainter *p) | 204 | void MonthViewItem::paint(QPainter *p) |
205 | { | 205 | { |
206 | #if QT_VERSION >= 0x030000 | 206 | #if QT_VERSION >= 0x030000 |
207 | bool sel = isSelected(); | 207 | bool sel = isSelected(); |
208 | #else | 208 | #else |
209 | bool sel = selected(); | 209 | bool sel = selected(); |
210 | #endif | 210 | #endif |
211 | 211 | ||
212 | 212 | ||
213 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) | 213 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) |
214 | { | 214 | { |
215 | p->setBackgroundColor( palette().color( QPalette::Normal, \ | 215 | p->setBackgroundColor( palette().color( QPalette::Normal, \ |
216 | sel ? QColorGroup::Highlight : QColorGroup::Background ) ); | 216 | sel ? QColorGroup::Highlight : QColorGroup::Background ) ); |
217 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); | 217 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); |
218 | } | 218 | } |
219 | int x = 1; | 219 | int x = 1; |
220 | int y = 3;//(height() - mRecurPixmap.height()) /2; | 220 | int y = 3;//(height() - mRecurPixmap.height()) /2; |
221 | int size = PIXMAP_SIZE; | 221 | int size = PIXMAP_SIZE; |
222 | if ( QApplication::desktop()->width() < 300 ) | 222 | if ( QApplication::desktop()->width() < 300 ) |
223 | size = 3; | 223 | size = 3; |
224 | if ( KOPrefs::instance()->mMonthShowIcons ) { | 224 | if ( KOPrefs::instance()->mMonthShowIcons ) { |
225 | if ( mInfo ) { | 225 | if ( mInfo ) { |
226 | p->fillRect ( x, y,size,size, Qt::darkGreen ); | 226 | p->fillRect ( x, y,size,size, Qt::darkGreen ); |
227 | x += size + 1; | 227 | x += size + 1; |
228 | } | 228 | } |
229 | if ( mRecur ) { | 229 | if ( mRecur ) { |
230 | p->fillRect ( x, y,size,size, Qt::blue ); | 230 | p->fillRect ( x, y,size,size, Qt::blue ); |
231 | x += size + 1; | 231 | x += size + 1; |
232 | } | 232 | } |
233 | if ( mAlarm ) { | 233 | if ( mAlarm ) { |
234 | p->fillRect ( x, y,size,size, Qt::red ); | 234 | p->fillRect ( x, y,size,size, Qt::red ); |
235 | x += size + 1; | 235 | x += size + 1; |
236 | } | 236 | } |
237 | if ( mReply ) { | 237 | if ( mReply ) { |
238 | p->fillRect ( x, y,size,size, Qt::yellow ); | 238 | p->fillRect ( x, y,size,size, Qt::yellow ); |
239 | x += size + 1; | 239 | x += size + 1; |
240 | } | 240 | } |
241 | } | 241 | } |
242 | QFontMetrics fm = p->fontMetrics(); | 242 | QFontMetrics fm = p->fontMetrics(); |
243 | int yPos; | 243 | int yPos; |
244 | int pmheight = size; | 244 | int pmheight = size; |
245 | if( pmheight < fm.height() ) | 245 | if( pmheight < fm.height() ) |
246 | yPos = fm.ascent() + fm.leading()/2; | 246 | yPos = fm.ascent() + fm.leading()/2; |
247 | else | 247 | else |
248 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); | 248 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); |
249 | p->setPen( palette().color( QPalette::Normal, sel ? \ | 249 | p->setPen( palette().color( QPalette::Normal, sel ? \ |
250 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); | 250 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); |
251 | p->drawText( x, yPos, text() ); | 251 | p->drawText( x, yPos, text() ); |
252 | if ( mIncidence->cancelled() ) { | 252 | if ( mIncidence->cancelled() ) { |
253 | int wid = fm.width( text() ); | 253 | int wid = fm.width( text() ); |
254 | p->drawLine( x, yPos- fm.height()/2+3,x+wid, yPos- fm.height()/2 +3); | 254 | p->drawLine( x, yPos- fm.height()/2+3,x+wid, yPos- fm.height()/2 +3); |
255 | } | 255 | } |
256 | 256 | ||
257 | } | 257 | } |
258 | 258 | ||
259 | int MonthViewItem::height(const QListBox *lb) const | 259 | int MonthViewItem::height(const QListBox *lb) const |
260 | { | 260 | { |
261 | return lb->fontMetrics().lineSpacing()+1; | 261 | return lb->fontMetrics().lineSpacing()+1; |
262 | } | 262 | } |
263 | 263 | ||
264 | int MonthViewItem::width(const QListBox *lb) const | 264 | int MonthViewItem::width(const QListBox *lb) const |
265 | { | 265 | { |
266 | int size = PIXMAP_SIZE; | 266 | int size = PIXMAP_SIZE; |
267 | if ( QApplication::desktop()->width() < 300 ) | 267 | if ( QApplication::desktop()->width() < 300 ) |
268 | size = 3; | 268 | size = 3; |
269 | int x = 1; | 269 | int x = 1; |
270 | if ( mInfo ) { | 270 | if ( mInfo ) { |
271 | x += size + 1; | 271 | x += size + 1; |
272 | } | 272 | } |
273 | if( mRecur ) { | 273 | if( mRecur ) { |
274 | x += size+1; | 274 | x += size+1; |
275 | } | 275 | } |
276 | if( mAlarm ) { | 276 | if( mAlarm ) { |
277 | x += size+1; | 277 | x += size+1; |
278 | } | 278 | } |
279 | if( mReply ) { | 279 | if( mReply ) { |
280 | x += size+1; | 280 | x += size+1; |
281 | } | 281 | } |
282 | 282 | ||
283 | return( x + lb->fontMetrics().width( text() ) + 1 ); | 283 | return( x + lb->fontMetrics().width( text() ) + 1 ); |
284 | } | 284 | } |
285 | 285 | ||
286 | 286 | ||
287 | MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) | 287 | MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) |
288 | : QWidget( par ), | 288 | : QWidget( par ), |
289 | mMonthView( parent ) | 289 | mMonthView( parent ) |
290 | { | 290 | { |
291 | 291 | ||
292 | QVBoxLayout *topLayout = new QVBoxLayout( this ); | 292 | QVBoxLayout *topLayout = new QVBoxLayout( this ); |
293 | 293 | ||
294 | // mLabel = new QLabel( this );QPushButton | 294 | // mLabel = new QLabel( this );QPushButton |
295 | mLabel = new QPushButton( this ); | 295 | mLabel = new QPushButton( this ); |
296 | //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); | 296 | //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); |
297 | //mLabel->setLineWidth( 1 ); | 297 | //mLabel->setLineWidth( 1 ); |
298 | //mLabel->setAlignment( AlignCenter ); | 298 | //mLabel->setAlignment( AlignCenter ); |
299 | mLabel->setFlat( true ); | 299 | mLabel->setFlat( true ); |
300 | mLabel->setFocusPolicy(NoFocus); | 300 | mLabel->setFocusPolicy(NoFocus); |
301 | mItemList = new KNoScrollListBox( this ); | 301 | mItemList = new KNoScrollListBox( this ); |
302 | mItemList->setMinimumSize( 10, 10 ); | 302 | mItemList->setMinimumSize( 10, 10 ); |
303 | mItemList->setFrameStyle( QFrame::Panel | QFrame::Plain ); | 303 | mItemList->setFrameStyle( QFrame::Panel | QFrame::Plain ); |
304 | mItemList->setLineWidth( 1 ); | 304 | mItemList->setLineWidth( 1 ); |
305 | topLayout->addWidget( mItemList ); | 305 | topLayout->addWidget( mItemList ); |
306 | mLabel->raise(); | 306 | mLabel->raise(); |
307 | // QColor( 0,0,255 ) QColor( 160,1600,255 ) | 307 | // QColor( 0,0,255 ) QColor( 160,1600,255 ) |
308 | mStandardPalette = palette(); | 308 | mStandardPalette = palette(); |
309 | mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); | 309 | mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); |
310 | 310 | ||
311 | enableScrollBars( false ); | 311 | enableScrollBars( false ); |
312 | updateConfig(); | 312 | updateConfig(); |
313 | //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); | 313 | //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); |
314 | connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); | 314 | connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); |
315 | connect( mItemList, SIGNAL( doubleClicked( QListBoxItem *) ), | 315 | connect( mItemList, SIGNAL( doubleClicked( QListBoxItem *) ), |
316 | SLOT( defaultAction( QListBoxItem * ) ) ); | 316 | SLOT( defaultAction( QListBoxItem * ) ) ); |
317 | connect( mItemList, SIGNAL( rightButtonPressed( QListBoxItem *, | 317 | connect( mItemList, SIGNAL( rightButtonPressed( QListBoxItem *, |
318 | const QPoint &) ), | 318 | const QPoint &) ), |
319 | SLOT( contextMenu( QListBoxItem * ) ) ); | 319 | SLOT( contextMenu( QListBoxItem * ) ) ); |
320 | connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ), | 320 | connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ), |
321 | SLOT( selection( QListBoxItem * ) ) ); | 321 | SLOT( selection( QListBoxItem * ) ) ); |
322 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), | 322 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), |
323 | SLOT( cellClicked( QListBoxItem * ) ) ); | 323 | SLOT( cellClicked( QListBoxItem * ) ) ); |
324 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), | 324 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), |
325 | SLOT( selection( QListBoxItem * ) ) ); | 325 | SLOT( selection( QListBoxItem * ) ) ); |
326 | } | 326 | } |
327 | #ifdef DESKTOP_VERSION | 327 | #ifdef DESKTOP_VERSION |
328 | QToolTipGroup *MonthViewCell::toolTipGroup() | 328 | QToolTipGroup *MonthViewCell::toolTipGroup() |
329 | { | 329 | { |
330 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); | 330 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); |
331 | return mToolTipGroup; | 331 | return mToolTipGroup; |
332 | } | 332 | } |
333 | #endif | 333 | #endif |
334 | 334 | ||
335 | void MonthViewCell::setDate( const QDate &date ) | 335 | void MonthViewCell::setDate( const QDate &date ) |
336 | { | 336 | { |
337 | // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; | 337 | // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; |
338 | mDate = date; | 338 | mDate = date; |
339 | 339 | ||
340 | 340 | ||
341 | 341 | ||
342 | //resizeEvent( 0 ); | 342 | //resizeEvent( 0 ); |
343 | } | 343 | } |
344 | 344 | ||
345 | QDate MonthViewCell::date() const | 345 | QDate MonthViewCell::date() const |
346 | { | 346 | { |
347 | return mDate; | 347 | return mDate; |
348 | } | 348 | } |
349 | 349 | ||
350 | void MonthViewCell::setPrimary( bool primary ) | 350 | void MonthViewCell::setPrimary( bool primary ) |
351 | { | 351 | { |
352 | mPrimary = primary; | 352 | mPrimary = primary; |
353 | //setMyPalette(); | 353 | //setMyPalette(); |
354 | } | 354 | } |
355 | void MonthViewCell::setMyPalette() | 355 | void MonthViewCell::setMyPalette() |
356 | { | 356 | { |
357 | 357 | ||
358 | if ( mHoliday) { | 358 | if ( mHoliday) { |
359 | setPalette( mHolidayPalette ); | 359 | setPalette( mHolidayPalette ); |
360 | } else { | 360 | } else { |
361 | if ( mPrimary ) { | 361 | if ( mPrimary ) { |
362 | setPalette( mPrimaryPalette ); | 362 | setPalette( mPrimaryPalette ); |
363 | } else { | 363 | } else { |
364 | setPalette( mNonPrimaryPalette ); | 364 | setPalette( mNonPrimaryPalette ); |
365 | } | 365 | } |
366 | } | 366 | } |
367 | QPalette pal = palette(); | 367 | QPalette pal = palette(); |
368 | 368 | ||
369 | mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); | 369 | mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); |
370 | } | 370 | } |
371 | QPalette MonthViewCell::getPalette () | 371 | QPalette MonthViewCell::getPalette () |
372 | { | 372 | { |
373 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) | 373 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) |
374 | return mStandardPalette; | 374 | return mStandardPalette; |
375 | if ( mHoliday) { | 375 | if ( mHoliday) { |
376 | return mHolidayPalette ; | 376 | return mHolidayPalette ; |
377 | } else { | 377 | } else { |
378 | if ( mPrimary ) { | 378 | if ( mPrimary ) { |
379 | return mPrimaryPalette ; | 379 | return mPrimaryPalette ; |
380 | } | 380 | } |
381 | } | 381 | } |
382 | return mNonPrimaryPalette; | 382 | return mNonPrimaryPalette; |
383 | } | 383 | } |
384 | bool MonthViewCell::isPrimary() const | 384 | bool MonthViewCell::isPrimary() const |
385 | { | 385 | { |
386 | return mPrimary; | 386 | return mPrimary; |
387 | } | 387 | } |
388 | 388 | ||
389 | void MonthViewCell::setHoliday( bool holiday ) | 389 | void MonthViewCell::setHoliday( bool holiday ) |
390 | { | 390 | { |
391 | mHoliday = holiday; | 391 | mHoliday = holiday; |
392 | //setMyPalette(); | 392 | //setMyPalette(); |
393 | } | 393 | } |
394 | 394 | ||
395 | void MonthViewCell::setHoliday( const QString &holiday ) | 395 | void MonthViewCell::setHoliday( const QString &holiday ) |
396 | { | 396 | { |
397 | mHolidayString = holiday; | 397 | mHolidayString = holiday; |
398 | 398 | ||
399 | if ( !holiday.isEmpty() ) { | 399 | if ( !holiday.isEmpty() ) { |
400 | setHoliday( true ); | 400 | setHoliday( true ); |
401 | } | 401 | } |
402 | } | 402 | } |
403 | void MonthViewCell::keyPressEvent ( QKeyEvent * e ) | 403 | void MonthViewCell::keyPressEvent ( QKeyEvent * e ) |
404 | { | 404 | { |
405 | 405 | ||
406 | e->ignore(); | 406 | e->ignore(); |
407 | 407 | ||
408 | } | 408 | } |
409 | void MonthViewCell::clear() | 409 | void MonthViewCell::clear() |
410 | { | 410 | { |
411 | mItemList->clear(); | 411 | mItemList->clear(); |
412 | QApplication::removePostedEvents ( mItemList ); | 412 | QApplication::removePostedEvents ( mItemList ); |
413 | QApplication::removePostedEvents ( mLabel ); | 413 | QApplication::removePostedEvents ( mLabel ); |
414 | QApplication::removePostedEvents ( this ); | 414 | QApplication::removePostedEvents ( this ); |
415 | } | 415 | } |
416 | 416 | ||
417 | void MonthViewCell::startUpdateCell() | 417 | void MonthViewCell::startUpdateCell() |
418 | { | 418 | { |
419 | 419 | ||
420 | mItemList->setFocusPolicy(NoFocus); | 420 | mItemList->setFocusPolicy(NoFocus); |
421 | if ( !mMonthView->isUpdatePossible() ) | 421 | if ( !mMonthView->isUpdatePossible() ) |
422 | return; | 422 | return; |
423 | 423 | ||
424 | /* | 424 | /* |
425 | if ( !isVisible() ){ | 425 | if ( !isVisible() ){ |
426 | return; | 426 | return; |
427 | } | 427 | } |
428 | */ | 428 | */ |
429 | // qDebug("MonthViewCell::updateCell() "); | 429 | // qDebug("MonthViewCell::updateCell() "); |
430 | setPrimary( mDate.month()%2 ); | 430 | setPrimary( mDate.month()%2 ); |
431 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); | 431 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); |
432 | if ( mDate == QDate::currentDate() ) { | 432 | if ( mDate == QDate::currentDate() ) { |
433 | mItemList->setLineWidth( 3 ); | 433 | mItemList->setLineWidth( 3 ); |
434 | } else { | 434 | } else { |
435 | mItemList->setLineWidth( 1 ); | 435 | mItemList->setLineWidth( 1 ); |
436 | } | 436 | } |
437 | mItemList->clear(); | 437 | mItemList->clear(); |
438 | 438 | ||
439 | #ifdef DESKTOP_VERSION | 439 | #ifdef DESKTOP_VERSION |
440 | QToolTip::remove(this); | 440 | QToolTip::remove(this); |
441 | #endif | 441 | #endif |
442 | mToolTip = ""; | 442 | mToolTip = ""; |
443 | //qApp->processEvents(); | 443 | //qApp->processEvents(); |
444 | if ( !mHolidayString.isEmpty() ) { | 444 | if ( !mHolidayString.isEmpty() ) { |
445 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); | 445 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); |
446 | item->setPalette( mHolidayPalette ); | 446 | item->setPalette( mHolidayPalette ); |
447 | mItemList->insertItem( item ); | 447 | mItemList->insertItem( item ); |
448 | mToolTip += mHolidayString+"\n"; | 448 | mToolTip += mHolidayString+"\n"; |
449 | } | 449 | } |
450 | } | 450 | } |
451 | 451 | ||
452 | void MonthViewCell::insertEvent(Event *event) | 452 | void MonthViewCell::insertEvent(Event *event) |
453 | { | 453 | { |
454 | 454 | ||
455 | mItemList->setFocusPolicy(WheelFocus); | 455 | mItemList->setFocusPolicy(WheelFocus); |
456 | if ( !(event->doesRecur() == Recurrence::rNone) ) { | 456 | if ( !(event->doesRecur() == Recurrence::rNone) ) { |
457 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) | 457 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) |
458 | return; | 458 | return; |
459 | else | 459 | else |
460 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) | 460 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) |
461 | return; | 461 | return; |
462 | } | 462 | } |
463 | 463 | ||
464 | if ( event->categories().contains("Holiday") || | 464 | if ( event->categories().contains("Holiday") || |
465 | event->categories().contains(i18n("Holiday"))) { | 465 | event->categories().contains(i18n("Holiday"))) { |
466 | setHoliday( true ); | 466 | setHoliday( true ); |
467 | if ( mDate.dayOfWeek() == 7 ) | 467 | if ( mDate.dayOfWeek() == 7 ) |
468 | mItemList->setLineWidth( 3 ); | 468 | mItemList->setLineWidth( 3 ); |
469 | } | 469 | } |
470 | QString text; | 470 | QString text; |
471 | if (event->isMultiDay()) { | 471 | if (event->isMultiDay()) { |
472 | QString prefix = "<->"; | 472 | QString prefix = "<->"; |
473 | if ( event->doesRecur() ) { | 473 | if ( event->doesRecur() ) { |
474 | if ( event->recursOn( mDate) ) | 474 | if ( event->recursOn( mDate) ) |
475 | prefix ="->" ; | 475 | prefix ="->" ; |
476 | else { | 476 | else { |
477 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 477 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
478 | if ( event->recursOn( mDate.addDays( -days)) ) | 478 | if ( event->recursOn( mDate.addDays( -days)) ) |
479 | prefix ="<-" ; | 479 | prefix ="<-" ; |
480 | } | 480 | } |
481 | 481 | ||
482 | } else { | 482 | } else { |
483 | if (mDate == event->dtStart().date()) { | 483 | if (mDate == event->dtStart().date()) { |
484 | prefix ="->" ; | 484 | prefix ="->" ; |
485 | } else if (mDate == event->dtEnd().date()) { | 485 | } else if (mDate == event->dtEnd().date()) { |
486 | prefix ="<-" ; | 486 | prefix ="<-" ; |
487 | } | 487 | } |
488 | } | 488 | } |
489 | if ( !event->doesFloat() ) { | 489 | if ( !event->doesFloat() ) { |
490 | if ( mDate == event->dtStart().date () ) | 490 | if ( mDate == event->dtStart().date () ) |
491 | prefix += KGlobal::locale()->formatTime(event->dtStart().time())+" "; | 491 | prefix += KGlobal::locale()->formatTime(event->dtStart().time())+" "; |
492 | else if ( mDate == event->dtEnd().date () ) | 492 | else if ( mDate == event->dtEnd().date () ) |
493 | prefix += KGlobal::locale()->formatTime(event->dtEnd().time())+" "; | 493 | prefix += KGlobal::locale()->formatTime(event->dtEnd().time())+" "; |
494 | 494 | ||
495 | } | 495 | } |
496 | text = prefix + event->summary(); | 496 | text = prefix + event->summary(); |
497 | mToolTip += text; | 497 | mToolTip += text; |
498 | } else { | 498 | } else { |
499 | if (event->doesFloat()) { | 499 | if (event->doesFloat()) { |
500 | text = event->summary(); | 500 | text = event->summary(); |
501 | mToolTip += text; | 501 | mToolTip += text; |
502 | } | 502 | } |
503 | else { | 503 | else { |
504 | text = KGlobal::locale()->formatTime(event->dtStart().time()); | 504 | text = KGlobal::locale()->formatTime(event->dtStart().time()); |
505 | text += " " + event->summary(); | 505 | text += " " + event->summary(); |
506 | mToolTip += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); | 506 | mToolTip += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); |
507 | } | 507 | } |
508 | } | 508 | } |
509 | 509 | ||
510 | MonthViewItem *item = new MonthViewItem( event, mDate, text ); | 510 | MonthViewItem *item = new MonthViewItem( event, mDate, text ); |
511 | QPalette pal; | 511 | QPalette pal; |
512 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 512 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
513 | QStringList categories = event->categories(); | 513 | QStringList categories = event->categories(); |
514 | QString cat = categories.first(); | 514 | QString cat = categories.first(); |
515 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 515 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
516 | pal = getPalette(); | 516 | pal = getPalette(); |
517 | if (cat.isEmpty()) { | 517 | if (cat.isEmpty()) { |
518 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 518 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
519 | } else { | 519 | } else { |
520 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 520 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
521 | } | 521 | } |
522 | 522 | ||
523 | } else { | 523 | } else { |
524 | if (cat.isEmpty()) { | 524 | if (cat.isEmpty()) { |
525 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 525 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
526 | } else { | 526 | } else { |
527 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 527 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
528 | } | 528 | } |
529 | } | 529 | } |
530 | 530 | ||
531 | } else { | 531 | } else { |
532 | pal = mStandardPalette ; | 532 | pal = mStandardPalette ; |
533 | } | 533 | } |
534 | item->setPalette( pal ); | 534 | item->setPalette( pal ); |
535 | item->setRecur( event->recurrence()->doesRecur() ); | 535 | item->setRecur( event->recurrence()->doesRecur() ); |
536 | item->setAlarm( event->isAlarmEnabled() ); | 536 | item->setAlarm( event->isAlarmEnabled() ); |
537 | item->setMoreInfo( event->description().length() > 0 ); | 537 | item->setMoreInfo( event->description().length() > 0 ); |
538 | #ifdef DESKTOP_VERSION | 538 | #ifdef DESKTOP_VERSION |
539 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, | 539 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, |
540 | KOPrefs::instance()->email()); | 540 | KOPrefs::instance()->email()); |
541 | if ( me != 0 ) { | 541 | if ( me != 0 ) { |
542 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) | 542 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) |
543 | item->setReply(true); | 543 | item->setReply(true); |
544 | else | 544 | else |
545 | item->setReply(false); | 545 | item->setReply(false); |
546 | } else | 546 | } else |
547 | item->setReply(false); | 547 | item->setReply(false); |
548 | #endif | 548 | #endif |
549 | mItemList->insertItem( item ); | 549 | mItemList->insertItem( item ); |
550 | mToolTip += "\n"; | 550 | mToolTip += "\n"; |
551 | } | 551 | } |
552 | void MonthViewCell::insertTodo(Todo *todo) | 552 | void MonthViewCell::insertTodo(Todo *todo) |
553 | { | 553 | { |
554 | QString text; | 554 | QString text; |
555 | if (todo->hasDueDate()) { | 555 | if (todo->hasDueDate()) { |
556 | if (!todo->doesFloat()) { | 556 | if (!todo->doesFloat()) { |
557 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); | 557 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); |
558 | text += " "; | 558 | text += " "; |
559 | } | 559 | } |
560 | } | 560 | } |
561 | text += i18n("Td: %1").arg(todo->summary()); | 561 | text += i18n("Td: %1").arg(todo->summary()); |
562 | 562 | ||
563 | MonthViewItem *item = new MonthViewItem( todo, mDate, text ); | 563 | MonthViewItem *item = new MonthViewItem( todo, mDate, text ); |
564 | //item->setPalette( mStandardPalette ); | 564 | //item->setPalette( mStandardPalette ); |
565 | QPalette pal; | 565 | QPalette pal; |
566 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 566 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
567 | QStringList categories = todo->categories(); | 567 | QStringList categories = todo->categories(); |
568 | QString cat = categories.first(); | 568 | QString cat = categories.first(); |
569 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 569 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
570 | pal = getPalette(); | 570 | pal = getPalette(); |
571 | if (cat.isEmpty()) { | 571 | if (cat.isEmpty()) { |
572 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 572 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
573 | } else { | 573 | } else { |
574 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 574 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
575 | } | 575 | } |
576 | 576 | ||
577 | } else { | 577 | } else { |
578 | if (cat.isEmpty()) { | 578 | if (cat.isEmpty()) { |
579 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 579 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
580 | } else { | 580 | } else { |
581 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 581 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
582 | } | 582 | } |
583 | } | 583 | } |
584 | 584 | ||
585 | } else { | 585 | } else { |
586 | pal = mStandardPalette ; | 586 | pal = mStandardPalette ; |
587 | } | 587 | } |
588 | item->setPalette( pal ); | 588 | item->setPalette( pal ); |
589 | mItemList->insertItem( item ); | 589 | mItemList->insertItem( item ); |
590 | mToolTip += text+"\n"; | 590 | mToolTip += text+"\n"; |
591 | } | 591 | } |
592 | void MonthViewCell::finishUpdateCell() | 592 | void MonthViewCell::finishUpdateCell() |
593 | { | 593 | { |
594 | #ifdef DESKTOP_VERSION | 594 | #ifdef DESKTOP_VERSION |
595 | if (mToolTip != "") | 595 | if (mToolTip != "") |
596 | QToolTip::add(this,mToolTip,toolTipGroup(),""); | 596 | QToolTip::add(this,mToolTip,toolTipGroup(),""); |
597 | #endif | 597 | #endif |
598 | mItemList->sort(); | 598 | mItemList->sort(); |
599 | //setMyPalette(); | 599 | //setMyPalette(); |
600 | setMyPalette(); | 600 | setMyPalette(); |
601 | QString text; | 601 | QString text; |
602 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; | 602 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; |
603 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { | 603 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { |
604 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; | 604 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; |
605 | mLabel->resize( mLabelBigSize ); | 605 | mLabel->resize( mLabelBigSize ); |
606 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 606 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
607 | } else { | 607 | } else { |
608 | mLabel->resize( mLabelSize ); | 608 | mLabel->resize( mLabelSize ); |
609 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 609 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
610 | } | 610 | } |
611 | 611 | ||
612 | mLabel->setText( text ); | 612 | mLabel->setText( text ); |
613 | resizeEvent( 0 ); | 613 | resizeEvent( 0 ); |
614 | } | 614 | } |
615 | void MonthViewCell::updateCell() | 615 | void MonthViewCell::updateCell() |
616 | { | 616 | { |
617 | if ( !mMonthView->isUpdatePossible() ) | 617 | if ( !mMonthView->isUpdatePossible() ) |
618 | return; | 618 | return; |
619 | startUpdateCell(); | 619 | startUpdateCell(); |
620 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 620 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
621 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); | 621 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); |
622 | Event *event; | 622 | Event *event; |
623 | for( event = events.first(); event; event = events.next() ) { // for event | 623 | for( event = events.first(); event; event = events.next() ) { // for event |
624 | insertEvent(event); | 624 | insertEvent(event); |
625 | } | 625 | } |
626 | // insert due todos | 626 | // insert due todos |
627 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); | 627 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); |
628 | Todo *todo; | 628 | Todo *todo; |
629 | for(todo = todos.first(); todo; todo = todos.next()) { | 629 | for(todo = todos.first(); todo; todo = todos.next()) { |
630 | insertTodo( todo ); | 630 | insertTodo( todo ); |
631 | } | 631 | } |
632 | finishUpdateCell(); | 632 | finishUpdateCell(); |
633 | // if ( isVisible()) | 633 | // if ( isVisible()) |
634 | //qApp->processEvents(); | 634 | //qApp->processEvents(); |
635 | } | 635 | } |
636 | 636 | ||
637 | void MonthViewCell::updateConfig( bool bigFont ) // = false | 637 | void MonthViewCell::updateConfig( bool bigFont ) // = false |
638 | { | 638 | { |
639 | 639 | ||
640 | if ( bigFont ) { | 640 | if ( bigFont ) { |
641 | QFont fo = KOPrefs::instance()->mMonthViewFont; | 641 | QFont fo = KOPrefs::instance()->mMonthViewFont; |
642 | int ps = fo.pointSize() + 2; | 642 | int ps = fo.pointSize() + 2; |
643 | if ( ps < 18 ) | 643 | if ( ps < 18 ) |
644 | ps += 2; | 644 | ps += 2; |
645 | fo.setPointSize( ps ); | 645 | fo.setPointSize( ps ); |
646 | setFont( fo ); | 646 | setFont( fo ); |
647 | } else | 647 | } else |
648 | setFont( KOPrefs::instance()->mMonthViewFont ); | 648 | setFont( KOPrefs::instance()->mMonthViewFont ); |
649 | 649 | ||
650 | QFontMetrics fm( font() ); | 650 | QFontMetrics fm( font() ); |
651 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); | 651 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); |
652 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); | 652 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); |
653 | mHolidayPalette = mStandardPalette; | 653 | mHolidayPalette = mStandardPalette; |
654 | mPrimaryPalette = mStandardPalette; | 654 | mPrimaryPalette = mStandardPalette; |
655 | mNonPrimaryPalette = mStandardPalette; | 655 | mNonPrimaryPalette = mStandardPalette; |
656 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { | 656 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { |
657 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); | 657 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); |
658 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); | 658 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); |
659 | mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); | 659 | mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); |
660 | mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); | 660 | mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); |
661 | mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); | 661 | mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); |
662 | mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); | 662 | mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); |
663 | mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); | 663 | mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); |
664 | mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); | 664 | mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); |
665 | mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); | 665 | mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); |
666 | } | 666 | } |
667 | //updateCell(); | 667 | //updateCell(); |
668 | } | 668 | } |
669 | 669 | ||
670 | void MonthViewCell::enableScrollBars( bool enabled ) | 670 | void MonthViewCell::enableScrollBars( bool enabled ) |
671 | { | 671 | { |
672 | if ( enabled ) { | 672 | if ( enabled ) { |
673 | mItemList->setVScrollBarMode(QScrollView::Auto); | 673 | mItemList->setVScrollBarMode(QScrollView::Auto); |
674 | mItemList->setHScrollBarMode(QScrollView::Auto); | 674 | mItemList->setHScrollBarMode(QScrollView::Auto); |
675 | } else { | 675 | } else { |
676 | mItemList->setVScrollBarMode(QScrollView::AlwaysOff); | 676 | mItemList->setVScrollBarMode(QScrollView::AlwaysOff); |
677 | mItemList->setHScrollBarMode(QScrollView::AlwaysOff); | 677 | mItemList->setHScrollBarMode(QScrollView::AlwaysOff); |
678 | } | 678 | } |
679 | } | 679 | } |
680 | 680 | ||
681 | Incidence *MonthViewCell::selectedIncidence() | 681 | Incidence *MonthViewCell::selectedIncidence() |
682 | { | 682 | { |
683 | int index = mItemList->currentItem(); | 683 | int index = mItemList->currentItem(); |
684 | if ( index < 0 ) return 0; | 684 | if ( index < 0 ) return 0; |
685 | 685 | ||
686 | MonthViewItem *item = | 686 | MonthViewItem *item = |
687 | static_cast<MonthViewItem *>( mItemList->item( index ) ); | 687 | static_cast<MonthViewItem *>( mItemList->item( index ) ); |
688 | 688 | ||
689 | if ( !item ) return 0; | 689 | if ( !item ) return 0; |
690 | 690 | ||
691 | return item->incidence(); | 691 | return item->incidence(); |
692 | } | 692 | } |
693 | 693 | ||
694 | QDate MonthViewCell::selectedIncidenceDate() | 694 | QDate MonthViewCell::selectedIncidenceDate() |
695 | { | 695 | { |
696 | QDate qd; | 696 | QDate qd; |
697 | int index = mItemList->currentItem(); | 697 | int index = mItemList->currentItem(); |
698 | if ( index < 0 ) return qd; | 698 | if ( index < 0 ) return qd; |
699 | 699 | ||
700 | MonthViewItem *item = | 700 | MonthViewItem *item = |
701 | static_cast<MonthViewItem *>( mItemList->item( index ) ); | 701 | static_cast<MonthViewItem *>( mItemList->item( index ) ); |
702 | 702 | ||
703 | if ( !item ) return qd; | 703 | if ( !item ) return qd; |
704 | 704 | ||
705 | return item->incidenceDate(); | 705 | return item->incidenceDate(); |
706 | } | 706 | } |
707 | 707 | ||
708 | void MonthViewCell::deselect() | 708 | void MonthViewCell::deselect() |
709 | { | 709 | { |
710 | mItemList->clearSelection(); | 710 | mItemList->clearSelection(); |
711 | enableScrollBars( false ); | 711 | enableScrollBars( false ); |
712 | // updateCell(); | 712 | // updateCell(); |
713 | } | 713 | } |
714 | void MonthViewCell::select() | 714 | void MonthViewCell::select() |
715 | { | 715 | { |
716 | ;// updateCell(); | 716 | ;// updateCell(); |
717 | } | 717 | } |
718 | 718 | ||
719 | void MonthViewCell::resizeEvent ( QResizeEvent * ) | 719 | void MonthViewCell::resizeEvent ( QResizeEvent * ) |
720 | { | 720 | { |
721 | if ( !mMonthView->isUpdatePossible() ) | 721 | if ( !mMonthView->isUpdatePossible() ) |
722 | return; | 722 | return; |
723 | 723 | ||
724 | int size = height() - mLabel->height() - 2; | 724 | int size = height() - mLabel->height() - 2; |
725 | if ( size > 0 ) | 725 | if ( size > 0 ) |
726 | mItemList->verticalScrollBar()->setMaximumHeight( size ); | 726 | mItemList->verticalScrollBar()->setMaximumHeight( size ); |
727 | size = width() - mLabel->width() -2; | 727 | size = width() - mLabel->width() -2; |
728 | if ( size > 0 ) | 728 | if ( size > 0 ) |
729 | mItemList->horizontalScrollBar()->setMaximumWidth( size ); | 729 | mItemList->horizontalScrollBar()->setMaximumWidth( size ); |
730 | mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() ); | 730 | mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() ); |
731 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 731 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
732 | } | 732 | } |
733 | 733 | ||
734 | void MonthViewCell::defaultAction( QListBoxItem *item ) | 734 | void MonthViewCell::defaultAction( QListBoxItem *item ) |
735 | { | 735 | { |
736 | if ( !item ) return; | 736 | if ( !item ) return; |
737 | 737 | ||
738 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); | 738 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); |
739 | Incidence *incidence = eventItem->incidence(); | 739 | Incidence *incidence = eventItem->incidence(); |
740 | if ( incidence ) mMonthView->defaultAction( incidence ); | 740 | if ( incidence ) mMonthView->defaultAction( incidence ); |
741 | } | 741 | } |
742 | void MonthViewCell::showDay() | 742 | void MonthViewCell::showDay() |
743 | { | 743 | { |
744 | emit showDaySignal( date() ); | 744 | emit showDaySignal( date() ); |
745 | } | 745 | } |
746 | void MonthViewCell::newEvent() | 746 | void MonthViewCell::newEvent() |
747 | { | 747 | { |
748 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 748 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
749 | emit newEventSignal( dt ); | 749 | emit newEventSignal( dt ); |
750 | } | 750 | } |
751 | void MonthViewCell::cellClicked( QListBoxItem *item ) | 751 | void MonthViewCell::cellClicked( QListBoxItem *item ) |
752 | { | 752 | { |
753 | static QListBoxItem * lastClicked = 0; | 753 | static QListBoxItem * lastClicked = 0; |
754 | if ( item == 0 ) { | 754 | if ( item == 0 ) { |
755 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 755 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
756 | emit newEventSignal( dt ); | 756 | emit newEventSignal( dt ); |
757 | return; | 757 | return; |
758 | } | 758 | } |
759 | /* | 759 | /* |
760 | if ( lastClicked ) | 760 | if ( lastClicked ) |
761 | if ( ! item ) { | 761 | if ( ! item ) { |
762 | if ( lastClicked->listBox() != item->listBox() ) | 762 | if ( lastClicked->listBox() != item->listBox() ) |
763 | lastClicked->listBox()->clearSelection(); | 763 | lastClicked->listBox()->clearSelection(); |
764 | } | 764 | } |
765 | */ | 765 | */ |
766 | 766 | ||
767 | mMonthView->setSelectedCell( this ); | 767 | mMonthView->setSelectedCell( this ); |
768 | if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) enableScrollBars( true ); | 768 | if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) enableScrollBars( true ); |
769 | select(); | 769 | select(); |
770 | } | 770 | } |
771 | 771 | ||
772 | void MonthViewCell::contextMenu( QListBoxItem *item ) | 772 | void MonthViewCell::contextMenu( QListBoxItem *item ) |
773 | { | 773 | { |
774 | if ( !item ) return; | 774 | if ( !item ) return; |
775 | 775 | ||
776 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); | 776 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); |
777 | Incidence *incidence = eventItem->incidence(); | 777 | Incidence *incidence = eventItem->incidence(); |
778 | if ( incidence ) mMonthView->showContextMenu( incidence ); | 778 | if ( incidence ) mMonthView->showContextMenu( incidence ); |
779 | } | 779 | } |
780 | 780 | ||
781 | void MonthViewCell::selection( QListBoxItem *item ) | 781 | void MonthViewCell::selection( QListBoxItem *item ) |
782 | { | 782 | { |
783 | if ( !item ) return; | 783 | if ( !item ) return; |
784 | 784 | ||
785 | mMonthView->setSelectedCell( this ); | 785 | mMonthView->setSelectedCell( this ); |
786 | } | 786 | } |
787 | 787 | ||
788 | 788 | ||
789 | // ******************************************************************************* | 789 | // ******************************************************************************* |
790 | // ******************************************************************************* | 790 | // ******************************************************************************* |
791 | // ******************************************************************************* | 791 | // ******************************************************************************* |
792 | 792 | ||
793 | 793 | ||
794 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | 794 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) |
795 | : KOEventView( calendar, parent, name ), | 795 | : KOEventView( calendar, parent, name ), |
796 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), | 796 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), |
797 | mShortDayLabels( false ), mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) | 797 | mShortDayLabels( false ), mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) |
798 | { | 798 | { |
799 | 799 | ||
800 | clPending = true; | 800 | clPending = true; |
801 | mWidStack = new QWidgetStack( this ); | 801 | mWidStack = new QWidgetStack( this ); |
802 | QHBoxLayout* hb = new QHBoxLayout( this ); | 802 | QHBoxLayout* hb = new QHBoxLayout( this ); |
803 | mMonthView = new QWidget( mWidStack ); | 803 | mMonthView = new QWidget( mWidStack ); |
804 | mWeekView = new QWidget( mWidStack ); | 804 | mWeekView = new QWidget( mWidStack ); |
805 | #if QT_VERSION >= 0x030000 | 805 | #if QT_VERSION >= 0x030000 |
806 | mWidStack->addWidget(mMonthView ); | 806 | mWidStack->addWidget(mMonthView ); |
807 | mWidStack->addWidget(mWeekView ); | 807 | mWidStack->addWidget(mWeekView ); |
808 | #else | 808 | #else |
809 | mWidStack->addWidget( mMonthView, 1 ); | 809 | mWidStack->addWidget( mMonthView, 1 ); |
810 | mWidStack->addWidget( mWeekView , 1 ); | 810 | mWidStack->addWidget( mWeekView , 1 ); |
811 | #endif | 811 | #endif |
812 | hb->addWidget( mWidStack ); | 812 | hb->addWidget( mWidStack ); |
813 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); | 813 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); |
814 | mShowWeekView = KOPrefs::instance()->mMonthViewWeek; | 814 | mShowWeekView = KOPrefs::instance()->mMonthViewWeek; |
815 | if ( mShowWeekView ) | 815 | if ( mShowWeekView ) |
816 | mWeekStartsMonday = true; | 816 | mWeekStartsMonday = true; |
817 | updatePossible = false; | 817 | updatePossible = false; |
818 | mCells.setAutoDelete( true ); | 818 | mCells.setAutoDelete( true ); |
819 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; | 819 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; |
820 | mDayLabels.resize( mDaysPerWeek ); | 820 | mDayLabels.resize( mDaysPerWeek ); |
821 | mDayLabelsW.resize( mDaysPerWeek ); | 821 | mDayLabelsW.resize( mDaysPerWeek ); |
822 | QFont bfont = font(); | 822 | QFont bfont = font(); |
823 | if ( QApplication::desktop()->width() < 650 ) { | 823 | if ( QApplication::desktop()->width() < 650 ) { |
824 | bfont.setPointSize( bfont.pointSize() - 2 ); | 824 | bfont.setPointSize( bfont.pointSize() - 2 ); |
825 | } | 825 | } |
826 | bfont.setBold( true ); | 826 | bfont.setBold( true ); |
827 | int i; | 827 | int i; |
828 | 828 | ||
829 | for( i = 0; i < mDaysPerWeek; i++ ) { | 829 | for( i = 0; i < mDaysPerWeek; i++ ) { |
830 | QLabel *label = new QLabel( mMonthView ); | 830 | QLabel *label = new QLabel( mMonthView ); |
831 | label->setFont(bfont); | 831 | label->setFont(bfont); |
832 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 832 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
833 | label->setLineWidth(1); | 833 | label->setLineWidth(1); |
834 | label->setAlignment(AlignCenter); | 834 | label->setAlignment(AlignCenter); |
835 | mDayLabels.insert( i, label ); | 835 | mDayLabels.insert( i, label ); |
836 | label = new QLabel( mWeekView ); | 836 | label = new QLabel( mWeekView ); |
837 | label->setFont(bfont); | 837 | label->setFont(bfont); |
838 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 838 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
839 | label->setLineWidth(1); | 839 | label->setLineWidth(1); |
840 | label->setAlignment(AlignCenter); | 840 | label->setAlignment(AlignCenter); |
841 | mDayLabelsW.insert( i, label ); | 841 | mDayLabelsW.insert( i, label ); |
842 | } | 842 | } |
843 | 843 | ||
844 | bfont.setBold( false ); | 844 | bfont.setBold( false ); |
845 | mWeekLabels.resize( mNumWeeks+1 ); | 845 | mWeekLabels.resize( mNumWeeks+1 ); |
846 | mWeekLabelsW.resize( 2 ); | 846 | mWeekLabelsW.resize( 2 ); |
847 | for( i = 0; i < mNumWeeks+1; i++ ) { | 847 | for( i = 0; i < mNumWeeks+1; i++ ) { |
848 | KOWeekButton *label = new KOWeekButton( mMonthView ); | 848 | KOWeekButton *label = new KOWeekButton( mMonthView ); |
849 | label->setFocusPolicy(NoFocus); | 849 | label->setFocusPolicy(NoFocus); |
850 | label->setFont(bfont); | 850 | label->setFont(bfont); |
851 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); | 851 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); |
852 | label->setFlat(true); | 852 | label->setFlat(true); |
853 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); | 853 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); |
854 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 854 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
855 | //label->setLineWidth(1); | 855 | //label->setLineWidth(1); |
856 | //label->setAlignment(AlignCenter); | 856 | //label->setAlignment(AlignCenter); |
857 | mWeekLabels.insert( i, label ); | 857 | mWeekLabels.insert( i, label ); |
858 | } | 858 | } |
859 | mWeekLabels[mNumWeeks]->setText( i18n("W")); | 859 | mWeekLabels[mNumWeeks]->setText( i18n("W")); |
860 | QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); | 860 | QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); |
861 | 861 | ||
862 | for( i = 0; i < 1+1; i++ ) { | 862 | for( i = 0; i < 1+1; i++ ) { |
863 | KOWeekButton *label = new KOWeekButton( mWeekView ); | 863 | KOWeekButton *label = new KOWeekButton( mWeekView ); |
864 | label->setFocusPolicy(NoFocus); | 864 | label->setFocusPolicy(NoFocus); |
865 | label->setFont(bfont); | 865 | label->setFont(bfont); |
866 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); | 866 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); |
867 | label->setFlat(true); | 867 | label->setFlat(true); |
868 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); | 868 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); |
869 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 869 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
870 | //label->setLineWidth(1); | 870 | //label->setLineWidth(1); |
871 | //label->setAlignment(AlignCenter); | 871 | //label->setAlignment(AlignCenter); |
872 | mWeekLabelsW.insert( i, label ); | 872 | mWeekLabelsW.insert( i, label ); |
873 | } | 873 | } |
874 | mWeekLabelsW[1]->setText( i18n("W")); | 874 | mWeekLabelsW[1]->setText( i18n("W")); |
875 | 875 | ||
876 | 876 | ||
877 | int row, col; | 877 | int row, col; |
878 | mCells.resize( mNumCells ); | 878 | mCells.resize( mNumCells ); |
879 | for( row = 0; row < mNumWeeks; ++row ) { | 879 | for( row = 0; row < mNumWeeks; ++row ) { |
880 | for( col = 0; col < mDaysPerWeek; ++col ) { | 880 | for( col = 0; col < mDaysPerWeek; ++col ) { |
881 | MonthViewCell *cell = new MonthViewCell( this, mMonthView ); | 881 | MonthViewCell *cell = new MonthViewCell( this, mMonthView ); |
882 | mCells.insert( row * mDaysPerWeek + col, cell ); | 882 | mCells.insert( row * mDaysPerWeek + col, cell ); |
883 | 883 | ||
884 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), | 884 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), |
885 | SLOT( defaultAction( Incidence * ) ) ); | 885 | SLOT( defaultAction( Incidence * ) ) ); |
886 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), | 886 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), |
887 | SIGNAL( newEventSignal( QDateTime ) ) ); | 887 | SIGNAL( newEventSignal( QDateTime ) ) ); |
888 | connect( cell, SIGNAL( showDaySignal( QDate ) ), | 888 | connect( cell, SIGNAL( showDaySignal( QDate ) ), |
889 | SIGNAL( showDaySignal( QDate ) ) ); | 889 | SIGNAL( showDaySignal( QDate ) ) ); |
890 | } | 890 | } |
891 | } | 891 | } |
892 | mCellsW.resize( mDaysPerWeek ); | 892 | mCellsW.resize( mDaysPerWeek ); |
893 | for( col = 0; col < mDaysPerWeek; ++col ) { | 893 | for( col = 0; col < mDaysPerWeek; ++col ) { |
894 | MonthViewCell *cell = new MonthViewCell( this, mWeekView ); | 894 | MonthViewCell *cell = new MonthViewCell( this, mWeekView ); |
895 | mCellsW.insert( col, cell ); | 895 | mCellsW.insert( col, cell ); |
896 | 896 | ||
897 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), | 897 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), |
898 | SLOT( defaultAction( Incidence * ) ) ); | 898 | SLOT( defaultAction( Incidence * ) ) ); |
899 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), | 899 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), |
900 | SIGNAL( newEventSignal( QDateTime ) ) ); | 900 | SIGNAL( newEventSignal( QDateTime ) ) ); |
901 | connect( cell, SIGNAL( showDaySignal( QDate ) ), | 901 | connect( cell, SIGNAL( showDaySignal( QDate ) ), |
902 | SIGNAL( showDaySignal( QDate ) ) ); | 902 | SIGNAL( showDaySignal( QDate ) ) ); |
903 | cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); | 903 | cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); |
904 | } | 904 | } |
905 | 905 | ||
906 | //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); | 906 | //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); |
907 | mContextMenu = eventPopup(); | 907 | mContextMenu = eventPopup(); |
908 | // updateConfig(); //useless here | 908 | // updateConfig(); //useless here |
909 | 909 | ||
910 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); | 910 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); |
911 | #if 0 | 911 | #if 0 |
912 | mWidStack = new QWidgetStack( this ); | 912 | mWidStack = new QWidgetStack( this ); |
913 | mMonthView = new QWidget( mWidStack ); | 913 | mMonthView = new QWidget( mWidStack ); |
914 | mWeekView = new QWidget( mWidStack ); | 914 | mWeekView = new QWidget( mWidStack ); |
915 | #endif | 915 | #endif |
916 | if ( mShowWeekView ) | 916 | if ( mShowWeekView ) |
917 | mWidStack->raiseWidget( mWeekView ); | 917 | mWidStack->raiseWidget( mWeekView ); |
918 | else | 918 | else |
919 | mWidStack->raiseWidget( mMonthView ); | 919 | mWidStack->raiseWidget( mMonthView ); |
920 | 920 | ||
921 | emit incidenceSelected( 0 ); | 921 | emit incidenceSelected( 0 ); |
922 | } | 922 | } |
923 | 923 | ||
924 | KOMonthView::~KOMonthView() | 924 | KOMonthView::~KOMonthView() |
925 | { | 925 | { |
926 | delete mContextMenu; | 926 | delete mContextMenu; |
927 | } | 927 | } |
928 | 928 | ||
929 | void KOMonthView::selectInternalWeekNum ( int n ) | 929 | void KOMonthView::selectInternalWeekNum ( int n ) |
930 | { | 930 | { |
931 | switchView(); | 931 | switchView(); |
932 | emit selectWeekNum ( n ); | 932 | emit selectWeekNum ( n ); |
933 | } | 933 | } |
934 | 934 | ||
935 | int KOMonthView::currentWeek() | 935 | int KOMonthView::currentWeek() |
936 | { | 936 | { |
937 | if ( mShowWeekView ) | 937 | if ( mShowWeekView ) |
938 | return mWeekLabelsW[0]->getWeekNum(); | 938 | return mWeekLabelsW[0]->getWeekNum(); |
939 | return mWeekLabels[0]->getWeekNum(); | 939 | return mWeekLabels[0]->getWeekNum(); |
940 | } | 940 | } |
941 | void KOMonthView::switchView() | 941 | void KOMonthView::switchView() |
942 | { | 942 | { |
943 | 943 | ||
944 | if ( selectedCell( ) ) | 944 | if ( selectedCell( ) ) |
945 | selectedCell()->deselect(); | 945 | selectedCell()->deselect(); |
946 | mShowWeekView = !mShowWeekView; | 946 | mShowWeekView = !mShowWeekView; |
947 | KOPrefs::instance()->mMonthViewWeek = mShowWeekView; | 947 | KOPrefs::instance()->mMonthViewWeek = mShowWeekView; |
948 | //emit showNavigator( !mShowWeekView ); | 948 | //emit showNavigator( !mShowWeekView ); |
949 | if ( clPending ) { | 949 | if ( clPending ) { |
950 | computeLayout(); | 950 | computeLayout(); |
951 | updateConfig(); | 951 | updateConfig(); |
952 | } | 952 | } |
953 | if ( mShowWeekView ) | 953 | if ( mShowWeekView ) |
954 | mWidStack->raiseWidget( mWeekView ); | 954 | mWidStack->raiseWidget( mWeekView ); |
955 | else | 955 | else |
956 | mWidStack->raiseWidget( mMonthView ); | 956 | mWidStack->raiseWidget( mMonthView ); |
957 | clPending = false; | 957 | clPending = false; |
958 | } | 958 | } |
959 | 959 | ||
960 | int KOMonthView::maxDatesHint() | 960 | int KOMonthView::maxDatesHint() |
961 | { | 961 | { |
962 | return mNumCells; | 962 | return mNumCells; |
963 | } | 963 | } |
964 | 964 | ||
965 | int KOMonthView::currentDateCount() | 965 | int KOMonthView::currentDateCount() |
966 | { | 966 | { |
967 | return mNumCells; | 967 | return mNumCells; |
968 | } | 968 | } |
969 | 969 | ||
970 | QPtrList<Incidence> KOMonthView::selectedIncidences() | 970 | QPtrList<Incidence> KOMonthView::selectedIncidences() |
971 | { | 971 | { |
972 | QPtrList<Incidence> selected; | 972 | QPtrList<Incidence> selected; |
973 | 973 | ||
974 | if ( mSelectedCell ) { | 974 | if ( mSelectedCell ) { |
975 | Incidence *incidence = mSelectedCell->selectedIncidence(); | 975 | Incidence *incidence = mSelectedCell->selectedIncidence(); |
976 | if ( incidence ) selected.append( incidence ); | 976 | if ( incidence ) selected.append( incidence ); |
977 | } | 977 | } |
978 | 978 | ||
979 | return selected; | 979 | return selected; |
980 | } | 980 | } |
981 | 981 | ||
982 | DateList KOMonthView::selectedDates() | 982 | DateList KOMonthView::selectedDates() |
983 | { | 983 | { |
984 | DateList selected; | 984 | DateList selected; |
985 | 985 | ||
986 | if ( mSelectedCell ) { | 986 | if ( mSelectedCell ) { |
987 | QDate qd = mSelectedCell->selectedIncidenceDate(); | 987 | QDate qd = mSelectedCell->selectedIncidenceDate(); |
988 | if ( qd.isValid() ) selected.append( qd ); | 988 | if ( qd.isValid() ) selected.append( qd ); |
989 | } | 989 | } |
990 | 990 | ||
991 | return selected; | 991 | return selected; |
992 | } | 992 | } |
993 | 993 | ||
994 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 994 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
995 | const QDate &td) | 995 | const QDate &td) |
996 | { | 996 | { |
997 | #ifndef KORG_NOPRINTER | 997 | #ifndef KORG_NOPRINTER |
998 | calPrinter->preview(CalPrinter::Month, fd, td); | 998 | calPrinter->preview(CalPrinter::Month, fd, td); |
999 | #endif | 999 | #endif |
1000 | } | 1000 | } |
1001 | 1001 | ||
1002 | void KOMonthView::updateConfig() | 1002 | void KOMonthView::updateConfig() |
1003 | { | 1003 | { |
1004 | 1004 | ||
1005 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); | 1005 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); |
1006 | 1006 | ||
1007 | if ( mShowWeekView ) { | 1007 | if ( mShowWeekView ) { |
1008 | mWeekStartsMonday = true; | 1008 | mWeekStartsMonday = true; |
1009 | } | 1009 | } |
1010 | QFontMetrics fontmetric(mDayLabels[0]->font()); | 1010 | QFontMetrics fontmetric(mDayLabels[0]->font()); |
1011 | mWidthLongDayLabel = 0; | 1011 | mWidthLongDayLabel = 0; |
1012 | 1012 | ||
1013 | for (int i = 0; i < 7; i++) { | 1013 | for (int i = 0; i < 7; i++) { |
1014 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); | 1014 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); |
1015 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; | 1015 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; |
1016 | } | 1016 | } |
1017 | bool temp = mShowSatSunComp ; | 1017 | bool temp = mShowSatSunComp ; |
1018 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; | 1018 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; |
1019 | if ( ! mShowWeekView ) { | 1019 | if ( ! mShowWeekView ) { |
1020 | if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) | 1020 | if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) |
1021 | computeLayout(); | 1021 | computeLayout(); |
1022 | } | 1022 | } |
1023 | updateDayLabels(); | 1023 | updateDayLabels(); |
1024 | //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); | 1024 | //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); |
1025 | //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; | 1025 | //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; |
1026 | //resizeEvent( 0 ); | 1026 | //resizeEvent( 0 ); |
1027 | for (uint i = 0; i < mCells.count(); ++i) { | 1027 | for (uint i = 0; i < mCells.count(); ++i) { |
1028 | mCells[i]->updateConfig(); | 1028 | mCells[i]->updateConfig(); |
1029 | } | 1029 | } |
1030 | 1030 | ||
1031 | for (uint i = 0; i < mCellsW.count(); ++i) { | 1031 | for (uint i = 0; i < mCellsW.count(); ++i) { |
1032 | mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont); | 1032 | mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont); |
1033 | } | 1033 | } |
1034 | #ifdef DESKTOP_VERSION | 1034 | #ifdef DESKTOP_VERSION |
1035 | MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); | 1035 | MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); |
1036 | #endif | 1036 | #endif |
1037 | updateView(); | 1037 | updateView(); |
1038 | } | 1038 | } |
1039 | 1039 | ||
1040 | void KOMonthView::updateDayLabels() | 1040 | void KOMonthView::updateDayLabels() |
1041 | { | 1041 | { |
1042 | 1042 | ||
1043 | QPtrVector<QLabel> *mDayLabelsT; | 1043 | QPtrVector<QLabel> *mDayLabelsT; |
1044 | #if 0 | 1044 | #if 0 |
1045 | if (mShowWeekView ) | 1045 | if (mShowWeekView ) |
1046 | mDayLabelsT = &mDayLabelsW; | 1046 | mDayLabelsT = &mDayLabelsW; |
1047 | else | 1047 | else |
1048 | mDayLabelsT = &mDayLabels; | 1048 | mDayLabelsT = &mDayLabels; |
1049 | #endif | 1049 | #endif |
1050 | 1050 | ||
1051 | mDayLabelsT = &mDayLabelsW; | 1051 | mDayLabelsT = &mDayLabelsW; |
1052 | for (int i = 0; i < 7; i++) { | 1052 | for (int i = 0; i < 7; i++) { |
1053 | if (mWeekStartsMonday) { | 1053 | if (mWeekStartsMonday) { |
1054 | bool show = mShortDayLabels; | 1054 | bool show = mShortDayLabels; |
1055 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) | 1055 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) |
1056 | show = true; | 1056 | show = true; |
1057 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); | 1057 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); |
1058 | } else { | 1058 | } else { |
1059 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabels)); | 1059 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabels)); |
1060 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabels)); | 1060 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabels)); |
1061 | 1061 | ||
1062 | } | 1062 | } |
1063 | } | 1063 | } |
1064 | mDayLabelsT = &mDayLabels; | 1064 | mDayLabelsT = &mDayLabels; |
1065 | for (int i = 0; i < 7; i++) { | 1065 | for (int i = 0; i < 7; i++) { |
1066 | if (mWeekStartsMonday) { | 1066 | if (mWeekStartsMonday) { |
1067 | bool show = mShortDayLabels; | 1067 | bool show = mShortDayLabels; |
1068 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) | 1068 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) |
1069 | show = true; | 1069 | show = true; |
1070 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); | 1070 | (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); |
1071 | } else { | 1071 | } else { |
1072 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabels)); | 1072 | if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabels)); |
1073 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabels)); | 1073 | else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabels)); |
1074 | 1074 | ||
1075 | } | 1075 | } |
1076 | } | 1076 | } |
1077 | 1077 | ||
1078 | } | 1078 | } |
1079 | 1079 | ||
1080 | void KOMonthView::showDates(const QDate &start, const QDate &) | 1080 | void KOMonthView::showDates(const QDate &start, const QDate &) |
1081 | { | 1081 | { |
1082 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; | 1082 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; |
1083 | 1083 | ||
1084 | QPtrVector<MonthViewCell> *cells; | 1084 | QPtrVector<MonthViewCell> *cells; |
1085 | QPtrVector<QLabel> *dayLabels; | 1085 | QPtrVector<QLabel> *dayLabels; |
1086 | QPtrVector<KOWeekButton> *weekLabels; | 1086 | QPtrVector<KOWeekButton> *weekLabels; |
1087 | int weekNum = 6; | 1087 | int weekNum = 6; |
1088 | if ( mShowWeekView ) { | 1088 | if ( mShowWeekView ) { |
1089 | weekNum = 1; | 1089 | weekNum = 1; |
1090 | cells = &mCellsW; | 1090 | cells = &mCellsW; |
1091 | dayLabels = &mDayLabelsW; | 1091 | dayLabels = &mDayLabelsW; |
1092 | weekLabels = &mWeekLabelsW; | 1092 | weekLabels = &mWeekLabelsW; |
1093 | } else { | 1093 | } else { |
1094 | cells = &mCells; | 1094 | cells = &mCells; |
1095 | dayLabels = &mDayLabels; | 1095 | dayLabels = &mDayLabels; |
1096 | weekLabels = &mWeekLabels; | 1096 | weekLabels = &mWeekLabels; |
1097 | } | 1097 | } |
1098 | 1098 | ||
1099 | mStartDate = start; | 1099 | mStartDate = start; |
1100 | 1100 | ||
1101 | int startWeekDay = mWeekStartsMonday ? 1 : 7; | 1101 | int startWeekDay = mWeekStartsMonday ? 1 : 7; |
1102 | 1102 | ||
1103 | while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { | 1103 | while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { |
1104 | mStartDate = mStartDate.addDays( -1 ); | 1104 | mStartDate = mStartDate.addDays( -1 ); |
1105 | } | 1105 | } |
1106 | 1106 | ||
1107 | bool primary = false; | 1107 | bool primary = false; |
1108 | uint i; | 1108 | uint i; |
1109 | for( i = 0; i < (*cells).size(); ++i ) { | 1109 | for( i = 0; i < (*cells).size(); ++i ) { |
1110 | QDate date = mStartDate.addDays( i ); | 1110 | QDate date = mStartDate.addDays( i ); |
1111 | (*cells)[i]->setDate( date ); | 1111 | (*cells)[i]->setDate( date ); |
1112 | 1112 | ||
1113 | #ifndef KORG_NOPLUGINS | 1113 | #ifndef KORG_NOPLUGINS |
1114 | // add holiday, if present | 1114 | // add holiday, if present |
1115 | QString hstring(KOCore::self()->holiday(date)); | 1115 | QString hstring(KOCore::self()->holiday(date)); |
1116 | (*cells)[i]->setHoliday( hstring ); | 1116 | (*cells)[i]->setHoliday( hstring ); |
1117 | #endif | 1117 | #endif |
1118 | 1118 | ||
1119 | } | 1119 | } |
1120 | QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); | 1120 | QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); |
1121 | for( i = 0; i < weekNum; ++i ) { | 1121 | for( i = 0; i < weekNum; ++i ) { |
1122 | int wno; | 1122 | int wno; |
1123 | // remember, according to ISO 8601, the first week of the year is the | 1123 | // remember, according to ISO 8601, the first week of the year is the |
1124 | // first week that contains a thursday. Thus we must subtract off 4, | 1124 | // first week that contains a thursday. Thus we must subtract off 4, |
1125 | // not just 1. | 1125 | // not just 1. |
1126 | int dayOfYear = date.dayOfYear(); | 1126 | int dayOfYear = date.dayOfYear(); |
1127 | if (dayOfYear % 7 != 0) | 1127 | if (dayOfYear % 7 != 0) |
1128 | wno = dayOfYear / 7 + 1; | 1128 | wno = dayOfYear / 7 + 1; |
1129 | else | 1129 | else |
1130 | wno =dayOfYear / 7; | 1130 | wno =dayOfYear / 7; |
1131 | (*weekLabels)[i]->setWeekNum( wno ); | 1131 | (*weekLabels)[i]->setWeekNum( wno ); |
1132 | date = date.addDays( 7 ); | 1132 | date = date.addDays( 7 ); |
1133 | } | 1133 | } |
1134 | updateView(); | 1134 | updateView(); |
1135 | } | 1135 | } |
1136 | 1136 | ||
1137 | void KOMonthView::showEvents(QPtrList<Event>) | 1137 | void KOMonthView::showEvents(QPtrList<Event>) |
1138 | { | 1138 | { |
1139 | qDebug("KOMonthView::selectEvents is not implemented yet. "); | 1139 | qDebug("KOMonthView::selectEvents is not implemented yet. "); |
1140 | } | 1140 | } |
1141 | 1141 | ||
1142 | void KOMonthView::changeEventDisplay(Event *, int) | 1142 | void KOMonthView::changeEventDisplay(Event *, int) |
1143 | { | 1143 | { |
1144 | // this should be re-written to be much more efficient, but this | 1144 | // this should be re-written to be much more efficient, but this |
1145 | // quick-and-dirty-hack gets the job done for right now. | 1145 | // quick-and-dirty-hack gets the job done for right now. |
1146 | updateView(); | 1146 | updateView(); |
1147 | } | 1147 | } |
1148 | 1148 | ||
1149 | void KOMonthView::updateView() | 1149 | void KOMonthView::updateView() |
1150 | { | 1150 | { |
1151 | 1151 | ||
1152 | if ( !updatePossible ) | 1152 | if ( !updatePossible ) |
1153 | return; | 1153 | return; |
1154 | //QTime ti; | 1154 | //QTime ti; |
1155 | //ti.start(); | 1155 | //ti.start(); |
1156 | QPtrVector<MonthViewCell> *cells; | 1156 | QPtrVector<MonthViewCell> *cells; |
1157 | if ( mShowWeekView ) { | 1157 | if ( mShowWeekView ) { |
1158 | cells = &mCellsW; | 1158 | cells = &mCellsW; |
1159 | } else { | 1159 | } else { |
1160 | cells = &mCells; | 1160 | cells = &mCells; |
1161 | } | 1161 | } |
1162 | #if 1 | 1162 | #if 1 |
1163 | int i; | 1163 | int i; |
1164 | int timeSpan = (*cells).size()-1; | 1164 | int timeSpan = (*cells).size()-1; |
1165 | if ( KOPrefs::instance()->mMonthViewWeek ) | 1165 | if ( KOPrefs::instance()->mMonthViewWeek ) |
1166 | timeSpan = 6; | 1166 | timeSpan = 6; |
1167 | for( i = 0; i < timeSpan + 1; ++i ) { | 1167 | for( i = 0; i < timeSpan + 1; ++i ) { |
1168 | (*cells)[i]->startUpdateCell(); | 1168 | (*cells)[i]->startUpdateCell(); |
1169 | } | 1169 | } |
1170 | 1170 | ||
1171 | QPtrList<Event> events = calendar()->events(); | 1171 | QPtrList<Event> events = calendar()->events(); |
1172 | Event *event; | 1172 | Event *event; |
1173 | QDateTime dt; | 1173 | QDateTime dt; |
1174 | bool ok; | 1174 | bool ok; |
1175 | QDate endDate = mStartDate.addDays( timeSpan ); | 1175 | QDate endDate = mStartDate.addDays( timeSpan ); |
1176 | for( event = events.first(); event; event = events.next() ) { // for event | 1176 | for( event = events.first(); event; event = events.next() ) { // for event |
1177 | if ( event->doesRecur() ) { | 1177 | if ( event->doesRecur() ) { |
1178 | bool last; | 1178 | bool last; |
1179 | QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); | 1179 | QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); |
1180 | QDateTime incidenceEnd; | 1180 | QDateTime incidenceEnd; |
1181 | int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 1181 | int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
1182 | bool invalid = false; | 1182 | bool invalid = false; |
1183 | while( true ) { | 1183 | while( true ) { |
1184 | if ( incidenceStart.isValid() ) { | 1184 | if ( incidenceStart.isValid() ) { |
1185 | incidenceEnd = incidenceStart.addDays( eventlen ); | 1185 | incidenceEnd = incidenceStart.addDays( eventlen ); |
1186 | int st = incidenceStart.date().daysTo( endDate ); | 1186 | int st = incidenceStart.date().daysTo( endDate ); |
1187 | if ( st >= 0 ) { // start before timeend | 1187 | if ( st >= 0 ) { // start before timeend |
1188 | int end = mStartDate.daysTo( incidenceEnd.date() ); | 1188 | int end = mStartDate.daysTo( incidenceEnd.date() ); |
1189 | if ( end >= 0 ) { // end after timestart --- got one! | 1189 | if ( end >= 0 ) { // end after timestart --- got one! |
1190 | //normalize | 1190 | //normalize |
1191 | st = timeSpan - st; | 1191 | st = timeSpan - st; |
1192 | if ( st < 0 ) st = 0; | 1192 | if ( st < 0 ) st = 0; |
1193 | if ( end > timeSpan ) end = timeSpan; | 1193 | if ( end > timeSpan ) end = timeSpan; |
1194 | int iii; | 1194 | int iii; |
1195 | //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); | 1195 | //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); |
1196 | for ( iii = st;iii<= end;++iii) | 1196 | for ( iii = st;iii<= end;++iii) |
1197 | (*cells)[iii]->insertEvent( event ); | 1197 | (*cells)[iii]->insertEvent( event ); |
1198 | } | 1198 | } |
1199 | } | 1199 | } |
1200 | } else { | 1200 | } else { |
1201 | if ( invalid ) | 1201 | if ( invalid ) |
1202 | break; | 1202 | break; |
1203 | invalid = true; | 1203 | invalid = true; |
1204 | //qDebug("invalid %s", event->summary().latin1()); | 1204 | //qDebug("invalid %s", event->summary().latin1()); |
1205 | incidenceStart = QDateTime( mStartDate ); | 1205 | incidenceStart = QDateTime( mStartDate ).addSecs( -2 );; |
1206 | } | 1206 | } |
1207 | if ( last ) | 1207 | if ( last ) |
1208 | break; | 1208 | break; |
1209 | bool ok; | 1209 | bool ok; |
1210 | incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); | 1210 | incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); |
1211 | if ( ! ok ) | 1211 | if ( ! ok ) |
1212 | break; | 1212 | break; |
1213 | if ( incidenceStart.date() > endDate ) | 1213 | if ( incidenceStart.date() > endDate ) |
1214 | break; | 1214 | break; |
1215 | } | 1215 | } |
1216 | } else { // no recur | 1216 | } else { // no recur |
1217 | int st = event->dtStart().date().daysTo( endDate ); | 1217 | int st = event->dtStart().date().daysTo( endDate ); |
1218 | if ( st >= 0 ) { // start before timeend | 1218 | if ( st >= 0 ) { // start before timeend |
1219 | int end = mStartDate.daysTo( event->dtEnd().date() ); | 1219 | int end = mStartDate.daysTo( event->dtEnd().date() ); |
1220 | if ( end >= 0 ) { // end after timestart --- got one! | 1220 | if ( end >= 0 ) { // end after timestart --- got one! |
1221 | //normalize | 1221 | //normalize |
1222 | st = timeSpan - st; | 1222 | st = timeSpan - st; |
1223 | if ( st < 0 ) st = 0; | 1223 | if ( st < 0 ) st = 0; |
1224 | if ( end > timeSpan ) end = timeSpan; | 1224 | if ( end > timeSpan ) end = timeSpan; |
1225 | int iii; | 1225 | int iii; |
1226 | for ( iii = st;iii<= end;++iii) | 1226 | for ( iii = st;iii<= end;++iii) |
1227 | (*cells)[iii]->insertEvent( event ); | 1227 | (*cells)[iii]->insertEvent( event ); |
1228 | } | 1228 | } |
1229 | } | 1229 | } |
1230 | } | 1230 | } |
1231 | } | 1231 | } |
1232 | // insert due todos | 1232 | // insert due todos |
1233 | QPtrList<Todo> todos = calendar()->todos( ); | 1233 | QPtrList<Todo> todos = calendar()->todos( ); |
1234 | Todo *todo; | 1234 | Todo *todo; |
1235 | for(todo = todos.first(); todo; todo = todos.next()) { | 1235 | for(todo = todos.first(); todo; todo = todos.next()) { |
1236 | //insertTodo( todo ); | 1236 | //insertTodo( todo ); |
1237 | if ( todo->hasDueDate() ) { | 1237 | if ( todo->hasDueDate() ) { |
1238 | int day = mStartDate.daysTo( todo->dtDue().date() ); | 1238 | int day = mStartDate.daysTo( todo->dtDue().date() ); |
1239 | if ( day >= 0 && day < timeSpan + 1) { | 1239 | if ( day >= 0 && day < timeSpan + 1) { |
1240 | (*cells)[day]->insertTodo( todo ); | 1240 | (*cells)[day]->insertTodo( todo ); |
1241 | } | 1241 | } |
1242 | } | 1242 | } |
1243 | } | 1243 | } |
1244 | 1244 | ||
1245 | for( i = 0; i < timeSpan+1; ++i ) { | 1245 | for( i = 0; i < timeSpan+1; ++i ) { |
1246 | (*cells)[i]->finishUpdateCell(); | 1246 | (*cells)[i]->finishUpdateCell(); |
1247 | } | 1247 | } |
1248 | processSelectionChange(); | 1248 | processSelectionChange(); |
1249 | (*cells)[0]->setFocus(); | 1249 | (*cells)[0]->setFocus(); |
1250 | 1250 | ||
1251 | 1251 | ||
1252 | #else | 1252 | #else |
1253 | // old code | 1253 | // old code |
1254 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); | 1254 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); |
1255 | int i; | 1255 | int i; |
1256 | for( i = 0; i < (*cells).count(); ++i ) { | 1256 | for( i = 0; i < (*cells).count(); ++i ) { |
1257 | (*cells)[i]->updateCell(); | 1257 | (*cells)[i]->updateCell(); |
1258 | } | 1258 | } |
1259 | 1259 | ||
1260 | //qDebug("KOMonthView::updateView() "); | 1260 | //qDebug("KOMonthView::updateView() "); |
1261 | processSelectionChange(); | 1261 | processSelectionChange(); |
1262 | // qDebug("---------------------------------------------------------------------+ "); | 1262 | // qDebug("---------------------------------------------------------------------+ "); |
1263 | (*cells)[0]->setFocus(); | 1263 | (*cells)[0]->setFocus(); |
1264 | #endif | 1264 | #endif |
1265 | 1265 | ||
1266 | //qDebug("update time %d ", ti.elapsed()); | 1266 | //qDebug("update time %d ", ti.elapsed()); |
1267 | } | 1267 | } |
1268 | 1268 | ||
1269 | void KOMonthView::resizeEvent(QResizeEvent * e) | 1269 | void KOMonthView::resizeEvent(QResizeEvent * e) |
1270 | { | 1270 | { |
1271 | computeLayout(); | 1271 | computeLayout(); |
1272 | clPending = true; | 1272 | clPending = true; |
1273 | if ( mShowWeekView ) | 1273 | if ( mShowWeekView ) |
1274 | mCellsW[0]->setFocus(); | 1274 | mCellsW[0]->setFocus(); |
1275 | else | 1275 | else |
1276 | mCells[0]->setFocus(); | 1276 | mCells[0]->setFocus(); |
1277 | } | 1277 | } |
1278 | void KOMonthView::computeLayoutWeek() | 1278 | void KOMonthView::computeLayoutWeek() |
1279 | { | 1279 | { |
1280 | 1280 | ||
1281 | int daysToShow; | 1281 | int daysToShow; |
1282 | bool combinedSatSun = false; | 1282 | bool combinedSatSun = false; |
1283 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { | 1283 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { |
1284 | daysToShow = 6; | 1284 | daysToShow = 6; |
1285 | combinedSatSun = true; | 1285 | combinedSatSun = true; |
1286 | } | 1286 | } |
1287 | int tWid = topLevelWidget()->size().width(); | 1287 | int tWid = topLevelWidget()->size().width(); |
1288 | int tHei = topLevelWidget()->size().height(); | 1288 | int tHei = topLevelWidget()->size().height(); |
1289 | 1289 | ||
1290 | int wid = size().width();//e | 1290 | int wid = size().width();//e |
1291 | int hei = size().height()-1; | 1291 | int hei = size().height()-1; |
1292 | 1292 | ||
1293 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) | 1293 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) |
1294 | return; | 1294 | return; |
1295 | 1295 | ||
1296 | if ( wid < hei ) | 1296 | if ( wid < hei ) |
1297 | daysToShow = 2; | 1297 | daysToShow = 2; |
1298 | else | 1298 | else |
1299 | daysToShow = 3; | 1299 | daysToShow = 3; |
1300 | mShowSatSunComp = true; | 1300 | mShowSatSunComp = true; |
1301 | combinedSatSun = true; | 1301 | combinedSatSun = true; |
1302 | 1302 | ||
1303 | //qDebug("KOMonthView::computeLayout()------------------------------------ "); | 1303 | //qDebug("KOMonthView::computeLayout()------------------------------------ "); |
1304 | QFontMetrics fm ( mWeekLabels[0]->font() ); | 1304 | QFontMetrics fm ( mWeekLabels[0]->font() ); |
1305 | int weeklabelwid = fm.width( "888" ); | 1305 | int weeklabelwid = fm.width( "888" ); |
1306 | wid -= weeklabelwid; | 1306 | wid -= weeklabelwid; |
1307 | 1307 | ||
1308 | int colWid = wid / daysToShow; | 1308 | int colWid = wid / daysToShow; |
1309 | int lastCol = wid - ( colWid*6 ); | 1309 | int lastCol = wid - ( colWid*6 ); |
1310 | int dayLabelHei = mDayLabelsW[0]->sizeHint().height(); | 1310 | int dayLabelHei = mDayLabelsW[0]->sizeHint().height(); |
1311 | int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); | 1311 | int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); |
1312 | int colModulo = wid % daysToShow; | 1312 | int colModulo = wid % daysToShow; |
1313 | int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; | 1313 | int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; |
1314 | //qDebug("rowmod %d ", rowModulo); | 1314 | //qDebug("rowmod %d ", rowModulo); |
1315 | int i; | 1315 | int i; |
1316 | int x,y,w,h; | 1316 | int x,y,w,h; |
1317 | x= 0; | 1317 | x= 0; |
1318 | y= 0; | 1318 | y= 0; |
1319 | w = colWid; | 1319 | w = colWid; |
1320 | h = dayLabelHei ; | 1320 | h = dayLabelHei ; |
1321 | for ( i = 0; i < 7; i++) { | 1321 | for ( i = 0; i < 7; i++) { |
1322 | if ( i && !( i % daysToShow) && i < 6) { | 1322 | if ( i && !( i % daysToShow) && i < 6) { |
1323 | y += hei/(5-daysToShow); | 1323 | y += hei/(5-daysToShow); |
1324 | x = 0; | 1324 | x = 0; |
1325 | w = colWid; | 1325 | w = colWid; |
1326 | } | 1326 | } |
1327 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { | 1327 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { |
1328 | ++w; | 1328 | ++w; |
1329 | } | 1329 | } |
1330 | if ( i >= 5 ) { | 1330 | if ( i >= 5 ) { |
1331 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w/2+w%2,h); | 1331 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w/2+w%2,h); |
1332 | x -= (w/2 ); | 1332 | x -= (w/2 ); |
1333 | } | 1333 | } |
1334 | else | 1334 | else |
1335 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w,h); | 1335 | mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w,h); |
1336 | x += w; | 1336 | x += w; |
1337 | } | 1337 | } |
1338 | x= 0; | 1338 | x= 0; |
1339 | y= dayLabelHei; | 1339 | y= dayLabelHei; |
1340 | w = colWid; | 1340 | w = colWid; |
1341 | h = cellHei; | 1341 | h = cellHei; |
1342 | for ( i = 0; i < mCellsW.count(); ++i) { | 1342 | for ( i = 0; i < mCellsW.count(); ++i) { |
1343 | if ( i > 6 ) { | 1343 | if ( i > 6 ) { |
1344 | mCellsW[i]->hide(); | 1344 | mCellsW[i]->hide(); |
1345 | continue; | 1345 | continue; |
1346 | } | 1346 | } |
1347 | 1347 | ||
1348 | w = colWid; | 1348 | w = colWid; |
1349 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { | 1349 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { |
1350 | ++w; | 1350 | ++w; |
1351 | } | 1351 | } |
1352 | if ( i == (daysToShow-1-rowModulo)*7) | 1352 | if ( i == (daysToShow-1-rowModulo)*7) |
1353 | ++h; | 1353 | ++h; |
1354 | 1354 | ||
1355 | if ( i >= 5 ) { | 1355 | if ( i >= 5 ) { |
1356 | if ( i ==5 ) { | 1356 | if ( i ==5 ) { |
1357 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); | 1357 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); |
1358 | x -= w ;y += h/2; | 1358 | x -= w ;y += h/2; |
1359 | } else { | 1359 | } else { |
1360 | if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) { | 1360 | if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) { |
1361 | ++w; | 1361 | ++w; |
1362 | } | 1362 | } |
1363 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); | 1363 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); |
1364 | y -= h/2; | 1364 | y -= h/2; |
1365 | } | 1365 | } |
1366 | } else | 1366 | } else |
1367 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1367 | mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1368 | 1368 | ||
1369 | 1369 | ||
1370 | x += w; | 1370 | x += w; |
1371 | if ( x + w/2 > wid ) { | 1371 | if ( x + w/2 > wid ) { |
1372 | x = 0; | 1372 | x = 0; |
1373 | y += h+dayLabelHei ; | 1373 | y += h+dayLabelHei ; |
1374 | } | 1374 | } |
1375 | } | 1375 | } |
1376 | y= dayLabelHei; | 1376 | y= dayLabelHei; |
1377 | h = cellHei ; | 1377 | h = cellHei ; |
1378 | mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei); | 1378 | mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei); |
1379 | mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei); | 1379 | mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei); |
1380 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); | 1380 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); |
1381 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); | 1381 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); |
1382 | mShortDayLabels = mDayLabelsW[0]->width() < mWidthLongDayLabel ; | 1382 | mShortDayLabels = mDayLabelsW[0]->width() < mWidthLongDayLabel ; |
1383 | updateDayLabels(); | 1383 | updateDayLabels(); |
1384 | bool forceUpdate = !updatePossible; | 1384 | bool forceUpdate = !updatePossible; |
1385 | updatePossible = true; | 1385 | updatePossible = true; |
1386 | //mWeekLabels[mNumWeeks]->setText( i18n("M")); | 1386 | //mWeekLabels[mNumWeeks]->setText( i18n("M")); |
1387 | if ( forceUpdate ) | 1387 | if ( forceUpdate ) |
1388 | updateView(); | 1388 | updateView(); |
1389 | } | 1389 | } |
1390 | void KOMonthView::computeLayout() | 1390 | void KOMonthView::computeLayout() |
1391 | { | 1391 | { |
1392 | // select the appropriate heading string size. E.g. "Wednesday" or "Wed". | 1392 | // select the appropriate heading string size. E.g. "Wednesday" or "Wed". |
1393 | // note this only changes the text if the requested size crosses the | 1393 | // note this only changes the text if the requested size crosses the |
1394 | // threshold between big enough to support the full name and not big | 1394 | // threshold between big enough to support the full name and not big |
1395 | // enough. | 1395 | // enough. |
1396 | if ( mShowWeekView ){ | 1396 | if ( mShowWeekView ){ |
1397 | computeLayoutWeek(); | 1397 | computeLayoutWeek(); |
1398 | return; | 1398 | return; |
1399 | } | 1399 | } |
1400 | int daysToShow = 7; | 1400 | int daysToShow = 7; |
1401 | bool combinedSatSun = false; | 1401 | bool combinedSatSun = false; |
1402 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { | 1402 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { |
1403 | daysToShow = 6; | 1403 | daysToShow = 6; |
1404 | combinedSatSun = true; | 1404 | combinedSatSun = true; |
1405 | } | 1405 | } |
1406 | int tWid = topLevelWidget()->size().width(); | 1406 | int tWid = topLevelWidget()->size().width(); |
1407 | int tHei = topLevelWidget()->size().height(); | 1407 | int tHei = topLevelWidget()->size().height(); |
1408 | 1408 | ||
1409 | int wid = size().width();//e | 1409 | int wid = size().width();//e |
1410 | int hei = size().height()-1; | 1410 | int hei = size().height()-1; |
1411 | 1411 | ||
1412 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) | 1412 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) |
1413 | return; | 1413 | return; |
1414 | //qDebug("KOMonthView::computeLayout()------------------------------------ "); | 1414 | //qDebug("KOMonthView::computeLayout()------------------------------------ "); |
1415 | QFontMetrics fm ( mWeekLabels[0]->font() ); | 1415 | QFontMetrics fm ( mWeekLabels[0]->font() ); |
1416 | int weeklabelwid = fm.width( "888" ); | 1416 | int weeklabelwid = fm.width( "888" ); |
1417 | wid -= weeklabelwid; | 1417 | wid -= weeklabelwid; |
1418 | 1418 | ||
1419 | int colWid = wid / daysToShow; | 1419 | int colWid = wid / daysToShow; |
1420 | int lastCol = wid - ( colWid*6 ); | 1420 | int lastCol = wid - ( colWid*6 ); |
1421 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); | 1421 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); |
1422 | int cellHei = (hei - dayLabelHei) /6; | 1422 | int cellHei = (hei - dayLabelHei) /6; |
1423 | int colModulo = wid % daysToShow; | 1423 | int colModulo = wid % daysToShow; |
1424 | int rowModulo = (hei- dayLabelHei) % 6; | 1424 | int rowModulo = (hei- dayLabelHei) % 6; |
1425 | //qDebug("rowmod %d ", rowModulo); | 1425 | //qDebug("rowmod %d ", rowModulo); |
1426 | int i; | 1426 | int i; |
1427 | int x,y,w,h; | 1427 | int x,y,w,h; |
1428 | x= 0; | 1428 | x= 0; |
1429 | y= 0; | 1429 | y= 0; |
1430 | w = colWid; | 1430 | w = colWid; |
1431 | h = dayLabelHei ; | 1431 | h = dayLabelHei ; |
1432 | for ( i = 0; i < 7; i++) { | 1432 | for ( i = 0; i < 7; i++) { |
1433 | if ( i == daysToShow-colModulo ) | 1433 | if ( i == daysToShow-colModulo ) |
1434 | ++w; | 1434 | ++w; |
1435 | if ( combinedSatSun ) { | 1435 | if ( combinedSatSun ) { |
1436 | if ( i >= daysToShow-1 ) { | 1436 | if ( i >= daysToShow-1 ) { |
1437 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); | 1437 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); |
1438 | x -= w/2 ; | 1438 | x -= w/2 ; |
1439 | } | 1439 | } |
1440 | else | 1440 | else |
1441 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); | 1441 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); |
1442 | } else | 1442 | } else |
1443 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); | 1443 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); |
1444 | x += w; | 1444 | x += w; |
1445 | } | 1445 | } |
1446 | x= 0; | 1446 | x= 0; |
1447 | y= dayLabelHei; | 1447 | y= dayLabelHei; |
1448 | w = colWid; | 1448 | w = colWid; |
1449 | h = cellHei ; | 1449 | h = cellHei ; |
1450 | for ( i = 0; i < mCells.count(); ++i) { | 1450 | for ( i = 0; i < mCells.count(); ++i) { |
1451 | w = colWid; | 1451 | w = colWid; |
1452 | if ( ((i) % 7) >= 7-colModulo ) { | 1452 | if ( ((i) % 7) >= 7-colModulo ) { |
1453 | ++w; | 1453 | ++w; |
1454 | } | 1454 | } |
1455 | if ( i == (6-rowModulo)*7) | 1455 | if ( i == (6-rowModulo)*7) |
1456 | ++h; | 1456 | ++h; |
1457 | if ( combinedSatSun ) { | 1457 | if ( combinedSatSun ) { |
1458 | if ( (i)%7 >= daysToShow-1 ) { | 1458 | if ( (i)%7 >= daysToShow-1 ) { |
1459 | if ( (i)%7 == daysToShow-1 ) { | 1459 | if ( (i)%7 == daysToShow-1 ) { |
1460 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); | 1460 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); |
1461 | x -= w ;y += h/2; | 1461 | x -= w ;y += h/2; |
1462 | } else { | 1462 | } else { |
1463 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); | 1463 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); |
1464 | y -= h/2; | 1464 | y -= h/2; |
1465 | } | 1465 | } |
1466 | } else | 1466 | } else |
1467 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1467 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1468 | 1468 | ||
1469 | } | 1469 | } |
1470 | else | 1470 | else |
1471 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1471 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1472 | x += w; | 1472 | x += w; |
1473 | if ( x + w/2 > wid ) { | 1473 | if ( x + w/2 > wid ) { |
1474 | x = 0; | 1474 | x = 0; |
1475 | y += h; | 1475 | y += h; |
1476 | } | 1476 | } |
1477 | } | 1477 | } |
1478 | y= dayLabelHei; | 1478 | y= dayLabelHei; |
1479 | h = cellHei ; | 1479 | h = cellHei ; |
1480 | for ( i = 0; i < 6; i++) { | 1480 | for ( i = 0; i < 6; i++) { |
1481 | if ( i == (6-rowModulo)) | 1481 | if ( i == (6-rowModulo)) |
1482 | ++h; | 1482 | ++h; |
1483 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); | 1483 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); |
1484 | y += h; | 1484 | y += h; |
1485 | } | 1485 | } |
1486 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); | 1486 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); |
1487 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); | 1487 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); |
1488 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); | 1488 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); |
1489 | mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ; | 1489 | mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ; |
1490 | updateDayLabels(); | 1490 | updateDayLabels(); |
1491 | bool forceUpdate = !updatePossible; | 1491 | bool forceUpdate = !updatePossible; |
1492 | updatePossible = true; | 1492 | updatePossible = true; |
1493 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); | 1493 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); |
1494 | if ( forceUpdate ) | 1494 | if ( forceUpdate ) |
1495 | updateView(); | 1495 | updateView(); |
1496 | } | 1496 | } |
1497 | 1497 | ||
1498 | void KOMonthView::showContextMenu( Incidence *incidence ) | 1498 | void KOMonthView::showContextMenu( Incidence *incidence ) |
1499 | { | 1499 | { |
1500 | mContextMenu->showIncidencePopup(incidence); | 1500 | mContextMenu->showIncidencePopup(incidence); |
1501 | /* | 1501 | /* |
1502 | if( incidence && incidence->type() == "Event" ) { | 1502 | if( incidence && incidence->type() == "Event" ) { |
1503 | Event *event = static_cast<Event *>(incidence); | 1503 | Event *event = static_cast<Event *>(incidence); |
1504 | mContextMenu->showEventPopup(event); | 1504 | mContextMenu->showEventPopup(event); |
1505 | } else { | 1505 | } else { |
1506 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; | 1506 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; |
1507 | } | 1507 | } |
1508 | */ | 1508 | */ |
1509 | } | 1509 | } |
1510 | MonthViewCell * KOMonthView::selectedCell( ) | 1510 | MonthViewCell * KOMonthView::selectedCell( ) |
1511 | { | 1511 | { |
1512 | return mSelectedCell; | 1512 | return mSelectedCell; |
1513 | } | 1513 | } |
1514 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) | 1514 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) |
1515 | { | 1515 | { |
1516 | // qDebug("KOMonthView::setSelectedCell "); | 1516 | // qDebug("KOMonthView::setSelectedCell "); |
1517 | if ( mSelectedCell && mSelectedCell != cell ) { | 1517 | if ( mSelectedCell && mSelectedCell != cell ) { |
1518 | MonthViewCell * mvc = mSelectedCell; | 1518 | MonthViewCell * mvc = mSelectedCell; |
1519 | mSelectedCell = cell; | 1519 | mSelectedCell = cell; |
1520 | mvc->deselect(); | 1520 | mvc->deselect(); |
1521 | } else | 1521 | } else |
1522 | mSelectedCell = cell; | 1522 | mSelectedCell = cell; |
1523 | // if ( mSelectedCell ) | 1523 | // if ( mSelectedCell ) |
1524 | // mSelectedCell->select(); | 1524 | // mSelectedCell->select(); |
1525 | if ( !mSelectedCell ) | 1525 | if ( !mSelectedCell ) |
1526 | emit incidenceSelected( 0 ); | 1526 | emit incidenceSelected( 0 ); |
1527 | else | 1527 | else |
1528 | emit incidenceSelected( mSelectedCell->selectedIncidence() ); | 1528 | emit incidenceSelected( mSelectedCell->selectedIncidence() ); |
1529 | } | 1529 | } |
1530 | 1530 | ||
1531 | void KOMonthView::processSelectionChange() | 1531 | void KOMonthView::processSelectionChange() |
1532 | { | 1532 | { |
1533 | QPtrList<Incidence> incidences = selectedIncidences(); | 1533 | QPtrList<Incidence> incidences = selectedIncidences(); |
1534 | if (incidences.count() > 0) { | 1534 | if (incidences.count() > 0) { |
1535 | emit incidenceSelected( incidences.first() ); | 1535 | emit incidenceSelected( incidences.first() ); |
1536 | } else { | 1536 | } else { |
1537 | emit incidenceSelected( 0 ); | 1537 | emit incidenceSelected( 0 ); |
1538 | } | 1538 | } |
1539 | } | 1539 | } |
1540 | 1540 | ||
1541 | void KOMonthView::clearSelection() | 1541 | void KOMonthView::clearSelection() |
1542 | { | 1542 | { |
1543 | if ( mSelectedCell ) { | 1543 | if ( mSelectedCell ) { |
1544 | mSelectedCell->deselect(); | 1544 | mSelectedCell->deselect(); |
1545 | mSelectedCell = 0; | 1545 | mSelectedCell = 0; |
1546 | } | 1546 | } |
1547 | } | 1547 | } |
1548 | void KOMonthView::keyPressEvent ( QKeyEvent * e ) | 1548 | void KOMonthView::keyPressEvent ( QKeyEvent * e ) |
1549 | { | 1549 | { |
1550 | //qDebug("KOMonthView::keyPressEvent "); | 1550 | //qDebug("KOMonthView::keyPressEvent "); |
1551 | switch(e->key()) { | 1551 | switch(e->key()) { |
1552 | case Key_Up: | 1552 | case Key_Up: |
1553 | { | 1553 | { |
1554 | emit prevMonth(); | 1554 | emit prevMonth(); |
1555 | mCells[0]->setFocus(); | 1555 | mCells[0]->setFocus(); |
1556 | } | 1556 | } |
1557 | e->accept(); | 1557 | e->accept(); |
1558 | break; | 1558 | break; |
1559 | case Key_Down: | 1559 | case Key_Down: |
1560 | { | 1560 | { |
1561 | emit nextMonth(); | 1561 | emit nextMonth(); |
1562 | mCells[0]->setFocus(); | 1562 | mCells[0]->setFocus(); |
1563 | 1563 | ||
1564 | } | 1564 | } |
1565 | e->accept(); | 1565 | e->accept(); |
1566 | break; | 1566 | break; |
1567 | case Key_Return: | 1567 | case Key_Return: |
1568 | case Key_Enter: | 1568 | case Key_Enter: |
1569 | { | 1569 | { |
1570 | selectInternalWeekNum ( currentWeek() ); | 1570 | selectInternalWeekNum ( currentWeek() ); |
1571 | } | 1571 | } |
1572 | e->accept(); | 1572 | e->accept(); |
1573 | break; | 1573 | break; |
1574 | default: | 1574 | default: |
1575 | e->ignore(); | 1575 | e->ignore(); |
1576 | break; | 1576 | break; |
1577 | } | 1577 | } |
1578 | } | 1578 | } |
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp index 6bdee18..78d4027 100644 --- a/korganizer/kotodoviewitem.cpp +++ b/korganizer/kotodoviewitem.cpp | |||
@@ -1,468 +1,464 @@ | |||
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 <klocale.h> | 20 | #include <klocale.h> |
21 | #include <kdebug.h> | 21 | #include <kdebug.h> |
22 | #include <qapp.h> | 22 | #include <qapp.h> |
23 | 23 | ||
24 | #include <kiconloader.h> | 24 | #include <kiconloader.h> |
25 | #include "kotodoviewitem.h" | 25 | #include "kotodoviewitem.h" |
26 | #include "kotodoview.h" | 26 | #include "kotodoview.h" |
27 | #include "koprefs.h" | 27 | #include "koprefs.h" |
28 | 28 | ||
29 | KOTodoViewItem::KOTodoViewItem( QListView *parent, Todo *todo, KOTodoView *kotodo) | 29 | KOTodoViewItem::KOTodoViewItem( QListView *parent, Todo *todo, KOTodoView *kotodo) |
30 | : QCheckListItem( parent , "", CheckBox ), mTodo( todo ), mTodoView( kotodo ) | 30 | : QCheckListItem( parent , "", CheckBox ), mTodo( todo ), mTodoView( kotodo ) |
31 | { | 31 | { |
32 | construct(); | 32 | construct(); |
33 | } | 33 | } |
34 | 34 | ||
35 | KOTodoViewItem::KOTodoViewItem( KOTodoViewItem *parent, Todo *todo, KOTodoView *kotodo ) | 35 | KOTodoViewItem::KOTodoViewItem( KOTodoViewItem *parent, Todo *todo, KOTodoView *kotodo ) |
36 | : QCheckListItem( parent, "", CheckBox ), mTodo( todo ), mTodoView( kotodo ) | 36 | : QCheckListItem( parent, "", CheckBox ), mTodo( todo ), mTodoView( kotodo ) |
37 | { | 37 | { |
38 | construct(); | 38 | construct(); |
39 | } | 39 | } |
40 | 40 | ||
41 | QString KOTodoViewItem::key(int column,bool) const | 41 | QString KOTodoViewItem::key(int column,bool) const |
42 | { | 42 | { |
43 | QMap<int,QString>::ConstIterator it = mKeyMap.find(column); | 43 | QMap<int,QString>::ConstIterator it = mKeyMap.find(column); |
44 | if (it == mKeyMap.end()) { | 44 | if (it == mKeyMap.end()) { |
45 | return text(column).lower(); | 45 | return text(column).lower(); |
46 | } else { | 46 | } else { |
47 | return *it; | 47 | return *it; |
48 | } | 48 | } |
49 | } | 49 | } |
50 | 50 | ||
51 | void KOTodoViewItem:: setup() | 51 | void KOTodoViewItem:: setup() |
52 | { | 52 | { |
53 | 53 | ||
54 | int h = 20; | 54 | int h = 20; |
55 | if ( listView () ) { | 55 | if ( listView () ) { |
56 | QFontMetrics fm ( listView ()->font () ); | 56 | QFontMetrics fm ( listView ()->font () ); |
57 | h = fm.height(); | 57 | h = fm.height(); |
58 | } | 58 | } |
59 | setHeight( h ); | 59 | setHeight( h ); |
60 | 60 | ||
61 | } | 61 | } |
62 | void KOTodoViewItem::setSortKey(int column,const QString &key) | 62 | void KOTodoViewItem::setSortKey(int column,const QString &key) |
63 | { | 63 | { |
64 | mKeyMap.insert(column,key); | 64 | mKeyMap.insert(column,key); |
65 | } | 65 | } |
66 | 66 | ||
67 | #if QT_VERSION >= 0x030000 | 67 | #if QT_VERSION >= 0x030000 |
68 | void KOTodoViewItem::paintBranches(QPainter *p,const QColorGroup & cg,int w, | 68 | void KOTodoViewItem::paintBranches(QPainter *p,const QColorGroup & cg,int w, |
69 | int y,int h) | 69 | int y,int h) |
70 | { | 70 | { |
71 | QListViewItem::paintBranches(p,cg,w,y,h); | 71 | QListViewItem::paintBranches(p,cg,w,y,h); |
72 | } | 72 | } |
73 | #else | 73 | #else |
74 | #endif | 74 | #endif |
75 | 75 | ||
76 | void KOTodoViewItem::construct() | 76 | void KOTodoViewItem::construct() |
77 | { | 77 | { |
78 | // qDebug("KOTodoViewItem::construct() "); | 78 | // qDebug("KOTodoViewItem::construct() "); |
79 | m_init = true; | 79 | m_init = true; |
80 | QString keyd = "=="; | 80 | QString keyd = "=="; |
81 | QString keyt = "=="; | 81 | QString keyt = "=="; |
82 | QString skeyd = "=="; | 82 | QString skeyd = "=="; |
83 | QString skeyt = "=="; | 83 | QString skeyt = "=="; |
84 | 84 | ||
85 | setOn(mTodo->isCompleted()); | 85 | setOn(mTodo->isCompleted()); |
86 | setText(0,mTodo->summary()); | 86 | setText(0,mTodo->summary()); |
87 | setText(1,QString::number(mTodo->priority())); | 87 | setText(1,QString::number(mTodo->priority())); |
88 | setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); | 88 | setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); |
89 | if (mTodo->percentComplete()<100) { | 89 | if (mTodo->percentComplete()<100) { |
90 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); | 90 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); |
91 | else setSortKey(2,QString::number(mTodo->percentComplete())); | 91 | else setSortKey(2,QString::number(mTodo->percentComplete())); |
92 | } | 92 | } |
93 | else { | 93 | else { |
94 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); | 94 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); |
95 | else setSortKey(2,QString::number(99)); | 95 | else setSortKey(2,QString::number(99)); |
96 | } | 96 | } |
97 | if (mTodo->hasDueDate()) { | 97 | if (mTodo->hasDueDate()) { |
98 | setText(3, mTodo->dtDueDateStr()); | 98 | setText(3, mTodo->dtDueDateStr()); |
99 | QDate d = mTodo->dtDue().date(); | 99 | QDate d = mTodo->dtDue().date(); |
100 | keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 100 | keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
101 | // setSortKey(3,keyd); | 101 | // setSortKey(3,keyd); |
102 | if (mTodo->doesFloat()) { | 102 | if (mTodo->doesFloat()) { |
103 | setText(4,""); | 103 | setText(4,""); |
104 | } | 104 | } |
105 | else { | 105 | else { |
106 | setText(4,mTodo->dtDueTimeStr()); | 106 | setText(4,mTodo->dtDueTimeStr()); |
107 | QTime t = mTodo->dtDue().time(); | 107 | QTime t = mTodo->dtDue().time(); |
108 | keyt.sprintf("%02d%02d",t.hour(),t.minute()); | 108 | keyt.sprintf("%02d%02d",t.hour(),t.minute()); |
109 | //setSortKey(4,keyt); | 109 | //setSortKey(4,keyt); |
110 | } | 110 | } |
111 | } else { | 111 | } else { |
112 | setText(3,""); | 112 | setText(3,""); |
113 | setText(4,""); | 113 | setText(4,""); |
114 | } | 114 | } |
115 | setSortKey(3,keyd); | 115 | setSortKey(3,keyd); |
116 | setSortKey(4,keyt); | 116 | setSortKey(4,keyt); |
117 | 117 | ||
118 | if (mTodo->isCompleted()) setSortKey(1,"6" + QString::number(mTodo->priority())+keyd+keyt); | 118 | if (mTodo->isCompleted()) setSortKey(1,"6" + QString::number(mTodo->priority())+keyd+keyt); |
119 | else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); | 119 | else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); |
120 | 120 | ||
121 | 121 | ||
122 | 122 | ||
123 | if (mTodo->hasStartDate()) { | 123 | if (mTodo->hasStartDate()) { |
124 | setText(5, mTodo->dtStartDateStr()); | 124 | setText(5, mTodo->dtStartDateStr()); |
125 | QDate d = mTodo->dtStart().date(); | 125 | QDate d = mTodo->dtStart().date(); |
126 | skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 126 | skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
127 | 127 | ||
128 | if (mTodo->doesFloat()) { | 128 | if (mTodo->doesFloat()) { |
129 | setText(6,""); | 129 | setText(6,""); |
130 | } | 130 | } |
131 | else { | 131 | else { |
132 | setText(6,mTodo->dtStartTimeStr()); | 132 | setText(6,mTodo->dtStartTimeStr()); |
133 | QTime t = mTodo->dtStart().time(); | 133 | QTime t = mTodo->dtStart().time(); |
134 | skeyt.sprintf("%02d%02d",t.hour(),t.minute()); | 134 | skeyt.sprintf("%02d%02d",t.hour(),t.minute()); |
135 | 135 | ||
136 | } | 136 | } |
137 | } else { | 137 | } else { |
138 | setText(5,""); | 138 | setText(5,""); |
139 | setText(6,""); | 139 | setText(6,""); |
140 | } | 140 | } |
141 | setSortKey(5,skeyd); | 141 | setSortKey(5,skeyd); |
142 | setSortKey(6,skeyt); | 142 | setSortKey(6,skeyt); |
143 | 143 | ||
144 | setText(7,mTodo->cancelled() ? i18n("Yes") : i18n("No")); | 144 | setText(7,mTodo->cancelled() ? i18n("Yes") : i18n("No")); |
145 | setText(8,mTodo->categoriesStr()); | 145 | setText(8,mTodo->categoriesStr()); |
146 | 146 | ||
147 | #if 0 | 147 | #if 0 |
148 | // Find sort id in description. It's the text behind the last '#' character | 148 | // Find sort id in description. It's the text behind the last '#' character |
149 | // found in the description. White spaces are removed from beginning and end | 149 | // found in the description. White spaces are removed from beginning and end |
150 | // of sort id. | 150 | // of sort id. |
151 | int pos = mTodo->description().findRev('#'); | 151 | int pos = mTodo->description().findRev('#'); |
152 | if (pos < 0) { | 152 | if (pos < 0) { |
153 | setText(6,""); | 153 | setText(6,""); |
154 | } else { | 154 | } else { |
155 | QString str = mTodo->description().mid(pos+1); | 155 | QString str = mTodo->description().mid(pos+1); |
156 | str.stripWhiteSpace(); | 156 | str.stripWhiteSpace(); |
157 | setText(6,str); | 157 | setText(6,str); |
158 | } | 158 | } |
159 | #endif | 159 | #endif |
160 | 160 | ||
161 | m_known = false; | 161 | m_known = false; |
162 | m_init = false; | 162 | m_init = false; |
163 | 163 | ||
164 | setMyPixmap(); | 164 | setMyPixmap(); |
165 | 165 | ||
166 | } | 166 | } |
167 | void KOTodoViewItem::setMyPixmap() | 167 | void KOTodoViewItem::setMyPixmap() |
168 | { | 168 | { |
169 | int size = 5; | 169 | int size = 5; |
170 | QPixmap pixi = QPixmap( 1, 1 ); | 170 | QPixmap pixi = QPixmap( 1, 1 ); |
171 | // if ( !mTodo->isCompleted() && mTodo->hasDueDate() && mTodo->dtDue() < QDateTime::currentDateTime() ) { | 171 | // if ( !mTodo->isCompleted() && mTodo->hasDueDate() && mTodo->dtDue() < QDateTime::currentDateTime() ) { |
172 | // pixi = SmallIcon("redcross16"); | 172 | // pixi = SmallIcon("redcross16"); |
173 | // } else { | 173 | // } else { |
174 | QPainter p; | 174 | QPainter p; |
175 | 175 | ||
176 | int pixSize = 0; | 176 | int pixSize = 0; |
177 | QPixmap pPix = QPixmap( size, size ); | 177 | QPixmap pPix = QPixmap( size, size ); |
178 | if ( mTodo->description().length() > 0 ) { | 178 | if ( mTodo->description().length() > 0 ) { |
179 | pixi.resize(size, pixSize+size); | 179 | pixi.resize(size, pixSize+size); |
180 | pPix.fill( Qt::darkGreen ); | 180 | pPix.fill( Qt::darkGreen ); |
181 | p.begin( &pixi ); | 181 | p.begin( &pixi ); |
182 | p. drawPixmap ( 0, pixSize, pPix); | 182 | p. drawPixmap ( 0, pixSize, pPix); |
183 | p.end(); | 183 | p.end(); |
184 | pixSize += size; | 184 | pixSize += size; |
185 | } | 185 | } |
186 | if ( mTodo->isAlarmEnabled() ) { | 186 | if ( mTodo->isAlarmEnabled() ) { |
187 | pixi.resize(size, pixSize+size); | 187 | pixi.resize(size, pixSize+size); |
188 | pPix.fill( Qt::red ); | 188 | pPix.fill( Qt::red ); |
189 | p.begin( &pixi ); | 189 | p.begin( &pixi ); |
190 | p. drawPixmap ( 0, pixSize, pPix); | 190 | p. drawPixmap ( 0, pixSize, pPix); |
191 | p.end(); | 191 | p.end(); |
192 | pixSize += size; | 192 | pixSize += size; |
193 | } | 193 | } |
194 | // } | 194 | // } |
195 | if ( pixi.width() > 1 ) { | 195 | if ( pixi.width() > 1 ) { |
196 | setPixmap ( 0,pixi ) ; | 196 | setPixmap ( 0,pixi ) ; |
197 | } else { | 197 | } else { |
198 | setPixmap ( 0,QPixmap() ) ; | 198 | setPixmap ( 0,QPixmap() ) ; |
199 | } | 199 | } |
200 | } | 200 | } |
201 | void KOTodoViewItem::stateChange(bool state) | 201 | void KOTodoViewItem::stateChange(bool state) |
202 | { | 202 | { |
203 | // qDebug("KOTodoViewItem::stateChange "); | 203 | // qDebug("KOTodoViewItem::stateChange "); |
204 | // do not change setting on startup | 204 | // do not change setting on startup |
205 | if ( m_init ) return; | 205 | if ( m_init ) return; |
206 | if (isOn()!=state) { | 206 | if (isOn()!=state) { |
207 | setOn(state); | 207 | setOn(state); |
208 | //qDebug("SETON "); | 208 | //qDebug("SETON "); |
209 | return; | 209 | return; |
210 | } | 210 | } |
211 | if ( mTodo->isCompleted() == state ) { | 211 | if ( mTodo->isCompleted() == state ) { |
212 | //qDebug("STATECHANGE:nothing to do "); | 212 | //qDebug("STATECHANGE:nothing to do "); |
213 | return; | 213 | return; |
214 | } | 214 | } |
215 | QString keyd = "=="; | 215 | QString keyd = "=="; |
216 | QString keyt = "=="; | 216 | QString keyt = "=="; |
217 | //qDebug("KOTodoViewItem::stateChange %s ", text(0).latin1()); | 217 | //qDebug("KOTodoViewItem::stateChange %s ", text(0).latin1()); |
218 | mTodo->setCompleted(state); | 218 | mTodo->setCompleted(state); |
219 | if (state) mTodo->setCompleted(QDateTime::currentDateTime()); | 219 | if (state) mTodo->setCompleted(QDateTime::currentDateTime()); |
220 | 220 | ||
221 | if (mTodo->hasDueDate()) { | 221 | if (mTodo->hasDueDate()) { |
222 | setText(3, mTodo->dtDueDateStr()); | 222 | setText(3, mTodo->dtDueDateStr()); |
223 | QDate d = mTodo->dtDue().date(); | 223 | QDate d = mTodo->dtDue().date(); |
224 | keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 224 | keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
225 | setSortKey(3,keyd); | 225 | setSortKey(3,keyd); |
226 | if (mTodo->doesFloat()) { | 226 | if (mTodo->doesFloat()) { |
227 | setText(4,""); | 227 | setText(4,""); |
228 | } | 228 | } |
229 | else { | 229 | else { |
230 | setText(4,mTodo->dtDueTimeStr()); | 230 | setText(4,mTodo->dtDueTimeStr()); |
231 | QTime t = mTodo->dtDue().time(); | 231 | QTime t = mTodo->dtDue().time(); |
232 | keyt.sprintf("%02d%02d",t.hour(),t.minute()); | 232 | keyt.sprintf("%02d%02d",t.hour(),t.minute()); |
233 | setSortKey(4,keyt); | 233 | setSortKey(4,keyt); |
234 | } | 234 | } |
235 | } | 235 | } |
236 | if (mTodo->isCompleted()) setSortKey(1,QString::number(9)+keyd+keyt); | 236 | if (mTodo->isCompleted()) setSortKey(1,QString::number(9)+keyd+keyt); |
237 | else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); | 237 | else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); |
238 | 238 | ||
239 | setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); | 239 | setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); |
240 | if (mTodo->percentComplete()<100) { | 240 | if (mTodo->percentComplete()<100) { |
241 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); | 241 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); |
242 | else setSortKey(2,QString::number(mTodo->percentComplete())); | 242 | else setSortKey(2,QString::number(mTodo->percentComplete())); |
243 | } | 243 | } |
244 | else { | 244 | else { |
245 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); | 245 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); |
246 | else setSortKey(2,QString::number(99)); | 246 | else setSortKey(2,QString::number(99)); |
247 | } | 247 | } |
248 | if ( state ) { | 248 | if ( state ) { |
249 | QListViewItem * myChild = firstChild(); | 249 | QListViewItem * myChild = firstChild(); |
250 | KOTodoViewItem *item; | 250 | KOTodoViewItem *item; |
251 | while( myChild ) { | 251 | while( myChild ) { |
252 | //qDebug("stateCH "); | 252 | //qDebug("stateCH "); |
253 | item = static_cast<KOTodoViewItem*>(myChild); | 253 | item = static_cast<KOTodoViewItem*>(myChild); |
254 | item->stateChange(state); | 254 | item->stateChange(state); |
255 | myChild = myChild->nextSibling(); | 255 | myChild = myChild->nextSibling(); |
256 | } | 256 | } |
257 | } else { | 257 | } else { |
258 | QListViewItem * myChild = parent(); | 258 | QListViewItem * myChild = parent(); |
259 | if ( myChild ) | 259 | if ( myChild ) |
260 | (static_cast<KOTodoViewItem*>(myChild))->stateChange(state); | 260 | (static_cast<KOTodoViewItem*>(myChild))->stateChange(state); |
261 | } | 261 | } |
262 | mTodoView->modified(true); | 262 | mTodoView->modified(true); |
263 | setMyPixmap(); | 263 | setMyPixmap(); |
264 | mTodoView->setTodoModified( mTodo ); | 264 | mTodoView->setTodoModified( mTodo ); |
265 | } | 265 | } |
266 | 266 | ||
267 | bool KOTodoViewItem::isAlternate() | 267 | bool KOTodoViewItem::isAlternate() |
268 | { | 268 | { |
269 | #ifndef KORG_NOLVALTERNATION | 269 | #ifndef KORG_NOLVALTERNATION |
270 | KOTodoListView *lv = static_cast<KOTodoListView *>(listView()); | 270 | KOTodoListView *lv = static_cast<KOTodoListView *>(listView()); |
271 | if (lv && lv->alternateBackground().isValid()) | 271 | if (lv && lv->alternateBackground().isValid()) |
272 | { | 272 | { |
273 | KOTodoViewItem *above = 0; | 273 | KOTodoViewItem *above = 0; |
274 | above = dynamic_cast<KOTodoViewItem *>(itemAbove()); | 274 | above = dynamic_cast<KOTodoViewItem *>(itemAbove()); |
275 | m_known = above ? above->m_known : true; | 275 | m_known = above ? above->m_known : true; |
276 | if (m_known) | 276 | if (m_known) |
277 | { | 277 | { |
278 | m_odd = above ? !above->m_odd : false; | 278 | m_odd = above ? !above->m_odd : false; |
279 | } | 279 | } |
280 | else | 280 | else |
281 | { | 281 | { |
282 | KOTodoViewItem *item; | 282 | KOTodoViewItem *item; |
283 | bool previous = true; | 283 | bool previous = true; |
284 | if (QListViewItem::parent()) | 284 | if (QListViewItem::parent()) |
285 | { | 285 | { |
286 | item = dynamic_cast<KOTodoViewItem *>(QListViewItem::parent()); | 286 | item = dynamic_cast<KOTodoViewItem *>(QListViewItem::parent()); |
287 | if (item) | 287 | if (item) |
288 | previous = item->m_odd; | 288 | previous = item->m_odd; |
289 | item = dynamic_cast<KOTodoViewItem *>(QListViewItem::parent()->firstChild()); | 289 | item = dynamic_cast<KOTodoViewItem *>(QListViewItem::parent()->firstChild()); |
290 | } | 290 | } |
291 | else | 291 | else |
292 | { | 292 | { |
293 | item = dynamic_cast<KOTodoViewItem *>(lv->firstChild()); | 293 | item = dynamic_cast<KOTodoViewItem *>(lv->firstChild()); |
294 | } | 294 | } |
295 | 295 | ||
296 | while(item) | 296 | while(item) |
297 | { | 297 | { |
298 | item->m_odd = previous = !previous; | 298 | item->m_odd = previous = !previous; |
299 | item->m_known = true; | 299 | item->m_known = true; |
300 | item = dynamic_cast<KOTodoViewItem *>(item->nextSibling()); | 300 | item = dynamic_cast<KOTodoViewItem *>(item->nextSibling()); |
301 | } | 301 | } |
302 | } | 302 | } |
303 | return m_odd; | 303 | return m_odd; |
304 | } | 304 | } |
305 | return false; | 305 | return false; |
306 | #else | 306 | #else |
307 | return false; | 307 | return false; |
308 | #endif | 308 | #endif |
309 | } | 309 | } |
310 | 310 | ||
311 | void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment) | 311 | void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment) |
312 | { | 312 | { |
313 | QColorGroup _cg = cg; | 313 | QColorGroup _cg = cg; |
314 | QColorGroup::ColorRole role; | 314 | QColorGroup::ColorRole role; |
315 | if ( KOPrefs::instance()->mTodoViewUsesForegroundColor ) | 315 | if ( KOPrefs::instance()->mTodoViewUsesForegroundColor ) |
316 | role = QColorGroup::Text; | 316 | role = QColorGroup::Text; |
317 | else | 317 | else |
318 | role = QColorGroup::Base; | 318 | role = QColorGroup::Base; |
319 | //#ifndef KORG_NOLVALTERNATION | 319 | //#ifndef KORG_NOLVALTERNATION |
320 | // if (isAlternate()) | 320 | // if (isAlternate()) |
321 | // _cg.setColor(QColorGroup::Base, static_cast< KOTodoListView* >(listView())->alternateBackground()); | 321 | // _cg.setColor(QColorGroup::Base, static_cast< KOTodoListView* >(listView())->alternateBackground()); |
322 | bool setColor = KOPrefs::instance()->mTodoViewUsesCatColors; | 322 | bool setColor = KOPrefs::instance()->mTodoViewUsesCatColors; |
323 | QColor colorToSet; | 323 | QColor colorToSet; |
324 | if ( setColor ) { | 324 | if ( setColor ) { |
325 | QStringList categories = mTodo->categories(); | 325 | QStringList categories = mTodo->categories(); |
326 | QString cat = categories.first(); | 326 | QString cat = categories.first(); |
327 | if ( !cat.isEmpty()) { | 327 | if ( !cat.isEmpty()) { |
328 | colorToSet = *(KOPrefs::instance()->categoryColor(cat) ); | 328 | colorToSet = *(KOPrefs::instance()->categoryColor(cat) ); |
329 | } else | 329 | } else |
330 | setColor = false; | 330 | setColor = false; |
331 | } | 331 | } |
332 | if (mTodo->hasDueDate()) { | 332 | |
333 | if (mTodo->dtDue().date()==QDate::currentDate() && | 333 | int odue = mTodo->hasDueSubTodo( !isOpen()); |
334 | !mTodo->isCompleted()) { | 334 | if (odue == 2) { |
335 | //_cg.setColor( role , KOPrefs::instance()->mTodoDueTodayColor); | 335 | colorToSet = KOPrefs::instance()->mTodoOverdueColor; |
336 | colorToSet = KOPrefs::instance()->mTodoDueTodayColor; | 336 | setColor = true; |
337 | setColor = true; | 337 | } else if ( odue == 1 ) { |
338 | } | 338 | colorToSet = KOPrefs::instance()->mTodoDueTodayColor; |
339 | if (mTodo->dtDue().date() < QDate::currentDate() && | 339 | setColor = true; |
340 | !mTodo->isCompleted()) { | 340 | } |
341 | //_cg.setColor( role, KOPrefs::instance()->mTodoOverdueColor); | 341 | |
342 | colorToSet = KOPrefs::instance()->mTodoOverdueColor; | ||
343 | setColor = true; | ||
344 | } | ||
345 | } | ||
346 | 342 | ||
347 | if ( setColor ) { | 343 | if ( setColor ) { |
348 | _cg.setColor(role,colorToSet ); | 344 | _cg.setColor(role,colorToSet ); |
349 | if ( role == QColorGroup::Base) { | 345 | if ( role == QColorGroup::Base) { |
350 | int rgb = colorToSet.red(); | 346 | int rgb = colorToSet.red(); |
351 | rgb += colorToSet.blue()/2; | 347 | rgb += colorToSet.blue()/2; |
352 | rgb += colorToSet.green(); | 348 | rgb += colorToSet.green(); |
353 | if ( rgb < 200 ) | 349 | if ( rgb < 200 ) |
354 | _cg.setColor(QColorGroup::Text,Qt::white ); | 350 | _cg.setColor(QColorGroup::Text,Qt::white ); |
355 | } | 351 | } |
356 | } | 352 | } |
357 | //#endif | 353 | //#endif |
358 | if ( column > 0 ){ | 354 | if ( column > 0 ){ |
359 | if ( column == 2 && !KOPrefs::instance()->mTodoViewShowsPercentage ) { | 355 | if ( column == 2 && !KOPrefs::instance()->mTodoViewShowsPercentage ) { |
360 | p->save(); | 356 | p->save(); |
361 | int progress = (int)(( (width-6)*mTodo->percentComplete())/100.0 + 0.5); | 357 | int progress = (int)(( (width-6)*mTodo->percentComplete())/100.0 + 0.5); |
362 | 358 | ||
363 | p->fillRect( 0, 0, width, height(), _cg.base() ); // background | 359 | p->fillRect( 0, 0, width, height(), _cg.base() ); // background |
364 | // p->setPen(Qt::black ); //border | 360 | // p->setPen(Qt::black ); //border |
365 | // p->setBrush( KOPrefs::instance()->mHighlightColorKGlobalSettings::baseColor() ); //filling | 361 | // p->setBrush( KOPrefs::instance()->mHighlightColorKGlobalSettings::baseColor() ); //filling |
366 | QColor fc = KOPrefs::instance()->mHighlightColor; | 362 | QColor fc = KOPrefs::instance()->mHighlightColor; |
367 | if ( mTodo->percentComplete() == 100 ) | 363 | if ( mTodo->percentComplete() == 100 ) |
368 | fc = darkGreen; | 364 | fc = darkGreen; |
369 | p->drawRect( 2, 2, width-4, height()-4); | 365 | p->drawRect( 2, 2, width-4, height()-4); |
370 | p->fillRect( 3, 3, progress, height()-6, | 366 | p->fillRect( 3, 3, progress, height()-6, |
371 | fc ); | 367 | fc ); |
372 | p->restore(); | 368 | p->restore(); |
373 | } else { | 369 | } else { |
374 | QCheckListItem::paintCell(p, _cg, column, width, alignment); | 370 | QCheckListItem::paintCell(p, _cg, column, width, alignment); |
375 | } | 371 | } |
376 | return; | 372 | return; |
377 | } | 373 | } |
378 | 374 | ||
379 | int align = alignment; | 375 | int align = alignment; |
380 | 376 | ||
381 | if ( !p ) | 377 | if ( !p ) |
382 | return; | 378 | return; |
383 | 379 | ||
384 | p->fillRect( 0, 0, width, height(), _cg.brush( QColorGroup::Base ) ); | 380 | p->fillRect( 0, 0, width, height(), _cg.brush( QColorGroup::Base ) ); |
385 | 381 | ||
386 | QListView *lv = listView(); | 382 | QListView *lv = listView(); |
387 | if ( !lv ) | 383 | if ( !lv ) |
388 | return; | 384 | return; |
389 | int marg = 2;//lv->itemMargin(); | 385 | int marg = 2;//lv->itemMargin(); |
390 | int r = 0; | 386 | int r = 0; |
391 | QCheckListItem::Type myType = QCheckListItem::CheckBox; | 387 | QCheckListItem::Type myType = QCheckListItem::CheckBox; |
392 | int BoxSize = 20; | 388 | int BoxSize = 20; |
393 | int boxOffset = 2; | 389 | int boxOffset = 2; |
394 | int xOffset = 2; | 390 | int xOffset = 2; |
395 | if (qApp->desktop()->width() < 300 ) { | 391 | if (qApp->desktop()->width() < 300 ) { |
396 | BoxSize = 14; | 392 | BoxSize = 14; |
397 | boxOffset = -1; | 393 | boxOffset = -1; |
398 | xOffset = 1; | 394 | xOffset = 1; |
399 | // marg = 0; | 395 | // marg = 0; |
400 | } | 396 | } |
401 | if ( height() < BoxSize ) { | 397 | if ( height() < BoxSize ) { |
402 | boxOffset = boxOffset - ((BoxSize - height())/2) ; | 398 | boxOffset = boxOffset - ((BoxSize - height())/2) ; |
403 | // qDebug("boxOffset %d height %d", boxOffset, height() ); | 399 | // qDebug("boxOffset %d height %d", boxOffset, height() ); |
404 | BoxSize = height(); | 400 | BoxSize = height(); |
405 | 401 | ||
406 | } | 402 | } |
407 | //bool winStyle = lv->style() == WindowsStyle; | 403 | //bool winStyle = lv->style() == WindowsStyle; |
408 | 404 | ||
409 | int lineStart = 5; | 405 | int lineStart = 5; |
410 | if ( myType == Controller ) { | 406 | if ( myType == Controller ) { |
411 | if ( !pixmap( 0 ) ) | 407 | if ( !pixmap( 0 ) ) |
412 | r += BoxSize + 4; | 408 | r += BoxSize + 4; |
413 | } else { | 409 | } else { |
414 | ASSERT( lv ); //### | 410 | ASSERT( lv ); //### |
415 | //QFontMetrics fm( lv->font() ); | 411 | //QFontMetrics fm( lv->font() ); |
416 | //int d = fm.height(); | 412 | //int d = fm.height(); |
417 | int x = 0; | 413 | int x = 0; |
418 | int y = (height() - BoxSize) / 2; | 414 | int y = (height() - BoxSize) / 2; |
419 | //p->setPen( QPen( _cg.text(), winStyle ? 2 : 1 ) ); | 415 | //p->setPen( QPen( _cg.text(), winStyle ? 2 : 1 ) ); |
420 | if ( myType == CheckBox ) { | 416 | if ( myType == CheckBox ) { |
421 | if ( isEnabled() ) | 417 | if ( isEnabled() ) |
422 | p->setPen( QPen( _cg.text(), 1 ) ); | 418 | p->setPen( QPen( _cg.text(), 1 ) ); |
423 | else | 419 | else |
424 | p->setPen( QPen( listView()->palette().color( QPalette::Disabled, QColorGroup::Text ), 1 ) ); | 420 | p->setPen( QPen( listView()->palette().color( QPalette::Disabled, QColorGroup::Text ), 1 ) ); |
425 | p->drawRect( x+marg, y+2, BoxSize-4, BoxSize-4 ); | 421 | p->drawRect( x+marg, y+2, BoxSize-4, BoxSize-4 ); |
426 | lineStart = x+marg; | 422 | lineStart = x+marg; |
427 | ///////////////////// | 423 | ///////////////////// |
428 | x++; | 424 | x++; |
429 | y++; | 425 | y++; |
430 | if ( isOn() ) { | 426 | if ( isOn() ) { |
431 | QPointArray a( 7*2 ); | 427 | QPointArray a( 7*2 ); |
432 | int i, xx, yy; | 428 | int i, xx, yy; |
433 | xx = x+xOffset+marg+(boxOffset/2); | 429 | xx = x+xOffset+marg+(boxOffset/2); |
434 | yy = y+5+boxOffset; | 430 | yy = y+5+boxOffset; |
435 | for ( i=0; i<3; i++ ) { | 431 | for ( i=0; i<3; i++ ) { |
436 | a.setPoint( 2*i, xx, yy ); | 432 | a.setPoint( 2*i, xx, yy ); |
437 | a.setPoint( 2*i+1, xx, yy+2 ); | 433 | a.setPoint( 2*i+1, xx, yy+2 ); |
438 | // qDebug(" "); | 434 | // qDebug(" "); |
439 | xx++; yy++; | 435 | xx++; yy++; |
440 | } | 436 | } |
441 | yy -= 2; | 437 | yy -= 2; |
442 | for ( i=3; i<7; i++ ) { | 438 | for ( i=3; i<7; i++ ) { |
443 | a.setPoint( 2*i, xx, yy ); | 439 | a.setPoint( 2*i, xx, yy ); |
444 | a.setPoint( 2*i+1, xx, yy+2 ); | 440 | a.setPoint( 2*i+1, xx, yy+2 ); |
445 | xx++; yy--; | 441 | xx++; yy--; |
446 | } | 442 | } |
447 | p->setPen( darkGreen ); | 443 | p->setPen( darkGreen ); |
448 | p->drawLineSegments( a ); | 444 | p->drawLineSegments( a ); |
449 | } | 445 | } |
450 | //////////////////////// | 446 | //////////////////////// |
451 | } | 447 | } |
452 | r += BoxSize + 4; | 448 | r += BoxSize + 4; |
453 | } | 449 | } |
454 | 450 | ||
455 | p->translate( r, 0 ); | 451 | p->translate( r, 0 ); |
456 | p->setPen( QPen( _cg.text() ) ); | 452 | p->setPen( QPen( _cg.text() ) ); |
457 | QListViewItem::paintCell( p, _cg, column, width - r, align ); | 453 | QListViewItem::paintCell( p, _cg, column, width - r, align ); |
458 | if ( mTodo->cancelled () ) { | 454 | if ( mTodo->cancelled () ) { |
459 | p->setPen( black ); | 455 | p->setPen( black ); |
460 | QRect br = p->boundingRect( 1,1,1,1,0,mTodo->summary() ); | 456 | QRect br = p->boundingRect( 1,1,1,1,0,mTodo->summary() ); |
461 | int wid = br.width() +lineStart; | 457 | int wid = br.width() +lineStart; |
462 | if ( wid > width-3 ) | 458 | if ( wid > width-3 ) |
463 | wid = width-3; | 459 | wid = width-3; |
464 | p->drawLine( lineStart, height()/2+1, wid, height()/2+1 ); | 460 | p->drawLine( lineStart, height()/2+1, wid, height()/2+1 ); |
465 | 461 | ||
466 | } | 462 | } |
467 | 463 | ||
468 | } | 464 | } |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index a2c20a8..5bc8c00 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1,1942 +1,1951 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | 2 | ||
3 | #include <qaction.h> | 3 | #include <qaction.h> |
4 | #include <qpopupmenu.h> | 4 | #include <qpopupmenu.h> |
5 | #include <qpainter.h> | 5 | #include <qpainter.h> |
6 | #include <qwhatsthis.h> | 6 | #include <qwhatsthis.h> |
7 | #include <qpushbutton.h> | 7 | #include <qpushbutton.h> |
8 | #include <qmessagebox.h> | 8 | #include <qmessagebox.h> |
9 | #include <qlineedit.h> | 9 | #include <qlineedit.h> |
10 | #include <qtextcodec.h> | 10 | #include <qtextcodec.h> |
11 | #include <qfile.h> | 11 | #include <qfile.h> |
12 | #include <qdir.h> | 12 | #include <qdir.h> |
13 | #include <qapp.h> | 13 | #include <qapp.h> |
14 | #include <qfileinfo.h> | 14 | #include <qfileinfo.h> |
15 | #include <qlabel.h> | 15 | #include <qlabel.h> |
16 | #include <qspinbox.h> | 16 | #include <qspinbox.h> |
17 | #include <qcheckbox.h> | 17 | #include <qcheckbox.h> |
18 | #include <qmap.h> | 18 | #include <qmap.h> |
19 | #include <qwmatrix.h> | 19 | #include <qwmatrix.h> |
20 | #include <qtextbrowser.h> | 20 | #include <qtextbrowser.h> |
21 | #include <qtextstream.h> | 21 | #include <qtextstream.h> |
22 | #ifndef DESKTOP_VERSION | 22 | #ifndef DESKTOP_VERSION |
23 | #include <qpe/global.h> | 23 | #include <qpe/global.h> |
24 | #include <qpe/qpemenubar.h> | 24 | #include <qpe/qpemenubar.h> |
25 | #include <qpe/qpetoolbar.h> | 25 | #include <qpe/qpetoolbar.h> |
26 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
27 | #include <qpe/qpeapplication.h> | 27 | #include <qpe/qpeapplication.h> |
28 | #include <qtopia/alarmserver.h> | 28 | #include <qtopia/alarmserver.h> |
29 | #include <qtopia/qcopenvelope_qws.h> | 29 | #include <qtopia/qcopenvelope_qws.h> |
30 | #include <unistd.h> // for sleep | 30 | #include <unistd.h> // for sleep |
31 | #else | 31 | #else |
32 | #include <qmenubar.h> | 32 | #include <qmenubar.h> |
33 | #include <qtoolbar.h> | 33 | #include <qtoolbar.h> |
34 | #include <qapplication.h> | 34 | #include <qapplication.h> |
35 | //#include <resource.h> | 35 | //#include <resource.h> |
36 | 36 | ||
37 | #endif | 37 | #endif |
38 | #include <libkcal/calendarlocal.h> | 38 | #include <libkcal/calendarlocal.h> |
39 | #include <libkcal/todo.h> | 39 | #include <libkcal/todo.h> |
40 | #include <libkcal/phoneformat.h> | 40 | #include <libkcal/phoneformat.h> |
41 | #include <libkdepim/ksyncprofile.h> | 41 | #include <libkdepim/ksyncprofile.h> |
42 | #include <libkdepim/phoneaccess.h> | 42 | #include <libkdepim/phoneaccess.h> |
43 | #include <libkcal/kincidenceformatter.h> | 43 | #include <libkcal/kincidenceformatter.h> |
44 | #include <libkdepim/kpimglobalprefs.h> | 44 | #include <libkdepim/kpimglobalprefs.h> |
45 | 45 | ||
46 | #include "calendarview.h" | 46 | #include "calendarview.h" |
47 | #include "koviewmanager.h" | 47 | #include "koviewmanager.h" |
48 | #include "datenavigator.h" | 48 | #include "datenavigator.h" |
49 | #include "koagendaview.h" | 49 | #include "koagendaview.h" |
50 | #include "koagenda.h" | 50 | #include "koagenda.h" |
51 | #include "kodialogmanager.h" | 51 | #include "kodialogmanager.h" |
52 | #include "kdialogbase.h" | 52 | #include "kdialogbase.h" |
53 | #include "kapplication.h" | 53 | #include "kapplication.h" |
54 | #include "kofilterview.h" | 54 | #include "kofilterview.h" |
55 | #include "kstandarddirs.h" | 55 | #include "kstandarddirs.h" |
56 | #include "koprefs.h" | 56 | #include "koprefs.h" |
57 | #include "kfiledialog.h" | 57 | #include "kfiledialog.h" |
58 | #include "koglobals.h" | 58 | #include "koglobals.h" |
59 | #include "kglobal.h" | 59 | #include "kglobal.h" |
60 | #include "klocale.h" | 60 | #include "klocale.h" |
61 | #include "kconfig.h" | 61 | #include "kconfig.h" |
62 | #include "simplealarmclient.h" | 62 | #include "simplealarmclient.h" |
63 | #include "externalapphandler.h" | 63 | #include "externalapphandler.h" |
64 | 64 | ||
65 | using namespace KCal; | 65 | using namespace KCal; |
66 | #ifndef _WIN32_ | 66 | #ifndef _WIN32_ |
67 | #include <unistd.h> | 67 | #include <unistd.h> |
68 | #else | 68 | #else |
69 | #ifdef _OL_IMPORT_ | 69 | #ifdef _OL_IMPORT_ |
70 | #include "koimportoldialog.h" | 70 | #include "koimportoldialog.h" |
71 | #endif | 71 | #endif |
72 | #endif | 72 | #endif |
73 | #include "mainwindow.h" | 73 | #include "mainwindow.h" |
74 | 74 | ||
75 | class KOex2phonePrefs : public QDialog | 75 | class KOex2phonePrefs : public QDialog |
76 | { | 76 | { |
77 | public: | 77 | public: |
78 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | 78 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : |
79 | QDialog( parent, name, true ) | 79 | QDialog( parent, name, true ) |
80 | { | 80 | { |
81 | setCaption( i18n("Export to phone options") ); | 81 | setCaption( i18n("Export to phone options") ); |
82 | QVBoxLayout* lay = new QVBoxLayout( this ); | 82 | QVBoxLayout* lay = new QVBoxLayout( this ); |
83 | lay->setSpacing( 3 ); | 83 | lay->setSpacing( 3 ); |
84 | lay->setMargin( 3 ); | 84 | lay->setMargin( 3 ); |
85 | QLabel *lab; | 85 | QLabel *lab; |
86 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); | 86 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); |
87 | lab->setAlignment (AlignHCenter ); | 87 | lab->setAlignment (AlignHCenter ); |
88 | QHBox* temphb; | 88 | QHBox* temphb; |
89 | temphb = new QHBox( this ); | 89 | temphb = new QHBox( this ); |
90 | new QLabel( i18n("I/O device: "), temphb ); | 90 | new QLabel( i18n("I/O device: "), temphb ); |
91 | mPhoneDevice = new QLineEdit( temphb); | 91 | mPhoneDevice = new QLineEdit( temphb); |
92 | lay->addWidget( temphb ); | 92 | lay->addWidget( temphb ); |
93 | temphb = new QHBox( this ); | 93 | temphb = new QHBox( this ); |
94 | new QLabel( i18n("Connection: "), temphb ); | 94 | new QLabel( i18n("Connection: "), temphb ); |
95 | mPhoneConnection = new QLineEdit( temphb); | 95 | mPhoneConnection = new QLineEdit( temphb); |
96 | lay->addWidget( temphb ); | 96 | lay->addWidget( temphb ); |
97 | temphb = new QHBox( this ); | 97 | temphb = new QHBox( this ); |
98 | new QLabel( i18n("Model(opt.): "), temphb ); | 98 | new QLabel( i18n("Model(opt.): "), temphb ); |
99 | mPhoneModel = new QLineEdit( temphb); | 99 | mPhoneModel = new QLineEdit( temphb); |
100 | lay->addWidget( temphb ); | 100 | lay->addWidget( temphb ); |
101 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); | 101 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); |
102 | mWriteBackFuture->setChecked( true ); | 102 | mWriteBackFuture->setChecked( true ); |
103 | lay->addWidget( mWriteBackFuture ); | 103 | lay->addWidget( mWriteBackFuture ); |
104 | temphb = new QHBox( this ); | 104 | temphb = new QHBox( this ); |
105 | new QLabel( i18n("Max. weeks in future: ") , temphb ); | 105 | new QLabel( i18n("Max. weeks in future: ") , temphb ); |
106 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); | 106 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); |
107 | mWriteBackFutureWeeks->setValue( 8 ); | 107 | mWriteBackFutureWeeks->setValue( 8 ); |
108 | lay->addWidget( temphb ); | 108 | lay->addWidget( temphb ); |
109 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); | 109 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); |
110 | lab->setAlignment (AlignHCenter ); | 110 | lab->setAlignment (AlignHCenter ); |
111 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | 111 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); |
112 | lay->addWidget( ok ); | 112 | lay->addWidget( ok ); |
113 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 113 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
114 | lay->addWidget( cancel ); | 114 | lay->addWidget( cancel ); |
115 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 115 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
116 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 116 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
117 | resize( 220, 240 ); | 117 | resize( 220, 240 ); |
118 | qApp->processEvents(); | 118 | qApp->processEvents(); |
119 | int dw = QApplication::desktop()->width(); | 119 | int dw = QApplication::desktop()->width(); |
120 | int dh = QApplication::desktop()->height(); | 120 | int dh = QApplication::desktop()->height(); |
121 | move( (dw-width())/2, (dh - height() )/2 ); | 121 | move( (dw-width())/2, (dh - height() )/2 ); |
122 | } | 122 | } |
123 | 123 | ||
124 | public: | 124 | public: |
125 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 125 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
126 | QCheckBox* mWriteBackFuture; | 126 | QCheckBox* mWriteBackFuture; |
127 | QSpinBox* mWriteBackFutureWeeks; | 127 | QSpinBox* mWriteBackFutureWeeks; |
128 | }; | 128 | }; |
129 | 129 | ||
130 | int globalFlagBlockStartup; | 130 | int globalFlagBlockStartup; |
131 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | 131 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : |
132 | QMainWindow( parent, name ) | 132 | QMainWindow( parent, name ) |
133 | { | 133 | { |
134 | 134 | ||
135 | #ifdef DESKTOP_VERSION | 135 | #ifdef DESKTOP_VERSION |
136 | setFont( QFont("Arial"), 14 ); | 136 | setFont( QFont("Arial"), 14 ); |
137 | #endif | 137 | #endif |
138 | mClosed = false; | 138 | mClosed = false; |
139 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; | 139 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; |
140 | QString confFile = locateLocal("config","korganizerrc"); | 140 | QString confFile = locateLocal("config","korganizerrc"); |
141 | QFileInfo finf ( confFile ); | 141 | QFileInfo finf ( confFile ); |
142 | bool showWarning = !finf.exists(); | 142 | bool showWarning = !finf.exists(); |
143 | setIcon(SmallIcon( "ko24" ) ); | 143 | setIcon(SmallIcon( "ko24" ) ); |
144 | mBlockAtStartup = true; | 144 | mBlockAtStartup = true; |
145 | mFlagKeyPressed = false; | 145 | mFlagKeyPressed = false; |
146 | setCaption("KOrganizer/Pi"); | 146 | setCaption("KOrganizer/Pi"); |
147 | KOPrefs *p = KOPrefs::instance(); | 147 | KOPrefs *p = KOPrefs::instance(); |
148 | KPimGlobalPrefs::instance()->setGlobalConfig(); | 148 | KPimGlobalPrefs::instance()->setGlobalConfig(); |
149 | if ( p->mHourSize > 18 ) | 149 | if ( p->mHourSize > 18 ) |
150 | p->mHourSize = 18; | 150 | p->mHourSize = 18; |
151 | QMainWindow::ToolBarDock tbd; | 151 | QMainWindow::ToolBarDock tbd; |
152 | if ( p->mToolBarHor ) { | 152 | if ( p->mToolBarHor ) { |
153 | if ( p->mToolBarUp ) | 153 | if ( p->mToolBarUp ) |
154 | tbd = Bottom; | 154 | tbd = Bottom; |
155 | else | 155 | else |
156 | tbd = Top; | 156 | tbd = Top; |
157 | } | 157 | } |
158 | else { | 158 | else { |
159 | if ( p->mToolBarUp ) | 159 | if ( p->mToolBarUp ) |
160 | tbd = Right; | 160 | tbd = Right; |
161 | else | 161 | else |
162 | tbd = Left; | 162 | tbd = Left; |
163 | } | 163 | } |
164 | if ( KOPrefs::instance()->mUseAppColors ) | 164 | if ( KOPrefs::instance()->mUseAppColors ) |
165 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 165 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
166 | globalFlagBlockStartup = 1; | 166 | globalFlagBlockStartup = 1; |
167 | iconToolBar = new QPEToolBar( this ); | 167 | iconToolBar = new QPEToolBar( this ); |
168 | addToolBar (iconToolBar , tbd ); | 168 | addToolBar (iconToolBar , tbd ); |
169 | mCalendarModifiedFlag = false; | 169 | mCalendarModifiedFlag = false; |
170 | 170 | ||
171 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); | 171 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); |
172 | splash->setAlignment ( AlignCenter ); | 172 | splash->setAlignment ( AlignCenter ); |
173 | setCentralWidget( splash ); | 173 | setCentralWidget( splash ); |
174 | #ifndef DESKTOP_VERSION | 174 | #ifndef DESKTOP_VERSION |
175 | showMaximized(); | 175 | showMaximized(); |
176 | #endif | 176 | #endif |
177 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); | 177 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); |
178 | setDefaultPreferences(); | 178 | setDefaultPreferences(); |
179 | mCalendar = new CalendarLocal(); | 179 | mCalendar = new CalendarLocal(); |
180 | mView = new CalendarView( mCalendar, this,"mCalendar " ); | 180 | mView = new CalendarView( mCalendar, this,"mCalendar " ); |
181 | mView->hide(); | 181 | mView->hide(); |
182 | //mView->resize(splash->size() ); | 182 | //mView->resize(splash->size() ); |
183 | initActions(); | 183 | initActions(); |
184 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); | 184 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); |
185 | mSyncManager->setBlockSave(false); | 185 | mSyncManager->setBlockSave(false); |
186 | mView->setSyncManager(mSyncManager); | 186 | mView->setSyncManager(mSyncManager); |
187 | #ifndef DESKTOP_VERSION | 187 | #ifndef DESKTOP_VERSION |
188 | iconToolBar->show(); | 188 | iconToolBar->show(); |
189 | qApp->processEvents(); | 189 | qApp->processEvents(); |
190 | #endif | 190 | #endif |
191 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); | 191 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); |
192 | int vh = height() ; | 192 | int vh = height() ; |
193 | int vw = width(); | 193 | int vw = width(); |
194 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); | 194 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); |
195 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 195 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
196 | vh -= iconToolBar->height(); | 196 | vh -= iconToolBar->height(); |
197 | } else { | 197 | } else { |
198 | vw -= iconToolBar->height(); | 198 | vw -= iconToolBar->height(); |
199 | } | 199 | } |
200 | //mView->setMaximumSize( splash->size() ); | 200 | //mView->setMaximumSize( splash->size() ); |
201 | //mView->resize( splash->size() ); | 201 | //mView->resize( splash->size() ); |
202 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 202 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
203 | mView->readSettings(); | 203 | mView->readSettings(); |
204 | bool newFile = false; | 204 | bool newFile = false; |
205 | if( !QFile::exists( defaultFileName() ) ) { | 205 | if( !QFile::exists( defaultFileName() ) ) { |
206 | QFileInfo finfo ( defaultFileName() ); | 206 | QFileInfo finfo ( defaultFileName() ); |
207 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); | 207 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); |
208 | qDebug("oldfile %s ", oldFile.latin1()); | 208 | qDebug("oldfile %s ", oldFile.latin1()); |
209 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; | 209 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; |
210 | finfo.setFile( oldFile ); | 210 | finfo.setFile( oldFile ); |
211 | if (finfo.exists() ) { | 211 | if (finfo.exists() ) { |
212 | KMessageBox::information( this, message); | 212 | KMessageBox::information( this, message); |
213 | mView->openCalendar( oldFile ); | 213 | mView->openCalendar( oldFile ); |
214 | qApp->processEvents(); | 214 | qApp->processEvents(); |
215 | } else { | 215 | } else { |
216 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); | 216 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); |
217 | finfo.setFile( oldFile ); | 217 | finfo.setFile( oldFile ); |
218 | if (finfo.exists() ) { | 218 | if (finfo.exists() ) { |
219 | KMessageBox::information( this, message); | 219 | KMessageBox::information( this, message); |
220 | mView->openCalendar( oldFile ); | 220 | mView->openCalendar( oldFile ); |
221 | qApp->processEvents(); | 221 | qApp->processEvents(); |
222 | } | 222 | } |
223 | } | 223 | } |
224 | mView->saveCalendar( defaultFileName() ); | 224 | mView->saveCalendar( defaultFileName() ); |
225 | newFile = true; | 225 | newFile = true; |
226 | } | 226 | } |
227 | 227 | ||
228 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 228 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
229 | mView->openCalendar( defaultFileName() ); | 229 | mView->openCalendar( defaultFileName() ); |
230 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 230 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
231 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 231 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
232 | 232 | ||
233 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { | 233 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { |
234 | KOPrefs::instance()->setCategoryDefaults(); | 234 | KOPrefs::instance()->setCategoryDefaults(); |
235 | int count = mView->addCategories(); | 235 | int count = mView->addCategories(); |
236 | } | 236 | } |
237 | processIncidenceSelection( 0 ); | 237 | processIncidenceSelection( 0 ); |
238 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 238 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
239 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 239 | SLOT( processIncidenceSelection( Incidence * ) ) ); |
240 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | 240 | connect( mView, SIGNAL( modifiedChanged( bool ) ), |
241 | SLOT( slotModifiedChanged( bool ) ) ); | 241 | SLOT( slotModifiedChanged( bool ) ) ); |
242 | 242 | ||
243 | 243 | ||
244 | connect( mView, SIGNAL( tempDisableBR(bool) ), | 244 | connect( mView, SIGNAL( tempDisableBR(bool) ), |
245 | SLOT( disableBR(bool) ) ); | 245 | SLOT( disableBR(bool) ) ); |
246 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); | 246 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |
247 | mView->setModified( false ); | 247 | mView->setModified( false ); |
248 | mBlockAtStartup = false; | 248 | mBlockAtStartup = false; |
249 | mView->setModified( false ); | 249 | mView->setModified( false ); |
250 | setCentralWidget( mView ); | 250 | setCentralWidget( mView ); |
251 | globalFlagBlockStartup = 0; | 251 | globalFlagBlockStartup = 0; |
252 | mView->show(); | 252 | mView->show(); |
253 | delete splash; | 253 | delete splash; |
254 | if ( newFile ) | 254 | if ( newFile ) |
255 | mView->updateConfig(); | 255 | mView->updateConfig(); |
256 | // qApp->processEvents(); | 256 | // qApp->processEvents(); |
257 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 257 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
258 | //fillSyncMenu(); | 258 | //fillSyncMenu(); |
259 | 259 | ||
260 | 260 | ||
261 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); | 261 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); |
262 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); | 262 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); |
263 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); | 263 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); |
264 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 264 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
265 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 265 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
266 | mSyncManager->setDefaultFileName( defaultFileName()); | 266 | mSyncManager->setDefaultFileName( defaultFileName()); |
267 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); | 267 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); |
268 | mSyncManager->fillSyncMenu(); | 268 | mSyncManager->fillSyncMenu(); |
269 | 269 | ||
270 | 270 | ||
271 | 271 | ||
272 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 272 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
273 | if ( showWarning ) { | 273 | if ( showWarning ) { |
274 | KMessageBox::information( this, | 274 | KMessageBox::information( this, |
275 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); | 275 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); |
276 | qApp->processEvents(); | 276 | qApp->processEvents(); |
277 | mView->dialogManager()->showSyncOptions(); | 277 | mView->dialogManager()->showSyncOptions(); |
278 | } | 278 | } |
279 | 279 | ||
280 | //US listen for result adressed from Ka/Pi | 280 | //US listen for result adressed from Ka/Pi |
281 | #ifndef DESKTOP_VERSION | 281 | #ifndef DESKTOP_VERSION |
282 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 282 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
283 | #endif | 283 | #endif |
284 | #ifndef DESKTOP_VERSION | 284 | #ifndef DESKTOP_VERSION |
285 | infrared = 0; | 285 | infrared = 0; |
286 | #endif | 286 | #endif |
287 | 287 | ||
288 | mBRdisabled = false; | 288 | mBRdisabled = false; |
289 | //toggleBeamReceive(); | 289 | //toggleBeamReceive(); |
290 | } | 290 | } |
291 | MainWindow::~MainWindow() | 291 | MainWindow::~MainWindow() |
292 | { | 292 | { |
293 | //qDebug("MainWindow::~MainWindow() "); | 293 | //qDebug("MainWindow::~MainWindow() "); |
294 | //save toolbar location | 294 | //save toolbar location |
295 | delete mCalendar; | 295 | delete mCalendar; |
296 | delete mSyncManager; | 296 | delete mSyncManager; |
297 | #ifndef DESKTOP_VERSION | 297 | #ifndef DESKTOP_VERSION |
298 | if ( infrared ) | 298 | if ( infrared ) |
299 | delete infrared; | 299 | delete infrared; |
300 | #endif | 300 | #endif |
301 | 301 | ||
302 | 302 | ||
303 | } | 303 | } |
304 | 304 | ||
305 | void MainWindow::disableBR(bool b) | 305 | void MainWindow::disableBR(bool b) |
306 | { | 306 | { |
307 | #ifndef DESKTOP_VERSION | 307 | #ifndef DESKTOP_VERSION |
308 | if ( b ) { | 308 | if ( b ) { |
309 | if ( infrared ) { | 309 | if ( infrared ) { |
310 | toggleBeamReceive(); | 310 | toggleBeamReceive(); |
311 | mBRdisabled = true; | 311 | mBRdisabled = true; |
312 | } | 312 | } |
313 | mBRdisabled = true; | 313 | mBRdisabled = true; |
314 | } else { | 314 | } else { |
315 | if ( mBRdisabled ) { | 315 | if ( mBRdisabled ) { |
316 | mBRdisabled = false; | 316 | mBRdisabled = false; |
317 | //makes no sense,because other cal ap is probably running | 317 | //makes no sense,because other cal ap is probably running |
318 | // toggleBeamReceive(); | 318 | // toggleBeamReceive(); |
319 | } | 319 | } |
320 | } | 320 | } |
321 | #endif | 321 | #endif |
322 | 322 | ||
323 | } | 323 | } |
324 | bool MainWindow::beamReceiveEnabled() | 324 | bool MainWindow::beamReceiveEnabled() |
325 | { | 325 | { |
326 | #ifndef DESKTOP_VERSION | 326 | #ifndef DESKTOP_VERSION |
327 | return ( infrared != 0 ); | 327 | return ( infrared != 0 ); |
328 | #endif | 328 | #endif |
329 | return false; | 329 | return false; |
330 | } | 330 | } |
331 | 331 | ||
332 | void MainWindow::toggleBeamReceive() | 332 | void MainWindow::toggleBeamReceive() |
333 | { | 333 | { |
334 | if ( mBRdisabled ) | 334 | if ( mBRdisabled ) |
335 | return; | 335 | return; |
336 | #ifndef DESKTOP_VERSION | 336 | #ifndef DESKTOP_VERSION |
337 | if ( infrared ) { | 337 | if ( infrared ) { |
338 | qDebug("disable BeamReceive "); | 338 | qDebug("disable BeamReceive "); |
339 | delete infrared; | 339 | delete infrared; |
340 | infrared = 0; | 340 | infrared = 0; |
341 | brAction->setOn(false); | 341 | brAction->setOn(false); |
342 | return; | 342 | return; |
343 | } | 343 | } |
344 | qDebug("enable BeamReceive "); | 344 | qDebug("enable BeamReceive "); |
345 | brAction->setOn(true); | 345 | brAction->setOn(true); |
346 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; | 346 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; |
347 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); | 347 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); |
348 | #endif | 348 | #endif |
349 | } | 349 | } |
350 | void MainWindow::showMaximized () | 350 | void MainWindow::showMaximized () |
351 | { | 351 | { |
352 | #ifndef DESKTOP_VERSION | 352 | #ifndef DESKTOP_VERSION |
353 | if ( ! globalFlagBlockStartup ) | 353 | if ( ! globalFlagBlockStartup ) |
354 | if ( mClosed ) | 354 | if ( mClosed ) |
355 | mView->goToday(); | 355 | mView->goToday(); |
356 | #endif | 356 | #endif |
357 | QWidget::showMaximized () ; | 357 | QWidget::showMaximized () ; |
358 | mClosed = false; | 358 | mClosed = false; |
359 | } | 359 | } |
360 | void MainWindow::closeEvent( QCloseEvent* ce ) | 360 | void MainWindow::closeEvent( QCloseEvent* ce ) |
361 | { | 361 | { |
362 | 362 | ||
363 | 363 | ||
364 | 364 | ||
365 | if ( ! KOPrefs::instance()->mAskForQuit ) { | 365 | if ( ! KOPrefs::instance()->mAskForQuit ) { |
366 | saveOnClose(); | 366 | saveOnClose(); |
367 | mClosed = true; | 367 | mClosed = true; |
368 | ce->accept(); | 368 | ce->accept(); |
369 | return; | 369 | return; |
370 | 370 | ||
371 | } | 371 | } |
372 | 372 | ||
373 | switch( QMessageBox::information( this, "KO/Pi", | 373 | switch( QMessageBox::information( this, "KO/Pi", |
374 | i18n("Do you really want\nto close KO/Pi?"), | 374 | i18n("Do you really want\nto close KO/Pi?"), |
375 | i18n("Close"), i18n("No"), | 375 | i18n("Close"), i18n("No"), |
376 | 0, 0 ) ) { | 376 | 0, 0 ) ) { |
377 | case 0: | 377 | case 0: |
378 | saveOnClose(); | 378 | saveOnClose(); |
379 | mClosed = true; | 379 | mClosed = true; |
380 | ce->accept(); | 380 | ce->accept(); |
381 | break; | 381 | break; |
382 | case 1: | 382 | case 1: |
383 | ce->ignore(); | 383 | ce->ignore(); |
384 | break; | 384 | break; |
385 | case 2: | 385 | case 2: |
386 | 386 | ||
387 | default: | 387 | default: |
388 | break; | 388 | break; |
389 | } | 389 | } |
390 | 390 | ||
391 | 391 | ||
392 | } | 392 | } |
393 | 393 | ||
394 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) | 394 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) |
395 | { | 395 | { |
396 | QDataStream stream( data, IO_ReadOnly ); | 396 | QDataStream stream( data, IO_ReadOnly ); |
397 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); | 397 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); |
398 | //QString datamess; | 398 | //QString datamess; |
399 | //qDebug("message "); | 399 | //qDebug("message "); |
400 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); | 400 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); |
401 | 401 | ||
402 | if ( cmsg == "setDocument(QString)" ) { | 402 | if ( cmsg == "setDocument(QString)" ) { |
403 | QDataStream stream( data, IO_ReadOnly ); | 403 | QDataStream stream( data, IO_ReadOnly ); |
404 | QString fileName; | 404 | QString fileName; |
405 | stream >> fileName; | 405 | stream >> fileName; |
406 | //qDebug("filename %s ", fileName.latin1()); | 406 | //qDebug("filename %s ", fileName.latin1()); |
407 | showMaximized(); | 407 | showMaximized(); |
408 | raise(); | 408 | raise(); |
409 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; | 409 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; |
410 | mSyncManager->slotSyncMenu( 1002 ); | 410 | mSyncManager->slotSyncMenu( 1002 ); |
411 | return; | 411 | return; |
412 | } | 412 | } |
413 | 413 | ||
414 | if ( cmsg == "-writeFile" ) { | 414 | if ( cmsg == "-writeFile" ) { |
415 | // I made from the "-writeFile" an "-writeAlarm" | 415 | // I made from the "-writeFile" an "-writeAlarm" |
416 | mView->viewManager()->showWhatsNextView(); | 416 | mView->viewManager()->showWhatsNextView(); |
417 | mCalendar->checkAlarmForIncidence( 0, true); | 417 | mCalendar->checkAlarmForIncidence( 0, true); |
418 | showMaximized(); | 418 | showMaximized(); |
419 | raise(); | 419 | raise(); |
420 | return; | 420 | return; |
421 | 421 | ||
422 | } | 422 | } |
423 | if ( cmsg == "-writeFileSilent" ) { | 423 | if ( cmsg == "-writeFileSilent" ) { |
424 | // I made from the "-writeFile" an "-writeAlarm" | 424 | // I made from the "-writeFile" an "-writeAlarm" |
425 | // mView->viewManager()->showWhatsNextView(); | 425 | // mView->viewManager()->showWhatsNextView(); |
426 | mCalendar->checkAlarmForIncidence( 0, true); | 426 | mCalendar->checkAlarmForIncidence( 0, true); |
427 | //showMaximized(); | 427 | //showMaximized(); |
428 | //raise(); | 428 | //raise(); |
429 | hide(); | 429 | hide(); |
430 | return; | 430 | return; |
431 | } | 431 | } |
432 | if ( cmsg == "-newCountdown" ) { | 432 | if ( cmsg == "-newCountdown" ) { |
433 | qDebug("newCountdown "); | 433 | qDebug("newCountdown "); |
434 | 434 | ||
435 | } | 435 | } |
436 | QString msg ; | 436 | QString msg ; |
437 | QString allmsg = cmsg; | 437 | QString allmsg = cmsg; |
438 | while ( allmsg.length() > 0 ) { | 438 | while ( allmsg.length() > 0 ) { |
439 | int nextC = allmsg.find( "-", 1 ); | 439 | int nextC = allmsg.find( "-", 1 ); |
440 | if ( nextC == -1 ) { | 440 | if ( nextC == -1 ) { |
441 | msg = allmsg; | 441 | msg = allmsg; |
442 | allmsg = ""; | 442 | allmsg = ""; |
443 | } else{ | 443 | } else{ |
444 | msg = allmsg.left( nextC ); | 444 | msg = allmsg.left( nextC ); |
445 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); | 445 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); |
446 | } | 446 | } |
447 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); | 447 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); |
448 | if ( msg == "-newEvent" ) { | 448 | if ( msg == "-newEvent" ) { |
449 | mView->newEvent(); | 449 | mView->newEvent(); |
450 | } | 450 | } |
451 | if ( msg == "-newTodo" ) { | 451 | if ( msg == "-newTodo" ) { |
452 | mView->newTodo(); | 452 | mView->newTodo(); |
453 | 453 | ||
454 | } | 454 | } |
455 | if ( msg == "-showWN" ) { | 455 | if ( msg == "-showWN" ) { |
456 | mView->viewManager()->showWhatsNextView(); | 456 | mView->viewManager()->showWhatsNextView(); |
457 | } | 457 | } |
458 | if ( msg == "-showTodo" ) { | 458 | if ( msg == "-showTodo" ) { |
459 | mView->viewManager()->showTodoView(); | 459 | mView->viewManager()->showTodoView(); |
460 | } | 460 | } |
461 | if ( msg == "-showList" ) { | 461 | if ( msg == "-showList" ) { |
462 | mView->viewManager()->showListView(); | 462 | mView->viewManager()->showListView(); |
463 | } | 463 | } |
464 | else if ( msg == "-showDay" ) { | 464 | else if ( msg == "-showDay" ) { |
465 | mView->viewManager()->showDayView(); | 465 | mView->viewManager()->showDayView(); |
466 | } | 466 | } |
467 | else if ( msg == "-showWWeek" ) { | 467 | else if ( msg == "-showWWeek" ) { |
468 | mView->viewManager()->showWorkWeekView(); | 468 | mView->viewManager()->showWorkWeekView(); |
469 | } | 469 | } |
470 | else if ( msg == "-ringSync" ) { | 470 | else if ( msg == "-ringSync" ) { |
471 | mSyncManager->multiSync( false ); | 471 | mSyncManager->multiSync( false ); |
472 | } | 472 | } |
473 | else if ( msg == "-showWeek" ) { | 473 | else if ( msg == "-showWeek" ) { |
474 | mView->viewManager()->showWeekView(); | 474 | mView->viewManager()->showWeekView(); |
475 | } | 475 | } |
476 | else if ( msg == "-showTodo" ) { | 476 | else if ( msg == "-showTodo" ) { |
477 | mView->viewManager()->showTodoView(); | 477 | mView->viewManager()->showTodoView(); |
478 | } | 478 | } |
479 | else if ( msg == "-showJournal" ) { | 479 | else if ( msg == "-showJournal" ) { |
480 | mView->dateNavigator()->selectDates( 1 ); | 480 | mView->dateNavigator()->selectDates( 1 ); |
481 | mView->dateNavigator()->selectToday(); | 481 | mView->dateNavigator()->selectToday(); |
482 | mView->viewManager()->showJournalView(); | 482 | mView->viewManager()->showJournalView(); |
483 | } | 483 | } |
484 | else if ( msg == "-showKO" ) { | 484 | else if ( msg == "-showKO" ) { |
485 | mView->viewManager()->showNextXView(); | 485 | mView->viewManager()->showNextXView(); |
486 | } | 486 | } |
487 | else if ( msg == "-showWNext" || msg == "nextView()" ) { | 487 | else if ( msg == "-showWNext" || msg == "nextView()" ) { |
488 | mView->viewManager()->showWhatsNextView(); | 488 | mView->viewManager()->showWhatsNextView(); |
489 | } | 489 | } |
490 | else if ( msg == "-showNextXView" ) { | 490 | else if ( msg == "-showNextXView" ) { |
491 | mView->viewManager()->showNextXView(); | 491 | mView->viewManager()->showNextXView(); |
492 | } | 492 | } |
493 | 493 | ||
494 | 494 | ||
495 | } | 495 | } |
496 | 496 | ||
497 | showMaximized(); | 497 | showMaximized(); |
498 | raise(); | 498 | raise(); |
499 | } | 499 | } |
500 | 500 | ||
501 | QPixmap MainWindow::loadPixmap( QString name ) | 501 | QPixmap MainWindow::loadPixmap( QString name ) |
502 | { | 502 | { |
503 | return SmallIcon( name ); | 503 | return SmallIcon( name ); |
504 | 504 | ||
505 | } | 505 | } |
506 | void MainWindow::initActions() | 506 | void MainWindow::initActions() |
507 | { | 507 | { |
508 | //KOPrefs::instance()->mShowFullMenu | 508 | //KOPrefs::instance()->mShowFullMenu |
509 | iconToolBar->clear(); | 509 | iconToolBar->clear(); |
510 | KOPrefs *p = KOPrefs::instance(); | 510 | KOPrefs *p = KOPrefs::instance(); |
511 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); | 511 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); |
512 | 512 | ||
513 | QPopupMenu *viewMenu = new QPopupMenu( this ); | 513 | QPopupMenu *viewMenu = new QPopupMenu( this ); |
514 | QPopupMenu *actionMenu = new QPopupMenu( this ); | 514 | QPopupMenu *actionMenu = new QPopupMenu( this ); |
515 | QPopupMenu *importMenu = new QPopupMenu( this ); | 515 | QPopupMenu *importMenu = new QPopupMenu( this ); |
516 | selectFilterMenu = new QPopupMenu( this ); | 516 | selectFilterMenu = new QPopupMenu( this ); |
517 | selectFilterMenu->setCheckable( true ); | 517 | selectFilterMenu->setCheckable( true ); |
518 | syncMenu = new QPopupMenu( this ); | 518 | syncMenu = new QPopupMenu( this ); |
519 | configureAgendaMenu = new QPopupMenu( this ); | 519 | configureAgendaMenu = new QPopupMenu( this ); |
520 | configureToolBarMenu = new QPopupMenu( this ); | 520 | configureToolBarMenu = new QPopupMenu( this ); |
521 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 521 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
522 | if ( KOPrefs::instance()->mShowFullMenu ) { | 522 | if ( KOPrefs::instance()->mShowFullMenu ) { |
523 | QMenuBar *menuBar1; | 523 | QMenuBar *menuBar1; |
524 | menuBar1 = menuBar(); | 524 | menuBar1 = menuBar(); |
525 | menuBar1->insertItem( i18n("File"), importMenu ); | 525 | menuBar1->insertItem( i18n("File"), importMenu ); |
526 | menuBar1->insertItem( i18n("View"), viewMenu ); | 526 | menuBar1->insertItem( i18n("View"), viewMenu ); |
527 | menuBar1->insertItem( i18n("Actions"), actionMenu ); | 527 | menuBar1->insertItem( i18n("Actions"), actionMenu ); |
528 | #ifdef DESKTOP_VERSION | 528 | #ifdef DESKTOP_VERSION |
529 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); | 529 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); |
530 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 530 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
531 | #else | 531 | #else |
532 | menuBar1->insertItem( i18n("Sync"), syncMenu ); | 532 | menuBar1->insertItem( i18n("Sync"), syncMenu ); |
533 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); | 533 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); |
534 | #endif | 534 | #endif |
535 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 535 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
536 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); | 536 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); |
537 | menuBar1->insertItem( i18n("Help"), helpMenu ); | 537 | menuBar1->insertItem( i18n("Help"), helpMenu ); |
538 | } else { | 538 | } else { |
539 | QPEMenuBar *menuBar1; | 539 | QPEMenuBar *menuBar1; |
540 | menuBar1 = new QPEMenuBar( iconToolBar ); | 540 | menuBar1 = new QPEMenuBar( iconToolBar ); |
541 | QPopupMenu *menuBar = new QPopupMenu( this ); | 541 | QPopupMenu *menuBar = new QPopupMenu( this ); |
542 | menuBar1->insertItem( i18n("ME"), menuBar); | 542 | menuBar1->insertItem( i18n("ME"), menuBar); |
543 | menuBar->insertItem( i18n("File"), importMenu ); | 543 | menuBar->insertItem( i18n("File"), importMenu ); |
544 | menuBar->insertItem( i18n("View"), viewMenu ); | 544 | menuBar->insertItem( i18n("View"), viewMenu ); |
545 | menuBar->insertItem( i18n("Actions"), actionMenu ); | 545 | menuBar->insertItem( i18n("Actions"), actionMenu ); |
546 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); | 546 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); |
547 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 547 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
548 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 548 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
549 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); | 549 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); |
550 | menuBar->insertItem( i18n("Help"), helpMenu ); | 550 | menuBar->insertItem( i18n("Help"), helpMenu ); |
551 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); | 551 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); |
552 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); | 552 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); |
553 | } | 553 | } |
554 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 554 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
555 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); | 555 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); |
556 | 556 | ||
557 | // ****************** | 557 | // ****************** |
558 | QAction *action; | 558 | QAction *action; |
559 | QIconSet icon; | 559 | QIconSet icon; |
560 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); | 560 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); |
561 | configureToolBarMenu->setCheckable( true ); | 561 | configureToolBarMenu->setCheckable( true ); |
562 | 562 | ||
563 | QString pathString = ""; | 563 | QString pathString = ""; |
564 | if ( !p->mToolBarMiniIcons ) { | 564 | if ( !p->mToolBarMiniIcons ) { |
565 | if ( QApplication::desktop()->width() < 480 ) | 565 | if ( QApplication::desktop()->width() < 480 ) |
566 | pathString += "icons16/"; | 566 | pathString += "icons16/"; |
567 | } else | 567 | } else |
568 | pathString += "iconsmini/"; | 568 | pathString += "iconsmini/"; |
569 | configureAgendaMenu->setCheckable( true ); | 569 | configureAgendaMenu->setCheckable( true ); |
570 | int iii ; | 570 | int iii ; |
571 | for ( iii = 1;iii<= 10 ;++iii ){ | 571 | for ( iii = 1;iii<= 10 ;++iii ){ |
572 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); | 572 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); |
573 | } | 573 | } |
574 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); | 574 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); |
575 | 575 | ||
576 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), | 576 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), |
577 | this, SLOT( showConfigureAgenda( ) ) ); | 577 | this, SLOT( showConfigureAgenda( ) ) ); |
578 | 578 | ||
579 | icon = loadPixmap( pathString + "configure" ); | 579 | icon = loadPixmap( pathString + "configure" ); |
580 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); | 580 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); |
581 | action->addTo( actionMenu ); | 581 | action->addTo( actionMenu ); |
582 | connect( action, SIGNAL( activated() ), | 582 | connect( action, SIGNAL( activated() ), |
583 | mView, SLOT( edit_options() ) ); | 583 | mView, SLOT( edit_options() ) ); |
584 | actionMenu->insertSeparator(); | 584 | actionMenu->insertSeparator(); |
585 | 585 | ||
586 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); | 586 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); |
587 | action->addTo( actionMenu ); | 587 | action->addTo( actionMenu ); |
588 | connect( action, SIGNAL( activated() ), | 588 | connect( action, SIGNAL( activated() ), |
589 | mView, SLOT( undo_delete() ) ); | 589 | mView, SLOT( undo_delete() ) ); |
590 | actionMenu->insertSeparator(); | 590 | actionMenu->insertSeparator(); |
591 | 591 | ||
592 | icon = loadPixmap( pathString + "newevent" ); | 592 | icon = loadPixmap( pathString + "newevent" ); |
593 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); | 593 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); |
594 | configureToolBarMenu->insertSeparator(); | 594 | configureToolBarMenu->insertSeparator(); |
595 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); | 595 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); |
596 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); | 596 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); |
597 | ne_action->addTo( actionMenu ); | 597 | ne_action->addTo( actionMenu ); |
598 | connect( ne_action, SIGNAL( activated() ), | 598 | connect( ne_action, SIGNAL( activated() ), |
599 | mView, SLOT( newEvent() ) ); | 599 | mView, SLOT( newEvent() ) ); |
600 | icon = loadPixmap( pathString + "newtodo" ); | 600 | icon = loadPixmap( pathString + "newtodo" ); |
601 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); | 601 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); |
602 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); | 602 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); |
603 | nt_action->addTo( actionMenu ); | 603 | nt_action->addTo( actionMenu ); |
604 | connect( nt_action, SIGNAL( activated() ), | 604 | connect( nt_action, SIGNAL( activated() ), |
605 | mView, SLOT( newTodo() ) ); | 605 | mView, SLOT( newTodo() ) ); |
606 | 606 | ||
607 | icon = loadPixmap( pathString + "today" ); | 607 | icon = loadPixmap( pathString + "today" ); |
608 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); | 608 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); |
609 | today_action->addTo( viewMenu ); | 609 | today_action->addTo( viewMenu ); |
610 | connect( today_action, SIGNAL( activated() ), | 610 | connect( today_action, SIGNAL( activated() ), |
611 | mView, SLOT( goToday() ) ); | 611 | mView, SLOT( goToday() ) ); |
612 | viewMenu->insertSeparator(); | 612 | viewMenu->insertSeparator(); |
613 | 613 | ||
614 | icon = loadPixmap( pathString + "navi" ); | 614 | icon = loadPixmap( pathString + "navi" ); |
615 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); | 615 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); |
616 | action->addTo( viewMenu ); | 616 | action->addTo( viewMenu ); |
617 | connect( action, SIGNAL( activated() ), | 617 | connect( action, SIGNAL( activated() ), |
618 | mView, SLOT( toggleDateNavigatorWidget() ) ); | 618 | mView, SLOT( toggleDateNavigatorWidget() ) ); |
619 | mToggleNav = action ; | 619 | mToggleNav = action ; |
620 | icon = loadPixmap( pathString + "filter" ); | 620 | icon = loadPixmap( pathString + "filter" ); |
621 | action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); | 621 | action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); |
622 | action->addTo( viewMenu ); | 622 | action->addTo( viewMenu ); |
623 | connect( action, SIGNAL( activated() ), | 623 | connect( action, SIGNAL( activated() ), |
624 | mView, SLOT( toggleFilter() ) ); | 624 | mView, SLOT( toggleFilter() ) ); |
625 | mToggleFilter = action; | 625 | mToggleFilter = action; |
626 | icon = loadPixmap( pathString + "allday" ); | 626 | icon = loadPixmap( pathString + "allday" ); |
627 | action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); | 627 | action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); |
628 | action->addTo( viewMenu ); | 628 | action->addTo( viewMenu ); |
629 | connect( action, SIGNAL( activated() ), | 629 | connect( action, SIGNAL( activated() ), |
630 | mView, SLOT( toggleAllDaySize() ) ); | 630 | mView, SLOT( toggleAllDaySize() ) ); |
631 | mToggleAllday = action; | 631 | mToggleAllday = action; |
632 | 632 | ||
633 | 633 | ||
634 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), | 634 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), |
635 | mToggleNav, SLOT( setEnabled ( bool ) ) ); | 635 | mToggleNav, SLOT( setEnabled ( bool ) ) ); |
636 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), | 636 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), |
637 | mToggleFilter, SLOT( setEnabled ( bool ) ) ); | 637 | mToggleFilter, SLOT( setEnabled ( bool ) ) ); |
638 | connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), | 638 | connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), |
639 | mToggleAllday, SLOT( setEnabled ( bool ) ) ); | 639 | mToggleAllday, SLOT( setEnabled ( bool ) ) ); |
640 | 640 | ||
641 | viewMenu->insertSeparator(); | 641 | viewMenu->insertSeparator(); |
642 | icon = loadPixmap( pathString + "picker" ); | 642 | icon = loadPixmap( pathString + "picker" ); |
643 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); | 643 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); |
644 | action->addTo( viewMenu ); | 644 | action->addTo( viewMenu ); |
645 | connect( action, SIGNAL( activated() ), | 645 | connect( action, SIGNAL( activated() ), |
646 | mView, SLOT( showDatePicker() ) ); | 646 | mView, SLOT( showDatePicker() ) ); |
647 | action->addTo( iconToolBar ); | 647 | action->addTo( iconToolBar ); |
648 | viewMenu->insertSeparator(); | 648 | viewMenu->insertSeparator(); |
649 | icon = loadPixmap( pathString + "list" ); | 649 | icon = loadPixmap( pathString + "list" ); |
650 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); | 650 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); |
651 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); | 651 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); |
652 | showlist_action->addTo( viewMenu ); | 652 | showlist_action->addTo( viewMenu ); |
653 | connect( showlist_action, SIGNAL( activated() ), | 653 | connect( showlist_action, SIGNAL( activated() ), |
654 | mView->viewManager(), SLOT( showListView() ) ); | 654 | mView->viewManager(), SLOT( showListView() ) ); |
655 | 655 | ||
656 | 656 | ||
657 | icon = loadPixmap( pathString + "day" ); | 657 | icon = loadPixmap( pathString + "day" ); |
658 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); | 658 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); |
659 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); | 659 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); |
660 | day1_action->addTo( viewMenu ); | 660 | day1_action->addTo( viewMenu ); |
661 | // action->addTo( toolBar ); | 661 | // action->addTo( toolBar ); |
662 | connect( day1_action, SIGNAL( activated() ), | 662 | connect( day1_action, SIGNAL( activated() ), |
663 | mView->viewManager(), SLOT( showDayView() ) ); | 663 | mView->viewManager(), SLOT( showDayView() ) ); |
664 | 664 | ||
665 | icon = loadPixmap( pathString + "workweek" ); | 665 | icon = loadPixmap( pathString + "workweek" ); |
666 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); | 666 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); |
667 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); | 667 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); |
668 | day5_action->addTo( viewMenu ); | 668 | day5_action->addTo( viewMenu ); |
669 | connect( day5_action, SIGNAL( activated() ), | 669 | connect( day5_action, SIGNAL( activated() ), |
670 | mView->viewManager(), SLOT( showWorkWeekView() ) ); | 670 | mView->viewManager(), SLOT( showWorkWeekView() ) ); |
671 | 671 | ||
672 | icon = loadPixmap( pathString + "week" ); | 672 | icon = loadPixmap( pathString + "week" ); |
673 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); | 673 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); |
674 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); | 674 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); |
675 | day7_action->addTo( viewMenu ); | 675 | day7_action->addTo( viewMenu ); |
676 | connect( day7_action, SIGNAL( activated() ), | 676 | connect( day7_action, SIGNAL( activated() ), |
677 | mView->viewManager(), SLOT( showWeekView() ) ); | 677 | mView->viewManager(), SLOT( showWeekView() ) ); |
678 | 678 | ||
679 | icon = loadPixmap( pathString + "month" ); | 679 | icon = loadPixmap( pathString + "month" ); |
680 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); | 680 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); |
681 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); | 681 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); |
682 | month_action->addTo( viewMenu ); | 682 | month_action->addTo( viewMenu ); |
683 | connect( month_action, SIGNAL( activated() ), | 683 | connect( month_action, SIGNAL( activated() ), |
684 | mView->viewManager(), SLOT( showMonthView() ) ); | 684 | mView->viewManager(), SLOT( showMonthView() ) ); |
685 | 685 | ||
686 | icon = loadPixmap( pathString + "todo" ); | 686 | icon = loadPixmap( pathString + "todo" ); |
687 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); | 687 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); |
688 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); | 688 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); |
689 | todoview_action->addTo( viewMenu ); | 689 | todoview_action->addTo( viewMenu ); |
690 | connect( todoview_action, SIGNAL( activated() ), | 690 | connect( todoview_action, SIGNAL( activated() ), |
691 | mView->viewManager(), SLOT( showTodoView() ) ); | 691 | mView->viewManager(), SLOT( showTodoView() ) ); |
692 | 692 | ||
693 | icon = loadPixmap( pathString + "journal" ); | 693 | icon = loadPixmap( pathString + "journal" ); |
694 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); | 694 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); |
695 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); | 695 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); |
696 | viewjournal_action->addTo( viewMenu ); | 696 | viewjournal_action->addTo( viewMenu ); |
697 | connect( viewjournal_action, SIGNAL( activated() ), | 697 | connect( viewjournal_action, SIGNAL( activated() ), |
698 | mView->viewManager(), SLOT( showJournalView() ) ); | 698 | mView->viewManager(), SLOT( showJournalView() ) ); |
699 | 699 | ||
700 | icon = loadPixmap( pathString + "xdays" ); | 700 | icon = loadPixmap( pathString + "xdays" ); |
701 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); | 701 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); |
702 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); | 702 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); |
703 | xdays_action->addTo( viewMenu ); | 703 | xdays_action->addTo( viewMenu ); |
704 | connect( xdays_action, SIGNAL( activated() ), | 704 | connect( xdays_action, SIGNAL( activated() ), |
705 | mView->viewManager(), SLOT( showNextXView() ) ); | 705 | mView->viewManager(), SLOT( showNextXView() ) ); |
706 | 706 | ||
707 | icon = loadPixmap( pathString + "whatsnext" ); | 707 | icon = loadPixmap( pathString + "whatsnext" ); |
708 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); | 708 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); |
709 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); | 709 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); |
710 | whatsnext_action->addTo( viewMenu ); | 710 | whatsnext_action->addTo( viewMenu ); |
711 | connect( whatsnext_action, SIGNAL( activated() ), | 711 | connect( whatsnext_action, SIGNAL( activated() ), |
712 | mView->viewManager(), SLOT( showWhatsNextView() ) ); | 712 | mView->viewManager(), SLOT( showWhatsNextView() ) ); |
713 | 713 | ||
714 | #if 0 | 714 | #if 0 |
715 | action = new QAction( "view_timespan", "Time Span", 0, this ); | 715 | action = new QAction( "view_timespan", "Time Span", 0, this ); |
716 | action->addTo( viewMenu ); | 716 | action->addTo( viewMenu ); |
717 | connect( action, SIGNAL( activated() ), | 717 | connect( action, SIGNAL( activated() ), |
718 | mView->viewManager(), SLOT( showTimeSpanView() ) ); | 718 | mView->viewManager(), SLOT( showTimeSpanView() ) ); |
719 | #endif | 719 | #endif |
720 | 720 | ||
721 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, | 721 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, |
722 | this ); | 722 | this ); |
723 | mNewSubTodoAction->addTo( actionMenu ); | 723 | mNewSubTodoAction->addTo( actionMenu ); |
724 | connect( mNewSubTodoAction, SIGNAL( activated() ), | 724 | connect( mNewSubTodoAction, SIGNAL( activated() ), |
725 | mView, SLOT( newSubTodo() ) ); | 725 | mView, SLOT( newSubTodo() ) ); |
726 | 726 | ||
727 | actionMenu->insertSeparator(); | 727 | actionMenu->insertSeparator(); |
728 | 728 | ||
729 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); | 729 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); |
730 | mShowAction->addTo( actionMenu ); | 730 | mShowAction->addTo( actionMenu ); |
731 | connect( mShowAction, SIGNAL( activated() ), | 731 | connect( mShowAction, SIGNAL( activated() ), |
732 | mView, SLOT( showIncidence() ) ); | 732 | mView, SLOT( showIncidence() ) ); |
733 | 733 | ||
734 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); | 734 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); |
735 | mEditAction->addTo( actionMenu ); | 735 | mEditAction->addTo( actionMenu ); |
736 | connect( mEditAction, SIGNAL( activated() ), | 736 | connect( mEditAction, SIGNAL( activated() ), |
737 | mView, SLOT( editIncidence() ) ); | 737 | mView, SLOT( editIncidence() ) ); |
738 | 738 | ||
739 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); | 739 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); |
740 | mDeleteAction->addTo( actionMenu ); | 740 | mDeleteAction->addTo( actionMenu ); |
741 | connect( mDeleteAction, SIGNAL( activated() ), | 741 | connect( mDeleteAction, SIGNAL( activated() ), |
742 | mView, SLOT( deleteIncidence() ) ); | 742 | mView, SLOT( deleteIncidence() ) ); |
743 | 743 | ||
744 | 744 | ||
745 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); | 745 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); |
746 | mCloneAction->addTo( actionMenu ); | 746 | mCloneAction->addTo( actionMenu ); |
747 | connect( mCloneAction, SIGNAL( activated() ), | 747 | connect( mCloneAction, SIGNAL( activated() ), |
748 | mView, SLOT( cloneIncidence() ) ); | 748 | mView, SLOT( cloneIncidence() ) ); |
749 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); | 749 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); |
750 | mMoveAction->addTo( actionMenu ); | 750 | mMoveAction->addTo( actionMenu ); |
751 | connect( mMoveAction, SIGNAL( activated() ), | 751 | connect( mMoveAction, SIGNAL( activated() ), |
752 | mView, SLOT( moveIncidence() ) ); | 752 | mView, SLOT( moveIncidence() ) ); |
753 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); | 753 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); |
754 | mBeamAction->addTo( actionMenu ); | 754 | mBeamAction->addTo( actionMenu ); |
755 | connect( mBeamAction, SIGNAL( activated() ), | 755 | connect( mBeamAction, SIGNAL( activated() ), |
756 | mView, SLOT( beamIncidence() ) ); | 756 | mView, SLOT( beamIncidence() ) ); |
757 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); | 757 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); |
758 | mCancelAction->addTo( actionMenu ); | 758 | mCancelAction->addTo( actionMenu ); |
759 | connect( mCancelAction, SIGNAL( activated() ), | 759 | connect( mCancelAction, SIGNAL( activated() ), |
760 | mView, SLOT( toggleCancelIncidence() ) ); | 760 | mView, SLOT( toggleCancelIncidence() ) ); |
761 | 761 | ||
762 | actionMenu->insertSeparator(); | 762 | actionMenu->insertSeparator(); |
763 | 763 | ||
764 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, | 764 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, |
765 | this ); | 765 | this ); |
766 | action->addTo( actionMenu ); | 766 | action->addTo( actionMenu ); |
767 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); | 767 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); |
768 | 768 | ||
769 | icon = loadPixmap( pathString + "search" ); | 769 | icon = loadPixmap( pathString + "search" ); |
770 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); | 770 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); |
771 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); | 771 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); |
772 | search_action->addTo( actionMenu ); | 772 | search_action->addTo( actionMenu ); |
773 | connect( search_action, SIGNAL( activated() ), | 773 | connect( search_action, SIGNAL( activated() ), |
774 | mView->dialogManager(), SLOT( showSearchDialog() ) ); | 774 | mView->dialogManager(), SLOT( showSearchDialog() ) ); |
775 | 775 | ||
776 | 776 | ||
777 | 777 | ||
778 | if ( KOPrefs::instance()->mShowFullMenu ) { | 778 | if ( KOPrefs::instance()->mShowFullMenu ) { |
779 | actionMenu->insertSeparator(); | 779 | actionMenu->insertSeparator(); |
780 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); | 780 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); |
781 | 781 | ||
782 | } | 782 | } |
783 | // actionMenu->insertSeparator(); | 783 | // actionMenu->insertSeparator(); |
784 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, | 784 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, |
785 | this ); | 785 | this ); |
786 | action->addTo( importMenu ); | 786 | action->addTo( importMenu ); |
787 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); | 787 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); |
788 | action = new QAction( "import_quick", i18n("Import last file"), 0, | 788 | action = new QAction( "import_quick", i18n("Import last file"), 0, |
789 | this ); | 789 | this ); |
790 | action->addTo( importMenu ); | 790 | action->addTo( importMenu ); |
791 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); | 791 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); |
792 | importMenu->insertSeparator(); | 792 | importMenu->insertSeparator(); |
793 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, | 793 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, |
794 | this ); | 794 | this ); |
795 | action->addTo( importMenu ); | 795 | action->addTo( importMenu ); |
796 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); | 796 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); |
797 | #ifndef DESKTOP_VERSION | 797 | #ifndef DESKTOP_VERSION |
798 | importMenu->insertSeparator(); | 798 | importMenu->insertSeparator(); |
799 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, | 799 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, |
800 | this ); | 800 | this ); |
801 | action->addTo( importMenu ); | 801 | action->addTo( importMenu ); |
802 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); | 802 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); |
803 | #else | 803 | #else |
804 | #ifdef _OL_IMPORT_ | 804 | #ifdef _OL_IMPORT_ |
805 | importMenu->insertSeparator(); | 805 | importMenu->insertSeparator(); |
806 | action = new QAction( "import_ol", i18n("Import from OL"), 0, | 806 | action = new QAction( "import_ol", i18n("Import from OL"), 0, |
807 | this ); | 807 | this ); |
808 | action->addTo( importMenu ); | 808 | action->addTo( importMenu ); |
809 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); | 809 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); |
810 | #endif | 810 | #endif |
811 | #endif | 811 | #endif |
812 | 812 | ||
813 | importMenu->insertSeparator(); | 813 | importMenu->insertSeparator(); |
814 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, | 814 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, |
815 | this ); | 815 | this ); |
816 | action->addTo( importMenu ); | 816 | action->addTo( importMenu ); |
817 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); | 817 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); |
818 | 818 | ||
819 | action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, | 819 | action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, |
820 | this ); | 820 | this ); |
821 | action->addTo( importMenu ); | 821 | action->addTo( importMenu ); |
822 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); | 822 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); |
823 | 823 | ||
824 | importMenu->insertSeparator(); | 824 | importMenu->insertSeparator(); |
825 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, | 825 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, |
826 | this ); | 826 | this ); |
827 | action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); | 827 | action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); |
828 | 828 | ||
829 | 829 | ||
830 | //LR | 830 | //LR |
831 | QPopupMenu *ex2phone = new QPopupMenu( this ); | 831 | QPopupMenu *ex2phone = new QPopupMenu( this ); |
832 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 832 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
833 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 833 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
834 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); | 834 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); |
835 | importMenu->insertItem( i18n("Export to phone"), ex2phone ); | 835 | importMenu->insertItem( i18n("Export to phone"), ex2phone ); |
836 | 836 | ||
837 | importMenu->insertSeparator(); | 837 | importMenu->insertSeparator(); |
838 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, | 838 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, |
839 | this ); | 839 | this ); |
840 | action->addTo( importMenu ); | 840 | action->addTo( importMenu ); |
841 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); | 841 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); |
842 | #ifndef DESKTOP_VERSION | 842 | #ifndef DESKTOP_VERSION |
843 | importMenu->insertSeparator(); | 843 | importMenu->insertSeparator(); |
844 | brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, | 844 | brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, |
845 | this ); | 845 | this ); |
846 | brAction->addTo( importMenu ); | 846 | brAction->addTo( importMenu ); |
847 | brAction->setToggleAction (true ) ; | 847 | brAction->setToggleAction (true ) ; |
848 | connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); | 848 | connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); |
849 | 849 | ||
850 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, | 850 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, |
851 | this ); | 851 | this ); |
852 | action->addTo( importMenu ); | 852 | action->addTo( importMenu ); |
853 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); | 853 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); |
854 | 854 | ||
855 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, | 855 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, |
856 | this ); | 856 | this ); |
857 | action->addTo( importMenu ); | 857 | action->addTo( importMenu ); |
858 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); | 858 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); |
859 | #else | 859 | #else |
860 | importMenu->insertSeparator(); | 860 | importMenu->insertSeparator(); |
861 | icon = loadPixmap( pathString + "print" ); | 861 | icon = loadPixmap( pathString + "print" ); |
862 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); | 862 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); |
863 | action->addTo( importMenu ); | 863 | action->addTo( importMenu ); |
864 | connect( action, SIGNAL( activated() ), | 864 | connect( action, SIGNAL( activated() ), |
865 | this, SLOT( printCal() ) ); | 865 | this, SLOT( printCal() ) ); |
866 | 866 | ||
867 | icon = loadPixmap( pathString + "print" ); | 867 | icon = loadPixmap( pathString + "print" ); |
868 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); | 868 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); |
869 | action->addTo( importMenu ); | 869 | action->addTo( importMenu ); |
870 | connect( action, SIGNAL( activated() ), | 870 | connect( action, SIGNAL( activated() ), |
871 | this, SLOT( printSel() ) ); | 871 | this, SLOT( printSel() ) ); |
872 | action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); | 872 | action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); |
873 | action->addTo( importMenu ); | 873 | action->addTo( importMenu ); |
874 | connect( action, SIGNAL( activated() ), | 874 | connect( action, SIGNAL( activated() ), |
875 | mView->viewManager(), SIGNAL( printWNV() ) ); | 875 | mView->viewManager(), SIGNAL( printWNV() ) ); |
876 | #endif | 876 | #endif |
877 | importMenu->insertSeparator(); | 877 | importMenu->insertSeparator(); |
878 | action = new QAction( "beam all", i18n("Save"), 0, | 878 | action = new QAction( "beam all", i18n("Save"), 0, |
879 | this ); | 879 | this ); |
880 | action->addTo( importMenu ); | 880 | action->addTo( importMenu ); |
881 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); | 881 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); |
882 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, | 882 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, |
883 | this ); | 883 | this ); |
884 | action->addTo( importMenu ); | 884 | action->addTo( importMenu ); |
885 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); | 885 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); |
886 | 886 | ||
887 | //menuBar->insertItem( "Configure",configureMenu ); | 887 | //menuBar->insertItem( "Configure",configureMenu ); |
888 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); | 888 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); |
889 | icon = loadPixmap( "korganizer/korganizer" ); | 889 | icon = loadPixmap( "korganizer/korganizer" ); |
890 | 890 | ||
891 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); | 891 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); |
892 | action->addTo( helpMenu ); | 892 | action->addTo( helpMenu ); |
893 | connect( action, SIGNAL( activated() ), | 893 | connect( action, SIGNAL( activated() ), |
894 | SLOT( whatsNew() ) ); | 894 | SLOT( whatsNew() ) ); |
895 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); | 895 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); |
896 | action->addTo( helpMenu ); | 896 | action->addTo( helpMenu ); |
897 | connect( action, SIGNAL( activated() ), | 897 | connect( action, SIGNAL( activated() ), |
898 | SLOT( features() ) ); | 898 | SLOT( features() ) ); |
899 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); | 899 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); |
900 | action->addTo( helpMenu ); | 900 | action->addTo( helpMenu ); |
901 | connect( action, SIGNAL( activated() ), | 901 | connect( action, SIGNAL( activated() ), |
902 | SLOT( keyBindings() ) ); | 902 | SLOT( keyBindings() ) ); |
903 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); | 903 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); |
904 | action->addTo( helpMenu ); | 904 | action->addTo( helpMenu ); |
905 | connect( action, SIGNAL( activated() ), | 905 | connect( action, SIGNAL( activated() ), |
906 | SLOT( synchowto() ) ); | 906 | SLOT( synchowto() ) ); |
907 | action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); | 907 | action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); |
908 | action->addTo( helpMenu ); | 908 | action->addTo( helpMenu ); |
909 | connect( action, SIGNAL( activated() ), | 909 | connect( action, SIGNAL( activated() ), |
910 | SLOT( kdesynchowto() ) ); | 910 | SLOT( kdesynchowto() ) ); |
911 | action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); | 911 | action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); |
912 | action->addTo( helpMenu ); | 912 | action->addTo( helpMenu ); |
913 | connect( action, SIGNAL( activated() ), | 913 | connect( action, SIGNAL( activated() ), |
914 | SLOT( multisynchowto() ) ); | 914 | SLOT( multisynchowto() ) ); |
915 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); | 915 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); |
916 | action->addTo( helpMenu ); | 916 | action->addTo( helpMenu ); |
917 | connect( action, SIGNAL( activated() ), | 917 | connect( action, SIGNAL( activated() ), |
918 | SLOT( aboutAutoSaving() ) ); | 918 | SLOT( aboutAutoSaving() ) ); |
919 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); | 919 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); |
920 | action->addTo( helpMenu ); | 920 | action->addTo( helpMenu ); |
921 | connect( action, SIGNAL( activated() ), | 921 | connect( action, SIGNAL( activated() ), |
922 | SLOT( aboutKnownBugs() ) ); | 922 | SLOT( aboutKnownBugs() ) ); |
923 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); | 923 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); |
924 | action->addTo( helpMenu ); | 924 | action->addTo( helpMenu ); |
925 | connect( action, SIGNAL( activated() ), | 925 | connect( action, SIGNAL( activated() ), |
926 | SLOT( usertrans() ) ); | 926 | SLOT( usertrans() ) ); |
927 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); | 927 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); |
928 | action->addTo( helpMenu ); | 928 | action->addTo( helpMenu ); |
929 | connect( action, SIGNAL( activated() ), | 929 | connect( action, SIGNAL( activated() ), |
930 | SLOT( faq() ) ); | 930 | SLOT( faq() ) ); |
931 | action = new QAction( "licence", i18n("Licence..."), 0, this ); | 931 | action = new QAction( "licence", i18n("Licence..."), 0, this ); |
932 | action->addTo( helpMenu ); | 932 | action->addTo( helpMenu ); |
933 | connect( action, SIGNAL( activated() ), | 933 | connect( action, SIGNAL( activated() ), |
934 | SLOT( licence() ) ); | 934 | SLOT( licence() ) ); |
935 | action = new QAction( "about", i18n("About..."), 0, this ); | 935 | action = new QAction( "about", i18n("About..."), 0, this ); |
936 | action->addTo( helpMenu ); | 936 | action->addTo( helpMenu ); |
937 | connect( action, SIGNAL( activated() ), | 937 | connect( action, SIGNAL( activated() ), |
938 | SLOT( about() ) ); | 938 | SLOT( about() ) ); |
939 | //menuBar->insertSeparator(); | 939 | //menuBar->insertSeparator(); |
940 | 940 | ||
941 | // ****************************************************** | 941 | // ****************************************************** |
942 | // menubar icons | 942 | // menubar icons |
943 | 943 | ||
944 | 944 | ||
945 | iconToolBar->setHorizontalStretchable (true ); | 945 | iconToolBar->setHorizontalStretchable (true ); |
946 | //menuBar->insertItem( iconToolBar ); | 946 | //menuBar->insertItem( iconToolBar ); |
947 | //xdays_action | 947 | //xdays_action |
948 | if (p-> mShowIconNewEvent) | 948 | if (p-> mShowIconNewEvent) |
949 | ne_action->addTo( iconToolBar ); | 949 | ne_action->addTo( iconToolBar ); |
950 | if (p->mShowIconNewTodo ) | 950 | if (p->mShowIconNewTodo ) |
951 | nt_action->addTo( iconToolBar ); | 951 | nt_action->addTo( iconToolBar ); |
952 | if (p-> mShowIconSearch) | 952 | if (p-> mShowIconSearch) |
953 | search_action->addTo( iconToolBar ); | 953 | search_action->addTo( iconToolBar ); |
954 | if (p-> mShowIconNext) | 954 | if (p-> mShowIconNext) |
955 | whatsnext_action->addTo( iconToolBar ); | 955 | whatsnext_action->addTo( iconToolBar ); |
956 | if (p-> mShowIconNextDays) | 956 | if (p-> mShowIconNextDays) |
957 | xdays_action->addTo( iconToolBar ); | 957 | xdays_action->addTo( iconToolBar ); |
958 | if (p-> mShowIconList) | 958 | if (p-> mShowIconList) |
959 | showlist_action->addTo( iconToolBar ); | 959 | showlist_action->addTo( iconToolBar ); |
960 | if (p-> mShowIconDay1) | 960 | if (p-> mShowIconDay1) |
961 | day1_action->addTo( iconToolBar ); | 961 | day1_action->addTo( iconToolBar ); |
962 | if (p-> mShowIconDay5) | 962 | if (p-> mShowIconDay5) |
963 | day5_action->addTo( iconToolBar ); | 963 | day5_action->addTo( iconToolBar ); |
964 | if (p-> mShowIconDay7) | 964 | if (p-> mShowIconDay7) |
965 | day7_action->addTo( iconToolBar ); | 965 | day7_action->addTo( iconToolBar ); |
966 | if (p-> mShowIconMonth) | 966 | if (p-> mShowIconMonth) |
967 | month_action->addTo( iconToolBar ); | 967 | month_action->addTo( iconToolBar ); |
968 | if (p-> mShowIconTodoview) | 968 | if (p-> mShowIconTodoview) |
969 | todoview_action->addTo( iconToolBar ); | 969 | todoview_action->addTo( iconToolBar ); |
970 | if (p-> mShowIconJournal) | 970 | if (p-> mShowIconJournal) |
971 | viewjournal_action->addTo( iconToolBar ); | 971 | viewjournal_action->addTo( iconToolBar ); |
972 | icon = loadPixmap( pathString + "2leftarrowB" ); | 972 | icon = loadPixmap( pathString + "2leftarrowB" ); |
973 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); | 973 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); |
974 | if (p-> mShowIconBackFast) { | 974 | if (p-> mShowIconBackFast) { |
975 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); | 975 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); |
976 | connect( action, SIGNAL( activated() ), | 976 | connect( action, SIGNAL( activated() ), |
977 | mView, SLOT( goPreviousMonth() ) ); | 977 | mView, SLOT( goPreviousMonth() ) ); |
978 | action->addTo( iconToolBar ); | 978 | action->addTo( iconToolBar ); |
979 | } | 979 | } |
980 | icon = loadPixmap( pathString + "1leftarrowB" ); | 980 | icon = loadPixmap( pathString + "1leftarrowB" ); |
981 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); | 981 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); |
982 | if (p-> mShowIconBack) { | 982 | if (p-> mShowIconBack) { |
983 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); | 983 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); |
984 | connect( action, SIGNAL( activated() ), | 984 | connect( action, SIGNAL( activated() ), |
985 | mView, SLOT( goPrevious() ) ); | 985 | mView, SLOT( goPrevious() ) ); |
986 | action->addTo( iconToolBar ); | 986 | action->addTo( iconToolBar ); |
987 | } | 987 | } |
988 | icon = loadPixmap( pathString + "today" ); | 988 | icon = loadPixmap( pathString + "today" ); |
989 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); | 989 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); |
990 | if (p-> mShowIconToday) | 990 | if (p-> mShowIconToday) |
991 | today_action->addTo( iconToolBar ); | 991 | today_action->addTo( iconToolBar ); |
992 | icon = loadPixmap( pathString + "1rightarrowB" ); | 992 | icon = loadPixmap( pathString + "1rightarrowB" ); |
993 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); | 993 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); |
994 | if (p-> mShowIconForward) { | 994 | if (p-> mShowIconForward) { |
995 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); | 995 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); |
996 | connect( action, SIGNAL( activated() ), | 996 | connect( action, SIGNAL( activated() ), |
997 | mView, SLOT( goNext() ) ); | 997 | mView, SLOT( goNext() ) ); |
998 | action->addTo( iconToolBar ); | 998 | action->addTo( iconToolBar ); |
999 | } | 999 | } |
1000 | icon = loadPixmap( pathString + "2rightarrowB" ); | 1000 | icon = loadPixmap( pathString + "2rightarrowB" ); |
1001 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); | 1001 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); |
1002 | if (p-> mShowIconForwardFast) { | 1002 | if (p-> mShowIconForwardFast) { |
1003 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); | 1003 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); |
1004 | connect( action, SIGNAL( activated() ), | 1004 | connect( action, SIGNAL( activated() ), |
1005 | mView, SLOT( goNextMonth() ) ); | 1005 | mView, SLOT( goNextMonth() ) ); |
1006 | action->addTo( iconToolBar ); | 1006 | action->addTo( iconToolBar ); |
1007 | } | 1007 | } |
1008 | 1008 | ||
1009 | 1009 | ||
1010 | configureToolBarMenu->insertItem(i18n("What's This?"), 300); | 1010 | configureToolBarMenu->insertItem(i18n("What's This?"), 300); |
1011 | 1011 | ||
1012 | if (p-> mShowIconNewEvent) | 1012 | if (p-> mShowIconNewEvent) |
1013 | configureToolBarMenu->setItemChecked( 10, true ); | 1013 | configureToolBarMenu->setItemChecked( 10, true ); |
1014 | if (p->mShowIconNewTodo ) | 1014 | if (p->mShowIconNewTodo ) |
1015 | configureToolBarMenu->setItemChecked( 20, true ); | 1015 | configureToolBarMenu->setItemChecked( 20, true ); |
1016 | if (p-> mShowIconSearch) | 1016 | if (p-> mShowIconSearch) |
1017 | configureToolBarMenu->setItemChecked( 120, true ); | 1017 | configureToolBarMenu->setItemChecked( 120, true ); |
1018 | if (p-> mShowIconList) | 1018 | if (p-> mShowIconList) |
1019 | configureToolBarMenu->setItemChecked( 30, true ); | 1019 | configureToolBarMenu->setItemChecked( 30, true ); |
1020 | if (p-> mShowIconDay1) | 1020 | if (p-> mShowIconDay1) |
1021 | configureToolBarMenu->setItemChecked( 40, true ); | 1021 | configureToolBarMenu->setItemChecked( 40, true ); |
1022 | if (p-> mShowIconDay5) | 1022 | if (p-> mShowIconDay5) |
1023 | configureToolBarMenu->setItemChecked( 50, true ); | 1023 | configureToolBarMenu->setItemChecked( 50, true ); |
1024 | if (p-> mShowIconDay7) | 1024 | if (p-> mShowIconDay7) |
1025 | configureToolBarMenu->setItemChecked( 60, true ); | 1025 | configureToolBarMenu->setItemChecked( 60, true ); |
1026 | if (p-> mShowIconMonth) | 1026 | if (p-> mShowIconMonth) |
1027 | configureToolBarMenu->setItemChecked( 70, true ); | 1027 | configureToolBarMenu->setItemChecked( 70, true ); |
1028 | if (p-> mShowIconTodoview) | 1028 | if (p-> mShowIconTodoview) |
1029 | configureToolBarMenu->setItemChecked( 80, true ); | 1029 | configureToolBarMenu->setItemChecked( 80, true ); |
1030 | if (p-> mShowIconBackFast) | 1030 | if (p-> mShowIconBackFast) |
1031 | configureToolBarMenu->setItemChecked( 200, true ); | 1031 | configureToolBarMenu->setItemChecked( 200, true ); |
1032 | if (p-> mShowIconBack) | 1032 | if (p-> mShowIconBack) |
1033 | configureToolBarMenu->setItemChecked( 210, true ); | 1033 | configureToolBarMenu->setItemChecked( 210, true ); |
1034 | if (p-> mShowIconToday) | 1034 | if (p-> mShowIconToday) |
1035 | configureToolBarMenu->setItemChecked( 130, true ); | 1035 | configureToolBarMenu->setItemChecked( 130, true ); |
1036 | if (p-> mShowIconForward) | 1036 | if (p-> mShowIconForward) |
1037 | configureToolBarMenu->setItemChecked( 220, true ); | 1037 | configureToolBarMenu->setItemChecked( 220, true ); |
1038 | if (p-> mShowIconForwardFast) | 1038 | if (p-> mShowIconForwardFast) |
1039 | configureToolBarMenu->setItemChecked( 230, true ); | 1039 | configureToolBarMenu->setItemChecked( 230, true ); |
1040 | if (p-> mShowIconNextDays) | 1040 | if (p-> mShowIconNextDays) |
1041 | configureToolBarMenu->setItemChecked( 100, true ); | 1041 | configureToolBarMenu->setItemChecked( 100, true ); |
1042 | if (p-> mShowIconNext) | 1042 | if (p-> mShowIconNext) |
1043 | configureToolBarMenu->setItemChecked( 110, true ); | 1043 | configureToolBarMenu->setItemChecked( 110, true ); |
1044 | if (p-> mShowIconJournal) | 1044 | if (p-> mShowIconJournal) |
1045 | configureToolBarMenu->setItemChecked( 90, true ); | 1045 | configureToolBarMenu->setItemChecked( 90, true ); |
1046 | if (p-> mShowIconWhatsThis) | 1046 | if (p-> mShowIconWhatsThis) |
1047 | configureToolBarMenu->setItemChecked( 300, true ); | 1047 | configureToolBarMenu->setItemChecked( 300, true ); |
1048 | 1048 | ||
1049 | QLabel* dummy = new QLabel( iconToolBar ); | 1049 | QLabel* dummy = new QLabel( iconToolBar ); |
1050 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); | 1050 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); |
1051 | if (!p-> mShowIconStretch) | 1051 | if (!p-> mShowIconStretch) |
1052 | iconToolBar->setStretchableWidget ( dummy ) ; | 1052 | iconToolBar->setStretchableWidget ( dummy ) ; |
1053 | else | 1053 | else |
1054 | configureToolBarMenu->setItemChecked( 5, true ); | 1054 | configureToolBarMenu->setItemChecked( 5, true ); |
1055 | if (p-> mShowIconWhatsThis) | 1055 | if (p-> mShowIconWhatsThis) |
1056 | QWhatsThis::whatsThisButton ( iconToolBar ); | 1056 | QWhatsThis::whatsThisButton ( iconToolBar ); |
1057 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); | 1057 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); |
1058 | configureAgenda( p->mHourSize ); | 1058 | configureAgenda( p->mHourSize ); |
1059 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); | 1059 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); |
1060 | } | 1060 | } |
1061 | 1061 | ||
1062 | void MainWindow::exportToPhone( int mode ) | 1062 | void MainWindow::exportToPhone( int mode ) |
1063 | { | 1063 | { |
1064 | 1064 | ||
1065 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 1065 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
1066 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 1066 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
1067 | KOex2phonePrefs ex2phone; | 1067 | KOex2phonePrefs ex2phone; |
1068 | 1068 | ||
1069 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); | 1069 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); |
1070 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); | 1070 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); |
1071 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1071 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1072 | if ( mode == 1 ) | 1072 | if ( mode == 1 ) |
1073 | ex2phone.setCaption(i18n("Export complete calendar")); | 1073 | ex2phone.setCaption(i18n("Export complete calendar")); |
1074 | if ( mode == 2 ) | 1074 | if ( mode == 2 ) |
1075 | ex2phone.setCaption(i18n("Export filtered calendar")); | 1075 | ex2phone.setCaption(i18n("Export filtered calendar")); |
1076 | 1076 | ||
1077 | if ( !ex2phone.exec() ) { | 1077 | if ( !ex2phone.exec() ) { |
1078 | return; | 1078 | return; |
1079 | } | 1079 | } |
1080 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); | 1080 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); |
1081 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); | 1081 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); |
1082 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); | 1082 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); |
1083 | 1083 | ||
1084 | int inFuture = 0; | 1084 | int inFuture = 0; |
1085 | if ( ex2phone.mWriteBackFuture->isChecked() ) | 1085 | if ( ex2phone.mWriteBackFuture->isChecked() ) |
1086 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); | 1086 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); |
1087 | QPtrList<Incidence> delSel; | 1087 | QPtrList<Incidence> delSel; |
1088 | if ( mode == 1 ) | 1088 | if ( mode == 1 ) |
1089 | delSel = mCalendar->rawIncidences(); | 1089 | delSel = mCalendar->rawIncidences(); |
1090 | if ( mode == 2 ) | 1090 | if ( mode == 2 ) |
1091 | delSel = mCalendar->incidences(); | 1091 | delSel = mCalendar->incidences(); |
1092 | CalendarLocal* cal = new CalendarLocal(); | 1092 | CalendarLocal* cal = new CalendarLocal(); |
1093 | cal->setLocalTime(); | 1093 | cal->setLocalTime(); |
1094 | Incidence *incidence = delSel.first(); | 1094 | Incidence *incidence = delSel.first(); |
1095 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); | 1095 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); |
1096 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); | 1096 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); |
1097 | while ( incidence ) { | 1097 | while ( incidence ) { |
1098 | if ( incidence->type() != "Journal" ) { | 1098 | if ( incidence->type() != "Journal" ) { |
1099 | bool add = true; | 1099 | bool add = true; |
1100 | if ( inFuture ) { | 1100 | if ( inFuture ) { |
1101 | QDateTime dt; | 1101 | QDateTime dt; |
1102 | if ( incidence->type() == "Todo" ) { | 1102 | if ( incidence->type() == "Todo" ) { |
1103 | Todo * t = (Todo*)incidence; | 1103 | Todo * t = (Todo*)incidence; |
1104 | if ( t->hasDueDate() ) | 1104 | if ( t->hasDueDate() ) |
1105 | dt = t->dtDue(); | 1105 | dt = t->dtDue(); |
1106 | else | 1106 | else |
1107 | dt = cur.addSecs( 62 ); | 1107 | dt = cur.addSecs( 62 ); |
1108 | } | 1108 | } |
1109 | else { | 1109 | else { |
1110 | bool ok; | 1110 | bool ok; |
1111 | dt = incidence->getNextOccurence( cur, &ok ); | 1111 | dt = incidence->getNextOccurence( cur, &ok ); |
1112 | if ( !ok ) | 1112 | if ( !ok ) |
1113 | dt = cur.addSecs( -62 ); | 1113 | dt = cur.addSecs( -62 ); |
1114 | } | 1114 | } |
1115 | if ( dt < cur || dt > end ) { | 1115 | if ( dt < cur || dt > end ) { |
1116 | add = false; | 1116 | add = false; |
1117 | } | 1117 | } |
1118 | } | 1118 | } |
1119 | if ( add ) { | 1119 | if ( add ) { |
1120 | Incidence *in = incidence->clone(); | 1120 | Incidence *in = incidence->clone(); |
1121 | cal->addIncidence( in ); | 1121 | cal->addIncidence( in ); |
1122 | } | 1122 | } |
1123 | } | 1123 | } |
1124 | incidence = delSel.next(); | 1124 | incidence = delSel.next(); |
1125 | } | 1125 | } |
1126 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, | 1126 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, |
1127 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, | 1127 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, |
1128 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1128 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1129 | 1129 | ||
1130 | setCaption( i18n("Writing to phone...")); | 1130 | setCaption( i18n("Writing to phone...")); |
1131 | if ( PhoneFormat::writeToPhone( cal ) ) | 1131 | if ( PhoneFormat::writeToPhone( cal ) ) |
1132 | setCaption( i18n("Export to phone successful!")); | 1132 | setCaption( i18n("Export to phone successful!")); |
1133 | else | 1133 | else |
1134 | setCaption( i18n("Error exporting to phone!")); | 1134 | setCaption( i18n("Error exporting to phone!")); |
1135 | delete cal; | 1135 | delete cal; |
1136 | } | 1136 | } |
1137 | 1137 | ||
1138 | 1138 | ||
1139 | void MainWindow::setDefaultPreferences() | 1139 | void MainWindow::setDefaultPreferences() |
1140 | { | 1140 | { |
1141 | KOPrefs *p = KOPrefs::instance(); | 1141 | KOPrefs *p = KOPrefs::instance(); |
1142 | 1142 | ||
1143 | p->mCompactDialogs = true; | 1143 | p->mCompactDialogs = true; |
1144 | p->mConfirm = true; | 1144 | p->mConfirm = true; |
1145 | // p->mEnableQuickTodo = false; | 1145 | // p->mEnableQuickTodo = false; |
1146 | 1146 | ||
1147 | } | 1147 | } |
1148 | 1148 | ||
1149 | QString MainWindow::resourcePath() | 1149 | QString MainWindow::resourcePath() |
1150 | { | 1150 | { |
1151 | return KGlobal::iconLoader()->iconPath(); | 1151 | return KGlobal::iconLoader()->iconPath(); |
1152 | } | 1152 | } |
1153 | 1153 | ||
1154 | void MainWindow::displayText( QString text ,QString cap ) | 1154 | void MainWindow::displayText( QString text ,QString cap ) |
1155 | { | 1155 | { |
1156 | QDialog dia( this, "name", true ); ; | 1156 | QDialog dia( this, "name", true ); ; |
1157 | dia.setCaption( cap ); | 1157 | dia.setCaption( cap ); |
1158 | QVBoxLayout* lay = new QVBoxLayout( &dia ); | 1158 | QVBoxLayout* lay = new QVBoxLayout( &dia ); |
1159 | lay->setSpacing( 3 ); | 1159 | lay->setSpacing( 3 ); |
1160 | lay->setMargin( 3 ); | 1160 | lay->setMargin( 3 ); |
1161 | QTextBrowser tb ( &dia ); | 1161 | QTextBrowser tb ( &dia ); |
1162 | lay->addWidget( &tb ); | 1162 | lay->addWidget( &tb ); |
1163 | tb.setText( text ); | 1163 | tb.setText( text ); |
1164 | #ifdef DESKTOP_VERSION | 1164 | #ifdef DESKTOP_VERSION |
1165 | dia.resize( 640, 480); | 1165 | dia.resize( 640, 480); |
1166 | #else | 1166 | #else |
1167 | dia.showMaximized(); | 1167 | dia.showMaximized(); |
1168 | #endif | 1168 | #endif |
1169 | dia.exec(); | 1169 | dia.exec(); |
1170 | } | 1170 | } |
1171 | 1171 | ||
1172 | void MainWindow::features() | 1172 | void MainWindow::features() |
1173 | { | 1173 | { |
1174 | 1174 | ||
1175 | KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); | 1175 | KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); |
1176 | } | 1176 | } |
1177 | 1177 | ||
1178 | void MainWindow::usertrans() | 1178 | void MainWindow::usertrans() |
1179 | { | 1179 | { |
1180 | 1180 | ||
1181 | KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); | 1181 | KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); |
1182 | } | 1182 | } |
1183 | 1183 | ||
1184 | void MainWindow::kdesynchowto() | 1184 | void MainWindow::kdesynchowto() |
1185 | { | 1185 | { |
1186 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); | 1186 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); |
1187 | } | 1187 | } |
1188 | void MainWindow::multisynchowto() | 1188 | void MainWindow::multisynchowto() |
1189 | { | 1189 | { |
1190 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); | 1190 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); |
1191 | } | 1191 | } |
1192 | void MainWindow::synchowto() | 1192 | void MainWindow::synchowto() |
1193 | { | 1193 | { |
1194 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); | 1194 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); |
1195 | } | 1195 | } |
1196 | void MainWindow::faq() | 1196 | void MainWindow::faq() |
1197 | { | 1197 | { |
1198 | KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); | 1198 | KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); |
1199 | 1199 | ||
1200 | } | 1200 | } |
1201 | void MainWindow::whatsNew() | 1201 | void MainWindow::whatsNew() |
1202 | { | 1202 | { |
1203 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); | 1203 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); |
1204 | 1204 | ||
1205 | } | 1205 | } |
1206 | void MainWindow::licence() | 1206 | void MainWindow::licence() |
1207 | { | 1207 | { |
1208 | KApplication::showLicence(); | 1208 | KApplication::showLicence(); |
1209 | 1209 | ||
1210 | } | 1210 | } |
1211 | void MainWindow::about() | 1211 | void MainWindow::about() |
1212 | { | 1212 | { |
1213 | QString version; | 1213 | QString version; |
1214 | #include <../version> | 1214 | #include <../version> |
1215 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), | 1215 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), |
1216 | i18n("KOrganizer/Platform-independent\n") + | 1216 | i18n("KOrganizer/Platform-independent\n") + |
1217 | "(KO/Pi) " + version + " - " + | 1217 | "(KO/Pi) " + version + " - " + |
1218 | 1218 | ||
1219 | #ifdef DESKTOP_VERSION | 1219 | #ifdef DESKTOP_VERSION |
1220 | i18n("Desktop Edition\n") + | 1220 | i18n("Desktop Edition\n") + |
1221 | #else | 1221 | #else |
1222 | i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + | 1222 | i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + |
1223 | #endif | 1223 | #endif |
1224 | i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") ); | 1224 | i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") ); |
1225 | } | 1225 | } |
1226 | void MainWindow::keyBindings() | 1226 | void MainWindow::keyBindings() |
1227 | { | 1227 | { |
1228 | QString cap = i18n("KO/Pi Keys + Colors"); | 1228 | QString cap = i18n("KO/Pi Keys + Colors"); |
1229 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + | 1229 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + |
1230 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ | 1230 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ |
1231 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + | 1231 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + |
1232 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ | 1232 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ |
1233 | i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ | 1233 | i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ |
1234 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ | 1234 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ |
1235 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ | 1235 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ |
1236 | i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ | 1236 | i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ |
1237 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ | 1237 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ |
1238 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ | 1238 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ |
1239 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ | 1239 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ |
1240 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ | 1240 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ |
1241 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ | 1241 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ |
1242 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ | 1242 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ |
1243 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ | 1243 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ |
1244 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ | 1244 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ |
1245 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ | 1245 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ |
1246 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ | 1246 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ |
1247 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ | 1247 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ |
1248 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ | 1248 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ |
1249 | i18n("<p><h3>In agenda view:</h3></p>\n") + | 1249 | i18n("<p><h3>In agenda view:</h3></p>\n") + |
1250 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ | 1250 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ |
1251 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ | 1251 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ |
1252 | i18n("<p><h3>In todo view:</h3></p>\n") + | 1252 | i18n("<p><h3>In todo view:</h3></p>\n") + |
1253 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ | 1253 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ |
1254 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ | 1254 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ |
1255 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ | 1255 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ |
1256 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ | 1256 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ |
1257 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1257 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1258 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ | 1258 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ |
1259 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ | 1259 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ |
1260 | i18n("<p><h3>In list view:</h3></p>\n") + | 1260 | i18n("<p><h3>In list view:</h3></p>\n") + |
1261 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1261 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1262 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ | 1262 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ |
1263 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ | 1263 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ |
1264 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ | 1264 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ |
1265 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ | 1265 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ |
1266 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ | 1266 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ |
1267 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + | 1267 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + |
1268 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ | 1268 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ |
1269 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ | 1269 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ |
1270 | i18n("<p><b>E</b>: Edit item</p>\n") + | 1270 | i18n("<p><b>E</b>: Edit item</p>\n") + |
1271 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + | 1271 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + |
1272 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + | 1272 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + |
1273 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ | 1273 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ |
1274 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ | 1274 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ |
1275 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ | 1275 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ |
1276 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ | 1276 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ |
1277 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ | 1277 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ |
1278 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + | 1278 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + |
1279 | i18n("<p><b>White</b>: Item readonly</p>\n"); | 1279 | i18n("<p><b>White</b>: Item readonly</p>\n"); |
1280 | displayText( text, cap); | 1280 | displayText( text, cap); |
1281 | } | 1281 | } |
1282 | void MainWindow::aboutAutoSaving() | 1282 | void MainWindow::aboutAutoSaving() |
1283 | { | 1283 | { |
1284 | QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); | 1284 | QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); |
1285 | 1285 | ||
1286 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); | 1286 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); |
1287 | 1287 | ||
1288 | } | 1288 | } |
1289 | void MainWindow::aboutKnownBugs() | 1289 | void MainWindow::aboutKnownBugs() |
1290 | { | 1290 | { |
1291 | QMessageBox* msg; | 1291 | QMessageBox* msg; |
1292 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), | 1292 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), |
1293 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ | 1293 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ |
1294 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ | 1294 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ |
1295 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + | 1295 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + |
1296 | i18n("\nor report them in the bugtracker on\n") + | 1296 | i18n("\nor report them in the bugtracker on\n") + |
1297 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), | 1297 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), |
1298 | QMessageBox::NoIcon, | 1298 | QMessageBox::NoIcon, |
1299 | QMessageBox::Ok, | 1299 | QMessageBox::Ok, |
1300 | QMessageBox::NoButton, | 1300 | QMessageBox::NoButton, |
1301 | QMessageBox::NoButton); | 1301 | QMessageBox::NoButton); |
1302 | msg->exec(); | 1302 | msg->exec(); |
1303 | delete msg; | 1303 | delete msg; |
1304 | 1304 | ||
1305 | } | 1305 | } |
1306 | 1306 | ||
1307 | QString MainWindow::defaultFileName() | 1307 | QString MainWindow::defaultFileName() |
1308 | { | 1308 | { |
1309 | return locateLocal( "data", "korganizer/mycalendar.ics" ); | 1309 | return locateLocal( "data", "korganizer/mycalendar.ics" ); |
1310 | } | 1310 | } |
1311 | QString MainWindow::syncFileName() | 1311 | QString MainWindow::syncFileName() |
1312 | { | 1312 | { |
1313 | #ifdef DESKTOP_VERSION | 1313 | #ifdef DESKTOP_VERSION |
1314 | return locateLocal( "tmp", "synccalendar.ics" ); | 1314 | return locateLocal( "tmp", "synccalendar.ics" ); |
1315 | #else | 1315 | #else |
1316 | return QString( "/tmp/synccalendar.ics" ); | 1316 | return QString( "/tmp/synccalendar.ics" ); |
1317 | #endif | 1317 | #endif |
1318 | } | 1318 | } |
1319 | 1319 | ||
1320 | void MainWindow::processIncidenceSelection( Incidence *incidence ) | 1320 | void MainWindow::processIncidenceSelection( Incidence *incidence ) |
1321 | { | 1321 | { |
1322 | if ( !incidence ) { | 1322 | if ( !incidence ) { |
1323 | enableIncidenceActions( false ); | 1323 | enableIncidenceActions( false ); |
1324 | 1324 | ||
1325 | mNewSubTodoAction->setEnabled( false ); | 1325 | mNewSubTodoAction->setEnabled( false ); |
1326 | setCaptionToDates(); | 1326 | setCaptionToDates(); |
1327 | return; | 1327 | return; |
1328 | 1328 | ||
1329 | } | 1329 | } |
1330 | 1330 | ||
1331 | //KGlobal::locale()->formatDateTime(nextA, true); | 1331 | //KGlobal::locale()->formatDateTime(nextA, true); |
1332 | QString startString = ""; | 1332 | QString startString = ""; |
1333 | if ( incidence->type() != "Todo" ) { | 1333 | if ( incidence->type() != "Todo" ) { |
1334 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { | 1334 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { |
1335 | if ( incidence->doesFloat() ) { | 1335 | if ( incidence->doesFloat() ) { |
1336 | startString += ": "+incidence->dtStartDateStr( true ); | 1336 | startString += ": "+incidence->dtStartDateStr( true ); |
1337 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); | 1337 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); |
1338 | 1338 | ||
1339 | } else { | 1339 | } else { |
1340 | startString = ": "+incidence->dtStartStr(true); | 1340 | startString = ": "+incidence->dtStartStr(true); |
1341 | startString += " --- "+((Event*)incidence)->dtEndStr(true); | 1341 | startString += " --- "+((Event*)incidence)->dtEndStr(true); |
1342 | 1342 | ||
1343 | } | 1343 | } |
1344 | 1344 | ||
1345 | } else { | 1345 | } else { |
1346 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) | 1346 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) |
1347 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ | 1347 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ |
1348 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); | 1348 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); |
1349 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); | 1349 | if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) { |
1350 | bool ok; | ||
1351 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); | ||
1352 | if ( ok ) { | ||
1353 | int years = noc.date().year() - incidence->dtStart().date().year(); | ||
1354 | startString += i18n(" (%1 y.)"). arg( years ); | ||
1355 | } | ||
1356 | } | ||
1357 | else | ||
1358 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); | ||
1350 | } | 1359 | } |
1351 | 1360 | ||
1352 | } | 1361 | } |
1353 | else | 1362 | else |
1354 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); | 1363 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); |
1355 | if ( !incidence->location().isEmpty() ) | 1364 | if ( !incidence->location().isEmpty() ) |
1356 | startString += " (" +incidence->location()+")"; | 1365 | startString += " (" +incidence->location()+")"; |
1357 | setCaption( incidence->summary()+startString); | 1366 | setCaption( incidence->summary()+startString); |
1358 | 1367 | ||
1359 | enableIncidenceActions( true ); | 1368 | enableIncidenceActions( true ); |
1360 | 1369 | ||
1361 | if ( incidence->type() == "Event" ) { | 1370 | if ( incidence->type() == "Event" ) { |
1362 | mShowAction->setText( i18n("Show Event...") ); | 1371 | mShowAction->setText( i18n("Show Event...") ); |
1363 | mEditAction->setText( i18n("Edit Event...") ); | 1372 | mEditAction->setText( i18n("Edit Event...") ); |
1364 | mDeleteAction->setText( i18n("Delete Event...") ); | 1373 | mDeleteAction->setText( i18n("Delete Event...") ); |
1365 | 1374 | ||
1366 | mNewSubTodoAction->setEnabled( false ); | 1375 | mNewSubTodoAction->setEnabled( false ); |
1367 | } else if ( incidence->type() == "Todo" ) { | 1376 | } else if ( incidence->type() == "Todo" ) { |
1368 | mShowAction->setText( i18n("Show Todo...") ); | 1377 | mShowAction->setText( i18n("Show Todo...") ); |
1369 | mEditAction->setText( i18n("Edit Todo...") ); | 1378 | mEditAction->setText( i18n("Edit Todo...") ); |
1370 | mDeleteAction->setText( i18n("Delete Todo...") ); | 1379 | mDeleteAction->setText( i18n("Delete Todo...") ); |
1371 | 1380 | ||
1372 | mNewSubTodoAction->setEnabled( true ); | 1381 | mNewSubTodoAction->setEnabled( true ); |
1373 | } else { | 1382 | } else { |
1374 | mShowAction->setText( i18n("Show...") ); | 1383 | mShowAction->setText( i18n("Show...") ); |
1375 | mShowAction->setText( i18n("Edit...") ); | 1384 | mShowAction->setText( i18n("Edit...") ); |
1376 | mShowAction->setText( i18n("Delete...") ); | 1385 | mShowAction->setText( i18n("Delete...") ); |
1377 | 1386 | ||
1378 | mNewSubTodoAction->setEnabled( false ); | 1387 | mNewSubTodoAction->setEnabled( false ); |
1379 | } | 1388 | } |
1380 | } | 1389 | } |
1381 | 1390 | ||
1382 | void MainWindow::enableIncidenceActions( bool enabled ) | 1391 | void MainWindow::enableIncidenceActions( bool enabled ) |
1383 | { | 1392 | { |
1384 | mShowAction->setEnabled( enabled ); | 1393 | mShowAction->setEnabled( enabled ); |
1385 | mEditAction->setEnabled( enabled ); | 1394 | mEditAction->setEnabled( enabled ); |
1386 | mDeleteAction->setEnabled( enabled ); | 1395 | mDeleteAction->setEnabled( enabled ); |
1387 | 1396 | ||
1388 | mCloneAction->setEnabled( enabled ); | 1397 | mCloneAction->setEnabled( enabled ); |
1389 | mMoveAction->setEnabled( enabled ); | 1398 | mMoveAction->setEnabled( enabled ); |
1390 | mBeamAction->setEnabled( enabled ); | 1399 | mBeamAction->setEnabled( enabled ); |
1391 | mCancelAction->setEnabled( enabled ); | 1400 | mCancelAction->setEnabled( enabled ); |
1392 | } | 1401 | } |
1393 | 1402 | ||
1394 | void MainWindow::importOL() | 1403 | void MainWindow::importOL() |
1395 | { | 1404 | { |
1396 | #ifdef _OL_IMPORT_ | 1405 | #ifdef _OL_IMPORT_ |
1397 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); | 1406 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); |
1398 | id->exec(); | 1407 | id->exec(); |
1399 | delete id; | 1408 | delete id; |
1400 | mView->updateView(); | 1409 | mView->updateView(); |
1401 | #endif | 1410 | #endif |
1402 | } | 1411 | } |
1403 | void MainWindow::importBday() | 1412 | void MainWindow::importBday() |
1404 | { | 1413 | { |
1405 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1414 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1406 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), | 1415 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), |
1407 | i18n("Import!"), i18n("Cancel"), 0, | 1416 | i18n("Import!"), i18n("Cancel"), 0, |
1408 | 0, 1 ); | 1417 | 0, 1 ); |
1409 | if ( result == 0 ) { | 1418 | if ( result == 0 ) { |
1410 | mView->importBday(); | 1419 | mView->importBday(); |
1411 | 1420 | ||
1412 | } | 1421 | } |
1413 | 1422 | ||
1414 | 1423 | ||
1415 | } | 1424 | } |
1416 | void MainWindow::importQtopia() | 1425 | void MainWindow::importQtopia() |
1417 | { | 1426 | { |
1418 | #ifndef DESKTOP_VERSION | 1427 | #ifndef DESKTOP_VERSION |
1419 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1428 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1420 | i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"), | 1429 | i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"), |
1421 | i18n("Import!"), i18n("Cancel"), 0, | 1430 | i18n("Import!"), i18n("Cancel"), 0, |
1422 | 0, 1 ); | 1431 | 0, 1 ); |
1423 | if ( result == 0 ) { | 1432 | if ( result == 0 ) { |
1424 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); | 1433 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); |
1425 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); | 1434 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); |
1426 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; | 1435 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; |
1427 | mView->importQtopia( categories, datebook, todolist ); | 1436 | mView->importQtopia( categories, datebook, todolist ); |
1428 | } | 1437 | } |
1429 | #else | 1438 | #else |
1430 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1439 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1431 | i18n("Not supported \non desktop!\n"), | 1440 | i18n("Not supported \non desktop!\n"), |
1432 | i18n("Ok"), i18n("Cancel"), 0, | 1441 | i18n("Ok"), i18n("Cancel"), 0, |
1433 | 0, 1 ); | 1442 | 0, 1 ); |
1434 | 1443 | ||
1435 | #endif | 1444 | #endif |
1436 | } | 1445 | } |
1437 | 1446 | ||
1438 | void MainWindow::saveOnClose() | 1447 | void MainWindow::saveOnClose() |
1439 | { | 1448 | { |
1440 | KOPrefs *p = KOPrefs::instance(); | 1449 | KOPrefs *p = KOPrefs::instance(); |
1441 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); | 1450 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); |
1442 | p->mToolBarUp = iconToolBar->x() > width()/2 || | 1451 | p->mToolBarUp = iconToolBar->x() > width()/2 || |
1443 | iconToolBar->y() > height()/2; | 1452 | iconToolBar->y() > height()/2; |
1444 | mView->writeSettings(); | 1453 | mView->writeSettings(); |
1445 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) | 1454 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) |
1446 | save(); | 1455 | save(); |
1447 | } | 1456 | } |
1448 | void MainWindow::slotModifiedChanged( bool changed ) | 1457 | void MainWindow::slotModifiedChanged( bool changed ) |
1449 | { | 1458 | { |
1450 | if ( mBlockAtStartup ) | 1459 | if ( mBlockAtStartup ) |
1451 | return; | 1460 | return; |
1452 | 1461 | ||
1453 | int msec; | 1462 | int msec; |
1454 | // we store the changes after 1 minute, | 1463 | // we store the changes after 1 minute, |
1455 | // and for safety reasons after 10 minutes again | 1464 | // and for safety reasons after 10 minutes again |
1456 | if ( !mSyncManager->blockSave() ) | 1465 | if ( !mSyncManager->blockSave() ) |
1457 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; | 1466 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; |
1458 | else | 1467 | else |
1459 | msec = 1000 * 600; | 1468 | msec = 1000 * 600; |
1460 | mSaveTimer.start( msec, true ); // 1 minute | 1469 | mSaveTimer.start( msec, true ); // 1 minute |
1461 | qDebug("KO: Saving File in %d secs!", msec/1000); | 1470 | qDebug("KO: Saving File in %d secs!", msec/1000); |
1462 | mCalendarModifiedFlag = true; | 1471 | mCalendarModifiedFlag = true; |
1463 | } | 1472 | } |
1464 | void MainWindow::saveStopTimer() | 1473 | void MainWindow::saveStopTimer() |
1465 | { | 1474 | { |
1466 | mSaveTimer.stop(); | 1475 | mSaveTimer.stop(); |
1467 | if (mSaveTimer.isActive() ) | 1476 | if (mSaveTimer.isActive() ) |
1468 | qDebug("ti active "); | 1477 | qDebug("ti active "); |
1469 | else | 1478 | else |
1470 | qDebug("KO: Save timer stopped"); | 1479 | qDebug("KO: Save timer stopped"); |
1471 | } | 1480 | } |
1472 | void MainWindow::save() | 1481 | void MainWindow::save() |
1473 | { | 1482 | { |
1474 | if ( !mCalendarModifiedFlag ) { | 1483 | if ( !mCalendarModifiedFlag ) { |
1475 | qDebug("KO: Calendar not modified. Nothing saved."); | 1484 | qDebug("KO: Calendar not modified. Nothing saved."); |
1476 | return; | 1485 | return; |
1477 | } | 1486 | } |
1478 | if ( mSyncManager->blockSave() ) | 1487 | if ( mSyncManager->blockSave() ) |
1479 | return; | 1488 | return; |
1480 | mSyncManager->setBlockSave(true); | 1489 | mSyncManager->setBlockSave(true); |
1481 | if ( mView->checkFileVersion( defaultFileName()) ) { | 1490 | if ( mView->checkFileVersion( defaultFileName()) ) { |
1482 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 1491 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
1483 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); | 1492 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); |
1484 | qDebug("KO: Start saving data to file!"); | 1493 | qDebug("KO: Start saving data to file!"); |
1485 | mView->saveCalendar( defaultFileName() ); | 1494 | mView->saveCalendar( defaultFileName() ); |
1486 | mCalendarModifiedFlag = false; | 1495 | mCalendarModifiedFlag = false; |
1487 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 1496 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
1488 | qDebug("KO: Needed %d ms for saving.",msNeeded ); | 1497 | qDebug("KO: Needed %d ms for saving.",msNeeded ); |
1489 | QString savemes; | 1498 | QString savemes; |
1490 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); | 1499 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); |
1491 | setCaption(savemes); | 1500 | setCaption(savemes); |
1492 | } else | 1501 | } else |
1493 | setCaption(i18n("Saving cancelled!")); | 1502 | setCaption(i18n("Saving cancelled!")); |
1494 | mSyncManager->setBlockSave( false ); | 1503 | mSyncManager->setBlockSave( false ); |
1495 | } | 1504 | } |
1496 | 1505 | ||
1497 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) | 1506 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) |
1498 | { | 1507 | { |
1499 | if ( !e->isAutoRepeat() ) { | 1508 | if ( !e->isAutoRepeat() ) { |
1500 | mFlagKeyPressed = false; | 1509 | mFlagKeyPressed = false; |
1501 | } | 1510 | } |
1502 | } | 1511 | } |
1503 | void MainWindow::keyPressEvent ( QKeyEvent * e ) | 1512 | void MainWindow::keyPressEvent ( QKeyEvent * e ) |
1504 | { | 1513 | { |
1505 | qApp->processEvents(); | 1514 | qApp->processEvents(); |
1506 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 1515 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
1507 | e->ignore(); | 1516 | e->ignore(); |
1508 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 1517 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
1509 | return; | 1518 | return; |
1510 | } | 1519 | } |
1511 | if (! e->isAutoRepeat() ) | 1520 | if (! e->isAutoRepeat() ) |
1512 | mFlagKeyPressed = true; | 1521 | mFlagKeyPressed = true; |
1513 | KOPrefs *p = KOPrefs::instance(); | 1522 | KOPrefs *p = KOPrefs::instance(); |
1514 | bool showSelectedDates = false; | 1523 | bool showSelectedDates = false; |
1515 | int size; | 1524 | int size; |
1516 | int pro = 0; | 1525 | int pro = 0; |
1517 | //qDebug("MainWindow::keyPressEvent "); | 1526 | //qDebug("MainWindow::keyPressEvent "); |
1518 | switch ( e->key() ) { | 1527 | switch ( e->key() ) { |
1519 | case Qt::Key_Right: | 1528 | case Qt::Key_Right: |
1520 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1529 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1521 | mView->goNextMonth(); | 1530 | mView->goNextMonth(); |
1522 | else | 1531 | else |
1523 | mView->goNext(); | 1532 | mView->goNext(); |
1524 | showSelectedDates = true; | 1533 | showSelectedDates = true; |
1525 | break; | 1534 | break; |
1526 | case Qt::Key_Left: | 1535 | case Qt::Key_Left: |
1527 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1536 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1528 | mView->goPreviousMonth(); | 1537 | mView->goPreviousMonth(); |
1529 | else | 1538 | else |
1530 | mView->goPrevious(); | 1539 | mView->goPrevious(); |
1531 | showSelectedDates = true; | 1540 | showSelectedDates = true; |
1532 | break; | 1541 | break; |
1533 | case Qt::Key_Down: | 1542 | case Qt::Key_Down: |
1534 | mView->viewManager()->agendaView()->scrollOneHourDown(); | 1543 | mView->viewManager()->agendaView()->scrollOneHourDown(); |
1535 | break; | 1544 | break; |
1536 | case Qt::Key_Up: | 1545 | case Qt::Key_Up: |
1537 | mView->viewManager()->agendaView()->scrollOneHourUp(); | 1546 | mView->viewManager()->agendaView()->scrollOneHourUp(); |
1538 | break; | 1547 | break; |
1539 | case Qt::Key_I: | 1548 | case Qt::Key_I: |
1540 | mView->showIncidence(); | 1549 | mView->showIncidence(); |
1541 | break; | 1550 | break; |
1542 | case Qt::Key_Delete: | 1551 | case Qt::Key_Delete: |
1543 | case Qt::Key_Backspace: | 1552 | case Qt::Key_Backspace: |
1544 | mView->deleteIncidence(); | 1553 | mView->deleteIncidence(); |
1545 | break; | 1554 | break; |
1546 | case Qt::Key_D: | 1555 | case Qt::Key_D: |
1547 | mView->viewManager()->showDayView(); | 1556 | mView->viewManager()->showDayView(); |
1548 | showSelectedDates = true; | 1557 | showSelectedDates = true; |
1549 | break; | 1558 | break; |
1550 | case Qt::Key_O: | 1559 | case Qt::Key_O: |
1551 | mView->toggleFilerEnabled( ); | 1560 | mView->toggleFilerEnabled( ); |
1552 | break; | 1561 | break; |
1553 | case Qt::Key_0: | 1562 | case Qt::Key_0: |
1554 | case Qt::Key_1: | 1563 | case Qt::Key_1: |
1555 | case Qt::Key_2: | 1564 | case Qt::Key_2: |
1556 | case Qt::Key_3: | 1565 | case Qt::Key_3: |
1557 | case Qt::Key_4: | 1566 | case Qt::Key_4: |
1558 | case Qt::Key_5: | 1567 | case Qt::Key_5: |
1559 | case Qt::Key_6: | 1568 | case Qt::Key_6: |
1560 | case Qt::Key_7: | 1569 | case Qt::Key_7: |
1561 | case Qt::Key_8: | 1570 | case Qt::Key_8: |
1562 | case Qt::Key_9: | 1571 | case Qt::Key_9: |
1563 | pro = e->key()-48; | 1572 | pro = e->key()-48; |
1564 | if ( pro == 0 ) | 1573 | if ( pro == 0 ) |
1565 | pro = 10; | 1574 | pro = 10; |
1566 | if ( e->state() == Qt::ControlButton) | 1575 | if ( e->state() == Qt::ControlButton) |
1567 | pro += 10; | 1576 | pro += 10; |
1568 | break; | 1577 | break; |
1569 | case Qt::Key_M: | 1578 | case Qt::Key_M: |
1570 | mView->viewManager()->showMonthView(); | 1579 | mView->viewManager()->showMonthView(); |
1571 | showSelectedDates = true; | 1580 | showSelectedDates = true; |
1572 | break; | 1581 | break; |
1573 | case Qt::Key_Insert: | 1582 | case Qt::Key_Insert: |
1574 | mView->newEvent(); | 1583 | mView->newEvent(); |
1575 | break; | 1584 | break; |
1576 | case Qt::Key_S : | 1585 | case Qt::Key_S : |
1577 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1586 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1578 | mView->newSubTodo(); | 1587 | mView->newSubTodo(); |
1579 | else | 1588 | else |
1580 | mView->dialogManager()->showSearchDialog(); | 1589 | mView->dialogManager()->showSearchDialog(); |
1581 | break; | 1590 | break; |
1582 | case Qt::Key_Y : | 1591 | case Qt::Key_Y : |
1583 | case Qt::Key_Z : | 1592 | case Qt::Key_Z : |
1584 | mView->viewManager()->showWorkWeekView(); | 1593 | mView->viewManager()->showWorkWeekView(); |
1585 | showSelectedDates = true; | 1594 | showSelectedDates = true; |
1586 | break; | 1595 | break; |
1587 | case Qt::Key_U : | 1596 | case Qt::Key_U : |
1588 | mView->viewManager()->showWeekView(); | 1597 | mView->viewManager()->showWeekView(); |
1589 | showSelectedDates = true; | 1598 | showSelectedDates = true; |
1590 | break; | 1599 | break; |
1591 | case Qt::Key_H : | 1600 | case Qt::Key_H : |
1592 | keyBindings(); | 1601 | keyBindings(); |
1593 | break; | 1602 | break; |
1594 | case Qt::Key_W: | 1603 | case Qt::Key_W: |
1595 | mView->viewManager()->showWhatsNextView(); | 1604 | mView->viewManager()->showWhatsNextView(); |
1596 | break; | 1605 | break; |
1597 | case Qt::Key_L: | 1606 | case Qt::Key_L: |
1598 | mView->viewManager()->showListView(); | 1607 | mView->viewManager()->showListView(); |
1599 | break; | 1608 | break; |
1600 | case Qt::Key_N: | 1609 | case Qt::Key_N: |
1601 | mView->viewManager()->showNextXView(); | 1610 | mView->viewManager()->showNextXView(); |
1602 | showSelectedDates = true; | 1611 | showSelectedDates = true; |
1603 | break; | 1612 | break; |
1604 | case Qt::Key_V: | 1613 | case Qt::Key_V: |
1605 | mView->viewManager()->showTodoView(); | 1614 | mView->viewManager()->showTodoView(); |
1606 | break; | 1615 | break; |
1607 | case Qt::Key_C: | 1616 | case Qt::Key_C: |
1608 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); | 1617 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); |
1609 | break; | 1618 | break; |
1610 | case Qt::Key_P: | 1619 | case Qt::Key_P: |
1611 | mView->showDatePicker( ); | 1620 | mView->showDatePicker( ); |
1612 | break; | 1621 | break; |
1613 | case Qt::Key_F: | 1622 | case Qt::Key_F: |
1614 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1623 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1615 | mView->editFilters(); | 1624 | mView->editFilters(); |
1616 | else | 1625 | else |
1617 | mView->toggleFilter(); | 1626 | mView->toggleFilter(); |
1618 | break; | 1627 | break; |
1619 | case Qt::Key_X: | 1628 | case Qt::Key_X: |
1620 | mView->toggleDateNavigatorWidget(); | 1629 | mView->toggleDateNavigatorWidget(); |
1621 | break; | 1630 | break; |
1622 | case Qt::Key_Space: | 1631 | case Qt::Key_Space: |
1623 | mView->toggleExpand(); | 1632 | mView->toggleExpand(); |
1624 | break; | 1633 | break; |
1625 | case Qt::Key_A: | 1634 | case Qt::Key_A: |
1626 | mView->toggleAllDaySize(); | 1635 | mView->toggleAllDaySize(); |
1627 | break; | 1636 | break; |
1628 | case Qt::Key_T: | 1637 | case Qt::Key_T: |
1629 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1638 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1630 | mView->newTodo(); | 1639 | mView->newTodo(); |
1631 | else { | 1640 | else { |
1632 | mView->goToday(); | 1641 | mView->goToday(); |
1633 | showSelectedDates = true; | 1642 | showSelectedDates = true; |
1634 | } | 1643 | } |
1635 | break; | 1644 | break; |
1636 | case Qt::Key_J: | 1645 | case Qt::Key_J: |
1637 | mView->viewManager()->showJournalView(); | 1646 | mView->viewManager()->showJournalView(); |
1638 | break; | 1647 | break; |
1639 | case Qt::Key_B: | 1648 | case Qt::Key_B: |
1640 | mView->editIncidenceDescription();; | 1649 | mView->editIncidenceDescription();; |
1641 | break; | 1650 | break; |
1642 | // case Qt::Key_Return: | 1651 | // case Qt::Key_Return: |
1643 | case Qt::Key_E: | 1652 | case Qt::Key_E: |
1644 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1653 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1645 | mView->newEvent(); | 1654 | mView->newEvent(); |
1646 | else | 1655 | else |
1647 | mView->editIncidence(); | 1656 | mView->editIncidence(); |
1648 | break; | 1657 | break; |
1649 | case Qt::Key_Plus: | 1658 | case Qt::Key_Plus: |
1650 | size = p->mHourSize +2; | 1659 | size = p->mHourSize +2; |
1651 | if ( size <= 18 ) | 1660 | if ( size <= 18 ) |
1652 | configureAgenda( size ); | 1661 | configureAgenda( size ); |
1653 | break; | 1662 | break; |
1654 | case Qt::Key_Minus: | 1663 | case Qt::Key_Minus: |
1655 | size = p->mHourSize - 2; | 1664 | size = p->mHourSize - 2; |
1656 | if ( size >= 4 ) | 1665 | if ( size >= 4 ) |
1657 | configureAgenda( size ); | 1666 | configureAgenda( size ); |
1658 | break; | 1667 | break; |
1659 | 1668 | ||
1660 | 1669 | ||
1661 | default: | 1670 | default: |
1662 | e->ignore(); | 1671 | e->ignore(); |
1663 | } | 1672 | } |
1664 | if ( pro > 0 ) { | 1673 | if ( pro > 0 ) { |
1665 | mView->selectFilter( pro-1 ); | 1674 | mView->selectFilter( pro-1 ); |
1666 | } | 1675 | } |
1667 | if ( showSelectedDates ) { | 1676 | if ( showSelectedDates ) { |
1668 | ;// setCaptionToDates(); | 1677 | ;// setCaptionToDates(); |
1669 | } | 1678 | } |
1670 | 1679 | ||
1671 | } | 1680 | } |
1672 | 1681 | ||
1673 | void MainWindow::fillFilterMenu() | 1682 | void MainWindow::fillFilterMenu() |
1674 | { | 1683 | { |
1675 | selectFilterMenu->clear(); | 1684 | selectFilterMenu->clear(); |
1676 | bool disable = false; | 1685 | bool disable = false; |
1677 | selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); | 1686 | selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); |
1678 | selectFilterMenu->insertSeparator(); | 1687 | selectFilterMenu->insertSeparator(); |
1679 | if ( mView->filterView()->filtersEnabled() ) { | 1688 | if ( mView->filterView()->filtersEnabled() ) { |
1680 | selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 ); | 1689 | selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 ); |
1681 | } | 1690 | } |
1682 | else { | 1691 | else { |
1683 | selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 ); | 1692 | selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 ); |
1684 | disable = true; | 1693 | disable = true; |
1685 | } | 1694 | } |
1686 | selectFilterMenu->insertSeparator(); | 1695 | selectFilterMenu->insertSeparator(); |
1687 | QPtrList<CalFilter> fili = mView->filters(); | 1696 | QPtrList<CalFilter> fili = mView->filters(); |
1688 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 1697 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
1689 | CalFilter *filter = fili.first(); | 1698 | CalFilter *filter = fili.first(); |
1690 | int iii = 2; | 1699 | int iii = 2; |
1691 | while(filter) { | 1700 | while(filter) { |
1692 | selectFilterMenu->insertItem( filter->name(), iii ); | 1701 | selectFilterMenu->insertItem( filter->name(), iii ); |
1693 | if ( filter == curfilter) | 1702 | if ( filter == curfilter) |
1694 | selectFilterMenu->setItemChecked( iii, true ); | 1703 | selectFilterMenu->setItemChecked( iii, true ); |
1695 | if ( disable ) | 1704 | if ( disable ) |
1696 | selectFilterMenu->setItemEnabled( iii, false ); | 1705 | selectFilterMenu->setItemEnabled( iii, false ); |
1697 | filter = fili.next(); | 1706 | filter = fili.next(); |
1698 | ++iii; | 1707 | ++iii; |
1699 | } | 1708 | } |
1700 | } | 1709 | } |
1701 | void MainWindow::selectFilter( int fil ) | 1710 | void MainWindow::selectFilter( int fil ) |
1702 | { | 1711 | { |
1703 | if ( fil == 0 ) { | 1712 | if ( fil == 0 ) { |
1704 | mView->editFilters( ); | 1713 | mView->editFilters( ); |
1705 | } else if ( fil == 1 ){ | 1714 | } else if ( fil == 1 ){ |
1706 | mView->toggleFilerEnabled( ); | 1715 | mView->toggleFilerEnabled( ); |
1707 | } else { | 1716 | } else { |
1708 | mView->selectFilter( fil-2 ); | 1717 | mView->selectFilter( fil-2 ); |
1709 | } | 1718 | } |
1710 | } | 1719 | } |
1711 | void MainWindow::configureToolBar( int item ) | 1720 | void MainWindow::configureToolBar( int item ) |
1712 | { | 1721 | { |
1713 | 1722 | ||
1714 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); | 1723 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); |
1715 | KOPrefs *p = KOPrefs::instance(); | 1724 | KOPrefs *p = KOPrefs::instance(); |
1716 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); | 1725 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); |
1717 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); | 1726 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); |
1718 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); | 1727 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); |
1719 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); | 1728 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); |
1720 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); | 1729 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); |
1721 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); | 1730 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); |
1722 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); | 1731 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); |
1723 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); | 1732 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); |
1724 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); | 1733 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); |
1725 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); | 1734 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); |
1726 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); | 1735 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); |
1727 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); | 1736 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); |
1728 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); | 1737 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); |
1729 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); | 1738 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); |
1730 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); | 1739 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); |
1731 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); | 1740 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); |
1732 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); | 1741 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); |
1733 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); | 1742 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); |
1734 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); | 1743 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); |
1735 | // initActions(); | 1744 | // initActions(); |
1736 | } | 1745 | } |
1737 | 1746 | ||
1738 | void MainWindow::setCaptionToDates() | 1747 | void MainWindow::setCaptionToDates() |
1739 | { | 1748 | { |
1740 | QString selDates; | 1749 | QString selDates; |
1741 | selDates = KGlobal::locale()->formatDate(mView->startDate(), true); | 1750 | selDates = KGlobal::locale()->formatDate(mView->startDate(), true); |
1742 | if (mView->startDate() < mView->endDate() ) | 1751 | if (mView->startDate() < mView->endDate() ) |
1743 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); | 1752 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); |
1744 | else { | 1753 | else { |
1745 | QString addString; | 1754 | QString addString; |
1746 | if ( mView->startDate() == QDateTime::currentDateTime().date() ) | 1755 | if ( mView->startDate() == QDateTime::currentDateTime().date() ) |
1747 | addString = i18n("Today"); | 1756 | addString = i18n("Today"); |
1748 | else if ( mView->startDate() == QDateTime::currentDateTime().date().addDays(1) ) | 1757 | else if ( mView->startDate() == QDateTime::currentDateTime().date().addDays(1) ) |
1749 | addString = i18n("Tomorrow"); | 1758 | addString = i18n("Tomorrow"); |
1750 | if ( !addString.isEmpty() ) | 1759 | if ( !addString.isEmpty() ) |
1751 | selDates = addString+", "+selDates ; | 1760 | selDates = addString+", "+selDates ; |
1752 | } | 1761 | } |
1753 | setCaption( i18n("Dates: ") + selDates ); | 1762 | setCaption( i18n("Dates: ") + selDates ); |
1754 | 1763 | ||
1755 | } | 1764 | } |
1756 | void MainWindow::showConfigureAgenda( ) | 1765 | void MainWindow::showConfigureAgenda( ) |
1757 | { | 1766 | { |
1758 | int iii; | 1767 | int iii; |
1759 | for ( iii = 1;iii<= 10 ;++iii ){ | 1768 | for ( iii = 1;iii<= 10 ;++iii ){ |
1760 | configureAgendaMenu->setItemChecked( (iii+1)*2, false ); | 1769 | configureAgendaMenu->setItemChecked( (iii+1)*2, false ); |
1761 | } | 1770 | } |
1762 | configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); | 1771 | configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); |
1763 | } | 1772 | } |
1764 | void MainWindow::configureAgenda( int item ) | 1773 | void MainWindow::configureAgenda( int item ) |
1765 | { | 1774 | { |
1766 | if ( KOPrefs::instance()->mHourSize == item ) | 1775 | if ( KOPrefs::instance()->mHourSize == item ) |
1767 | return; | 1776 | return; |
1768 | KOPrefs::instance()->mHourSize=item; | 1777 | KOPrefs::instance()->mHourSize=item; |
1769 | mView->viewManager()->agendaView()->updateConfig(); | 1778 | mView->viewManager()->agendaView()->updateConfig(); |
1770 | } | 1779 | } |
1771 | 1780 | ||
1772 | void MainWindow::saveCalendar() | 1781 | void MainWindow::saveCalendar() |
1773 | { | 1782 | { |
1774 | QString fn = KOPrefs::instance()->mLastSaveFile; | 1783 | QString fn = KOPrefs::instance()->mLastSaveFile; |
1775 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); | 1784 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); |
1776 | 1785 | ||
1777 | if ( fn == "" ) | 1786 | if ( fn == "" ) |
1778 | return; | 1787 | return; |
1779 | QFileInfo info; | 1788 | QFileInfo info; |
1780 | info.setFile( fn ); | 1789 | info.setFile( fn ); |
1781 | QString mes; | 1790 | QString mes; |
1782 | bool createbup = true; | 1791 | bool createbup = true; |
1783 | if ( info. exists() ) { | 1792 | if ( info. exists() ) { |
1784 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; | 1793 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; |
1785 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 1794 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
1786 | i18n("Overwrite!"), i18n("Cancel"), 0, | 1795 | i18n("Overwrite!"), i18n("Cancel"), 0, |
1787 | 0, 1 ); | 1796 | 0, 1 ); |
1788 | if ( result != 0 ) { | 1797 | if ( result != 0 ) { |
1789 | createbup = false; | 1798 | createbup = false; |
1790 | } | 1799 | } |
1791 | } | 1800 | } |
1792 | if ( createbup ) { | 1801 | if ( createbup ) { |
1793 | mView->saveCalendar( fn ); | 1802 | mView->saveCalendar( fn ); |
1794 | mes = i18n("KO/Pi:Saved %1").arg(fn); | 1803 | mes = i18n("KO/Pi:Saved %1").arg(fn); |
1795 | KOPrefs::instance()->mLastSaveFile = fn; | 1804 | KOPrefs::instance()->mLastSaveFile = fn; |
1796 | setCaption(mes); | 1805 | setCaption(mes); |
1797 | } | 1806 | } |
1798 | } | 1807 | } |
1799 | void MainWindow::loadCalendar() | 1808 | void MainWindow::loadCalendar() |
1800 | { | 1809 | { |
1801 | 1810 | ||
1802 | QString fn = KOPrefs::instance()->mLastLoadFile; | 1811 | QString fn = KOPrefs::instance()->mLastLoadFile; |
1803 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); | 1812 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); |
1804 | 1813 | ||
1805 | if ( fn == "" ) | 1814 | if ( fn == "" ) |
1806 | return; | 1815 | return; |
1807 | QFileInfo info; | 1816 | QFileInfo info; |
1808 | info.setFile( fn ); | 1817 | info.setFile( fn ); |
1809 | QString mess; | 1818 | QString mess; |
1810 | bool loadbup = true; | 1819 | bool loadbup = true; |
1811 | if ( info. exists() ) { | 1820 | if ( info. exists() ) { |
1812 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 1821 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
1813 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", | 1822 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", |
1814 | mess, | 1823 | mess, |
1815 | i18n("Load!"), i18n("Cancel"), 0, | 1824 | i18n("Load!"), i18n("Cancel"), 0, |
1816 | 0, 1 ); | 1825 | 0, 1 ); |
1817 | if ( result != 0 ) { | 1826 | if ( result != 0 ) { |
1818 | loadbup = false; | 1827 | loadbup = false; |
1819 | } | 1828 | } |
1820 | } else { | 1829 | } else { |
1821 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1830 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1822 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, | 1831 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, |
1823 | 0, 1 ); | 1832 | 0, 1 ); |
1824 | 1833 | ||
1825 | return; | 1834 | return; |
1826 | } | 1835 | } |
1827 | if ( loadbup ) { | 1836 | if ( loadbup ) { |
1828 | mView->openCalendar( fn ); | 1837 | mView->openCalendar( fn ); |
1829 | KOPrefs::instance()->mLastLoadFile = fn; | 1838 | KOPrefs::instance()->mLastLoadFile = fn; |
1830 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; | 1839 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; |
1831 | setCaption(mess); | 1840 | setCaption(mess); |
1832 | } | 1841 | } |
1833 | 1842 | ||
1834 | } | 1843 | } |
1835 | void MainWindow::quickImportIcal() | 1844 | void MainWindow::quickImportIcal() |
1836 | { | 1845 | { |
1837 | importFile( KOPrefs::instance()->mLastImportFile, false ); | 1846 | importFile( KOPrefs::instance()->mLastImportFile, false ); |
1838 | } | 1847 | } |
1839 | void MainWindow::importFile( QString fn, bool quick ) | 1848 | void MainWindow::importFile( QString fn, bool quick ) |
1840 | { | 1849 | { |
1841 | QFileInfo info; | 1850 | QFileInfo info; |
1842 | info.setFile( fn ); | 1851 | info.setFile( fn ); |
1843 | QString mess; | 1852 | QString mess; |
1844 | bool loadbup = true; | 1853 | bool loadbup = true; |
1845 | if ( !info. exists() ) { | 1854 | if ( !info. exists() ) { |
1846 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); | 1855 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); |
1847 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1856 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1848 | mess ); | 1857 | mess ); |
1849 | return; | 1858 | return; |
1850 | } | 1859 | } |
1851 | int result = 0; | 1860 | int result = 0; |
1852 | if ( !quick ) { | 1861 | if ( !quick ) { |
1853 | mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 1862 | mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
1854 | result = QMessageBox::warning( this, "KO/Pi: Warning!", | 1863 | result = QMessageBox::warning( this, "KO/Pi: Warning!", |
1855 | mess, | 1864 | mess, |
1856 | "Import", "Cancel", 0, | 1865 | "Import", "Cancel", 0, |
1857 | 0, 1 ); | 1866 | 0, 1 ); |
1858 | } | 1867 | } |
1859 | if ( result == 0 ) { | 1868 | if ( result == 0 ) { |
1860 | if ( mView->openCalendar( fn, true )) { | 1869 | if ( mView->openCalendar( fn, true )) { |
1861 | KOPrefs::instance()->mLastImportFile = fn; | 1870 | KOPrefs::instance()->mLastImportFile = fn; |
1862 | setCaption(i18n("Imported file successfully")); | 1871 | setCaption(i18n("Imported file successfully")); |
1863 | } else { | 1872 | } else { |
1864 | setCaption(i18n("Error importing file")); | 1873 | setCaption(i18n("Error importing file")); |
1865 | } | 1874 | } |
1866 | } | 1875 | } |
1867 | } | 1876 | } |
1868 | 1877 | ||
1869 | void MainWindow::importIcal() | 1878 | void MainWindow::importIcal() |
1870 | { | 1879 | { |
1871 | 1880 | ||
1872 | QString fn =KOPrefs::instance()->mLastImportFile; | 1881 | QString fn =KOPrefs::instance()->mLastImportFile; |
1873 | 1882 | ||
1874 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); | 1883 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); |
1875 | if ( fn == "" ) | 1884 | if ( fn == "" ) |
1876 | return; | 1885 | return; |
1877 | importFile( fn, true ); | 1886 | importFile( fn, true ); |
1878 | 1887 | ||
1879 | } | 1888 | } |
1880 | 1889 | ||
1881 | void MainWindow::exportVCalendar() | 1890 | void MainWindow::exportVCalendar() |
1882 | { | 1891 | { |
1883 | QString fn = KOPrefs::instance()->mLastVcalFile; | 1892 | QString fn = KOPrefs::instance()->mLastVcalFile; |
1884 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); | 1893 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); |
1885 | if ( fn == "" ) | 1894 | if ( fn == "" ) |
1886 | return; | 1895 | return; |
1887 | QFileInfo info; | 1896 | QFileInfo info; |
1888 | info.setFile( fn ); | 1897 | info.setFile( fn ); |
1889 | QString mes; | 1898 | QString mes; |
1890 | bool createbup = true; | 1899 | bool createbup = true; |
1891 | if ( info. exists() ) { | 1900 | if ( info. exists() ) { |
1892 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); | 1901 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); |
1893 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 1902 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
1894 | i18n("Overwrite!"), i18n("Cancel"), 0, | 1903 | i18n("Overwrite!"), i18n("Cancel"), 0, |
1895 | 0, 1 ); | 1904 | 0, 1 ); |
1896 | if ( result != 0 ) { | 1905 | if ( result != 0 ) { |
1897 | createbup = false; | 1906 | createbup = false; |
1898 | } | 1907 | } |
1899 | } | 1908 | } |
1900 | if ( createbup ) { | 1909 | if ( createbup ) { |
1901 | if ( mView->exportVCalendar( fn ) ) { | 1910 | if ( mView->exportVCalendar( fn ) ) { |
1902 | KOPrefs::instance()->mLastVcalFile = fn; | 1911 | KOPrefs::instance()->mLastVcalFile = fn; |
1903 | if ( fn.length() > 20 ) | 1912 | if ( fn.length() > 20 ) |
1904 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; | 1913 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; |
1905 | else | 1914 | else |
1906 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); | 1915 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); |
1907 | setCaption(mes); | 1916 | setCaption(mes); |
1908 | } | 1917 | } |
1909 | } | 1918 | } |
1910 | 1919 | ||
1911 | } | 1920 | } |
1912 | 1921 | ||
1913 | void MainWindow::syncFileRequest() | 1922 | void MainWindow::syncFileRequest() |
1914 | { | 1923 | { |
1915 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { | 1924 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { |
1916 | mSyncManager->slotSyncMenu( 999 ); | 1925 | mSyncManager->slotSyncMenu( 999 ); |
1917 | } | 1926 | } |
1918 | save(); | 1927 | save(); |
1919 | } | 1928 | } |
1920 | void MainWindow::getFile( bool success ) | 1929 | void MainWindow::getFile( bool success ) |
1921 | { | 1930 | { |
1922 | if ( ! success ) { | 1931 | if ( ! success ) { |
1923 | setCaption( i18n("Error receiving file. Nothing changed!") ); | 1932 | setCaption( i18n("Error receiving file. Nothing changed!") ); |
1924 | return; | 1933 | return; |
1925 | } | 1934 | } |
1926 | mView->openCalendar( defaultFileName() ); | 1935 | mView->openCalendar( defaultFileName() ); |
1927 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { | 1936 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { |
1928 | mSyncManager->slotSyncMenu( 999 ); | 1937 | mSyncManager->slotSyncMenu( 999 ); |
1929 | } | 1938 | } |
1930 | setCaption( i18n("Pi-Sync successful!") ); | 1939 | setCaption( i18n("Pi-Sync successful!") ); |
1931 | } | 1940 | } |
1932 | 1941 | ||
1933 | void MainWindow::printSel( ) | 1942 | void MainWindow::printSel( ) |
1934 | { | 1943 | { |
1935 | mView->viewManager()->agendaView()->agenda()->printSelection(); | 1944 | mView->viewManager()->agendaView()->agenda()->printSelection(); |
1936 | } | 1945 | } |
1937 | 1946 | ||
1938 | void MainWindow::printCal() | 1947 | void MainWindow::printCal() |
1939 | { | 1948 | { |
1940 | mView->print();//mCp->showDialog(); | 1949 | mView->print();//mCp->showDialog(); |
1941 | } | 1950 | } |
1942 | 1951 | ||
diff --git a/libkcal/incidence.h b/libkcal/incidence.h index 1807bc4..de2a381 100644 --- a/libkcal/incidence.h +++ b/libkcal/incidence.h | |||
@@ -1,299 +1,299 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library 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 GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | #ifndef INCIDENCE_H | 20 | #ifndef INCIDENCE_H |
21 | #define INCIDENCE_H | 21 | #define INCIDENCE_H |
22 | // | 22 | // |
23 | // Incidence - base class of calendaring components | 23 | // Incidence - base class of calendaring components |
24 | // | 24 | // |
25 | 25 | ||
26 | #include <qdatetime.h> | 26 | #include <qdatetime.h> |
27 | #include <qstringlist.h> | 27 | #include <qstringlist.h> |
28 | #include <qvaluelist.h> | 28 | #include <qvaluelist.h> |
29 | 29 | ||
30 | #include "recurrence.h" | 30 | #include "recurrence.h" |
31 | #include "alarm.h" | 31 | #include "alarm.h" |
32 | #include "attachment.h" | 32 | #include "attachment.h" |
33 | #include "listbase.h" | 33 | #include "listbase.h" |
34 | #include "incidencebase.h" | 34 | #include "incidencebase.h" |
35 | 35 | ||
36 | namespace KCal { | 36 | namespace KCal { |
37 | 37 | ||
38 | class Event; | 38 | class Event; |
39 | class Todo; | 39 | class Todo; |
40 | class Journal; | 40 | class Journal; |
41 | 41 | ||
42 | /** | 42 | /** |
43 | This class provides the base class common to all calendar components. | 43 | This class provides the base class common to all calendar components. |
44 | */ | 44 | */ |
45 | class Incidence : public IncidenceBase | 45 | class Incidence : public IncidenceBase |
46 | { | 46 | { |
47 | public: | 47 | public: |
48 | /** | 48 | /** |
49 | This class provides the interface for a visitor of calendar components. It | 49 | This class provides the interface for a visitor of calendar components. It |
50 | serves as base class for concrete visitors, which implement certain actions on | 50 | serves as base class for concrete visitors, which implement certain actions on |
51 | calendar components. It allows to add functions, which operate on the concrete | 51 | calendar components. It allows to add functions, which operate on the concrete |
52 | types of calendar components, without changing the calendar component classes. | 52 | types of calendar components, without changing the calendar component classes. |
53 | */ | 53 | */ |
54 | class Visitor | 54 | class Visitor |
55 | { | 55 | { |
56 | public: | 56 | public: |
57 | /** Destruct Incidence::Visitor */ | 57 | /** Destruct Incidence::Visitor */ |
58 | virtual ~Visitor() {} | 58 | virtual ~Visitor() {} |
59 | 59 | ||
60 | /** | 60 | /** |
61 | Reimplement this function in your concrete subclass of IncidenceVisitor to perform actions | 61 | Reimplement this function in your concrete subclass of IncidenceVisitor to perform actions |
62 | on an Event object. | 62 | on an Event object. |
63 | */ | 63 | */ |
64 | virtual bool visit(Event *) { return false; } | 64 | virtual bool visit(Event *) { return false; } |
65 | /** | 65 | /** |
66 | Reimplement this function in your concrete subclass of IncidenceVisitor to perform actions | 66 | Reimplement this function in your concrete subclass of IncidenceVisitor to perform actions |
67 | on an Todo object. | 67 | on an Todo object. |
68 | */ | 68 | */ |
69 | virtual bool visit(Todo *) { return false; } | 69 | virtual bool visit(Todo *) { return false; } |
70 | /** | 70 | /** |
71 | Reimplement this function in your concrete subclass of IncidenceVisitor to perform actions | 71 | Reimplement this function in your concrete subclass of IncidenceVisitor to perform actions |
72 | on an Journal object. | 72 | on an Journal object. |
73 | */ | 73 | */ |
74 | virtual bool visit(Journal *) { return false; } | 74 | virtual bool visit(Journal *) { return false; } |
75 | 75 | ||
76 | protected: | 76 | protected: |
77 | /** Constructor is protected to prevent direct creation of visitor base class. */ | 77 | /** Constructor is protected to prevent direct creation of visitor base class. */ |
78 | Visitor() {} | 78 | Visitor() {} |
79 | }; | 79 | }; |
80 | 80 | ||
81 | /** | 81 | /** |
82 | This class implements a visitor for adding an Incidence to a resource | 82 | This class implements a visitor for adding an Incidence to a resource |
83 | supporting addEvent(), addTodo() and addJournal() calls. | 83 | supporting addEvent(), addTodo() and addJournal() calls. |
84 | */ | 84 | */ |
85 | template<class T> | 85 | template<class T> |
86 | class AddVisitor : public Visitor | 86 | class AddVisitor : public Visitor |
87 | { | 87 | { |
88 | public: | 88 | public: |
89 | AddVisitor( T *r ) : mResource( r ) {} | 89 | AddVisitor( T *r ) : mResource( r ) {} |
90 | bool visit( Event *e ) { return mResource->addEvent( e ); } | 90 | bool visit( Event *e ) { return mResource->addEvent( e ); } |
91 | bool visit( Todo *t ) { return mResource->addTodo( t ); } | 91 | bool visit( Todo *t ) { return mResource->addTodo( t ); } |
92 | bool visit( Journal *j ) { return mResource->addJournal( j ); } | 92 | bool visit( Journal *j ) { return mResource->addJournal( j ); } |
93 | 93 | ||
94 | private: | 94 | private: |
95 | T *mResource; | 95 | T *mResource; |
96 | }; | 96 | }; |
97 | 97 | ||
98 | /** enumeration for describing an event's secrecy. */ | 98 | /** enumeration for describing an event's secrecy. */ |
99 | enum { SecrecyPublic = 0, SecrecyPrivate = 1, SecrecyConfidential = 2 }; | 99 | enum { SecrecyPublic = 0, SecrecyPrivate = 1, SecrecyConfidential = 2 }; |
100 | typedef ListBase<Incidence> List; | 100 | typedef ListBase<Incidence> List; |
101 | Incidence(); | 101 | Incidence(); |
102 | Incidence(const Incidence &); | 102 | Incidence(const Incidence &); |
103 | ~Incidence(); | 103 | ~Incidence(); |
104 | 104 | ||
105 | /** | 105 | /** |
106 | Accept IncidenceVisitor. A class taking part in the visitor mechanism has to | 106 | Accept IncidenceVisitor. A class taking part in the visitor mechanism has to |
107 | provide this implementation: | 107 | provide this implementation: |
108 | <pre> | 108 | <pre> |
109 | bool accept(Visitor &v) { return v.visit(this); } | 109 | bool accept(Visitor &v) { return v.visit(this); } |
110 | </pre> | 110 | </pre> |
111 | */ | 111 | */ |
112 | virtual bool accept(Visitor &) { return false; } | 112 | virtual bool accept(Visitor &) { return false; } |
113 | 113 | ||
114 | virtual Incidence *clone() = 0; | 114 | virtual Incidence *clone() = 0; |
115 | 115 | ||
116 | virtual QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const = 0; | 116 | virtual QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const = 0; |
117 | void setReadOnly( bool ); | 117 | void setReadOnly( bool ); |
118 | 118 | ||
119 | /** | 119 | /** |
120 | Recreate event. The event is made a new unique event, but already stored | 120 | Recreate event. The event is made a new unique event, but already stored |
121 | event information is preserved. Sets uniquie id, creation date, last | 121 | event information is preserved. Sets uniquie id, creation date, last |
122 | modification date and revision number. | 122 | modification date and revision number. |
123 | */ | 123 | */ |
124 | void recreate(); | 124 | void recreate(); |
125 | Incidence* recreateCloneException(QDate); | 125 | Incidence* recreateCloneException(QDate); |
126 | 126 | ||
127 | /** set creation date */ | 127 | /** set creation date */ |
128 | void setCreated(QDateTime); | 128 | void setCreated(QDateTime); |
129 | /** return time and date of creation. */ | 129 | /** return time and date of creation. */ |
130 | QDateTime created() const; | 130 | QDateTime created() const; |
131 | 131 | ||
132 | /** set the number of revisions this event has seen */ | 132 | /** set the number of revisions this event has seen */ |
133 | void setRevision(int rev); | 133 | void setRevision(int rev); |
134 | /** return the number of revisions this event has seen */ | 134 | /** return the number of revisions this event has seen */ |
135 | int revision() const; | 135 | int revision() const; |
136 | 136 | ||
137 | /** Set starting date/time. */ | 137 | /** Set starting date/time. */ |
138 | virtual void setDtStart(const QDateTime &dtStart); | 138 | virtual void setDtStart(const QDateTime &dtStart); |
139 | /** Return the incidence's ending date/time as a QDateTime. */ | 139 | /** Return the incidence's ending date/time as a QDateTime. */ |
140 | virtual QDateTime dtEnd() const { return QDateTime(); } | 140 | virtual QDateTime dtEnd() const { return QDateTime(); } |
141 | 141 | ||
142 | /** sets the event's lengthy description. */ | 142 | /** sets the event's lengthy description. */ |
143 | void setDescription(const QString &description); | 143 | void setDescription(const QString &description); |
144 | /** returns a reference to the event's description. */ | 144 | /** returns a reference to the event's description. */ |
145 | QString description() const; | 145 | QString description() const; |
146 | 146 | ||
147 | /** sets the event's short summary. */ | 147 | /** sets the event's short summary. */ |
148 | void setSummary(const QString &summary); | 148 | void setSummary(const QString &summary); |
149 | /** returns a reference to the event's summary. */ | 149 | /** returns a reference to the event's summary. */ |
150 | QString summary() const; | 150 | QString summary() const; |
151 | 151 | ||
152 | /** set event's applicable categories */ | 152 | /** set event's applicable categories */ |
153 | void setCategories(const QStringList &categories); | 153 | void setCategories(const QStringList &categories); |
154 | /** set event's categories based on a comma delimited string */ | 154 | /** set event's categories based on a comma delimited string */ |
155 | void setCategories(const QString &catStr); | 155 | void setCategories(const QString &catStr); |
156 | /** return categories in a list */ | 156 | /** return categories in a list */ |
157 | QStringList categories() const; | 157 | QStringList categories() const; |
158 | /** return categories as a comma separated string */ | 158 | /** return categories as a comma separated string */ |
159 | QString categoriesStr(); | 159 | QString categoriesStr(); |
160 | 160 | ||
161 | /** point at some other event to which the event relates. This function should | 161 | /** point at some other event to which the event relates. This function should |
162 | * only be used when constructing a calendar before the related Event | 162 | * only be used when constructing a calendar before the related Event |
163 | * exists. */ | 163 | * exists. */ |
164 | void setRelatedToUid(const QString &); | 164 | void setRelatedToUid(const QString &); |
165 | /** what event does this one relate to? This function should | 165 | /** what event does this one relate to? This function should |
166 | * only be used when constructing a calendar before the related Event | 166 | * only be used when constructing a calendar before the related Event |
167 | * exists. */ | 167 | * exists. */ |
168 | QString relatedToUid() const; | 168 | QString relatedToUid() const; |
169 | /** point at some other event to which the event relates */ | 169 | /** point at some other event to which the event relates */ |
170 | void setRelatedTo(Incidence *relatedTo); | 170 | void setRelatedTo(Incidence *relatedTo); |
171 | /** what event does this one relate to? */ | 171 | /** what event does this one relate to? */ |
172 | Incidence *relatedTo() const; | 172 | Incidence *relatedTo() const; |
173 | /** All events that are related to this event */ | 173 | /** All events that are related to this event */ |
174 | QPtrList<Incidence> relations() const; | 174 | QPtrList<Incidence> relations() const; |
175 | /** Add an event which is related to this event */ | 175 | /** Add an event which is related to this event */ |
176 | void addRelation(Incidence *); | 176 | void addRelation(Incidence *); |
177 | /** Remove event that is related to this event */ | 177 | /** Remove event that is related to this event */ |
178 | void removeRelation(Incidence *); | 178 | void removeRelation(Incidence *); |
179 | 179 | ||
180 | /** returns the list of dates which are exceptions to the recurrence rule */ | 180 | /** returns the list of dates which are exceptions to the recurrence rule */ |
181 | DateList exDates() const; | 181 | DateList exDates() const; |
182 | /** sets the list of dates which are exceptions to the recurrence rule */ | 182 | /** sets the list of dates which are exceptions to the recurrence rule */ |
183 | void setExDates(const DateList &_exDates); | 183 | void setExDates(const DateList &_exDates); |
184 | void setExDates(const char *dates); | 184 | void setExDates(const char *dates); |
185 | /** Add a date to the list of exceptions of the recurrence rule. */ | 185 | /** Add a date to the list of exceptions of the recurrence rule. */ |
186 | void addExDate(const QDate &date); | 186 | void addExDate(const QDate &date); |
187 | 187 | ||
188 | /** returns true if there is an exception for this date in the recurrence | 188 | /** returns true if there is an exception for this date in the recurrence |
189 | rule set, or false otherwise. */ | 189 | rule set, or false otherwise. */ |
190 | bool isException(const QDate &qd) const; | 190 | bool isException(const QDate &qd) const; |
191 | 191 | ||
192 | /** add attachment to this event */ | 192 | /** add attachment to this event */ |
193 | void addAttachment(Attachment *attachment); | 193 | void addAttachment(Attachment *attachment); |
194 | /** remove and delete a specific attachment */ | 194 | /** remove and delete a specific attachment */ |
195 | void deleteAttachment(Attachment *attachment); | 195 | void deleteAttachment(Attachment *attachment); |
196 | /** remove and delete all attachments with this mime type */ | 196 | /** remove and delete all attachments with this mime type */ |
197 | void deleteAttachments(const QString& mime); | 197 | void deleteAttachments(const QString& mime); |
198 | /** return list of all associated attachments */ | 198 | /** return list of all associated attachments */ |
199 | QPtrList<Attachment> attachments() const; | 199 | QPtrList<Attachment> attachments() const; |
200 | /** find a list of attachments with this mime type */ | 200 | /** find a list of attachments with this mime type */ |
201 | QPtrList<Attachment> attachments(const QString& mime) const; | 201 | QPtrList<Attachment> attachments(const QString& mime) const; |
202 | 202 | ||
203 | /** sets the event's status the value specified. See the enumeration | 203 | /** sets the event's status the value specified. See the enumeration |
204 | * above for possible values. */ | 204 | * above for possible values. */ |
205 | void setSecrecy(int); | 205 | void setSecrecy(int); |
206 | /** return the event's secrecy. */ | 206 | /** return the event's secrecy. */ |
207 | int secrecy() const; | 207 | int secrecy() const; |
208 | /** return the event's secrecy in string format. */ | 208 | /** return the event's secrecy in string format. */ |
209 | QString secrecyStr() const; | 209 | QString secrecyStr() const; |
210 | /** return list of all availbale secrecy classes */ | 210 | /** return list of all availbale secrecy classes */ |
211 | static QStringList secrecyList(); | 211 | static QStringList secrecyList(); |
212 | /** return human-readable name of secrecy class */ | 212 | /** return human-readable name of secrecy class */ |
213 | static QString secrecyName(int); | 213 | static QString secrecyName(int); |
214 | 214 | ||
215 | /** returns TRUE if the date specified is one on which the event will | 215 | /** returns TRUE if the date specified is one on which the event will |
216 | * recur. */ | 216 | * recur. */ |
217 | bool recursOn(const QDate &qd) const; | 217 | bool recursOn(const QDate &qd) const; |
218 | 218 | ||
219 | // VEVENT and VTODO, but not VJOURNAL (move to EventBase class?): | 219 | // VEVENT and VTODO, but not VJOURNAL (move to EventBase class?): |
220 | 220 | ||
221 | /** set resources used, such as Office, Car, etc. */ | 221 | /** set resources used, such as Office, Car, etc. */ |
222 | void setResources(const QStringList &resources); | 222 | void setResources(const QStringList &resources); |
223 | /** return list of current resources */ | 223 | /** return list of current resources */ |
224 | QStringList resources() const; | 224 | QStringList resources() const; |
225 | 225 | ||
226 | /** set the event's priority, 0 is undefined, 1 highest (decreasing order) */ | 226 | /** set the event's priority, 0 is undefined, 1 highest (decreasing order) */ |
227 | void setPriority(int priority); | 227 | void setPriority(int priority); |
228 | /** get the event's priority */ | 228 | /** get the event's priority */ |
229 | int priority() const; | 229 | int priority() const; |
230 | 230 | ||
231 | /** All alarms that are associated with this incidence */ | 231 | /** All alarms that are associated with this incidence */ |
232 | QPtrList<Alarm> alarms() const; | 232 | QPtrList<Alarm> alarms() const; |
233 | /** Create a new alarm which is associated with this incidence */ | 233 | /** Create a new alarm which is associated with this incidence */ |
234 | Alarm* newAlarm(); | 234 | Alarm* newAlarm(); |
235 | /** Add an alarm which is associated with this incidence */ | 235 | /** Add an alarm which is associated with this incidence */ |
236 | void addAlarm(Alarm*); | 236 | void addAlarm(Alarm*); |
237 | /** Remove an alarm that is associated with this incidence */ | 237 | /** Remove an alarm that is associated with this incidence */ |
238 | void removeAlarm(Alarm*); | 238 | void removeAlarm(Alarm*); |
239 | /** Remove all alarms that are associated with this incidence */ | 239 | /** Remove all alarms that are associated with this incidence */ |
240 | void clearAlarms(); | 240 | void clearAlarms(); |
241 | /** return whether any alarm associated with this incidence is enabled */ | 241 | /** return whether any alarm associated with this incidence is enabled */ |
242 | bool isAlarmEnabled() const; | 242 | bool isAlarmEnabled() const; |
243 | 243 | ||
244 | /** | 244 | /** |
245 | Return the recurrence rule associated with this incidence. If there is | 245 | Return the recurrence rule associated with this incidence. If there is |
246 | none, returns an appropriate (non-0) object. | 246 | none, returns an appropriate (non-0) object. |
247 | */ | 247 | */ |
248 | Recurrence *recurrence() const; | 248 | Recurrence *recurrence() const; |
249 | void setRecurrence(Recurrence * r); | 249 | void setRecurrence(Recurrence * r); |
250 | /** | 250 | /** |
251 | Forward to Recurrence::doesRecur(). | 251 | Forward to Recurrence::doesRecur(). |
252 | */ | 252 | */ |
253 | ushort doesRecur() const; | 253 | ushort doesRecur() const; |
254 | 254 | ||
255 | /** set the event's/todo's location. Do _not_ use it with journal */ | 255 | /** set the event's/todo's location. Do _not_ use it with journal */ |
256 | void setLocation(const QString &location); | 256 | void setLocation(const QString &location); |
257 | /** return the event's/todo's location. Do _not_ use it with journal */ | 257 | /** return the event's/todo's location. Do _not_ use it with journal */ |
258 | QString location() const; | 258 | QString location() const; |
259 | /** returns TRUE or FALSE depending on whether the todo has a start date */ | 259 | /** returns TRUE or FALSE depending on whether the todo has a start date */ |
260 | bool hasStartDate() const; | 260 | bool hasStartDate() const; |
261 | /** sets the event's hasStartDate value. */ | 261 | /** sets the event's hasStartDate value. */ |
262 | void setHasStartDate(bool f); | 262 | void setHasStartDate(bool f); |
263 | QDateTime getNextOccurence( const QDateTime& dt, bool* yes ) const; | 263 | QDateTime getNextOccurence( const QDateTime& dt, bool* yes ) const; |
264 | bool cancelled() const; | 264 | bool cancelled() const; |
265 | void setCancelled( bool b ); | 265 | void setCancelled( bool b ); |
266 | 266 | ||
267 | protected: | 267 | protected: |
268 | QPtrList<Alarm> mAlarms; | 268 | QPtrList<Alarm> mAlarms; |
269 | QPtrList<Incidence> mRelations; | ||
269 | private: | 270 | private: |
270 | int mRevision; | 271 | int mRevision; |
271 | bool mCancelled; | 272 | bool mCancelled; |
272 | 273 | ||
273 | // base components of jounal, event and todo | 274 | // base components of jounal, event and todo |
274 | QDateTime mCreated; | 275 | QDateTime mCreated; |
275 | QString mDescription; | 276 | QString mDescription; |
276 | QString mSummary; | 277 | QString mSummary; |
277 | QStringList mCategories; | 278 | QStringList mCategories; |
278 | Incidence *mRelatedTo; | 279 | Incidence *mRelatedTo; |
279 | QString mRelatedToUid; | 280 | QString mRelatedToUid; |
280 | QPtrList<Incidence> mRelations; | ||
281 | DateList mExDates; | 281 | DateList mExDates; |
282 | QPtrList<Attachment> mAttachments; | 282 | QPtrList<Attachment> mAttachments; |
283 | QStringList mResources; | 283 | QStringList mResources; |
284 | bool mHasStartDate; // if todo has associated start date | 284 | bool mHasStartDate; // if todo has associated start date |
285 | 285 | ||
286 | int mSecrecy; | 286 | int mSecrecy; |
287 | int mPriority; // 1 = highest, 2 = less, etc. | 287 | int mPriority; // 1 = highest, 2 = less, etc. |
288 | 288 | ||
289 | //QPtrList<Alarm> mAlarms; | 289 | //QPtrList<Alarm> mAlarms; |
290 | Recurrence *mRecurrence; | 290 | Recurrence *mRecurrence; |
291 | 291 | ||
292 | QString mLocation; | 292 | QString mLocation; |
293 | }; | 293 | }; |
294 | 294 | ||
295 | bool operator==( const Incidence&, const Incidence& ); | 295 | bool operator==( const Incidence&, const Incidence& ); |
296 | 296 | ||
297 | } | 297 | } |
298 | 298 | ||
299 | #endif | 299 | #endif |
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index 7f1de78..d81a68f 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp | |||
@@ -1,384 +1,414 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library 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 GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <kglobal.h> | 21 | #include <kglobal.h> |
22 | #include <klocale.h> | 22 | #include <klocale.h> |
23 | #include <kdebug.h> | 23 | #include <kdebug.h> |
24 | 24 | ||
25 | #include "todo.h" | 25 | #include "todo.h" |
26 | 26 | ||
27 | using namespace KCal; | 27 | using namespace KCal; |
28 | 28 | ||
29 | Todo::Todo(): Incidence() | 29 | Todo::Todo(): Incidence() |
30 | { | 30 | { |
31 | // mStatus = TENTATIVE; | 31 | // mStatus = TENTATIVE; |
32 | 32 | ||
33 | mHasDueDate = false; | 33 | mHasDueDate = false; |
34 | setHasStartDate( false ); | 34 | setHasStartDate( false ); |
35 | mCompleted = getEvenTime(QDateTime::currentDateTime()); | 35 | mCompleted = getEvenTime(QDateTime::currentDateTime()); |
36 | mHasCompletedDate = false; | 36 | mHasCompletedDate = false; |
37 | mPercentComplete = 0; | 37 | mPercentComplete = 0; |
38 | } | 38 | } |
39 | 39 | ||
40 | Todo::Todo(const Todo &t) : Incidence(t) | 40 | Todo::Todo(const Todo &t) : Incidence(t) |
41 | { | 41 | { |
42 | mDtDue = t.mDtDue; | 42 | mDtDue = t.mDtDue; |
43 | mHasDueDate = t.mHasDueDate; | 43 | mHasDueDate = t.mHasDueDate; |
44 | mCompleted = t.mCompleted; | 44 | mCompleted = t.mCompleted; |
45 | mHasCompletedDate = t.mHasCompletedDate; | 45 | mHasCompletedDate = t.mHasCompletedDate; |
46 | mPercentComplete = t.mPercentComplete; | 46 | mPercentComplete = t.mPercentComplete; |
47 | } | 47 | } |
48 | 48 | ||
49 | Todo::~Todo() | 49 | Todo::~Todo() |
50 | { | 50 | { |
51 | 51 | ||
52 | } | 52 | } |
53 | 53 | ||
54 | Incidence *Todo::clone() | 54 | Incidence *Todo::clone() |
55 | { | 55 | { |
56 | return new Todo(*this); | 56 | return new Todo(*this); |
57 | } | 57 | } |
58 | 58 | ||
59 | bool Todo::contains ( Todo* from ) | 59 | bool Todo::contains ( Todo* from ) |
60 | { | 60 | { |
61 | 61 | ||
62 | if ( !from->summary().isEmpty() ) | 62 | if ( !from->summary().isEmpty() ) |
63 | if ( !summary().startsWith( from->summary() )) | 63 | if ( !summary().startsWith( from->summary() )) |
64 | return false; | 64 | return false; |
65 | if ( from->hasStartDate() ) { | 65 | if ( from->hasStartDate() ) { |
66 | if ( !hasStartDate() ) | 66 | if ( !hasStartDate() ) |
67 | return false; | 67 | return false; |
68 | if ( from->dtStart() != dtStart()) | 68 | if ( from->dtStart() != dtStart()) |
69 | return false; | 69 | return false; |
70 | } | 70 | } |
71 | if ( from->hasDueDate() ){ | 71 | if ( from->hasDueDate() ){ |
72 | if ( !hasDueDate() ) | 72 | if ( !hasDueDate() ) |
73 | return false; | 73 | return false; |
74 | if ( from->dtDue() != dtDue()) | 74 | if ( from->dtDue() != dtDue()) |
75 | return false; | 75 | return false; |
76 | } | 76 | } |
77 | if ( !from->location().isEmpty() ) | 77 | if ( !from->location().isEmpty() ) |
78 | if ( !location().startsWith( from->location() ) ) | 78 | if ( !location().startsWith( from->location() ) ) |
79 | return false; | 79 | return false; |
80 | if ( !from->description().isEmpty() ) | 80 | if ( !from->description().isEmpty() ) |
81 | if ( !description().startsWith( from->description() )) | 81 | if ( !description().startsWith( from->description() )) |
82 | return false; | 82 | return false; |
83 | if ( from->alarms().count() ) { | 83 | if ( from->alarms().count() ) { |
84 | Alarm *a = from->alarms().first(); | 84 | Alarm *a = from->alarms().first(); |
85 | if ( a->enabled() ){ | 85 | if ( a->enabled() ){ |
86 | if ( !alarms().count() ) | 86 | if ( !alarms().count() ) |
87 | return false; | 87 | return false; |
88 | Alarm *b = alarms().first(); | 88 | Alarm *b = alarms().first(); |
89 | if( ! b->enabled() ) | 89 | if( ! b->enabled() ) |
90 | return false; | 90 | return false; |
91 | if ( ! (a->offset() == b->offset() )) | 91 | if ( ! (a->offset() == b->offset() )) |
92 | return false; | 92 | return false; |
93 | } | 93 | } |
94 | } | 94 | } |
95 | 95 | ||
96 | QStringList cat = categories(); | 96 | QStringList cat = categories(); |
97 | QStringList catFrom = from->categories(); | 97 | QStringList catFrom = from->categories(); |
98 | QString nCat; | 98 | QString nCat; |
99 | int iii; | 99 | int iii; |
100 | for ( iii = 0; iii < catFrom.count();++iii ) { | 100 | for ( iii = 0; iii < catFrom.count();++iii ) { |
101 | nCat = catFrom[iii]; | 101 | nCat = catFrom[iii]; |
102 | if ( !nCat.isEmpty() ) | 102 | if ( !nCat.isEmpty() ) |
103 | if ( !cat.contains( nCat )) { | 103 | if ( !cat.contains( nCat )) { |
104 | return false; | 104 | return false; |
105 | } | 105 | } |
106 | } | 106 | } |
107 | if ( from->isCompleted() ) { | 107 | if ( from->isCompleted() ) { |
108 | if ( !isCompleted() ) | 108 | if ( !isCompleted() ) |
109 | return false; | 109 | return false; |
110 | } | 110 | } |
111 | if( priority() != from->priority() ) | 111 | if( priority() != from->priority() ) |
112 | return false; | 112 | return false; |
113 | 113 | ||
114 | 114 | ||
115 | return true; | 115 | return true; |
116 | 116 | ||
117 | } | 117 | } |
118 | bool KCal::operator==( const Todo& t1, const Todo& t2 ) | 118 | bool KCal::operator==( const Todo& t1, const Todo& t2 ) |
119 | { | 119 | { |
120 | 120 | ||
121 | bool ret = operator==( (const Incidence&)t1, (const Incidence&)t2 ); | 121 | bool ret = operator==( (const Incidence&)t1, (const Incidence&)t2 ); |
122 | if ( ! ret ) | 122 | if ( ! ret ) |
123 | return false; | 123 | return false; |
124 | if ( t1.hasDueDate() == t2.hasDueDate() ) { | 124 | if ( t1.hasDueDate() == t2.hasDueDate() ) { |
125 | if ( t1.hasDueDate() ) { | 125 | if ( t1.hasDueDate() ) { |
126 | if ( t1.doesFloat() == t2.doesFloat() ) { | 126 | if ( t1.doesFloat() == t2.doesFloat() ) { |
127 | if ( t1.doesFloat() ) { | 127 | if ( t1.doesFloat() ) { |
128 | if ( t1.dtDue().date() != t2.dtDue().date() ) | 128 | if ( t1.dtDue().date() != t2.dtDue().date() ) |
129 | return false; | 129 | return false; |
130 | } else | 130 | } else |
131 | if ( t1.dtDue() != t2.dtDue() ) | 131 | if ( t1.dtDue() != t2.dtDue() ) |
132 | return false; | 132 | return false; |
133 | } else | 133 | } else |
134 | return false;// float != | 134 | return false;// float != |
135 | } | 135 | } |
136 | 136 | ||
137 | } else | 137 | } else |
138 | return false; | 138 | return false; |
139 | if ( t1.percentComplete() != t2.percentComplete() ) | 139 | if ( t1.percentComplete() != t2.percentComplete() ) |
140 | return false; | 140 | return false; |
141 | if ( t1.isCompleted() ) { | 141 | if ( t1.isCompleted() ) { |
142 | if ( t1.hasCompletedDate() == t2.hasCompletedDate() ) { | 142 | if ( t1.hasCompletedDate() == t2.hasCompletedDate() ) { |
143 | if ( t1.hasCompletedDate() ) { | 143 | if ( t1.hasCompletedDate() ) { |
144 | if ( t1.completed() != t2.completed() ) | 144 | if ( t1.completed() != t2.completed() ) |
145 | return false; | 145 | return false; |
146 | } | 146 | } |
147 | 147 | ||
148 | } else | 148 | } else |
149 | return false; | 149 | return false; |
150 | } | 150 | } |
151 | return true; | 151 | return true; |
152 | 152 | ||
153 | } | 153 | } |
154 | 154 | ||
155 | void Todo::setDtDue(const QDateTime &dtDue) | 155 | void Todo::setDtDue(const QDateTime &dtDue) |
156 | { | 156 | { |
157 | //int diffsecs = mDtDue.secsTo(dtDue); | 157 | //int diffsecs = mDtDue.secsTo(dtDue); |
158 | 158 | ||
159 | /*if (mReadOnly) return; | 159 | /*if (mReadOnly) return; |
160 | const QPtrList<Alarm>& alarms = alarms(); | 160 | const QPtrList<Alarm>& alarms = alarms(); |
161 | for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next()) { | 161 | for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next()) { |
162 | if (alarm->enabled()) { | 162 | if (alarm->enabled()) { |
163 | alarm->setTime(alarm->time().addSecs(diffsecs)); | 163 | alarm->setTime(alarm->time().addSecs(diffsecs)); |
164 | } | 164 | } |
165 | }*/ | 165 | }*/ |
166 | mDtDue = getEvenTime(dtDue); | 166 | mDtDue = getEvenTime(dtDue); |
167 | 167 | ||
168 | //kdDebug(5800) << "setDtDue says date is " << mDtDue.toString() << endl; | 168 | //kdDebug(5800) << "setDtDue says date is " << mDtDue.toString() << endl; |
169 | 169 | ||
170 | /*const QPtrList<Alarm>& alarms = alarms(); | 170 | /*const QPtrList<Alarm>& alarms = alarms(); |
171 | for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next()) | 171 | for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next()) |
172 | alarm->setAlarmStart(mDtDue);*/ | 172 | alarm->setAlarmStart(mDtDue);*/ |
173 | 173 | ||
174 | updated(); | 174 | updated(); |
175 | } | 175 | } |
176 | 176 | ||
177 | QDateTime Todo::dtDue() const | 177 | QDateTime Todo::dtDue() const |
178 | { | 178 | { |
179 | return mDtDue; | 179 | return mDtDue; |
180 | } | 180 | } |
181 | 181 | ||
182 | QString Todo::dtDueTimeStr() const | 182 | QString Todo::dtDueTimeStr() const |
183 | { | 183 | { |
184 | return KGlobal::locale()->formatTime(mDtDue.time()); | 184 | return KGlobal::locale()->formatTime(mDtDue.time()); |
185 | } | 185 | } |
186 | 186 | ||
187 | QString Todo::dtDueDateStr(bool shortfmt) const | 187 | QString Todo::dtDueDateStr(bool shortfmt) const |
188 | { | 188 | { |
189 | return KGlobal::locale()->formatDate(mDtDue.date(),shortfmt); | 189 | return KGlobal::locale()->formatDate(mDtDue.date(),shortfmt); |
190 | } | 190 | } |
191 | 191 | ||
192 | QString Todo::dtDueStr(bool shortfmt) const | 192 | QString Todo::dtDueStr(bool shortfmt) const |
193 | { | 193 | { |
194 | return KGlobal::locale()->formatDateTime(mDtDue, shortfmt); | 194 | return KGlobal::locale()->formatDateTime(mDtDue, shortfmt); |
195 | } | 195 | } |
196 | 196 | // retval 0 : no found | |
197 | // 1 : due for date found | ||
198 | // 2 : overdue for date found | ||
199 | int Todo::hasDueSubTodoForDate( const QDate & date, bool checkSubtodos ) | ||
200 | { | ||
201 | int retval = 0; | ||
202 | if ( isCompleted() ) | ||
203 | return 0; | ||
204 | if ( hasDueDate() ) { | ||
205 | if ( dtDue().date() < date ) | ||
206 | return 2; | ||
207 | // we do not return, because we may find an overdue sub todo | ||
208 | if ( dtDue().date() == date ) | ||
209 | retval = 1; | ||
210 | } | ||
211 | if ( checkSubtodos ) { | ||
212 | Incidence *aTodo; | ||
213 | for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) { | ||
214 | int ret = ((Todo*)aTodo)->hasDueSubTodoForDate( date ,checkSubtodos ); | ||
215 | if ( ret == 2 ) | ||
216 | return 2; | ||
217 | if ( ret == 1) | ||
218 | retval = 1; | ||
219 | } | ||
220 | } | ||
221 | return retval; | ||
222 | } | ||
223 | int Todo::hasDueSubTodo( bool checkSubtodos ) //= true | ||
224 | { | ||
225 | return hasDueSubTodoForDate(QDate::currentDate(), checkSubtodos ); | ||
226 | } | ||
197 | bool Todo::hasDueDate() const | 227 | bool Todo::hasDueDate() const |
198 | { | 228 | { |
199 | return mHasDueDate; | 229 | return mHasDueDate; |
200 | } | 230 | } |
201 | 231 | ||
202 | void Todo::setHasDueDate(bool f) | 232 | void Todo::setHasDueDate(bool f) |
203 | { | 233 | { |
204 | if (mReadOnly) return; | 234 | if (mReadOnly) return; |
205 | mHasDueDate = f; | 235 | mHasDueDate = f; |
206 | updated(); | 236 | updated(); |
207 | } | 237 | } |
208 | 238 | ||
209 | 239 | ||
210 | #if 0 | 240 | #if 0 |
211 | void Todo::setStatus(const QString &statStr) | 241 | void Todo::setStatus(const QString &statStr) |
212 | { | 242 | { |
213 | if (mReadOnly) return; | 243 | if (mReadOnly) return; |
214 | QString ss(statStr.upper()); | 244 | QString ss(statStr.upper()); |
215 | 245 | ||
216 | if (ss == "X-ACTION") | 246 | if (ss == "X-ACTION") |
217 | mStatus = NEEDS_ACTION; | 247 | mStatus = NEEDS_ACTION; |
218 | else if (ss == "NEEDS ACTION") | 248 | else if (ss == "NEEDS ACTION") |
219 | mStatus = NEEDS_ACTION; | 249 | mStatus = NEEDS_ACTION; |
220 | else if (ss == "ACCEPTED") | 250 | else if (ss == "ACCEPTED") |
221 | mStatus = ACCEPTED; | 251 | mStatus = ACCEPTED; |
222 | else if (ss == "SENT") | 252 | else if (ss == "SENT") |
223 | mStatus = SENT; | 253 | mStatus = SENT; |
224 | else if (ss == "TENTATIVE") | 254 | else if (ss == "TENTATIVE") |
225 | mStatus = TENTATIVE; | 255 | mStatus = TENTATIVE; |
226 | else if (ss == "CONFIRMED") | 256 | else if (ss == "CONFIRMED") |
227 | mStatus = CONFIRMED; | 257 | mStatus = CONFIRMED; |
228 | else if (ss == "DECLINED") | 258 | else if (ss == "DECLINED") |
229 | mStatus = DECLINED; | 259 | mStatus = DECLINED; |
230 | else if (ss == "COMPLETED") | 260 | else if (ss == "COMPLETED") |
231 | mStatus = COMPLETED; | 261 | mStatus = COMPLETED; |
232 | else if (ss == "DELEGATED") | 262 | else if (ss == "DELEGATED") |
233 | mStatus = DELEGATED; | 263 | mStatus = DELEGATED; |
234 | 264 | ||
235 | updated(); | 265 | updated(); |
236 | } | 266 | } |
237 | 267 | ||
238 | void Todo::setStatus(int status) | 268 | void Todo::setStatus(int status) |
239 | { | 269 | { |
240 | if (mReadOnly) return; | 270 | if (mReadOnly) return; |
241 | mStatus = status; | 271 | mStatus = status; |
242 | updated(); | 272 | updated(); |
243 | } | 273 | } |
244 | 274 | ||
245 | int Todo::status() const | 275 | int Todo::status() const |
246 | { | 276 | { |
247 | return mStatus; | 277 | return mStatus; |
248 | } | 278 | } |
249 | 279 | ||
250 | QString Todo::statusStr() const | 280 | QString Todo::statusStr() const |
251 | { | 281 | { |
252 | switch(mStatus) { | 282 | switch(mStatus) { |
253 | case NEEDS_ACTION: | 283 | case NEEDS_ACTION: |
254 | return QString("NEEDS ACTION"); | 284 | return QString("NEEDS ACTION"); |
255 | break; | 285 | break; |
256 | case ACCEPTED: | 286 | case ACCEPTED: |
257 | return QString("ACCEPTED"); | 287 | return QString("ACCEPTED"); |
258 | break; | 288 | break; |
259 | case SENT: | 289 | case SENT: |
260 | return QString("SENT"); | 290 | return QString("SENT"); |
261 | break; | 291 | break; |
262 | case TENTATIVE: | 292 | case TENTATIVE: |
263 | return QString("TENTATIVE"); | 293 | return QString("TENTATIVE"); |
264 | break; | 294 | break; |
265 | case CONFIRMED: | 295 | case CONFIRMED: |
266 | return QString("CONFIRMED"); | 296 | return QString("CONFIRMED"); |
267 | break; | 297 | break; |
268 | case DECLINED: | 298 | case DECLINED: |
269 | return QString("DECLINED"); | 299 | return QString("DECLINED"); |
270 | break; | 300 | break; |
271 | case COMPLETED: | 301 | case COMPLETED: |
272 | return QString("COMPLETED"); | 302 | return QString("COMPLETED"); |
273 | break; | 303 | break; |
274 | case DELEGATED: | 304 | case DELEGATED: |
275 | return QString("DELEGATED"); | 305 | return QString("DELEGATED"); |
276 | break; | 306 | break; |
277 | } | 307 | } |
278 | return QString(""); | 308 | return QString(""); |
279 | } | 309 | } |
280 | #endif | 310 | #endif |
281 | 311 | ||
282 | bool Todo::isCompleted() const | 312 | bool Todo::isCompleted() const |
283 | { | 313 | { |
284 | if (mPercentComplete == 100) return true; | 314 | if (mPercentComplete == 100) return true; |
285 | else return false; | 315 | else return false; |
286 | } | 316 | } |
287 | 317 | ||
288 | void Todo::setCompleted(bool completed) | 318 | void Todo::setCompleted(bool completed) |
289 | { | 319 | { |
290 | if (completed) mPercentComplete = 100; | 320 | if (completed) mPercentComplete = 100; |
291 | else { | 321 | else { |
292 | mPercentComplete = 0; | 322 | mPercentComplete = 0; |
293 | mHasCompletedDate = false; | 323 | mHasCompletedDate = false; |
294 | } | 324 | } |
295 | updated(); | 325 | updated(); |
296 | } | 326 | } |
297 | 327 | ||
298 | QDateTime Todo::completed() const | 328 | QDateTime Todo::completed() const |
299 | { | 329 | { |
300 | return mCompleted; | 330 | return mCompleted; |
301 | } | 331 | } |
302 | 332 | ||
303 | QString Todo::completedStr( bool shortF ) const | 333 | QString Todo::completedStr( bool shortF ) const |
304 | { | 334 | { |
305 | return KGlobal::locale()->formatDateTime(mCompleted, shortF); | 335 | return KGlobal::locale()->formatDateTime(mCompleted, shortF); |
306 | } | 336 | } |
307 | 337 | ||
308 | void Todo::setCompleted(const QDateTime &completed) | 338 | void Todo::setCompleted(const QDateTime &completed) |
309 | { | 339 | { |
310 | //qDebug("Todo::setCompleted "); | 340 | //qDebug("Todo::setCompleted "); |
311 | if ( mHasCompletedDate ) { | 341 | if ( mHasCompletedDate ) { |
312 | // qDebug("has completed data - return "); | 342 | // qDebug("has completed data - return "); |
313 | return; | 343 | return; |
314 | } | 344 | } |
315 | mHasCompletedDate = true; | 345 | mHasCompletedDate = true; |
316 | mPercentComplete = 100; | 346 | mPercentComplete = 100; |
317 | mCompleted = getEvenTime(completed); | 347 | mCompleted = getEvenTime(completed); |
318 | updated(); | 348 | updated(); |
319 | } | 349 | } |
320 | 350 | ||
321 | bool Todo::hasCompletedDate() const | 351 | bool Todo::hasCompletedDate() const |
322 | { | 352 | { |
323 | return mHasCompletedDate; | 353 | return mHasCompletedDate; |
324 | } | 354 | } |
325 | 355 | ||
326 | int Todo::percentComplete() const | 356 | int Todo::percentComplete() const |
327 | { | 357 | { |
328 | return mPercentComplete; | 358 | return mPercentComplete; |
329 | } | 359 | } |
330 | 360 | ||
331 | void Todo::setPercentComplete(int v) | 361 | void Todo::setPercentComplete(int v) |
332 | { | 362 | { |
333 | mPercentComplete = v; | 363 | mPercentComplete = v; |
334 | if ( v != 100 ) | 364 | if ( v != 100 ) |
335 | mHasCompletedDate = false; | 365 | mHasCompletedDate = false; |
336 | updated(); | 366 | updated(); |
337 | } | 367 | } |
338 | QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset ) const | 368 | QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset ) const |
339 | { | 369 | { |
340 | if ( isCompleted() || ! hasDueDate() || cancelled() ) { | 370 | if ( isCompleted() || ! hasDueDate() || cancelled() ) { |
341 | *ok = false; | 371 | *ok = false; |
342 | return QDateTime (); | 372 | return QDateTime (); |
343 | } | 373 | } |
344 | QDateTime incidenceStart; | 374 | QDateTime incidenceStart; |
345 | incidenceStart = dtDue(); | 375 | incidenceStart = dtDue(); |
346 | bool enabled = false; | 376 | bool enabled = false; |
347 | Alarm* alarm; | 377 | Alarm* alarm; |
348 | int off; | 378 | int off; |
349 | QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );; | 379 | QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );; |
350 | // if ( QDateTime::currentDateTime() > incidenceStart ){ | 380 | // if ( QDateTime::currentDateTime() > incidenceStart ){ |
351 | // *ok = false; | 381 | // *ok = false; |
352 | // return incidenceStart; | 382 | // return incidenceStart; |
353 | // } | 383 | // } |
354 | for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) { | 384 | for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) { |
355 | if (alarm->enabled()) { | 385 | if (alarm->enabled()) { |
356 | if ( alarm->hasTime () ) { | 386 | if ( alarm->hasTime () ) { |
357 | if ( alarm->time() < alarmStart ) { | 387 | if ( alarm->time() < alarmStart ) { |
358 | alarmStart = alarm->time(); | 388 | alarmStart = alarm->time(); |
359 | enabled = true; | 389 | enabled = true; |
360 | off = alarmStart.secsTo( incidenceStart ); | 390 | off = alarmStart.secsTo( incidenceStart ); |
361 | } | 391 | } |
362 | 392 | ||
363 | } else { | 393 | } else { |
364 | int secs = alarm->startOffset().asSeconds(); | 394 | int secs = alarm->startOffset().asSeconds(); |
365 | if ( incidenceStart.addSecs( secs ) < alarmStart ) { | 395 | if ( incidenceStart.addSecs( secs ) < alarmStart ) { |
366 | alarmStart = incidenceStart.addSecs( secs ); | 396 | alarmStart = incidenceStart.addSecs( secs ); |
367 | enabled = true; | 397 | enabled = true; |
368 | off = -secs; | 398 | off = -secs; |
369 | } | 399 | } |
370 | } | 400 | } |
371 | } | 401 | } |
372 | } | 402 | } |
373 | if ( enabled ) { | 403 | if ( enabled ) { |
374 | if ( alarmStart > QDateTime::currentDateTime() ) { | 404 | if ( alarmStart > QDateTime::currentDateTime() ) { |
375 | *ok = true; | 405 | *ok = true; |
376 | * offset = off; | 406 | * offset = off; |
377 | return alarmStart; | 407 | return alarmStart; |
378 | } | 408 | } |
379 | } | 409 | } |
380 | *ok = false; | 410 | *ok = false; |
381 | return QDateTime (); | 411 | return QDateTime (); |
382 | 412 | ||
383 | } | 413 | } |
384 | 414 | ||
diff --git a/libkcal/todo.h b/libkcal/todo.h index 41f5841..137b252 100644 --- a/libkcal/todo.h +++ b/libkcal/todo.h | |||
@@ -1,122 +1,134 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library 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 GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | #ifndef TODO_H | 20 | #ifndef TODO_H |
21 | #define TODO_H | 21 | #define TODO_H |
22 | // | 22 | // |
23 | // Todo component, representing a VTODO object | 23 | // Todo component, representing a VTODO object |
24 | // | 24 | // |
25 | 25 | ||
26 | #include "incidence.h" | 26 | #include "incidence.h" |
27 | 27 | ||
28 | namespace KCal { | 28 | namespace KCal { |
29 | 29 | ||
30 | /** | 30 | /** |
31 | This class provides a Todo in the sense of RFC2445. | 31 | This class provides a Todo in the sense of RFC2445. |
32 | */ | 32 | */ |
33 | class Todo : public Incidence | 33 | class Todo : public Incidence |
34 | { | 34 | { |
35 | public: | 35 | public: |
36 | Todo(); | 36 | Todo(); |
37 | Todo(const Todo &); | 37 | Todo(const Todo &); |
38 | ~Todo(); | 38 | ~Todo(); |
39 | typedef ListBase<Todo> List; | 39 | typedef ListBase<Todo> List; |
40 | QCString type() const { return "Todo"; } | 40 | QCString type() const { return "Todo"; } |
41 | 41 | ||
42 | /** Return an exact copy of this todo. */ | 42 | /** Return an exact copy of this todo. */ |
43 | Incidence *clone(); | 43 | Incidence *clone(); |
44 | QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const; | 44 | QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const; |
45 | 45 | ||
46 | /** for setting the todo's due date/time with a QDateTime. */ | 46 | /** for setting the todo's due date/time with a QDateTime. */ |
47 | void setDtDue(const QDateTime &dtDue); | 47 | void setDtDue(const QDateTime &dtDue); |
48 | /** returns an event's Due date/time as a QDateTime. */ | 48 | /** returns an event's Due date/time as a QDateTime. */ |
49 | QDateTime dtDue() const; | 49 | QDateTime dtDue() const; |
50 | /** returns an event's due time as a string formatted according to the | 50 | /** returns an event's due time as a string formatted according to the |
51 | users locale settings */ | 51 | users locale settings */ |
52 | QString dtDueTimeStr() const; | 52 | QString dtDueTimeStr() const; |
53 | /** returns an event's due date as a string formatted according to the | 53 | /** returns an event's due date as a string formatted according to the |
54 | users locale settings */ | 54 | users locale settings */ |
55 | QString dtDueDateStr(bool shortfmt=true) const; | 55 | QString dtDueDateStr(bool shortfmt=true) const; |
56 | /** returns an event's due date and time as a string formatted according | 56 | /** returns an event's due date and time as a string formatted according |
57 | to the users locale settings */ | 57 | to the users locale settings */ |
58 | QString dtDueStr(bool shortfmt=true) const; | 58 | QString dtDueStr(bool shortfmt=true) const; |
59 | 59 | ||
60 | /** returns TRUE or FALSE depending on whether the todo has a due date */ | 60 | /** returns TRUE or FALSE depending on whether the todo has a due date */ |
61 | bool hasDueDate() const; | 61 | bool hasDueDate() const; |
62 | /** sets the event's hasDueDate value. */ | 62 | /** sets the event's hasDueDate value. */ |
63 | void setHasDueDate(bool f); | 63 | void setHasDueDate(bool f); |
64 | 64 | ||
65 | /* | ||
66 | Looks for a subtodo (including itself ) which is not complete and is | ||
67 | - overdue, or | ||
68 | - due today. | ||
69 | It returns 0 for nothing found, | ||
70 | 1 for found a todo which is due today and no overdue found | ||
71 | 2 for found a overdue todo | ||
72 | */ | ||
73 | int hasDueSubTodo( bool checkSubtodos = true ); | ||
74 | /* same as above, but a specific date can be specified*/ | ||
75 | int hasDueSubTodoForDate( const QDate & date, bool checkSubtodos ); | ||
76 | |||
65 | 77 | ||
66 | /** sets the event's status to the string specified. The string | 78 | /** sets the event's status to the string specified. The string |
67 | * must be a recognized value for the status field, i.e. a string | 79 | * must be a recognized value for the status field, i.e. a string |
68 | * equivalent of the possible status enumerations previously described. */ | 80 | * equivalent of the possible status enumerations previously described. */ |
69 | // void setStatus(const QString &statStr); | 81 | // void setStatus(const QString &statStr); |
70 | /** sets the event's status to the value specified. See the enumeration | 82 | /** sets the event's status to the value specified. See the enumeration |
71 | * above for possible values. */ | 83 | * above for possible values. */ |
72 | // void setStatus(int); | 84 | // void setStatus(int); |
73 | /** return the event's status. */ | 85 | /** return the event's status. */ |
74 | // int status() const; | 86 | // int status() const; |
75 | /** return the event's status in string format. */ | 87 | /** return the event's status in string format. */ |
76 | // QString statusStr() const; | 88 | // QString statusStr() const; |
77 | 89 | ||
78 | /** return, if this todo is completed */ | 90 | /** return, if this todo is completed */ |
79 | bool isCompleted() const; | 91 | bool isCompleted() const; |
80 | /** set completed state of this todo */ | 92 | /** set completed state of this todo */ |
81 | void setCompleted(bool); | 93 | void setCompleted(bool); |
82 | 94 | ||
83 | /** | 95 | /** |
84 | Return how many percent of the task are completed. Returns a value | 96 | Return how many percent of the task are completed. Returns a value |
85 | between 0 and 100. | 97 | between 0 and 100. |
86 | */ | 98 | */ |
87 | int percentComplete() const; | 99 | int percentComplete() const; |
88 | /** | 100 | /** |
89 | Set how many percent of the task are completed. Valid values are in the | 101 | Set how many percent of the task are completed. Valid values are in the |
90 | range from 0 to 100. | 102 | range from 0 to 100. |
91 | */ | 103 | */ |
92 | void setPercentComplete(int); | 104 | void setPercentComplete(int); |
93 | 105 | ||
94 | /** return date and time when todo was completed */ | 106 | /** return date and time when todo was completed */ |
95 | QDateTime completed() const; | 107 | QDateTime completed() const; |
96 | QString completedStr(bool shortF = true) const; | 108 | QString completedStr(bool shortF = true) const; |
97 | /** set date and time of completion */ | 109 | /** set date and time of completion */ |
98 | void setCompleted(const QDateTime &completed); | 110 | void setCompleted(const QDateTime &completed); |
99 | 111 | ||
100 | /** Return true, if todo has a date associated with completion */ | 112 | /** Return true, if todo has a date associated with completion */ |
101 | bool hasCompletedDate() const; | 113 | bool hasCompletedDate() const; |
102 | bool contains ( Todo*); | 114 | bool contains ( Todo*); |
103 | 115 | ||
104 | private: | 116 | private: |
105 | bool accept(Visitor &v) { return v.visit(this); } | 117 | bool accept(Visitor &v) { return v.visit(this); } |
106 | 118 | ||
107 | QDateTime mDtDue; // due date of todo | 119 | QDateTime mDtDue; // due date of todo |
108 | 120 | ||
109 | bool mHasDueDate; // if todo has associated due date | 121 | bool mHasDueDate; // if todo has associated due date |
110 | 122 | ||
111 | // int mStatus; // confirmed/delegated/tentative/etc | 123 | // int mStatus; // confirmed/delegated/tentative/etc |
112 | 124 | ||
113 | QDateTime mCompleted; | 125 | QDateTime mCompleted; |
114 | bool mHasCompletedDate; | 126 | bool mHasCompletedDate; |
115 | 127 | ||
116 | int mPercentComplete; | 128 | int mPercentComplete; |
117 | }; | 129 | }; |
118 | 130 | ||
119 | bool operator==( const Todo&, const Todo& ); | 131 | bool operator==( const Todo&, const Todo& ); |
120 | } | 132 | } |
121 | 133 | ||
122 | #endif | 134 | #endif |