author | zautrix <zautrix> | 2005-07-06 21:26:48 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-06 21:26:48 (UTC) |
commit | 630904c92dc014538ff0b08731efb10dcc25426f (patch) (unidiff) | |
tree | fe27e7572546f070aa16445aaaa5084d5f84a965 | |
parent | e1731d8790403a079613f291b4ac172d8f04c960 (diff) | |
download | kdepimpi-630904c92dc014538ff0b08731efb10dcc25426f.zip kdepimpi-630904c92dc014538ff0b08731efb10dcc25426f.tar.gz kdepimpi-630904c92dc014538ff0b08731efb10dcc25426f.tar.bz2 |
fixx
-rw-r--r-- | bin/kdepim/WhatsNew.txt | 6 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index d6b2dc7..79de197 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt | |||
@@ -1,236 +1,242 @@ | |||
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.1.14 ************ | ||
4 | |||
5 | Added some buttons to the KO/Pi Quick-todo line to make it possible to quickly access some todo view layout settings like display all flat/open/close and hide/show running/done. | ||
6 | Added a button to add a subtodo quickly. | ||
7 | |||
8 | |||
3 | ********** VERSION 2.1.13 ************ | 9 | ********** VERSION 2.1.13 ************ |
4 | 10 | ||
5 | Fixed a problem in KA/Pi search. | 11 | Fixed a problem in KA/Pi search. |
6 | Fixed some minor problems in KO/Pi. | 12 | Fixed some minor problems in KO/Pi. |
7 | Added calendar selection possibility to the todo view popup and to the event/todo/journal editor. | 13 | Added calendar selection possibility to the todo view popup and to the event/todo/journal editor. |
8 | 14 | ||
9 | Fixed memory usage problems in KA/Pi: | 15 | Fixed memory usage problems in KA/Pi: |
10 | When loading data KA/Pi did load the file data twice. | 16 | When loading data KA/Pi did load the file data twice. |
11 | Example: | 17 | Example: |
12 | A 600k file did consume 1200k memory during loading process. | 18 | A 600k file did consume 1200k memory during loading process. |
13 | This is fixed, it does now consume only 600k during loading process. | 19 | This is fixed, it does now consume only 600k during loading process. |
14 | When saving data KA/Pi did consume a lot of memory for the data parsing during the save process. | 20 | When saving data KA/Pi did consume a lot of memory for the data parsing during the save process. |
15 | This is fixed. | 21 | This is fixed. |
16 | Example: | 22 | Example: |
17 | Before saving a 600k file KA/Pi did consume 21.7 Meg of Ram. | 23 | Before saving a 600k file KA/Pi did consume 21.7 Meg of Ram. |
18 | When saving KA/Pi did consume 28.6 Meg of Ram. That causes a crash on the Zaurus because there was no memeory left in the system. | 24 | When saving KA/Pi did consume 28.6 Meg of Ram. That causes a crash on the Zaurus because there was no memeory left in the system. |
19 | Now KA/Pi is consuming on saving the same data 22.0 Meg of Ram during the save process. | 25 | Now KA/Pi is consuming on saving the same data 22.0 Meg of Ram during the save process. |
20 | Note: The memory usage of KA/Pi after the data is loaded/saved has not changed. | 26 | Note: The memory usage of KA/Pi after the data is loaded/saved has not changed. |
21 | The saving of data may be a bit slower now. | 27 | The saving of data may be a bit slower now. |
22 | 28 | ||
23 | Fixed memory usage problems in KO/Pi: | 29 | Fixed memory usage problems in KO/Pi: |
24 | When KO/Pi did save the data to file, it did not release the used buffers after saving. | 30 | When KO/Pi did save the data to file, it did not release the used buffers after saving. |
25 | The used buffer was released after saving the next time, but there was new buffer space allocated again on that save operation. | 31 | The used buffer was released after saving the next time, but there was new buffer space allocated again on that save operation. |
26 | This is fixed. | 32 | This is fixed. |
27 | Example: | 33 | Example: |
28 | When saving a 400k file KO/Pi do now use 400k less memory now. | 34 | When saving a 400k file KO/Pi do now use 400k less memory now. |
29 | 35 | ||
30 | Optimized memory usage in KO/Pi Agenda view: | 36 | Optimized memory usage in KO/Pi Agenda view: |
31 | KO/Pi is storing some paint information in extra buffers for faster repainting of the agenda view. | 37 | KO/Pi is storing some paint information in extra buffers for faster repainting of the agenda view. |
32 | These buffers were not made smaller (i.e. downsized) because of performance reasons. | 38 | These buffers were not made smaller (i.e. downsized) because of performance reasons. |
33 | The handling of these buffers are now much smarter: | 39 | The handling of these buffers are now much smarter: |
34 | Two (of six) buffers are removed completely. | 40 | Two (of six) buffers are removed completely. |
35 | The remaing four buffers are now downsized after not using the agenda view for 45 seconds. | 41 | The remaing four buffers are now downsized after not using the agenda view for 45 seconds. |
36 | Such that the memory usage of KO/Pi is smaller now in general ( because 2 buffers are removed) and is much smaller when not using the agenda view. That is very important when using fastload for KO/Pi. | 42 | Such that the memory usage of KO/Pi is smaller now in general ( because 2 buffers are removed) and is much smaller when not using the agenda view. That is very important when using fastload for KO/Pi. |
37 | 43 | ||
38 | Worst case example ( for a maximum size agenda content): | 44 | Worst case example ( for a maximum size agenda content): |
39 | When resizing the agenda content to a large scale, KO/Pi did use 17Meg of mem ( and did not use less memory until it was stopped). Now KO/Pi is using on the same operation only 14.3 Meg of mem and after 45 seconds not using the agenda view it uses only 9.4 Meg of mem. | 45 | When resizing the agenda content to a large scale, KO/Pi did use 17Meg of mem ( and did not use less memory until it was stopped). Now KO/Pi is using on the same operation only 14.3 Meg of mem and after 45 seconds not using the agenda view it uses only 9.4 Meg of mem. |
40 | 46 | ||
41 | When switching to an unused Agenda view now KO/Pi is upizing the buffers again. This takes less than a second. Such that switching to Agenda view (after not using it for more than 45 seconds) is now a bit slower. | 47 | When switching to an unused Agenda view now KO/Pi is upizing the buffers again. This takes less than a second. Such that switching to Agenda view (after not using it for more than 45 seconds) is now a bit slower. |
42 | 48 | ||
43 | Summary: | 49 | Summary: |
44 | Many memory wasting problems of KA/Pi and KO/Pi fixed such that it is better to use on the Zaurus. | 50 | Many memory wasting problems of KA/Pi and KO/Pi fixed such that it is better to use on the Zaurus. |
45 | 51 | ||
46 | ********** VERSION 2.1.12 ************ | 52 | ********** VERSION 2.1.12 ************ |
47 | 53 | ||
48 | KO/Pi: | 54 | KO/Pi: |
49 | Many small usability fixes, e.g. rearranged the popup menus such that they are better to use on the Zaurus. | 55 | Many small usability fixes, e.g. rearranged the popup menus such that they are better to use on the Zaurus. |
50 | Fixed a problem with the month view when file was saved but KO/Pi was not the active window. | 56 | Fixed a problem with the month view when file was saved but KO/Pi was not the active window. |
51 | Fixed some problems in the resource config dialog (e.g. added a warning if you set all calendars to read-only). | 57 | Fixed some problems in the resource config dialog (e.g. added a warning if you set all calendars to read-only). |
52 | Fixed some other small problems. | 58 | Fixed some other small problems. |
53 | 59 | ||
54 | ********** VERSION 2.1.11 ************ | 60 | ********** VERSION 2.1.11 ************ |
55 | 61 | ||
56 | KO/Pi: | 62 | KO/Pi: |
57 | Because we can have many calendars now in KO/Pi we can have more than one journal entry per day. | 63 | Because we can have many calendars now in KO/Pi we can have more than one journal entry per day. |
58 | Added features to handle (and add ) more than one journal entry per day. | 64 | Added features to handle (and add ) more than one journal entry per day. |
59 | Added option for a journal title. | 65 | Added option for a journal title. |
60 | 66 | ||
61 | Added info about the calendar, the item belongs to, to the event/todo/journal viewer. | 67 | Added info about the calendar, the item belongs to, to the event/todo/journal viewer. |
62 | Fixed a problem of the alarm of completed recurring todos. | 68 | Fixed a problem of the alarm of completed recurring todos. |
63 | Added to the event/todo editor to set quickly the category of an item. | 69 | Added to the event/todo editor to set quickly the category of an item. |
64 | 70 | ||
65 | 71 | ||
66 | Fixed some problems when calling KO/Pi or KA/Pi from the alarm applet. | 72 | Fixed some problems when calling KO/Pi or KA/Pi from the alarm applet. |
67 | 73 | ||
68 | Added KA/Pi multi sync to the multi sync called from the alarm applet. | 74 | Added KA/Pi multi sync to the multi sync called from the alarm applet. |
69 | 75 | ||
70 | ********** VERSION 2.1.10 ************ | 76 | ********** VERSION 2.1.10 ************ |
71 | 77 | ||
72 | KO/Pi: | 78 | KO/Pi: |
73 | Importing Birthdays will now create another file resource "Birthdays" and import the birthday data from KA/Pi into that file. | 79 | Importing Birthdays will now create another file resource "Birthdays" and import the birthday data from KA/Pi into that file. |
74 | When a multidayevent is selected in monthview all occurences of this event in the monthview are now hightlighted. | 80 | When a multidayevent is selected in monthview all occurences of this event in the monthview are now hightlighted. |
75 | Fixed a bug in searching for a small timerange, i.e. one day. | 81 | Fixed a bug in searching for a small timerange, i.e. one day. |
76 | 82 | ||
77 | KA/Pi: | 83 | KA/Pi: |
78 | Fixed two problems in csv export. | 84 | Fixed two problems in csv export. |
79 | Fixed problems when calling the contact selection dialog from KO/Pi or OM/Pi. | 85 | Fixed problems when calling the contact selection dialog from KO/Pi or OM/Pi. |
80 | 86 | ||
81 | ********** VERSION 2.1.9 ************ | 87 | ********** VERSION 2.1.9 ************ |
82 | 88 | ||
83 | KO/Pi: | 89 | KO/Pi: |
84 | Fixed some problems of the new search options in the search dialog. | 90 | Fixed some problems of the new search options in the search dialog. |
85 | Fixed some problems in the new resource config options. | 91 | Fixed some problems in the new resource config options. |
86 | Changed the recurrence edit of events and todos such that the recurrence edit page now is notified about a change of the start date on the first page. | 92 | Changed the recurrence edit of events and todos such that the recurrence edit page now is notified about a change of the start date on the first page. |
87 | Fixed a problem creating new events in the agenda view if at the day/time is already an agenda item shown: | 93 | Fixed a problem creating new events in the agenda view if at the day/time is already an agenda item shown: |
88 | Now you can click on the bottom/top of an allday agenda item or on the left/right side of an agenda item to get the "new todo/new event" popup. | 94 | Now you can click on the bottom/top of an allday agenda item or on the left/right side of an agenda item to get the "new todo/new event" popup. |
89 | 95 | ||
90 | Fixed a problem in recurrence range in syncing with DTM. | 96 | Fixed a problem in recurrence range in syncing with DTM. |
91 | 97 | ||
92 | KA/Pi: | 98 | KA/Pi: |
93 | Made it posiible to show in the contact overview the details of all data available for that contact( e.g. office, spouse, children, nickname ...) | 99 | Made it posiible to show in the contact overview the details of all data available for that contact( e.g. office, spouse, children, nickname ...) |
94 | 100 | ||
95 | PwM/Pi: | 101 | PwM/Pi: |
96 | Added "sec" to the timeout config settings to make it clear the timeout values are seconds. | 102 | Added "sec" to the timeout config settings to make it clear the timeout values are seconds. |
97 | 103 | ||
98 | ********** VERSION 2.1.8 ************ | 104 | ********** VERSION 2.1.8 ************ |
99 | 105 | ||
100 | KO/Pi: | 106 | KO/Pi: |
101 | Added info about the completion state of a todo in the ListView/Searchdialog. | 107 | Added info about the completion state of a todo in the ListView/Searchdialog. |
102 | If in TodoView is selected "do not show compledted todos" then completed todos are not shown in the ListView as well. | 108 | If in TodoView is selected "do not show compledted todos" then completed todos are not shown in the ListView as well. |
103 | Fixed some updating problems when changing the filter. | 109 | Fixed some updating problems when changing the filter. |
104 | 110 | ||
105 | KA/Pi: | 111 | KA/Pi: |
106 | In the addressee selection dialog now the formatted name is shown, if not empty. | 112 | In the addressee selection dialog now the formatted name is shown, if not empty. |
107 | Added a column "category" to the addressee selection dialog to make it possible to sort addressees after category. | 113 | Added a column "category" to the addressee selection dialog to make it possible to sort addressees after category. |
108 | Now in the addressee selection dialog a selected contact is remove with a single click from the selected list. | 114 | Now in the addressee selection dialog a selected contact is remove with a single click from the selected list. |
109 | 115 | ||
110 | Fixed in the file selector on the Zaurus the problem that symbolic links to files/dirs were ignored. | 116 | Fixed in the file selector on the Zaurus the problem that symbolic links to files/dirs were ignored. |
111 | Fixed the sorting for size in the file selector on the Z. | 117 | Fixed the sorting for size in the file selector on the Z. |
112 | 118 | ||
113 | Changed the color selection dialog on the Zaurus to a more user friendly version. | 119 | Changed the color selection dialog on the Zaurus to a more user friendly version. |
114 | 120 | ||
115 | ********** VERSION 2.1.7 ************ | 121 | ********** VERSION 2.1.7 ************ |
116 | 122 | ||
117 | KO/Pi: | 123 | KO/Pi: |
118 | Fixed several problems in the new Resource handling. | 124 | Fixed several problems in the new Resource handling. |
119 | Added more options to the search dialog. | 125 | Added more options to the search dialog. |
120 | Fixed a problem in the Month view. | 126 | Fixed a problem in the Month view. |
121 | Added more options to the dialog when setting a todo to stopped. | 127 | Added more options to the dialog when setting a todo to stopped. |
122 | 128 | ||
123 | Fixed two small problems in KO/Pi Alarm applet. | 129 | Fixed two small problems in KO/Pi Alarm applet. |
124 | 130 | ||
125 | ********** VERSION 2.1.6 ************ | 131 | ********** VERSION 2.1.6 ************ |
126 | 132 | ||
127 | This release is for testing only. | 133 | This release is for testing only. |
128 | 134 | ||
129 | KO/Pi: | 135 | KO/Pi: |
130 | Added to the list view (the list view is used in search dialog as well) the possibility to print it. | 136 | Added to the list view (the list view is used in search dialog as well) the possibility to print it. |
131 | Added to the list view the possibility to hide entries, if you do not want to print all entries of the list view. | 137 | Added to the list view the possibility to hide entries, if you do not want to print all entries of the list view. |
132 | Added to the list view the possibility to add all subtodos of selected todos to an export/beam. | 138 | Added to the list view the possibility to add all subtodos of selected todos to an export/beam. |
133 | Added to the search dialog the possibility to make an additive search such that you can get a better list for export/printout. | 139 | Added to the search dialog the possibility to make an additive search such that you can get a better list for export/printout. |
134 | Added to the search dialog the possibility to hide the checkboxes such that there is more space for the list view on the Zaurus. | 140 | Added to the search dialog the possibility to hide the checkboxes such that there is more space for the list view on the Zaurus. |
135 | Fixed a problem in the AlarmTimer Applet: Now utf8 messages are displayed properly. | 141 | Fixed a problem in the AlarmTimer Applet: Now utf8 messages are displayed properly. |
136 | 142 | ||
137 | Added support for multiple calendar files in KO/Pi. Only local ical (*.ics) files are supported as calendars. | 143 | Added support for multiple calendar files in KO/Pi. Only local ical (*.ics) files are supported as calendars. |
138 | In the sync profile config it is still missing to specify a particular calendar to sync with this profile. That setting will be added later. | 144 | In the sync profile config it is still missing to specify a particular calendar to sync with this profile. That setting will be added later. |
139 | Now on every sync the set of calendars is synced which are enabled in the resource view. | 145 | Now on every sync the set of calendars is synced which are enabled in the resource view. |
140 | 146 | ||
141 | A calendar is enabled in the resource view if the "eye" column is checked. | 147 | A calendar is enabled in the resource view if the "eye" column is checked. |
142 | You can set a calendar to be the default for new items( "+" column ). | 148 | You can set a calendar to be the default for new items( "+" column ). |
143 | You can tell KO/Pi to ignore all alarm of a calendar ( "bell" column ) and you can set it readonly. | 149 | You can tell KO/Pi to ignore all alarm of a calendar ( "bell" column ) and you can set it readonly. |
144 | To find out how to add a new calendar and how to remove a calendar is left as an exercise to the reader ... | 150 | To find out how to add a new calendar and how to remove a calendar is left as an exercise to the reader ... |
145 | 151 | ||
146 | 152 | ||
147 | ********** VERSION 2.1.5 ************ | 153 | ********** VERSION 2.1.5 ************ |
148 | 154 | ||
149 | This is the new stable version. | 155 | This is the new stable version. |
150 | Bugfix: | 156 | Bugfix: |
151 | Fixed a problem with agenda popup on the desktop in KO/Pi. | 157 | Fixed a problem with agenda popup on the desktop in KO/Pi. |
152 | Fixed a crash when reloading file, e.g. after a passive pi-sync synchronization. | 158 | Fixed a crash when reloading file, e.g. after a passive pi-sync synchronization. |
153 | Added config option to not display completed todos in agenda view. | 159 | Added config option to not display completed todos in agenda view. |
154 | Addressee view is now using the formatted name, if defined. | 160 | Addressee view is now using the formatted name, if defined. |
155 | That makes it possible to display "lastname, firstname" in that view now. | 161 | That makes it possible to display "lastname, firstname" in that view now. |
156 | To set the formatted name for all contacts, please use menu: | 162 | To set the formatted name for all contacts, please use menu: |
157 | Edit->Change->Set formatted name. | 163 | Edit->Change->Set formatted name. |
158 | Fixed the bug in KA/Pi that is was not possible to add images to a contact on Windows. | 164 | Fixed the bug in KA/Pi that is was not possible to add images to a contact on Windows. |
159 | 165 | ||
160 | ********** VERSION 2.1.4 ************ | 166 | ********** VERSION 2.1.4 ************ |
161 | 167 | ||
162 | Fixed two more bugs in the KA/Pi CSV import dialog: | 168 | Fixed two more bugs in the KA/Pi CSV import dialog: |
163 | Made it possible to read multi-line fields and import it to the "Note" field. | 169 | Made it possible to read multi-line fields and import it to the "Note" field. |
164 | Fixed a problem in mapping custom fields, whatever a custem field is... | 170 | Fixed a problem in mapping custom fields, whatever a custem field is... |
165 | 171 | ||
166 | ********** VERSION 2.1.3 ************ | 172 | ********** VERSION 2.1.3 ************ |
167 | 173 | ||
168 | Changed the menu structure of the alarm applet: | 174 | Changed the menu structure of the alarm applet: |
169 | Moved "Simulate" to " Play Beeps" submenu and re-added "Todo List". | 175 | Moved "Simulate" to " Play Beeps" submenu and re-added "Todo List". |
170 | 176 | ||
171 | Fixed several problems in the KA/Pi CSV import dialog: | 177 | Fixed several problems in the KA/Pi CSV import dialog: |
172 | Added "Category", made codec configureable and made it possible to map many fields to the "Note" field. | 178 | Added "Category", made codec configureable and made it possible to map many fields to the "Note" field. |
173 | 179 | ||
174 | 180 | ||
175 | ********** VERSION 2.1.2 ************ | 181 | ********** VERSION 2.1.2 ************ |
176 | 182 | ||
177 | Fixed a problem closing the alarm dialog on Zaurus with "OK" button. | 183 | Fixed a problem closing the alarm dialog on Zaurus with "OK" button. |
178 | 184 | ||
179 | Fixed a problem when importing data from Outlook with mutiple categories set. | 185 | Fixed a problem when importing data from Outlook with mutiple categories set. |
180 | 186 | ||
181 | Changed display of days in datenavigator: | 187 | Changed display of days in datenavigator: |
182 | Birthdays are now blue, not dark green. | 188 | Birthdays are now blue, not dark green. |
183 | When todo view is shown, no birtdays are shown and days with due todos are shown blue. | 189 | When todo view is shown, no birtdays are shown and days with due todos are shown blue. |
184 | When journal view is shown, only holidays are shown and days with journals are blue. | 190 | When journal view is shown, only holidays are shown and days with journals are blue. |
185 | 191 | ||
186 | Added Backup options to global config: | 192 | Added Backup options to global config: |
187 | You can create now x-daily backups for KO/Pi, KA/Pi (for file resources only, file resource is the standard type) and PwM/Pi ( all files you will open ). | 193 | You can create now x-daily backups for KO/Pi, KA/Pi (for file resources only, file resource is the standard type) and PwM/Pi ( all files you will open ). |
188 | It is recommended to use another HDD/Memory card for the backup directory. If (very useful on the Zaurus) the specified backup directory does not exist you are asked if you want to try again to create a backup. That makes it possible to insert your memory card in the Zaurus and then trying again. | 194 | It is recommended to use another HDD/Memory card for the backup directory. If (very useful on the Zaurus) the specified backup directory does not exist you are asked if you want to try again to create a backup. That makes it possible to insert your memory card in the Zaurus and then trying again. |
189 | The backup is created when the application wants to save for the first time on a backup-day. You can specify the amount of backups and the day interval of backups. | 195 | The backup is created when the application wants to save for the first time on a backup-day. You can specify the amount of backups and the day interval of backups. |
190 | 196 | ||
191 | ********** VERSION 2.1.1 ************ | 197 | ********** VERSION 2.1.1 ************ |
192 | 198 | ||
193 | Stable release 2.1.1! | 199 | Stable release 2.1.1! |
194 | 200 | ||
195 | KO/Pi: | 201 | KO/Pi: |
196 | Fixed one problem in the layout of the edit dialogs on the Zaurus with 640x480 display. | 202 | Fixed one problem in the layout of the edit dialogs on the Zaurus with 640x480 display. |
197 | 203 | ||
198 | ********** VERSION 2.1.0 ************ | 204 | ********** VERSION 2.1.0 ************ |
199 | 205 | ||
200 | Stable release 2.1.0! | 206 | Stable release 2.1.0! |
201 | 207 | ||
202 | Summary of changes/fixes compared to version 2.0.6: | 208 | Summary of changes/fixes compared to version 2.0.6: |
203 | 209 | ||
204 | Many bugs of version 2.0.6 fixed. | 210 | Many bugs of version 2.0.6 fixed. |
205 | Most of them were small bugs, but some of them were important. | 211 | Most of them were small bugs, but some of them were important. |
206 | It is recommended to use version 2.1.0 and not version 2.0.6. | 212 | It is recommended to use version 2.1.0 and not version 2.0.6. |
207 | 213 | ||
208 | Important changes: | 214 | Important changes: |
209 | 215 | ||
210 | Added recurring todos to KO/Pi. | 216 | Added recurring todos to KO/Pi. |
211 | 217 | ||
212 | Added global application font settings (for all KDE-Pim/Pi apps) to the general settings. | 218 | Added global application font settings (for all KDE-Pim/Pi apps) to the general settings. |
213 | 219 | ||
214 | Made Passwordmanager PwM/Pi more userfriendly: Rearranged some toolbar icons, optimized setting of focus, fixed layout problems and more. | 220 | Made Passwordmanager PwM/Pi more userfriendly: Rearranged some toolbar icons, optimized setting of focus, fixed layout problems and more. |
215 | 221 | ||
216 | Datenavigator can now display many months. Very useful on the desktop. | 222 | Datenavigator can now display many months. Very useful on the desktop. |
217 | 223 | ||
218 | KO/Pi alarm applet changed: Made buttons in alarm dialog much bigger and other usebility enhancements. | 224 | KO/Pi alarm applet changed: Made buttons in alarm dialog much bigger and other usebility enhancements. |
219 | 225 | ||
220 | Made alarm sound working on Linux desktop. | 226 | Made alarm sound working on Linux desktop. |
221 | 227 | ||
222 | Made KO/Pi and KA/Pi running from a memory stick. Please read storage HowTo for details. | 228 | Made KO/Pi and KA/Pi running from a memory stick. Please read storage HowTo for details. |
223 | 229 | ||
224 | Added timetracking feature in KO/Pi todo view. Please read timetraker HowTo for details. | 230 | Added timetracking feature in KO/Pi todo view. Please read timetraker HowTo for details. |
225 | 231 | ||
226 | Many other usebility enhancements. | 232 | Many other usebility enhancements. |
227 | Special thanks to Ben for his suggestions! | 233 | Special thanks to Ben for his suggestions! |
228 | 234 | ||
229 | You can find the complete changelog | 235 | You can find the complete changelog |
230 | from version 1.7.7 to 2.1.0 | 236 | from version 1.7.7 to 2.1.0 |
231 | in the source package or on | 237 | in the source package or on |
232 | 238 | ||
233 | http://www.pi-sync.net/html/changelog.html | 239 | http://www.pi-sync.net/html/changelog.html |
234 | 240 | ||
235 | 241 | ||
236 | 242 | ||
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index c23a8ee..06d40b1 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -1,1691 +1,1693 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qlayout.h> | 24 | #include <qlayout.h> |
25 | #include <qheader.h> | 25 | #include <qheader.h> |
26 | #include <qcursor.h> | 26 | #include <qcursor.h> |
27 | #include <qwhatsthis.h> | 27 | #include <qwhatsthis.h> |
28 | #include <qdialog.h> | 28 | #include <qdialog.h> |
29 | #include <qlabel.h> | 29 | #include <qlabel.h> |
30 | #include <qpushbutton.h> | 30 | #include <qpushbutton.h> |
31 | 31 | ||
32 | #include <qinputdialog.h> | 32 | #include <qinputdialog.h> |
33 | 33 | ||
34 | #include <qvbox.h> | 34 | #include <qvbox.h> |
35 | #include <kdebug.h> | 35 | #include <kdebug.h> |
36 | #include "koprefs.h" | 36 | #include "koprefs.h" |
37 | #include <klocale.h> | 37 | #include <klocale.h> |
38 | #include <kglobal.h> | 38 | #include <kglobal.h> |
39 | #include <kdateedit.h> | 39 | #include <kdateedit.h> |
40 | #include "ktimeedit.h" | 40 | #include "ktimeedit.h" |
41 | #include <kiconloader.h> | 41 | #include <kiconloader.h> |
42 | #include <kmessagebox.h> | 42 | #include <kmessagebox.h> |
43 | 43 | ||
44 | #include <libkcal/icaldrag.h> | 44 | #include <libkcal/icaldrag.h> |
45 | #include <libkcal/vcaldrag.h> | 45 | #include <libkcal/vcaldrag.h> |
46 | #include <libkcal/calfilter.h> | 46 | #include <libkcal/calfilter.h> |
47 | #include <libkcal/dndfactory.h> | 47 | #include <libkcal/dndfactory.h> |
48 | #include <libkcal/calendarresources.h> | 48 | #include <libkcal/calendarresources.h> |
49 | #include <libkcal/resourcecalendar.h> | 49 | #include <libkcal/resourcecalendar.h> |
50 | #include <kresources/resourceselectdialog.h> | 50 | #include <kresources/resourceselectdialog.h> |
51 | #include <libkcal/kincidenceformatter.h> | 51 | #include <libkcal/kincidenceformatter.h> |
52 | #ifndef DESKTOP_VERSION | 52 | #ifndef DESKTOP_VERSION |
53 | #include <qpe/qpeapplication.h> | 53 | #include <qpe/qpeapplication.h> |
54 | #else | 54 | #else |
55 | #include <qapplication.h> | 55 | #include <qapplication.h> |
56 | #endif | 56 | #endif |
57 | #ifndef KORG_NOPRINTER | 57 | #ifndef KORG_NOPRINTER |
58 | #include "calprinter.h" | 58 | #include "calprinter.h" |
59 | #endif | 59 | #endif |
60 | #include "docprefs.h" | 60 | #include "docprefs.h" |
61 | 61 | ||
62 | #include "kotodoview.h" | 62 | #include "kotodoview.h" |
63 | using namespace KOrg; | 63 | using namespace KOrg; |
64 | 64 | ||
65 | 65 | ||
66 | KOStartTodoPrefs::KOStartTodoPrefs( QString sum, QWidget *parent, const char *name ) : | 66 | KOStartTodoPrefs::KOStartTodoPrefs( QString sum, QWidget *parent, const char *name ) : |
67 | QDialog( parent, name, true ) | 67 | QDialog( parent, name, true ) |
68 | { | 68 | { |
69 | mStopAll = true; | 69 | mStopAll = true; |
70 | setCaption( i18n("Start todo") ); | 70 | setCaption( i18n("Start todo") ); |
71 | QVBoxLayout* lay = new QVBoxLayout( this ); | 71 | QVBoxLayout* lay = new QVBoxLayout( this ); |
72 | lay->setSpacing( 3 ); | 72 | lay->setSpacing( 3 ); |
73 | lay->setMargin( 3 ); | 73 | lay->setMargin( 3 ); |
74 | QLabel * lab = new QLabel( i18n("<b>%1\n</b>").arg( sum ), this ); | 74 | QLabel * lab = new QLabel( i18n("<b>%1\n</b>").arg( sum ), this ); |
75 | lay->addWidget( lab ); | 75 | lay->addWidget( lab ); |
76 | lab->setAlignment( AlignCenter ); | 76 | lab->setAlignment( AlignCenter ); |
77 | 77 | ||
78 | QPushButton * ok = new QPushButton( i18n("Start this todo\nand stop all running"), this ); | 78 | QPushButton * ok = new QPushButton( i18n("Start this todo\nand stop all running"), this ); |
79 | lay->addWidget( ok ); | 79 | lay->addWidget( ok ); |
80 | ok->setDefault( true ); | 80 | ok->setDefault( true ); |
81 | QPushButton * start = new QPushButton( i18n("Start todo"), this ); | 81 | QPushButton * start = new QPushButton( i18n("Start todo"), this ); |
82 | lay->addWidget( start ); | 82 | lay->addWidget( start ); |
83 | QPushButton * cancel = new QPushButton( i18n("Cancel - do not start"), this ); | 83 | QPushButton * cancel = new QPushButton( i18n("Cancel - do not start"), this ); |
84 | lay->addWidget( cancel ); | 84 | lay->addWidget( cancel ); |
85 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 85 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
86 | connect ( start,SIGNAL(clicked() ),this , SLOT ( doStop() ) ); | 86 | connect ( start,SIGNAL(clicked() ),this , SLOT ( doStop() ) ); |
87 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 87 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
88 | resize( sizeHint() ); | 88 | resize( sizeHint() ); |
89 | 89 | ||
90 | } | 90 | } |
91 | void KOStartTodoPrefs::doStop() | 91 | void KOStartTodoPrefs::doStop() |
92 | { | 92 | { |
93 | mStopAll = false; | 93 | mStopAll = false; |
94 | accept(); | 94 | accept(); |
95 | } | 95 | } |
96 | KOStopTodoPrefs::KOStopTodoPrefs( Todo* todo, QWidget *parent, const char *name ) : | 96 | KOStopTodoPrefs::KOStopTodoPrefs( Todo* todo, QWidget *parent, const char *name ) : |
97 | QDialog( parent, name, true ) | 97 | QDialog( parent, name, true ) |
98 | { | 98 | { |
99 | mTodo = todo; | 99 | mTodo = todo; |
100 | setCaption( i18n("Stop todo") ); | 100 | setCaption( i18n("Stop todo") ); |
101 | QVBoxLayout* lay = new QVBoxLayout( this ); | 101 | QVBoxLayout* lay = new QVBoxLayout( this ); |
102 | lay->setSpacing( 3 ); | 102 | lay->setSpacing( 3 ); |
103 | lay->setMargin( 3 ); | 103 | lay->setMargin( 3 ); |
104 | QLabel * lab = new QLabel( i18n("<b>%1\n</b>").arg( todo->summary() ), this ); | 104 | QLabel * lab = new QLabel( i18n("<b>%1\n</b>").arg( todo->summary() ), this ); |
105 | lay->addWidget( lab ); | 105 | lay->addWidget( lab ); |
106 | lab->setAlignment( AlignHCenter ); | 106 | lab->setAlignment( AlignHCenter ); |
107 | lab = new QLabel( i18n("Additional Comment:"), this ); | 107 | lab = new QLabel( i18n("Additional Comment:"), this ); |
108 | lay->addWidget( lab ); | 108 | lay->addWidget( lab ); |
109 | mComment = new QLineEdit( this ); | 109 | mComment = new QLineEdit( this ); |
110 | lay->addWidget( mComment ); | 110 | lay->addWidget( mComment ); |
111 | QHBox * start = new QHBox ( this ); | 111 | QHBox * start = new QHBox ( this ); |
112 | lay->addWidget( start ); | 112 | lay->addWidget( start ); |
113 | lab = new QLabel( i18n("Start:"), start ); | 113 | lab = new QLabel( i18n("Start:"), start ); |
114 | QHBox * end = new QHBox ( this ); | 114 | QHBox * end = new QHBox ( this ); |
115 | lay->addWidget( end ); | 115 | lay->addWidget( end ); |
116 | lab = new QLabel( i18n("End:"), end ); | 116 | lab = new QLabel( i18n("End:"), end ); |
117 | sde = new KDateEdit( start ); | 117 | sde = new KDateEdit( start ); |
118 | ste = new KOTimeEdit( start ); | 118 | ste = new KOTimeEdit( start ); |
119 | connect ( sde,SIGNAL(setTimeTo( QTime ) ),ste , SLOT ( setTime(QTime ) ) ); | 119 | connect ( sde,SIGNAL(setTimeTo( QTime ) ),ste , SLOT ( setTime(QTime ) ) ); |
120 | ede = new KDateEdit( end ); | 120 | ede = new KDateEdit( end ); |
121 | ete = new KOTimeEdit(end ); | 121 | ete = new KOTimeEdit(end ); |
122 | connect ( ede,SIGNAL(setTimeTo( QTime ) ),ete , SLOT ( setTime(QTime ) ) ); | 122 | connect ( ede,SIGNAL(setTimeTo( QTime ) ),ete , SLOT ( setTime(QTime ) ) ); |
123 | sde->setDate( mTodo->runStart().date() ); | 123 | sde->setDate( mTodo->runStart().date() ); |
124 | ste->setTime( mTodo->runStart().time() ); | 124 | ste->setTime( mTodo->runStart().time() ); |
125 | ede->setDate( QDate::currentDate()); | 125 | ede->setDate( QDate::currentDate()); |
126 | ete->setTime( QTime::currentTime() ); | 126 | ete->setTime( QTime::currentTime() ); |
127 | QPushButton * ok = new QPushButton( i18n("Stop and save"), this ); | 127 | QPushButton * ok = new QPushButton( i18n("Stop and save"), this ); |
128 | lay->addWidget( ok ); | 128 | lay->addWidget( ok ); |
129 | ok->setDefault( true ); | 129 | ok->setDefault( true ); |
130 | QPushButton * cancel = new QPushButton( i18n("Continue running"), this ); | 130 | QPushButton * cancel = new QPushButton( i18n("Continue running"), this ); |
131 | lay->addWidget( cancel ); | 131 | lay->addWidget( cancel ); |
132 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 132 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
133 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 133 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
134 | ok = new QPushButton( i18n("Stop - do not save"), this ); | 134 | ok = new QPushButton( i18n("Stop - do not save"), this ); |
135 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( doNotSave() ) ); | 135 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( doNotSave() ) ); |
136 | lay->addWidget( ok ); | 136 | lay->addWidget( ok ); |
137 | if (QApplication::desktop()->width() < 320 ) | 137 | if (QApplication::desktop()->width() < 320 ) |
138 | resize( 240, sizeHint().height() ); | 138 | resize( 240, sizeHint().height() ); |
139 | else | 139 | else |
140 | resize( 320, sizeHint().height() ); | 140 | resize( 320, sizeHint().height() ); |
141 | 141 | ||
142 | } | 142 | } |
143 | 143 | ||
144 | void KOStopTodoPrefs::accept() | 144 | void KOStopTodoPrefs::accept() |
145 | { | 145 | { |
146 | QDateTime start = QDateTime( sde->date(), ste->getTime() ); | 146 | QDateTime start = QDateTime( sde->date(), ste->getTime() ); |
147 | QDateTime stop = QDateTime( ede->date(), ete->getTime() ); | 147 | QDateTime stop = QDateTime( ede->date(), ete->getTime() ); |
148 | if ( start > stop ) { | 148 | if ( start > stop ) { |
149 | KMessageBox::sorry(this, | 149 | KMessageBox::sorry(this, |
150 | i18n("The start time is\nafter the end time!"), | 150 | i18n("The start time is\nafter the end time!"), |
151 | i18n("Time mismatch!")); | 151 | i18n("Time mismatch!")); |
152 | return; | 152 | return; |
153 | } | 153 | } |
154 | mTodo->saveRunningInfo( mComment->text(), start, stop ); | 154 | mTodo->saveRunningInfo( mComment->text(), start, stop ); |
155 | QDialog::accept(); | 155 | QDialog::accept(); |
156 | } | 156 | } |
157 | void KOStopTodoPrefs::doNotSave() | 157 | void KOStopTodoPrefs::doNotSave() |
158 | { | 158 | { |
159 | int result = KMessageBox::warningContinueCancel(this, | 159 | int result = KMessageBox::warningContinueCancel(this, |
160 | i18n("Do you really want to set\nthe state to stopped\nwithout saving the data?"),mTodo->summary(),i18n("Yes, stop todo") ); | 160 | i18n("Do you really want to set\nthe state to stopped\nwithout saving the data?"),mTodo->summary(),i18n("Yes, stop todo") ); |
161 | if (result != KMessageBox::Continue) return; | 161 | if (result != KMessageBox::Continue) return; |
162 | mTodo->stopRunning(); | 162 | mTodo->stopRunning(); |
163 | QDialog::accept(); | 163 | QDialog::accept(); |
164 | } | 164 | } |
165 | 165 | ||
166 | 166 | ||
167 | class KOTodoViewWhatsThis :public QWhatsThis | 167 | class KOTodoViewWhatsThis :public QWhatsThis |
168 | { | 168 | { |
169 | public: | 169 | public: |
170 | KOTodoViewWhatsThis( QWidget *wid, KOTodoView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; | 170 | KOTodoViewWhatsThis( QWidget *wid, KOTodoView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; |
171 | 171 | ||
172 | protected: | 172 | protected: |
173 | virtual QString text( const QPoint& p) | 173 | virtual QString text( const QPoint& p) |
174 | { | 174 | { |
175 | return _view->getWhatsThisText(p) ; | 175 | return _view->getWhatsThisText(p) ; |
176 | } | 176 | } |
177 | private: | 177 | private: |
178 | QWidget* _wid; | 178 | QWidget* _wid; |
179 | KOTodoView * _view; | 179 | KOTodoView * _view; |
180 | }; | 180 | }; |
181 | 181 | ||
182 | KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent, | 182 | KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent, |
183 | const char *name) : | 183 | const char *name) : |
184 | KListView(parent,name) | 184 | KListView(parent,name) |
185 | { | 185 | { |
186 | mName = QString ( name ); | 186 | mName = QString ( name ); |
187 | mCalendar = calendar; | 187 | mCalendar = calendar; |
188 | #ifndef DESKTOP_VERSION | 188 | #ifndef DESKTOP_VERSION |
189 | QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); | 189 | QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); |
190 | #endif | 190 | #endif |
191 | mOldCurrent = 0; | 191 | mOldCurrent = 0; |
192 | mMousePressed = false; | 192 | mMousePressed = false; |
193 | 193 | ||
194 | setAcceptDrops(true); | 194 | setAcceptDrops(true); |
195 | viewport()->setAcceptDrops(true); | 195 | viewport()->setAcceptDrops(true); |
196 | int size = 16; | 196 | int size = 16; |
197 | if (qApp->desktop()->width() < 300 ) | 197 | if (qApp->desktop()->width() < 300 ) |
198 | size = 12; | 198 | size = 12; |
199 | setTreeStepSize( size + 6 ); | 199 | setTreeStepSize( size + 6 ); |
200 | 200 | ||
201 | } | 201 | } |
202 | 202 | ||
203 | void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e) | 203 | void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e) |
204 | { | 204 | { |
205 | #ifndef KORG_NODND | 205 | #ifndef KORG_NODND |
206 | // kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl; | 206 | // kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl; |
207 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && | 207 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && |
208 | !QTextDrag::canDecode( e ) ) { | 208 | !QTextDrag::canDecode( e ) ) { |
209 | e->ignore(); | 209 | e->ignore(); |
210 | return; | 210 | return; |
211 | } | 211 | } |
212 | 212 | ||
213 | mOldCurrent = currentItem(); | 213 | mOldCurrent = currentItem(); |
214 | #endif | 214 | #endif |
215 | } | 215 | } |
216 | 216 | ||
217 | 217 | ||
218 | void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e) | 218 | void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e) |
219 | { | 219 | { |
220 | #ifndef KORG_NODND | 220 | #ifndef KORG_NODND |
221 | // kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl; | 221 | // kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl; |
222 | 222 | ||
223 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && | 223 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && |
224 | !QTextDrag::canDecode( e ) ) { | 224 | !QTextDrag::canDecode( e ) ) { |
225 | e->ignore(); | 225 | e->ignore(); |
226 | return; | 226 | return; |
227 | } | 227 | } |
228 | 228 | ||
229 | e->accept(); | 229 | e->accept(); |
230 | #endif | 230 | #endif |
231 | } | 231 | } |
232 | 232 | ||
233 | void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *) | 233 | void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *) |
234 | { | 234 | { |
235 | #ifndef KORG_NODND | 235 | #ifndef KORG_NODND |
236 | // kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl; | 236 | // kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl; |
237 | 237 | ||
238 | setCurrentItem(mOldCurrent); | 238 | setCurrentItem(mOldCurrent); |
239 | setSelected(mOldCurrent,true); | 239 | setSelected(mOldCurrent,true); |
240 | #endif | 240 | #endif |
241 | } | 241 | } |
242 | 242 | ||
243 | void KOTodoListView::contentsDropEvent(QDropEvent *e) | 243 | void KOTodoListView::contentsDropEvent(QDropEvent *e) |
244 | { | 244 | { |
245 | #ifndef KORG_NODND | 245 | #ifndef KORG_NODND |
246 | // kdDebug() << "KOTodoListView::contentsDropEvent" << endl; | 246 | // kdDebug() << "KOTodoListView::contentsDropEvent" << endl; |
247 | 247 | ||
248 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && | 248 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && |
249 | !QTextDrag::canDecode( e ) ) { | 249 | !QTextDrag::canDecode( e ) ) { |
250 | e->ignore(); | 250 | e->ignore(); |
251 | return; | 251 | return; |
252 | } | 252 | } |
253 | 253 | ||
254 | DndFactory factory( mCalendar ); | 254 | DndFactory factory( mCalendar ); |
255 | Todo *todo = factory.createDropTodo(e); | 255 | Todo *todo = factory.createDropTodo(e); |
256 | 256 | ||
257 | if (todo) { | 257 | if (todo) { |
258 | e->acceptAction(); | 258 | e->acceptAction(); |
259 | 259 | ||
260 | KOTodoViewItem *destination = | 260 | KOTodoViewItem *destination = |
261 | (KOTodoViewItem *)itemAt(contentsToViewport(e->pos())); | 261 | (KOTodoViewItem *)itemAt(contentsToViewport(e->pos())); |
262 | Todo *destinationEvent = 0; | 262 | Todo *destinationEvent = 0; |
263 | if (destination) destinationEvent = destination->todo(); | 263 | if (destination) destinationEvent = destination->todo(); |
264 | 264 | ||
265 | Todo *existingTodo = mCalendar->todo(todo->uid()); | 265 | Todo *existingTodo = mCalendar->todo(todo->uid()); |
266 | 266 | ||
267 | if(existingTodo) { | 267 | if(existingTodo) { |
268 | Incidence *to = destinationEvent; | 268 | Incidence *to = destinationEvent; |
269 | while(to) { | 269 | while(to) { |
270 | if (to->uid() == todo->uid()) { | 270 | if (to->uid() == todo->uid()) { |
271 | KMessageBox::sorry(this, | 271 | KMessageBox::sorry(this, |
272 | i18n("Cannot move Todo to itself\nor a child of itself"), | 272 | i18n("Cannot move Todo to itself\nor a child of itself"), |
273 | i18n("Drop Todo")); | 273 | i18n("Drop Todo")); |
274 | delete todo; | 274 | delete todo; |
275 | return; | 275 | return; |
276 | } | 276 | } |
277 | to = to->relatedTo(); | 277 | to = to->relatedTo(); |
278 | } | 278 | } |
279 | internalDrop = true; | 279 | internalDrop = true; |
280 | if ( destinationEvent ) | 280 | if ( destinationEvent ) |
281 | reparentTodoSignal( destinationEvent, existingTodo ); | 281 | reparentTodoSignal( destinationEvent, existingTodo ); |
282 | else | 282 | else |
283 | unparentTodoSignal(existingTodo); | 283 | unparentTodoSignal(existingTodo); |
284 | delete todo; | 284 | delete todo; |
285 | } else { | 285 | } else { |
286 | mCalendar->addTodo(todo); | 286 | mCalendar->addTodo(todo); |
287 | emit todoDropped(todo, KOGlobals::EVENTADDED); | 287 | emit todoDropped(todo, KOGlobals::EVENTADDED); |
288 | if ( destinationEvent ) | 288 | if ( destinationEvent ) |
289 | reparentTodoSignal( destinationEvent, todo ); | 289 | reparentTodoSignal( destinationEvent, todo ); |
290 | } | 290 | } |
291 | } | 291 | } |
292 | else { | 292 | else { |
293 | QString text; | 293 | QString text; |
294 | if (QTextDrag::decode(e,text)) { | 294 | if (QTextDrag::decode(e,text)) { |
295 | //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) ); | 295 | //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) ); |
296 | KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) )); | 296 | KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) )); |
297 | qDebug("Dropped : " + text); | 297 | qDebug("Dropped : " + text); |
298 | QStringList emails = QStringList::split(",",text); | 298 | QStringList emails = QStringList::split(",",text); |
299 | for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { | 299 | for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { |
300 | int pos = (*it).find("<"); | 300 | int pos = (*it).find("<"); |
301 | QString name = (*it).left(pos); | 301 | QString name = (*it).left(pos); |
302 | QString email = (*it).mid(pos); | 302 | QString email = (*it).mid(pos); |
303 | if (!email.isEmpty() && todoi) { | 303 | if (!email.isEmpty() && todoi) { |
304 | todoi->todo()->addAttendee(new Attendee(name,email)); | 304 | todoi->todo()->addAttendee(new Attendee(name,email)); |
305 | } | 305 | } |
306 | } | 306 | } |
307 | } | 307 | } |
308 | else { | 308 | else { |
309 | qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable "); | 309 | qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable "); |
310 | e->ignore(); | 310 | e->ignore(); |
311 | } | 311 | } |
312 | } | 312 | } |
313 | #endif | 313 | #endif |
314 | } | 314 | } |
315 | void KOTodoListView::wheelEvent (QWheelEvent *e) | 315 | void KOTodoListView::wheelEvent (QWheelEvent *e) |
316 | { | 316 | { |
317 | QListView::wheelEvent (e); | 317 | QListView::wheelEvent (e); |
318 | } | 318 | } |
319 | 319 | ||
320 | void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) | 320 | void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) |
321 | { | 321 | { |
322 | 322 | ||
323 | QPoint p(contentsToViewport(e->pos())); | 323 | QPoint p(contentsToViewport(e->pos())); |
324 | QListViewItem *i = itemAt(p); | 324 | QListViewItem *i = itemAt(p); |
325 | bool rootClicked = true; | 325 | bool rootClicked = true; |
326 | if (i) { | 326 | if (i) { |
327 | // if the user clicked into the root decoration of the item, don't | 327 | // if the user clicked into the root decoration of the item, don't |
328 | // try to start a drag! | 328 | // try to start a drag! |
329 | int X = p.x(); | 329 | int X = p.x(); |
330 | //qDebug("%d %d %d", X, header()->sectionPos(0), treeStepSize() ); | 330 | //qDebug("%d %d %d", X, header()->sectionPos(0), treeStepSize() ); |
331 | if (X > header()->sectionPos(0) + | 331 | if (X > header()->sectionPos(0) + |
332 | treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + | 332 | treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + |
333 | itemMargin() +i->height()|| | 333 | itemMargin() +i->height()|| |
334 | X < header()->sectionPos(0)) { | 334 | X < header()->sectionPos(0)) { |
335 | rootClicked = false; | 335 | rootClicked = false; |
336 | } | 336 | } |
337 | } else { | 337 | } else { |
338 | rootClicked = false; | 338 | rootClicked = false; |
339 | } | 339 | } |
340 | #ifndef KORG_NODND | 340 | #ifndef KORG_NODND |
341 | mMousePressed = false; | 341 | mMousePressed = false; |
342 | if (! rootClicked && !( e->button() == RightButton) ) { | 342 | if (! rootClicked && !( e->button() == RightButton) ) { |
343 | mPressPos = e->pos(); | 343 | mPressPos = e->pos(); |
344 | mMousePressed = true; | 344 | mMousePressed = true; |
345 | } else { | 345 | } else { |
346 | mMousePressed = false; | 346 | mMousePressed = false; |
347 | } | 347 | } |
348 | #endif | 348 | #endif |
349 | //qDebug("KOTodoListView::contentsMousePressEvent %d", rootClicked); | 349 | //qDebug("KOTodoListView::contentsMousePressEvent %d", rootClicked); |
350 | #ifndef DESKTOP_VERSION | 350 | #ifndef DESKTOP_VERSION |
351 | if (!( e->button() == RightButton && rootClicked) ) | 351 | if (!( e->button() == RightButton && rootClicked) ) |
352 | QListView::contentsMousePressEvent(e); | 352 | QListView::contentsMousePressEvent(e); |
353 | #else | 353 | #else |
354 | QListView::contentsMousePressEvent(e); | 354 | QListView::contentsMousePressEvent(e); |
355 | #endif | 355 | #endif |
356 | } | 356 | } |
357 | void KOTodoListView::paintEvent(QPaintEvent* e) | 357 | void KOTodoListView::paintEvent(QPaintEvent* e) |
358 | { | 358 | { |
359 | emit paintNeeded(); | 359 | emit paintNeeded(); |
360 | QListView::paintEvent( e); | 360 | QListView::paintEvent( e); |
361 | } | 361 | } |
362 | void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) | 362 | void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) |
363 | { | 363 | { |
364 | 364 | ||
365 | #ifndef KORG_NODND | 365 | #ifndef KORG_NODND |
366 | //QListView::contentsMouseMoveEvent(e); | 366 | //QListView::contentsMouseMoveEvent(e); |
367 | if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > | 367 | if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > |
368 | QApplication::startDragDistance()*3) { | 368 | QApplication::startDragDistance()*3) { |
369 | mMousePressed = false; | 369 | mMousePressed = false; |
370 | QListViewItem *item = itemAt(contentsToViewport(mPressPos)); | 370 | QListViewItem *item = itemAt(contentsToViewport(mPressPos)); |
371 | if (item) { | 371 | if (item) { |
372 | DndFactory factory( mCalendar ); | 372 | DndFactory factory( mCalendar ); |
373 | ICalDrag *vd = factory.createDrag( | 373 | ICalDrag *vd = factory.createDrag( |
374 | ((KOTodoViewItem *)item)->todo(),viewport()); | 374 | ((KOTodoViewItem *)item)->todo(),viewport()); |
375 | internalDrop = false; | 375 | internalDrop = false; |
376 | // we cannot do any senseful here, because the DnD is still broken in Qt | 376 | // we cannot do any senseful here, because the DnD is still broken in Qt |
377 | if (vd->drag()) { | 377 | if (vd->drag()) { |
378 | if ( !internalDrop ) { | 378 | if ( !internalDrop ) { |
379 | //emit deleteTodo( ((KOTodoViewItem *)item)->todo() ); | 379 | //emit deleteTodo( ((KOTodoViewItem *)item)->todo() ); |
380 | qDebug("Dnd: External move: Delete drag source "); | 380 | qDebug("Dnd: External move: Delete drag source "); |
381 | } else | 381 | } else |
382 | qDebug("Dnd: Internal move "); | 382 | qDebug("Dnd: Internal move "); |
383 | 383 | ||
384 | } else { | 384 | } else { |
385 | if ( !internalDrop ) { | 385 | if ( !internalDrop ) { |
386 | qDebug("Dnd: External Copy"); | 386 | qDebug("Dnd: External Copy"); |
387 | } else | 387 | } else |
388 | qDebug("DnD: Internal copy: Copy pending"); | 388 | qDebug("DnD: Internal copy: Copy pending"); |
389 | } | 389 | } |
390 | } | 390 | } |
391 | } | 391 | } |
392 | #endif | 392 | #endif |
393 | } | 393 | } |
394 | void KOTodoListView::keyReleaseEvent ( QKeyEvent *e ) | 394 | void KOTodoListView::keyReleaseEvent ( QKeyEvent *e ) |
395 | { | 395 | { |
396 | if ( !e->isAutoRepeat() ) { | 396 | if ( !e->isAutoRepeat() ) { |
397 | mFlagKeyPressed = false; | 397 | mFlagKeyPressed = false; |
398 | } | 398 | } |
399 | } | 399 | } |
400 | 400 | ||
401 | 401 | ||
402 | void KOTodoListView::keyPressEvent ( QKeyEvent * e ) | 402 | void KOTodoListView::keyPressEvent ( QKeyEvent * e ) |
403 | { | 403 | { |
404 | qApp->processEvents(); | 404 | qApp->processEvents(); |
405 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 405 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
406 | e->ignore(); | 406 | e->ignore(); |
407 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 407 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
408 | return; | 408 | return; |
409 | } | 409 | } |
410 | if (! e->isAutoRepeat() ) | 410 | if (! e->isAutoRepeat() ) |
411 | mFlagKeyPressed = true; | 411 | mFlagKeyPressed = true; |
412 | QListViewItem* cn; | 412 | QListViewItem* cn; |
413 | if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) { | 413 | if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) { |
414 | cn = currentItem(); | 414 | cn = currentItem(); |
415 | if ( cn ) { | 415 | if ( cn ) { |
416 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); | 416 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); |
417 | if ( ci ){ | 417 | if ( ci ){ |
418 | if ( e->state() == ShiftButton ) | 418 | if ( e->state() == ShiftButton ) |
419 | ci->setOn( false ); | 419 | ci->setOn( false ); |
420 | else | 420 | else |
421 | ci->setOn( true ); | 421 | ci->setOn( true ); |
422 | cn = cn->itemBelow(); | 422 | cn = cn->itemBelow(); |
423 | if ( cn ) { | 423 | if ( cn ) { |
424 | setCurrentItem ( cn ); | 424 | setCurrentItem ( cn ); |
425 | ensureItemVisible ( cn ); | 425 | ensureItemVisible ( cn ); |
426 | } | 426 | } |
427 | 427 | ||
428 | } | 428 | } |
429 | } | 429 | } |
430 | 430 | ||
431 | return; | 431 | return; |
432 | } | 432 | } |
433 | 433 | ||
434 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { | 434 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { |
435 | switch ( e->key() ) { | 435 | switch ( e->key() ) { |
436 | case Qt::Key_Down: | 436 | case Qt::Key_Down: |
437 | case Qt::Key_Up: | 437 | case Qt::Key_Up: |
438 | QListView::keyPressEvent ( e ); | 438 | QListView::keyPressEvent ( e ); |
439 | break; | 439 | break; |
440 | case Qt::Key_Left: | 440 | case Qt::Key_Left: |
441 | case Qt::Key_Right: | 441 | case Qt::Key_Right: |
442 | QListView::keyPressEvent ( e ); | 442 | QListView::keyPressEvent ( e ); |
443 | e->accept(); | 443 | e->accept(); |
444 | return; | 444 | return; |
445 | break; | 445 | break; |
446 | default: | 446 | default: |
447 | e->ignore(); | 447 | e->ignore(); |
448 | break; | 448 | break; |
449 | } | 449 | } |
450 | return; | 450 | return; |
451 | } | 451 | } |
452 | e->ignore(); | 452 | e->ignore(); |
453 | } | 453 | } |
454 | void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) | 454 | void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) |
455 | { | 455 | { |
456 | QListView::contentsMouseReleaseEvent(e); | 456 | QListView::contentsMouseReleaseEvent(e); |
457 | mMousePressed = false; | 457 | mMousePressed = false; |
458 | } | 458 | } |
459 | 459 | ||
460 | void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) | 460 | void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) |
461 | { | 461 | { |
462 | if (!e) return; | 462 | if (!e) return; |
463 | 463 | ||
464 | QPoint vp = contentsToViewport(e->pos()); | 464 | QPoint vp = contentsToViewport(e->pos()); |
465 | 465 | ||
466 | QListViewItem *item = itemAt(vp); | 466 | QListViewItem *item = itemAt(vp); |
467 | 467 | ||
468 | emit double_Clicked(item); | 468 | emit double_Clicked(item); |
469 | if (!item) return; | 469 | if (!item) return; |
470 | 470 | ||
471 | emit doubleClicked(item,vp,0); | 471 | emit doubleClicked(item,vp,0); |
472 | } | 472 | } |
473 | 473 | ||
474 | ///////////////////////////////////////////////////////////////////////////// | 474 | ///////////////////////////////////////////////////////////////////////////// |
475 | 475 | ||
476 | KOQuickTodo::KOQuickTodo(QWidget *parent) : | 476 | KOQuickTodo::KOQuickTodo(QWidget *parent) : |
477 | QLineEdit(parent) | 477 | QLineEdit(parent) |
478 | { | 478 | { |
479 | setText(i18n("Click to add a new Todo")); | 479 | setText(i18n("Click to add a new Todo")); |
480 | } | 480 | } |
481 | 481 | ||
482 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) | 482 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) |
483 | { | 483 | { |
484 | if ( text()==i18n("Click to add a new Todo") ) | 484 | if ( text()==i18n("Click to add a new Todo") ) |
485 | setText(""); | 485 | setText(""); |
486 | QLineEdit::focusInEvent(ev); | 486 | QLineEdit::focusInEvent(ev); |
487 | } | 487 | } |
488 | 488 | ||
489 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) | 489 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) |
490 | { | 490 | { |
491 | setText(i18n("Click to add a new Todo")); | 491 | setText(i18n("Click to add a new Todo")); |
492 | QLineEdit::focusOutEvent(ev); | 492 | QLineEdit::focusOutEvent(ev); |
493 | } | 493 | } |
494 | 494 | ||
495 | ///////////////////////////////////////////////////////////////////////////// | 495 | ///////////////////////////////////////////////////////////////////////////// |
496 | 496 | ||
497 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | 497 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : |
498 | KOrg::BaseView(calendar,parent,name) | 498 | KOrg::BaseView(calendar,parent,name) |
499 | { | 499 | { |
500 | mCategoryPopupMenu = 0; | 500 | mCategoryPopupMenu = 0; |
501 | mPendingUpdateBeforeRepaint = false; | 501 | mPendingUpdateBeforeRepaint = false; |
502 | isFlatDisplay = false; | 502 | isFlatDisplay = false; |
503 | mNavigator = 0; | 503 | mNavigator = 0; |
504 | QBoxLayout *topLayout = new QVBoxLayout(this); | 504 | QBoxLayout *topLayout = new QVBoxLayout(this); |
505 | mName = QString ( name ); | 505 | mName = QString ( name ); |
506 | mBlockUpdate = false; | 506 | mBlockUpdate = false; |
507 | mQuickBar = new QWidget( this ); | 507 | mQuickBar = new QWidget( this ); |
508 | topLayout->addWidget(mQuickBar); | 508 | topLayout->addWidget(mQuickBar); |
509 | 509 | ||
510 | mQuickAdd = new KOQuickTodo(mQuickBar); | 510 | mQuickAdd = new KOQuickTodo(mQuickBar); |
511 | QBoxLayout *quickLayout = new QHBoxLayout(mQuickBar); | 511 | QBoxLayout *quickLayout = new QHBoxLayout(mQuickBar); |
512 | quickLayout->addWidget( mQuickAdd ); | 512 | quickLayout->addWidget( mQuickAdd ); |
513 | QPushButton * flat = new QPushButton( "F",mQuickBar ); | 513 | QPushButton * flat = new QPushButton( "F",mQuickBar ); |
514 | int fixwid = flat->sizeHint().height(); | 514 | int fixwid = flat->sizeHint().height(); |
515 | if ( QApplication::desktop()->width() > 320 ) | 515 | if ( QApplication::desktop()->width() > 320 ) |
516 | fixwid *= 2; | 516 | fixwid *= 2; |
517 | flat->setFixedWidth( fixwid ); | 517 | flat->setFixedWidth( fixwid ); |
518 | connect ( flat, SIGNAL ( clicked()), SLOT ( setAllFlat())); | 518 | connect ( flat, SIGNAL ( clicked()), SLOT ( setAllFlat())); |
519 | QPushButton * allopen = new QPushButton( "O",mQuickBar ); | 519 | QPushButton * allopen = new QPushButton( "O",mQuickBar ); |
520 | allopen->setFixedWidth( fixwid ); | 520 | allopen->setFixedWidth( fixwid ); |
521 | connect ( allopen, SIGNAL ( clicked()), SLOT ( setAllOpen())); | 521 | connect ( allopen, SIGNAL ( clicked()), SLOT ( setAllOpen())); |
522 | QPushButton * allclose = new QPushButton( "C",mQuickBar ); | 522 | QPushButton * allclose = new QPushButton( "C",mQuickBar ); |
523 | allclose->setFixedWidth( fixwid ); | 523 | allclose->setFixedWidth( fixwid ); |
524 | connect ( allclose, SIGNAL ( clicked()), SLOT ( setAllClose())); | 524 | connect ( allclose, SIGNAL ( clicked()), SLOT ( setAllClose())); |
525 | QPushButton * s_done = new QPushButton( "D",mQuickBar ); | 525 | QPushButton * s_done = new QPushButton( "D",mQuickBar ); |
526 | s_done->setFixedWidth( fixwid ); | 526 | s_done->setFixedWidth( fixwid ); |
527 | connect ( s_done, SIGNAL ( clicked()), SLOT ( toggleCompleted())); | 527 | connect ( s_done, SIGNAL ( clicked()), SLOT ( toggleCompleted())); |
528 | QPushButton * s_run = new QPushButton( "R",mQuickBar ); | 528 | QPushButton * s_run = new QPushButton( "R",mQuickBar ); |
529 | s_run->setFixedWidth( fixwid ); | 529 | s_run->setFixedWidth( fixwid ); |
530 | connect ( s_run, SIGNAL ( clicked()), SLOT ( toggleRunning())); | 530 | connect ( s_run, SIGNAL ( clicked()), SLOT ( toggleRunning())); |
531 | 531 | ||
532 | mNewSubBut = new QPushButton( "sub",mQuickBar ); | 532 | mNewSubBut = new QPushButton( "sub",mQuickBar ); |
533 | mNewSubBut->setFixedWidth( fixwid*3/2 ); | 533 | mNewSubBut->setFixedWidth( fixwid*3/2 ); |
534 | connect ( mNewSubBut, SIGNAL ( clicked()), SLOT ( newSubTodo())); | 534 | connect ( mNewSubBut, SIGNAL ( clicked()), SLOT ( newSubTodo())); |
535 | mNewSubBut->setEnabled( false ); | 535 | mNewSubBut->setEnabled( false ); |
536 | quickLayout->addWidget( mNewSubBut ); | 536 | quickLayout->addWidget( mNewSubBut ); |
537 | quickLayout->addWidget( s_done ); | 537 | quickLayout->addWidget( s_done ); |
538 | quickLayout->addWidget( s_run ); | 538 | quickLayout->addWidget( s_run ); |
539 | 539 | ||
540 | quickLayout->addWidget( allopen ); | 540 | quickLayout->addWidget( allopen ); |
541 | quickLayout->addWidget( allclose ); | 541 | quickLayout->addWidget( allclose ); |
542 | quickLayout->addWidget( flat ); | 542 | quickLayout->addWidget( flat ); |
543 | 543 | ||
544 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickBar->hide(); | 544 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickBar->hide(); |
545 | 545 | ||
546 | mTodoListView = new KOTodoListView(calendar,this, name ); | 546 | mTodoListView = new KOTodoListView(calendar,this, name ); |
547 | topLayout->addWidget(mTodoListView); | 547 | topLayout->addWidget(mTodoListView); |
548 | //mTodoListView->header()->setMaximumHeight(30); | 548 | //mTodoListView->header()->setMaximumHeight(30); |
549 | mTodoListView->setRootIsDecorated(true); | 549 | mTodoListView->setRootIsDecorated(true); |
550 | mTodoListView->setAllColumnsShowFocus(true); | 550 | mTodoListView->setAllColumnsShowFocus(true); |
551 | 551 | ||
552 | mTodoListView->setShowSortIndicator(true); | 552 | mTodoListView->setShowSortIndicator(true); |
553 | 553 | ||
554 | mTodoListView->addColumn(i18n("Todo")); | 554 | mTodoListView->addColumn(i18n("Todo")); |
555 | mTodoListView->addColumn(i18n("Prio")); | 555 | mTodoListView->addColumn(i18n("Prio")); |
556 | mTodoListView->setColumnAlignment(1,AlignHCenter); | 556 | mTodoListView->setColumnAlignment(1,AlignHCenter); |
557 | mTodoListView->addColumn(i18n("Complete")); | 557 | mTodoListView->addColumn(i18n("Complete")); |
558 | mTodoListView->setColumnAlignment(2,AlignCenter); | 558 | mTodoListView->setColumnAlignment(2,AlignCenter); |
559 | 559 | ||
560 | mTodoListView->addColumn(i18n("Due Date")); | 560 | mTodoListView->addColumn(i18n("Due Date")); |
561 | mTodoListView->setColumnAlignment(3,AlignLeft); | 561 | mTodoListView->setColumnAlignment(3,AlignLeft); |
562 | mTodoListView->addColumn(i18n("Due Time")); | 562 | mTodoListView->addColumn(i18n("Due Time")); |
563 | mTodoListView->setColumnAlignment(4,AlignHCenter); | 563 | mTodoListView->setColumnAlignment(4,AlignHCenter); |
564 | 564 | ||
565 | mTodoListView->addColumn(i18n("Start Date")); | 565 | mTodoListView->addColumn(i18n("Start Date")); |
566 | mTodoListView->setColumnAlignment(5,AlignLeft); | 566 | mTodoListView->setColumnAlignment(5,AlignLeft); |
567 | mTodoListView->addColumn(i18n("Start Time")); | 567 | mTodoListView->addColumn(i18n("Start Time")); |
568 | mTodoListView->setColumnAlignment(6,AlignHCenter); | 568 | mTodoListView->setColumnAlignment(6,AlignHCenter); |
569 | 569 | ||
570 | mTodoListView->addColumn(i18n("Cancelled")); | 570 | mTodoListView->addColumn(i18n("Cancelled")); |
571 | mTodoListView->addColumn(i18n("Categories")); | 571 | mTodoListView->addColumn(i18n("Categories")); |
572 | mTodoListView->addColumn(i18n("Calendar")); | 572 | mTodoListView->addColumn(i18n("Calendar")); |
573 | #if 0 | 573 | #if 0 |
574 | mTodoListView->addColumn(i18n("Sort Id")); | 574 | mTodoListView->addColumn(i18n("Sort Id")); |
575 | mTodoListView->setColumnAlignment(4,AlignHCenter); | 575 | mTodoListView->setColumnAlignment(4,AlignHCenter); |
576 | #endif | 576 | #endif |
577 | 577 | ||
578 | mTodoListView->setMinimumHeight( 60 ); | 578 | mTodoListView->setMinimumHeight( 60 ); |
579 | mTodoListView->setItemsRenameable( true ); | 579 | mTodoListView->setItemsRenameable( true ); |
580 | mTodoListView->setRenameable( 0 ); | 580 | mTodoListView->setRenameable( 0 ); |
581 | mTodoListView->setColumnWidth( 0, 120 ); | 581 | mTodoListView->setColumnWidth( 0, 120 ); |
582 | int iii = 0; | 582 | int iii = 0; |
583 | for ( iii = 0; iii< 10 ; ++iii ) | 583 | for ( iii = 0; iii< 10 ; ++iii ) |
584 | mTodoListView->setColumnWidthMode( iii, QListView::Manual ); | 584 | mTodoListView->setColumnWidthMode( iii, QListView::Manual ); |
585 | 585 | ||
586 | 586 | ||
587 | mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this); | 587 | mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this); |
588 | 588 | ||
589 | mPriorityPopupMenu = new QPopupMenu(this); | 589 | mPriorityPopupMenu = new QPopupMenu(this); |
590 | for (int i = 1; i <= 5; i++) { | 590 | for (int i = 1; i <= 5; i++) { |
591 | QString label = QString ("%1").arg (i); | 591 | QString label = QString ("%1").arg (i); |
592 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; | 592 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; |
593 | } | 593 | } |
594 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); | 594 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); |
595 | 595 | ||
596 | mPercentageCompletedPopupMenu = new QPopupMenu(this); | 596 | mPercentageCompletedPopupMenu = new QPopupMenu(this); |
597 | for (int i = 0; i <= 100; i+=20) { | 597 | for (int i = 0; i <= 100; i+=20) { |
598 | QString label = QString ("%1 %").arg (i); | 598 | QString label = QString ("%1 %").arg (i); |
599 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; | 599 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; |
600 | } | 600 | } |
601 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); | 601 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); |
602 | 602 | ||
603 | 603 | ||
604 | mCategoryPopupMenu = new QPopupMenu (this); | 604 | mCategoryPopupMenu = new QPopupMenu (this); |
605 | mCategoryPopupMenu->setCheckable (true); | 605 | mCategoryPopupMenu->setCheckable (true); |
606 | connect (mCategoryPopupMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); | 606 | connect (mCategoryPopupMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); |
607 | connect (mCategoryPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCategories ())); | 607 | connect (mCategoryPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCategories ())); |
608 | 608 | ||
609 | mCalPopupMenu = new QPopupMenu (this); | 609 | mCalPopupMenu = new QPopupMenu (this); |
610 | mCalPopupMenu->setCheckable (true); | 610 | mCalPopupMenu->setCheckable (true); |
611 | connect (mCalPopupMenu, SIGNAL (activated (int)), SLOT (changedCal (int))); | 611 | connect (mCalPopupMenu, SIGNAL (activated (int)), SLOT (changedCal (int))); |
612 | connect (mCalPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCal ())); | 612 | connect (mCalPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCal ())); |
613 | 613 | ||
614 | 614 | ||
615 | 615 | ||
616 | 616 | ||
617 | mItemPopupMenu = new QPopupMenu(this); | 617 | mItemPopupMenu = new QPopupMenu(this); |
618 | mItemPopupMenu->insertItem(i18n("Show"), this, | 618 | mItemPopupMenu->insertItem(i18n("Show"), this, |
619 | SLOT (showTodo())); | 619 | SLOT (showTodo())); |
620 | mItemPopupMenu->insertItem(i18n("Edit..."), this, | 620 | mItemPopupMenu->insertItem(i18n("Edit..."), this, |
621 | SLOT (editTodo())); | 621 | SLOT (editTodo())); |
622 | mItemPopupMenu->insertItem( i18n("Delete..."), this, | 622 | mItemPopupMenu->insertItem( i18n("Delete..."), this, |
623 | SLOT (deleteTodo())); | 623 | SLOT (deleteTodo())); |
624 | mItemPopupMenu->insertItem( i18n("Clone..."), this, | 624 | mItemPopupMenu->insertItem( i18n("Clone..."), this, |
625 | SLOT (cloneTodo())); | 625 | SLOT (cloneTodo())); |
626 | mItemPopupMenu->insertItem( i18n("Move..."), this, | 626 | mItemPopupMenu->insertItem( i18n("Move..."), this, |
627 | SLOT (moveTodo())); | 627 | SLOT (moveTodo())); |
628 | #ifndef DESKTOP_VERSION | 628 | #ifndef DESKTOP_VERSION |
629 | mItemPopupMenu->insertItem( i18n("Beam..."), this, | 629 | mItemPopupMenu->insertItem( i18n("Beam..."), this, |
630 | SLOT (beamTodo())); | 630 | SLOT (beamTodo())); |
631 | #endif | 631 | #endif |
632 | mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, | 632 | mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, |
633 | SLOT (cancelTodo())); | 633 | SLOT (cancelTodo())); |
634 | mItemPopupMenu->insertItem( i18n("Categories"), mCategoryPopupMenu); | 634 | mItemPopupMenu->insertItem( i18n("Categories"), mCategoryPopupMenu); |
635 | mItemPopupMenu->insertItem( i18n("Calendar"), mCalPopupMenu); | 635 | mItemPopupMenu->insertItem( i18n("Calendar"), mCalPopupMenu); |
636 | mItemPopupMenu->insertSeparator(); | 636 | mItemPopupMenu->insertSeparator(); |
637 | mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this, | 637 | mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this, |
638 | SLOT (toggleRunningItem())); | 638 | SLOT (toggleRunningItem())); |
639 | mItemPopupMenu->insertSeparator(); | 639 | mItemPopupMenu->insertSeparator(); |
640 | /* | 640 | /* |
641 | mItemPopupMenu->insertItem( i18n("New Todo..."), this, | 641 | mItemPopupMenu->insertItem( i18n("New Todo..."), this, |
642 | SLOT (newTodo())); | 642 | SLOT (newTodo())); |
643 | */ | 643 | */ |
644 | mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, | 644 | mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, |
645 | SLOT (newSubTodo())); | 645 | SLOT (newSubTodo())); |
646 | mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, | 646 | mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, |
647 | SLOT (unparentTodo()),0,21); | 647 | SLOT (unparentTodo()),0,21); |
648 | mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, | 648 | mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, |
649 | SLOT (reparentTodo()),0,22); | 649 | SLOT (reparentTodo()),0,22); |
650 | mItemPopupMenu->insertSeparator(); | 650 | mItemPopupMenu->insertSeparator(); |
651 | #if 0 | 651 | #if 0 |
652 | mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed..."), | 652 | mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed..."), |
653 | this, SLOT( purgeCompleted() ) ); | 653 | this, SLOT( purgeCompleted() ) ); |
654 | mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), | 654 | mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), |
655 | this, SLOT( toggleCompleted() ),0, 33 ); | 655 | this, SLOT( toggleCompleted() ),0, 33 ); |
656 | mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), | 656 | mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), |
657 | this, SLOT( toggleQuickTodo() ),0, 34 ); | 657 | this, SLOT( toggleQuickTodo() ),0, 34 ); |
658 | mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), | 658 | mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), |
659 | this, SLOT( toggleRunning() ),0, 35 ); | 659 | this, SLOT( toggleRunning() ),0, 35 ); |
660 | 660 | ||
661 | #endif | 661 | #endif |
662 | mPopupMenu = new QPopupMenu(this); | 662 | mPopupMenu = new QPopupMenu(this); |
663 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, | 663 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, |
664 | SLOT (newTodo()),0,1); | 664 | SLOT (newTodo()),0,1); |
665 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed..."), | 665 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed..."), |
666 | this, SLOT(purgeCompleted()),0,2); | 666 | this, SLOT(purgeCompleted()),0,2); |
667 | mPopupMenu->insertItem(i18n("Show Completed"), | 667 | mPopupMenu->insertItem(i18n("Show Completed"), |
668 | this, SLOT( toggleCompleted() ),0,3 ); | 668 | this, SLOT( toggleCompleted() ),0,3 ); |
669 | mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), | 669 | mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), |
670 | this, SLOT( toggleRunning() ),0,5 ); | 670 | this, SLOT( toggleRunning() ),0,5 ); |
671 | mPopupMenu->insertItem(i18n(" set all open","Display all opened"), | 671 | mPopupMenu->insertItem(i18n(" set all open","Display all opened"), |
672 | this, SLOT( setAllOpen() ),0,6 ); | 672 | this, SLOT( setAllOpen() ),0,6 ); |
673 | mPopupMenu->insertItem(i18n(" set all close","Display all closed"), | 673 | mPopupMenu->insertItem(i18n(" set all close","Display all closed"), |
674 | this, SLOT( setAllClose() ),0,7 ); | 674 | this, SLOT( setAllClose() ),0,7 ); |
675 | mPopupMenu->insertItem(i18n(" set all flat","Display all flat"), | 675 | mPopupMenu->insertItem(i18n(" set all flat","Display all flat"), |
676 | this, SLOT( setAllFlat() ),0,8 ); | 676 | this, SLOT( setAllFlat() ),0,8 ); |
677 | mPopupMenu->insertSeparator(); | 677 | mPopupMenu->insertSeparator(); |
678 | mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), | 678 | mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), |
679 | this, SLOT( toggleQuickTodo() ),0,4 ); | 679 | this, SLOT( toggleQuickTodo() ),0,4 ); |
680 | mDocPrefs = new DocPrefs( name ); | 680 | mDocPrefs = new DocPrefs( name ); |
681 | 681 | ||
682 | mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu ); | 682 | mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu ); |
683 | mPopupMenu->setCheckable( true ); | 683 | mPopupMenu->setCheckable( true ); |
684 | mItemPopupMenu->setCheckable( true ); | 684 | mItemPopupMenu->setCheckable( true ); |
685 | 685 | ||
686 | 686 | ||
687 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); | 687 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); |
688 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); | 688 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); |
689 | 689 | ||
690 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); | 690 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); |
691 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); | 691 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); |
692 | 692 | ||
693 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); | 693 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); |
694 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); | 694 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); |
695 | 695 | ||
696 | 696 | ||
697 | // Double clicking conflicts with opening/closing the subtree | 697 | // Double clicking conflicts with opening/closing the subtree |
698 | connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), | 698 | connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), |
699 | SLOT( editItem( QListViewItem *) ) ); | 699 | SLOT( editItem( QListViewItem *) ) ); |
700 | /* | 700 | /* |
701 | connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, | 701 | connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, |
702 | const QPoint &,int ) ), | 702 | const QPoint &,int ) ), |
703 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); | 703 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); |
704 | */ | 704 | */ |
705 | connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, | 705 | connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, |
706 | const QPoint &,int ) ), | 706 | const QPoint &,int ) ), |
707 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); | 707 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); |
708 | connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), | 708 | connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), |
709 | SLOT( itemClicked( QListViewItem * ) ) ); | 709 | SLOT( itemClicked( QListViewItem * ) ) ); |
710 | connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), | 710 | connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), |
711 | SLOT( itemDoubleClicked( QListViewItem * ) ) ); | 711 | SLOT( itemDoubleClicked( QListViewItem * ) ) ); |
712 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), | 712 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), |
713 | SLOT( updateView() ) ); | 713 | SLOT( updateView() ) ); |
714 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), | 714 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), |
715 | SLOT( todoModified(Todo *, int) ) ); | 715 | SLOT( todoModified(Todo *, int) ) ); |
716 | connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), | 716 | connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), |
717 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 717 | SLOT( itemStateChanged( QListViewItem * ) ) ); |
718 | connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), | 718 | connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), |
719 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 719 | SLOT( itemStateChanged( QListViewItem * ) ) ); |
720 | connect( mTodoListView, SIGNAL( paintNeeded() ), | 720 | connect( mTodoListView, SIGNAL( paintNeeded() ), |
721 | SLOT( paintNeeded()) ); | 721 | SLOT( paintNeeded()) ); |
722 | 722 | ||
723 | #if 0 | 723 | #if 0 |
724 | connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), | 724 | connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), |
725 | SLOT(selectionChanged(QListViewItem *))); | 725 | SLOT(selectionChanged(QListViewItem *))); |
726 | connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), | 726 | connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), |
727 | SLOT(selectionChanged(QListViewItem *))); | 727 | SLOT(selectionChanged(QListViewItem *))); |
728 | connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), | 728 | connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), |
729 | SLOT(selectionChanged(QListViewItem *))); | 729 | SLOT(selectionChanged(QListViewItem *))); |
730 | #endif | 730 | #endif |
731 | 731 | ||
732 | connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); | 732 | connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); |
733 | connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); | 733 | connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); |
734 | connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); | 734 | connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); |
735 | 735 | ||
736 | connect( mTodoListView, SIGNAL(selectionChanged() ), | 736 | connect( mTodoListView, SIGNAL(selectionChanged() ), |
737 | SLOT( processSelectionChange() ) ); | 737 | SLOT( processSelectionChange() ) ); |
738 | connect( mQuickAdd, SIGNAL( returnPressed () ), | 738 | connect( mQuickAdd, SIGNAL( returnPressed () ), |
739 | SLOT( addQuickTodo() ) ); | 739 | SLOT( addQuickTodo() ) ); |
740 | 740 | ||
741 | } | 741 | } |
742 | 742 | ||
743 | KOTodoView::~KOTodoView() | 743 | KOTodoView::~KOTodoView() |
744 | { | 744 | { |
745 | 745 | ||
746 | #if QT_VERSION >= 0x030000 | 746 | #if QT_VERSION >= 0x030000 |
747 | 747 | ||
748 | #else | 748 | #else |
749 | delete mKOTodoViewWhatsThis; | 749 | delete mKOTodoViewWhatsThis; |
750 | #endif | 750 | #endif |
751 | 751 | ||
752 | delete mDocPrefs; | 752 | delete mDocPrefs; |
753 | } | 753 | } |
754 | QString KOTodoView::getWhatsThisText(QPoint p) | 754 | QString KOTodoView::getWhatsThisText(QPoint p) |
755 | { | 755 | { |
756 | KOTodoViewItem* item = ( KOTodoViewItem* ) mTodoListView->itemAt( p ); | 756 | KOTodoViewItem* item = ( KOTodoViewItem* ) mTodoListView->itemAt( p ); |
757 | if ( item ) | 757 | if ( item ) |
758 | return KIncidenceFormatter::instance()->getFormattedText( item->todo(), | 758 | return KIncidenceFormatter::instance()->getFormattedText( item->todo(), |
759 | KOPrefs::instance()->mWTshowDetails, | 759 | KOPrefs::instance()->mWTshowDetails, |
760 | KOPrefs::instance()->mWTshowCreated, | 760 | KOPrefs::instance()->mWTshowCreated, |
761 | KOPrefs::instance()->mWTshowChanged); | 761 | KOPrefs::instance()->mWTshowChanged); |
762 | return i18n("That is the todo view" ); | 762 | return i18n("That is the todo view" ); |
763 | 763 | ||
764 | } | 764 | } |
765 | 765 | ||
766 | void KOTodoView::jumpToDate () | 766 | void KOTodoView::jumpToDate () |
767 | { | 767 | { |
768 | // if (mActiveItem) { | 768 | // if (mActiveItem) { |
769 | // mActiveItem->todo()); | 769 | // mActiveItem->todo()); |
770 | // if ( mActiveItem->todo()->hasDueDate() ) | 770 | // if ( mActiveItem->todo()->hasDueDate() ) |
771 | // emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); | 771 | // emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); |
772 | } | 772 | } |
773 | void KOTodoView::paintNeeded() | 773 | void KOTodoView::paintNeeded() |
774 | { | 774 | { |
775 | if ( mPendingUpdateBeforeRepaint ) { | 775 | if ( mPendingUpdateBeforeRepaint ) { |
776 | updateView(); | 776 | updateView(); |
777 | mPendingUpdateBeforeRepaint = false; | 777 | mPendingUpdateBeforeRepaint = false; |
778 | } | 778 | } |
779 | } | 779 | } |
780 | void KOTodoView::paintEvent(QPaintEvent * pevent) | 780 | void KOTodoView::paintEvent(QPaintEvent * pevent) |
781 | { | 781 | { |
782 | if ( mPendingUpdateBeforeRepaint ) { | 782 | if ( mPendingUpdateBeforeRepaint ) { |
783 | updateView(); | 783 | updateView(); |
784 | mPendingUpdateBeforeRepaint = false; | 784 | mPendingUpdateBeforeRepaint = false; |
785 | } | 785 | } |
786 | KOrg::BaseView::paintEvent( pevent); | 786 | KOrg::BaseView::paintEvent( pevent); |
787 | } | 787 | } |
788 | 788 | ||
789 | void KOTodoView::updateView() | 789 | void KOTodoView::updateView() |
790 | { | 790 | { |
791 | pendingSubtodo = 0; | 791 | pendingSubtodo = 0; |
792 | if ( mBlockUpdate ) { | 792 | if ( mBlockUpdate ) { |
793 | return; | 793 | return; |
794 | } | 794 | } |
795 | if ( !isVisible() ) { | 795 | if ( !isVisible() ) { |
796 | mPendingUpdateBeforeRepaint = true; | 796 | mPendingUpdateBeforeRepaint = true; |
797 | return; | 797 | return; |
798 | } | 798 | } |
799 | //qDebug("KOTodoView::updateView() %x", this); | 799 | //qDebug("KOTodoView::updateView() %x", this); |
800 | if ( isFlatDisplay ) { | 800 | if ( isFlatDisplay ) { |
801 | displayAllFlat(); | 801 | displayAllFlat(); |
802 | return; | 802 | return; |
803 | } | 803 | } |
804 | storeCurrentItem(); | 804 | storeCurrentItem(); |
805 | //qDebug("update "); | 805 | //qDebug("update "); |
806 | // kdDebug() << "KOTodoView::updateView()" << endl; | 806 | // kdDebug() << "KOTodoView::updateView()" << endl; |
807 | QFont fo = KOPrefs::instance()->mTodoViewFont; | 807 | QFont fo = KOPrefs::instance()->mTodoViewFont; |
808 | 808 | ||
809 | 809 | ||
810 | mTodoListView->clear(); | 810 | mTodoListView->clear(); |
811 | if ( mName == "todolistsmall" ) { | 811 | if ( mName == "todolistsmall" ) { |
812 | if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { | 812 | if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { |
813 | int ps = fo.pointSize() -2; | 813 | int ps = fo.pointSize() -2; |
814 | if ( ps > 12 ) | 814 | if ( ps > 12 ) |
815 | ps -= 2; | 815 | ps -= 2; |
816 | fo.setPointSize( ps ); | 816 | fo.setPointSize( ps ); |
817 | } | 817 | } |
818 | } | 818 | } |
819 | 819 | ||
820 | mTodoListView->setFont( fo ); | 820 | mTodoListView->setFont( fo ); |
821 | // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); | 821 | // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); |
822 | //mTodoListView->header()->setMaximumHeight(fm.height()); | 822 | //mTodoListView->header()->setMaximumHeight(fm.height()); |
823 | QPtrList<Todo> todoList = calendar()->todos(); | 823 | QPtrList<Todo> todoList = calendar()->todos(); |
824 | 824 | ||
825 | /* | 825 | /* |
826 | kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; | 826 | kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; |
827 | Event *t; | 827 | Event *t; |
828 | for(t = todoList.first(); t; t = todoList.next()) { | 828 | for(t = todoList.first(); t; t = todoList.next()) { |
829 | kdDebug() << " " << t->getSummary() << endl; | 829 | kdDebug() << " " << t->getSummary() << endl; |
830 | 830 | ||
831 | if (t->getRelatedTo()) { | 831 | if (t->getRelatedTo()) { |
832 | kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; | 832 | kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; |
833 | } | 833 | } |
834 | 834 | ||
835 | QPtrList<Event> l = t->getRelations(); | 835 | QPtrList<Event> l = t->getRelations(); |
836 | Event *c; | 836 | Event *c; |
837 | for(c=l.first();c;c=l.next()) { | 837 | for(c=l.first();c;c=l.next()) { |
838 | kdDebug() << " - relation: " << c->getSummary() << endl; | 838 | kdDebug() << " - relation: " << c->getSummary() << endl; |
839 | } | 839 | } |
840 | } | 840 | } |
841 | */ | 841 | */ |
842 | 842 | ||
843 | // Put for each Event a KOTodoViewItem in the list view. Don't rely on a | 843 | // Put for each Event a KOTodoViewItem in the list view. Don't rely on a |
844 | // specific order of events. That means that we have to generate parent items | 844 | // specific order of events. That means that we have to generate parent items |
845 | // recursively for proper hierarchical display of Todos. | 845 | // recursively for proper hierarchical display of Todos. |
846 | mTodoMap.clear(); | 846 | mTodoMap.clear(); |
847 | Todo *todo; | 847 | Todo *todo; |
848 | todo = todoList.first();// todo; todo = todoList.next()) { | 848 | todo = todoList.first();// todo; todo = todoList.next()) { |
849 | while ( todo ) { | 849 | while ( todo ) { |
850 | bool next = true; | 850 | bool next = true; |
851 | // qDebug("todo %s ", todo->summary().latin1()); | 851 | // qDebug("todo %s ", todo->summary().latin1()); |
852 | Incidence *incidence = todo->relatedTo(); | 852 | Incidence *incidence = todo->relatedTo(); |
853 | while ( incidence ) { | 853 | while ( incidence ) { |
854 | if ( incidence->typeID() == todoID ) { | 854 | if ( incidence->typeID() == todoID ) { |
855 | //qDebug("related %s ",incidence->summary().latin1() ); | 855 | //qDebug("related %s ",incidence->summary().latin1() ); |
856 | if ( !(todoList.contains ( ((Todo* )incidence ) ) ) && incidence->calEnabled() ) { | 856 | if ( !(todoList.contains ( ((Todo* )incidence ) ) ) && incidence->calEnabled() ) { |
857 | //qDebug("related not found "); | 857 | //qDebug("related not found "); |
858 | todoList.remove( ); | 858 | todoList.remove( ); |
859 | todo = todoList.current(); | 859 | todo = todoList.current(); |
860 | next = false; | 860 | next = false; |
861 | incidence = 0; | 861 | incidence = 0; |
862 | 862 | ||
863 | } else { | 863 | } else { |
864 | //qDebug("related found "); | 864 | //qDebug("related found "); |
865 | incidence = incidence->relatedTo(); | 865 | incidence = incidence->relatedTo(); |
866 | } | 866 | } |
867 | } else | 867 | } else |
868 | incidence = 0; | 868 | incidence = 0; |
869 | } | 869 | } |
870 | if ( next ) | 870 | if ( next ) |
871 | todo = todoList.next(); | 871 | todo = todoList.next(); |
872 | } | 872 | } |
873 | 873 | ||
874 | for(todo = todoList.first(); todo; todo = todoList.next()) { | 874 | for(todo = todoList.first(); todo; todo = todoList.next()) { |
875 | if (!mTodoMap.contains(todo) && checkTodo( todo ) ) | 875 | if (!mTodoMap.contains(todo) && checkTodo( todo ) ) |
876 | { | 876 | { |
877 | insertTodoItem(todo); | 877 | insertTodoItem(todo); |
878 | } | 878 | } |
879 | } | 879 | } |
880 | // Restore opened/closed state | 880 | // Restore opened/closed state |
881 | mTodoListView->blockSignals( true ); | 881 | mTodoListView->blockSignals( true ); |
882 | if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); | 882 | if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); |
883 | mTodoListView->blockSignals( false ); | 883 | mTodoListView->blockSignals( false ); |
884 | resetCurrentItem(); | 884 | resetCurrentItem(); |
885 | } | 885 | } |
886 | 886 | ||
887 | void KOTodoView::storeCurrentItem() | 887 | void KOTodoView::storeCurrentItem() |
888 | { | 888 | { |
889 | mCurItem = 0; | 889 | mCurItem = 0; |
890 | mCurItemRootParent = 0; | 890 | mCurItemRootParent = 0; |
891 | mCurItemParent = 0; | 891 | mCurItemParent = 0; |
892 | mCurItemAbove = 0; | 892 | mCurItemAbove = 0; |
893 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | 893 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); |
894 | if (mActiveItem) { | 894 | if (mActiveItem) { |
895 | mCurItem = mActiveItem->todo(); | 895 | mCurItem = mActiveItem->todo(); |
896 | KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove (); | 896 | KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove (); |
897 | if ( activeItemAbove ) | 897 | if ( activeItemAbove ) |
898 | mCurItemAbove = activeItemAbove->todo(); | 898 | mCurItemAbove = activeItemAbove->todo(); |
899 | mCurItemRootParent = mCurItem; | 899 | mCurItemRootParent = mCurItem; |
900 | mCurItemParent = mCurItemRootParent->relatedTo(); | 900 | mCurItemParent = mCurItemRootParent->relatedTo(); |
901 | while ( mCurItemRootParent->relatedTo() != 0 ) | 901 | while ( mCurItemRootParent->relatedTo() != 0 ) |
902 | mCurItemRootParent = mCurItemRootParent->relatedTo(); | 902 | mCurItemRootParent = mCurItemRootParent->relatedTo(); |
903 | } | 903 | } |
904 | mActiveItem = 0; | 904 | mActiveItem = 0; |
905 | } | 905 | } |
906 | 906 | ||
907 | void KOTodoView::resetCurrentItem() | 907 | void KOTodoView::resetCurrentItem() |
908 | { | 908 | { |
909 | //mTodoListView->setFocus(); | 909 | //mTodoListView->setFocus(); |
910 | KOTodoViewItem* foundItem = 0; | 910 | KOTodoViewItem* foundItem = 0; |
911 | KOTodoViewItem* foundItemRoot = 0; | 911 | KOTodoViewItem* foundItemRoot = 0; |
912 | KOTodoViewItem* foundItemParent = 0; | 912 | KOTodoViewItem* foundItemParent = 0; |
913 | KOTodoViewItem* foundItemAbove = 0; | 913 | KOTodoViewItem* foundItemAbove = 0; |
914 | if ( mTodoListView->firstChild () ) { | 914 | if ( mTodoListView->firstChild () ) { |
915 | if ( mCurItem ) { | 915 | if ( mCurItem ) { |
916 | KOTodoViewItem* item = (KOTodoViewItem*)mTodoListView->firstChild (); | 916 | KOTodoViewItem* item = (KOTodoViewItem*)mTodoListView->firstChild (); |
917 | while ( item ) { | 917 | while ( item ) { |
918 | if ( item->todo() == mCurItem ) { | 918 | if ( item->todo() == mCurItem ) { |
919 | foundItem = item; | 919 | foundItem = item; |
920 | break; | 920 | break; |
921 | } else if ( item->todo() == mCurItemAbove ) { | 921 | } else if ( item->todo() == mCurItemAbove ) { |
922 | foundItemAbove = item; | 922 | foundItemAbove = item; |
923 | 923 | ||
924 | } | 924 | } |
925 | if ( item->todo() == mCurItemRootParent ) { | 925 | if ( item->todo() == mCurItemRootParent ) { |
926 | foundItemRoot = item; | 926 | foundItemRoot = item; |
927 | } | 927 | } |
928 | if ( item->todo() == mCurItemParent ) { | 928 | if ( item->todo() == mCurItemParent ) { |
929 | foundItemParent = item; | 929 | foundItemParent = item; |
930 | } | 930 | } |
931 | item = (KOTodoViewItem*)item->itemBelow(); | 931 | item = (KOTodoViewItem*)item->itemBelow(); |
932 | } | 932 | } |
933 | if ( ! foundItem ) { | 933 | if ( ! foundItem ) { |
934 | if ( foundItemParent ) { | 934 | if ( foundItemParent ) { |
935 | foundItem = foundItemParent; | 935 | foundItem = foundItemParent; |
936 | } else { | 936 | } else { |
937 | if ( foundItemRoot ) | 937 | if ( foundItemRoot ) |
938 | foundItem = foundItemRoot; | 938 | foundItem = foundItemRoot; |
939 | else | 939 | else |
940 | foundItem = foundItemAbove; | 940 | foundItem = foundItemAbove; |
941 | } | 941 | } |
942 | } | 942 | } |
943 | } | 943 | } |
944 | if ( foundItem ) { | 944 | if ( foundItem ) { |
945 | mTodoListView->setSelected ( foundItem, true ); | 945 | mTodoListView->setSelected ( foundItem, true ); |
946 | mTodoListView->setCurrentItem( foundItem ); | 946 | mTodoListView->setCurrentItem( foundItem ); |
947 | mTodoListView->ensureItemVisible( foundItem ); | 947 | mTodoListView->ensureItemVisible( foundItem ); |
948 | } else { | 948 | } else { |
949 | if ( mTodoListView->firstChild () ) { | 949 | if ( mTodoListView->firstChild () ) { |
950 | mTodoListView->setSelected ( mTodoListView->firstChild (), true ); | 950 | mTodoListView->setSelected ( mTodoListView->firstChild (), true ); |
951 | mTodoListView->setCurrentItem( mTodoListView->firstChild () ); | 951 | mTodoListView->setCurrentItem( mTodoListView->firstChild () ); |
952 | } | 952 | } |
953 | } | 953 | } |
954 | } | 954 | } |
955 | processSelectionChange(); | 955 | processSelectionChange(); |
956 | QTimer::singleShot( 100, this, SLOT ( resetFocusToList() )); | 956 | QTimer::singleShot( 100, this, SLOT ( resetFocusToList() )); |
957 | } | 957 | } |
958 | void KOTodoView::resetFocusToList() | 958 | void KOTodoView::resetFocusToList() |
959 | { | 959 | { |
960 | topLevelWidget()->setActiveWindow(); | 960 | topLevelWidget()->setActiveWindow(); |
961 | mTodoListView->setFocus(); | 961 | mTodoListView->setFocus(); |
962 | } | 962 | } |
963 | //Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove; | 963 | //Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove; |
964 | bool KOTodoView::checkTodo( Todo * todo ) | 964 | bool KOTodoView::checkTodo( Todo * todo ) |
965 | { | 965 | { |
966 | 966 | ||
967 | if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() ) | 967 | if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() ) |
968 | return false; | 968 | return false; |
969 | if ( !todo->isCompleted() ) { | 969 | if ( !todo->isCompleted() ) { |
970 | if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() ) | 970 | if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() ) |
971 | return true; | 971 | return true; |
972 | } | 972 | } |
973 | if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) { | 973 | if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) { |
974 | if ( todo->hasStartDate() ) | 974 | if ( todo->hasStartDate() ) |
975 | if ( mNavigator->selectedDates().last() < todo->dtStart().date() ) | 975 | if ( mNavigator->selectedDates().last() < todo->dtStart().date() ) |
976 | return false; | 976 | return false; |
977 | if ( todo->hasDueDate() ) | 977 | if ( todo->hasDueDate() ) |
978 | if ( mNavigator->selectedDates().first() > todo->dtDue().date() ) | 978 | if ( mNavigator->selectedDates().first() > todo->dtDue().date() ) |
979 | return false; | 979 | return false; |
980 | } | 980 | } |
981 | return true; | 981 | return true; |
982 | } | 982 | } |
983 | 983 | ||
984 | void KOTodoView::restoreItemState( QListViewItem *item ) | 984 | void KOTodoView::restoreItemState( QListViewItem *item ) |
985 | { | 985 | { |
986 | pendingSubtodo = 0; | 986 | pendingSubtodo = 0; |
987 | while( item ) { | 987 | while( item ) { |
988 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 988 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
989 | todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); | 989 | todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); |
990 | if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); | 990 | if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); |
991 | item = item->nextSibling(); | 991 | item = item->nextSibling(); |
992 | } | 992 | } |
993 | } | 993 | } |
994 | 994 | ||
995 | 995 | ||
996 | QMap<Todo *,KOTodoViewItem *>::ConstIterator | 996 | QMap<Todo *,KOTodoViewItem *>::ConstIterator |
997 | KOTodoView::insertTodoItem(Todo *todo) | 997 | KOTodoView::insertTodoItem(Todo *todo) |
998 | { | 998 | { |
999 | 999 | ||
1000 | // kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl; | 1000 | // kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl; |
1001 | // TODO: Check, if dynmaic cast is necessary | 1001 | // TODO: Check, if dynmaic cast is necessary |
1002 | 1002 | ||
1003 | pendingSubtodo = 0; | 1003 | pendingSubtodo = 0; |
1004 | Incidence *incidence = todo->relatedTo(); | 1004 | Incidence *incidence = todo->relatedTo(); |
1005 | while ( incidence && !incidence->calEnabled() ) | 1005 | while ( incidence && !incidence->calEnabled() ) |
1006 | incidence = incidence->relatedTo(); | 1006 | incidence = incidence->relatedTo(); |
1007 | if (incidence && incidence->typeID() == todoID ) { | 1007 | if (incidence && incidence->typeID() == todoID ) { |
1008 | Todo *relatedTodo = static_cast<Todo *>(incidence); | 1008 | Todo *relatedTodo = static_cast<Todo *>(incidence); |
1009 | 1009 | ||
1010 | // kdDebug() << " has Related" << endl; | 1010 | // kdDebug() << " has Related" << endl; |
1011 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; | 1011 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; |
1012 | itemIterator = mTodoMap.find(relatedTodo); | 1012 | itemIterator = mTodoMap.find(relatedTodo); |
1013 | if (itemIterator == mTodoMap.end()) { | 1013 | if (itemIterator == mTodoMap.end()) { |
1014 | // kdDebug() << " related not yet in list" << endl; | 1014 | // kdDebug() << " related not yet in list" << endl; |
1015 | itemIterator = insertTodoItem (relatedTodo); | 1015 | itemIterator = insertTodoItem (relatedTodo); |
1016 | } | 1016 | } |
1017 | // isn't this pretty stupid? We give one Todo to the KOTodoViewItem | 1017 | // isn't this pretty stupid? We give one Todo to the KOTodoViewItem |
1018 | // and one into the map. Sure finding is more easy but why? -zecke | 1018 | // and one into the map. Sure finding is more easy but why? -zecke |
1019 | KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this); | 1019 | KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this); |
1020 | return mTodoMap.insert(todo,todoItem); | 1020 | return mTodoMap.insert(todo,todoItem); |
1021 | } else { | 1021 | } else { |
1022 | // kdDebug() << " no Related" << endl; | 1022 | // kdDebug() << " no Related" << endl; |
1023 | // see above -zecke | 1023 | // see above -zecke |
1024 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); | 1024 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); |
1025 | return mTodoMap.insert(todo,todoItem); | 1025 | return mTodoMap.insert(todo,todoItem); |
1026 | } | 1026 | } |
1027 | } | 1027 | } |
1028 | 1028 | ||
1029 | 1029 | ||
1030 | void KOTodoView::updateConfig() | 1030 | void KOTodoView::updateConfig() |
1031 | { | 1031 | { |
1032 | updateView(); | 1032 | updateView(); |
1033 | mTodoListView->repaintContents(); | 1033 | mTodoListView->repaintContents(); |
1034 | } | 1034 | } |
1035 | 1035 | ||
1036 | QPtrList<Incidence> KOTodoView::selectedIncidences() | 1036 | QPtrList<Incidence> KOTodoView::selectedIncidences() |
1037 | { | 1037 | { |
1038 | QPtrList<Incidence> selected; | 1038 | QPtrList<Incidence> selected; |
1039 | 1039 | ||
1040 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); | 1040 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); |
1041 | // if (!item) item = mActiveItem; | 1041 | // if (!item) item = mActiveItem; |
1042 | if (item) selected.append(item->todo()); | 1042 | if (item) selected.append(item->todo()); |
1043 | 1043 | ||
1044 | return selected; | 1044 | return selected; |
1045 | } | 1045 | } |
1046 | 1046 | ||
1047 | QPtrList<Todo> KOTodoView::selectedTodos() | 1047 | QPtrList<Todo> KOTodoView::selectedTodos() |
1048 | { | 1048 | { |
1049 | QPtrList<Todo> selected; | 1049 | QPtrList<Todo> selected; |
1050 | 1050 | ||
1051 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); | 1051 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); |
1052 | // if (!item) item = mActiveItem; | 1052 | // if (!item) item = mActiveItem; |
1053 | if (item) selected.append(item->todo()); | 1053 | if (item) selected.append(item->todo()); |
1054 | 1054 | ||
1055 | return selected; | 1055 | return selected; |
1056 | } | 1056 | } |
1057 | 1057 | ||
1058 | void KOTodoView::changeEventDisplay(Event *, int) | 1058 | void KOTodoView::changeEventDisplay(Event *, int) |
1059 | { | 1059 | { |
1060 | updateView(); | 1060 | updateView(); |
1061 | } | 1061 | } |
1062 | 1062 | ||
1063 | void KOTodoView::showDates(const QDate &, const QDate &) | 1063 | void KOTodoView::showDates(const QDate &, const QDate &) |
1064 | { | 1064 | { |
1065 | } | 1065 | } |
1066 | 1066 | ||
1067 | void KOTodoView::showEvents(QPtrList<Event>) | 1067 | void KOTodoView::showEvents(QPtrList<Event>) |
1068 | { | 1068 | { |
1069 | kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl; | 1069 | kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl; |
1070 | } | 1070 | } |
1071 | 1071 | ||
1072 | void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 1072 | void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
1073 | const QDate &td) | 1073 | const QDate &td) |
1074 | { | 1074 | { |
1075 | #ifndef KORG_NOPRINTER | 1075 | #ifndef KORG_NOPRINTER |
1076 | calPrinter->preview(CalPrinter::Todolist, fd, td); | 1076 | calPrinter->preview(CalPrinter::Todolist, fd, td); |
1077 | #endif | 1077 | #endif |
1078 | } | 1078 | } |
1079 | 1079 | ||
1080 | void KOTodoView::editItem(QListViewItem *item ) | 1080 | void KOTodoView::editItem(QListViewItem *item ) |
1081 | { | 1081 | { |
1082 | emit editTodoSignal(((KOTodoViewItem *)item)->todo()); | 1082 | emit editTodoSignal(((KOTodoViewItem *)item)->todo()); |
1083 | } | 1083 | } |
1084 | 1084 | ||
1085 | void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) | 1085 | void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) |
1086 | { | 1086 | { |
1087 | emit showTodoSignal(((KOTodoViewItem *)item)->todo()); | 1087 | emit showTodoSignal(((KOTodoViewItem *)item)->todo()); |
1088 | } | 1088 | } |
1089 | 1089 | ||
1090 | void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column) | 1090 | void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column) |
1091 | { | 1091 | { |
1092 | pendingSubtodo = 0; | 1092 | pendingSubtodo = 0; |
1093 | mActiveItem = (KOTodoViewItem *)item; | 1093 | mActiveItem = (KOTodoViewItem *)item; |
1094 | if (item) { | 1094 | if (item) { |
1095 | switch (column){ | 1095 | switch (column){ |
1096 | case 1: | 1096 | case 1: |
1097 | mPriorityPopupMenu->popup(QCursor::pos ()); break; | 1097 | mPriorityPopupMenu->popup(QCursor::pos ()); break; |
1098 | case 2: | 1098 | case 2: |
1099 | mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break; | 1099 | mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break; |
1100 | case 3: | 1100 | case 3: |
1101 | moveTodo(); | 1101 | moveTodo(); |
1102 | break; | 1102 | break; |
1103 | case 8: | 1103 | case 8: |
1104 | mCategoryPopupMenu->popup(QCursor::pos ()); break; | 1104 | mCategoryPopupMenu->popup(QCursor::pos ()); break; |
1105 | case 9: | 1105 | case 9: |
1106 | mCalPopupMenu->popup(QCursor::pos ()); break; | 1106 | mCalPopupMenu->popup(QCursor::pos ()); break; |
1107 | default: | 1107 | default: |
1108 | mItemPopupMenu->popup(QCursor::pos()); | 1108 | mItemPopupMenu->popup(QCursor::pos()); |
1109 | } | 1109 | } |
1110 | } else mPopupMenu->popup(QCursor::pos()); | 1110 | } else mPopupMenu->popup(QCursor::pos()); |
1111 | } | 1111 | } |
1112 | void KOTodoView::newTodo() | 1112 | void KOTodoView::newTodo() |
1113 | { | 1113 | { |
1114 | emit newTodoSignal(); | 1114 | emit newTodoSignal(); |
1115 | } | 1115 | } |
1116 | 1116 | ||
1117 | void KOTodoView::newSubTodo() | 1117 | void KOTodoView::newSubTodo() |
1118 | { | 1118 | { |
1119 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | 1119 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); |
1120 | if (mActiveItem) { | 1120 | if (mActiveItem) { |
1121 | if ( mQuickAdd->isVisible() && !mQuickAdd->text().isEmpty() && mQuickAdd->text() != i18n("Click to add a new Todo") ) { | 1121 | if ( mQuickAdd->isVisible() && !mQuickAdd->text().isEmpty() && mQuickAdd->text() != i18n("Click to add a new Todo") ) { |
1122 | addQuickTodoPar( mActiveItem->todo()); | 1122 | addQuickTodoPar( mActiveItem->todo()); |
1123 | } else | 1123 | } else |
1124 | emit newSubTodoSignal(mActiveItem->todo()); | 1124 | emit newSubTodoSignal(mActiveItem->todo()); |
1125 | } | 1125 | } |
1126 | } | 1126 | } |
1127 | void KOTodoView::unparentTodo() | 1127 | void KOTodoView::unparentTodo() |
1128 | { | 1128 | { |
1129 | if (mActiveItem) { | 1129 | if (mActiveItem) { |
1130 | emit unparentTodoSignal(mActiveItem->todo()); | 1130 | emit unparentTodoSignal(mActiveItem->todo()); |
1131 | } | 1131 | } |
1132 | } | 1132 | } |
1133 | 1133 | ||
1134 | void KOTodoView::reparentTodo() | 1134 | void KOTodoView::reparentTodo() |
1135 | { | 1135 | { |
1136 | if (mActiveItem) { | 1136 | if (mActiveItem) { |
1137 | topLevelWidget()->setCaption(i18n("Click on new parent item")); | 1137 | topLevelWidget()->setCaption(i18n("Click on new parent item")); |
1138 | pendingSubtodo = mActiveItem; | 1138 | pendingSubtodo = mActiveItem; |
1139 | } | 1139 | } |
1140 | } | 1140 | } |
1141 | void KOTodoView::editTodo() | 1141 | void KOTodoView::editTodo() |
1142 | { | 1142 | { |
1143 | if (mActiveItem) { | 1143 | if (mActiveItem) { |
1144 | emit editTodoSignal(mActiveItem->todo()); | 1144 | emit editTodoSignal(mActiveItem->todo()); |
1145 | } | 1145 | } |
1146 | } | 1146 | } |
1147 | void KOTodoView::cloneTodo() | 1147 | void KOTodoView::cloneTodo() |
1148 | { | 1148 | { |
1149 | if (mActiveItem) { | 1149 | if (mActiveItem) { |
1150 | emit cloneTodoSignal((Incidence*)mActiveItem->todo()); | 1150 | emit cloneTodoSignal((Incidence*)mActiveItem->todo()); |
1151 | } | 1151 | } |
1152 | } | 1152 | } |
1153 | void KOTodoView::cancelTodo() | 1153 | void KOTodoView::cancelTodo() |
1154 | { | 1154 | { |
1155 | if (mActiveItem) { | 1155 | if (mActiveItem) { |
1156 | emit cancelTodoSignal((Incidence*)mActiveItem->todo()); | 1156 | emit cancelTodoSignal((Incidence*)mActiveItem->todo()); |
1157 | } | 1157 | } |
1158 | } | 1158 | } |
1159 | void KOTodoView::moveTodo() | 1159 | void KOTodoView::moveTodo() |
1160 | { | 1160 | { |
1161 | if (mActiveItem) { | 1161 | if (mActiveItem) { |
1162 | emit moveTodoSignal((Incidence*)mActiveItem->todo()); | 1162 | emit moveTodoSignal((Incidence*)mActiveItem->todo()); |
1163 | } | 1163 | } |
1164 | } | 1164 | } |
1165 | void KOTodoView::beamTodo() | 1165 | void KOTodoView::beamTodo() |
1166 | { | 1166 | { |
1167 | if (mActiveItem) { | 1167 | if (mActiveItem) { |
1168 | emit beamTodoSignal((Incidence*)mActiveItem->todo()); | 1168 | emit beamTodoSignal((Incidence*)mActiveItem->todo()); |
1169 | } | 1169 | } |
1170 | } | 1170 | } |
1171 | 1171 | ||
1172 | 1172 | ||
1173 | void KOTodoView::showTodo() | 1173 | void KOTodoView::showTodo() |
1174 | { | 1174 | { |
1175 | if (mActiveItem) { | 1175 | if (mActiveItem) { |
1176 | emit showTodoSignal(mActiveItem->todo()); | 1176 | emit showTodoSignal(mActiveItem->todo()); |
1177 | } | 1177 | } |
1178 | } | 1178 | } |
1179 | 1179 | ||
1180 | void KOTodoView::deleteTodo() | 1180 | void KOTodoView::deleteTodo() |
1181 | { | 1181 | { |
1182 | if (mActiveItem) { | 1182 | if (mActiveItem) { |
1183 | emit deleteTodoSignal(mActiveItem->todo()); | 1183 | emit deleteTodoSignal(mActiveItem->todo()); |
1184 | } | 1184 | } |
1185 | } | 1185 | } |
1186 | 1186 | ||
1187 | void KOTodoView::setNewPriority(int index) | 1187 | void KOTodoView::setNewPriority(int index) |
1188 | { | 1188 | { |
1189 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 1189 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
1190 | mActiveItem->todo()->setPriority(mPriority[index]); | 1190 | mActiveItem->todo()->setPriority(mPriority[index]); |
1191 | mActiveItem->construct(); | 1191 | mActiveItem->construct(); |
1192 | todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED); | 1192 | todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED); |
1193 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 1193 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
1194 | } | 1194 | } |
1195 | processSelectionChange(); | 1195 | processSelectionChange(); |
1196 | } | 1196 | } |
1197 | 1197 | ||
1198 | void KOTodoView::setNewPercentage(int index) | 1198 | void KOTodoView::setNewPercentage(int index) |
1199 | { | 1199 | { |
1200 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 1200 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
1201 | 1201 | ||
1202 | if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) { | 1202 | if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) { |
1203 | mActiveItem->setOn( true ); | 1203 | mActiveItem->setOn( true ); |
1204 | processSelectionChange(); | 1204 | processSelectionChange(); |
1205 | return; | 1205 | return; |
1206 | } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) { | 1206 | } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) { |
1207 | KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent())); | 1207 | KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent())); |
1208 | if ( par && par->isOn() ) | 1208 | if ( par && par->isOn() ) |
1209 | par->setOn( false ); | 1209 | par->setOn( false ); |
1210 | } | 1210 | } |
1211 | if (mPercentage[index] == 100) { | 1211 | if (mPercentage[index] == 100) { |
1212 | mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); | 1212 | mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); |
1213 | } else { | 1213 | } else { |
1214 | mActiveItem->todo()->setCompleted(false); | 1214 | mActiveItem->todo()->setCompleted(false); |
1215 | } | 1215 | } |
1216 | mActiveItem->todo()->setPercentComplete(mPercentage[index]); | 1216 | mActiveItem->todo()->setPercentComplete(mPercentage[index]); |
1217 | mActiveItem->construct(); | 1217 | mActiveItem->construct(); |
1218 | todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); | 1218 | todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); |
1219 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 1219 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
1220 | } | 1220 | } |
1221 | processSelectionChange(); | 1221 | processSelectionChange(); |
1222 | } | 1222 | } |
1223 | 1223 | ||
1224 | void KOTodoView::fillCategories () | 1224 | void KOTodoView::fillCategories () |
1225 | { | 1225 | { |
1226 | mCategoryPopupMenu->clear(); | 1226 | mCategoryPopupMenu->clear(); |
1227 | if ( ! mActiveItem ) return; | 1227 | if ( ! mActiveItem ) return; |
1228 | QStringList checkedCategories = mActiveItem->todo()->categories (); | 1228 | QStringList checkedCategories = mActiveItem->todo()->categories (); |
1229 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); | 1229 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); |
1230 | it != KOPrefs::instance()->mCustomCategories.end (); | 1230 | it != KOPrefs::instance()->mCustomCategories.end (); |
1231 | ++it) { | 1231 | ++it) { |
1232 | int index = mCategoryPopupMenu->insertItem (*it); | 1232 | int index = mCategoryPopupMenu->insertItem (*it); |
1233 | mCategory[index] = *it; | 1233 | mCategory[index] = *it; |
1234 | if (checkedCategories.find (*it) != checkedCategories.end ()) mCategoryPopupMenu->setItemChecked (index, true); | 1234 | if (checkedCategories.find (*it) != checkedCategories.end ()) mCategoryPopupMenu->setItemChecked (index, true); |
1235 | } | 1235 | } |
1236 | } | 1236 | } |
1237 | void KOTodoView::fillCal () | 1237 | void KOTodoView::fillCal () |
1238 | { | 1238 | { |
1239 | mCalPopupMenu->clear(); | 1239 | mCalPopupMenu->clear(); |
1240 | if (!mActiveItem) return; | 1240 | if (!mActiveItem) return; |
1241 | bool readO = mActiveItem->todo()->isReadOnly(); | 1241 | bool readO = mActiveItem->todo()->isReadOnly(); |
1242 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | 1242 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); |
1243 | while ( kkf ) { | 1243 | while ( kkf ) { |
1244 | int index = mCalPopupMenu->insertItem( kkf->mName, kkf->mCalNumber); | 1244 | int index = mCalPopupMenu->insertItem( kkf->mName, kkf->mCalNumber); |
1245 | if ( kkf->mErrorOnLoad || kkf->isReadOnly || readO ) | 1245 | if ( kkf->mErrorOnLoad || kkf->isReadOnly || readO ) |
1246 | mCalPopupMenu->setItemEnabled( index, false ); | 1246 | mCalPopupMenu->setItemEnabled( index, false ); |
1247 | mCalPopupMenu->setItemChecked (index, kkf->mCalNumber == mActiveItem->todo()->calID()); | 1247 | mCalPopupMenu->setItemChecked (index, kkf->mCalNumber == mActiveItem->todo()->calID()); |
1248 | kkf = KOPrefs::instance()->mCalendars.next(); | 1248 | kkf = KOPrefs::instance()->mCalendars.next(); |
1249 | } | 1249 | } |
1250 | } | 1250 | } |
1251 | void KOTodoView::changedCal (int index ) | 1251 | void KOTodoView::changedCal (int index ) |
1252 | { | 1252 | { |
1253 | if (!mActiveItem) return; | 1253 | if (!mActiveItem) return; |
1254 | mActiveItem->todo()->setCalID( index ); | 1254 | mActiveItem->todo()->setCalID( index ); |
1255 | mActiveItem->construct(); | 1255 | mActiveItem->construct(); |
1256 | } | 1256 | } |
1257 | void KOTodoView::changedCategories(int index) | 1257 | void KOTodoView::changedCategories(int index) |
1258 | { | 1258 | { |
1259 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 1259 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
1260 | QStringList categories = mActiveItem->todo()->categories (); | 1260 | QStringList categories = mActiveItem->todo()->categories (); |
1261 | QString colcat = categories.first(); | 1261 | QString colcat = categories.first(); |
1262 | if (categories.find (mCategory[index]) != categories.end ()) | 1262 | if (categories.find (mCategory[index]) != categories.end ()) |
1263 | categories.remove (mCategory[index]); | 1263 | categories.remove (mCategory[index]); |
1264 | else | 1264 | else |
1265 | categories.insert (categories.end(), mCategory[index]); | 1265 | categories.insert (categories.end(), mCategory[index]); |
1266 | categories.sort (); | 1266 | categories.sort (); |
1267 | if ( !colcat.isEmpty() ) { | 1267 | if ( !colcat.isEmpty() ) { |
1268 | if ( categories.find ( colcat ) != categories.end () ) { | 1268 | if ( categories.find ( colcat ) != categories.end () ) { |
1269 | categories.remove( colcat ); | 1269 | categories.remove( colcat ); |
1270 | categories.prepend( colcat ); | 1270 | categories.prepend( colcat ); |
1271 | } | 1271 | } |
1272 | } | 1272 | } |
1273 | mActiveItem->todo()->setCategories (categories); | 1273 | mActiveItem->todo()->setCategories (categories); |
1274 | mActiveItem->construct(); | 1274 | mActiveItem->construct(); |
1275 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 1275 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
1276 | todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); | 1276 | todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); |
1277 | } | 1277 | } |
1278 | } | 1278 | } |
1279 | void KOTodoView::itemDoubleClicked(QListViewItem *item) | 1279 | void KOTodoView::itemDoubleClicked(QListViewItem *item) |
1280 | { | 1280 | { |
1281 | if ( pendingSubtodo != 0 ) { | 1281 | if ( pendingSubtodo != 0 ) { |
1282 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); | 1282 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); |
1283 | } | 1283 | } |
1284 | pendingSubtodo = 0; | 1284 | pendingSubtodo = 0; |
1285 | //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() ); | 1285 | //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() ); |
1286 | int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() ); | 1286 | int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() ); |
1287 | //qDebug("ROW %d ", row); | 1287 | //qDebug("ROW %d ", row); |
1288 | if (!item) { | 1288 | if (!item) { |
1289 | newTodo(); | 1289 | newTodo(); |
1290 | return; | 1290 | return; |
1291 | } else { | 1291 | } else { |
1292 | if ( row == 1 ) { | 1292 | if ( row == 1 ) { |
1293 | mActiveItem = (KOTodoViewItem *) item; | 1293 | mActiveItem = (KOTodoViewItem *) item; |
1294 | newSubTodo(); | 1294 | newSubTodo(); |
1295 | return; | 1295 | return; |
1296 | } | 1296 | } |
1297 | if ( row == 5 || row == 6 || row == 2) { | 1297 | if ( row == 5 || row == 6 || row == 2) { |
1298 | mActiveItem = (KOTodoViewItem *) item; | 1298 | mActiveItem = (KOTodoViewItem *) item; |
1299 | Todo * t = mActiveItem->todo(); | 1299 | Todo * t = mActiveItem->todo(); |
1300 | if ( t->isRunning() ) { | 1300 | if ( t->isRunning() ) { |
1301 | if ( t->runTime() < 15) { | 1301 | if ( t->runTime() < 15) { |
1302 | t->stopRunning(); | 1302 | t->stopRunning(); |
1303 | mActiveItem->construct(); | 1303 | mActiveItem->construct(); |
1304 | topLevelWidget()->setCaption(i18n("Todo stopped - no data saved because runtime was < 15 sec!")); | 1304 | topLevelWidget()->setCaption(i18n("Todo stopped - no data saved because runtime was < 15 sec!")); |
1305 | return; | 1305 | return; |
1306 | } | 1306 | } |
1307 | else | 1307 | else |
1308 | toggleRunningItem(); | 1308 | toggleRunningItem(); |
1309 | return; | 1309 | return; |
1310 | } else { | 1310 | } else { |
1311 | t->setRunning( true ); | 1311 | t->setRunning( true ); |
1312 | mActiveItem->construct(); | 1312 | mActiveItem->construct(); |
1313 | topLevelWidget()->setCaption(i18n("Todo started! Double click again to stop!")); | 1313 | topLevelWidget()->setCaption(i18n("Todo started! Double click again to stop!")); |
1314 | return; | 1314 | return; |
1315 | } | 1315 | } |
1316 | } | 1316 | } |
1317 | } | 1317 | } |
1318 | if ( KOPrefs::instance()->mEditOnDoubleClick ) | 1318 | if ( KOPrefs::instance()->mEditOnDoubleClick ) |
1319 | editItem( item ); | 1319 | editItem( item ); |
1320 | else | 1320 | else |
1321 | showItem( item , QPoint(), 0 ); | 1321 | showItem( item , QPoint(), 0 ); |
1322 | } | 1322 | } |
1323 | void KOTodoView::toggleRunningItem() | 1323 | void KOTodoView::toggleRunningItem() |
1324 | { | 1324 | { |
1325 | // qDebug("KOTodoView::toggleRunning() "); | 1325 | // qDebug("KOTodoView::toggleRunning() "); |
1326 | if ( ! mActiveItem ) | 1326 | if ( ! mActiveItem ) |
1327 | return; | 1327 | return; |
1328 | Todo * t = mActiveItem->todo(); | 1328 | Todo * t = mActiveItem->todo(); |
1329 | if ( t->isRunning() ) { | 1329 | if ( t->isRunning() ) { |
1330 | KOStopTodoPrefs tp ( t, this ); | 1330 | KOStopTodoPrefs tp ( t, this ); |
1331 | if (QApplication::desktop()->width() <= 800 ){ | 1331 | if (QApplication::desktop()->width() <= 800 ){ |
1332 | int wid = tp.width(); | 1332 | int wid = tp.width(); |
1333 | int hei = tp.height(); | 1333 | int hei = tp.height(); |
1334 | int xx = (QApplication::desktop()->width()-wid)/2; | 1334 | int xx = (QApplication::desktop()->width()-wid)/2; |
1335 | int yy = (QApplication::desktop()->height()-hei)/2; | 1335 | int yy = (QApplication::desktop()->height()-hei)/2; |
1336 | tp.setGeometry( xx,yy,wid,hei ); | 1336 | tp.setGeometry( xx,yy,wid,hei ); |
1337 | } | 1337 | } |
1338 | tp.exec(); | 1338 | tp.exec(); |
1339 | mActiveItem->construct(); | 1339 | mActiveItem->construct(); |
1340 | } else { | 1340 | } else { |
1341 | KOStartTodoPrefs tp ( t->summary(), this ); | 1341 | KOStartTodoPrefs tp ( t->summary(), this ); |
1342 | if (QApplication::desktop()->width() <= 800 ){ | 1342 | if (QApplication::desktop()->width() <= 800 ){ |
1343 | int wid = tp.width(); | 1343 | int wid = tp.width(); |
1344 | int hei = tp.height(); | 1344 | int hei = tp.height(); |
1345 | int xx = (QApplication::desktop()->width()-wid)/2; | 1345 | int xx = (QApplication::desktop()->width()-wid)/2; |
1346 | int yy = (QApplication::desktop()->height()-hei)/2; | 1346 | int yy = (QApplication::desktop()->height()-hei)/2; |
1347 | tp.setGeometry( xx,yy,wid,hei ); | 1347 | tp.setGeometry( xx,yy,wid,hei ); |
1348 | } | 1348 | } |
1349 | if ( !tp.exec() ) return; | 1349 | if ( !tp.exec() ) return; |
1350 | if ( tp.stopAll() ) { | 1350 | if ( tp.stopAll() ) { |
1351 | mCalendar->stopAllTodos(); | 1351 | mCalendar->stopAllTodos(); |
1352 | t->setRunning( true ); | 1352 | t->setRunning( true ); |
1353 | updateView(); | 1353 | updateView(); |
1354 | } else { | 1354 | } else { |
1355 | t->setRunning( true ); | 1355 | t->setRunning( true ); |
1356 | mActiveItem->construct(); | 1356 | mActiveItem->construct(); |
1357 | } | 1357 | } |
1358 | } | 1358 | } |
1359 | } | 1359 | } |
1360 | 1360 | ||
1361 | void KOTodoView::itemClicked(QListViewItem *item) | 1361 | void KOTodoView::itemClicked(QListViewItem *item) |
1362 | { | 1362 | { |
1363 | //qDebug("KOTodoView::itemClicked %d", item); | 1363 | //qDebug("KOTodoView::itemClicked %d", item); |
1364 | if (!item) { | 1364 | if (!item) { |
1365 | if ( pendingSubtodo != 0 ) { | 1365 | if ( pendingSubtodo != 0 ) { |
1366 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); | 1366 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); |
1367 | } | 1367 | } |
1368 | pendingSubtodo = 0; | 1368 | pendingSubtodo = 0; |
1369 | return; | 1369 | return; |
1370 | } | 1370 | } |
1371 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 1371 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
1372 | if ( pendingSubtodo != 0 ) { | 1372 | if ( pendingSubtodo != 0 ) { |
1373 | bool allowReparent = true; | 1373 | bool allowReparent = true; |
1374 | QListViewItem *par = item; | 1374 | QListViewItem *par = item; |
1375 | while ( par ) { | 1375 | while ( par ) { |
1376 | if ( par == pendingSubtodo ) { | 1376 | if ( par == pendingSubtodo ) { |
1377 | allowReparent = false; | 1377 | allowReparent = false; |
1378 | break; | 1378 | break; |
1379 | } | 1379 | } |
1380 | par = par->parent(); | 1380 | par = par->parent(); |
1381 | } | 1381 | } |
1382 | if ( !allowReparent ) { | 1382 | if ( !allowReparent ) { |
1383 | topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); | 1383 | topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); |
1384 | pendingSubtodo = 0; | 1384 | pendingSubtodo = 0; |
1385 | } else { | 1385 | } else { |
1386 | Todo* newParent = todoItem->todo(); | 1386 | Todo* newParent = todoItem->todo(); |
1387 | Todo* newSub = pendingSubtodo->todo(); | 1387 | Todo* newSub = pendingSubtodo->todo(); |
1388 | pendingSubtodo = 0; | 1388 | pendingSubtodo = 0; |
1389 | emit reparentTodoSignal( newParent,newSub ); | 1389 | emit reparentTodoSignal( newParent,newSub ); |
1390 | return; | 1390 | return; |
1391 | } | 1391 | } |
1392 | } | 1392 | } |
1393 | 1393 | ||
1394 | } | 1394 | } |
1395 | 1395 | ||
1396 | void KOTodoView::setDocumentId( const QString &id ) | 1396 | void KOTodoView::setDocumentId( const QString &id ) |
1397 | { | 1397 | { |
1398 | 1398 | ||
1399 | mDocPrefs->setDoc( id ); | 1399 | mDocPrefs->setDoc( id ); |
1400 | } | 1400 | } |
1401 | 1401 | ||
1402 | void KOTodoView::itemStateChanged( QListViewItem *item ) | 1402 | void KOTodoView::itemStateChanged( QListViewItem *item ) |
1403 | { | 1403 | { |
1404 | if (!item) return; | 1404 | if (!item) return; |
1405 | 1405 | ||
1406 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 1406 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
1407 | 1407 | ||
1408 | // kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; | 1408 | // kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; |
1409 | 1409 | ||
1410 | if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); | 1410 | if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); |
1411 | } | 1411 | } |
1412 | 1412 | ||
1413 | void KOTodoView::saveLayout(KConfig *config, const QString &group) const | 1413 | void KOTodoView::saveLayout(KConfig *config, const QString &group) const |
1414 | { | 1414 | { |
1415 | mTodoListView->saveLayout(config,group); | 1415 | mTodoListView->saveLayout(config,group); |
1416 | } | 1416 | } |
1417 | 1417 | ||
1418 | void KOTodoView::restoreLayout(KConfig *config, const QString &group) | 1418 | void KOTodoView::restoreLayout(KConfig *config, const QString &group) |
1419 | { | 1419 | { |
1420 | mTodoListView->restoreLayout(config,group); | 1420 | mTodoListView->restoreLayout(config,group); |
1421 | } | 1421 | } |
1422 | 1422 | ||
1423 | void KOTodoView::processSelectionChange() | 1423 | void KOTodoView::processSelectionChange() |
1424 | { | 1424 | { |
1425 | // kdDebug() << "KOTodoView::processSelectionChange()" << endl; | 1425 | // kdDebug() << "KOTodoView::processSelectionChange()" << endl; |
1426 | 1426 | ||
1427 | KOTodoViewItem *item = | 1427 | KOTodoViewItem *item = |
1428 | static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() ); | 1428 | static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() ); |
1429 | 1429 | ||
1430 | if ( !item ) { | 1430 | if ( !item ) { |
1431 | emit incidenceSelected( 0 ); | 1431 | emit incidenceSelected( 0 ); |
1432 | mNewSubBut->setEnabled( false ); | 1432 | mNewSubBut->setEnabled( false ); |
1433 | } else { | 1433 | } else { |
1434 | emit incidenceSelected( item->todo() ); | 1434 | emit incidenceSelected( item->todo() ); |
1435 | mNewSubBut->setEnabled( true ); | 1435 | mNewSubBut->setEnabled( true ); |
1436 | } | 1436 | } |
1437 | } | 1437 | } |
1438 | 1438 | ||
1439 | void KOTodoView::modified(bool b) | 1439 | void KOTodoView::modified(bool b) |
1440 | { | 1440 | { |
1441 | emit isModified(b); | 1441 | emit isModified(b); |
1442 | } | 1442 | } |
1443 | void KOTodoView::setTodoModified( Todo* todo ) | 1443 | void KOTodoView::setTodoModified( Todo* todo ) |
1444 | { | 1444 | { |
1445 | todoModified( todo, KOGlobals::UNKNOWN_MODIFIED ); | 1445 | todoModified( todo, KOGlobals::UNKNOWN_MODIFIED ); |
1446 | } | 1446 | } |
1447 | void KOTodoView::clearSelection() | 1447 | void KOTodoView::clearSelection() |
1448 | { | 1448 | { |
1449 | mTodoListView->selectAll( false ); | 1449 | mTodoListView->selectAll( false ); |
1450 | } | 1450 | } |
1451 | void KOTodoView::setAllOpen() | 1451 | void KOTodoView::setAllOpen() |
1452 | { | 1452 | { |
1453 | if ( isFlatDisplay ) { | 1453 | if ( isFlatDisplay ) { |
1454 | isFlatDisplay = false; | 1454 | isFlatDisplay = false; |
1455 | mPopupMenu->setItemChecked( 8,false ); | 1455 | mPopupMenu->setItemChecked( 8,false ); |
1456 | updateView(); | 1456 | updateView(); |
1457 | } else { | 1457 | } else { |
1458 | storeCurrentItem(); | 1458 | storeCurrentItem(); |
1459 | } | 1459 | } |
1460 | setOpen(mTodoListView->firstChild(), true); | 1460 | setOpen(mTodoListView->firstChild(), true); |
1461 | resetCurrentItem(); | 1461 | resetCurrentItem(); |
1462 | } | 1462 | } |
1463 | void KOTodoView::setAllClose() | 1463 | void KOTodoView::setAllClose() |
1464 | { | 1464 | { |
1465 | if ( isFlatDisplay ) { | 1465 | if ( isFlatDisplay ) { |
1466 | isFlatDisplay = false; | 1466 | isFlatDisplay = false; |
1467 | mPopupMenu->setItemChecked( 8,false ); | 1467 | mPopupMenu->setItemChecked( 8,false ); |
1468 | updateView(); | 1468 | updateView(); |
1469 | } else { | 1469 | } else { |
1470 | storeCurrentItem(); | 1470 | storeCurrentItem(); |
1471 | } | 1471 | } |
1472 | setOpen(mTodoListView->firstChild(), false); | 1472 | setOpen(mTodoListView->firstChild(), false); |
1473 | resetCurrentItem(); | 1473 | resetCurrentItem(); |
1474 | } | 1474 | } |
1475 | void KOTodoView::setOpen( QListViewItem* item, bool setOpenI) | 1475 | void KOTodoView::setOpen( QListViewItem* item, bool setOpenI) |
1476 | { | 1476 | { |
1477 | 1477 | ||
1478 | while ( item ) { | 1478 | while ( item ) { |
1479 | setOpen( item->firstChild(), setOpenI ); | 1479 | setOpen( item->firstChild(), setOpenI ); |
1480 | item->setOpen( setOpenI ); | 1480 | item->setOpen( setOpenI ); |
1481 | item = item->nextSibling(); | 1481 | item = item->nextSibling(); |
1482 | } | 1482 | } |
1483 | } | 1483 | } |
1484 | 1484 | ||
1485 | void KOTodoView::displayAllFlat() | 1485 | void KOTodoView::displayAllFlat() |
1486 | { | 1486 | { |
1487 | storeCurrentItem(); | 1487 | storeCurrentItem(); |
1488 | pendingSubtodo = 0; | 1488 | pendingSubtodo = 0; |
1489 | if ( mBlockUpdate ) { | 1489 | if ( mBlockUpdate ) { |
1490 | return; | 1490 | return; |
1491 | } | 1491 | } |
1492 | mPopupMenu->setItemChecked( 8,true ); | 1492 | mPopupMenu->setItemChecked( 8,true ); |
1493 | isFlatDisplay = true; | 1493 | isFlatDisplay = true; |
1494 | QPtrList<Todo> todoList = calendar()->todos(); | 1494 | QPtrList<Todo> todoList = calendar()->todos(); |
1495 | mTodoMap.clear(); | 1495 | mTodoMap.clear(); |
1496 | mTodoListView->clear(); | 1496 | mTodoListView->clear(); |
1497 | Todo *todo; | 1497 | Todo *todo; |
1498 | for(todo = todoList.first(); todo; todo = todoList.next()) { | 1498 | for(todo = todoList.first(); todo; todo = todoList.next()) { |
1499 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); | 1499 | if ( checkTodo( todo ) ) { |
1500 | mTodoMap.insert(todo,todoItem); | 1500 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); |
1501 | mTodoMap.insert(todo,todoItem); | ||
1502 | } | ||
1501 | } | 1503 | } |
1502 | resetCurrentItem(); | 1504 | resetCurrentItem(); |
1503 | } | 1505 | } |
1504 | 1506 | ||
1505 | void KOTodoView::setAllFlat() | 1507 | void KOTodoView::setAllFlat() |
1506 | { | 1508 | { |
1507 | if ( isFlatDisplay ) { | 1509 | if ( isFlatDisplay ) { |
1508 | isFlatDisplay = false; | 1510 | isFlatDisplay = false; |
1509 | mPopupMenu->setItemChecked( 8,false ); | 1511 | mPopupMenu->setItemChecked( 8,false ); |
1510 | updateView(); | 1512 | updateView(); |
1511 | return; | 1513 | return; |
1512 | } | 1514 | } |
1513 | displayAllFlat(); | 1515 | displayAllFlat(); |
1514 | } | 1516 | } |
1515 | 1517 | ||
1516 | void KOTodoView::purgeCompleted() | 1518 | void KOTodoView::purgeCompleted() |
1517 | { | 1519 | { |
1518 | emit purgeCompletedSignal(); | 1520 | emit purgeCompletedSignal(); |
1519 | 1521 | ||
1520 | } | 1522 | } |
1521 | void KOTodoView::toggleQuickTodo() | 1523 | void KOTodoView::toggleQuickTodo() |
1522 | { | 1524 | { |
1523 | if ( mQuickBar->isVisible() ) { | 1525 | if ( mQuickBar->isVisible() ) { |
1524 | mQuickBar->hide(); | 1526 | mQuickBar->hide(); |
1525 | KOPrefs::instance()->mEnableQuickTodo = false; | 1527 | KOPrefs::instance()->mEnableQuickTodo = false; |
1526 | } | 1528 | } |
1527 | else { | 1529 | else { |
1528 | mQuickBar->show(); | 1530 | mQuickBar->show(); |
1529 | KOPrefs::instance()->mEnableQuickTodo = true; | 1531 | KOPrefs::instance()->mEnableQuickTodo = true; |
1530 | } | 1532 | } |
1531 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); | 1533 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); |
1532 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); | 1534 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); |
1533 | } | 1535 | } |
1534 | 1536 | ||
1535 | void KOTodoView::toggleRunning() | 1537 | void KOTodoView::toggleRunning() |
1536 | { | 1538 | { |
1537 | KOPrefs::instance()->mHideNonStartedTodos = !KOPrefs::instance()->mHideNonStartedTodos; | 1539 | KOPrefs::instance()->mHideNonStartedTodos = !KOPrefs::instance()->mHideNonStartedTodos; |
1538 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); | 1540 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); |
1539 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); | 1541 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); |
1540 | updateView(); | 1542 | updateView(); |
1541 | if ( KOPrefs::instance()->mHideNonStartedTodos ) | 1543 | if ( KOPrefs::instance()->mHideNonStartedTodos ) |
1542 | topLevelWidget()->setCaption(i18n("Hide not Running")); | 1544 | topLevelWidget()->setCaption(i18n("Hide not Running")); |
1543 | else | 1545 | else |
1544 | topLevelWidget()->setCaption(i18n("Show not Running")); | 1546 | topLevelWidget()->setCaption(i18n("Show not Running")); |
1545 | } | 1547 | } |
1546 | 1548 | ||
1547 | void KOTodoView::toggleCompleted() | 1549 | void KOTodoView::toggleCompleted() |
1548 | { | 1550 | { |
1549 | KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo; | 1551 | KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo; |
1550 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); | 1552 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); |
1551 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); | 1553 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); |
1552 | updateView(); | 1554 | updateView(); |
1553 | if ( KOPrefs::instance()->mShowCompletedTodo ) | 1555 | if ( KOPrefs::instance()->mShowCompletedTodo ) |
1554 | topLevelWidget()->setCaption(i18n("Show Completed")); | 1556 | topLevelWidget()->setCaption(i18n("Show Completed")); |
1555 | else | 1557 | else |
1556 | topLevelWidget()->setCaption(i18n("Hide Completed")); | 1558 | topLevelWidget()->setCaption(i18n("Hide Completed")); |
1557 | } | 1559 | } |
1558 | 1560 | ||
1559 | void KOTodoView::addQuickTodo() | 1561 | void KOTodoView::addQuickTodo() |
1560 | { | 1562 | { |
1561 | addQuickTodoPar( 0 ); | 1563 | addQuickTodoPar( 0 ); |
1562 | } | 1564 | } |
1563 | void KOTodoView::addQuickTodoPar( Todo * parentTodo) | 1565 | void KOTodoView::addQuickTodoPar( Todo * parentTodo) |
1564 | { | 1566 | { |
1565 | Todo *todo = new Todo(); | 1567 | Todo *todo = new Todo(); |
1566 | todo->setSummary(mQuickAdd->text()); | 1568 | todo->setSummary(mQuickAdd->text()); |
1567 | todo->setOrganizer(KOPrefs::instance()->email()); | 1569 | todo->setOrganizer(KOPrefs::instance()->email()); |
1568 | if ( parentTodo ) { | 1570 | if ( parentTodo ) { |
1569 | todo->setRelatedTo(parentTodo); | 1571 | todo->setRelatedTo(parentTodo); |
1570 | 1572 | ||
1571 | todo->setCategories (parentTodo->categoriesStr ()); | 1573 | todo->setCategories (parentTodo->categoriesStr ()); |
1572 | todo->setSecrecy (parentTodo->secrecy ()); | 1574 | todo->setSecrecy (parentTodo->secrecy ()); |
1573 | if ( parentTodo->priority() < 3 ) | 1575 | if ( parentTodo->priority() < 3 ) |
1574 | todo->setPriority( parentTodo->priority() ); | 1576 | todo->setPriority( parentTodo->priority() ); |
1575 | todo->setCalID( parentTodo->calID() ); | 1577 | todo->setCalID( parentTodo->calID() ); |
1576 | } else { | 1578 | } else { |
1577 | CalFilter * cf = mCalendar->filter(); | 1579 | CalFilter * cf = mCalendar->filter(); |
1578 | if ( cf ) { | 1580 | if ( cf ) { |
1579 | if ( cf->isEnabled()&& cf->showCategories()) { | 1581 | if ( cf->isEnabled()&& cf->showCategories()) { |
1580 | todo->setCategories(cf->categoryList()); | 1582 | todo->setCategories(cf->categoryList()); |
1581 | } | 1583 | } |
1582 | if ( cf->isEnabled() ) | 1584 | if ( cf->isEnabled() ) |
1583 | todo->setSecrecy( cf->getSecrecy()); | 1585 | todo->setSecrecy( cf->getSecrecy()); |
1584 | } | 1586 | } |
1585 | } | 1587 | } |
1586 | mCalendar->addTodo(todo); | 1588 | mCalendar->addTodo(todo); |
1587 | mQuickAdd->setText(""); | 1589 | mQuickAdd->setText(""); |
1588 | todoModified (todo, KOGlobals::EVENTADDED ); | 1590 | todoModified (todo, KOGlobals::EVENTADDED ); |
1589 | updateView(); | 1591 | updateView(); |
1590 | 1592 | ||
1591 | } | 1593 | } |
1592 | void KOTodoView::keyPressEvent ( QKeyEvent * e ) | 1594 | void KOTodoView::keyPressEvent ( QKeyEvent * e ) |
1593 | { | 1595 | { |
1594 | // e->ignore(); | 1596 | // e->ignore(); |
1595 | //return; | 1597 | //return; |
1596 | //qDebug("KOTodoView::keyPressEvent "); | 1598 | //qDebug("KOTodoView::keyPressEvent "); |
1597 | switch ( e->key() ) { | 1599 | switch ( e->key() ) { |
1598 | case Qt::Key_Down: | 1600 | case Qt::Key_Down: |
1599 | case Qt::Key_Up: | 1601 | case Qt::Key_Up: |
1600 | QWidget::keyPressEvent ( e ); | 1602 | QWidget::keyPressEvent ( e ); |
1601 | break; | 1603 | break; |
1602 | 1604 | ||
1603 | case Qt::Key_Q: | 1605 | case Qt::Key_Q: |
1604 | toggleQuickTodo(); | 1606 | toggleQuickTodo(); |
1605 | break; | 1607 | break; |
1606 | case Qt::Key_U: | 1608 | case Qt::Key_U: |
1607 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { | 1609 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { |
1608 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | 1610 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); |
1609 | unparentTodo(); | 1611 | unparentTodo(); |
1610 | e->accept(); | 1612 | e->accept(); |
1611 | } else | 1613 | } else |
1612 | e->ignore(); | 1614 | e->ignore(); |
1613 | break; | 1615 | break; |
1614 | case Qt::Key_S: | 1616 | case Qt::Key_S: |
1615 | if ( e->state() == Qt::ControlButton ) { | 1617 | if ( e->state() == Qt::ControlButton ) { |
1616 | e->ignore(); | 1618 | e->ignore(); |
1617 | break; | 1619 | break; |
1618 | } | 1620 | } |
1619 | if ( e->state() == Qt::ShiftButton ) { | 1621 | if ( e->state() == Qt::ShiftButton ) { |
1620 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | 1622 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); |
1621 | reparentTodo(); | 1623 | reparentTodo(); |
1622 | e->accept(); | 1624 | e->accept(); |
1623 | } else | 1625 | } else |
1624 | e->ignore(); | 1626 | e->ignore(); |
1625 | break; | 1627 | break; |
1626 | case Qt::Key_P: | 1628 | case Qt::Key_P: |
1627 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { | 1629 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { |
1628 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | 1630 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); |
1629 | if ( pendingSubtodo ) | 1631 | if ( pendingSubtodo ) |
1630 | itemClicked(mActiveItem); | 1632 | itemClicked(mActiveItem); |
1631 | e->accept(); | 1633 | e->accept(); |
1632 | } else | 1634 | } else |
1633 | e->ignore(); | 1635 | e->ignore(); |
1634 | break; | 1636 | break; |
1635 | case Qt::Key_Escape: | 1637 | case Qt::Key_Escape: |
1636 | if ( pendingSubtodo ) { | 1638 | if ( pendingSubtodo ) { |
1637 | itemClicked(0); | 1639 | itemClicked(0); |
1638 | e->accept(); | 1640 | e->accept(); |
1639 | } else | 1641 | } else |
1640 | e->ignore(); | 1642 | e->ignore(); |
1641 | break; | 1643 | break; |
1642 | default: | 1644 | default: |
1643 | e->ignore(); | 1645 | e->ignore(); |
1644 | } | 1646 | } |
1645 | 1647 | ||
1646 | if ( true ) { | 1648 | if ( true ) { |
1647 | if ( e->key() == Qt::Key_I ) { | 1649 | if ( e->key() == Qt::Key_I ) { |
1648 | KOTodoViewItem*cn = (KOTodoViewItem*)mTodoListView->currentItem(); | 1650 | KOTodoViewItem*cn = (KOTodoViewItem*)mTodoListView->currentItem(); |
1649 | if ( cn ) { | 1651 | if ( cn ) { |
1650 | mActiveItem = cn; | 1652 | mActiveItem = cn; |
1651 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); | 1653 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); |
1652 | if ( ci ){ | 1654 | if ( ci ){ |
1653 | showTodo(); | 1655 | showTodo(); |
1654 | cn = (KOTodoViewItem*)cn->itemBelow(); | 1656 | cn = (KOTodoViewItem*)cn->itemBelow(); |
1655 | if ( cn ) { | 1657 | if ( cn ) { |
1656 | mTodoListView->setCurrentItem ( cn ); | 1658 | mTodoListView->setCurrentItem ( cn ); |
1657 | mTodoListView->ensureItemVisible ( cn ); | 1659 | mTodoListView->ensureItemVisible ( cn ); |
1658 | } | 1660 | } |
1659 | 1661 | ||
1660 | } | 1662 | } |
1661 | } | 1663 | } |
1662 | e->accept(); | 1664 | e->accept(); |
1663 | 1665 | ||
1664 | } | 1666 | } |
1665 | 1667 | ||
1666 | } | 1668 | } |
1667 | 1669 | ||
1668 | } | 1670 | } |
1669 | void KOTodoView::updateTodo( Todo * t, int type ) | 1671 | void KOTodoView::updateTodo( Todo * t, int type ) |
1670 | { | 1672 | { |
1671 | if ( mBlockUpdate) | 1673 | if ( mBlockUpdate) |
1672 | return; | 1674 | return; |
1673 | 1675 | ||
1674 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; | 1676 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; |
1675 | itemIterator = mTodoMap.find(t); | 1677 | itemIterator = mTodoMap.find(t); |
1676 | if (itemIterator != mTodoMap.end()) { | 1678 | if (itemIterator != mTodoMap.end()) { |
1677 | (*itemIterator)->construct(); | 1679 | (*itemIterator)->construct(); |
1678 | } else { | 1680 | } else { |
1679 | if ( type == KOGlobals::EVENTADDED ) { | 1681 | if ( type == KOGlobals::EVENTADDED ) { |
1680 | insertTodoItem( t ); | 1682 | insertTodoItem( t ); |
1681 | } | 1683 | } |
1682 | } | 1684 | } |
1683 | 1685 | ||
1684 | } | 1686 | } |
1685 | 1687 | ||
1686 | void KOTodoView::todoModified(Todo * t , int p ) | 1688 | void KOTodoView::todoModified(Todo * t , int p ) |
1687 | { | 1689 | { |
1688 | mBlockUpdate = true; | 1690 | mBlockUpdate = true; |
1689 | emit todoModifiedSignal ( t, p ); | 1691 | emit todoModifiedSignal ( t, p ); |
1690 | mBlockUpdate = false; | 1692 | mBlockUpdate = false; |
1691 | } | 1693 | } |