summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt6
-rw-r--r--korganizer/kotodoview.cpp6
2 files changed, 10 insertions, 2 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index d6b2dc7..79de197 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,236 +1,242 @@
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.14 ************
4
5Added 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.
6Added a button to add a subtodo quickly.
7
8
3********** VERSION 2.1.13 ************ 9********** VERSION 2.1.13 ************
4 10
5Fixed a problem in KA/Pi search. 11Fixed a problem in KA/Pi search.
6Fixed some minor problems in KO/Pi. 12Fixed some minor problems in KO/Pi.
7Added calendar selection possibility to the todo view popup and to the event/todo/journal editor. 13Added calendar selection possibility to the todo view popup and to the event/todo/journal editor.
8 14
9Fixed memory usage problems in KA/Pi: 15Fixed memory usage problems in KA/Pi:
10When loading data KA/Pi did load the file data twice. 16When loading data KA/Pi did load the file data twice.
11Example: 17Example:
12 A 600k file did consume 1200k memory during loading process. 18 A 600k file did consume 1200k memory during loading process.
13 This is fixed, it does now consume only 600k during loading process. 19 This is fixed, it does now consume only 600k during loading process.
14When saving data KA/Pi did consume a lot of memory for the data parsing during the save process. 20When saving data KA/Pi did consume a lot of memory for the data parsing during the save process.
15This is fixed. 21This is fixed.
16Example: 22Example:
17 Before saving a 600k file KA/Pi did consume 21.7 Meg of Ram. 23 Before saving a 600k file KA/Pi did consume 21.7 Meg of Ram.
18 When saving KA/Pi did consume 28.6 Meg of Ram. That causes a crash on the Zaurus because there was no memeory left in the system. 24 When saving KA/Pi did consume 28.6 Meg of Ram. That causes a crash on the Zaurus because there was no memeory left in the system.
19 Now KA/Pi is consuming on saving the same data 22.0 Meg of Ram during the save process. 25 Now KA/Pi is consuming on saving the same data 22.0 Meg of Ram during the save process.
20Note: The memory usage of KA/Pi after the data is loaded/saved has not changed. 26Note: The memory usage of KA/Pi after the data is loaded/saved has not changed.
21The saving of data may be a bit slower now. 27The saving of data may be a bit slower now.
22 28
23Fixed memory usage problems in KO/Pi: 29Fixed memory usage problems in KO/Pi:
24When KO/Pi did save the data to file, it did not release the used buffers after saving. 30When KO/Pi did save the data to file, it did not release the used buffers after saving.
25The used buffer was released after saving the next time, but there was new buffer space allocated again on that save operation. 31The used buffer was released after saving the next time, but there was new buffer space allocated again on that save operation.
26This is fixed. 32This is fixed.
27Example: 33Example:
28 When saving a 400k file KO/Pi do now use 400k less memory now. 34 When saving a 400k file KO/Pi do now use 400k less memory now.
29 35
30Optimized memory usage in KO/Pi Agenda view: 36Optimized memory usage in KO/Pi Agenda view:
31KO/Pi is storing some paint information in extra buffers for faster repainting of the agenda view. 37KO/Pi is storing some paint information in extra buffers for faster repainting of the agenda view.
32These buffers were not made smaller (i.e. downsized) because of performance reasons. 38These buffers were not made smaller (i.e. downsized) because of performance reasons.
33The handling of these buffers are now much smarter: 39The handling of these buffers are now much smarter:
34Two (of six) buffers are removed completely. 40Two (of six) buffers are removed completely.
35The remaing four buffers are now downsized after not using the agenda view for 45 seconds. 41The remaing four buffers are now downsized after not using the agenda view for 45 seconds.
36Such 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. 42Such that the memory usage of KO/Pi is smaller now in general ( because 2 buffers are removed) and is much smaller when not using the agenda view. That is very important when using fastload for KO/Pi.
37 43
38Worst case example ( for a maximum size agenda content): 44Worst case example ( for a maximum size agenda content):
39 When resizing the agenda content to a large scale, KO/Pi did use 17Meg of mem ( and did not use less memory until it was stopped). Now KO/Pi is using on the same operation only 14.3 Meg of mem and after 45 seconds not using the agenda view it uses only 9.4 Meg of mem. 45 When resizing the agenda content to a large scale, KO/Pi did use 17Meg of mem ( and did not use less memory until it was stopped). Now KO/Pi is using on the same operation only 14.3 Meg of mem and after 45 seconds not using the agenda view it uses only 9.4 Meg of mem.
40 46
41When 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. 47When switching to an unused Agenda view now KO/Pi is upizing the buffers again. This takes less than a second. Such that switching to Agenda view (after not using it for more than 45 seconds) is now a bit slower.
42 48
43Summary: 49Summary:
44Many memory wasting problems of KA/Pi and KO/Pi fixed such that it is better to use on the Zaurus. 50Many memory wasting problems of KA/Pi and KO/Pi fixed such that it is better to use on the Zaurus.
45 51
46********** VERSION 2.1.12 ************ 52********** VERSION 2.1.12 ************
47 53
48KO/Pi: 54KO/Pi:
49Many small usability fixes, e.g. rearranged the popup menus such that they are better to use on the Zaurus. 55Many small usability fixes, e.g. rearranged the popup menus such that they are better to use on the Zaurus.
50Fixed a problem with the month view when file was saved but KO/Pi was not the active window. 56Fixed a problem with the month view when file was saved but KO/Pi was not the active window.
51Fixed some problems in the resource config dialog (e.g. added a warning if you set all calendars to read-only). 57Fixed some problems in the resource config dialog (e.g. added a warning if you set all calendars to read-only).
52Fixed some other small problems. 58Fixed some other small problems.
53 59
54********** VERSION 2.1.11 ************ 60********** VERSION 2.1.11 ************
55 61
56KO/Pi: 62KO/Pi:
57Because we can have many calendars now in KO/Pi we can have more than one journal entry per day. 63Because we can have many calendars now in KO/Pi we can have more than one journal entry per day.
58Added features to handle (and add ) more than one journal entry per day. 64Added features to handle (and add ) more than one journal entry per day.
59Added option for a journal title. 65Added option for a journal title.
60 66
61Added info about the calendar, the item belongs to, to the event/todo/journal viewer. 67Added info about the calendar, the item belongs to, to the event/todo/journal viewer.
62Fixed a problem of the alarm of completed recurring todos. 68Fixed a problem of the alarm of completed recurring todos.
63Added to the event/todo editor to set quickly the category of an item. 69Added to the event/todo editor to set quickly the category of an item.
64 70
65 71
66Fixed some problems when calling KO/Pi or KA/Pi from the alarm applet. 72Fixed some problems when calling KO/Pi or KA/Pi from the alarm applet.
67 73
68Added KA/Pi multi sync to the multi sync called from the alarm applet. 74Added KA/Pi multi sync to the multi sync called from the alarm applet.
69 75
70********** VERSION 2.1.10 ************ 76********** VERSION 2.1.10 ************
71 77
72KO/Pi: 78KO/Pi:
73Importing Birthdays will now create another file resource "Birthdays" and import the birthday data from KA/Pi into that file. 79Importing Birthdays will now create another file resource "Birthdays" and import the birthday data from KA/Pi into that file.
74When a multidayevent is selected in monthview all occurences of this event in the monthview are now hightlighted. 80When a multidayevent is selected in monthview all occurences of this event in the monthview are now hightlighted.
75Fixed a bug in searching for a small timerange, i.e. one day. 81Fixed a bug in searching for a small timerange, i.e. one day.
76 82
77KA/Pi: 83KA/Pi:
78Fixed two problems in csv export. 84Fixed two problems in csv export.
79Fixed problems when calling the contact selection dialog from KO/Pi or OM/Pi. 85Fixed problems when calling the contact selection dialog from KO/Pi or OM/Pi.
80 86
81********** VERSION 2.1.9 ************ 87********** VERSION 2.1.9 ************
82 88
83KO/Pi: 89KO/Pi:
84Fixed some problems of the new search options in the search dialog. 90Fixed some problems of the new search options in the search dialog.
85Fixed some problems in the new resource config options. 91Fixed some problems in the new resource config options.
86Changed 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. 92Changed 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.
87Fixed a problem creating new events in the agenda view if at the day/time is already an agenda item shown: 93Fixed a problem creating new events in the agenda view if at the day/time is already an agenda item shown:
88Now 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. 94Now you can click on the bottom/top of an allday agenda item or on the left/right side of an agenda item to get the "new todo/new event" popup.
89 95
90Fixed a problem in recurrence range in syncing with DTM. 96Fixed a problem in recurrence range in syncing with DTM.
91 97
92KA/Pi: 98KA/Pi:
93Made it posiible to show in the contact overview the details of all data available for that contact( e.g. office, spouse, children, nickname ...) 99Made it posiible to show in the contact overview the details of all data available for that contact( e.g. office, spouse, children, nickname ...)
94 100
95PwM/Pi: 101PwM/Pi:
96Added "sec" to the timeout config settings to make it clear the timeout values are seconds. 102Added "sec" to the timeout config settings to make it clear the timeout values are seconds.
97 103
98********** VERSION 2.1.8 ************ 104********** VERSION 2.1.8 ************
99 105
100KO/Pi: 106KO/Pi:
101Added info about the completion state of a todo in the ListView/Searchdialog. 107Added info about the completion state of a todo in the ListView/Searchdialog.
102If in TodoView is selected "do not show compledted todos" then completed todos are not shown in the ListView as well. 108If in TodoView is selected "do not show compledted todos" then completed todos are not shown in the ListView as well.
103Fixed some updating problems when changing the filter. 109Fixed some updating problems when changing the filter.
104 110
105KA/Pi: 111KA/Pi:
106In the addressee selection dialog now the formatted name is shown, if not empty. 112In the addressee selection dialog now the formatted name is shown, if not empty.
107Added a column "category" to the addressee selection dialog to make it possible to sort addressees after category. 113Added a column "category" to the addressee selection dialog to make it possible to sort addressees after category.
108Now in the addressee selection dialog a selected contact is remove with a single click from the selected list. 114Now in the addressee selection dialog a selected contact is remove with a single click from the selected list.
109 115
110Fixed in the file selector on the Zaurus the problem that symbolic links to files/dirs were ignored. 116Fixed in the file selector on the Zaurus the problem that symbolic links to files/dirs were ignored.
111Fixed the sorting for size in the file selector on the Z. 117Fixed the sorting for size in the file selector on the Z.
112 118
113Changed the color selection dialog on the Zaurus to a more user friendly version. 119Changed the color selection dialog on the Zaurus to a more user friendly version.
114 120
115********** VERSION 2.1.7 ************ 121********** VERSION 2.1.7 ************
116 122
117KO/Pi: 123KO/Pi:
118Fixed several problems in the new Resource handling. 124Fixed several problems in the new Resource handling.
119Added more options to the search dialog. 125Added more options to the search dialog.
120Fixed a problem in the Month view. 126Fixed a problem in the Month view.
121Added more options to the dialog when setting a todo to stopped. 127Added more options to the dialog when setting a todo to stopped.
122 128
123Fixed two small problems in KO/Pi Alarm applet. 129Fixed two small problems in KO/Pi Alarm applet.
124 130
125********** VERSION 2.1.6 ************ 131********** VERSION 2.1.6 ************
126 132
127This release is for testing only. 133This release is for testing only.
128 134
129KO/Pi: 135KO/Pi:
130Added to the list view (the list view is used in search dialog as well) the possibility to print it. 136Added to the list view (the list view is used in search dialog as well) the possibility to print it.
131Added to the list view the possibility to hide entries, if you do not want to print all entries of the list view. 137Added to the list view the possibility to hide entries, if you do not want to print all entries of the list view.
132Added to the list view the possibility to add all subtodos of selected todos to an export/beam. 138Added to the list view the possibility to add all subtodos of selected todos to an export/beam.
133Added to the search dialog the possibility to make an additive search such that you can get a better list for export/printout. 139Added to the search dialog the possibility to make an additive search such that you can get a better list for export/printout.
134Added to the search dialog the possibility to hide the checkboxes such that there is more space for the list view on the Zaurus. 140Added to the search dialog the possibility to hide the checkboxes such that there is more space for the list view on the Zaurus.
135Fixed a problem in the AlarmTimer Applet: Now utf8 messages are displayed properly. 141Fixed a problem in the AlarmTimer Applet: Now utf8 messages are displayed properly.
136 142
137Added support for multiple calendar files in KO/Pi. Only local ical (*.ics) files are supported as calendars. 143Added support for multiple calendar files in KO/Pi. Only local ical (*.ics) files are supported as calendars.
138In the sync profile config it is still missing to specify a particular calendar to sync with this profile. That setting will be added later. 144In the sync profile config it is still missing to specify a particular calendar to sync with this profile. That setting will be added later.
139Now on every sync the set of calendars is synced which are enabled in the resource view. 145Now on every sync the set of calendars is synced which are enabled in the resource view.
140 146
141A calendar is enabled in the resource view if the "eye" column is checked. 147A calendar is enabled in the resource view if the "eye" column is checked.
142You can set a calendar to be the default for new items( "+" column ). 148You can set a calendar to be the default for new items( "+" column ).
143You can tell KO/Pi to ignore all alarm of a calendar ( "bell" column ) and you can set it readonly. 149You can tell KO/Pi to ignore all alarm of a calendar ( "bell" column ) and you can set it readonly.
144To find out how to add a new calendar and how to remove a calendar is left as an exercise to the reader ... 150To find out how to add a new calendar and how to remove a calendar is left as an exercise to the reader ...
145 151
146 152
147********** VERSION 2.1.5 ************ 153********** VERSION 2.1.5 ************
148 154
149This is the new stable version. 155This is the new stable version.
150Bugfix: 156Bugfix:
151Fixed a problem with agenda popup on the desktop in KO/Pi. 157Fixed a problem with agenda popup on the desktop in KO/Pi.
152Fixed a crash when reloading file, e.g. after a passive pi-sync synchronization. 158Fixed a crash when reloading file, e.g. after a passive pi-sync synchronization.
153Added config option to not display completed todos in agenda view. 159Added config option to not display completed todos in agenda view.
154Addressee view is now using the formatted name, if defined. 160Addressee view is now using the formatted name, if defined.
155That makes it possible to display "lastname, firstname" in that view now. 161That makes it possible to display "lastname, firstname" in that view now.
156To set the formatted name for all contacts, please use menu: 162To set the formatted name for all contacts, please use menu:
157Edit->Change->Set formatted name. 163Edit->Change->Set formatted name.
158Fixed the bug in KA/Pi that is was not possible to add images to a contact on Windows. 164Fixed the bug in KA/Pi that is was not possible to add images to a contact on Windows.
159 165
160********** VERSION 2.1.4 ************ 166********** VERSION 2.1.4 ************
161 167
162Fixed two more bugs in the KA/Pi CSV import dialog: 168Fixed two more bugs in the KA/Pi CSV import dialog:
163Made it possible to read multi-line fields and import it to the "Note" field. 169Made it possible to read multi-line fields and import it to the "Note" field.
164Fixed a problem in mapping custom fields, whatever a custem field is... 170Fixed a problem in mapping custom fields, whatever a custem field is...
165 171
166********** VERSION 2.1.3 ************ 172********** VERSION 2.1.3 ************
167 173
168Changed the menu structure of the alarm applet: 174Changed the menu structure of the alarm applet:
169Moved "Simulate" to " Play Beeps" submenu and re-added "Todo List". 175Moved "Simulate" to " Play Beeps" submenu and re-added "Todo List".
170 176
171Fixed several problems in the KA/Pi CSV import dialog: 177Fixed several problems in the KA/Pi CSV import dialog:
172Added "Category", made codec configureable and made it possible to map many fields to the "Note" field. 178Added "Category", made codec configureable and made it possible to map many fields to the "Note" field.
173 179
174 180
175********** VERSION 2.1.2 ************ 181********** VERSION 2.1.2 ************
176 182
177Fixed a problem closing the alarm dialog on Zaurus with "OK" button. 183Fixed a problem closing the alarm dialog on Zaurus with "OK" button.
178 184
179Fixed a problem when importing data from Outlook with mutiple categories set. 185Fixed a problem when importing data from Outlook with mutiple categories set.
180 186
181Changed display of days in datenavigator: 187Changed display of days in datenavigator:
182Birthdays are now blue, not dark green. 188Birthdays are now blue, not dark green.
183When todo view is shown, no birtdays are shown and days with due todos are shown blue. 189When todo view is shown, no birtdays are shown and days with due todos are shown blue.
184When journal view is shown, only holidays are shown and days with journals are blue. 190When journal view is shown, only holidays are shown and days with journals are blue.
185 191
186Added Backup options to global config: 192Added Backup options to global config:
187You 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 ). 193You 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 ).
188It 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. 194It 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.
189The 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. 195The backup is created when the application wants to save for the first time on a backup-day. You can specify the amount of backups and the day interval of backups.
190 196
191********** VERSION 2.1.1 ************ 197********** VERSION 2.1.1 ************
192 198
193Stable release 2.1.1! 199Stable release 2.1.1!
194 200
195KO/Pi: 201KO/Pi:
196Fixed one problem in the layout of the edit dialogs on the Zaurus with 640x480 display. 202Fixed one problem in the layout of the edit dialogs on the Zaurus with 640x480 display.
197 203
198********** VERSION 2.1.0 ************ 204********** VERSION 2.1.0 ************
199 205
200Stable release 2.1.0! 206Stable release 2.1.0!
201 207
202Summary of changes/fixes compared to version 2.0.6: 208Summary of changes/fixes compared to version 2.0.6:
203 209
204Many bugs of version 2.0.6 fixed. 210Many bugs of version 2.0.6 fixed.
205Most of them were small bugs, but some of them were important. 211Most of them were small bugs, but some of them were important.
206It is recommended to use version 2.1.0 and not version 2.0.6. 212It is recommended to use version 2.1.0 and not version 2.0.6.
207 213
208Important changes: 214Important changes:
209 215
210Added recurring todos to KO/Pi. 216Added recurring todos to KO/Pi.
211 217
212Added global application font settings (for all KDE-Pim/Pi apps) to the general settings. 218Added global application font settings (for all KDE-Pim/Pi apps) to the general settings.
213 219
214Made Passwordmanager PwM/Pi more userfriendly: Rearranged some toolbar icons, optimized setting of focus, fixed layout problems and more. 220Made Passwordmanager PwM/Pi more userfriendly: Rearranged some toolbar icons, optimized setting of focus, fixed layout problems and more.
215 221
216Datenavigator can now display many months. Very useful on the desktop. 222Datenavigator can now display many months. Very useful on the desktop.
217 223
218KO/Pi alarm applet changed: Made buttons in alarm dialog much bigger and other usebility enhancements. 224KO/Pi alarm applet changed: Made buttons in alarm dialog much bigger and other usebility enhancements.
219 225
220Made alarm sound working on Linux desktop. 226Made alarm sound working on Linux desktop.
221 227
222Made KO/Pi and KA/Pi running from a memory stick. Please read storage HowTo for details. 228Made KO/Pi and KA/Pi running from a memory stick. Please read storage HowTo for details.
223 229
224Added timetracking feature in KO/Pi todo view. Please read timetraker HowTo for details. 230Added timetracking feature in KO/Pi todo view. Please read timetraker HowTo for details.
225 231
226Many other usebility enhancements. 232Many other usebility enhancements.
227Special thanks to Ben for his suggestions! 233Special thanks to Ben for his suggestions!
228 234
229You can find the complete changelog 235You can find the complete changelog
230from version 1.7.7 to 2.1.0 236from version 1.7.7 to 2.1.0
231in the source package or on 237in the source package or on
232 238
233http://www.pi-sync.net/html/changelog.html 239http://www.pi-sync.net/html/changelog.html
234 240
235 241
236 242
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index c23a8ee..06d40b1 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -731,961 +731,963 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
731 731
732 connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); 732 connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) ));
733 connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); 733 connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) ));
734 connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); 734 connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) ));
735 735
736 connect( mTodoListView, SIGNAL(selectionChanged() ), 736 connect( mTodoListView, SIGNAL(selectionChanged() ),
737 SLOT( processSelectionChange() ) ); 737 SLOT( processSelectionChange() ) );
738 connect( mQuickAdd, SIGNAL( returnPressed () ), 738 connect( mQuickAdd, SIGNAL( returnPressed () ),
739 SLOT( addQuickTodo() ) ); 739 SLOT( addQuickTodo() ) );
740 740
741} 741}
742 742
743KOTodoView::~KOTodoView() 743KOTodoView::~KOTodoView()
744{ 744{
745 745
746#if QT_VERSION >= 0x030000 746#if QT_VERSION >= 0x030000
747 747
748#else 748#else
749 delete mKOTodoViewWhatsThis; 749 delete mKOTodoViewWhatsThis;
750#endif 750#endif
751 751
752 delete mDocPrefs; 752 delete mDocPrefs;
753} 753}
754QString KOTodoView::getWhatsThisText(QPoint p) 754QString KOTodoView::getWhatsThisText(QPoint p)
755{ 755{
756 KOTodoViewItem* item = ( KOTodoViewItem* ) mTodoListView->itemAt( p ); 756 KOTodoViewItem* item = ( KOTodoViewItem* ) mTodoListView->itemAt( p );
757 if ( item ) 757 if ( item )
758 return KIncidenceFormatter::instance()->getFormattedText( item->todo(), 758 return KIncidenceFormatter::instance()->getFormattedText( item->todo(),
759 KOPrefs::instance()->mWTshowDetails, 759 KOPrefs::instance()->mWTshowDetails,
760 KOPrefs::instance()->mWTshowCreated, 760 KOPrefs::instance()->mWTshowCreated,
761 KOPrefs::instance()->mWTshowChanged); 761 KOPrefs::instance()->mWTshowChanged);
762 return i18n("That is the todo view" ); 762 return i18n("That is the todo view" );
763 763
764} 764}
765 765
766void KOTodoView::jumpToDate () 766void KOTodoView::jumpToDate ()
767{ 767{
768 // if (mActiveItem) { 768 // if (mActiveItem) {
769// mActiveItem->todo()); 769// mActiveItem->todo());
770// if ( mActiveItem->todo()->hasDueDate() ) 770// if ( mActiveItem->todo()->hasDueDate() )
771// emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); 771// emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() );
772} 772}
773void KOTodoView::paintNeeded() 773void KOTodoView::paintNeeded()
774{ 774{
775 if ( mPendingUpdateBeforeRepaint ) { 775 if ( mPendingUpdateBeforeRepaint ) {
776 updateView(); 776 updateView();
777 mPendingUpdateBeforeRepaint = false; 777 mPendingUpdateBeforeRepaint = false;
778 } 778 }
779} 779}
780void KOTodoView::paintEvent(QPaintEvent * pevent) 780void KOTodoView::paintEvent(QPaintEvent * pevent)
781{ 781{
782 if ( mPendingUpdateBeforeRepaint ) { 782 if ( mPendingUpdateBeforeRepaint ) {
783 updateView(); 783 updateView();
784 mPendingUpdateBeforeRepaint = false; 784 mPendingUpdateBeforeRepaint = false;
785 } 785 }
786 KOrg::BaseView::paintEvent( pevent); 786 KOrg::BaseView::paintEvent( pevent);
787} 787}
788 788
789void KOTodoView::updateView() 789void KOTodoView::updateView()
790{ 790{
791 pendingSubtodo = 0; 791 pendingSubtodo = 0;
792 if ( mBlockUpdate ) { 792 if ( mBlockUpdate ) {
793 return; 793 return;
794 } 794 }
795 if ( !isVisible() ) { 795 if ( !isVisible() ) {
796 mPendingUpdateBeforeRepaint = true; 796 mPendingUpdateBeforeRepaint = true;
797 return; 797 return;
798 } 798 }
799 //qDebug("KOTodoView::updateView() %x", this); 799 //qDebug("KOTodoView::updateView() %x", this);
800 if ( isFlatDisplay ) { 800 if ( isFlatDisplay ) {
801 displayAllFlat(); 801 displayAllFlat();
802 return; 802 return;
803 } 803 }
804 storeCurrentItem(); 804 storeCurrentItem();
805 //qDebug("update "); 805 //qDebug("update ");
806// kdDebug() << "KOTodoView::updateView()" << endl; 806// kdDebug() << "KOTodoView::updateView()" << endl;
807 QFont fo = KOPrefs::instance()->mTodoViewFont; 807 QFont fo = KOPrefs::instance()->mTodoViewFont;
808 808
809 809
810 mTodoListView->clear(); 810 mTodoListView->clear();
811 if ( mName == "todolistsmall" ) { 811 if ( mName == "todolistsmall" ) {
812 if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { 812 if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) {
813 int ps = fo.pointSize() -2; 813 int ps = fo.pointSize() -2;
814 if ( ps > 12 ) 814 if ( ps > 12 )
815 ps -= 2; 815 ps -= 2;
816 fo.setPointSize( ps ); 816 fo.setPointSize( ps );
817 } 817 }
818 } 818 }
819 819
820 mTodoListView->setFont( fo ); 820 mTodoListView->setFont( fo );
821 // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); 821 // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont );
822 //mTodoListView->header()->setMaximumHeight(fm.height()); 822 //mTodoListView->header()->setMaximumHeight(fm.height());
823 QPtrList<Todo> todoList = calendar()->todos(); 823 QPtrList<Todo> todoList = calendar()->todos();
824 824
825/* 825/*
826 kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; 826 kdDebug() << "KOTodoView::updateView(): Todo List:" << endl;
827 Event *t; 827 Event *t;
828 for(t = todoList.first(); t; t = todoList.next()) { 828 for(t = todoList.first(); t; t = todoList.next()) {
829 kdDebug() << " " << t->getSummary() << endl; 829 kdDebug() << " " << t->getSummary() << endl;
830 830
831 if (t->getRelatedTo()) { 831 if (t->getRelatedTo()) {
832 kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; 832 kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl;
833 } 833 }
834 834
835 QPtrList<Event> l = t->getRelations(); 835 QPtrList<Event> l = t->getRelations();
836 Event *c; 836 Event *c;
837 for(c=l.first();c;c=l.next()) { 837 for(c=l.first();c;c=l.next()) {
838 kdDebug() << " - relation: " << c->getSummary() << endl; 838 kdDebug() << " - relation: " << c->getSummary() << endl;
839 } 839 }
840 } 840 }
841*/ 841*/
842 842
843 // Put for each Event a KOTodoViewItem in the list view. Don't rely on a 843 // Put for each Event a KOTodoViewItem in the list view. Don't rely on a
844 // specific order of events. That means that we have to generate parent items 844 // specific order of events. That means that we have to generate parent items
845 // recursively for proper hierarchical display of Todos. 845 // recursively for proper hierarchical display of Todos.
846 mTodoMap.clear(); 846 mTodoMap.clear();
847 Todo *todo; 847 Todo *todo;
848 todo = todoList.first();// todo; todo = todoList.next()) { 848 todo = todoList.first();// todo; todo = todoList.next()) {
849 while ( todo ) { 849 while ( todo ) {
850 bool next = true; 850 bool next = true;
851 // qDebug("todo %s ", todo->summary().latin1()); 851 // qDebug("todo %s ", todo->summary().latin1());
852 Incidence *incidence = todo->relatedTo(); 852 Incidence *incidence = todo->relatedTo();
853 while ( incidence ) { 853 while ( incidence ) {
854 if ( incidence->typeID() == todoID ) { 854 if ( incidence->typeID() == todoID ) {
855 //qDebug("related %s ",incidence->summary().latin1() ); 855 //qDebug("related %s ",incidence->summary().latin1() );
856 if ( !(todoList.contains ( ((Todo* )incidence ) ) ) && incidence->calEnabled() ) { 856 if ( !(todoList.contains ( ((Todo* )incidence ) ) ) && incidence->calEnabled() ) {
857 //qDebug("related not found "); 857 //qDebug("related not found ");
858 todoList.remove( ); 858 todoList.remove( );
859 todo = todoList.current(); 859 todo = todoList.current();
860 next = false; 860 next = false;
861 incidence = 0; 861 incidence = 0;
862 862
863 } else { 863 } else {
864 //qDebug("related found "); 864 //qDebug("related found ");
865 incidence = incidence->relatedTo(); 865 incidence = incidence->relatedTo();
866 } 866 }
867 } else 867 } else
868 incidence = 0; 868 incidence = 0;
869 } 869 }
870 if ( next ) 870 if ( next )
871 todo = todoList.next(); 871 todo = todoList.next();
872 } 872 }
873 873
874 for(todo = todoList.first(); todo; todo = todoList.next()) { 874 for(todo = todoList.first(); todo; todo = todoList.next()) {
875 if (!mTodoMap.contains(todo) && checkTodo( todo ) ) 875 if (!mTodoMap.contains(todo) && checkTodo( todo ) )
876 { 876 {
877 insertTodoItem(todo); 877 insertTodoItem(todo);
878 } 878 }
879 } 879 }
880 // Restore opened/closed state 880 // Restore opened/closed state
881 mTodoListView->blockSignals( true ); 881 mTodoListView->blockSignals( true );
882 if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); 882 if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() );
883 mTodoListView->blockSignals( false ); 883 mTodoListView->blockSignals( false );
884 resetCurrentItem(); 884 resetCurrentItem();
885} 885}
886 886
887void KOTodoView::storeCurrentItem() 887void KOTodoView::storeCurrentItem()
888{ 888{
889 mCurItem = 0; 889 mCurItem = 0;
890 mCurItemRootParent = 0; 890 mCurItemRootParent = 0;
891 mCurItemParent = 0; 891 mCurItemParent = 0;
892 mCurItemAbove = 0; 892 mCurItemAbove = 0;
893 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); 893 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
894 if (mActiveItem) { 894 if (mActiveItem) {
895 mCurItem = mActiveItem->todo(); 895 mCurItem = mActiveItem->todo();
896 KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove (); 896 KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove ();
897 if ( activeItemAbove ) 897 if ( activeItemAbove )
898 mCurItemAbove = activeItemAbove->todo(); 898 mCurItemAbove = activeItemAbove->todo();
899 mCurItemRootParent = mCurItem; 899 mCurItemRootParent = mCurItem;
900 mCurItemParent = mCurItemRootParent->relatedTo(); 900 mCurItemParent = mCurItemRootParent->relatedTo();
901 while ( mCurItemRootParent->relatedTo() != 0 ) 901 while ( mCurItemRootParent->relatedTo() != 0 )
902 mCurItemRootParent = mCurItemRootParent->relatedTo(); 902 mCurItemRootParent = mCurItemRootParent->relatedTo();
903 } 903 }
904 mActiveItem = 0; 904 mActiveItem = 0;
905} 905}
906 906
907void KOTodoView::resetCurrentItem() 907void KOTodoView::resetCurrentItem()
908{ 908{
909 //mTodoListView->setFocus(); 909 //mTodoListView->setFocus();
910 KOTodoViewItem* foundItem = 0; 910 KOTodoViewItem* foundItem = 0;
911 KOTodoViewItem* foundItemRoot = 0; 911 KOTodoViewItem* foundItemRoot = 0;
912 KOTodoViewItem* foundItemParent = 0; 912 KOTodoViewItem* foundItemParent = 0;
913 KOTodoViewItem* foundItemAbove = 0; 913 KOTodoViewItem* foundItemAbove = 0;
914 if ( mTodoListView->firstChild () ) { 914 if ( mTodoListView->firstChild () ) {
915 if ( mCurItem ) { 915 if ( mCurItem ) {
916 KOTodoViewItem* item = (KOTodoViewItem*)mTodoListView->firstChild (); 916 KOTodoViewItem* item = (KOTodoViewItem*)mTodoListView->firstChild ();
917 while ( item ) { 917 while ( item ) {
918 if ( item->todo() == mCurItem ) { 918 if ( item->todo() == mCurItem ) {
919 foundItem = item; 919 foundItem = item;
920 break; 920 break;
921 } else if ( item->todo() == mCurItemAbove ) { 921 } else if ( item->todo() == mCurItemAbove ) {
922 foundItemAbove = item; 922 foundItemAbove = item;
923 923
924 } 924 }
925 if ( item->todo() == mCurItemRootParent ) { 925 if ( item->todo() == mCurItemRootParent ) {
926 foundItemRoot = item; 926 foundItemRoot = item;
927 } 927 }
928 if ( item->todo() == mCurItemParent ) { 928 if ( item->todo() == mCurItemParent ) {
929 foundItemParent = item; 929 foundItemParent = item;
930 } 930 }
931 item = (KOTodoViewItem*)item->itemBelow(); 931 item = (KOTodoViewItem*)item->itemBelow();
932 } 932 }
933 if ( ! foundItem ) { 933 if ( ! foundItem ) {
934 if ( foundItemParent ) { 934 if ( foundItemParent ) {
935 foundItem = foundItemParent; 935 foundItem = foundItemParent;
936 } else { 936 } else {
937 if ( foundItemRoot ) 937 if ( foundItemRoot )
938 foundItem = foundItemRoot; 938 foundItem = foundItemRoot;
939 else 939 else
940 foundItem = foundItemAbove; 940 foundItem = foundItemAbove;
941 } 941 }
942 } 942 }
943 } 943 }
944 if ( foundItem ) { 944 if ( foundItem ) {
945 mTodoListView->setSelected ( foundItem, true ); 945 mTodoListView->setSelected ( foundItem, true );
946 mTodoListView->setCurrentItem( foundItem ); 946 mTodoListView->setCurrentItem( foundItem );
947 mTodoListView->ensureItemVisible( foundItem ); 947 mTodoListView->ensureItemVisible( foundItem );
948 } else { 948 } else {
949 if ( mTodoListView->firstChild () ) { 949 if ( mTodoListView->firstChild () ) {
950 mTodoListView->setSelected ( mTodoListView->firstChild (), true ); 950 mTodoListView->setSelected ( mTodoListView->firstChild (), true );
951 mTodoListView->setCurrentItem( mTodoListView->firstChild () ); 951 mTodoListView->setCurrentItem( mTodoListView->firstChild () );
952 } 952 }
953 } 953 }
954 } 954 }
955 processSelectionChange(); 955 processSelectionChange();
956 QTimer::singleShot( 100, this, SLOT ( resetFocusToList() )); 956 QTimer::singleShot( 100, this, SLOT ( resetFocusToList() ));
957} 957}
958void KOTodoView::resetFocusToList() 958void KOTodoView::resetFocusToList()
959{ 959{
960 topLevelWidget()->setActiveWindow(); 960 topLevelWidget()->setActiveWindow();
961 mTodoListView->setFocus(); 961 mTodoListView->setFocus();
962} 962}
963//Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove; 963//Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove;
964bool KOTodoView::checkTodo( Todo * todo ) 964bool KOTodoView::checkTodo( Todo * todo )
965{ 965{
966 966
967 if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() ) 967 if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() )
968 return false; 968 return false;
969 if ( !todo->isCompleted() ) { 969 if ( !todo->isCompleted() ) {
970 if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() ) 970 if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() )
971 return true; 971 return true;
972 } 972 }
973 if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) { 973 if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) {
974 if ( todo->hasStartDate() ) 974 if ( todo->hasStartDate() )
975 if ( mNavigator->selectedDates().last() < todo->dtStart().date() ) 975 if ( mNavigator->selectedDates().last() < todo->dtStart().date() )
976 return false; 976 return false;
977 if ( todo->hasDueDate() ) 977 if ( todo->hasDueDate() )
978 if ( mNavigator->selectedDates().first() > todo->dtDue().date() ) 978 if ( mNavigator->selectedDates().first() > todo->dtDue().date() )
979 return false; 979 return false;
980 } 980 }
981 return true; 981 return true;
982} 982}
983 983
984void KOTodoView::restoreItemState( QListViewItem *item ) 984void KOTodoView::restoreItemState( QListViewItem *item )
985{ 985{
986 pendingSubtodo = 0; 986 pendingSubtodo = 0;
987 while( item ) { 987 while( item ) {
988 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 988 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
989 todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); 989 todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) );
990 if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); 990 if( item->childCount() > 0 ) restoreItemState( item->firstChild() );
991 item = item->nextSibling(); 991 item = item->nextSibling();
992 } 992 }
993} 993}
994 994
995 995
996QMap<Todo *,KOTodoViewItem *>::ConstIterator 996QMap<Todo *,KOTodoViewItem *>::ConstIterator
997KOTodoView::insertTodoItem(Todo *todo) 997KOTodoView::insertTodoItem(Todo *todo)
998{ 998{
999 999
1000 // kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl; 1000 // kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl;
1001 // TODO: Check, if dynmaic cast is necessary 1001 // TODO: Check, if dynmaic cast is necessary
1002 1002
1003 pendingSubtodo = 0; 1003 pendingSubtodo = 0;
1004 Incidence *incidence = todo->relatedTo(); 1004 Incidence *incidence = todo->relatedTo();
1005 while ( incidence && !incidence->calEnabled() ) 1005 while ( incidence && !incidence->calEnabled() )
1006 incidence = incidence->relatedTo(); 1006 incidence = incidence->relatedTo();
1007 if (incidence && incidence->typeID() == todoID ) { 1007 if (incidence && incidence->typeID() == todoID ) {
1008 Todo *relatedTodo = static_cast<Todo *>(incidence); 1008 Todo *relatedTodo = static_cast<Todo *>(incidence);
1009 1009
1010 // kdDebug() << " has Related" << endl; 1010 // kdDebug() << " has Related" << endl;
1011 QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; 1011 QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator;
1012 itemIterator = mTodoMap.find(relatedTodo); 1012 itemIterator = mTodoMap.find(relatedTodo);
1013 if (itemIterator == mTodoMap.end()) { 1013 if (itemIterator == mTodoMap.end()) {
1014 // kdDebug() << " related not yet in list" << endl; 1014 // kdDebug() << " related not yet in list" << endl;
1015 itemIterator = insertTodoItem (relatedTodo); 1015 itemIterator = insertTodoItem (relatedTodo);
1016 } 1016 }
1017 // isn't this pretty stupid? We give one Todo to the KOTodoViewItem 1017 // isn't this pretty stupid? We give one Todo to the KOTodoViewItem
1018 // and one into the map. Sure finding is more easy but why? -zecke 1018 // and one into the map. Sure finding is more easy but why? -zecke
1019 KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this); 1019 KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this);
1020 return mTodoMap.insert(todo,todoItem); 1020 return mTodoMap.insert(todo,todoItem);
1021 } else { 1021 } else {
1022 // kdDebug() << " no Related" << endl; 1022 // kdDebug() << " no Related" << endl;
1023 // see above -zecke 1023 // see above -zecke
1024 KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); 1024 KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this);
1025 return mTodoMap.insert(todo,todoItem); 1025 return mTodoMap.insert(todo,todoItem);
1026 } 1026 }
1027} 1027}
1028 1028
1029 1029
1030void KOTodoView::updateConfig() 1030void KOTodoView::updateConfig()
1031{ 1031{
1032 updateView(); 1032 updateView();
1033 mTodoListView->repaintContents(); 1033 mTodoListView->repaintContents();
1034} 1034}
1035 1035
1036QPtrList<Incidence> KOTodoView::selectedIncidences() 1036QPtrList<Incidence> KOTodoView::selectedIncidences()
1037{ 1037{
1038 QPtrList<Incidence> selected; 1038 QPtrList<Incidence> selected;
1039 1039
1040 KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); 1040 KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem());
1041// if (!item) item = mActiveItem; 1041// if (!item) item = mActiveItem;
1042 if (item) selected.append(item->todo()); 1042 if (item) selected.append(item->todo());
1043 1043
1044 return selected; 1044 return selected;
1045} 1045}
1046 1046
1047QPtrList<Todo> KOTodoView::selectedTodos() 1047QPtrList<Todo> KOTodoView::selectedTodos()
1048{ 1048{
1049 QPtrList<Todo> selected; 1049 QPtrList<Todo> selected;
1050 1050
1051 KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); 1051 KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem());
1052// if (!item) item = mActiveItem; 1052// if (!item) item = mActiveItem;
1053 if (item) selected.append(item->todo()); 1053 if (item) selected.append(item->todo());
1054 1054
1055 return selected; 1055 return selected;
1056} 1056}
1057 1057
1058void KOTodoView::changeEventDisplay(Event *, int) 1058void KOTodoView::changeEventDisplay(Event *, int)
1059{ 1059{
1060 updateView(); 1060 updateView();
1061} 1061}
1062 1062
1063void KOTodoView::showDates(const QDate &, const QDate &) 1063void KOTodoView::showDates(const QDate &, const QDate &)
1064{ 1064{
1065} 1065}
1066 1066
1067void KOTodoView::showEvents(QPtrList<Event>) 1067void KOTodoView::showEvents(QPtrList<Event>)
1068{ 1068{
1069 kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl; 1069 kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl;
1070} 1070}
1071 1071
1072void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd, 1072void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd,
1073 const QDate &td) 1073 const QDate &td)
1074{ 1074{
1075#ifndef KORG_NOPRINTER 1075#ifndef KORG_NOPRINTER
1076 calPrinter->preview(CalPrinter::Todolist, fd, td); 1076 calPrinter->preview(CalPrinter::Todolist, fd, td);
1077#endif 1077#endif
1078} 1078}
1079 1079
1080void KOTodoView::editItem(QListViewItem *item ) 1080void KOTodoView::editItem(QListViewItem *item )
1081{ 1081{
1082 emit editTodoSignal(((KOTodoViewItem *)item)->todo()); 1082 emit editTodoSignal(((KOTodoViewItem *)item)->todo());
1083} 1083}
1084 1084
1085void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) 1085void KOTodoView::showItem(QListViewItem *item,const QPoint &,int)
1086{ 1086{
1087 emit showTodoSignal(((KOTodoViewItem *)item)->todo()); 1087 emit showTodoSignal(((KOTodoViewItem *)item)->todo());
1088} 1088}
1089 1089
1090void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column) 1090void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column)
1091{ 1091{
1092 pendingSubtodo = 0; 1092 pendingSubtodo = 0;
1093 mActiveItem = (KOTodoViewItem *)item; 1093 mActiveItem = (KOTodoViewItem *)item;
1094 if (item) { 1094 if (item) {
1095 switch (column){ 1095 switch (column){
1096 case 1: 1096 case 1:
1097 mPriorityPopupMenu->popup(QCursor::pos ()); break; 1097 mPriorityPopupMenu->popup(QCursor::pos ()); break;
1098 case 2: 1098 case 2:
1099 mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break; 1099 mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break;
1100 case 3: 1100 case 3:
1101 moveTodo(); 1101 moveTodo();
1102 break; 1102 break;
1103 case 8: 1103 case 8:
1104 mCategoryPopupMenu->popup(QCursor::pos ()); break; 1104 mCategoryPopupMenu->popup(QCursor::pos ()); break;
1105 case 9: 1105 case 9:
1106 mCalPopupMenu->popup(QCursor::pos ()); break; 1106 mCalPopupMenu->popup(QCursor::pos ()); break;
1107 default: 1107 default:
1108 mItemPopupMenu->popup(QCursor::pos()); 1108 mItemPopupMenu->popup(QCursor::pos());
1109 } 1109 }
1110 } else mPopupMenu->popup(QCursor::pos()); 1110 } else mPopupMenu->popup(QCursor::pos());
1111} 1111}
1112void KOTodoView::newTodo() 1112void KOTodoView::newTodo()
1113{ 1113{
1114 emit newTodoSignal(); 1114 emit newTodoSignal();
1115} 1115}
1116 1116
1117void KOTodoView::newSubTodo() 1117void KOTodoView::newSubTodo()
1118{ 1118{
1119 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); 1119 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
1120 if (mActiveItem) { 1120 if (mActiveItem) {
1121 if ( mQuickAdd->isVisible() && !mQuickAdd->text().isEmpty() && mQuickAdd->text() != i18n("Click to add a new Todo") ) { 1121 if ( mQuickAdd->isVisible() && !mQuickAdd->text().isEmpty() && mQuickAdd->text() != i18n("Click to add a new Todo") ) {
1122 addQuickTodoPar( mActiveItem->todo()); 1122 addQuickTodoPar( mActiveItem->todo());
1123 } else 1123 } else
1124 emit newSubTodoSignal(mActiveItem->todo()); 1124 emit newSubTodoSignal(mActiveItem->todo());
1125 } 1125 }
1126} 1126}
1127void KOTodoView::unparentTodo() 1127void KOTodoView::unparentTodo()
1128{ 1128{
1129 if (mActiveItem) { 1129 if (mActiveItem) {
1130 emit unparentTodoSignal(mActiveItem->todo()); 1130 emit unparentTodoSignal(mActiveItem->todo());
1131 } 1131 }
1132} 1132}
1133 1133
1134void KOTodoView::reparentTodo() 1134void KOTodoView::reparentTodo()
1135{ 1135{
1136 if (mActiveItem) { 1136 if (mActiveItem) {
1137 topLevelWidget()->setCaption(i18n("Click on new parent item")); 1137 topLevelWidget()->setCaption(i18n("Click on new parent item"));
1138 pendingSubtodo = mActiveItem; 1138 pendingSubtodo = mActiveItem;
1139 } 1139 }
1140} 1140}
1141void KOTodoView::editTodo() 1141void KOTodoView::editTodo()
1142{ 1142{
1143 if (mActiveItem) { 1143 if (mActiveItem) {
1144 emit editTodoSignal(mActiveItem->todo()); 1144 emit editTodoSignal(mActiveItem->todo());
1145 } 1145 }
1146} 1146}
1147void KOTodoView::cloneTodo() 1147void KOTodoView::cloneTodo()
1148{ 1148{
1149 if (mActiveItem) { 1149 if (mActiveItem) {
1150 emit cloneTodoSignal((Incidence*)mActiveItem->todo()); 1150 emit cloneTodoSignal((Incidence*)mActiveItem->todo());
1151 } 1151 }
1152} 1152}
1153void KOTodoView::cancelTodo() 1153void KOTodoView::cancelTodo()
1154{ 1154{
1155 if (mActiveItem) { 1155 if (mActiveItem) {
1156 emit cancelTodoSignal((Incidence*)mActiveItem->todo()); 1156 emit cancelTodoSignal((Incidence*)mActiveItem->todo());
1157 } 1157 }
1158} 1158}
1159void KOTodoView::moveTodo() 1159void KOTodoView::moveTodo()
1160{ 1160{
1161 if (mActiveItem) { 1161 if (mActiveItem) {
1162 emit moveTodoSignal((Incidence*)mActiveItem->todo()); 1162 emit moveTodoSignal((Incidence*)mActiveItem->todo());
1163 } 1163 }
1164} 1164}
1165void KOTodoView::beamTodo() 1165void KOTodoView::beamTodo()
1166{ 1166{
1167 if (mActiveItem) { 1167 if (mActiveItem) {
1168 emit beamTodoSignal((Incidence*)mActiveItem->todo()); 1168 emit beamTodoSignal((Incidence*)mActiveItem->todo());
1169 } 1169 }
1170} 1170}
1171 1171
1172 1172
1173void KOTodoView::showTodo() 1173void KOTodoView::showTodo()
1174{ 1174{
1175 if (mActiveItem) { 1175 if (mActiveItem) {
1176 emit showTodoSignal(mActiveItem->todo()); 1176 emit showTodoSignal(mActiveItem->todo());
1177 } 1177 }
1178} 1178}
1179 1179
1180void KOTodoView::deleteTodo() 1180void KOTodoView::deleteTodo()
1181{ 1181{
1182 if (mActiveItem) { 1182 if (mActiveItem) {
1183 emit deleteTodoSignal(mActiveItem->todo()); 1183 emit deleteTodoSignal(mActiveItem->todo());
1184 } 1184 }
1185} 1185}
1186 1186
1187void KOTodoView::setNewPriority(int index) 1187void KOTodoView::setNewPriority(int index)
1188{ 1188{
1189 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { 1189 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
1190 mActiveItem->todo()->setPriority(mPriority[index]); 1190 mActiveItem->todo()->setPriority(mPriority[index]);
1191 mActiveItem->construct(); 1191 mActiveItem->construct();
1192 todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED); 1192 todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED);
1193 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 1193 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
1194 } 1194 }
1195 processSelectionChange(); 1195 processSelectionChange();
1196} 1196}
1197 1197
1198void KOTodoView::setNewPercentage(int index) 1198void KOTodoView::setNewPercentage(int index)
1199{ 1199{
1200 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { 1200 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
1201 1201
1202 if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) { 1202 if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) {
1203 mActiveItem->setOn( true ); 1203 mActiveItem->setOn( true );
1204 processSelectionChange(); 1204 processSelectionChange();
1205 return; 1205 return;
1206 } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) { 1206 } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) {
1207 KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent())); 1207 KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent()));
1208 if ( par && par->isOn() ) 1208 if ( par && par->isOn() )
1209 par->setOn( false ); 1209 par->setOn( false );
1210 } 1210 }
1211 if (mPercentage[index] == 100) { 1211 if (mPercentage[index] == 100) {
1212 mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); 1212 mActiveItem->todo()->setCompleted(QDateTime::currentDateTime());
1213 } else { 1213 } else {
1214 mActiveItem->todo()->setCompleted(false); 1214 mActiveItem->todo()->setCompleted(false);
1215 } 1215 }
1216 mActiveItem->todo()->setPercentComplete(mPercentage[index]); 1216 mActiveItem->todo()->setPercentComplete(mPercentage[index]);
1217 mActiveItem->construct(); 1217 mActiveItem->construct();
1218 todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); 1218 todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED);
1219 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 1219 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
1220 } 1220 }
1221 processSelectionChange(); 1221 processSelectionChange();
1222} 1222}
1223 1223
1224void KOTodoView::fillCategories () 1224void KOTodoView::fillCategories ()
1225{ 1225{
1226 mCategoryPopupMenu->clear(); 1226 mCategoryPopupMenu->clear();
1227 if ( ! mActiveItem ) return; 1227 if ( ! mActiveItem ) return;
1228 QStringList checkedCategories = mActiveItem->todo()->categories (); 1228 QStringList checkedCategories = mActiveItem->todo()->categories ();
1229 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); 1229 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin ();
1230 it != KOPrefs::instance()->mCustomCategories.end (); 1230 it != KOPrefs::instance()->mCustomCategories.end ();
1231 ++it) { 1231 ++it) {
1232 int index = mCategoryPopupMenu->insertItem (*it); 1232 int index = mCategoryPopupMenu->insertItem (*it);
1233 mCategory[index] = *it; 1233 mCategory[index] = *it;
1234 if (checkedCategories.find (*it) != checkedCategories.end ()) mCategoryPopupMenu->setItemChecked (index, true); 1234 if (checkedCategories.find (*it) != checkedCategories.end ()) mCategoryPopupMenu->setItemChecked (index, true);
1235 } 1235 }
1236} 1236}
1237void KOTodoView::fillCal () 1237void KOTodoView::fillCal ()
1238{ 1238{
1239 mCalPopupMenu->clear(); 1239 mCalPopupMenu->clear();
1240 if (!mActiveItem) return; 1240 if (!mActiveItem) return;
1241 bool readO = mActiveItem->todo()->isReadOnly(); 1241 bool readO = mActiveItem->todo()->isReadOnly();
1242 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); 1242 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
1243 while ( kkf ) { 1243 while ( kkf ) {
1244 int index = mCalPopupMenu->insertItem( kkf->mName, kkf->mCalNumber); 1244 int index = mCalPopupMenu->insertItem( kkf->mName, kkf->mCalNumber);
1245 if ( kkf->mErrorOnLoad || kkf->isReadOnly || readO ) 1245 if ( kkf->mErrorOnLoad || kkf->isReadOnly || readO )
1246 mCalPopupMenu->setItemEnabled( index, false ); 1246 mCalPopupMenu->setItemEnabled( index, false );
1247 mCalPopupMenu->setItemChecked (index, kkf->mCalNumber == mActiveItem->todo()->calID()); 1247 mCalPopupMenu->setItemChecked (index, kkf->mCalNumber == mActiveItem->todo()->calID());
1248 kkf = KOPrefs::instance()->mCalendars.next(); 1248 kkf = KOPrefs::instance()->mCalendars.next();
1249 } 1249 }
1250} 1250}
1251void KOTodoView::changedCal (int index ) 1251void KOTodoView::changedCal (int index )
1252{ 1252{
1253 if (!mActiveItem) return; 1253 if (!mActiveItem) return;
1254 mActiveItem->todo()->setCalID( index ); 1254 mActiveItem->todo()->setCalID( index );
1255 mActiveItem->construct(); 1255 mActiveItem->construct();
1256} 1256}
1257void KOTodoView::changedCategories(int index) 1257void KOTodoView::changedCategories(int index)
1258{ 1258{
1259 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { 1259 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
1260 QStringList categories = mActiveItem->todo()->categories (); 1260 QStringList categories = mActiveItem->todo()->categories ();
1261 QString colcat = categories.first(); 1261 QString colcat = categories.first();
1262 if (categories.find (mCategory[index]) != categories.end ()) 1262 if (categories.find (mCategory[index]) != categories.end ())
1263 categories.remove (mCategory[index]); 1263 categories.remove (mCategory[index]);
1264 else 1264 else
1265 categories.insert (categories.end(), mCategory[index]); 1265 categories.insert (categories.end(), mCategory[index]);
1266 categories.sort (); 1266 categories.sort ();
1267 if ( !colcat.isEmpty() ) { 1267 if ( !colcat.isEmpty() ) {
1268 if ( categories.find ( colcat ) != categories.end () ) { 1268 if ( categories.find ( colcat ) != categories.end () ) {
1269 categories.remove( colcat ); 1269 categories.remove( colcat );
1270 categories.prepend( colcat ); 1270 categories.prepend( colcat );
1271 } 1271 }
1272 } 1272 }
1273 mActiveItem->todo()->setCategories (categories); 1273 mActiveItem->todo()->setCategories (categories);
1274 mActiveItem->construct(); 1274 mActiveItem->construct();
1275 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 1275 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
1276 todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); 1276 todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED);
1277 } 1277 }
1278} 1278}
1279void KOTodoView::itemDoubleClicked(QListViewItem *item) 1279void KOTodoView::itemDoubleClicked(QListViewItem *item)
1280{ 1280{
1281 if ( pendingSubtodo != 0 ) { 1281 if ( pendingSubtodo != 0 ) {
1282 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 1282 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
1283 } 1283 }
1284 pendingSubtodo = 0; 1284 pendingSubtodo = 0;
1285 //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() ); 1285 //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() );
1286 int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() ); 1286 int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() );
1287 //qDebug("ROW %d ", row); 1287 //qDebug("ROW %d ", row);
1288 if (!item) { 1288 if (!item) {
1289 newTodo(); 1289 newTodo();
1290 return; 1290 return;
1291 } else { 1291 } else {
1292 if ( row == 1 ) { 1292 if ( row == 1 ) {
1293 mActiveItem = (KOTodoViewItem *) item; 1293 mActiveItem = (KOTodoViewItem *) item;
1294 newSubTodo(); 1294 newSubTodo();
1295 return; 1295 return;
1296 } 1296 }
1297 if ( row == 5 || row == 6 || row == 2) { 1297 if ( row == 5 || row == 6 || row == 2) {
1298 mActiveItem = (KOTodoViewItem *) item; 1298 mActiveItem = (KOTodoViewItem *) item;
1299 Todo * t = mActiveItem->todo(); 1299 Todo * t = mActiveItem->todo();
1300 if ( t->isRunning() ) { 1300 if ( t->isRunning() ) {
1301 if ( t->runTime() < 15) { 1301 if ( t->runTime() < 15) {
1302 t->stopRunning(); 1302 t->stopRunning();
1303 mActiveItem->construct(); 1303 mActiveItem->construct();
1304 topLevelWidget()->setCaption(i18n("Todo stopped - no data saved because runtime was < 15 sec!")); 1304 topLevelWidget()->setCaption(i18n("Todo stopped - no data saved because runtime was < 15 sec!"));
1305 return; 1305 return;
1306 } 1306 }
1307 else 1307 else
1308 toggleRunningItem(); 1308 toggleRunningItem();
1309 return; 1309 return;
1310 } else { 1310 } else {
1311 t->setRunning( true ); 1311 t->setRunning( true );
1312 mActiveItem->construct(); 1312 mActiveItem->construct();
1313 topLevelWidget()->setCaption(i18n("Todo started! Double click again to stop!")); 1313 topLevelWidget()->setCaption(i18n("Todo started! Double click again to stop!"));
1314 return; 1314 return;
1315 } 1315 }
1316 } 1316 }
1317 } 1317 }
1318 if ( KOPrefs::instance()->mEditOnDoubleClick ) 1318 if ( KOPrefs::instance()->mEditOnDoubleClick )
1319 editItem( item ); 1319 editItem( item );
1320 else 1320 else
1321 showItem( item , QPoint(), 0 ); 1321 showItem( item , QPoint(), 0 );
1322} 1322}
1323void KOTodoView::toggleRunningItem() 1323void KOTodoView::toggleRunningItem()
1324{ 1324{
1325 // qDebug("KOTodoView::toggleRunning() "); 1325 // qDebug("KOTodoView::toggleRunning() ");
1326 if ( ! mActiveItem ) 1326 if ( ! mActiveItem )
1327 return; 1327 return;
1328 Todo * t = mActiveItem->todo(); 1328 Todo * t = mActiveItem->todo();
1329 if ( t->isRunning() ) { 1329 if ( t->isRunning() ) {
1330 KOStopTodoPrefs tp ( t, this ); 1330 KOStopTodoPrefs tp ( t, this );
1331 if (QApplication::desktop()->width() <= 800 ){ 1331 if (QApplication::desktop()->width() <= 800 ){
1332 int wid = tp.width(); 1332 int wid = tp.width();
1333 int hei = tp.height(); 1333 int hei = tp.height();
1334 int xx = (QApplication::desktop()->width()-wid)/2; 1334 int xx = (QApplication::desktop()->width()-wid)/2;
1335 int yy = (QApplication::desktop()->height()-hei)/2; 1335 int yy = (QApplication::desktop()->height()-hei)/2;
1336 tp.setGeometry( xx,yy,wid,hei ); 1336 tp.setGeometry( xx,yy,wid,hei );
1337 } 1337 }
1338 tp.exec(); 1338 tp.exec();
1339 mActiveItem->construct(); 1339 mActiveItem->construct();
1340 } else { 1340 } else {
1341 KOStartTodoPrefs tp ( t->summary(), this ); 1341 KOStartTodoPrefs tp ( t->summary(), this );
1342 if (QApplication::desktop()->width() <= 800 ){ 1342 if (QApplication::desktop()->width() <= 800 ){
1343 int wid = tp.width(); 1343 int wid = tp.width();
1344 int hei = tp.height(); 1344 int hei = tp.height();
1345 int xx = (QApplication::desktop()->width()-wid)/2; 1345 int xx = (QApplication::desktop()->width()-wid)/2;
1346 int yy = (QApplication::desktop()->height()-hei)/2; 1346 int yy = (QApplication::desktop()->height()-hei)/2;
1347 tp.setGeometry( xx,yy,wid,hei ); 1347 tp.setGeometry( xx,yy,wid,hei );
1348 } 1348 }
1349 if ( !tp.exec() ) return; 1349 if ( !tp.exec() ) return;
1350 if ( tp.stopAll() ) { 1350 if ( tp.stopAll() ) {
1351 mCalendar->stopAllTodos(); 1351 mCalendar->stopAllTodos();
1352 t->setRunning( true ); 1352 t->setRunning( true );
1353 updateView(); 1353 updateView();
1354 } else { 1354 } else {
1355 t->setRunning( true ); 1355 t->setRunning( true );
1356 mActiveItem->construct(); 1356 mActiveItem->construct();
1357 } 1357 }
1358 } 1358 }
1359} 1359}
1360 1360
1361void KOTodoView::itemClicked(QListViewItem *item) 1361void KOTodoView::itemClicked(QListViewItem *item)
1362{ 1362{
1363 //qDebug("KOTodoView::itemClicked %d", item); 1363 //qDebug("KOTodoView::itemClicked %d", item);
1364 if (!item) { 1364 if (!item) {
1365 if ( pendingSubtodo != 0 ) { 1365 if ( pendingSubtodo != 0 ) {
1366 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 1366 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
1367 } 1367 }
1368 pendingSubtodo = 0; 1368 pendingSubtodo = 0;
1369 return; 1369 return;
1370 } 1370 }
1371 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 1371 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
1372 if ( pendingSubtodo != 0 ) { 1372 if ( pendingSubtodo != 0 ) {
1373 bool allowReparent = true; 1373 bool allowReparent = true;
1374 QListViewItem *par = item; 1374 QListViewItem *par = item;
1375 while ( par ) { 1375 while ( par ) {
1376 if ( par == pendingSubtodo ) { 1376 if ( par == pendingSubtodo ) {
1377 allowReparent = false; 1377 allowReparent = false;
1378 break; 1378 break;
1379 } 1379 }
1380 par = par->parent(); 1380 par = par->parent();
1381 } 1381 }
1382 if ( !allowReparent ) { 1382 if ( !allowReparent ) {
1383 topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); 1383 topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!"));
1384 pendingSubtodo = 0; 1384 pendingSubtodo = 0;
1385 } else { 1385 } else {
1386 Todo* newParent = todoItem->todo(); 1386 Todo* newParent = todoItem->todo();
1387 Todo* newSub = pendingSubtodo->todo(); 1387 Todo* newSub = pendingSubtodo->todo();
1388 pendingSubtodo = 0; 1388 pendingSubtodo = 0;
1389 emit reparentTodoSignal( newParent,newSub ); 1389 emit reparentTodoSignal( newParent,newSub );
1390 return; 1390 return;
1391 } 1391 }
1392 } 1392 }
1393 1393
1394} 1394}
1395 1395
1396void KOTodoView::setDocumentId( const QString &id ) 1396void KOTodoView::setDocumentId( const QString &id )
1397{ 1397{
1398 1398
1399 mDocPrefs->setDoc( id ); 1399 mDocPrefs->setDoc( id );
1400} 1400}
1401 1401
1402void KOTodoView::itemStateChanged( QListViewItem *item ) 1402void KOTodoView::itemStateChanged( QListViewItem *item )
1403{ 1403{
1404 if (!item) return; 1404 if (!item) return;
1405 1405
1406 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 1406 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
1407 1407
1408// kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; 1408// kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl;
1409 1409
1410 if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); 1410 if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() );
1411} 1411}
1412 1412
1413void KOTodoView::saveLayout(KConfig *config, const QString &group) const 1413void KOTodoView::saveLayout(KConfig *config, const QString &group) const
1414{ 1414{
1415 mTodoListView->saveLayout(config,group); 1415 mTodoListView->saveLayout(config,group);
1416} 1416}
1417 1417
1418void KOTodoView::restoreLayout(KConfig *config, const QString &group) 1418void KOTodoView::restoreLayout(KConfig *config, const QString &group)
1419{ 1419{
1420 mTodoListView->restoreLayout(config,group); 1420 mTodoListView->restoreLayout(config,group);
1421} 1421}
1422 1422
1423void KOTodoView::processSelectionChange() 1423void KOTodoView::processSelectionChange()
1424{ 1424{
1425// kdDebug() << "KOTodoView::processSelectionChange()" << endl; 1425// kdDebug() << "KOTodoView::processSelectionChange()" << endl;
1426 1426
1427 KOTodoViewItem *item = 1427 KOTodoViewItem *item =
1428 static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() ); 1428 static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() );
1429 1429
1430 if ( !item ) { 1430 if ( !item ) {
1431 emit incidenceSelected( 0 ); 1431 emit incidenceSelected( 0 );
1432 mNewSubBut->setEnabled( false ); 1432 mNewSubBut->setEnabled( false );
1433 } else { 1433 } else {
1434 emit incidenceSelected( item->todo() ); 1434 emit incidenceSelected( item->todo() );
1435 mNewSubBut->setEnabled( true ); 1435 mNewSubBut->setEnabled( true );
1436 } 1436 }
1437} 1437}
1438 1438
1439void KOTodoView::modified(bool b) 1439void KOTodoView::modified(bool b)
1440{ 1440{
1441 emit isModified(b); 1441 emit isModified(b);
1442} 1442}
1443void KOTodoView::setTodoModified( Todo* todo ) 1443void KOTodoView::setTodoModified( Todo* todo )
1444{ 1444{
1445 todoModified( todo, KOGlobals::UNKNOWN_MODIFIED ); 1445 todoModified( todo, KOGlobals::UNKNOWN_MODIFIED );
1446} 1446}
1447void KOTodoView::clearSelection() 1447void KOTodoView::clearSelection()
1448{ 1448{
1449 mTodoListView->selectAll( false ); 1449 mTodoListView->selectAll( false );
1450} 1450}
1451void KOTodoView::setAllOpen() 1451void KOTodoView::setAllOpen()
1452{ 1452{
1453 if ( isFlatDisplay ) { 1453 if ( isFlatDisplay ) {
1454 isFlatDisplay = false; 1454 isFlatDisplay = false;
1455 mPopupMenu->setItemChecked( 8,false ); 1455 mPopupMenu->setItemChecked( 8,false );
1456 updateView(); 1456 updateView();
1457 } else { 1457 } else {
1458 storeCurrentItem(); 1458 storeCurrentItem();
1459 } 1459 }
1460 setOpen(mTodoListView->firstChild(), true); 1460 setOpen(mTodoListView->firstChild(), true);
1461 resetCurrentItem(); 1461 resetCurrentItem();
1462} 1462}
1463void KOTodoView::setAllClose() 1463void KOTodoView::setAllClose()
1464{ 1464{
1465 if ( isFlatDisplay ) { 1465 if ( isFlatDisplay ) {
1466 isFlatDisplay = false; 1466 isFlatDisplay = false;
1467 mPopupMenu->setItemChecked( 8,false ); 1467 mPopupMenu->setItemChecked( 8,false );
1468 updateView(); 1468 updateView();
1469 } else { 1469 } else {
1470 storeCurrentItem(); 1470 storeCurrentItem();
1471 } 1471 }
1472 setOpen(mTodoListView->firstChild(), false); 1472 setOpen(mTodoListView->firstChild(), false);
1473 resetCurrentItem(); 1473 resetCurrentItem();
1474} 1474}
1475void KOTodoView::setOpen( QListViewItem* item, bool setOpenI) 1475void KOTodoView::setOpen( QListViewItem* item, bool setOpenI)
1476{ 1476{
1477 1477
1478 while ( item ) { 1478 while ( item ) {
1479 setOpen( item->firstChild(), setOpenI ); 1479 setOpen( item->firstChild(), setOpenI );
1480 item->setOpen( setOpenI ); 1480 item->setOpen( setOpenI );
1481 item = item->nextSibling(); 1481 item = item->nextSibling();
1482 } 1482 }
1483} 1483}
1484 1484
1485void KOTodoView::displayAllFlat() 1485void KOTodoView::displayAllFlat()
1486{ 1486{
1487 storeCurrentItem(); 1487 storeCurrentItem();
1488 pendingSubtodo = 0; 1488 pendingSubtodo = 0;
1489 if ( mBlockUpdate ) { 1489 if ( mBlockUpdate ) {
1490 return; 1490 return;
1491 } 1491 }
1492 mPopupMenu->setItemChecked( 8,true ); 1492 mPopupMenu->setItemChecked( 8,true );
1493 isFlatDisplay = true; 1493 isFlatDisplay = true;
1494 QPtrList<Todo> todoList = calendar()->todos(); 1494 QPtrList<Todo> todoList = calendar()->todos();
1495 mTodoMap.clear(); 1495 mTodoMap.clear();
1496 mTodoListView->clear(); 1496 mTodoListView->clear();
1497 Todo *todo; 1497 Todo *todo;
1498 for(todo = todoList.first(); todo; todo = todoList.next()) { 1498 for(todo = todoList.first(); todo; todo = todoList.next()) {
1499 KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); 1499 if ( checkTodo( todo ) ) {
1500 mTodoMap.insert(todo,todoItem); 1500 KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this);
1501 mTodoMap.insert(todo,todoItem);
1502 }
1501 } 1503 }
1502 resetCurrentItem(); 1504 resetCurrentItem();
1503} 1505}
1504 1506
1505void KOTodoView::setAllFlat() 1507void KOTodoView::setAllFlat()
1506{ 1508{
1507 if ( isFlatDisplay ) { 1509 if ( isFlatDisplay ) {
1508 isFlatDisplay = false; 1510 isFlatDisplay = false;
1509 mPopupMenu->setItemChecked( 8,false ); 1511 mPopupMenu->setItemChecked( 8,false );
1510 updateView(); 1512 updateView();
1511 return; 1513 return;
1512 } 1514 }
1513 displayAllFlat(); 1515 displayAllFlat();
1514} 1516}
1515 1517
1516void KOTodoView::purgeCompleted() 1518void KOTodoView::purgeCompleted()
1517{ 1519{
1518 emit purgeCompletedSignal(); 1520 emit purgeCompletedSignal();
1519 1521
1520} 1522}
1521void KOTodoView::toggleQuickTodo() 1523void KOTodoView::toggleQuickTodo()
1522{ 1524{
1523 if ( mQuickBar->isVisible() ) { 1525 if ( mQuickBar->isVisible() ) {
1524 mQuickBar->hide(); 1526 mQuickBar->hide();
1525 KOPrefs::instance()->mEnableQuickTodo = false; 1527 KOPrefs::instance()->mEnableQuickTodo = false;
1526 } 1528 }
1527 else { 1529 else {
1528 mQuickBar->show(); 1530 mQuickBar->show();
1529 KOPrefs::instance()->mEnableQuickTodo = true; 1531 KOPrefs::instance()->mEnableQuickTodo = true;
1530 } 1532 }
1531 mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); 1533 mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo);
1532 mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); 1534 mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo );
1533} 1535}
1534 1536
1535void KOTodoView::toggleRunning() 1537void KOTodoView::toggleRunning()
1536{ 1538{
1537 KOPrefs::instance()->mHideNonStartedTodos = !KOPrefs::instance()->mHideNonStartedTodos; 1539 KOPrefs::instance()->mHideNonStartedTodos = !KOPrefs::instance()->mHideNonStartedTodos;
1538 mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); 1540 mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos);
1539 mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); 1541 mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos );
1540 updateView(); 1542 updateView();
1541 if ( KOPrefs::instance()->mHideNonStartedTodos ) 1543 if ( KOPrefs::instance()->mHideNonStartedTodos )
1542 topLevelWidget()->setCaption(i18n("Hide not Running")); 1544 topLevelWidget()->setCaption(i18n("Hide not Running"));
1543 else 1545 else
1544 topLevelWidget()->setCaption(i18n("Show not Running")); 1546 topLevelWidget()->setCaption(i18n("Show not Running"));
1545} 1547}
1546 1548
1547void KOTodoView::toggleCompleted() 1549void KOTodoView::toggleCompleted()
1548{ 1550{
1549 KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo; 1551 KOPrefs::instance()->mShowCompletedTodo = !KOPrefs::instance()->mShowCompletedTodo;
1550 mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); 1552 mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo );
1551 mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); 1553 mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo );
1552 updateView(); 1554 updateView();
1553 if ( KOPrefs::instance()->mShowCompletedTodo ) 1555 if ( KOPrefs::instance()->mShowCompletedTodo )
1554 topLevelWidget()->setCaption(i18n("Show Completed")); 1556 topLevelWidget()->setCaption(i18n("Show Completed"));
1555 else 1557 else
1556 topLevelWidget()->setCaption(i18n("Hide Completed")); 1558 topLevelWidget()->setCaption(i18n("Hide Completed"));
1557} 1559}
1558 1560
1559void KOTodoView::addQuickTodo() 1561void KOTodoView::addQuickTodo()
1560{ 1562{
1561 addQuickTodoPar( 0 ); 1563 addQuickTodoPar( 0 );
1562} 1564}
1563void KOTodoView::addQuickTodoPar( Todo * parentTodo) 1565void KOTodoView::addQuickTodoPar( Todo * parentTodo)
1564{ 1566{
1565 Todo *todo = new Todo(); 1567 Todo *todo = new Todo();
1566 todo->setSummary(mQuickAdd->text()); 1568 todo->setSummary(mQuickAdd->text());
1567 todo->setOrganizer(KOPrefs::instance()->email()); 1569 todo->setOrganizer(KOPrefs::instance()->email());
1568 if ( parentTodo ) { 1570 if ( parentTodo ) {
1569 todo->setRelatedTo(parentTodo); 1571 todo->setRelatedTo(parentTodo);
1570 1572
1571 todo->setCategories (parentTodo->categoriesStr ()); 1573 todo->setCategories (parentTodo->categoriesStr ());
1572 todo->setSecrecy (parentTodo->secrecy ()); 1574 todo->setSecrecy (parentTodo->secrecy ());
1573 if ( parentTodo->priority() < 3 ) 1575 if ( parentTodo->priority() < 3 )
1574 todo->setPriority( parentTodo->priority() ); 1576 todo->setPriority( parentTodo->priority() );
1575 todo->setCalID( parentTodo->calID() ); 1577 todo->setCalID( parentTodo->calID() );
1576 } else { 1578 } else {
1577 CalFilter * cf = mCalendar->filter(); 1579 CalFilter * cf = mCalendar->filter();
1578 if ( cf ) { 1580 if ( cf ) {
1579 if ( cf->isEnabled()&& cf->showCategories()) { 1581 if ( cf->isEnabled()&& cf->showCategories()) {
1580 todo->setCategories(cf->categoryList()); 1582 todo->setCategories(cf->categoryList());
1581 } 1583 }
1582 if ( cf->isEnabled() ) 1584 if ( cf->isEnabled() )
1583 todo->setSecrecy( cf->getSecrecy()); 1585 todo->setSecrecy( cf->getSecrecy());
1584 } 1586 }
1585 } 1587 }
1586 mCalendar->addTodo(todo); 1588 mCalendar->addTodo(todo);
1587 mQuickAdd->setText(""); 1589 mQuickAdd->setText("");
1588 todoModified (todo, KOGlobals::EVENTADDED ); 1590 todoModified (todo, KOGlobals::EVENTADDED );
1589 updateView(); 1591 updateView();
1590 1592
1591} 1593}
1592void KOTodoView::keyPressEvent ( QKeyEvent * e ) 1594void KOTodoView::keyPressEvent ( QKeyEvent * e )
1593{ 1595{
1594 // e->ignore(); 1596 // e->ignore();
1595 //return; 1597 //return;
1596 //qDebug("KOTodoView::keyPressEvent "); 1598 //qDebug("KOTodoView::keyPressEvent ");
1597 switch ( e->key() ) { 1599 switch ( e->key() ) {
1598 case Qt::Key_Down: 1600 case Qt::Key_Down:
1599 case Qt::Key_Up: 1601 case Qt::Key_Up:
1600 QWidget::keyPressEvent ( e ); 1602 QWidget::keyPressEvent ( e );
1601 break; 1603 break;
1602 1604
1603 case Qt::Key_Q: 1605 case Qt::Key_Q:
1604 toggleQuickTodo(); 1606 toggleQuickTodo();
1605 break; 1607 break;
1606 case Qt::Key_U: 1608 case Qt::Key_U:
1607 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { 1609 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) {
1608 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); 1610 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
1609 unparentTodo(); 1611 unparentTodo();
1610 e->accept(); 1612 e->accept();
1611 } else 1613 } else
1612 e->ignore(); 1614 e->ignore();
1613 break; 1615 break;
1614 case Qt::Key_S: 1616 case Qt::Key_S:
1615 if ( e->state() == Qt::ControlButton ) { 1617 if ( e->state() == Qt::ControlButton ) {
1616 e->ignore(); 1618 e->ignore();
1617 break; 1619 break;
1618 } 1620 }
1619 if ( e->state() == Qt::ShiftButton ) { 1621 if ( e->state() == Qt::ShiftButton ) {
1620 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); 1622 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
1621 reparentTodo(); 1623 reparentTodo();
1622 e->accept(); 1624 e->accept();
1623 } else 1625 } else
1624 e->ignore(); 1626 e->ignore();
1625 break; 1627 break;
1626 case Qt::Key_P: 1628 case Qt::Key_P:
1627 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { 1629 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) {
1628 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); 1630 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
1629 if ( pendingSubtodo ) 1631 if ( pendingSubtodo )
1630 itemClicked(mActiveItem); 1632 itemClicked(mActiveItem);
1631 e->accept(); 1633 e->accept();
1632 } else 1634 } else
1633 e->ignore(); 1635 e->ignore();
1634 break; 1636 break;
1635 case Qt::Key_Escape: 1637 case Qt::Key_Escape:
1636 if ( pendingSubtodo ) { 1638 if ( pendingSubtodo ) {
1637 itemClicked(0); 1639 itemClicked(0);
1638 e->accept(); 1640 e->accept();
1639 } else 1641 } else
1640 e->ignore(); 1642 e->ignore();
1641 break; 1643 break;
1642 default: 1644 default:
1643 e->ignore(); 1645 e->ignore();
1644 } 1646 }
1645 1647
1646 if ( true ) { 1648 if ( true ) {
1647 if ( e->key() == Qt::Key_I ) { 1649 if ( e->key() == Qt::Key_I ) {
1648 KOTodoViewItem*cn = (KOTodoViewItem*)mTodoListView->currentItem(); 1650 KOTodoViewItem*cn = (KOTodoViewItem*)mTodoListView->currentItem();
1649 if ( cn ) { 1651 if ( cn ) {
1650 mActiveItem = cn; 1652 mActiveItem = cn;
1651 KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); 1653 KOTodoViewItem* ci = (KOTodoViewItem*)( cn );
1652 if ( ci ){ 1654 if ( ci ){
1653 showTodo(); 1655 showTodo();
1654 cn = (KOTodoViewItem*)cn->itemBelow(); 1656 cn = (KOTodoViewItem*)cn->itemBelow();
1655 if ( cn ) { 1657 if ( cn ) {
1656 mTodoListView->setCurrentItem ( cn ); 1658 mTodoListView->setCurrentItem ( cn );
1657 mTodoListView->ensureItemVisible ( cn ); 1659 mTodoListView->ensureItemVisible ( cn );
1658 } 1660 }
1659 1661
1660 } 1662 }
1661 } 1663 }
1662 e->accept(); 1664 e->accept();
1663 1665
1664 } 1666 }
1665 1667
1666 } 1668 }
1667 1669
1668} 1670}
1669void KOTodoView::updateTodo( Todo * t, int type ) 1671void KOTodoView::updateTodo( Todo * t, int type )
1670{ 1672{
1671 if ( mBlockUpdate) 1673 if ( mBlockUpdate)
1672 return; 1674 return;
1673 1675
1674 QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; 1676 QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator;
1675 itemIterator = mTodoMap.find(t); 1677 itemIterator = mTodoMap.find(t);
1676 if (itemIterator != mTodoMap.end()) { 1678 if (itemIterator != mTodoMap.end()) {
1677 (*itemIterator)->construct(); 1679 (*itemIterator)->construct();
1678 } else { 1680 } else {
1679 if ( type == KOGlobals::EVENTADDED ) { 1681 if ( type == KOGlobals::EVENTADDED ) {
1680 insertTodoItem( t ); 1682 insertTodoItem( t );
1681 } 1683 }
1682 } 1684 }
1683 1685
1684} 1686}
1685 1687
1686void KOTodoView::todoModified(Todo * t , int p ) 1688void KOTodoView::todoModified(Todo * t , int p )
1687{ 1689{
1688 mBlockUpdate = true; 1690 mBlockUpdate = true;
1689 emit todoModifiedSignal ( t, p ); 1691 emit todoModifiedSignal ( t, p );
1690 mBlockUpdate = false; 1692 mBlockUpdate = false;
1691} 1693}