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