author | zautrix <zautrix> | 2005-02-01 23:46:24 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-01 23:46:24 (UTC) |
commit | 9ecfd0660e36b6b8dd7401f0edb16dd3d6f03289 (patch) (unidiff) | |
tree | d80eb20b97ab401b4e9e34f25b65030fb2c0b035 | |
parent | afa94abe147d23e09a14a81e47d04d4a3d5670c3 (diff) | |
download | kdepimpi-9ecfd0660e36b6b8dd7401f0edb16dd3d6f03289.zip kdepimpi-9ecfd0660e36b6b8dd7401f0edb16dd3d6f03289.tar.gz kdepimpi-9ecfd0660e36b6b8dd7401f0edb16dd3d6f03289.tar.bz2 |
text
-rw-r--r-- | bin/kdepim/korganizer/featuresKOPI.txt | 39 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 11 |
2 files changed, 41 insertions, 9 deletions
diff --git a/bin/kdepim/korganizer/featuresKOPI.txt b/bin/kdepim/korganizer/featuresKOPI.txt index ab6b224..052680e 100644 --- a/bin/kdepim/korganizer/featuresKOPI.txt +++ b/bin/kdepim/korganizer/featuresKOPI.txt | |||
@@ -1,211 +1,244 @@ | |||
1 | Features of KO/Pi and hints for usage of KO/Pi | 1 | Features of KO/Pi and hints for usage of KO/Pi |
2 | (www.pi-sync.net) | 2 | (www.pi-sync.net) |
3 | 3 | ||
4 | A) General features | 4 | A) General features |
5 | 0) Main features | 5 | 0) Main features |
6 | 1) Import - export - connection - syncing | 6 | 1) Import - export - connection - syncing |
7 | 2) Filter | 7 | 2) Filter |
8 | 3) Managing categories: | 8 | 3) Managing categories: |
9 | 4) Cancelling of items: | 9 | 4) Cancelling of items: |
10 | 5) Addressbook access: | 10 | 5) Addressbook access: |
11 | 6) Quick editing: | 11 | 6) Quick editing: |
12 | 7) Fast navigation: | 12 | 7) Fast navigation: |
13 | 8) Printing: | 13 | 8) Printing: |
14 | 9) Configuration: | 14 | 9) Configuration: |
15 | 10) Language: | 15 | 10) Language: |
16 | 11) Alarm: | 16 | 11) Alarm: |
17 | 12) What'sThis Help: | 17 | 12) What'sThis Help: |
18 | 18 | ||
19 | B) Useful features, that are not straighforward to see | 19 | B) Useful features, that are not straighforward to see |
20 | 1) Right mouse click on Zaurus | 20 | 1) Right mouse click on Zaurus |
21 | 2) Moving of items in the agenda view | 21 | 2) Moving of items in the agenda view |
22 | 3) Creating exceptions for recurring events | 22 | 3) Creating exceptions for recurring events |
23 | 4) Accessing the week in agenda view from the Month view | 23 | 4) Accessing the week in agenda view from the Month view |
24 | 5) Navigation in month view | 24 | 5) Navigation in month view |
25 | 6) Navigation in agenda view | 25 | 6) Navigation in agenda view |
26 | 26 | ||
27 | 27 | ||
28 | ****************************************************** | 28 | ****************************************************** |
29 | A) General features | 29 | A) General features |
30 | ****************************************************** | 30 | ****************************************************** |
31 | Features of KO/Pi 1.9.12: | 31 | Features of KO/Pi 1.9.12: |
32 | 0) | 32 | 0) |
33 | Main features: | 33 | Main features: |
34 | KO/Pi makes synchronizing your data easy! | 34 | KO/Pi makes synchronizing your data easy! |
35 | Details in 1) and the sync HowTos. | 35 | Details in 1) and the sync HowTos. |
36 | With KO/Pi you can manage your events/todos/journals. | 36 | With KO/Pi you can manage your events/todos/journals. |
37 | Todos may have subtodos. | 37 | Todos may have subtodos. |
38 | A subtodo can be changed to a parent root todo. | 38 | A subtodo can be changed to a parent root todo. |
39 | A (sub)todo can be reparented to make it a subtodo of another todo. | 39 | A (sub)todo can be reparented to make it a subtodo of another todo. |
40 | KO/Pi has a monthview, a What's Next view, an event list view, a small and big todo-view and an agenda view to display 1-42 days. | 40 | KO/Pi has a monthview, a What's Next view, an event list view, a small and big todo-view and an agenda view to display 1-42 days. |
41 | KO/Pi is Qt-only based and runs on Sharp Zaurus PDA, Linux and Windows. | 41 | KO/Pi is Qt-only based and runs on Sharp Zaurus PDA, Linux and Windows. |
42 | 1) | 42 | 1) |
43 | Import - export - connection - syncing: | 43 | Import - export - connection - syncing: |
44 | KO/Pi on Windows can import calendar data easyly from Outlook directly via OLE. | 44 | KO/Pi on Windows can import calendar data easyly from Outlook directly via OLE. |
45 | Recurring events with exceptions and attendee lists of meetings are imported properly. | 45 | Recurring events with exceptions and attendee lists of meetings are imported properly. |
46 | KO/Pi can import/export ics and vcs files. | 46 | KO/Pi can import/export ics and vcs files. |
47 | KO/Pi can save/load ics backup files. | 47 | KO/Pi can save/load ics backup files. |
48 | KO/Pi can send ics and vcs files via infrared, with and without timezone settings.( Zaurus only ) | 48 | KO/Pi can send ics and vcs files via infrared, with and without timezone settings.( Zaurus only ) |
49 | KO/Pi can receive files via infrared directly, after beam receive is enabled.( Zaurus only ) | 49 | KO/Pi can receive files via infrared directly, after beam receive is enabled.( Zaurus only ) |
50 | Via the search function you can send any number/selection of events/tasks/journal via infrared. | 50 | Via the search function you can send any number/selection of events/tasks/journal via infrared. |
51 | Via the search function you can export and save any number/selection of events/tasks/journal to an ics file. | 51 | Via the search function you can export and save any number/selection of events/tasks/journal to an ics file. |
52 | Via the search function you can export and save any number/selection of journals and descriptions of events/todos to a plain text file. | 52 | Via the search function you can export and save any number/selection of journals and descriptions of events/todos to a plain text file. |
53 | KO/Pi can import xml calendar/todo data from Opie/old Qtopia environment. | 53 | KO/Pi can import xml calendar/todo data from Opie/old Qtopia environment. |
54 | KO/Pi can sync calendar/todo data with new Sharp Rom DTM model PIM applications, found on Zaurus 7x0/860 and Sharp Rom 3.1 (and above) for 5x00 series. | 54 | KO/Pi can sync calendar/todo data with new Sharp Rom DTM model PIM applications, found on Zaurus 7x0/860 and Sharp Rom 3.1 (and above) for 5x00 series. |
55 | (Hint: Rename /home/QtPalmtop/bin/datebook to e.g. /home/QtPalmtop/bin/datebookwech | 55 | (Hint: Rename /home/QtPalmtop/bin/datebook to e.g. /home/QtPalmtop/bin/datebookwech |
56 | to prevent alarm notification by the Sharp calendar app) | 56 | to prevent alarm notification by the Sharp calendar app) |
57 | KO/Pi can sync calendar/todo/journal data with any local ics file. | 57 | KO/Pi can sync calendar/todo/journal data with any local ics file. |
58 | In KO/Pi you can create a specific profile for each device to sync with. | 58 | In KO/Pi you can create a specific profile for each device to sync with. |
59 | KO/Pi can automatically down/upload a remote ics file to a temp file via user specified system command (e.g. ssh/scp, ftp, ...) to sync with. | 59 | KO/Pi can automatically down/upload a remote ics file to a temp file via user specified system command (e.g. ssh/scp, ftp, ...) to sync with. |
60 | KO/Pi can ask you, if a conflict while syncing is detected and displays a detailed view of both events/todos. | 60 | KO/Pi can ask you, if a conflict while syncing is detected and displays a detailed view of both events/todos. |
61 | Multiple sync with many profiles at once is supported. Read "Multi Sync HowTo". | 61 | Multiple sync with many profiles at once is supported. Read "Multi Sync HowTo". |
62 | KO/Pi can sync after an easy and quick setup via network in the "Pi-Sync" mode with another running instance of KO/Pi with "Pi-Sync" enabled. | 62 | KO/Pi can sync after an easy and quick setup via network in the "Pi-Sync" mode with another running instance of KO/Pi with "Pi-Sync" enabled. |
63 | KO/Pi on Linux can sync with KDE calendar data. | 63 | KO/Pi on Linux can sync with KDE calendar data. |
64 | KO/Pi on the Zaurus can sync with KDE calendar data on desktop via Pi-Sync. Read "KDE-Sync HowTo". | 64 | KO/Pi on the Zaurus can sync with KDE calendar data on desktop via Pi-Sync. Read "KDE-Sync HowTo". |
65 | KO/Pi can sync and export data to mobile phones. Supported models are depending of the used lib, libgammu. | 65 | KO/Pi can sync and export data to mobile phones. Supported models are depending of the used lib, libgammu. |
66 | If KO/Pi detects that the saved file on disk has changed,(e.g. a remote sync from somewhere has happened), | 66 | If KO/Pi detects that the saved file on disk has changed,(e.g. a remote sync from somewhere has happened), |
67 | it asks you, if you want to overwrite the file or if you want to sync with the file. Such that no data is lost. | 67 | it asks you, if you want to overwrite the file or if you want to sync with the file. Such that no data is lost. |
68 | KO/Pi can save/load templates for events/todos. | 68 | KO/Pi can save/load templates for events/todos. |
69 | 2) | 69 | 2) |
70 | Filter: | 70 | Filter: |
71 | You can define filters for displaying/not displaying specified categories. | 71 | You can define filters for displaying/not displaying specified categories. |
72 | Quick access to the first 20 filters via hotkeys 1-0 and <ctrl>1-0 | 72 | Quick access to the first 20 filters via hotkeys 1-0 and <ctrl>1-0 |
73 | 3) | 73 | 3) |
74 | Managing categories: | 74 | Managing categories: |
75 | After importing/loading/syncing there may be new categories in events or todos which are not in the category list. | 75 | After importing/loading/syncing there may be new categories in events or todos which are not in the category list. |
76 | You can choose what to do with these categories: | 76 | You can choose what to do with these categories: |
77 | -Add to category list | 77 | -Add to category list |
78 | -Or remove them from events/todos | 78 | -Or remove them from events/todos |
79 | In the list view/search dialog you can quickly assign categories to all selected items. | 79 | In the list view/search dialog you can quickly assign categories to all selected items. |
80 | You can choose | 80 | You can choose |
81 | -to add a selection of categories to the list of categories | 81 | -to add a selection of categories to the list of categories |
82 | -to set a selection of categories as the new list of categories | 82 | -to set a selection of categories as the new list of categories |
83 | You can specify a color to every categorie. | 83 | You can specify a color to every categorie. |
84 | The events/tasks of this categorie are displayed with this color in the agenda view. | 84 | The events/tasks of this categorie are displayed with this color in the agenda view. |
85 | You can configure, if the events/tasks categorie color is shown in todo view/month view as well. | 85 | You can configure, if the events/tasks categorie color is shown in todo view/month view as well. |
86 | 4) | 86 | 4) |
87 | Cancelling of items: | 87 | Cancelling of items: |
88 | You can cancel an event/todo without deleting them. | 88 | You can cancel an event/todo without deleting them. |
89 | The cancelled event/todo is then displayed stricked out. | 89 | The cancelled event/todo is then displayed stricked out. |
90 | 5) | 90 | 5) |
91 | Addressbook access: | 91 | Addressbook access: |
92 | You can access address entries stored in KA/Pi. | 92 | You can access address entries stored in KA/Pi. |
93 | You cam import birtdays from KA/Pi. | 93 | You cam import birtdays from KA/Pi. |
94 | In KA/Pi you can configure a new resource to get read-only acces to Opie addressbook data. | 94 | In KA/Pi you can configure a new resource to get read-only acces to Opie addressbook data. |
95 | 6) | 95 | 6) |
96 | Quick editing: | 96 | Quick editing: |
97 | You can quickly clone, move, cancel, beam events/todos. | 97 | You can quickly clone, move, cancel, beam events/todos. |
98 | When dragging a recurrent event in agenda view, this recurrence is automatically added to the list of recurrence exceptions and a non-recurring clone is created. | 98 | When dragging a recurrent event in agenda view, this recurrence is automatically added to the list of recurrence exceptions and a non-recurring clone is created. |
99 | If you click on a day number in month view, a new edit event dialog pops up. | 99 | If you click on a day number in month view, a new edit event dialog pops up. |
100 | 7) | 100 | 7) |
101 | Fast navigation: | 101 | Fast navigation: |
102 | There are many shortcuts for fast changing the view. Please refer to shortcut-key description. | 102 | There are many shortcuts for fast changing the view. Please refer to shortcut-key description. |
103 | If you click on the week number in month view, this week is shown in agenda view. | 103 | If you click on the week number in month view, this week is shown in agenda view. |
104 | 8) | 104 | 8) |
105 | Printing: | 105 | Printing: |
106 | On the desktop version, you can print out a vertical range of the agenda view "as you see it". | 106 | On the desktop version, you can print out a vertical range of the agenda view "as you see it". |
107 | And you can print on the desktop version a day view, three kinds of a week view and a month view. | 107 | And you can print on the desktop version a day view, three kinds of a week view and a month view. |
108 | You can print the todo list as well. | 108 | You can print the todo list as well. |
109 | 9) | 109 | 9) |
110 | Configuration: | 110 | Configuration: |
111 | There are many advanced configuration possibilities. | 111 | There are many advanced configuration possibilities. |
112 | You can configure for every item in the toolbar, whether it should be shown or not. | 112 | You can configure for every item in the toolbar, whether it should be shown or not. |
113 | There are two item sizes for toolbar icons available. (Useful for 5x00 user and small display). | 113 | There are two item sizes for toolbar icons available. (Useful for 5x00 user and small display). |
114 | You can configure the font/fontsize for every view. | 114 | You can configure the font/fontsize for every view. |
115 | 10) | 115 | 10) |
116 | Language: | 116 | Language: |
117 | KO/Pi is available in English, German, French and Italian. | 117 | KO/Pi is available in English, German, French and Italian. |
118 | 11) | 118 | 11) |
119 | Alarm: | 119 | Alarm: |
120 | For Zaurus there is an alarm applet available with additional timer functionality. | 120 | For Zaurus there is an alarm applet available with additional timer functionality. |
121 | This alarm applet will make the Zaurus wake up, if the device is in suspend mode. | 121 | This alarm applet will make the Zaurus wake up, if the device is in suspend mode. |
122 | On the desktop (e.g. Windows) you can enable in KO/Pi the internal alarm notification, | 122 | On the desktop (e.g. Windows) you can enable in KO/Pi the internal alarm notification, |
123 | such that you are informed about an alarm, if the program is running. | 123 | such that you are informed about an alarm, if the program is running. |
124 | 12) | 124 | 12) |
125 | What'sThis Help: | 125 | What'sThis Help: |
126 | To use the What'sThis Help, you have to enable the What'sThis icon in the toolbar. | 126 | To use the What'sThis Help, you have to enable the What'sThis icon in the toolbar. |
127 | (Choose menu: ME-Toolbar or Action-Configure Toolbar ). | 127 | (Choose menu: ME-Toolbar or Action-Configure Toolbar ). |
128 | (You have to restart to reload the changed toolbar config). | 128 | (You have to restart to reload the changed toolbar config). |
129 | Now click on the QWhat'sThis Icon | 129 | Now click on the QWhat'sThis Icon |
130 | in the top right corner of KO/Pi. | 130 | in the top right corner of KO/Pi. |
131 | Then click now after that on an item in the Agenda View or in the month view | 131 | Then click now after that on an item in the Agenda View or in the month view |
132 | you will get a detailed display of the items content. | 132 | you will get a detailed display of the items content. |
133 | 133 | ||
134 | 134 | ||
135 | 135 | ||
136 | ****************************************************** | 136 | ****************************************************** |
137 | B) Useful features, that are not straighforward to see | 137 | B) Useful features, that are not straighforward to see |
138 | ****************************************************** | 138 | ****************************************************** |
139 | 139 | ||
140 | 1) Right mouse click on Zaurus | 140 | 1) Right mouse click on Zaurus |
141 | 2) Moving of items in the agenda view | 141 | 2) Moving of items in the agenda view |
142 | 3) Creating exceptions for recurring events | 142 | 3) Creating exceptions for recurring events |
143 | 4) Accessing the week in agenda view from the Month view | 143 | 4) Accessing the week in agenda view from the Month view |
144 | 5) Navigation in month view | 144 | 5) Navigation in month view |
145 | 6) Navigation in agenda view | 145 | 6) Navigation in agenda view |
146 | 7) Monthview as week view | ||
147 | 8) Switching display mode in date edit | ||
146 | 148 | ||
147 | 1) | 149 | 1) |
148 | Right mouse click on Zaurus: | 150 | Right mouse click on Zaurus: |
149 | In KO/Pi on the desktop a right mouse click will popup an menu on some items. | 151 | In KO/Pi on the desktop a right mouse click will popup an menu on some items. |
150 | On the Zaurus there can only the stylus be used. | 152 | On the Zaurus there can only the stylus be used. |
151 | To simulte a right mouse click with the stylus press is and hold it down | 153 | To simulte a right mouse click with the stylus press is and hold it down |
152 | for 1-2 seconds. If you release it then, a menu pops up, if there is | 154 | for 1-2 seconds. If you release it then, a menu pops up, if there is |
153 | a menu available for this particular item. | 155 | a menu available for this particular item. |
154 | On some places the menu pops up without releasing the stylus. | 156 | On some places the menu pops up without releasing the stylus. |
155 | That bevaviour is not a bug, it is caused by the the behaviour of the | 157 | That bevaviour is not a bug, it is caused by the the behaviour of the |
156 | single left click on the item. | 158 | single left click on the item. |
159 | |||
157 | 2) | 160 | 2) |
158 | Moving of items in the agenda view: | 161 | Moving of items in the agenda view: |
159 | In the aganda view you can move an item by clicking on it and holding | 162 | In the agenda view you can move an item by clicking on it and holding |
160 | the mouse down. | 163 | the mouse down. |
161 | You have to move the mouse some distance before the items actually | 164 | You have to move the mouse some distance before the items actually |
162 | starts to move. That is not abug, that is a feature to prevent | 165 | starts to move. That is not abug, that is a feature to prevent |
163 | you to make unwanted moves of the item when you click on it(and moving the | 166 | you to make unwanted moves of the item when you click on it(and moving the |
164 | mouse only a small distance with this click) | 167 | mouse only a small distance with this click) |
168 | |||
165 | 3) | 169 | 3) |
166 | Creating exceptions for recurring events: | 170 | Creating exceptions for recurring events: |
167 | To create an exception for a recurring event, | 171 | To create an exception for a recurring event, |
168 | move this event in the agenda view. | 172 | move this event in the agenda view. |
169 | This recurrence is automatically added to the list | 173 | This recurrence is automatically added to the list |
170 | of recurrence exceptions and a non-recurring clone is created. | 174 | of recurrence exceptions and a non-recurring clone is created. |
171 | To cancel a recurrence, create an exception by moving it | 175 | To cancel a single recurrence, create an exception by moving it |
172 | and then move it back and cancel it. | 176 | and then move it back and cancel it. |
177 | |||
173 | 4) | 178 | 4) |
174 | Accessing the week in agenda view from the month view: | 179 | Accessing the week in agenda view from the month view: |
175 | In the month view there are on the left week numbers displayed. | 180 | In the month view there are on the left week numbers displayed. |
176 | Click on a week number to see this week in the agenda view. | 181 | Click on a week number to see this week in the agenda view. |
182 | |||
177 | 5) | 183 | 5) |
178 | Navigation in month view: | 184 | Navigation in month view: |
179 | If you select the month view with the icon in the toolbar, | 185 | If you select the month view with the icon in the toolbar, |
180 | the selected data range in the date navigator | 186 | the selected data range in the date navigator |
181 | is set automatically to the complete month. | 187 | is set automatically to the complete month. |
182 | (Click on month view and then the space bar to see the | 188 | (Click on month view and then the space bar to see the |
183 | selected data range in the date navigator). | 189 | selected data range in the date navigator). |
184 | If you select in the data navigator | 190 | If you select in the data navigator |
185 | (automatically by clicking on the month view or manually) | 191 | (automatically by clicking on the month view or manually) |
186 | a date range from the first of the month to the | 192 | a date range from the first of the month to the |
187 | 28.-31. of the month (the 28.-31. is valid for every month!) | 193 | 28.-31. of the month (the 28.-31. is valid for every month!) |
188 | then the (month-)navigation keys will select automatically the | 194 | then the (month-)navigation keys will select automatically the |
189 | complete next month as date range. | 195 | complete next month as date range. |
196 | |||
190 | 6) | 197 | 6) |
191 | Navigation in agenda view: | 198 | Navigation in agenda view: |
192 | If you select (as an example) 4 days in the date navigator | 199 | If you select (as an example) 4 days in the date navigator |
193 | the (week-) navigation key will select the same 4 days in the next week. | 200 | the (week-) navigation key will select the same 4 days in the next week. |
194 | If you want to get the next 4 days after the selected 4 days selected, | 201 | If you want to get the next 4 days after the selected 4 days selected, |
195 | you have to switch the navigation mode to "next days mode" | 202 | you have to switch the navigation mode to "next days mode" |
196 | by clicking on the next days icons. | 203 | by clicking on the next days icons. |
197 | Now the next days from today are selected, but after selecting | 204 | Now the next days from today are selected, but after selecting |
198 | 4 days in the day navigator the (week-) navigation key | 205 | 4 days in the day navigator the (week-) navigation key |
199 | will select the next 4 days. | 206 | will select the next 4 days. |
200 | The "next days mode" is turned off by clicking on the | 207 | The "next days mode" is turned off by clicking on the |
201 | week view, work week view or day view button. | 208 | week view, work week view or day view button. |
202 | The agenda view has "time labels" on the left, which displays the hours from 0-24. | 209 | The agenda view has "time labels" on the left, which displays the hours from 0-24. |
203 | If you press the mouse on the timelabels and move it up/down you can | 210 | If you press the mouse on the timelabels and move it up/down you can |
204 | increase/decrease the agenda size quickly. | 211 | increase/decrease the agenda size quickly. |
212 | In the agenda view you can click on the day labels (e.g. Mon 14) | ||
213 | to see the selected date in single day mode. | ||
214 | If you click in single day mode the day label you will switch back to | ||
215 | the previously selected date range. | ||
216 | Right of the day labels is a ">" button. | ||
217 | If you click this button, you will go one day ahead. | ||
218 | Left of the day labels is the month name displayed. | ||
219 | If you click this button, the month view is shown. | ||
220 | |||
221 | 7) | ||
222 | Monthview as week view: | ||
223 | On the left side of the monthview are the week number labels displayed. | ||
224 | On top of these labels is a "W" displayed. | ||
225 | If you click on this button the month view mode will switch to week view mode. | ||
226 | To switch back, please click the button, which now displays a "M". | ||
227 | |||
228 | 8) | ||
229 | Switching display mode in date edit: | ||
230 | On several places is a date edit used. | ||
231 | You can scroll the dates by selecting the part of the date (month, day, year) | ||
232 | in the lineedit and pressing the key up/key down key. | ||
233 | The display mode of a date edit is initially short date mode. | ||
234 | (I.e. weekday names are not displayed) | ||
235 | If you doubleclick in the lineedit the mode switches to long date mode. | ||
236 | Now the weekday names are displayed for better overview. | ||
237 | To switch back simply doubleclick again in the line edit. | ||
205 | 238 | ||
206 | 239 | ||
207 | 240 | ||
208 | 241 | ||
209 | 242 | ||
210 | 243 | ||
211 | 244 | ||
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 9888566..6294b98 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -501,858 +501,857 @@ void MonthViewCell::insertEvent(Event *event) | |||
501 | 501 | ||
502 | } else { | 502 | } else { |
503 | if (cat.isEmpty()) { | 503 | if (cat.isEmpty()) { |
504 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 504 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
505 | } else { | 505 | } else { |
506 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 506 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
507 | } | 507 | } |
508 | } | 508 | } |
509 | 509 | ||
510 | } else { | 510 | } else { |
511 | pal = mStandardPalette ; | 511 | pal = mStandardPalette ; |
512 | } | 512 | } |
513 | item->setPalette( pal ); | 513 | item->setPalette( pal ); |
514 | item->setRecur( event->recurrence()->doesRecur() ); | 514 | item->setRecur( event->recurrence()->doesRecur() ); |
515 | item->setAlarm( event->isAlarmEnabled() ); | 515 | item->setAlarm( event->isAlarmEnabled() ); |
516 | item->setMoreInfo( event->description().length() > 0 ); | 516 | item->setMoreInfo( event->description().length() > 0 ); |
517 | #ifdef DESKTOP_VERSION | 517 | #ifdef DESKTOP_VERSION |
518 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, | 518 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, |
519 | KOPrefs::instance()->email()); | 519 | KOPrefs::instance()->email()); |
520 | if ( me != 0 ) { | 520 | if ( me != 0 ) { |
521 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) | 521 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) |
522 | item->setReply(true); | 522 | item->setReply(true); |
523 | else | 523 | else |
524 | item->setReply(false); | 524 | item->setReply(false); |
525 | } else | 525 | } else |
526 | item->setReply(false); | 526 | item->setReply(false); |
527 | #endif | 527 | #endif |
528 | mItemList->insertItem( item ); | 528 | mItemList->insertItem( item ); |
529 | mToolTip += "\n"; | 529 | mToolTip += "\n"; |
530 | } | 530 | } |
531 | void MonthViewCell::insertTodo(Todo *todo) | 531 | void MonthViewCell::insertTodo(Todo *todo) |
532 | { | 532 | { |
533 | QString text; | 533 | QString text; |
534 | if (todo->hasDueDate()) { | 534 | if (todo->hasDueDate()) { |
535 | if (!todo->doesFloat()) { | 535 | if (!todo->doesFloat()) { |
536 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); | 536 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); |
537 | text += " "; | 537 | text += " "; |
538 | } | 538 | } |
539 | } | 539 | } |
540 | text += i18n("To-Do: %1").arg(todo->summary()); | 540 | text += i18n("To-Do: %1").arg(todo->summary()); |
541 | 541 | ||
542 | MonthViewItem *item = new MonthViewItem( todo, mDate, text ); | 542 | MonthViewItem *item = new MonthViewItem( todo, mDate, text ); |
543 | //item->setPalette( mStandardPalette ); | 543 | //item->setPalette( mStandardPalette ); |
544 | QPalette pal; | 544 | QPalette pal; |
545 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 545 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
546 | QStringList categories = todo->categories(); | 546 | QStringList categories = todo->categories(); |
547 | QString cat = categories.first(); | 547 | QString cat = categories.first(); |
548 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 548 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
549 | pal = getPalette(); | 549 | pal = getPalette(); |
550 | if (cat.isEmpty()) { | 550 | if (cat.isEmpty()) { |
551 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 551 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
552 | } else { | 552 | } else { |
553 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 553 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
554 | } | 554 | } |
555 | 555 | ||
556 | } else { | 556 | } else { |
557 | if (cat.isEmpty()) { | 557 | if (cat.isEmpty()) { |
558 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 558 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
559 | } else { | 559 | } else { |
560 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 560 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
561 | } | 561 | } |
562 | } | 562 | } |
563 | 563 | ||
564 | } else { | 564 | } else { |
565 | pal = mStandardPalette ; | 565 | pal = mStandardPalette ; |
566 | } | 566 | } |
567 | item->setPalette( pal ); | 567 | item->setPalette( pal ); |
568 | mItemList->insertItem( item ); | 568 | mItemList->insertItem( item ); |
569 | mToolTip += text+"\n"; | 569 | mToolTip += text+"\n"; |
570 | } | 570 | } |
571 | void MonthViewCell::finishUpdateCell() | 571 | void MonthViewCell::finishUpdateCell() |
572 | { | 572 | { |
573 | #ifdef DESKTOP_VERSION | 573 | #ifdef DESKTOP_VERSION |
574 | if (mToolTip != "") | 574 | if (mToolTip != "") |
575 | QToolTip::add(this,mToolTip,toolTipGroup(),""); | 575 | QToolTip::add(this,mToolTip,toolTipGroup(),""); |
576 | #endif | 576 | #endif |
577 | mItemList->sort(); | 577 | mItemList->sort(); |
578 | //setMyPalette(); | 578 | //setMyPalette(); |
579 | setMyPalette(); | 579 | setMyPalette(); |
580 | QString text; | 580 | QString text; |
581 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; | 581 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; |
582 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { | 582 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { |
583 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; | 583 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; |
584 | mLabel->resize( mLabelBigSize ); | 584 | mLabel->resize( mLabelBigSize ); |
585 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 585 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
586 | } else { | 586 | } else { |
587 | mLabel->resize( mLabelSize ); | 587 | mLabel->resize( mLabelSize ); |
588 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 588 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
589 | } | 589 | } |
590 | 590 | ||
591 | mLabel->setText( text ); | 591 | mLabel->setText( text ); |
592 | resizeEvent( 0 ); | 592 | resizeEvent( 0 ); |
593 | } | 593 | } |
594 | void MonthViewCell::updateCell() | 594 | void MonthViewCell::updateCell() |
595 | { | 595 | { |
596 | if ( !mMonthView->isUpdatePossible() ) | 596 | if ( !mMonthView->isUpdatePossible() ) |
597 | return; | 597 | return; |
598 | startUpdateCell(); | 598 | startUpdateCell(); |
599 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 599 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
600 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); | 600 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); |
601 | Event *event; | 601 | Event *event; |
602 | for( event = events.first(); event; event = events.next() ) { // for event | 602 | for( event = events.first(); event; event = events.next() ) { // for event |
603 | insertEvent(event); | 603 | insertEvent(event); |
604 | } | 604 | } |
605 | // insert due todos | 605 | // insert due todos |
606 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); | 606 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); |
607 | Todo *todo; | 607 | Todo *todo; |
608 | for(todo = todos.first(); todo; todo = todos.next()) { | 608 | for(todo = todos.first(); todo; todo = todos.next()) { |
609 | insertTodo( todo ); | 609 | insertTodo( todo ); |
610 | } | 610 | } |
611 | finishUpdateCell(); | 611 | finishUpdateCell(); |
612 | // if ( isVisible()) | 612 | // if ( isVisible()) |
613 | //qApp->processEvents(); | 613 | //qApp->processEvents(); |
614 | } | 614 | } |
615 | 615 | ||
616 | void MonthViewCell::updateConfig() | 616 | void MonthViewCell::updateConfig() |
617 | { | 617 | { |
618 | setFont( KOPrefs::instance()->mMonthViewFont ); | 618 | setFont( KOPrefs::instance()->mMonthViewFont ); |
619 | 619 | ||
620 | QFontMetrics fm( font() ); | 620 | QFontMetrics fm( font() ); |
621 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); | 621 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); |
622 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); | 622 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); |
623 | mHolidayPalette = mStandardPalette; | 623 | mHolidayPalette = mStandardPalette; |
624 | mPrimaryPalette = mStandardPalette; | 624 | mPrimaryPalette = mStandardPalette; |
625 | mNonPrimaryPalette = mStandardPalette; | 625 | mNonPrimaryPalette = mStandardPalette; |
626 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { | 626 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { |
627 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); | 627 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); |
628 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); | 628 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); |
629 | mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); | 629 | mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); |
630 | mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); | 630 | mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); |
631 | mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); | 631 | mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); |
632 | mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); | 632 | mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); |
633 | mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); | 633 | mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); |
634 | mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); | 634 | mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); |
635 | mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); | 635 | mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); |
636 | } | 636 | } |
637 | //updateCell(); | 637 | //updateCell(); |
638 | } | 638 | } |
639 | 639 | ||
640 | void MonthViewCell::enableScrollBars( bool enabled ) | 640 | void MonthViewCell::enableScrollBars( bool enabled ) |
641 | { | 641 | { |
642 | if ( enabled ) { | 642 | if ( enabled ) { |
643 | mItemList->setVScrollBarMode(QScrollView::Auto); | 643 | mItemList->setVScrollBarMode(QScrollView::Auto); |
644 | mItemList->setHScrollBarMode(QScrollView::Auto); | 644 | mItemList->setHScrollBarMode(QScrollView::Auto); |
645 | } else { | 645 | } else { |
646 | mItemList->setVScrollBarMode(QScrollView::AlwaysOff); | 646 | mItemList->setVScrollBarMode(QScrollView::AlwaysOff); |
647 | mItemList->setHScrollBarMode(QScrollView::AlwaysOff); | 647 | mItemList->setHScrollBarMode(QScrollView::AlwaysOff); |
648 | } | 648 | } |
649 | } | 649 | } |
650 | 650 | ||
651 | Incidence *MonthViewCell::selectedIncidence() | 651 | Incidence *MonthViewCell::selectedIncidence() |
652 | { | 652 | { |
653 | int index = mItemList->currentItem(); | 653 | int index = mItemList->currentItem(); |
654 | if ( index < 0 ) return 0; | 654 | if ( index < 0 ) return 0; |
655 | 655 | ||
656 | MonthViewItem *item = | 656 | MonthViewItem *item = |
657 | static_cast<MonthViewItem *>( mItemList->item( index ) ); | 657 | static_cast<MonthViewItem *>( mItemList->item( index ) ); |
658 | 658 | ||
659 | if ( !item ) return 0; | 659 | if ( !item ) return 0; |
660 | 660 | ||
661 | return item->incidence(); | 661 | return item->incidence(); |
662 | } | 662 | } |
663 | 663 | ||
664 | QDate MonthViewCell::selectedIncidenceDate() | 664 | QDate MonthViewCell::selectedIncidenceDate() |
665 | { | 665 | { |
666 | QDate qd; | 666 | QDate qd; |
667 | int index = mItemList->currentItem(); | 667 | int index = mItemList->currentItem(); |
668 | if ( index < 0 ) return qd; | 668 | if ( index < 0 ) return qd; |
669 | 669 | ||
670 | MonthViewItem *item = | 670 | MonthViewItem *item = |
671 | static_cast<MonthViewItem *>( mItemList->item( index ) ); | 671 | static_cast<MonthViewItem *>( mItemList->item( index ) ); |
672 | 672 | ||
673 | if ( !item ) return qd; | 673 | if ( !item ) return qd; |
674 | 674 | ||
675 | return item->incidenceDate(); | 675 | return item->incidenceDate(); |
676 | } | 676 | } |
677 | 677 | ||
678 | void MonthViewCell::deselect() | 678 | void MonthViewCell::deselect() |
679 | { | 679 | { |
680 | mItemList->clearSelection(); | 680 | mItemList->clearSelection(); |
681 | enableScrollBars( false ); | 681 | enableScrollBars( false ); |
682 | // updateCell(); | 682 | // updateCell(); |
683 | } | 683 | } |
684 | void MonthViewCell::select() | 684 | void MonthViewCell::select() |
685 | { | 685 | { |
686 | ;// updateCell(); | 686 | ;// updateCell(); |
687 | } | 687 | } |
688 | 688 | ||
689 | void MonthViewCell::resizeEvent ( QResizeEvent * ) | 689 | void MonthViewCell::resizeEvent ( QResizeEvent * ) |
690 | { | 690 | { |
691 | if ( !mMonthView->isUpdatePossible() ) | 691 | if ( !mMonthView->isUpdatePossible() ) |
692 | return; | 692 | return; |
693 | #ifndef DESKTOP_VERSION | 693 | |
694 | if ( !isVisible() ){ | ||
695 | return; | ||
696 | } | ||
697 | #endif | ||
698 | int size = height() - mLabel->height() - 2; | 694 | int size = height() - mLabel->height() - 2; |
699 | if ( size > 0 ) | 695 | if ( size > 0 ) |
700 | mItemList->verticalScrollBar()->setMaximumHeight( size ); | 696 | mItemList->verticalScrollBar()->setMaximumHeight( size ); |
701 | size = width() - mLabel->width() -2; | 697 | size = width() - mLabel->width() -2; |
702 | if ( size > 0 ) | 698 | if ( size > 0 ) |
703 | mItemList->horizontalScrollBar()->setMaximumWidth( size ); | 699 | mItemList->horizontalScrollBar()->setMaximumWidth( size ); |
704 | mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() ); | 700 | mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() ); |
705 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 701 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
706 | } | 702 | } |
707 | 703 | ||
708 | void MonthViewCell::defaultAction( QListBoxItem *item ) | 704 | void MonthViewCell::defaultAction( QListBoxItem *item ) |
709 | { | 705 | { |
710 | if ( !item ) return; | 706 | if ( !item ) return; |
711 | 707 | ||
712 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); | 708 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); |
713 | Incidence *incidence = eventItem->incidence(); | 709 | Incidence *incidence = eventItem->incidence(); |
714 | if ( incidence ) mMonthView->defaultAction( incidence ); | 710 | if ( incidence ) mMonthView->defaultAction( incidence ); |
715 | } | 711 | } |
716 | void MonthViewCell::showDay() | 712 | void MonthViewCell::showDay() |
717 | { | 713 | { |
718 | emit showDaySignal( date() ); | 714 | emit showDaySignal( date() ); |
719 | } | 715 | } |
720 | void MonthViewCell::newEvent() | 716 | void MonthViewCell::newEvent() |
721 | { | 717 | { |
722 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 718 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
723 | emit newEventSignal( dt ); | 719 | emit newEventSignal( dt ); |
724 | } | 720 | } |
725 | void MonthViewCell::cellClicked( QListBoxItem *item ) | 721 | void MonthViewCell::cellClicked( QListBoxItem *item ) |
726 | { | 722 | { |
727 | static QListBoxItem * lastClicked = 0; | 723 | static QListBoxItem * lastClicked = 0; |
728 | if ( item == 0 ) { | 724 | if ( item == 0 ) { |
729 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 725 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
730 | emit newEventSignal( dt ); | 726 | emit newEventSignal( dt ); |
731 | return; | 727 | return; |
732 | } | 728 | } |
733 | /* | 729 | /* |
734 | if ( lastClicked ) | 730 | if ( lastClicked ) |
735 | if ( ! item ) { | 731 | if ( ! item ) { |
736 | if ( lastClicked->listBox() != item->listBox() ) | 732 | if ( lastClicked->listBox() != item->listBox() ) |
737 | lastClicked->listBox()->clearSelection(); | 733 | lastClicked->listBox()->clearSelection(); |
738 | } | 734 | } |
739 | */ | 735 | */ |
740 | 736 | ||
741 | mMonthView->setSelectedCell( this ); | 737 | mMonthView->setSelectedCell( this ); |
742 | if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) enableScrollBars( true ); | 738 | if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) enableScrollBars( true ); |
743 | select(); | 739 | select(); |
744 | } | 740 | } |
745 | 741 | ||
746 | void MonthViewCell::contextMenu( QListBoxItem *item ) | 742 | void MonthViewCell::contextMenu( QListBoxItem *item ) |
747 | { | 743 | { |
748 | if ( !item ) return; | 744 | if ( !item ) return; |
749 | 745 | ||
750 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); | 746 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); |
751 | Incidence *incidence = eventItem->incidence(); | 747 | Incidence *incidence = eventItem->incidence(); |
752 | if ( incidence ) mMonthView->showContextMenu( incidence ); | 748 | if ( incidence ) mMonthView->showContextMenu( incidence ); |
753 | } | 749 | } |
754 | 750 | ||
755 | void MonthViewCell::selection( QListBoxItem *item ) | 751 | void MonthViewCell::selection( QListBoxItem *item ) |
756 | { | 752 | { |
757 | if ( !item ) return; | 753 | if ( !item ) return; |
758 | 754 | ||
759 | mMonthView->setSelectedCell( this ); | 755 | mMonthView->setSelectedCell( this ); |
760 | } | 756 | } |
761 | 757 | ||
762 | 758 | ||
763 | // ******************************************************************************* | 759 | // ******************************************************************************* |
764 | // ******************************************************************************* | 760 | // ******************************************************************************* |
765 | // ******************************************************************************* | 761 | // ******************************************************************************* |
766 | 762 | ||
767 | 763 | ||
768 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | 764 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) |
769 | : KOEventView( calendar, parent, name ), | 765 | : KOEventView( calendar, parent, name ), |
770 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), | 766 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), |
771 | mShortDayLabels( false ), mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) | 767 | mShortDayLabels( false ), mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) |
772 | { | 768 | { |
773 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); | 769 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); |
774 | mShowWeekView = KOPrefs::instance()->mMonthViewWeek; | 770 | mShowWeekView = KOPrefs::instance()->mMonthViewWeek; |
775 | if ( mShowWeekView ) | 771 | if ( mShowWeekView ) |
776 | mWeekStartsMonday = true; | 772 | mWeekStartsMonday = true; |
777 | updatePossible = false; | 773 | updatePossible = false; |
778 | mCells.setAutoDelete( true ); | 774 | mCells.setAutoDelete( true ); |
779 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; | 775 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; |
780 | // mDayLayout = new QGridLayout( this ); | 776 | // mDayLayout = new QGridLayout( this ); |
781 | // create the day of the week labels (Sun, Mon, etc) and add them to | 777 | // create the day of the week labels (Sun, Mon, etc) and add them to |
782 | // the layout. | 778 | // the layout. |
783 | mDayLabels.resize( mDaysPerWeek ); | 779 | mDayLabels.resize( mDaysPerWeek ); |
784 | QFont bfont = font(); | 780 | QFont bfont = font(); |
785 | if ( QApplication::desktop()->width() < 650 ) { | 781 | if ( QApplication::desktop()->width() < 650 ) { |
786 | bfont.setPointSize( bfont.pointSize() - 2 ); | 782 | bfont.setPointSize( bfont.pointSize() - 2 ); |
787 | } | 783 | } |
788 | bfont.setBold( true ); | 784 | bfont.setBold( true ); |
789 | int i; | 785 | int i; |
790 | 786 | ||
791 | for( i = 0; i < mDaysPerWeek; i++ ) { | 787 | for( i = 0; i < mDaysPerWeek; i++ ) { |
792 | QLabel *label = new QLabel( this ); | 788 | QLabel *label = new QLabel( this ); |
793 | label->setFont(bfont); | 789 | label->setFont(bfont); |
794 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 790 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
795 | label->setLineWidth(1); | 791 | label->setLineWidth(1); |
796 | label->setAlignment(AlignCenter); | 792 | label->setAlignment(AlignCenter); |
797 | mDayLabels.insert( i, label ); | 793 | mDayLabels.insert( i, label ); |
798 | } | 794 | } |
799 | 795 | ||
800 | bfont.setBold( false ); | 796 | bfont.setBold( false ); |
801 | mWeekLabels.resize( mNumWeeks+1 ); | 797 | mWeekLabels.resize( mNumWeeks+1 ); |
802 | for( i = 0; i < mNumWeeks+1; i++ ) { | 798 | for( i = 0; i < mNumWeeks+1; i++ ) { |
803 | KOWeekButton *label = new KOWeekButton( this ); | 799 | KOWeekButton *label = new KOWeekButton( this ); |
804 | label->setFont(bfont); | 800 | label->setFont(bfont); |
805 | connect( label, SIGNAL( selectWeekNum ( int )),this, SIGNAL( selectWeekNum ( int )) ); | 801 | connect( label, SIGNAL( selectWeekNum ( int )),this, SIGNAL( selectWeekNum ( int )) ); |
806 | label->setFlat(true); | 802 | label->setFlat(true); |
807 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week in agenda view")); | 803 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week in agenda view")); |
808 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 804 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
809 | //label->setLineWidth(1); | 805 | //label->setLineWidth(1); |
810 | //label->setAlignment(AlignCenter); | 806 | //label->setAlignment(AlignCenter); |
811 | mWeekLabels.insert( i, label ); | 807 | mWeekLabels.insert( i, label ); |
812 | } | 808 | } |
813 | mWeekLabels[mNumWeeks]->setText( i18n("W")); | 809 | mWeekLabels[mNumWeeks]->setText( i18n("W")); |
814 | int row, col; | 810 | int row, col; |
815 | mCells.resize( mNumCells ); | 811 | mCells.resize( mNumCells ); |
816 | for( row = 0; row < mNumWeeks; ++row ) { | 812 | for( row = 0; row < mNumWeeks; ++row ) { |
817 | for( col = 0; col < mDaysPerWeek; ++col ) { | 813 | for( col = 0; col < mDaysPerWeek; ++col ) { |
818 | MonthViewCell *cell = new MonthViewCell( this ); | 814 | MonthViewCell *cell = new MonthViewCell( this ); |
819 | mCells.insert( row * mDaysPerWeek + col, cell ); | 815 | mCells.insert( row * mDaysPerWeek + col, cell ); |
820 | 816 | ||
821 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), | 817 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), |
822 | SLOT( defaultAction( Incidence * ) ) ); | 818 | SLOT( defaultAction( Incidence * ) ) ); |
823 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), | 819 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), |
824 | SIGNAL( newEventSignal( QDateTime ) ) ); | 820 | SIGNAL( newEventSignal( QDateTime ) ) ); |
825 | connect( cell, SIGNAL( showDaySignal( QDate ) ), | 821 | connect( cell, SIGNAL( showDaySignal( QDate ) ), |
826 | SIGNAL( showDaySignal( QDate ) ) ); | 822 | SIGNAL( showDaySignal( QDate ) ) ); |
827 | } | 823 | } |
828 | } | 824 | } |
829 | 825 | ||
830 | connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), | 826 | connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), |
831 | SLOT( switchView() ) ); | 827 | SLOT( switchView() ) ); |
832 | mContextMenu = eventPopup(); | 828 | mContextMenu = eventPopup(); |
833 | // updateConfig(); //useless here | 829 | // updateConfig(); //useless here |
834 | 830 | ||
835 | emit incidenceSelected( 0 ); | 831 | emit incidenceSelected( 0 ); |
836 | } | 832 | } |
837 | 833 | ||
838 | KOMonthView::~KOMonthView() | 834 | KOMonthView::~KOMonthView() |
839 | { | 835 | { |
840 | delete mContextMenu; | 836 | delete mContextMenu; |
841 | } | 837 | } |
842 | void KOMonthView::switchView() | 838 | void KOMonthView::switchView() |
843 | { | 839 | { |
840 | if ( selectedCell( ) ) | ||
841 | selectedCell()->deselect(); | ||
844 | mShowWeekView = !mShowWeekView; | 842 | mShowWeekView = !mShowWeekView; |
845 | KOPrefs::instance()->mMonthViewWeek = mShowWeekView; | 843 | KOPrefs::instance()->mMonthViewWeek = mShowWeekView; |
846 | emit showNavigator( !mShowWeekView ); | 844 | emit showNavigator( !mShowWeekView ); |
847 | computeLayout(); | 845 | computeLayout(); |
848 | updateConfig(); | 846 | updateConfig(); |
849 | } | 847 | } |
850 | 848 | ||
851 | int KOMonthView::maxDatesHint() | 849 | int KOMonthView::maxDatesHint() |
852 | { | 850 | { |
853 | return mNumCells; | 851 | return mNumCells; |
854 | } | 852 | } |
855 | 853 | ||
856 | int KOMonthView::currentDateCount() | 854 | int KOMonthView::currentDateCount() |
857 | { | 855 | { |
858 | return mNumCells; | 856 | return mNumCells; |
859 | } | 857 | } |
860 | 858 | ||
861 | QPtrList<Incidence> KOMonthView::selectedIncidences() | 859 | QPtrList<Incidence> KOMonthView::selectedIncidences() |
862 | { | 860 | { |
863 | QPtrList<Incidence> selected; | 861 | QPtrList<Incidence> selected; |
864 | 862 | ||
865 | if ( mSelectedCell ) { | 863 | if ( mSelectedCell ) { |
866 | Incidence *incidence = mSelectedCell->selectedIncidence(); | 864 | Incidence *incidence = mSelectedCell->selectedIncidence(); |
867 | if ( incidence ) selected.append( incidence ); | 865 | if ( incidence ) selected.append( incidence ); |
868 | } | 866 | } |
869 | 867 | ||
870 | return selected; | 868 | return selected; |
871 | } | 869 | } |
872 | 870 | ||
873 | DateList KOMonthView::selectedDates() | 871 | DateList KOMonthView::selectedDates() |
874 | { | 872 | { |
875 | DateList selected; | 873 | DateList selected; |
876 | 874 | ||
877 | if ( mSelectedCell ) { | 875 | if ( mSelectedCell ) { |
878 | QDate qd = mSelectedCell->selectedIncidenceDate(); | 876 | QDate qd = mSelectedCell->selectedIncidenceDate(); |
879 | if ( qd.isValid() ) selected.append( qd ); | 877 | if ( qd.isValid() ) selected.append( qd ); |
880 | } | 878 | } |
881 | 879 | ||
882 | return selected; | 880 | return selected; |
883 | } | 881 | } |
884 | 882 | ||
885 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 883 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
886 | const QDate &td) | 884 | const QDate &td) |
887 | { | 885 | { |
888 | #ifndef KORG_NOPRINTER | 886 | #ifndef KORG_NOPRINTER |
889 | calPrinter->preview(CalPrinter::Month, fd, td); | 887 | calPrinter->preview(CalPrinter::Month, fd, td); |
890 | #endif | 888 | #endif |
891 | } | 889 | } |
892 | 890 | ||
893 | void KOMonthView::updateConfig() | 891 | void KOMonthView::updateConfig() |
894 | { | 892 | { |
895 | 893 | ||
896 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); | 894 | mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); |
897 | 895 | ||
898 | if ( mShowWeekView ) | 896 | if ( mShowWeekView ) |
899 | mWeekStartsMonday = true; | 897 | mWeekStartsMonday = true; |
900 | QFontMetrics fontmetric(mDayLabels[0]->font()); | 898 | QFontMetrics fontmetric(mDayLabels[0]->font()); |
901 | mWidthLongDayLabel = 0; | 899 | mWidthLongDayLabel = 0; |
902 | 900 | ||
903 | for (int i = 0; i < 7; i++) { | 901 | for (int i = 0; i < 7; i++) { |
904 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); | 902 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); |
905 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; | 903 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; |
906 | } | 904 | } |
907 | bool temp = mShowSatSunComp ; | 905 | bool temp = mShowSatSunComp ; |
908 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; | 906 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; |
909 | if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) | 907 | if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) |
910 | computeLayout(); | 908 | computeLayout(); |
911 | updateDayLabels(); | 909 | updateDayLabels(); |
912 | //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); | 910 | //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); |
913 | int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; | 911 | int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; |
914 | //resizeEvent( 0 ); | 912 | //resizeEvent( 0 ); |
915 | for (uint i = 0; i < mCells.count(); ++i) { | 913 | for (uint i = 0; i < mCells.count(); ++i) { |
916 | mCells[i]->updateConfig(); | 914 | mCells[i]->updateConfig(); |
917 | } | 915 | } |
918 | #ifdef DESKTOP_VERSION | 916 | #ifdef DESKTOP_VERSION |
919 | MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); | 917 | MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); |
920 | #endif | 918 | #endif |
921 | updateView(); | 919 | updateView(); |
922 | } | 920 | } |
923 | 921 | ||
924 | void KOMonthView::updateDayLabels() | 922 | void KOMonthView::updateDayLabels() |
925 | { | 923 | { |
926 | 924 | ||
927 | for (int i = 0; i < 7; i++) { | 925 | for (int i = 0; i < 7; i++) { |
928 | if (mWeekStartsMonday) { | 926 | if (mWeekStartsMonday) { |
929 | bool show = mShortDayLabels; | 927 | bool show = mShortDayLabels; |
930 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > mDayLabels[i]->width() ) | 928 | if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > mDayLabels[i]->width() ) |
931 | show = true; | 929 | show = true; |
932 | mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); | 930 | mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); |
933 | } else { | 931 | } else { |
934 | if (i==0) mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabels)); | 932 | if (i==0) mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabels)); |
935 | else mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabels)); | 933 | else mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabels)); |
936 | 934 | ||
937 | } | 935 | } |
938 | } | 936 | } |
939 | } | 937 | } |
940 | 938 | ||
941 | void KOMonthView::showDates(const QDate &start, const QDate &) | 939 | void KOMonthView::showDates(const QDate &start, const QDate &) |
942 | { | 940 | { |
943 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; | 941 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; |
944 | 942 | ||
945 | 943 | ||
946 | mStartDate = start; | 944 | mStartDate = start; |
947 | 945 | ||
948 | int startWeekDay = mWeekStartsMonday ? 1 : 7; | 946 | int startWeekDay = mWeekStartsMonday ? 1 : 7; |
949 | 947 | ||
950 | while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { | 948 | while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { |
951 | mStartDate = mStartDate.addDays( -1 ); | 949 | mStartDate = mStartDate.addDays( -1 ); |
952 | } | 950 | } |
953 | 951 | ||
954 | bool primary = false; | 952 | bool primary = false; |
955 | uint i; | 953 | uint i; |
956 | for( i = 0; i < mCells.size(); ++i ) { | 954 | for( i = 0; i < mCells.size(); ++i ) { |
957 | QDate date = mStartDate.addDays( i ); | 955 | QDate date = mStartDate.addDays( i ); |
958 | mCells[i]->setDate( date ); | 956 | mCells[i]->setDate( date ); |
959 | 957 | ||
960 | #ifndef KORG_NOPLUGINS | 958 | #ifndef KORG_NOPLUGINS |
961 | // add holiday, if present | 959 | // add holiday, if present |
962 | QString hstring(KOCore::self()->holiday(date)); | 960 | QString hstring(KOCore::self()->holiday(date)); |
963 | mCells[i]->setHoliday( hstring ); | 961 | mCells[i]->setHoliday( hstring ); |
964 | #endif | 962 | #endif |
965 | 963 | ||
966 | } | 964 | } |
967 | QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); | 965 | QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); |
968 | for( i = 0; i < 6; ++i ) { | 966 | for( i = 0; i < 6; ++i ) { |
969 | int wno; | 967 | int wno; |
970 | // remember, according to ISO 8601, the first week of the year is the | 968 | // remember, according to ISO 8601, the first week of the year is the |
971 | // first week that contains a thursday. Thus we must subtract off 4, | 969 | // first week that contains a thursday. Thus we must subtract off 4, |
972 | // not just 1. | 970 | // not just 1. |
973 | int dayOfYear = date.dayOfYear(); | 971 | int dayOfYear = date.dayOfYear(); |
974 | if (dayOfYear % 7 != 0) | 972 | if (dayOfYear % 7 != 0) |
975 | wno = dayOfYear / 7 + 1; | 973 | wno = dayOfYear / 7 + 1; |
976 | else | 974 | else |
977 | wno =dayOfYear / 7; | 975 | wno =dayOfYear / 7; |
978 | mWeekLabels[i]->setWeekNum( wno ); | 976 | mWeekLabels[i]->setWeekNum( wno ); |
979 | date = date.addDays( 7 ); | 977 | date = date.addDays( 7 ); |
980 | } | 978 | } |
981 | updateView(); | 979 | updateView(); |
982 | } | 980 | } |
983 | 981 | ||
984 | void KOMonthView::showEvents(QPtrList<Event>) | 982 | void KOMonthView::showEvents(QPtrList<Event>) |
985 | { | 983 | { |
986 | qDebug("KOMonthView::selectEvents is not implemented yet. "); | 984 | qDebug("KOMonthView::selectEvents is not implemented yet. "); |
987 | } | 985 | } |
988 | 986 | ||
989 | void KOMonthView::changeEventDisplay(Event *, int) | 987 | void KOMonthView::changeEventDisplay(Event *, int) |
990 | { | 988 | { |
991 | // this should be re-written to be much more efficient, but this | 989 | // this should be re-written to be much more efficient, but this |
992 | // quick-and-dirty-hack gets the job done for right now. | 990 | // quick-and-dirty-hack gets the job done for right now. |
993 | updateView(); | 991 | updateView(); |
994 | } | 992 | } |
995 | 993 | ||
996 | void KOMonthView::updateView() | 994 | void KOMonthView::updateView() |
997 | { | 995 | { |
998 | 996 | ||
999 | if ( !updatePossible ) | 997 | if ( !updatePossible ) |
1000 | return; | 998 | return; |
1001 | //QTime ti; | 999 | //QTime ti; |
1002 | //ti.start(); | 1000 | //ti.start(); |
1003 | #if 1 | 1001 | #if 1 |
1004 | int i; | 1002 | int i; |
1005 | int timeSpan = mCells.size()-1; | 1003 | int timeSpan = mCells.size()-1; |
1006 | if ( KOPrefs::instance()->mMonthViewWeek ) | 1004 | if ( KOPrefs::instance()->mMonthViewWeek ) |
1007 | timeSpan = 6; | 1005 | timeSpan = 6; |
1008 | for( i = 0; i < timeSpan + 1; ++i ) { | 1006 | for( i = 0; i < timeSpan + 1; ++i ) { |
1009 | mCells[i]->startUpdateCell(); | 1007 | mCells[i]->startUpdateCell(); |
1010 | } | 1008 | } |
1011 | 1009 | ||
1012 | QPtrList<Event> events = calendar()->events(); | 1010 | QPtrList<Event> events = calendar()->events(); |
1013 | Event *event; | 1011 | Event *event; |
1014 | QDateTime dt; | 1012 | QDateTime dt; |
1015 | bool ok; | 1013 | bool ok; |
1016 | QDate endDate = mStartDate.addDays( timeSpan ); | 1014 | QDate endDate = mStartDate.addDays( timeSpan ); |
1017 | for( event = events.first(); event; event = events.next() ) { // for event | 1015 | for( event = events.first(); event; event = events.next() ) { // for event |
1018 | if ( event->doesRecur() ) { | 1016 | if ( event->doesRecur() ) { |
1019 | bool last; | 1017 | bool last; |
1020 | QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); | 1018 | QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); |
1021 | QDateTime incidenceEnd; | 1019 | QDateTime incidenceEnd; |
1022 | int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 1020 | int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
1023 | bool invalid = false; | 1021 | bool invalid = false; |
1024 | while( true ) { | 1022 | while( true ) { |
1025 | if ( incidenceStart.isValid() ) { | 1023 | if ( incidenceStart.isValid() ) { |
1026 | incidenceEnd = incidenceStart.addDays( eventlen ); | 1024 | incidenceEnd = incidenceStart.addDays( eventlen ); |
1027 | int st = incidenceStart.date().daysTo( endDate ); | 1025 | int st = incidenceStart.date().daysTo( endDate ); |
1028 | if ( st >= 0 ) { // start before timeend | 1026 | if ( st >= 0 ) { // start before timeend |
1029 | int end = mStartDate.daysTo( incidenceEnd.date() ); | 1027 | int end = mStartDate.daysTo( incidenceEnd.date() ); |
1030 | if ( end >= 0 ) { // end after timestart --- got one! | 1028 | if ( end >= 0 ) { // end after timestart --- got one! |
1031 | //normalize | 1029 | //normalize |
1032 | st = timeSpan - st; | 1030 | st = timeSpan - st; |
1033 | if ( st < 0 ) st = 0; | 1031 | if ( st < 0 ) st = 0; |
1034 | if ( end > timeSpan ) end = timeSpan; | 1032 | if ( end > timeSpan ) end = timeSpan; |
1035 | int iii; | 1033 | int iii; |
1036 | //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); | 1034 | //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); |
1037 | for ( iii = st;iii<= end;++iii) | 1035 | for ( iii = st;iii<= end;++iii) |
1038 | mCells[iii]->insertEvent( event ); | 1036 | mCells[iii]->insertEvent( event ); |
1039 | } | 1037 | } |
1040 | } | 1038 | } |
1041 | } else { | 1039 | } else { |
1042 | if ( invalid ) | 1040 | if ( invalid ) |
1043 | break; | 1041 | break; |
1044 | invalid = true; | 1042 | invalid = true; |
1045 | //qDebug("invalid %s", event->summary().latin1()); | 1043 | //qDebug("invalid %s", event->summary().latin1()); |
1046 | incidenceStart = QDateTime( mStartDate ); | 1044 | incidenceStart = QDateTime( mStartDate ); |
1047 | } | 1045 | } |
1048 | if ( last ) | 1046 | if ( last ) |
1049 | break; | 1047 | break; |
1050 | bool ok; | 1048 | bool ok; |
1051 | incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); | 1049 | incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); |
1052 | if ( ! ok ) | 1050 | if ( ! ok ) |
1053 | break; | 1051 | break; |
1054 | if ( incidenceStart.date() > endDate ) | 1052 | if ( incidenceStart.date() > endDate ) |
1055 | break; | 1053 | break; |
1056 | } | 1054 | } |
1057 | } else { // no recur | 1055 | } else { // no recur |
1058 | int st = event->dtStart().date().daysTo( endDate ); | 1056 | int st = event->dtStart().date().daysTo( endDate ); |
1059 | if ( st >= 0 ) { // start before timeend | 1057 | if ( st >= 0 ) { // start before timeend |
1060 | int end = mStartDate.daysTo( event->dtEnd().date() ); | 1058 | int end = mStartDate.daysTo( event->dtEnd().date() ); |
1061 | if ( end >= 0 ) { // end after timestart --- got one! | 1059 | if ( end >= 0 ) { // end after timestart --- got one! |
1062 | //normalize | 1060 | //normalize |
1063 | st = timeSpan - st; | 1061 | st = timeSpan - st; |
1064 | if ( st < 0 ) st = 0; | 1062 | if ( st < 0 ) st = 0; |
1065 | if ( end > timeSpan ) end = timeSpan; | 1063 | if ( end > timeSpan ) end = timeSpan; |
1066 | int iii; | 1064 | int iii; |
1067 | for ( iii = st;iii<= end;++iii) | 1065 | for ( iii = st;iii<= end;++iii) |
1068 | mCells[iii]->insertEvent( event ); | 1066 | mCells[iii]->insertEvent( event ); |
1069 | } | 1067 | } |
1070 | } | 1068 | } |
1071 | } | 1069 | } |
1072 | } | 1070 | } |
1073 | // insert due todos | 1071 | // insert due todos |
1074 | QPtrList<Todo> todos = calendar()->todos( ); | 1072 | QPtrList<Todo> todos = calendar()->todos( ); |
1075 | Todo *todo; | 1073 | Todo *todo; |
1076 | for(todo = todos.first(); todo; todo = todos.next()) { | 1074 | for(todo = todos.first(); todo; todo = todos.next()) { |
1077 | //insertTodo( todo ); | 1075 | //insertTodo( todo ); |
1078 | if ( todo->hasDueDate() ) { | 1076 | if ( todo->hasDueDate() ) { |
1079 | int day = mStartDate.daysTo( todo->dtDue().date() ); | 1077 | int day = mStartDate.daysTo( todo->dtDue().date() ); |
1080 | if ( day >= 0 && day < timeSpan + 1) { | 1078 | if ( day >= 0 && day < timeSpan + 1) { |
1081 | mCells[day]->insertTodo( todo ); | 1079 | mCells[day]->insertTodo( todo ); |
1082 | } | 1080 | } |
1083 | } | 1081 | } |
1084 | } | 1082 | } |
1085 | 1083 | ||
1086 | for( i = 0; i < timeSpan+1; ++i ) { | 1084 | for( i = 0; i < timeSpan+1; ++i ) { |
1087 | mCells[i]->finishUpdateCell(); | 1085 | mCells[i]->finishUpdateCell(); |
1088 | } | 1086 | } |
1089 | processSelectionChange(); | 1087 | processSelectionChange(); |
1090 | mCells[0]->setFocus(); | 1088 | mCells[0]->setFocus(); |
1091 | 1089 | ||
1092 | 1090 | ||
1093 | #else | 1091 | #else |
1094 | // old code | 1092 | // old code |
1095 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); | 1093 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); |
1096 | int i; | 1094 | int i; |
1097 | for( i = 0; i < mCells.count(); ++i ) { | 1095 | for( i = 0; i < mCells.count(); ++i ) { |
1098 | mCells[i]->updateCell(); | 1096 | mCells[i]->updateCell(); |
1099 | } | 1097 | } |
1100 | 1098 | ||
1101 | //qDebug("KOMonthView::updateView() "); | 1099 | //qDebug("KOMonthView::updateView() "); |
1102 | processSelectionChange(); | 1100 | processSelectionChange(); |
1103 | // qDebug("---------------------------------------------------------------------+ "); | 1101 | // qDebug("---------------------------------------------------------------------+ "); |
1104 | mCells[0]->setFocus(); | 1102 | mCells[0]->setFocus(); |
1105 | #endif | 1103 | #endif |
1106 | 1104 | ||
1107 | //qDebug("update time %d ", ti.elapsed()); | 1105 | //qDebug("update time %d ", ti.elapsed()); |
1108 | } | 1106 | } |
1109 | 1107 | ||
1110 | void KOMonthView::resizeEvent(QResizeEvent * e) | 1108 | void KOMonthView::resizeEvent(QResizeEvent * e) |
1111 | { | 1109 | { |
1112 | computeLayout(); | 1110 | computeLayout(); |
1113 | mCells[0]->setFocus(); | 1111 | mCells[0]->setFocus(); |
1114 | } | 1112 | } |
1115 | void KOMonthView::computeLayoutWeek() | 1113 | void KOMonthView::computeLayoutWeek() |
1116 | { | 1114 | { |
1117 | 1115 | ||
1118 | int daysToShow; | 1116 | int daysToShow; |
1119 | bool combinedSatSun = false; | 1117 | bool combinedSatSun = false; |
1120 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { | 1118 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { |
1121 | daysToShow = 6; | 1119 | daysToShow = 6; |
1122 | combinedSatSun = true; | 1120 | combinedSatSun = true; |
1123 | } | 1121 | } |
1124 | int tWid = topLevelWidget()->size().width(); | 1122 | int tWid = topLevelWidget()->size().width(); |
1125 | int tHei = topLevelWidget()->size().height(); | 1123 | int tHei = topLevelWidget()->size().height(); |
1126 | 1124 | ||
1127 | int wid = size().width();//e | 1125 | int wid = size().width();//e |
1128 | int hei = size().height()-1; | 1126 | int hei = size().height()-1; |
1129 | 1127 | ||
1130 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) | 1128 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) |
1131 | return; | 1129 | return; |
1132 | 1130 | ||
1133 | if ( wid < hei ) | 1131 | if ( wid < hei ) |
1134 | daysToShow = 2; | 1132 | daysToShow = 2; |
1135 | else | 1133 | else |
1136 | daysToShow = 3; | 1134 | daysToShow = 3; |
1137 | mShowSatSunComp = true; | 1135 | mShowSatSunComp = true; |
1138 | combinedSatSun = true; | 1136 | combinedSatSun = true; |
1139 | 1137 | ||
1140 | //qDebug("KOMonthView::computeLayout()------------------------------------ "); | 1138 | //qDebug("KOMonthView::computeLayout()------------------------------------ "); |
1141 | QFontMetrics fm ( mWeekLabels[0]->font() ); | 1139 | QFontMetrics fm ( mWeekLabels[0]->font() ); |
1142 | int weeklabelwid = fm.width( "888" ); | 1140 | int weeklabelwid = fm.width( "888" ); |
1143 | wid -= weeklabelwid; | 1141 | wid -= weeklabelwid; |
1144 | 1142 | ||
1145 | int colWid = wid / daysToShow; | 1143 | int colWid = wid / daysToShow; |
1146 | int lastCol = wid - ( colWid*6 ); | 1144 | int lastCol = wid - ( colWid*6 ); |
1147 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); | 1145 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); |
1148 | int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); | 1146 | int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); |
1149 | int colModulo = wid % daysToShow; | 1147 | int colModulo = wid % daysToShow; |
1150 | int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; | 1148 | int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; |
1151 | //qDebug("rowmod %d ", rowModulo); | 1149 | //qDebug("rowmod %d ", rowModulo); |
1152 | int i; | 1150 | int i; |
1153 | int x,y,w,h; | 1151 | int x,y,w,h; |
1154 | x= 0; | 1152 | x= 0; |
1155 | y= 0; | 1153 | y= 0; |
1156 | w = colWid; | 1154 | w = colWid; |
1157 | h = dayLabelHei ; | 1155 | h = dayLabelHei ; |
1158 | for ( i = 0; i < 7; i++) { | 1156 | for ( i = 0; i < 7; i++) { |
1159 | if ( i && !( i % daysToShow) && i < 6) { | 1157 | if ( i && !( i % daysToShow) && i < 6) { |
1160 | y += hei/(5-daysToShow); | 1158 | y += hei/(5-daysToShow); |
1161 | x = 0; | 1159 | x = 0; |
1160 | w = colWid; | ||
1162 | } | 1161 | } |
1163 | if ( i == daysToShow-colModulo ) | 1162 | if ( i == daysToShow-colModulo ) |
1164 | ++w; | 1163 | ++w; |
1165 | if ( i >= 5 ) { | 1164 | if ( i >= 5 ) { |
1166 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); | 1165 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2+1,h); |
1167 | x -= w/2 ; | 1166 | x -= w/2 ; |
1168 | } | 1167 | } |
1169 | else | 1168 | else |
1170 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); | 1169 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); |
1171 | x += w; | 1170 | x += w; |
1172 | } | 1171 | } |
1173 | x= 0; | 1172 | x= 0; |
1174 | y= dayLabelHei; | 1173 | y= dayLabelHei; |
1175 | w = colWid; | 1174 | w = colWid; |
1176 | h = cellHei; | 1175 | h = cellHei; |
1177 | for ( i = 0; i < mCells.count(); ++i) { | 1176 | for ( i = 0; i < mCells.count(); ++i) { |
1178 | if ( i > 6 ) { | 1177 | if ( i > 6 ) { |
1179 | mCells[i]->hide(); | 1178 | mCells[i]->hide(); |
1180 | continue; | 1179 | continue; |
1181 | } | 1180 | } |
1182 | 1181 | ||
1183 | w = colWid; | 1182 | w = colWid; |
1184 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { | 1183 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { |
1185 | ++w; | 1184 | ++w; |
1186 | } | 1185 | } |
1187 | if ( i == (daysToShow-1-rowModulo)*7) | 1186 | if ( i == (daysToShow-1-rowModulo)*7) |
1188 | ++h; | 1187 | ++h; |
1189 | 1188 | ||
1190 | if ( i >= 5 ) { | 1189 | if ( i >= 5 ) { |
1191 | if ( i ==5 ) { | 1190 | if ( i ==5 ) { |
1192 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); | 1191 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); |
1193 | x -= w ;y += h/2; | 1192 | x -= w ;y += h/2; |
1194 | } else { | 1193 | } else { |
1195 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); | 1194 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); |
1196 | y -= h/2; | 1195 | y -= h/2; |
1197 | } | 1196 | } |
1198 | } else | 1197 | } else |
1199 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1198 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1200 | 1199 | ||
1201 | 1200 | ||
1202 | x += w; | 1201 | x += w; |
1203 | if ( x + w/2 > wid ) { | 1202 | if ( x + w/2 > wid ) { |
1204 | x = 0; | 1203 | x = 0; |
1205 | y += h+dayLabelHei ; | 1204 | y += h+dayLabelHei ; |
1206 | } | 1205 | } |
1207 | } | 1206 | } |
1208 | y= dayLabelHei; | 1207 | y= dayLabelHei; |
1209 | h = cellHei ; | 1208 | h = cellHei ; |
1210 | mWeekLabels[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei); | 1209 | mWeekLabels[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei); |
1211 | for ( i = 1; i < 6; i++) { | 1210 | for ( i = 1; i < 6; i++) { |
1212 | mWeekLabels[i]->hide(); | 1211 | mWeekLabels[i]->hide(); |
1213 | } | 1212 | } |
1214 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); | 1213 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); |
1215 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); | 1214 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); |
1216 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); | 1215 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); |
1217 | mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ; | 1216 | mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ; |
1218 | updateDayLabels(); | 1217 | updateDayLabels(); |
1219 | bool forceUpdate = !updatePossible; | 1218 | bool forceUpdate = !updatePossible; |
1220 | updatePossible = true; | 1219 | updatePossible = true; |
1221 | mWeekLabels[mNumWeeks]->setText( i18n("M")); | 1220 | mWeekLabels[mNumWeeks]->setText( i18n("M")); |
1222 | if ( forceUpdate ) | 1221 | if ( forceUpdate ) |
1223 | updateView(); | 1222 | updateView(); |
1224 | } | 1223 | } |
1225 | void KOMonthView::computeLayout() | 1224 | void KOMonthView::computeLayout() |
1226 | { | 1225 | { |
1227 | // select the appropriate heading string size. E.g. "Wednesday" or "Wed". | 1226 | // select the appropriate heading string size. E.g. "Wednesday" or "Wed". |
1228 | // note this only changes the text if the requested size crosses the | 1227 | // note this only changes the text if the requested size crosses the |
1229 | // threshold between big enough to support the full name and not big | 1228 | // threshold between big enough to support the full name and not big |
1230 | // enough. | 1229 | // enough. |
1231 | if ( mShowWeekView ){ | 1230 | if ( mShowWeekView ){ |
1232 | computeLayoutWeek(); | 1231 | computeLayoutWeek(); |
1233 | return; | 1232 | return; |
1234 | } | 1233 | } |
1235 | int daysToShow = 7; | 1234 | int daysToShow = 7; |
1236 | bool combinedSatSun = false; | 1235 | bool combinedSatSun = false; |
1237 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { | 1236 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { |
1238 | daysToShow = 6; | 1237 | daysToShow = 6; |
1239 | combinedSatSun = true; | 1238 | combinedSatSun = true; |
1240 | } | 1239 | } |
1241 | int tWid = topLevelWidget()->size().width(); | 1240 | int tWid = topLevelWidget()->size().width(); |
1242 | int tHei = topLevelWidget()->size().height(); | 1241 | int tHei = topLevelWidget()->size().height(); |
1243 | 1242 | ||
1244 | int wid = size().width();//e | 1243 | int wid = size().width();//e |
1245 | int hei = size().height()-1; | 1244 | int hei = size().height()-1; |
1246 | 1245 | ||
1247 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) | 1246 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) |
1248 | return; | 1247 | return; |
1249 | //qDebug("KOMonthView::computeLayout()------------------------------------ "); | 1248 | //qDebug("KOMonthView::computeLayout()------------------------------------ "); |
1250 | QFontMetrics fm ( mWeekLabels[0]->font() ); | 1249 | QFontMetrics fm ( mWeekLabels[0]->font() ); |
1251 | int weeklabelwid = fm.width( "888" ); | 1250 | int weeklabelwid = fm.width( "888" ); |
1252 | wid -= weeklabelwid; | 1251 | wid -= weeklabelwid; |
1253 | 1252 | ||
1254 | int colWid = wid / daysToShow; | 1253 | int colWid = wid / daysToShow; |
1255 | int lastCol = wid - ( colWid*6 ); | 1254 | int lastCol = wid - ( colWid*6 ); |
1256 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); | 1255 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); |
1257 | int cellHei = (hei - dayLabelHei) /6; | 1256 | int cellHei = (hei - dayLabelHei) /6; |
1258 | int colModulo = wid % daysToShow; | 1257 | int colModulo = wid % daysToShow; |
1259 | int rowModulo = (hei- dayLabelHei) % 6; | 1258 | int rowModulo = (hei- dayLabelHei) % 6; |
1260 | //qDebug("rowmod %d ", rowModulo); | 1259 | //qDebug("rowmod %d ", rowModulo); |
1261 | int i; | 1260 | int i; |
1262 | int x,y,w,h; | 1261 | int x,y,w,h; |
1263 | x= 0; | 1262 | x= 0; |
1264 | y= 0; | 1263 | y= 0; |
1265 | w = colWid; | 1264 | w = colWid; |
1266 | h = dayLabelHei ; | 1265 | h = dayLabelHei ; |
1267 | for ( i = 0; i < 7; i++) { | 1266 | for ( i = 0; i < 7; i++) { |
1268 | if ( i == daysToShow-colModulo ) | 1267 | if ( i == daysToShow-colModulo ) |
1269 | ++w; | 1268 | ++w; |
1270 | if ( combinedSatSun ) { | 1269 | if ( combinedSatSun ) { |
1271 | if ( i >= daysToShow-1 ) { | 1270 | if ( i >= daysToShow-1 ) { |
1272 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); | 1271 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); |
1273 | x -= w/2 ; | 1272 | x -= w/2 ; |
1274 | } | 1273 | } |
1275 | else | 1274 | else |
1276 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); | 1275 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); |
1277 | } else | 1276 | } else |
1278 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); | 1277 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); |
1279 | x += w; | 1278 | x += w; |
1280 | } | 1279 | } |
1281 | x= 0; | 1280 | x= 0; |
1282 | y= dayLabelHei; | 1281 | y= dayLabelHei; |
1283 | w = colWid; | 1282 | w = colWid; |
1284 | h = cellHei ; | 1283 | h = cellHei ; |
1285 | for ( i = 0; i < mCells.count(); ++i) { | 1284 | for ( i = 0; i < mCells.count(); ++i) { |
1286 | mCells[i]->show(); | 1285 | mCells[i]->show(); |
1287 | w = colWid; | 1286 | w = colWid; |
1288 | if ( ((i) % 7) >= 7-colModulo ) { | 1287 | if ( ((i) % 7) >= 7-colModulo ) { |
1289 | ++w; | 1288 | ++w; |
1290 | } | 1289 | } |
1291 | if ( i == (6-rowModulo)*7) | 1290 | if ( i == (6-rowModulo)*7) |
1292 | ++h; | 1291 | ++h; |
1293 | if ( combinedSatSun ) { | 1292 | if ( combinedSatSun ) { |
1294 | if ( (i)%7 >= daysToShow-1 ) { | 1293 | if ( (i)%7 >= daysToShow-1 ) { |
1295 | if ( (i)%7 == daysToShow-1 ) { | 1294 | if ( (i)%7 == daysToShow-1 ) { |
1296 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); | 1295 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); |
1297 | x -= w ;y += h/2; | 1296 | x -= w ;y += h/2; |
1298 | } else { | 1297 | } else { |
1299 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); | 1298 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); |
1300 | y -= h/2; | 1299 | y -= h/2; |
1301 | } | 1300 | } |
1302 | } else | 1301 | } else |
1303 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1302 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1304 | 1303 | ||
1305 | } | 1304 | } |
1306 | else | 1305 | else |
1307 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1306 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1308 | x += w; | 1307 | x += w; |
1309 | if ( x + w/2 > wid ) { | 1308 | if ( x + w/2 > wid ) { |
1310 | x = 0; | 1309 | x = 0; |
1311 | y += h; | 1310 | y += h; |
1312 | } | 1311 | } |
1313 | } | 1312 | } |
1314 | y= dayLabelHei; | 1313 | y= dayLabelHei; |
1315 | h = cellHei ; | 1314 | h = cellHei ; |
1316 | for ( i = 0; i < 6; i++) { | 1315 | for ( i = 0; i < 6; i++) { |
1317 | mWeekLabels[i]->show(); | 1316 | mWeekLabels[i]->show(); |
1318 | if ( i == (6-rowModulo)) | 1317 | if ( i == (6-rowModulo)) |
1319 | ++h; | 1318 | ++h; |
1320 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); | 1319 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); |
1321 | y += h; | 1320 | y += h; |
1322 | } | 1321 | } |
1323 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); | 1322 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); |
1324 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); | 1323 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); |
1325 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); | 1324 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); |
1326 | mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ; | 1325 | mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ; |
1327 | updateDayLabels(); | 1326 | updateDayLabels(); |
1328 | bool forceUpdate = !updatePossible; | 1327 | bool forceUpdate = !updatePossible; |
1329 | updatePossible = true; | 1328 | updatePossible = true; |
1330 | mWeekLabels[mNumWeeks]->setText( i18n("W")); | 1329 | mWeekLabels[mNumWeeks]->setText( i18n("W")); |
1331 | if ( forceUpdate ) | 1330 | if ( forceUpdate ) |
1332 | updateView(); | 1331 | updateView(); |
1333 | } | 1332 | } |
1334 | 1333 | ||
1335 | void KOMonthView::showContextMenu( Incidence *incidence ) | 1334 | void KOMonthView::showContextMenu( Incidence *incidence ) |
1336 | { | 1335 | { |
1337 | mContextMenu->showIncidencePopup(incidence); | 1336 | mContextMenu->showIncidencePopup(incidence); |
1338 | /* | 1337 | /* |
1339 | if( incidence && incidence->type() == "Event" ) { | 1338 | if( incidence && incidence->type() == "Event" ) { |
1340 | Event *event = static_cast<Event *>(incidence); | 1339 | Event *event = static_cast<Event *>(incidence); |
1341 | mContextMenu->showEventPopup(event); | 1340 | mContextMenu->showEventPopup(event); |
1342 | } else { | 1341 | } else { |
1343 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; | 1342 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; |
1344 | } | 1343 | } |
1345 | */ | 1344 | */ |
1346 | } | 1345 | } |
1347 | MonthViewCell * KOMonthView::selectedCell( ) | 1346 | MonthViewCell * KOMonthView::selectedCell( ) |
1348 | { | 1347 | { |
1349 | return mSelectedCell; | 1348 | return mSelectedCell; |
1350 | } | 1349 | } |
1351 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) | 1350 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) |
1352 | { | 1351 | { |
1353 | // qDebug("KOMonthView::setSelectedCell "); | 1352 | // qDebug("KOMonthView::setSelectedCell "); |
1354 | if ( mSelectedCell && mSelectedCell != cell ) { | 1353 | if ( mSelectedCell && mSelectedCell != cell ) { |
1355 | MonthViewCell * mvc = mSelectedCell; | 1354 | MonthViewCell * mvc = mSelectedCell; |
1356 | mSelectedCell = cell; | 1355 | mSelectedCell = cell; |
1357 | mvc->deselect(); | 1356 | mvc->deselect(); |
1358 | } else | 1357 | } else |