summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt1
-rw-r--r--korganizer/koagenda.cpp31
-rw-r--r--korganizer/koagendaitem.cpp1
3 files changed, 31 insertions, 2 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index 05c1afd..28029ee 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,261 +1,262 @@
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.0.12 ************ 3********** VERSION 2.0.12 ************
4 4
5Fixed a bug in todo start/due date handling for non recurring todos with a start and due date. 5Fixed a bug in todo start/due date handling for non recurring todos with a start and due date.
6Fixed some layout problems in the KO/Pi agenda view when there were many conflicting itmes.
6 7
7 8
8********** VERSION 2.0.11 ************ 9********** VERSION 2.0.11 ************
9 10
10Fixed some problems in pi-sync mode 11Fixed some problems in pi-sync mode
11(e.g. details of events were not synced properly) 12(e.g. details of events were not synced properly)
12 13
13********** VERSION 2.0.10 ************ 14********** VERSION 2.0.10 ************
14 15
15KO/Pi: 16KO/Pi:
16In the desktop versions the context menu in the search dialog was broken after introducing the What'sThis info for the list view. 17In the desktop versions the context menu in the search dialog was broken after introducing the What'sThis info for the list view.
17This is fixed. 18This is fixed.
18Changed the search dialog a bit to make it more user friendly. 19Changed the search dialog a bit to make it more user friendly.
19(E.g.: Removed message box about "no items found" and set key focus to search line edit after search). 20(E.g.: Removed message box about "no items found" and set key focus to search line edit after search).
20 21
21Added config option to hide the week number in KO/Pi toolbar. 22Added config option to hide the week number in KO/Pi toolbar.
22 23
23********** VERSION 2.0.9 ************ 24********** VERSION 2.0.9 ************
24 25
25Made month view icons for multiday events a bit nicer. 26Made month view icons for multiday events a bit nicer.
26Some minor fixes in KO/Pi 27Some minor fixes in KO/Pi
27(e.g. go to today did not work for new week view properly). 28(e.g. go to today did not work for new week view properly).
28 29
29 30
30********** VERSION 2.0.8 ************ 31********** VERSION 2.0.8 ************
31 32
32Fixed a problem in dependency info in the ipk files for the Zaurus. 33Fixed a problem in dependency info in the ipk files for the Zaurus.
33 34
34Added icon for the stealth new week view and made navigation more user friendly in monthview by adding a prev/next week button to the navigator bar. 35Added icon for the stealth new week view and made navigation more user friendly in monthview by adding a prev/next week button to the navigator bar.
35 36
36Added a "go today" button to the datepicker. 37Added a "go today" button to the datepicker.
37 38
38Added "created" and "last modified" to event/todo viewer (and What'sThis viewer) 39Added "created" and "last modified" to event/todo viewer (and What'sThis viewer)
39and made it configureable to show these values. 40and made it configureable to show these values.
40 41
41Fixed a problem for events (from external iCal files) that do have a duration but no end date. 42Fixed a problem for events (from external iCal files) that do have a duration but no end date.
42 43
43 44
44********** VERSION 2.0.7 ************ 45********** VERSION 2.0.7 ************
45 46
46Added global application font settings 47Added global application font settings
47(for all KDE-Pim/Pi apps) to the general settings. 48(for all KDE-Pim/Pi apps) to the general settings.
48 49
49Fixed a problem in OM/Pi when trying to login to some IMAP servers 50Fixed a problem in OM/Pi when trying to login to some IMAP servers
50(like the IMAP server of Apple: mail.mac.com ) 51(like the IMAP server of Apple: mail.mac.com )
51 52
52Added recurring todos to KO/Pi. 53Added recurring todos to KO/Pi.
53 54
54 55
55********** VERSION 2.0.6 ************ 56********** VERSION 2.0.6 ************
56 57
57Some bugfixes in the pi-sync mode. 58Some bugfixes in the pi-sync mode.
58Added German translation for pi-sync mode. 59Added German translation for pi-sync mode.
59 60
60KO/Pi: 61KO/Pi:
61Made the todolist using alternate background. 62Made the todolist using alternate background.
62 63
63Other minor fixes in KO/Pi. 64Other minor fixes in KO/Pi.
64 65
65 66
66********** VERSION 2.0.5 ************ 67********** VERSION 2.0.5 ************
67 68
68Bugfixes in KO/Pi. 69Bugfixes in KO/Pi.
69 70
70********** VERSION 2.0.4 ************ 71********** VERSION 2.0.4 ************
71 72
72KO/Pi: 73KO/Pi:
73Fixed problem loading translations for summary/location edit boxes in event/todo editor. 74Fixed problem loading translations for summary/location edit boxes in event/todo editor.
74 75
75Added a general "select week number" to the toolbar. 76Added a general "select week number" to the toolbar.
76 77
77Fixed some small problem of the new features introduced in version 2.0.3. 78Fixed some small problem of the new features introduced in version 2.0.3.
78 79
79Made it possible to specify one specific category as category color, 80Made it possible to specify one specific category as category color,
80if more than one categories are selected. 81if more than one categories are selected.
81 82
82Fixed a bug in saving colors for categories with non-ascii characters. 83Fixed a bug in saving colors for categories with non-ascii characters.
83(Like, e.g. German Umlauts). 84(Like, e.g. German Umlauts).
84Propably you have to set your colors again for those categories. 85Propably you have to set your colors again for those categories.
85 86
86 87
87********** VERSION 2.0.3 ************ 88********** VERSION 2.0.3 ************
88 89
89KO/Pi: 90KO/Pi:
90Added feature for changing alarm settings for many items at once: 91Added feature for changing alarm settings for many items at once:
91Open list view (or search dialog), select the desired items and choose in 92Open list view (or search dialog), select the desired items and choose in
92the popup menu: Set alarm for selected... 93the popup menu: Set alarm for selected...
93 94
94Added to the event/todo viewer the option to send an email to 95Added to the event/todo viewer the option to send an email to
95all attendees or all selected (with RSVP) attendees. 96all attendees or all selected (with RSVP) attendees.
96 97
97Made the week-month mode changing in month view faster. 98Made the week-month mode changing in month view faster.
98 99
99Made month view better useable with keyboard. 100Made month view better useable with keyboard.
100Now TAB key jumps to next cell with an event/todo. 101Now TAB key jumps to next cell with an event/todo.
101Scroll in cell with coursor keys, scroll in time (next week) with 102Scroll in cell with coursor keys, scroll in time (next week) with
102Shift/Control + coursorkeys. 103Shift/Control + coursorkeys.
103 104
104Fixed bug that the todo view flat mode was reset after first view update. 105Fixed bug that the todo view flat mode was reset after first view update.
105 106
106If a todo is displayed closed in the todo view, 107If a todo is displayed closed in the todo view,
107it is now displayed in overdue/due today color depending on the subtodos overdue/due today properties. 108it is now displayed in overdue/due today color depending on the subtodos overdue/due today properties.
108 109
109Added info about the numbers of years to the caption (title) information about a birthday event. 110Added info about the numbers of years to the caption (title) information about a birthday event.
110 111
111Made completion date in todo editor editable. 112Made completion date in todo editor editable.
112 113
113Added possibility to save/load templates for journals. 114Added possibility to save/load templates for journals.
114(Which is just a simple "save text to file" or "insert text from file". 115(Which is just a simple "save text to file" or "insert text from file".
115 116
116********** VERSION 2.0.2 ************ 117********** VERSION 2.0.2 ************
117 118
118KO/Pi: 119KO/Pi:
119Fixed the layout problem of the day label buttons 120Fixed the layout problem of the day label buttons
120of the agenda view introduced in version 2.0.1. 121of the agenda view introduced in version 2.0.1.
121 122
122Added WhatsThis support for the todo view and the list view. 123Added WhatsThis support for the todo view and the list view.
123 124
124Added a quite useful feature to the montview. 125Added a quite useful feature to the montview.
125Just click on the week numbers on the left. 126Just click on the week numbers on the left.
126And in the top right corner of month view/agenda view 127And in the top right corner of month view/agenda view
127there is now a "week number quick selector". 128there is now a "week number quick selector".
128(Click on the black triangle). 129(Click on the black triangle).
129 130
130Made the quite difficult timezone change in KO/Pi easy. 131Made the quite difficult timezone change in KO/Pi easy.
131 132
132OM/Pi: 133OM/Pi:
133Fixed too small icons on desktop. 134Fixed too small icons on desktop.
134Fixed non visible icons in mainwindow on Z with fastload enabled. 135Fixed non visible icons in mainwindow on Z with fastload enabled.
135Added signature file setting to smtp account config. 136Added signature file setting to smtp account config.
136And the signature can be edited and saved in the edit mail dialog. 137And the signature can be edited and saved in the edit mail dialog.
137That does mean: 138That does mean:
138Simply edit the signature for the selected smtp account in the 139Simply edit the signature for the selected smtp account in the
139edit new mail dialog and press the "save signature" button there. 140edit new mail dialog and press the "save signature" button there.
140Then the signature is saved to the file specified in the smtp account settings. 141Then the signature is saved to the file specified in the smtp account settings.
141If there is no file specified, it is saved automatically to the file 142If there is no file specified, it is saved automatically to the file
142kdepim/apps/kopiemail/<accountname>.sig. 143kdepim/apps/kopiemail/<accountname>.sig.
143 144
144 145
145 146
146********** VERSION 2.0.1 ************ 147********** VERSION 2.0.1 ************
147 148
148Oooops ... I forgot to test on the Zaurus 5500 ... 149Oooops ... I forgot to test on the Zaurus 5500 ...
149 150
150Fixed many problems of new (english) strings (and german translations) 151Fixed many problems of new (english) strings (and german translations)
151introduced in the latest versions, where the text was not fitting on the 152introduced in the latest versions, where the text was not fitting on the
152240x320 display of the Zaurus 5500. 153240x320 display of the Zaurus 5500.
153 154
154KO/Pi: 155KO/Pi:
155Added a popup menu ( press pen and hold to get popup ) to the agenda view 156Added a popup menu ( press pen and hold to get popup ) to the agenda view
156with many useful items (add event/todo, show next week, two weeks, month, journal). 157with many useful items (add event/todo, show next week, two weeks, month, journal).
157 158
158Added items to the todolist popup menu for: 159Added items to the todolist popup menu for:
159Display all opened, all closed or all todos flat. 160Display all opened, all closed or all todos flat.
160The "flat" view makes is possible to sort all todos after ,e.g., prio or date. 161The "flat" view makes is possible to sort all todos after ,e.g., prio or date.
161Made the reparenting of todos on the desktop possible via Drag&Drop. 162Made the reparenting of todos on the desktop possible via Drag&Drop.
162Fixed several bugs in setting the completed datetime for todos. 163Fixed several bugs in setting the completed datetime for todos.
163Added info about completed datetime of todos to the todo viewer. 164Added info about completed datetime of todos to the todo viewer.
164Now displaying a completed todo (with completed datetime set) in the agenda view 165Now displaying a completed todo (with completed datetime set) in the agenda view
165at the time of the completion. Such that now it is possible to see in the agenda view 166at the time of the completion. Such that now it is possible to see in the agenda view
166when what todo was completed. 167when what todo was completed.
167Fixed behaviour of automatic setting completion of todos with sub-todos/parent todos. 168Fixed behaviour of automatic setting completion of todos with sub-todos/parent todos.
168Now the behaviour is: 169Now the behaviour is:
169Setting a parent to complete sets all (sub)childs to complete. 170Setting a parent to complete sets all (sub)childs to complete.
170Setting a parent to uncomplete does not change the childs. 171Setting a parent to uncomplete does not change the childs.
171Setting a child to uncomplete sets all parent to uncomplete. 172Setting a child to uncomplete sets all parent to uncomplete.
172Setting a child to complete does not change the parents. 173Setting a child to complete does not change the parents.
173 174
174Smart updating and double buffering of the daymatrix. 175Smart updating and double buffering of the daymatrix.
175Showing holidays in the day matrix. 176Showing holidays in the day matrix.
176Many other small performance updates. 177Many other small performance updates.
177 178
178Made day labels in agenda clickable. By clicking a label, the day is displayed in single day mode. 179Made day labels in agenda clickable. By clicking a label, the day is displayed in single day mode.
179 180
180Now the translation file usertranslation.txt is supposed to be in utf8 format. 181Now the translation file usertranslation.txt is supposed to be in utf8 format.
181If you want to translate a language from western europe, just change the germantranslation.txt file. Please read the updated Usertranslation HowTo in KO/Pi Help menu. 182If you want to translate a language from western europe, just change the germantranslation.txt file. Please read the updated Usertranslation HowTo in KO/Pi Help menu.
182 183
183 184
184********** VERSION 2.0.0 ************ 185********** VERSION 2.0.0 ************
185 186
186Stable release 2.0.0! 187Stable release 2.0.0!
187 188
188KO/Pi: 189KO/Pi:
189Fixed problem in edit dialog recreation at startup. 190Fixed problem in edit dialog recreation at startup.
190Made "toggle view*" menu items enabled context sensitive. 191Made "toggle view*" menu items enabled context sensitive.
191Changed agenda size menu to items 1-10. 192Changed agenda size menu to items 1-10.
192Made it possible to change agenda size quickly by pressing mouse on timelabels in agenda view and move mouse up/down. 193Made it possible to change agenda size quickly by pressing mouse on timelabels in agenda view and move mouse up/down.
193Usebility enhancements in the KO/Pi menus. 194Usebility enhancements in the KO/Pi menus.
194Birthday import now adds year to summary. 195Birthday import now adds year to summary.
195What's Next view shows age in years for birthday. 196What's Next view shows age in years for birthday.
196 197
197OM/Pi: 198OM/Pi:
198Added three info lines to display subject, from and to of selected mails. 199Added three info lines to display subject, from and to of selected mails.
199 200
200KA/Pi: 201KA/Pi:
201Fixed jump bar behaviour on Zaurus. 202Fixed jump bar behaviour on Zaurus.
202Now KA/Pi search field supports searching for a range of starting characters. 203Now KA/Pi search field supports searching for a range of starting characters.
203E.g. to search for all contact beginning with b to n, type 204E.g. to search for all contact beginning with b to n, type
204b-n 205b-n
205in the search field. 206in the search field.
206 207
207********** VERSION 1.9.20 ************ 208********** VERSION 1.9.20 ************
208 209
209KO/Pi: 210KO/Pi:
210Added for the "dislplay one day" agenda mode 211Added for the "dislplay one day" agenda mode
211info in the caption and in the day lables: 212info in the caption and in the day lables:
212Now it is displayed, if the selected day is from "day before yesterday" 213Now it is displayed, if the selected day is from "day before yesterday"
213to "day after tomorrow". 214to "day after tomorrow".
214Made it possible to delete a Todo, which has sub-todos. 215Made it possible to delete a Todo, which has sub-todos.
215Fixed two small problems in the todo view. 216Fixed two small problems in the todo view.
216Added missing German translation for filter edit and print dialog. 217Added missing German translation for filter edit and print dialog.
217Made search dialog closeable by cancel key. 218Made search dialog closeable by cancel key.
218 219
219Made it possible to select in the date picker the (ligt grey ) 220Made it possible to select in the date picker the (ligt grey )
220dates of the prev./next month with the mouse. 221dates of the prev./next month with the mouse.
221 222
222OM/Pi: 223OM/Pi:
223"Delete mail" icon in main window now deletes all selected mails. 224"Delete mail" icon in main window now deletes all selected mails.
224Fixed the problem, that the state flag of imap mails was ignored. 225Fixed the problem, that the state flag of imap mails was ignored.
225Now mails with "FLAG_SEEN" on the imap server get no icon in the list view 226Now mails with "FLAG_SEEN" on the imap server get no icon in the list view
226to indecate that they are already seen. 227to indecate that they are already seen.
227Fixed the problem that the body of some mails was not displayed in the 228Fixed the problem that the body of some mails was not displayed in the
228mail viewer when fetching them from the imap server directly to read them. 229mail viewer when fetching them from the imap server directly to read them.
229Made it (configurable) possible to show the "To:" field in the list view. 230Made it (configurable) possible to show the "To:" field in the list view.
230Added to the mail viewer the option "View Source" to make it possible to see the raw mail data. 231Added to the mail viewer the option "View Source" to make it possible to see the raw mail data.
231Added a "Download Mail" button to the mail viewer to quickly download the viewed mail to the 232Added a "Download Mail" button to the mail viewer to quickly download the viewed mail to the
232local storage folder (specified in account settings) of the account of the mail. 233local storage folder (specified in account settings) of the account of the mail.
233Removed some memory leaks in OM/Pi. 234Removed some memory leaks in OM/Pi.
234 235
235 236
236********** VERSION 1.9.19 ************ 237********** VERSION 1.9.19 ************
237 238
238Added a lot of missing translations to KA/Pi, 239Added a lot of missing translations to KA/Pi,
239Added some missing translations to KO/Pi and OM/Pi. 240Added some missing translations to KO/Pi and OM/Pi.
240 241
241Fixed some minor problems in KA/Pi + KO/Pi. 242Fixed some minor problems in KA/Pi + KO/Pi.
242 243
243Fixed a crash when closing PwM/Pi. 244Fixed a crash when closing PwM/Pi.
244Added German translation for PwM/Pi. 245Added German translation for PwM/Pi.
245 246
246Made view change and Month View update faster in KO/Pi. 247Made view change and Month View update faster in KO/Pi.
247 248
248 249
249********** VERSION 1.9.18 ************ 250********** VERSION 1.9.18 ************
250 251
251FYI: The VERSION 1.9.17 was a testing release only. 252FYI: The VERSION 1.9.17 was a testing release only.
252Please read the changelog of VERSION 1.9.17 as well. 253Please read the changelog of VERSION 1.9.17 as well.
253 254
254Cleaned up the syncing config dialog. 255Cleaned up the syncing config dialog.
255Added sync config options for date range for events. 256Added sync config options for date range for events.
256Added sync config options for filters on incoming data. 257Added sync config options for filters on incoming data.
257Added sync config options for filters on outgoing data. 258Added sync config options for filters on outgoing data.
258Please read the updated SyncHowTo about the new filter settings. 259Please read the updated SyncHowTo about the new filter settings.
259These filter settings make it now possible to sync with shared 260These filter settings make it now possible to sync with shared
260calendars without writing back private or confidential data 261calendars without writing back private or confidential data
261(via the outgoing filters). 262(via the outgoing filters).
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index a72e470..195b1fa 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -826,533 +826,560 @@ void KOAgenda::performItemAction(QPoint viewportPos)
826 mActionItem->resize(mActionItem->width(), 826 mActionItem->resize(mActionItem->width(),
827 mGridSpacingY * mActionItem->cellHeight()); 827 mGridSpacingY * mActionItem->cellHeight());
828 int x,y; 828 int x,y;
829 gridToContents(mCurrentCellX,mActionItem->cellYTop(),x,y); 829 gridToContents(mCurrentCellX,mActionItem->cellYTop(),x,y);
830 //moveChild(mActionItem,childX(mActionItem),y); 830 //moveChild(mActionItem,childX(mActionItem),y);
831 QScrollView::moveChild( mActionItem,childX(mActionItem),y ); 831 QScrollView::moveChild( mActionItem,childX(mActionItem),y );
832 } 832 }
833 } else if (mActionType == RESIZEBOTTOM) { 833 } else if (mActionType == RESIZEBOTTOM) {
834 if (mCurrentCellY >= mActionItem->cellYTop()) { 834 if (mCurrentCellY >= mActionItem->cellYTop()) {
835 mActionItem->expandBottom(gy - mCurrentCellY); 835 mActionItem->expandBottom(gy - mCurrentCellY);
836 mActionItem->resize(mActionItem->width(), 836 mActionItem->resize(mActionItem->width(),
837 mGridSpacingY * mActionItem->cellHeight()); 837 mGridSpacingY * mActionItem->cellHeight());
838 } 838 }
839 } else if (mActionType == RESIZELEFT) { 839 } else if (mActionType == RESIZELEFT) {
840 if (mCurrentCellX <= mActionItem->cellXWidth()) { 840 if (mCurrentCellX <= mActionItem->cellXWidth()) {
841 mActionItem->expandLeft(gx - mCurrentCellX); 841 mActionItem->expandLeft(gx - mCurrentCellX);
842 mActionItem->resize(mGridSpacingX * mActionItem->cellWidth(), 842 mActionItem->resize(mGridSpacingX * mActionItem->cellWidth(),
843 mActionItem->height()); 843 mActionItem->height());
844 int x,y; 844 int x,y;
845 gridToContents(mActionItem->cellX(),mActionItem->cellYTop(),x,y); 845 gridToContents(mActionItem->cellX(),mActionItem->cellYTop(),x,y);
846 moveChild(mActionItem,x,childY(mActionItem)); 846 moveChild(mActionItem,x,childY(mActionItem));
847 } 847 }
848 } else if (mActionType == RESIZERIGHT) { 848 } else if (mActionType == RESIZERIGHT) {
849 if (mCurrentCellX >= mActionItem->cellX()) { 849 if (mCurrentCellX >= mActionItem->cellX()) {
850 mActionItem->expandRight(gx - mCurrentCellX); 850 mActionItem->expandRight(gx - mCurrentCellX);
851 mActionItem->resize(mGridSpacingX * mActionItem->cellWidth(), 851 mActionItem->resize(mGridSpacingX * mActionItem->cellWidth(),
852 mActionItem->height()); 852 mActionItem->height());
853 } 853 }
854 } 854 }
855 mCurrentCellX = gx; 855 mCurrentCellX = gx;
856 mCurrentCellY = gy; 856 mCurrentCellY = gy;
857 } 857 }
858} 858}
859 859
860void KOAgenda::endItemAction() 860void KOAgenda::endItemAction()
861{ 861{
862 862
863 if ( mItemMoved ) { 863 if ( mItemMoved ) {
864 KOAgendaItem *placeItem = mActionItem->firstMultiItem(); 864 KOAgendaItem *placeItem = mActionItem->firstMultiItem();
865 if ( !placeItem ) { 865 if ( !placeItem ) {
866 placeItem = mActionItem; 866 placeItem = mActionItem;
867 } 867 }
868 if ( placeItem->incidence()->recurrence()->doesRecur() ) { 868 if ( placeItem->incidence()->recurrence()->doesRecur() ) {
869 Incidence* oldInc = placeItem->incidence(); 869 Incidence* oldInc = placeItem->incidence();
870 placeItem->recreateIncidence(); 870 placeItem->recreateIncidence();
871 emit addToCalSignal(placeItem->incidence(), oldInc ); 871 emit addToCalSignal(placeItem->incidence(), oldInc );
872 } 872 }
873 int type = mActionType; 873 int type = mActionType;
874 if ( mAllDayMode ) 874 if ( mAllDayMode )
875 type = -1; 875 type = -1;
876 KOAgendaItem *modifiedItem = placeItem; 876 KOAgendaItem *modifiedItem = placeItem;
877 //emit itemModified( placeItem, mActionType /*KOGlobals::EVENTEDITED */); 877 //emit itemModified( placeItem, mActionType /*KOGlobals::EVENTEDITED */);
878 QPtrList<KOAgendaItem> oldconflictItems ;//= placeItem->conflictItems(); 878 QPtrList<KOAgendaItem> oldconflictItems ;//= placeItem->conflictItems();
879 KOAgendaItem *item; 879 KOAgendaItem *item;
880 880
881 if ( placeItem->incidence()->type() == "Todo" ) { 881 if ( placeItem->incidence()->type() == "Todo" ) {
882 mSelectedItem = 0; 882 mSelectedItem = 0;
883 //qDebug("todo %d %d %d ", mCurrentCellX, modifiedItem->cellX() ,modifiedItem->cellXWidth()); 883 //qDebug("todo %d %d %d ", mCurrentCellX, modifiedItem->cellX() ,modifiedItem->cellXWidth());
884 modifiedItem->mLastMoveXPos = mCurrentCellX; 884 modifiedItem->mLastMoveXPos = mCurrentCellX;
885 emit itemModified( modifiedItem, mActionType ); 885 emit itemModified( modifiedItem, mActionType );
886 } 886 }
887 else { 887 else {
888#if 0 888#if 0
889 for ( item=oldconflictItems.first(); item != 0; 889 for ( item=oldconflictItems.first(); item != 0;
890 item=oldconflictItems.next() ) { 890 item=oldconflictItems.next() ) {
891 placeSubCells(item); 891 placeSubCells(item);
892 } 892 }
893 while ( placeItem ) { 893 while ( placeItem ) {
894 //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1()); 894 //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1());
895 placeSubCells( placeItem ); 895 placeSubCells( placeItem );
896 placeItem = placeItem->nextMultiItem(); 896 placeItem = placeItem->nextMultiItem();
897 } 897 }
898#endif 898#endif
899 899
900 globalFlagBlockAgendaItemPaint = 1; 900 globalFlagBlockAgendaItemPaint = 1;
901 for ( item=oldconflictItems.first(); item != 0; 901 for ( item=oldconflictItems.first(); item != 0;
902 item=oldconflictItems.next() ) { 902 item=oldconflictItems.next() ) {
903 placeSubCells(item); 903 placeSubCells(item);
904 } 904 }
905 while ( placeItem ) { 905 while ( placeItem ) {
906 //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1()); 906 //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1());
907 oldconflictItems = placeItem->conflictItems(); 907 oldconflictItems = placeItem->conflictItems();
908 for ( item=oldconflictItems.first(); item != 0; 908 for ( item=oldconflictItems.first(); item != 0;
909 item=oldconflictItems.next() ) { 909 item=oldconflictItems.next() ) {
910 placeSubCells(item); 910 placeSubCells(item);
911 } 911 }
912 placeSubCells( placeItem ); 912 placeSubCells( placeItem );
913 placeItem = placeItem->nextMultiItem(); 913 placeItem = placeItem->nextMultiItem();
914 } 914 }
915 globalFlagBlockAgendaItemPaint = 0; 915 globalFlagBlockAgendaItemPaint = 0;
916 for ( item=oldconflictItems.first(); item != 0; 916 for ( item=oldconflictItems.first(); item != 0;
917 item=oldconflictItems.next() ) { 917 item=oldconflictItems.next() ) {
918 globalFlagBlockAgendaItemUpdate = 0; 918 globalFlagBlockAgendaItemUpdate = 0;
919 item->repaintMe(); 919 item->repaintMe();
920 globalFlagBlockAgendaItemUpdate = 1; 920 globalFlagBlockAgendaItemUpdate = 1;
921 item->repaint( false ); 921 item->repaint( false );
922 } 922 }
923 placeItem = modifiedItem; 923 placeItem = modifiedItem;
924 924
925 while ( placeItem ) { 925 while ( placeItem ) {
926 //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1()); 926 //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1());
927 globalFlagBlockAgendaItemUpdate = 0; 927 globalFlagBlockAgendaItemUpdate = 0;
928 placeItem->repaintMe(); 928 placeItem->repaintMe();
929 globalFlagBlockAgendaItemUpdate = 1; 929 globalFlagBlockAgendaItemUpdate = 1;
930 placeItem->repaint(false); 930 placeItem->repaint(false);
931 placeItem = placeItem->nextMultiItem(); 931 placeItem = placeItem->nextMultiItem();
932 } 932 }
933 emit itemModified( modifiedItem, mActionType ); 933 emit itemModified( modifiedItem, mActionType );
934 934
935 935
936 placeItem = modifiedItem; 936 placeItem = modifiedItem;
937 while ( placeItem ) { 937 while ( placeItem ) {
938 oldconflictItems = placeItem->conflictItems(); 938 oldconflictItems = placeItem->conflictItems();
939 for ( item=oldconflictItems.first(); item != 0; 939 for ( item=oldconflictItems.first(); item != 0;
940 item=oldconflictItems.next() ) { 940 item=oldconflictItems.next() ) {
941 placeSubCells(item); 941 placeSubCells(item);
942 } 942 }
943 placeSubCells( placeItem ); 943 placeSubCells( placeItem );
944 placeItem = placeItem->nextMultiItem(); 944 placeItem = placeItem->nextMultiItem();
945 945
946 } 946 }
947 placeItem = modifiedItem; 947 placeItem = modifiedItem;
948 while ( placeItem ) { 948 while ( placeItem ) {
949 oldconflictItems = placeItem->conflictItems(); 949 oldconflictItems = placeItem->conflictItems();
950 for ( item=oldconflictItems.first(); item != 0; 950 for ( item=oldconflictItems.first(); item != 0;
951 item=oldconflictItems.next() ) { 951 item=oldconflictItems.next() ) {
952 globalFlagBlockAgendaItemUpdate = 0; 952 globalFlagBlockAgendaItemUpdate = 0;
953 item->repaintMe(); 953 item->repaintMe();
954 globalFlagBlockAgendaItemUpdate = 1; 954 globalFlagBlockAgendaItemUpdate = 1;
955 item->repaint(false); 955 item->repaint(false);
956 } 956 }
957 placeItem = placeItem->nextMultiItem(); 957 placeItem = placeItem->nextMultiItem();
958 } 958 }
959 /* 959 /*
960 960
961 oldconflictItems = modifiedItem->conflictItems(); 961 oldconflictItems = modifiedItem->conflictItems();
962 for ( item=oldconflictItems.first(); item != 0; 962 for ( item=oldconflictItems.first(); item != 0;
963 item=oldconflictItems.next() ) { 963 item=oldconflictItems.next() ) {
964 globalFlagBlockAgendaItemUpdate = 0; 964 globalFlagBlockAgendaItemUpdate = 0;
965 item->paintMe(false); 965 item->paintMe(false);
966 globalFlagBlockAgendaItemUpdate = 1; 966 globalFlagBlockAgendaItemUpdate = 1;
967 item->repaint(false); 967 item->repaint(false);
968 } 968 }
969 */ 969 */
970 970
971 971
972 } 972 }
973 973
974 } 974 }
975 975
976 mScrollUpTimer.stop(); 976 mScrollUpTimer.stop();
977 mScrollDownTimer.stop(); 977 mScrollDownTimer.stop();
978 setCursor( arrowCursor ); 978 setCursor( arrowCursor );
979 mActionItem = 0; 979 mActionItem = 0;
980 mActionType = NOP; 980 mActionType = NOP;
981 mItemMoved = 0; 981 mItemMoved = 0;
982 982
983} 983}
984 984
985void KOAgenda::setNoActionCursor(KOAgendaItem *moveItem,QPoint viewportPos) 985void KOAgenda::setNoActionCursor(KOAgendaItem *moveItem,QPoint viewportPos)
986{ 986{
987// kdDebug() << "viewportPos: " << viewportPos.x() << "," << viewportPos.y() << endl; 987// kdDebug() << "viewportPos: " << viewportPos.x() << "," << viewportPos.y() << endl;
988// QPoint point = viewport()->mapToGlobal(viewportPos); 988// QPoint point = viewport()->mapToGlobal(viewportPos);
989// kdDebug() << "Global: " << point.x() << "," << point.y() << endl; 989// kdDebug() << "Global: " << point.x() << "," << point.y() << endl;
990// point = clipper()->mapFromGlobal(point); 990// point = clipper()->mapFromGlobal(point);
991// kdDebug() << "clipper: " << point.x() << "," << point.y() << endl; 991// kdDebug() << "clipper: " << point.x() << "," << point.y() << endl;
992 992
993 int x,y; 993 int x,y;
994 viewportToContents(viewportPos.x(),viewportPos.y(),x,y); 994 viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
995// kdDebug() << "contents: " << x << "," << y << "\n" << endl; 995// kdDebug() << "contents: " << x << "," << y << "\n" << endl;
996 int gx,gy; 996 int gx,gy;
997 contentsToGrid(x,y,gx,gy); 997 contentsToGrid(x,y,gx,gy);
998 998
999 // Change cursor to resize cursor if appropriate 999 // Change cursor to resize cursor if appropriate
1000 if (mAllDayMode) { 1000 if (mAllDayMode) {
1001 int gridDistanceX = (x - gx * mGridSpacingX); 1001 int gridDistanceX = (x - gx * mGridSpacingX);
1002 if (gridDistanceX < mResizeBorderWidth && 1002 if (gridDistanceX < mResizeBorderWidth &&
1003 moveItem->cellX() == gx) { 1003 moveItem->cellX() == gx) {
1004 setCursor(sizeHorCursor); 1004 setCursor(sizeHorCursor);
1005 } else if ((mGridSpacingX - gridDistanceX) < mResizeBorderWidth && 1005 } else if ((mGridSpacingX - gridDistanceX) < mResizeBorderWidth &&
1006 moveItem->cellXWidth() == gx) { 1006 moveItem->cellXWidth() == gx) {
1007 setCursor(sizeHorCursor); 1007 setCursor(sizeHorCursor);
1008 } else { 1008 } else {
1009 setCursor(arrowCursor); 1009 setCursor(arrowCursor);
1010 } 1010 }
1011 } else { 1011 } else {
1012 int gridDistanceY = (y - gy * mGridSpacingY); 1012 int gridDistanceY = (y - gy * mGridSpacingY);
1013 if (gridDistanceY < mResizeBorderWidth && 1013 if (gridDistanceY < mResizeBorderWidth &&
1014 moveItem->cellYTop() == gy && 1014 moveItem->cellYTop() == gy &&
1015 !moveItem->firstMultiItem()) { 1015 !moveItem->firstMultiItem()) {
1016 setCursor(sizeVerCursor); 1016 setCursor(sizeVerCursor);
1017 } else if ((mGridSpacingY - gridDistanceY) < mResizeBorderWidth && 1017 } else if ((mGridSpacingY - gridDistanceY) < mResizeBorderWidth &&
1018 moveItem->cellYBottom() == gy && 1018 moveItem->cellYBottom() == gy &&
1019 !moveItem->lastMultiItem()) { 1019 !moveItem->lastMultiItem()) {
1020 setCursor(sizeVerCursor); 1020 setCursor(sizeVerCursor);
1021 } else { 1021 } else {
1022 setCursor(arrowCursor); 1022 setCursor(arrowCursor);
1023 } 1023 }
1024 } 1024 }
1025} 1025}
1026 1026
1027 1027
1028/* 1028/*
1029 Place item in cell and take care that multiple items using the same cell do 1029 Place item in cell and take care that multiple items using the same cell do
1030 not overlap. This method is not yet optimal. It doesn´t use the maximum space 1030 not overlap. This method is not yet optimal. It doesn´t use the maximum space
1031 it can get in all cases. 1031 it can get in all cases.
1032 At the moment the method has a bug: When an item is placed only the sub cell 1032 At the moment the method has a bug: When an item is placed only the sub cell
1033 widths of the items are changed, which are within the Y region the item to 1033 widths of the items are changed, which are within the Y region the item to
1034 place spans. When the sub cell width change of one of this items affects a 1034 place spans. When the sub cell width change of one of this items affects a
1035 cell, where other items are, which do not overlap in Y with the item to place, 1035 cell, where other items are, which do not overlap in Y with the item to place,
1036 the display gets corrupted, although the corruption looks quite nice. 1036 the display gets corrupted, although the corruption looks quite nice.
1037*/ 1037*/
1038void KOAgenda::placeSubCells(KOAgendaItem *placeItem) 1038void KOAgenda::placeSubCells(KOAgendaItem *placeItem)
1039{ 1039{
1040 1040
1041 QPtrList<KOAgendaItem> conflictItems; 1041 QPtrList<KOAgendaItem> conflictItems;
1042 int maxSubCells = 0; 1042 int maxSubCells = 0;
1043 QIntDict<KOAgendaItem> subCellDict(5); 1043 QIntDict<KOAgendaItem> subCellDict(5);
1044 1044
1045 KOAgendaItem *item; 1045 KOAgendaItem *item;
1046 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1046 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1047 if (item != placeItem) { 1047 if (item != placeItem) {
1048 if (placeItem->cellX() <= item->cellXWidth() && 1048 if (placeItem->cellX() <= item->cellXWidth() &&
1049 placeItem->cellXWidth() >= item->cellX()) { 1049 placeItem->cellXWidth() >= item->cellX()) {
1050 if ((placeItem->cellYTop() <= item->cellYBottom()) && 1050 if ((placeItem->cellYTop() <= item->cellYBottom()) &&
1051 (placeItem->cellYBottom() >= item->cellYTop())) { 1051 (placeItem->cellYBottom() >= item->cellYTop())) {
1052 conflictItems.append(item); 1052 conflictItems.append(item);
1053 if (item->subCells() > maxSubCells) 1053 if (item->subCells() > maxSubCells)
1054 maxSubCells = item->subCells(); 1054 maxSubCells = item->subCells();
1055 subCellDict.insert(item->subCell(),item); 1055 subCellDict.insert(item->subCell(),item);
1056 } 1056 }
1057 } 1057 }
1058 } 1058 }
1059 } 1059 }
1060 1060
1061 if (conflictItems.count() > 0) { 1061 if (conflictItems.count() > 0) {
1062 // Look for unused sub cell and insert item 1062 // Look for unused sub cell and insert item
1063 int i; 1063 int i;
1064 for(i=0;i<maxSubCells;++i) { 1064 for(i=0;i<maxSubCells;++i) {
1065 if (!subCellDict.find(i)) { 1065 if (!subCellDict.find(i)) {
1066 placeItem->setSubCell(i); 1066 placeItem->setSubCell(i);
1067 break; 1067 break;
1068 } 1068 }
1069 } 1069 }
1070 if (i == maxSubCells) { 1070 if (i == maxSubCells) {
1071 placeItem->setSubCell(maxSubCells); 1071 placeItem->setSubCell(maxSubCells);
1072 maxSubCells++; // add new item to number of sub cells 1072 maxSubCells++; // add new item to number of sub cells
1073 } 1073 }
1074 1074
1075 // Prepare for sub cell geometry adjustment 1075 // Prepare for sub cell geometry adjustment
1076 int newSubCellWidth; 1076 int newSubCellWidth;
1077 if (mAllDayMode) newSubCellWidth = mGridSpacingY / maxSubCells; 1077 if (mAllDayMode) newSubCellWidth = mGridSpacingY / maxSubCells;
1078 else newSubCellWidth = mGridSpacingX / maxSubCells; 1078 else newSubCellWidth = mGridSpacingX / maxSubCells;
1079 conflictItems.append(placeItem); 1079 conflictItems.append(placeItem);
1080 1080
1081 1081
1082 // Adjust sub cell geometry of all items 1082 // Adjust sub cell geometry of all direct conflict items
1083 for ( item=conflictItems.first(); item != 0; 1083 for ( item=conflictItems.first(); item != 0;
1084 item=conflictItems.next() ) { 1084 item=conflictItems.next() ) {
1085 item->setSubCells(maxSubCells); 1085 item->setSubCells(maxSubCells);
1086 if (mAllDayMode) { 1086 if (mAllDayMode) {
1087 item->resize(item->cellWidth() * mGridSpacingX, newSubCellWidth); 1087 item->resize(item->cellWidth() * mGridSpacingX, newSubCellWidth);
1088 } else { 1088 } else {
1089 item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY); 1089 item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY);
1090 } 1090 }
1091 int x,y; 1091 int x,y;
1092 gridToContents(item->cellX(),item->cellYTop(),x,y); 1092 gridToContents(item->cellX(),item->cellYTop(),x,y);
1093 if (mAllDayMode) { 1093 if (mAllDayMode) {
1094 y += item->subCell() * newSubCellWidth; 1094 y += item->subCell() * newSubCellWidth;
1095 } else { 1095 } else {
1096 x += item->subCell() * newSubCellWidth; 1096 x += item->subCell() * newSubCellWidth;
1097 } 1097 }
1098 moveChild(item,x,y); 1098 moveChild(item,x,y);
1099 // qDebug("moveChild %s %d %d ", item->incidence()->summary().latin1() ,x,y); 1099 // qDebug("moveChild %s %d %d ", item->incidence()->summary().latin1() ,x,y);
1100 //item->updateItem(); 1100 //item->updateItem();
1101 } 1101 }
1102 1102 // Adjust sub cell geometry of all conflict items of all conflict items
1103 for ( item=conflictItems.first(); item != 0;
1104 item=conflictItems.next() ) {
1105 if ( placeItem != item ) {
1106 KOAgendaItem *item2;
1107 QPtrList<KOAgendaItem> conflictItems2 = item->conflictItems();
1108 for ( item2=conflictItems2.first(); item2 != 0;
1109 item2=conflictItems2.next() ) {
1110 if ( item2->subCells() != maxSubCells) {
1111 item2->setSubCells(maxSubCells);
1112 if (mAllDayMode) {
1113 item2->resize(item2->cellWidth() * mGridSpacingX, newSubCellWidth);
1114 } else {
1115 item2->resize(newSubCellWidth, item2->cellHeight() * mGridSpacingY);
1116 }
1117 int x,y;
1118 gridToContents(item2->cellX(),item2->cellYTop(),x,y);
1119 if (mAllDayMode) {
1120 y += item2->subCell() * newSubCellWidth;
1121 } else {
1122 x += item2->subCell() * newSubCellWidth;
1123 }
1124 moveChild(item2,x,y);
1125 //qDebug("setttttt %d %s",maxSubCells, item2->text().latin1() );
1126 }
1127 }
1128 }
1129 }
1103 } else { 1130 } else {
1104 placeItem->setSubCell(0); 1131 placeItem->setSubCell(0);
1105 placeItem->setSubCells(1); 1132 placeItem->setSubCells(1);
1106 if (mAllDayMode) placeItem->resize(placeItem->width(),mGridSpacingY); 1133 if (mAllDayMode) placeItem->resize(placeItem->width(),mGridSpacingY);
1107 else placeItem->resize(mGridSpacingX,placeItem->height()); 1134 else placeItem->resize(mGridSpacingX,placeItem->height());
1108 int x,y; 1135 int x,y;
1109 gridToContents(placeItem->cellX(),placeItem->cellYTop(),x,y); 1136 gridToContents(placeItem->cellX(),placeItem->cellYTop(),x,y);
1110 moveChild(placeItem,x,y); 1137 moveChild(placeItem,x,y);
1111 } 1138 }
1112 placeItem->setConflictItems(conflictItems); 1139 placeItem->setConflictItems(conflictItems);
1113 // for ( item=conflictItems.first(); item != 0; 1140 // for ( item=conflictItems.first(); item != 0;
1114// item=conflictItems.next() ) { 1141// item=conflictItems.next() ) {
1115// //item->updateItem(); 1142// //item->updateItem();
1116// //qDebug("xxx item->updateItem() %s %d %d", item->incidence()->summary().latin1(),item->x(), item->y() ); 1143// //qDebug("xxx item->updateItem() %s %d %d", item->incidence()->summary().latin1(),item->x(), item->y() );
1117// } 1144// }
1118// placeItem->updateItem(); 1145// placeItem->updateItem();
1119} 1146}
1120 1147
1121void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch) 1148void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch)
1122{ 1149{
1123 if ( globalFlagBlockAgenda ) 1150 if ( globalFlagBlockAgenda )
1124 return; 1151 return;
1125 //qDebug("KOAgenda::drawContents "); 1152 //qDebug("KOAgenda::drawContents ");
1126 if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) 1153 if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() )
1127 ;//drawContentsToPainter(); 1154 ;//drawContentsToPainter();
1128 1155
1129 QPaintDevice* pd = p->device(); 1156 QPaintDevice* pd = p->device();
1130 p->end(); 1157 p->end();
1131 int vx, vy; 1158 int vx, vy;
1132 int selectionX = KOGlobals::self()->reverseLayout() ? 1159 int selectionX = KOGlobals::self()->reverseLayout() ?
1133 (mColumns - 1 - mSelectionCellX) * mGridSpacingX : 1160 (mColumns - 1 - mSelectionCellX) * mGridSpacingX :
1134 mSelectionCellX * mGridSpacingX; 1161 mSelectionCellX * mGridSpacingX;
1135 contentsToViewport ( cx, cy, vx,vy); 1162 contentsToViewport ( cx, cy, vx,vy);
1136 // qDebug(" %d %d %d %d ", cx, cy, cw,ch) ; 1163 // qDebug(" %d %d %d %d ", cx, cy, cw,ch) ;
1137 if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) 1164 if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) )
1138 bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); 1165 bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP);
1139 1166
1140 if ( mSelectionHeight > 0 ) { 1167 if ( mSelectionHeight > 0 ) {
1141 //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight ); 1168 //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight );
1142 if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && 1169 if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) &&
1143 ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { 1170 ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) {
1144 contentsToViewport ( selectionX, mSelectionYTop, vx,vy); 1171 contentsToViewport ( selectionX, mSelectionYTop, vx,vy);
1145 bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP); 1172 bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP);
1146 } 1173 }
1147 } 1174 }
1148 //qDebug("btbl "); 1175 //qDebug("btbl ");
1149 p->begin( pd ); 1176 p->begin( pd );
1150 //qDebug("end "); 1177 //qDebug("end ");
1151} 1178}
1152 1179
1153void KOAgenda::finishUpdate() 1180void KOAgenda::finishUpdate()
1154{ 1181{
1155 1182
1156 KOAgendaItem *item; 1183 KOAgendaItem *item;
1157 globalFlagBlockAgendaItemPaint = 1; 1184 globalFlagBlockAgendaItemPaint = 1;
1158 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1185 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1159 if ( !item->isVisible() ) 1186 if ( !item->isVisible() )
1160 item->show(); 1187 item->show();
1161 1188
1162 } 1189 }
1163 globalFlagBlockAgendaItemUpdate = 0; 1190 globalFlagBlockAgendaItemUpdate = 0;
1164 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1191 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1165 item->repaintMe( ); 1192 item->repaintMe( );
1166 } 1193 }
1167 globalFlagBlockAgendaItemUpdate = 1; 1194 globalFlagBlockAgendaItemUpdate = 1;
1168 qApp->processEvents(); 1195 qApp->processEvents();
1169 globalFlagBlockAgendaItemPaint = 0; 1196 globalFlagBlockAgendaItemPaint = 0;
1170 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1197 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1171 item->repaint( false ); 1198 item->repaint( false );
1172 } 1199 }
1173 1200
1174} 1201}
1175 1202
1176/* 1203/*
1177 Draw grid in the background of the agenda. 1204 Draw grid in the background of the agenda.
1178*/ 1205*/
1179void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// int cx, int cy, int cw, int ch) 1206void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// int cx, int cy, int cw, int ch)
1180{ 1207{
1181 1208
1182 1209
1183 if ( ! mGridSpacingX || ! mGridSpacingY ||! mHolidayMask ) 1210 if ( ! mGridSpacingX || ! mGridSpacingY ||! mHolidayMask )
1184 return; 1211 return;
1185 if ( globalFlagBlockAgenda > 1 && globalFlagBlockAgenda < 4 ) 1212 if ( globalFlagBlockAgenda > 1 && globalFlagBlockAgenda < 4 )
1186 return; 1213 return;
1187 int cx = 0, cy = 0, cw = contentsWidth(), ch = contentsHeight(); 1214 int cx = 0, cy = 0, cw = contentsWidth(), ch = contentsHeight();
1188 if ( ch < 1 ) 1215 if ( ch < 1 )
1189 ch = 1; 1216 ch = 1;
1190 if ( mPaintPixmap.width() < contentsWidth()+42 || mPaintPixmap.height() < ch ) { 1217 if ( mPaintPixmap.width() < contentsWidth()+42 || mPaintPixmap.height() < ch ) {
1191 mPaintPixmap.resize( contentsWidth()+42, ch ); 1218 mPaintPixmap.resize( contentsWidth()+42, ch );
1192 } 1219 }
1193 mCurPixWid = contentsWidth(); 1220 mCurPixWid = contentsWidth();
1194 mCurPixHei = ch; 1221 mCurPixHei = ch;
1195 if ( mHighlightPixmap.width() < mGridSpacingX-1 || mHighlightPixmap.height() < ch ) { 1222 if ( mHighlightPixmap.width() < mGridSpacingX-1 || mHighlightPixmap.height() < ch ) {
1196 mHighlightPixmap.resize( mGridSpacingX-1, ch ); 1223 mHighlightPixmap.resize( mGridSpacingX-1, ch );
1197 mHighlightPixmap.fill ( KOPrefs::instance()->mHighlightColor ); 1224 mHighlightPixmap.fill ( KOPrefs::instance()->mHighlightColor );
1198 } 1225 }
1199 mPixPainter.begin( &mPaintPixmap) ; 1226 mPixPainter.begin( &mPaintPixmap) ;
1200 //qDebug("wid %d hei %d ",mPaintPixmap.width(),mPaintPixmap.height() ); 1227 //qDebug("wid %d hei %d ",mPaintPixmap.width(),mPaintPixmap.height() );
1201 QPainter * p ; 1228 QPainter * p ;
1202 if (paint == 0) { 1229 if (paint == 0) {
1203 mPaintPixmap.fill(KOPrefs::instance()->mAgendaBgColor); 1230 mPaintPixmap.fill(KOPrefs::instance()->mAgendaBgColor);
1204 p = &mPixPainter; 1231 p = &mPixPainter;
1205 } 1232 }
1206 else 1233 else
1207 p = paint ; 1234 p = paint ;
1208 // qDebug("++++++KOAgenda::drawContentsTo Painter %d %d %d %d ", cx, cy, cw, ch); 1235 // qDebug("++++++KOAgenda::drawContentsTo Painter %d %d %d %d ", cx, cy, cw, ch);
1209 1236
1210 //--cx;++cw; 1237 //--cx;++cw;
1211 int lGridSpacingY = mGridSpacingY*2; 1238 int lGridSpacingY = mGridSpacingY*2;
1212 int selDay; 1239 int selDay;
1213 if ( !backgroundOnly ) 1240 if ( !backgroundOnly )
1214 for ( selDay = 0; selDay < mSelectedDates.count(); ++selDay) 1241 for ( selDay = 0; selDay < mSelectedDates.count(); ++selDay)
1215 { 1242 {
1216 if ( mSelectedDates[selDay] == QDateTime::currentDateTime ().date() && KOPrefs::instance()->mHighlightCurrentDay) { 1243 if ( mSelectedDates[selDay] == QDateTime::currentDateTime ().date() && KOPrefs::instance()->mHighlightCurrentDay) {
1217 int x1 = cx; 1244 int x1 = cx;
1218 int y1 = 0; 1245 int y1 = 0;
1219 if (y1 < cy) y1 = cy; 1246 if (y1 < cy) y1 = cy;
1220 int x2 = cx+cw-1; 1247 int x2 = cx+cw-1;
1221 int y2 = contentsHeight(); 1248 int y2 = contentsHeight();
1222 if (y2 > cy+ch-1) y2=cy+ch-1; 1249 if (y2 > cy+ch-1) y2=cy+ch-1;
1223 if (x2 >= x1 && y2 >= y1) { 1250 if (x2 >= x1 && y2 >= y1) {
1224 int gxStart = selDay; 1251 int gxStart = selDay;
1225 int gxEnd = gxStart ; 1252 int gxEnd = gxStart ;
1226 int xStart = KOGlobals::self()->reverseLayout() ? 1253 int xStart = KOGlobals::self()->reverseLayout() ?
1227 (mColumns - 1 - gxStart)*mGridSpacingX : 1254 (mColumns - 1 - gxStart)*mGridSpacingX :
1228 gxStart*mGridSpacingX; 1255 gxStart*mGridSpacingX;
1229 if (xStart < x1) xStart = x1; 1256 if (xStart < x1) xStart = x1;
1230 int xEnd = KOGlobals::self()->reverseLayout() ? 1257 int xEnd = KOGlobals::self()->reverseLayout() ?
1231 (mColumns - gxStart)*mGridSpacingX-1 : 1258 (mColumns - gxStart)*mGridSpacingX-1 :
1232 (gxStart+1)*mGridSpacingX-1; 1259 (gxStart+1)*mGridSpacingX-1;
1233 if (xEnd > x2) xEnd = x2; 1260 if (xEnd > x2) xEnd = x2;
1234 if ( KOPrefs::instance()->mUseHighlightLightColor ) 1261 if ( KOPrefs::instance()->mUseHighlightLightColor )
1235 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, 1262 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1,
1236 KOPrefs::instance()->mAgendaBgColor.light()); 1263 KOPrefs::instance()->mAgendaBgColor.light());
1237 else 1264 else
1238 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, 1265 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1,
1239 KOPrefs::instance()->mAgendaBgColor.dark()); 1266 KOPrefs::instance()->mAgendaBgColor.dark());
1240 1267
1241 } 1268 }
1242 } 1269 }
1243 } 1270 }
1244 // Highlight working hours 1271 // Highlight working hours
1245 1272
1246 if ( !backgroundOnly ) 1273 if ( !backgroundOnly )
1247 if (mWorkingHoursEnable) { 1274 if (mWorkingHoursEnable) {
1248 int x1 = cx; 1275 int x1 = cx;
1249 int y1 = mWorkingHoursYTop; 1276 int y1 = mWorkingHoursYTop;
1250 if (y1 < cy) y1 = cy; 1277 if (y1 < cy) y1 = cy;
1251 int x2 = cx+cw-1; 1278 int x2 = cx+cw-1;
1252 // int x2 = mGridSpacingX * 5 - 1; 1279 // int x2 = mGridSpacingX * 5 - 1;
1253 // if (x2 > cx+cw-1) x2 = cx + cw - 1; 1280 // if (x2 > cx+cw-1) x2 = cx + cw - 1;
1254 int y2 = mWorkingHoursYBottom; 1281 int y2 = mWorkingHoursYBottom;
1255 if (y2 > cy+ch-1) y2=cy+ch-1; 1282 if (y2 > cy+ch-1) y2=cy+ch-1;
1256 1283
1257 if (x2 >= x1 && y2 >= y1) { 1284 if (x2 >= x1 && y2 >= y1) {
1258 // qDebug("x1 %d mGridSpacingX %d ", x1, mGridSpacingX ); 1285 // qDebug("x1 %d mGridSpacingX %d ", x1, mGridSpacingX );
1259 int gxStart = x1/mGridSpacingX; 1286 int gxStart = x1/mGridSpacingX;
1260 int gxEnd = x2/mGridSpacingX; 1287 int gxEnd = x2/mGridSpacingX;
1261 while(gxStart <= gxEnd) { 1288 while(gxStart <= gxEnd) {
1262 if (gxStart < int(mHolidayMask->count()) && 1289 if (gxStart < int(mHolidayMask->count()) &&
1263 !mHolidayMask->at(gxStart)) { 1290 !mHolidayMask->at(gxStart)) {
1264 int xStart = KOGlobals::self()->reverseLayout() ? 1291 int xStart = KOGlobals::self()->reverseLayout() ?
1265 (mColumns - 1 - gxStart)*mGridSpacingX : 1292 (mColumns - 1 - gxStart)*mGridSpacingX :
1266 gxStart*mGridSpacingX; 1293 gxStart*mGridSpacingX;
1267 if (xStart < x1) xStart = x1; 1294 if (xStart < x1) xStart = x1;
1268 int xEnd = KOGlobals::self()->reverseLayout() ? 1295 int xEnd = KOGlobals::self()->reverseLayout() ?
1269 (mColumns - gxStart)*mGridSpacingX-1 : 1296 (mColumns - gxStart)*mGridSpacingX-1 :
1270 (gxStart+1)*mGridSpacingX-1; 1297 (gxStart+1)*mGridSpacingX-1;
1271 if (xEnd > x2) xEnd = x2; 1298 if (xEnd > x2) xEnd = x2;
1272 if ( mSelectedDates[gxStart] == QDateTime::currentDateTime ().date()&& KOPrefs::instance()->mHighlightCurrentDay ) { 1299 if ( mSelectedDates[gxStart] == QDateTime::currentDateTime ().date()&& KOPrefs::instance()->mHighlightCurrentDay ) {
1273 if ( KOPrefs::instance()->mUseHighlightLightColor ) 1300 if ( KOPrefs::instance()->mUseHighlightLightColor )
1274 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, 1301 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1,
1275 KOPrefs::instance()->mWorkingHoursColor.light()); 1302 KOPrefs::instance()->mWorkingHoursColor.light());
1276 else 1303 else
1277 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, 1304 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1,
1278 KOPrefs::instance()->mWorkingHoursColor.dark()); 1305 KOPrefs::instance()->mWorkingHoursColor.dark());
1279 } else { 1306 } else {
1280 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1, 1307 p->fillRect(xStart,y1,xEnd-xStart+1,y2-y1+1,
1281 KOPrefs::instance()->mWorkingHoursColor); 1308 KOPrefs::instance()->mWorkingHoursColor);
1282 } 1309 }
1283 } 1310 }
1284 ++gxStart; 1311 ++gxStart;
1285 } 1312 }
1286 } 1313 }
1287 } 1314 }
1288 /* 1315 /*
1289 int selectionX = KOGlobals::self()->reverseLayout() ? 1316 int selectionX = KOGlobals::self()->reverseLayout() ?
1290 (mColumns - 1 - mSelectionCellX) * mGridSpacingX : 1317 (mColumns - 1 - mSelectionCellX) * mGridSpacingX :
1291 mSelectionCellX * mGridSpacingX; 1318 mSelectionCellX * mGridSpacingX;
1292 1319
1293 // Draw selection 1320 // Draw selection
1294 if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && 1321 if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) &&
1295 ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { 1322 ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) {
1296 // TODO: paint only part within cx,cy,cw,ch 1323 // TODO: paint only part within cx,cy,cw,ch
1297 p->fillRect( selectionX, mSelectionYTop, mGridSpacingX, 1324 p->fillRect( selectionX, mSelectionYTop, mGridSpacingX,
1298 mSelectionHeight, KOPrefs::instance()->mHighlightColor ); 1325 mSelectionHeight, KOPrefs::instance()->mHighlightColor );
1299 } 1326 }
1300 */ 1327 */
1301 // Draw vertical lines of grid 1328 // Draw vertical lines of grid
1302 1329
1303 int x = ((int)(cx/mGridSpacingX))*mGridSpacingX; 1330 int x = ((int)(cx/mGridSpacingX))*mGridSpacingX;
1304 if ( mGridSpacingX > 0 ) { 1331 if ( mGridSpacingX > 0 ) {
1305 while (x < cx + cw) { 1332 while (x < cx + cw) {
1306 p->drawLine(x,cy,x,cy+ch); 1333 p->drawLine(x,cy,x,cy+ch);
1307 x+=mGridSpacingX; 1334 x+=mGridSpacingX;
1308 } 1335 }
1309 } 1336 }
1310 // Draw horizontal lines of grid 1337 // Draw horizontal lines of grid
1311 int y = ((int)(cy/lGridSpacingY))*lGridSpacingY; 1338 int y = ((int)(cy/lGridSpacingY))*lGridSpacingY;
1312 if ( lGridSpacingY > 0 ) { 1339 if ( lGridSpacingY > 0 ) {
1313 while (y < cy + ch) { 1340 while (y < cy + ch) {
1314 p->setPen( SolidLine ); 1341 p->setPen( SolidLine );
1315 p->drawLine(cx,y,cx+cw,y); 1342 p->drawLine(cx,y,cx+cw,y);
1316 y+=lGridSpacingY; 1343 y+=lGridSpacingY;
1317 p->setPen( DotLine ); 1344 p->setPen( DotLine );
1318 p->drawLine(cx,y,cx+cw,y); 1345 p->drawLine(cx,y,cx+cw,y);
1319 y+=lGridSpacingY; 1346 y+=lGridSpacingY;
1320 } 1347 }
1321 p->setPen( SolidLine ); 1348 p->setPen( SolidLine );
1322 } 1349 }
1323 mPixPainter.end() ; 1350 mPixPainter.end() ;
1324} 1351}
1325 1352
1326/* 1353/*
1327 Convert srcollview contents coordinates to agenda grid coordinates. 1354 Convert srcollview contents coordinates to agenda grid coordinates.
1328*/ 1355*/
1329void KOAgenda::contentsToGrid (int x, int y, int& gx, int& gy) 1356void KOAgenda::contentsToGrid (int x, int y, int& gx, int& gy)
1330{ 1357{
1331 gx = KOGlobals::self()->reverseLayout() ? mColumns - 1 - x/mGridSpacingX : 1358 gx = KOGlobals::self()->reverseLayout() ? mColumns - 1 - x/mGridSpacingX :
1332 x/mGridSpacingX; 1359 x/mGridSpacingX;
1333 gy = y/mGridSpacingY; 1360 gy = y/mGridSpacingY;
1334} 1361}
1335 1362
1336/* 1363/*
1337 Convert agenda grid coordinates to scrollview contents coordinates. 1364 Convert agenda grid coordinates to scrollview contents coordinates.
1338*/ 1365*/
1339void KOAgenda::gridToContents (int gx, int gy, int& x, int& y) 1366void KOAgenda::gridToContents (int gx, int gy, int& x, int& y)
1340{ 1367{
1341 x = KOGlobals::self()->reverseLayout() ? (mColumns - 1 - gx)*mGridSpacingX: 1368 x = KOGlobals::self()->reverseLayout() ? (mColumns - 1 - gx)*mGridSpacingX:
1342 gx*mGridSpacingX; 1369 gx*mGridSpacingX;
1343 y = gy*mGridSpacingY; 1370 y = gy*mGridSpacingY;
1344} 1371}
1345 1372
1346 1373
1347/* 1374/*
1348 Return Y coordinate corresponding to time. Coordinates are rounded to fit into 1375 Return Y coordinate corresponding to time. Coordinates are rounded to fit into
1349 the grid. 1376 the grid.
1350*/ 1377*/
1351int KOAgenda::timeToY(const QTime &time) 1378int KOAgenda::timeToY(const QTime &time)
1352{ 1379{
1353 int minutesPerCell = 24 * 60 / mRows; 1380 int minutesPerCell = 24 * 60 / mRows;
1354 int timeMinutes = time.hour() * 60 + time.minute(); 1381 int timeMinutes = time.hour() * 60 + time.minute();
1355 int Y = (timeMinutes + (minutesPerCell / 2)) / minutesPerCell; 1382 int Y = (timeMinutes + (minutesPerCell / 2)) / minutesPerCell;
1356 return Y; 1383 return Y;
1357} 1384}
1358 1385
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index d0a7b07..38bd93a 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -1,393 +1,394 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#include <qlabel.h> 20#include <qlabel.h>
21#include <qlayout.h> 21#include <qlayout.h>
22#include <qhbox.h> 22#include <qhbox.h>
23#include <qvbox.h> 23#include <qvbox.h>
24#include <qtooltip.h> 24#include <qtooltip.h>
25#include <qwhatsthis.h> 25#include <qwhatsthis.h>
26#include <qdragobject.h> 26#include <qdragobject.h>
27#include <qdrawutil.h> 27#include <qdrawutil.h>
28#include <qpainter.h> 28#include <qpainter.h>
29 29
30#include <kiconloader.h> 30#include <kiconloader.h>
31#include <kdebug.h> 31#include <kdebug.h>
32#include <kglobal.h> 32#include <kglobal.h>
33#include <klocale.h> 33#include <klocale.h>
34#ifndef DESKTOP_VERSION 34#ifndef DESKTOP_VERSION
35#include <qpe/qpeapplication.h> 35#include <qpe/qpeapplication.h>
36#define AGENDA_ICON_SIZE 5 36#define AGENDA_ICON_SIZE 5
37#else 37#else
38#define AGENDA_ICON_SIZE 7 38#define AGENDA_ICON_SIZE 7
39#endif 39#endif
40#include <libkcal/icaldrag.h> 40#include <libkcal/icaldrag.h>
41#include <libkcal/vcaldrag.h> 41#include <libkcal/vcaldrag.h>
42#include <libkcal/kincidenceformatter.h> 42#include <libkcal/kincidenceformatter.h>
43extern int globalFlagBlockAgenda; 43extern int globalFlagBlockAgenda;
44extern int globalFlagBlockAgendaItemPaint; 44extern int globalFlagBlockAgendaItemPaint;
45extern int globalFlagBlockAgendaItemUpdate; 45extern int globalFlagBlockAgendaItemUpdate;
46 46
47#include "koprefs.h" 47#include "koprefs.h"
48 48
49#include "koagendaitem.h" 49#include "koagendaitem.h"
50//#include "koagendaitem.moc" 50//#include "koagendaitem.moc"
51 51
52 52
53//-------------------------------------------------------------------------- 53//--------------------------------------------------------------------------
54 54
55QToolTipGroup *KOAgendaItem::mToolTipGroup = 0; 55QToolTipGroup *KOAgendaItem::mToolTipGroup = 0;
56 56
57//-------------------------------------------------------------------------- 57//--------------------------------------------------------------------------
58 58
59class KOAgendaItemWhatsThis :public QWhatsThis 59class KOAgendaItemWhatsThis :public QWhatsThis
60{ 60{
61public: 61public:
62 KOAgendaItemWhatsThis( KOAgendaItem* view ) : QWhatsThis( view ),_view (view) { }; 62 KOAgendaItemWhatsThis( KOAgendaItem* view ) : QWhatsThis( view ),_view (view) { };
63 63
64protected: 64protected:
65 virtual QString text( const QPoint& ) 65 virtual QString text( const QPoint& )
66 { 66 {
67 return _view->getWhatsThisText() ; 67 return _view->getWhatsThisText() ;
68 } 68 }
69private: 69private:
70 KOAgendaItem * _view; 70 KOAgendaItem * _view;
71}; 71};
72 72
73KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, 73KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday,
74 const char *name,WFlags) : 74 const char *name,WFlags) :
75 QWidget(parent, name), mIncidence(incidence), mDate(qd) 75 QWidget(parent, name), mIncidence(incidence), mDate(qd)
76{ 76{
77#ifndef DESKTOP_VERSION 77#ifndef DESKTOP_VERSION
78 QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); 78 QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold );
79#endif 79#endif
80 new KOAgendaItemWhatsThis(this); 80 new KOAgendaItemWhatsThis(this);
81 int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase 81 int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase
82 setWFlags ( wflags); 82 setWFlags ( wflags);
83 mAllDay = allday; 83 mAllDay = allday;
84 init ( incidence, qd ); 84 init ( incidence, qd );
85 setMouseTracking(true); 85 setMouseTracking(true);
86 //setAcceptDrops(true); 86 //setAcceptDrops(true);
87 xPaintCoord = -1; 87 xPaintCoord = -1;
88 yPaintCoord = -1; 88 yPaintCoord = -1;
89} 89}
90QString KOAgendaItem::getWhatsThisText() 90QString KOAgendaItem::getWhatsThisText()
91{ 91{
92 if ( mIncidence ) 92 if ( mIncidence )
93 return KIncidenceFormatter::instance()->getFormattedText( mIncidence, 93 return KIncidenceFormatter::instance()->getFormattedText( mIncidence,
94 KOPrefs::instance()->mWTshowDetails, 94 KOPrefs::instance()->mWTshowDetails,
95 KOPrefs::instance()->mWTshowCreated, 95 KOPrefs::instance()->mWTshowCreated,
96 KOPrefs::instance()->mWTshowChanged); 96 KOPrefs::instance()->mWTshowChanged);
97 return "KOAgendaItem::getWhatsThisText()::internal error"; 97 return "KOAgendaItem::getWhatsThisText()::internal error";
98} 98}
99void KOAgendaItem::init ( Incidence *incidence, QDate qd ) 99void KOAgendaItem::init ( Incidence *incidence, QDate qd )
100{ 100{
101 mIncidence = incidence; 101 mIncidence = incidence;
102 mDate = qd; 102 mDate = qd;
103 mFirstMultiItem = 0; 103 mFirstMultiItem = 0;
104 mNextMultiItem = 0; 104 mNextMultiItem = 0;
105 mLastMultiItem = 0; 105 mLastMultiItem = 0;
106 computeText(); 106 computeText();
107 107
108 if ( (incidence->type() == "Todo") && 108 if ( (incidence->type() == "Todo") &&
109 ( !((static_cast<Todo*>(incidence))->isCompleted()) && 109 ( !((static_cast<Todo*>(incidence))->isCompleted()) &&
110 ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) { 110 ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) {
111 if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date()) 111 if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date())
112 mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; 112 mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ;
113 else 113 else
114 mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; 114 mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor;
115 } 115 }
116 else { 116 else {
117 QStringList categories = mIncidence->categories(); 117 QStringList categories = mIncidence->categories();
118 QString cat = categories.first(); 118 QString cat = categories.first();
119 if (cat.isEmpty()) { 119 if (cat.isEmpty()) {
120 if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) 120 if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) )
121 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; 121 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor;
122 else 122 else
123 mBackgroundColor =KOPrefs::instance()->mEventColor; 123 mBackgroundColor =KOPrefs::instance()->mEventColor;
124 } else { 124 } else {
125 mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); 125 mBackgroundColor = *KOPrefs::instance()->categoryColor(cat);
126 if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) { 126 if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) {
127 if ( mBackgroundColor == KOPrefs::instance()->mEventColor ) 127 if ( mBackgroundColor == KOPrefs::instance()->mEventColor )
128 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; 128 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor;
129 } 129 }
130 } 130 }
131 131
132 } 132 }
133 mColorGroup = QColorGroup( mBackgroundColor.light(), 133 mColorGroup = QColorGroup( mBackgroundColor.light(),
134 mBackgroundColor.dark(),mBackgroundColor.light(), 134 mBackgroundColor.dark(),mBackgroundColor.light(),
135 mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ; 135 mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ;
136 setBackgroundColor( mBackgroundColor ); 136 setBackgroundColor( mBackgroundColor );
137 137
138 mConflictItems.clear();
138 setCellXY(0,0,1); 139 setCellXY(0,0,1);
139 setCellXWidth(0); 140 setCellXWidth(0);
140 setSubCell(0); 141 setSubCell(0);
141 setSubCells(1); 142 setSubCells(1);
142 setMultiItem(0,0,0); 143 setMultiItem(0,0,0);
143 startMove(); 144 startMove();
144 mSelected = true; 145 mSelected = true;
145 select(false); 146 select(false);
146 QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); 147 QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont);
147 mFontPixelSize = fontinf.height();; 148 mFontPixelSize = fontinf.height();;
148 hide(); 149 hide();
149 xPaintCoord = -1; 150 xPaintCoord = -1;
150 yPaintCoord = -1; 151 yPaintCoord = -1;
151} 152}
152 153
153 154
154KOAgendaItem::~KOAgendaItem() 155KOAgendaItem::~KOAgendaItem()
155{ 156{
156 // qDebug("deleteKOAgendaItem::~KOAgendaItem( "); 157 // qDebug("deleteKOAgendaItem::~KOAgendaItem( ");
157 158
158} 159}
159 160
160void KOAgendaItem::recreateIncidence() 161void KOAgendaItem::recreateIncidence()
161{ 162{
162#if 0 163#if 0
163 Incidence* newInc = mIncidence->clone(); 164 Incidence* newInc = mIncidence->clone();
164 newInc->recreate(); 165 newInc->recreate();
165 if ( mIncidence->doesRecur() ) { 166 if ( mIncidence->doesRecur() ) {
166 mIncidence->addExDate( mDate ); 167 mIncidence->addExDate( mDate );
167 newInc->recurrence()->unsetRecurs(); 168 newInc->recurrence()->unsetRecurs();
168 int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); 169 int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd());
169 QTime tim = mIncidence->dtStart().time(); 170 QTime tim = mIncidence->dtStart().time();
170 newInc->setDtStart( QDateTime(mDate, tim) ); 171 newInc->setDtStart( QDateTime(mDate, tim) );
171 ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); 172 ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) );
172 } 173 }
173#endif 174#endif
174 mIncidence = mIncidence->recreateCloneException( mDate ); 175 mIncidence = mIncidence->recreateCloneException( mDate );
175} 176}
176bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) 177bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout)
177{ 178{
178 int size = AGENDA_ICON_SIZE; 179 int size = AGENDA_ICON_SIZE;
179 180
180 int yOff = 0; 181 int yOff = 0;
181 int xOff = 0; 182 int xOff = 0;
182 int x = pos().x() +3; 183 int x = pos().x() +3;
183 int y; 184 int y;
184 if ( mAllDay ) 185 if ( mAllDay )
185 y = pos().y()+3; 186 y = pos().y()+3;
186 else 187 else
187 y = mCellYTop * ( height() / cellHeight() ) +3; 188 y = mCellYTop * ( height() / cellHeight() ) +3;
188 if (mIncidence->cancelled()) { 189 if (mIncidence->cancelled()) {
189 int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x; 190 int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x;
190 int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y; 191 int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y;
191 p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 ); 192 p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 );
192 p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos ); 193 p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos );
193 if ( horLayout ) 194 if ( horLayout )
194 ++xOff; 195 ++xOff;
195 else 196 else
196 ++yOff; 197 ++yOff;
197 } 198 }
198 if (mIncidence->isAlarmEnabled()) { 199 if (mIncidence->isAlarmEnabled()) {
199 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red ); 200 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red );
200 if ( horLayout ) 201 if ( horLayout )
201 ++xOff; 202 ++xOff;
202 else 203 else
203 ++yOff; 204 ++yOff;
204 } 205 }
205 if (mIncidence->recurrence()->doesRecur()) { 206 if (mIncidence->recurrence()->doesRecur()) {
206 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue ); 207 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue );
207 if ( horLayout ) 208 if ( horLayout )
208 ++xOff; 209 ++xOff;
209 else 210 else
210 ++yOff; 211 ++yOff;
211 } 212 }
212 if (mIncidence->description().length() > 0) { 213 if (mIncidence->description().length() > 0) {
213 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen ); 214 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen );
214 if ( horLayout ) 215 if ( horLayout )
215 ++xOff; 216 ++xOff;
216 else 217 else
217 ++yOff; 218 ++yOff;
218 } 219 }
219 if (mIncidence->isReadOnly()) { 220 if (mIncidence->isReadOnly()) {
220 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white ); 221 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white );
221 if ( horLayout ) 222 if ( horLayout )
222 ++xOff; 223 ++xOff;
223 else 224 else
224 ++yOff; 225 ++yOff;
225 } 226 }
226 227
227 if (mIncidence->attendeeCount()>0) { 228 if (mIncidence->attendeeCount()>0) {
228 229
229 if (mIncidence->organizer() == KOPrefs::instance()->email()) { 230 if (mIncidence->organizer() == KOPrefs::instance()->email()) {
230 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black ); 231 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black );
231 if ( horLayout ) 232 if ( horLayout )
232 ++xOff; 233 ++xOff;
233 else 234 else
234 ++yOff; 235 ++yOff;
235 } else { 236 } else {
236 Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); 237 Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
237 if (me!=0) { 238 if (me!=0) {
238 239
239 240
240 } else { 241 } else {
241 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow ); 242 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow );
242 if ( horLayout ) 243 if ( horLayout )
243 ++xOff; 244 ++xOff;
244 else 245 else
245 ++yOff; 246 ++yOff;
246 247
247 } 248 }
248 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow ); 249 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow );
249 if ( horLayout ) 250 if ( horLayout )
250 ++xOff; 251 ++xOff;
251 else 252 else
252 ++yOff; 253 ++yOff;
253 254
254 } 255 }
255 256
256 } 257 }
257 return ( yOff || xOff ); 258 return ( yOff || xOff );
258} 259}
259 260
260 261
261void KOAgendaItem::select(bool selected) 262void KOAgendaItem::select(bool selected)
262{ 263{
263 //qDebug("select %d %d",firstMultiItem(), nextMultiItem() ); 264 //qDebug("select %d %d",firstMultiItem(), nextMultiItem() );
264 if (mSelected == selected) return; 265 if (mSelected == selected) return;
265 mSelected = selected; 266 mSelected = selected;
266 if ( ! isVisible() ) 267 if ( ! isVisible() )
267 return; 268 return;
268 if ( firstMultiItem() ) 269 if ( firstMultiItem() )
269 firstMultiItem()->select( selected ); 270 firstMultiItem()->select( selected );
270 if ( !firstMultiItem() && nextMultiItem() ) { 271 if ( !firstMultiItem() && nextMultiItem() ) {
271 KOAgendaItem * placeItem = nextMultiItem(); 272 KOAgendaItem * placeItem = nextMultiItem();
272 while ( placeItem ) { 273 while ( placeItem ) {
273 placeItem->select( selected ); 274 placeItem->select( selected );
274 placeItem = placeItem->nextMultiItem(); 275 placeItem = placeItem->nextMultiItem();
275 } 276 }
276 } 277 }
277 globalFlagBlockAgendaItemUpdate = 0; 278 globalFlagBlockAgendaItemUpdate = 0;
278 paintMe( selected ); 279 paintMe( selected );
279 globalFlagBlockAgendaItemUpdate = 1; 280 globalFlagBlockAgendaItemUpdate = 1;
280 repaint( false ); 281 repaint( false );
281} 282}
282 283
283 284
284/* 285/*
285 The eventFilter has to filter the mouse events of the agenda item childs. The 286 The eventFilter has to filter the mouse events of the agenda item childs. The
286 events are fed into the event handling method of KOAgendaItem. This allows the 287 events are fed into the event handling method of KOAgendaItem. This allows the
287 KOAgenda to handle the KOAgendaItems by using an eventFilter. 288 KOAgenda to handle the KOAgendaItems by using an eventFilter.
288*/ 289*/
289bool KOAgendaItem::eventFilter ( QObject *object, QEvent *e ) 290bool KOAgendaItem::eventFilter ( QObject *object, QEvent *e )
290{ 291{
291 if (e->type() == QEvent::MouseButtonPress || 292 if (e->type() == QEvent::MouseButtonPress ||
292 e->type() == QEvent::MouseButtonDblClick || 293 e->type() == QEvent::MouseButtonDblClick ||
293 e->type() == QEvent::MouseButtonRelease || 294 e->type() == QEvent::MouseButtonRelease ||
294 e->type() == QEvent::MouseMove) { 295 e->type() == QEvent::MouseMove) {
295 QMouseEvent *me = (QMouseEvent *)e; 296 QMouseEvent *me = (QMouseEvent *)e;
296 QPoint itemPos = this->mapFromGlobal(((QWidget *)object)-> 297 QPoint itemPos = this->mapFromGlobal(((QWidget *)object)->
297 mapToGlobal(me->pos())); 298 mapToGlobal(me->pos()));
298 QMouseEvent returnEvent (e->type(),itemPos,me->button(),me->state()); 299 QMouseEvent returnEvent (e->type(),itemPos,me->button(),me->state());
299 return event(&returnEvent); 300 return event(&returnEvent);
300 } else { 301 } else {
301 return false; 302 return false;
302 } 303 }
303} 304}
304void KOAgendaItem::repaintMe( ) 305void KOAgendaItem::repaintMe( )
305{ 306{
306 paintMe ( mSelected ); 307 paintMe ( mSelected );
307} 308}
308void KOAgendaItem::paintMe( bool selected, QPainter* paint ) 309void KOAgendaItem::paintMe( bool selected, QPainter* paint )
309{ 310{
310 if ( globalFlagBlockAgendaItemUpdate && ! selected) 311 if ( globalFlagBlockAgendaItemUpdate && ! selected)
311 return; 312 return;
312 QPainter pa; 313 QPainter pa;
313 314
314 if ( mSelected ) { 315 if ( mSelected ) {
315 pa.begin( paintPixSel() ); 316 pa.begin( paintPixSel() );
316 } else { 317 } else {
317 if ( mAllDay ) 318 if ( mAllDay )
318 pa.begin( paintPixAllday() ); 319 pa.begin( paintPixAllday() );
319 else 320 else
320 pa.begin( paintPix() ); 321 pa.begin( paintPix() );
321 } 322 }
322 int x, yy, w, h; 323 int x, yy, w, h;
323 float nfh = 7.0; 324 float nfh = 7.0;
324 x = pos().x(); w = width(); h = height (); 325 x = pos().x(); w = width(); h = height ();
325 if ( mAllDay ) 326 if ( mAllDay )
326 yy = y(); 327 yy = y();
327 else 328 else
328 yy = mCellYTop * ( height() / cellHeight() ); 329 yy = mCellYTop * ( height() / cellHeight() );
329 xPaintCoord= x; 330 xPaintCoord= x;
330 yPaintCoord = yy; 331 yPaintCoord = yy;
331 wPaintCoord = width(); 332 wPaintCoord = width();
332 hPaintCoord = height(); 333 hPaintCoord = height();
333 //qDebug("paintMe %s %d %d %d %d",incidence()->summary().latin1(), x, yy, width(), height()); 334 //qDebug("paintMe %s %d %d %d %d",incidence()->summary().latin1(), x, yy, width(), height());
334 if ( paint == 0 ) 335 if ( paint == 0 )
335 paint = &pa; 336 paint = &pa;
336 bool horLayout = ( w < h ); 337 bool horLayout = ( w < h );
337 int maxhei = mFontPixelSize+4; 338 int maxhei = mFontPixelSize+4;
338 if ( horLayout ) 339 if ( horLayout )
339 maxhei += AGENDA_ICON_SIZE -4; 340 maxhei += AGENDA_ICON_SIZE -4;
340 bool small = ( h < maxhei ); 341 bool small = ( h < maxhei );
341 if ( ! small ) 342 if ( ! small )
342 paint->setFont(KOPrefs::instance()->mAgendaViewFont); 343 paint->setFont(KOPrefs::instance()->mAgendaViewFont);
343 else { 344 else {
344 QFont f = KOPrefs::instance()->mAgendaViewFont; 345 QFont f = KOPrefs::instance()->mAgendaViewFont;
345 f.setBold( false ); 346 f.setBold( false );
346 int fh = f.pointSize(); 347 int fh = f.pointSize();
347 nfh = (((float)height())/(float)(mFontPixelSize+4))*fh; 348 nfh = (((float)height())/(float)(mFontPixelSize+4))*fh;
348 if ( nfh < 6 ) 349 if ( nfh < 6 )
349 nfh = 6; 350 nfh = 6;
350 f.setPointSize( nfh ); 351 f.setPointSize( nfh );
351 paint->setFont(f); 352 paint->setFont(f);
352 } 353 }
353 paint->fillRect ( x, yy, w, h, mBackgroundColor ); 354 paint->fillRect ( x, yy, w, h, mBackgroundColor );
354 static const QPixmap completedPxmp = SmallIcon("greenhook16"); 355 static const QPixmap completedPxmp = SmallIcon("greenhook16");
355 static const QPixmap overduePxmp = SmallIcon("redcross16"); 356 static const QPixmap overduePxmp = SmallIcon("redcross16");
356 if ( mIncidence->type() == "Todo" ) { 357 if ( mIncidence->type() == "Todo" ) {
357 Todo* tempTodo = static_cast<Todo*>(mIncidence); 358 Todo* tempTodo = static_cast<Todo*>(mIncidence);
358 int xx = pos().x()+(width()-completedPxmp.width()-3 ); 359 int xx = pos().x()+(width()-completedPxmp.width()-3 );
359 int yyy = yy+3; 360 int yyy = yy+3;
360 if ( tempTodo->isCompleted() ) 361 if ( tempTodo->isCompleted() )
361 paint->drawPixmap ( xx, yyy, completedPxmp ); 362 paint->drawPixmap ( xx, yyy, completedPxmp );
362 else { 363 else {
363 paint->drawPixmap ( xx, yyy, overduePxmp ); 364 paint->drawPixmap ( xx, yyy, overduePxmp );
364 365
365 } 366 }
366 } 367 }
367 bool addIcon = false; 368 bool addIcon = false;
368 if ( ! small || w > 3 * h || h > 3* w ) 369 if ( ! small || w > 3 * h || h > 3* w )
369 addIcon = updateIcons( paint, horLayout ); 370 addIcon = updateIcons( paint, horLayout );
370 371
371 qDrawShadePanel (paint, x, yy, w, h, mColorGroup, selected , 2, 0); 372 qDrawShadePanel (paint, x, yy, w, h, mColorGroup, selected , 2, 0);
372 //qDebug("draw rect %d %d %d %d ",x, yy, w, h ); 373 //qDebug("draw rect %d %d %d %d ",x, yy, w, h );
373 if ( ! small ) { 374 if ( ! small ) {
374 x += 3; yy += 3;w -= 6; h-= 5; 375 x += 3; yy += 3;w -= 6; h-= 5;
375 } else { 376 } else {
376 x += 2; yy += 1;w -= 4; h-= 4; 377 x += 2; yy += 1;w -= 4; h-= 4;
377 if ( nfh < 6.01 ) { 378 if ( nfh < 6.01 ) {
378 yy -= 2; 379 yy -= 2;
379 h += 4; 380 h += 4;
380 } 381 }
381 else 382 else
382 if ( nfh < h -2 ) 383 if ( nfh < h -2 )
383 ++yy; 384 ++yy;
384 } 385 }
385 int align; 386 int align;
386#ifndef DESKTOP_VERSION 387#ifndef DESKTOP_VERSION
387 align = ( AlignLeft|WordBreak|AlignTop); 388 align = ( AlignLeft|WordBreak|AlignTop);
388#else 389#else
389 align = ( AlignLeft|BreakAnywhere|WordBreak|AlignTop); 390 align = ( AlignLeft|BreakAnywhere|WordBreak|AlignTop);
390#endif 391#endif
391 if ( addIcon ) { 392 if ( addIcon ) {
392 if ( ! horLayout ) { 393 if ( ! horLayout ) {
393 x += AGENDA_ICON_SIZE+3; 394 x += AGENDA_ICON_SIZE+3;