-rw-r--r-- | desktop/rpm/kdepim_rpm | 2 | ||||
-rw-r--r-- | korganizer/koagendaitem.cpp | 10 |
2 files changed, 7 insertions, 5 deletions
diff --git a/desktop/rpm/kdepim_rpm b/desktop/rpm/kdepim_rpm index 9dd9034..9093b40 100644 --- a/desktop/rpm/kdepim_rpm +++ b/desktop/rpm/kdepim_rpm | |||
@@ -1,84 +1,84 @@ | |||
1 | Summary: A collection of PIM programs | 1 | Summary: A collection of PIM programs |
2 | Name: KDE-Pim-Pi | 2 | Name: KDE-Pim-Pi |
3 | Version: 1.9.20 | 3 | Version: 2.0.1 |
4 | Release: SuSE_9.2 | 4 | Release: SuSE_9.2 |
5 | Copyright:GPL | 5 | Copyright:GPL |
6 | Group: Productivity/Pim | 6 | Group: Productivity/Pim |
7 | Source:http://sourceforge.net/projects/kdepimpi/ | 7 | Source:http://sourceforge.net/projects/kdepimpi/ |
8 | URL:http://sourceforge.net/projects/kdepimpi/ | 8 | URL:http://sourceforge.net/projects/kdepimpi/ |
9 | Packager: zautrix | 9 | Packager: zautrix |
10 | 10 | ||
11 | %description | 11 | %description |
12 | This package contains the platform-independent PIM programs from | 12 | This package contains the platform-independent PIM programs from |
13 | www.pi-sync.net, compiled for SuSE 9.2: | 13 | www.pi-sync.net, compiled for SuSE 9.2: |
14 | KTimeTacker/Pi | 14 | KTimeTacker/Pi |
15 | KPhone/Pi | 15 | KPhone/Pi |
16 | KAddressbook/Pi | 16 | KAddressbook/Pi |
17 | KOrganizer/Pi | 17 | KOrganizer/Pi |
18 | PasswordManager/Pi | 18 | PasswordManager/Pi |
19 | KOPieMail/Pi | 19 | KOPieMail/Pi |
20 | 20 | ||
21 | These applications do not need anything from the KDE-desktop | 21 | These applications do not need anything from the KDE-desktop |
22 | at all to run on Linux. However, there is a dependency from | 22 | at all to run on Linux. However, there is a dependency from |
23 | two KDE libs, because a small command line program is included | 23 | two KDE libs, because a small command line program is included |
24 | to make it possible to sync with the KDE-desktop applications. | 24 | to make it possible to sync with the KDE-desktop applications. |
25 | 25 | ||
26 | These applications are independent from the KDE-desktop | 26 | These applications are independent from the KDE-desktop |
27 | environment. That means, nothing of your existing | 27 | environment. That means, nothing of your existing |
28 | KDE-desktop setup will be changed, or any data | 28 | KDE-desktop setup will be changed, or any data |
29 | (calendar-addressbook) used by the KDE-desktop | 29 | (calendar-addressbook) used by the KDE-desktop |
30 | applications will be changed or accessed. | 30 | applications will be changed or accessed. |
31 | These applications stores their data and config in | 31 | These applications stores their data and config in |
32 | $HOME/kdepim/ | 32 | $HOME/kdepim/ |
33 | However, because the same file format is used, | 33 | However, because the same file format is used, |
34 | an easy exchange of data with the KDE-desktop | 34 | an easy exchange of data with the KDE-desktop |
35 | is possible. | 35 | is possible. |
36 | A small command line program is included | 36 | A small command line program is included |
37 | to make it possible to sync with the KDE-desktop applications. | 37 | to make it possible to sync with the KDE-desktop applications. |
38 | You do not need to call this program from the commandline, | 38 | You do not need to call this program from the commandline, |
39 | it is called from the KDE-Pim/Pi apps when you choose there: | 39 | it is called from the KDE-Pim/Pi apps when you choose there: |
40 | Sync with KDE_Desktop. | 40 | Sync with KDE_Desktop. |
41 | If something is going wrong, please start the | 41 | If something is going wrong, please start the |
42 | KDE-Pim/Pi program itself from the console to get detailed output. | 42 | KDE-Pim/Pi program itself from the console to get detailed output. |
43 | 43 | ||
44 | After installation, you should have a | 44 | After installation, you should have a |
45 | PIM-pi | 45 | PIM-pi |
46 | folder in your KDE start menu, where you can | 46 | folder in your KDE start menu, where you can |
47 | start the applications from. | 47 | start the applications from. |
48 | 48 | ||
49 | These programs makes it possible to sync your Zaurus easily | 49 | These programs makes it possible to sync your Zaurus easily |
50 | (with the KDE-Pim/Pi programs running on the Zaurus) | 50 | (with the KDE-Pim/Pi programs running on the Zaurus) |
51 | with the KDE-desktop calendar/addressbook data. | 51 | with the KDE-desktop calendar/addressbook data. |
52 | If you want to use that, you have to update your | 52 | If you want to use that, you have to update your |
53 | KDE-desktop to version 3.3.0 or higher. | 53 | KDE-desktop to version 3.3.0 or higher. |
54 | SuSE 9.2 contains KDE 3.3.0 such that no update is needed. | 54 | SuSE 9.2 contains KDE 3.3.0 such that no update is needed. |
55 | Actually - after the (non difficult) configuration is set up - | 55 | Actually - after the (non difficult) configuration is set up - |
56 | with two mouseklicks on the Zaurus, | 56 | with two mouseklicks on the Zaurus, |
57 | the Zaurus syncs with the corresponding KDE-Pim/Pi | 57 | the Zaurus syncs with the corresponding KDE-Pim/Pi |
58 | program on the Linux Desktop which syncs automatically | 58 | program on the Linux Desktop which syncs automatically |
59 | with the KDE-desktop data. | 59 | with the KDE-desktop data. |
60 | 60 | ||
61 | If you want to use the KDE-desktop calendar/addressbook applications, | 61 | If you want to use the KDE-desktop calendar/addressbook applications, |
62 | just install these apps in this package and use them as a syncing tool for the | 62 | just install these apps in this package and use them as a syncing tool for the |
63 | Zaurus <-> KDE-desktop sync. | 63 | Zaurus <-> KDE-desktop sync. |
64 | The sync requires a network connection from your Zaurus to | 64 | The sync requires a network connection from your Zaurus to |
65 | the PC. A detailed Sync HowTo is available in the | 65 | the PC. A detailed Sync HowTo is available in the |
66 | Help menu of the applications. | 66 | Help menu of the applications. |
67 | 67 | ||
68 | These applications makes it also possible, that you can sync | 68 | These applications makes it also possible, that you can sync |
69 | (or just export the data to) your mobile phone with your | 69 | (or just export the data to) your mobile phone with your |
70 | data of the KDE-desktop calendar/addressbook applications. | 70 | data of the KDE-desktop calendar/addressbook applications. |
71 | This is tested and working for Nokia mobile phones, | 71 | This is tested and working for Nokia mobile phones, |
72 | it may work with others as well. | 72 | it may work with others as well. |
73 | (More info about that: -> Sync HowTo) | 73 | (More info about that: -> Sync HowTo) |
74 | 74 | ||
75 | NOTE: | 75 | NOTE: |
76 | When using SuSE 9.1 you have to update your KDE to 3.3.x | 76 | When using SuSE 9.1 you have to update your KDE to 3.3.x |
77 | and you have to make an online update in SuSE 9.1 to make it | 77 | and you have to make an online update in SuSE 9.1 to make it |
78 | possible to get the infrared connection working, such that | 78 | possible to get the infrared connection working, such that |
79 | you can sync your (Nokia) mobile phone via infrared. | 79 | you can sync your (Nokia) mobile phone via infrared. |
80 | 80 | ||
81 | %files | 81 | %files |
82 | /opt/kde3/share/applnk/PIM-pi/ | 82 | /opt/kde3/share/applnk/PIM-pi/ |
83 | /opt/kdepimpi/ | 83 | /opt/kdepimpi/ |
84 | /usr/lib/libmicro* | 84 | /usr/lib/libmicro* |
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index a05c60e..5f9ed92 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp | |||
@@ -137,602 +137,604 @@ KOAgendaItem::~KOAgendaItem() | |||
137 | void KOAgendaItem::recreateIncidence() | 137 | void KOAgendaItem::recreateIncidence() |
138 | { | 138 | { |
139 | #if 0 | 139 | #if 0 |
140 | Incidence* newInc = mIncidence->clone(); | 140 | Incidence* newInc = mIncidence->clone(); |
141 | newInc->recreate(); | 141 | newInc->recreate(); |
142 | if ( mIncidence->doesRecur() ) { | 142 | if ( mIncidence->doesRecur() ) { |
143 | mIncidence->addExDate( mDate ); | 143 | mIncidence->addExDate( mDate ); |
144 | newInc->recurrence()->unsetRecurs(); | 144 | newInc->recurrence()->unsetRecurs(); |
145 | int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); | 145 | int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); |
146 | QTime tim = mIncidence->dtStart().time(); | 146 | QTime tim = mIncidence->dtStart().time(); |
147 | newInc->setDtStart( QDateTime(mDate, tim) ); | 147 | newInc->setDtStart( QDateTime(mDate, tim) ); |
148 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); | 148 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); |
149 | } | 149 | } |
150 | #endif | 150 | #endif |
151 | mIncidence = mIncidence->recreateCloneException( mDate ); | 151 | mIncidence = mIncidence->recreateCloneException( mDate ); |
152 | } | 152 | } |
153 | bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) | 153 | bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) |
154 | { | 154 | { |
155 | int size = AGENDA_ICON_SIZE; | 155 | int size = AGENDA_ICON_SIZE; |
156 | 156 | ||
157 | int yOff = 0; | 157 | int yOff = 0; |
158 | int xOff = 0; | 158 | int xOff = 0; |
159 | int x = pos().x() +3; | 159 | int x = pos().x() +3; |
160 | int y; | 160 | int y; |
161 | if ( mAllDay ) | 161 | if ( mAllDay ) |
162 | y = pos().y()+3; | 162 | y = pos().y()+3; |
163 | else | 163 | else |
164 | y = mCellYTop * ( height() / cellHeight() ) +3; | 164 | y = mCellYTop * ( height() / cellHeight() ) +3; |
165 | if (mIncidence->cancelled()) { | 165 | if (mIncidence->cancelled()) { |
166 | int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x; | 166 | int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x; |
167 | int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y; | 167 | int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y; |
168 | p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 ); | 168 | p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 ); |
169 | p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos ); | 169 | p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos ); |
170 | if ( horLayout ) | 170 | if ( horLayout ) |
171 | ++xOff; | 171 | ++xOff; |
172 | else | 172 | else |
173 | ++yOff; | 173 | ++yOff; |
174 | } | 174 | } |
175 | if (mIncidence->isAlarmEnabled()) { | 175 | if (mIncidence->isAlarmEnabled()) { |
176 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red ); | 176 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red ); |
177 | if ( horLayout ) | 177 | if ( horLayout ) |
178 | ++xOff; | 178 | ++xOff; |
179 | else | 179 | else |
180 | ++yOff; | 180 | ++yOff; |
181 | } | 181 | } |
182 | if (mIncidence->recurrence()->doesRecur()) { | 182 | if (mIncidence->recurrence()->doesRecur()) { |
183 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue ); | 183 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue ); |
184 | if ( horLayout ) | 184 | if ( horLayout ) |
185 | ++xOff; | 185 | ++xOff; |
186 | else | 186 | else |
187 | ++yOff; | 187 | ++yOff; |
188 | } | 188 | } |
189 | if (mIncidence->description().length() > 0) { | 189 | if (mIncidence->description().length() > 0) { |
190 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen ); | 190 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen ); |
191 | if ( horLayout ) | 191 | if ( horLayout ) |
192 | ++xOff; | 192 | ++xOff; |
193 | else | 193 | else |
194 | ++yOff; | 194 | ++yOff; |
195 | } | 195 | } |
196 | if (mIncidence->isReadOnly()) { | 196 | if (mIncidence->isReadOnly()) { |
197 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white ); | 197 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white ); |
198 | if ( horLayout ) | 198 | if ( horLayout ) |
199 | ++xOff; | 199 | ++xOff; |
200 | else | 200 | else |
201 | ++yOff; | 201 | ++yOff; |
202 | } | 202 | } |
203 | 203 | ||
204 | if (mIncidence->attendeeCount()>0) { | 204 | if (mIncidence->attendeeCount()>0) { |
205 | 205 | ||
206 | if (mIncidence->organizer() == KOPrefs::instance()->email()) { | 206 | if (mIncidence->organizer() == KOPrefs::instance()->email()) { |
207 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black ); | 207 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black ); |
208 | if ( horLayout ) | 208 | if ( horLayout ) |
209 | ++xOff; | 209 | ++xOff; |
210 | else | 210 | else |
211 | ++yOff; | 211 | ++yOff; |
212 | } else { | 212 | } else { |
213 | Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); | 213 | Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); |
214 | if (me!=0) { | 214 | if (me!=0) { |
215 | 215 | ||
216 | 216 | ||
217 | } else { | 217 | } else { |
218 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow ); | 218 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow ); |
219 | if ( horLayout ) | 219 | if ( horLayout ) |
220 | ++xOff; | 220 | ++xOff; |
221 | else | 221 | else |
222 | ++yOff; | 222 | ++yOff; |
223 | 223 | ||
224 | } | 224 | } |
225 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow ); | 225 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow ); |
226 | if ( horLayout ) | 226 | if ( horLayout ) |
227 | ++xOff; | 227 | ++xOff; |
228 | else | 228 | else |
229 | ++yOff; | 229 | ++yOff; |
230 | 230 | ||
231 | } | 231 | } |
232 | 232 | ||
233 | } | 233 | } |
234 | return ( yOff || xOff ); | 234 | return ( yOff || xOff ); |
235 | } | 235 | } |
236 | 236 | ||
237 | 237 | ||
238 | void KOAgendaItem::select(bool selected) | 238 | void KOAgendaItem::select(bool selected) |
239 | { | 239 | { |
240 | //qDebug("select %d %d",firstMultiItem(), nextMultiItem() ); | 240 | //qDebug("select %d %d",firstMultiItem(), nextMultiItem() ); |
241 | if (mSelected == selected) return; | 241 | if (mSelected == selected) return; |
242 | mSelected = selected; | 242 | mSelected = selected; |
243 | if ( ! isVisible() ) | 243 | if ( ! isVisible() ) |
244 | return; | 244 | return; |
245 | if ( firstMultiItem() ) | 245 | if ( firstMultiItem() ) |
246 | firstMultiItem()->select( selected ); | 246 | firstMultiItem()->select( selected ); |
247 | if ( !firstMultiItem() && nextMultiItem() ) { | 247 | if ( !firstMultiItem() && nextMultiItem() ) { |
248 | KOAgendaItem * placeItem = nextMultiItem(); | 248 | KOAgendaItem * placeItem = nextMultiItem(); |
249 | while ( placeItem ) { | 249 | while ( placeItem ) { |
250 | placeItem->select( selected ); | 250 | placeItem->select( selected ); |
251 | placeItem = placeItem->nextMultiItem(); | 251 | placeItem = placeItem->nextMultiItem(); |
252 | } | 252 | } |
253 | } | 253 | } |
254 | globalFlagBlockAgendaItemUpdate = 0; | 254 | globalFlagBlockAgendaItemUpdate = 0; |
255 | paintMe( selected ); | 255 | paintMe( selected ); |
256 | globalFlagBlockAgendaItemUpdate = 1; | 256 | globalFlagBlockAgendaItemUpdate = 1; |
257 | repaint( false ); | 257 | repaint( false ); |
258 | } | 258 | } |
259 | 259 | ||
260 | 260 | ||
261 | /* | 261 | /* |
262 | The eventFilter has to filter the mouse events of the agenda item childs. The | 262 | The eventFilter has to filter the mouse events of the agenda item childs. The |
263 | events are fed into the event handling method of KOAgendaItem. This allows the | 263 | events are fed into the event handling method of KOAgendaItem. This allows the |
264 | KOAgenda to handle the KOAgendaItems by using an eventFilter. | 264 | KOAgenda to handle the KOAgendaItems by using an eventFilter. |
265 | */ | 265 | */ |
266 | bool KOAgendaItem::eventFilter ( QObject *object, QEvent *e ) | 266 | bool KOAgendaItem::eventFilter ( QObject *object, QEvent *e ) |
267 | { | 267 | { |
268 | if (e->type() == QEvent::MouseButtonPress || | 268 | if (e->type() == QEvent::MouseButtonPress || |
269 | e->type() == QEvent::MouseButtonDblClick || | 269 | e->type() == QEvent::MouseButtonDblClick || |
270 | e->type() == QEvent::MouseButtonRelease || | 270 | e->type() == QEvent::MouseButtonRelease || |
271 | e->type() == QEvent::MouseMove) { | 271 | e->type() == QEvent::MouseMove) { |
272 | QMouseEvent *me = (QMouseEvent *)e; | 272 | QMouseEvent *me = (QMouseEvent *)e; |
273 | QPoint itemPos = this->mapFromGlobal(((QWidget *)object)-> | 273 | QPoint itemPos = this->mapFromGlobal(((QWidget *)object)-> |
274 | mapToGlobal(me->pos())); | 274 | mapToGlobal(me->pos())); |
275 | QMouseEvent returnEvent (e->type(),itemPos,me->button(),me->state()); | 275 | QMouseEvent returnEvent (e->type(),itemPos,me->button(),me->state()); |
276 | return event(&returnEvent); | 276 | return event(&returnEvent); |
277 | } else { | 277 | } else { |
278 | return false; | 278 | return false; |
279 | } | 279 | } |
280 | } | 280 | } |
281 | void KOAgendaItem::repaintMe( ) | 281 | void KOAgendaItem::repaintMe( ) |
282 | { | 282 | { |
283 | paintMe ( mSelected ); | 283 | paintMe ( mSelected ); |
284 | } | 284 | } |
285 | void KOAgendaItem::paintMe( bool selected, QPainter* paint ) | 285 | void KOAgendaItem::paintMe( bool selected, QPainter* paint ) |
286 | { | 286 | { |
287 | if ( globalFlagBlockAgendaItemUpdate && ! selected) | 287 | if ( globalFlagBlockAgendaItemUpdate && ! selected) |
288 | return; | 288 | return; |
289 | QPainter pa; | 289 | QPainter pa; |
290 | 290 | ||
291 | if ( mSelected ) { | 291 | if ( mSelected ) { |
292 | pa.begin( paintPixSel() ); | 292 | pa.begin( paintPixSel() ); |
293 | } else { | 293 | } else { |
294 | if ( mAllDay ) | 294 | if ( mAllDay ) |
295 | pa.begin( paintPixAllday() ); | 295 | pa.begin( paintPixAllday() ); |
296 | else | 296 | else |
297 | pa.begin( paintPix() ); | 297 | pa.begin( paintPix() ); |
298 | } | 298 | } |
299 | int x, yy, w, h; | 299 | int x, yy, w, h; |
300 | float nfh; | 300 | float nfh; |
301 | x = pos().x(); w = width(); h = height (); | 301 | x = pos().x(); w = width(); h = height (); |
302 | if ( mAllDay ) | 302 | if ( mAllDay ) |
303 | yy = y(); | 303 | yy = y(); |
304 | else | 304 | else |
305 | yy = mCellYTop * ( height() / cellHeight() ); | 305 | yy = mCellYTop * ( height() / cellHeight() ); |
306 | xPaintCoord= x; | 306 | xPaintCoord= x; |
307 | yPaintCoord = yy; | 307 | yPaintCoord = yy; |
308 | wPaintCoord = width(); | 308 | wPaintCoord = width(); |
309 | hPaintCoord = height(); | 309 | hPaintCoord = height(); |
310 | //qDebug("paintMe %s %d %d %d %d",incidence()->summary().latin1(), x, yy, width(), height()); | 310 | //qDebug("paintMe %s %d %d %d %d",incidence()->summary().latin1(), x, yy, width(), height()); |
311 | if ( paint == 0 ) | 311 | if ( paint == 0 ) |
312 | paint = &pa; | 312 | paint = &pa; |
313 | bool horLayout = ( w < h ); | 313 | bool horLayout = ( w < h ); |
314 | int maxhei = mFontPixelSize+4; | 314 | int maxhei = mFontPixelSize+4; |
315 | if ( horLayout ) | 315 | if ( horLayout ) |
316 | maxhei += AGENDA_ICON_SIZE -4; | 316 | maxhei += AGENDA_ICON_SIZE -4; |
317 | bool small = ( h < maxhei ); | 317 | bool small = ( h < maxhei ); |
318 | if ( ! small ) | 318 | if ( ! small ) |
319 | paint->setFont(KOPrefs::instance()->mAgendaViewFont); | 319 | paint->setFont(KOPrefs::instance()->mAgendaViewFont); |
320 | else { | 320 | else { |
321 | QFont f = KOPrefs::instance()->mAgendaViewFont; | 321 | QFont f = KOPrefs::instance()->mAgendaViewFont; |
322 | f.setBold( false ); | 322 | f.setBold( false ); |
323 | int fh = f.pointSize(); | 323 | int fh = f.pointSize(); |
324 | nfh = (((float)height())/(float)(mFontPixelSize+4))*fh; | 324 | nfh = (((float)height())/(float)(mFontPixelSize+4))*fh; |
325 | if ( nfh < 6 ) | 325 | if ( nfh < 6 ) |
326 | nfh = 6; | 326 | nfh = 6; |
327 | f.setPointSize( nfh ); | 327 | f.setPointSize( nfh ); |
328 | paint->setFont(f); | 328 | paint->setFont(f); |
329 | } | 329 | } |
330 | paint->fillRect ( x, yy, w, h, mBackgroundColor ); | 330 | paint->fillRect ( x, yy, w, h, mBackgroundColor ); |
331 | static const QPixmap completedPxmp = SmallIcon("greenhook16"); | 331 | static const QPixmap completedPxmp = SmallIcon("greenhook16"); |
332 | static const QPixmap overduePxmp = SmallIcon("redcross16"); | 332 | static const QPixmap overduePxmp = SmallIcon("redcross16"); |
333 | if ( mIncidence->type() == "Todo" ) { | 333 | if ( mIncidence->type() == "Todo" ) { |
334 | Todo* tempTodo = static_cast<Todo*>(mIncidence); | 334 | Todo* tempTodo = static_cast<Todo*>(mIncidence); |
335 | int xx = pos().x()+(width()-completedPxmp.width()-3 ); | 335 | int xx = pos().x()+(width()-completedPxmp.width()-3 ); |
336 | int yyy = yy+3; | 336 | int yyy = yy+3; |
337 | if ( tempTodo->isCompleted() ) | 337 | if ( tempTodo->isCompleted() ) |
338 | paint->drawPixmap ( xx, yyy, completedPxmp ); | 338 | paint->drawPixmap ( xx, yyy, completedPxmp ); |
339 | else { | 339 | else { |
340 | paint->drawPixmap ( xx, yyy, overduePxmp ); | 340 | paint->drawPixmap ( xx, yyy, overduePxmp ); |
341 | 341 | ||
342 | } | 342 | } |
343 | } | 343 | } |
344 | bool addIcon = false; | 344 | bool addIcon = false; |
345 | if ( ! small || w > 3 * h || h > 3* w ) | 345 | if ( ! small || w > 3 * h || h > 3* w ) |
346 | addIcon = updateIcons( paint, horLayout ); | 346 | addIcon = updateIcons( paint, horLayout ); |
347 | 347 | ||
348 | qDrawShadePanel (paint, x, yy, w, h, mColorGroup, selected , 2, 0); | 348 | qDrawShadePanel (paint, x, yy, w, h, mColorGroup, selected , 2, 0); |
349 | //qDebug("draw rect %d %d %d %d ",x, yy, w, h ); | 349 | //qDebug("draw rect %d %d %d %d ",x, yy, w, h ); |
350 | if ( ! small ) { | 350 | if ( ! small ) { |
351 | x += 3; yy += 3;w -= 6; h-= 5; | 351 | x += 3; yy += 3;w -= 6; h-= 5; |
352 | } else { | 352 | } else { |
353 | x += 2; yy += 1;w -= 4; h-= 4; | 353 | x += 2; yy += 1;w -= 4; h-= 4; |
354 | if ( nfh < 6.01 ) { | 354 | if ( nfh < 6.01 ) { |
355 | yy -= 2; | 355 | yy -= 2; |
356 | h += 4; | 356 | h += 4; |
357 | } | 357 | } |
358 | else | 358 | else |
359 | if ( nfh < h -2 ) | 359 | if ( nfh < h -2 ) |
360 | ++yy; | 360 | ++yy; |
361 | } | 361 | } |
362 | int align; | 362 | int align; |
363 | #ifndef DESKTOP_VERSION | 363 | #ifndef DESKTOP_VERSION |
364 | align = ( AlignLeft|WordBreak|AlignTop); | 364 | align = ( AlignLeft|WordBreak|AlignTop); |
365 | #else | 365 | #else |
366 | align = ( AlignLeft|BreakAnywhere|WordBreak|AlignTop); | 366 | align = ( AlignLeft|BreakAnywhere|WordBreak|AlignTop); |
367 | #endif | 367 | #endif |
368 | if ( addIcon ) { | 368 | if ( addIcon ) { |
369 | if ( ! horLayout ) { | 369 | if ( ! horLayout ) { |
370 | x += AGENDA_ICON_SIZE+3; | 370 | x += AGENDA_ICON_SIZE+3; |
371 | w -= (AGENDA_ICON_SIZE+3); | 371 | w -= (AGENDA_ICON_SIZE+3); |
372 | } | 372 | } |
373 | else { | 373 | else { |
374 | yy+= AGENDA_ICON_SIZE+2; | 374 | yy+= AGENDA_ICON_SIZE+2; |
375 | h -=(AGENDA_ICON_SIZE+3); | 375 | h -=(AGENDA_ICON_SIZE+3); |
376 | } | 376 | } |
377 | } | 377 | } |
378 | int colsum = mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue(); | 378 | int colsum = mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue(); |
379 | if ( colsum < 250 ) | 379 | if ( colsum < 250 ) |
380 | paint->setPen ( white); | 380 | paint->setPen ( white); |
381 | if ( x < 0 ) { | 381 | if ( x < 0 ) { |
382 | w = w+x-3; | 382 | w = w+x-3; |
383 | x = 3; | 383 | x = 3; |
384 | if ( w > parentWidget()->width() ){ | 384 | if ( w > parentWidget()->width() ){ |
385 | w = parentWidget()->width() - 6; | 385 | w = parentWidget()->width() - 6; |
386 | #ifndef DESKTOP_VERSION | 386 | #ifndef DESKTOP_VERSION |
387 | align = ( AlignCenter|WordBreak); | 387 | align = ( AlignCenter|WordBreak); |
388 | #else | 388 | #else |
389 | align = ( AlignCenter|BreakAnywhere|WordBreak); | 389 | align = ( AlignCenter|BreakAnywhere|WordBreak); |
390 | #endif | 390 | #endif |
391 | 391 | ||
392 | } | 392 | } |
393 | } | 393 | } |
394 | QRect dr; | 394 | QRect dr; |
395 | paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr ); | 395 | paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr ); |
396 | if ( mIncidence->cancelled() ){ | 396 | if ( mIncidence->cancelled() ){ |
397 | if ( ! small ) { | 397 | if ( ! small ) { |
398 | QFontMetrics fm ( paint->font() ); | 398 | QFontMetrics fm ( paint->font() ); |
399 | paint->drawLine(dr.left(), yy+fm.height()/2, dr.right()-2, yy+fm.height()/2); | 399 | paint->drawLine(dr.left(), yy+fm.height()/2, dr.right()-2, yy+fm.height()/2); |
400 | } | 400 | } |
401 | 401 | ||
402 | } | 402 | } |
403 | pa.end(); | 403 | pa.end(); |
404 | 404 | ||
405 | } | 405 | } |
406 | void KOAgendaItem::resizePixmap( int w , int h ) | 406 | void KOAgendaItem::resizePixmap( int w , int h ) |
407 | { | 407 | { |
408 | paintPix()->resize( w, h ); | 408 | paintPix()->resize( w, h ); |
409 | paintPixSel()->resize( w, h ); | 409 | paintPixSel()->resize( w, h ); |
410 | 410 | ||
411 | } | 411 | } |
412 | QPixmap * KOAgendaItem::paintPix() | 412 | QPixmap * KOAgendaItem::paintPix() |
413 | { | 413 | { |
414 | static QPixmap* mPaintPix = 0; | 414 | static QPixmap* mPaintPix = 0; |
415 | if ( ! mPaintPix ) | 415 | if ( ! mPaintPix ) |
416 | mPaintPix = new QPixmap(1,1); | 416 | mPaintPix = new QPixmap(1,1); |
417 | return mPaintPix ; | 417 | return mPaintPix ; |
418 | } | 418 | } |
419 | QPixmap * KOAgendaItem::paintPixAllday() | 419 | QPixmap * KOAgendaItem::paintPixAllday() |
420 | { | 420 | { |
421 | static QPixmap* mPaintPixA = 0; | 421 | static QPixmap* mPaintPixA = 0; |
422 | if ( ! mPaintPixA ) | 422 | if ( ! mPaintPixA ) |
423 | mPaintPixA = new QPixmap(1,1); | 423 | mPaintPixA = new QPixmap(1,1); |
424 | return mPaintPixA ; | 424 | return mPaintPixA ; |
425 | } | 425 | } |
426 | QPixmap * KOAgendaItem::paintPixSel() | 426 | QPixmap * KOAgendaItem::paintPixSel() |
427 | { | 427 | { |
428 | static QPixmap* mPaintPixSel = 0; | 428 | static QPixmap* mPaintPixSel = 0; |
429 | if ( ! mPaintPixSel ) | 429 | if ( ! mPaintPixSel ) |
430 | mPaintPixSel = new QPixmap(1,1); | 430 | mPaintPixSel = new QPixmap(1,1); |
431 | return mPaintPixSel ; | 431 | return mPaintPixSel ; |
432 | } | 432 | } |
433 | void KOAgendaItem::paintEvent ( QPaintEvent *e ) | 433 | void KOAgendaItem::paintEvent ( QPaintEvent *e ) |
434 | { | 434 | { |
435 | 435 | ||
436 | if ( globalFlagBlockAgendaItemPaint ) | 436 | if ( globalFlagBlockAgendaItemPaint ) |
437 | return; | 437 | return; |
438 | if ( globalFlagBlockAgenda > 0 && globalFlagBlockAgenda < 5 ) | 438 | if ( globalFlagBlockAgenda > 0 && globalFlagBlockAgenda < 5 ) |
439 | return; | 439 | return; |
440 | int yy; | 440 | int yy; |
441 | if ( mAllDay ) | 441 | if ( mAllDay ) |
442 | yy = y(); | 442 | yy = y(); |
443 | else | 443 | else |
444 | yy = mCellYTop * ( height() / cellHeight() ); | 444 | yy = mCellYTop * ( height() / cellHeight() ); |
445 | int xx = x(); | 445 | int xx = x(); |
446 | if ( xPaintCoord != xx || yPaintCoord != yy || | 446 | if ( xPaintCoord != xx || yPaintCoord != yy || |
447 | wPaintCoord != width() || hPaintCoord != height()) { | 447 | wPaintCoord != width() || hPaintCoord != height()) { |
448 | xPaintCoord= xx; | 448 | xPaintCoord= xx; |
449 | yPaintCoord = yy; | 449 | yPaintCoord = yy; |
450 | wPaintCoord = width(); | 450 | wPaintCoord = width(); |
451 | hPaintCoord = height(); | 451 | hPaintCoord = height(); |
452 | globalFlagBlockAgendaItemUpdate = 0; | 452 | globalFlagBlockAgendaItemUpdate = 0; |
453 | paintMe( mSelected ); | 453 | paintMe( mSelected ); |
454 | //qDebug("calling paintMe "); | 454 | //qDebug("calling paintMe "); |
455 | globalFlagBlockAgendaItemUpdate = 1; | 455 | globalFlagBlockAgendaItemUpdate = 1; |
456 | } | 456 | } |
457 | int rx, ry, rw, rh; | 457 | int rx, ry, rw, rh; |
458 | rx = e->rect().x(); | 458 | rx = e->rect().x(); |
459 | ry = e->rect().y(); | 459 | ry = e->rect().y(); |
460 | rw = e->rect().width(); | 460 | rw = e->rect().width(); |
461 | rh = e->rect().height(); | 461 | rh = e->rect().height(); |
462 | //qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height()); | 462 | //qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height()); |
463 | 463 | ||
464 | QPixmap* paintFrom ; | 464 | QPixmap* paintFrom ; |
465 | if ( mSelected ) { | 465 | if ( mSelected ) { |
466 | paintFrom = paintPixSel(); | 466 | paintFrom = paintPixSel(); |
467 | } else { | 467 | } else { |
468 | if ( mAllDay ) | 468 | if ( mAllDay ) |
469 | paintFrom = paintPixAllday(); | 469 | paintFrom = paintPixAllday(); |
470 | else | 470 | else |
471 | paintFrom = paintPix(); | 471 | paintFrom = paintPix(); |
472 | } | 472 | } |
473 | bitBlt (this, rx, ry, paintFrom, x()+rx ,yPaintCoord+ry, rw, rh ,CopyROP); | 473 | bitBlt (this, rx, ry, paintFrom, x()+rx ,yPaintCoord+ry, rw, rh ,CopyROP); |
474 | } | 474 | } |
475 | void KOAgendaItem::computeText() | 475 | void KOAgendaItem::computeText() |
476 | { | 476 | { |
477 | 477 | ||
478 | mDisplayedText = mIncidence->summary(); | 478 | mDisplayedText = mIncidence->summary(); |
479 | if ( (mIncidence->type() == "Todo") ) { | 479 | if ( (mIncidence->type() == "Todo") ) { |
480 | if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) { | 480 | if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) { |
481 | if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() ) | 481 | if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() ) |
482 | mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")"; | 482 | mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")"; |
483 | else if ( !(mIncidence->doesFloat())) | 483 | else if ( !(mIncidence->doesFloat())) |
484 | mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")"; | 484 | mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")"; |
485 | } | 485 | } |
486 | } else { | 486 | } else { |
487 | if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda) | 487 | if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda) |
488 | mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + "-" + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ; | 488 | mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + "-" + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ; |
489 | 489 | ||
490 | if ( mAllDay ) { | 490 | if ( mAllDay ) { |
491 | if ( mIncidence->dtStart().date().addDays(3) < mIncidence->dtEnd().date() ) { | 491 | if ( mIncidence->dtStart().date().addDays(3) < mIncidence->dtEnd().date() ) { |
492 | mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtEnd().date(), true) ; | 492 | mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtEnd().date(), true) ; |
493 | } | 493 | } |
494 | } | 494 | } |
495 | 495 | ||
496 | } | 496 | } |
497 | 497 | ||
498 | if ( !mIncidence->location().isEmpty() ) { | 498 | if ( !mIncidence->location().isEmpty() ) { |
499 | if ( mAllDay ) | 499 | if ( mAllDay ) |
500 | mDisplayedText += " ("; | 500 | mDisplayedText += " ("; |
501 | else | 501 | else |
502 | mDisplayedText += "\n("; | 502 | mDisplayedText += "\n("; |
503 | mDisplayedText += mIncidence->location() +")"; | 503 | mDisplayedText += mIncidence->location() +")"; |
504 | } | 504 | } |
505 | 505 | ||
506 | QString tipText = mIncidence->summary(); | 506 | QString tipText = mIncidence->summary(); |
507 | QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); | 507 | QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); |
508 | if ( !mIncidence->doesFloat() ) { | 508 | if ( !mIncidence->doesFloat() ) { |
509 | if ( mIncidence->type() == "Event" ) { | 509 | if ( mIncidence->type() == "Event" ) { |
510 | if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) { | 510 | if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) { |
511 | tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr(); | 511 | tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr(); |
512 | tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr(); | 512 | tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr(); |
513 | } | 513 | } |
514 | else { | 514 | else { |
515 | tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr(); | 515 | tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr(); |
516 | tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr(); | 516 | tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr(); |
517 | } | 517 | } |
518 | } | 518 | } |
519 | else if ( mIncidence->type() == "Todo" ) { | 519 | else if ( mIncidence->type() == "Todo" ) { |
520 | if (mIncidence->hasStartDate()) | 520 | if (mIncidence->hasStartDate()) |
521 | tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartStr(); | 521 | tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartStr(); |
522 | tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueStr(); | 522 | if (((Todo*)mIncidence)->hasDueDate()) |
523 | tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueStr(); | ||
523 | } | 524 | } |
524 | } else if ( mIncidence->type() == "Todo" ) { | 525 | } else if ( mIncidence->type() == "Todo" ) { |
525 | if (mIncidence->hasStartDate()) | 526 | if (mIncidence->hasStartDate()) |
526 | tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartDateStr(); | 527 | tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartDateStr(); |
527 | tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueDateStr(); | 528 | if (((Todo*)mIncidence)->hasDueDate()) |
529 | tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueDateStr(); | ||
528 | } | 530 | } |
529 | 531 | ||
530 | if (!mIncidence->location().isEmpty()) { | 532 | if (!mIncidence->location().isEmpty()) { |
531 | tipText += "\n"+i18n("Location: ")+mIncidence->location(); | 533 | tipText += "\n"+i18n("Location: ")+mIncidence->location(); |
532 | } | 534 | } |
533 | QToolTip::add(this,tipText,toolTipGroup(),""); | 535 | QToolTip::add(this,tipText,toolTipGroup(),""); |
534 | 536 | ||
535 | } | 537 | } |
536 | void KOAgendaItem::updateItem() | 538 | void KOAgendaItem::updateItem() |
537 | { | 539 | { |
538 | computeText(); | 540 | computeText(); |
539 | 541 | ||
540 | //qDebug("KOAgendaItem:: updateItem() %s %d %d ",incidence()->summary().latin1(), x(), y()); | 542 | //qDebug("KOAgendaItem:: updateItem() %s %d %d ",incidence()->summary().latin1(), x(), y()); |
541 | paintMe( mSelected ); | 543 | paintMe( mSelected ); |
542 | repaint( false); | 544 | repaint( false); |
543 | } | 545 | } |
544 | 546 | ||
545 | void KOAgendaItem::resizeEvent ( QResizeEvent *ev ) | 547 | void KOAgendaItem::resizeEvent ( QResizeEvent *ev ) |
546 | { | 548 | { |
547 | //qDebug("KOAgendaItem::resizeEvent %s ", mIncidence->summary().latin1()); | 549 | //qDebug("KOAgendaItem::resizeEvent %s ", mIncidence->summary().latin1()); |
548 | paintMe( mSelected ); | 550 | paintMe( mSelected ); |
549 | repaint( false ); | 551 | repaint( false ); |
550 | } | 552 | } |
551 | 553 | ||
552 | /* | 554 | /* |
553 | Return height of item in units of agenda cells | 555 | Return height of item in units of agenda cells |
554 | */ | 556 | */ |
555 | int KOAgendaItem::cellHeight() | 557 | int KOAgendaItem::cellHeight() |
556 | { | 558 | { |
557 | int ret = mCellYBottom - mCellYTop + 1; | 559 | int ret = mCellYBottom - mCellYTop + 1; |
558 | if ( ret <= 0 ) { | 560 | if ( ret <= 0 ) { |
559 | ret = 1; | 561 | ret = 1; |
560 | mCellYBottom = 0; | 562 | mCellYBottom = 0; |
561 | mCellYTop = 0; | 563 | mCellYTop = 0; |
562 | } | 564 | } |
563 | return ret; | 565 | return ret; |
564 | } | 566 | } |
565 | 567 | ||
566 | /* | 568 | /* |
567 | Return height of item in units of agenda cells | 569 | Return height of item in units of agenda cells |
568 | */ | 570 | */ |
569 | int KOAgendaItem::cellWidth() | 571 | int KOAgendaItem::cellWidth() |
570 | { | 572 | { |
571 | return mCellXWidth - mCellX + 1; | 573 | return mCellXWidth - mCellX + 1; |
572 | } | 574 | } |
573 | 575 | ||
574 | void KOAgendaItem::setItemDate(QDate qd) | 576 | void KOAgendaItem::setItemDate(QDate qd) |
575 | { | 577 | { |
576 | mDate = qd; | 578 | mDate = qd; |
577 | } | 579 | } |
578 | 580 | ||
579 | void KOAgendaItem::setCellXY(int X, int YTop, int YBottom) | 581 | void KOAgendaItem::setCellXY(int X, int YTop, int YBottom) |
580 | { | 582 | { |
581 | mCellX = X; | 583 | mCellX = X; |
582 | mCellYTop = YTop; | 584 | mCellYTop = YTop; |
583 | mCellYBottom = YBottom; | 585 | mCellYBottom = YBottom; |
584 | } | 586 | } |
585 | 587 | ||
586 | void KOAgendaItem::setCellXWidth(int xwidth) | 588 | void KOAgendaItem::setCellXWidth(int xwidth) |
587 | { | 589 | { |
588 | mCellXWidth = xwidth; | 590 | mCellXWidth = xwidth; |
589 | } | 591 | } |
590 | 592 | ||
591 | void KOAgendaItem::setCellX(int XLeft, int XRight) | 593 | void KOAgendaItem::setCellX(int XLeft, int XRight) |
592 | { | 594 | { |
593 | mCellX = XLeft; | 595 | mCellX = XLeft; |
594 | mCellXWidth = XRight; | 596 | mCellXWidth = XRight; |
595 | } | 597 | } |
596 | 598 | ||
597 | void KOAgendaItem::setCellY(int YTop, int YBottom) | 599 | void KOAgendaItem::setCellY(int YTop, int YBottom) |
598 | { | 600 | { |
599 | mCellYTop = YTop; | 601 | mCellYTop = YTop; |
600 | mCellYBottom = YBottom; | 602 | mCellYBottom = YBottom; |
601 | } | 603 | } |
602 | 604 | ||
603 | void KOAgendaItem::setSubCell(int subCell) | 605 | void KOAgendaItem::setSubCell(int subCell) |
604 | { | 606 | { |
605 | mSubCell = subCell; | 607 | mSubCell = subCell; |
606 | } | 608 | } |
607 | 609 | ||
608 | void KOAgendaItem::setSubCells(int subCells) | 610 | void KOAgendaItem::setSubCells(int subCells) |
609 | { | 611 | { |
610 | mSubCells = subCells; | 612 | mSubCells = subCells; |
611 | } | 613 | } |
612 | 614 | ||
613 | void KOAgendaItem::setMultiItem(KOAgendaItem *first,KOAgendaItem *next, | 615 | void KOAgendaItem::setMultiItem(KOAgendaItem *first,KOAgendaItem *next, |
614 | KOAgendaItem *last) | 616 | KOAgendaItem *last) |
615 | { | 617 | { |
616 | mFirstMultiItem = first; | 618 | mFirstMultiItem = first; |
617 | mNextMultiItem = next; | 619 | mNextMultiItem = next; |
618 | mLastMultiItem = last; | 620 | mLastMultiItem = last; |
619 | } | 621 | } |
620 | 622 | ||
621 | void KOAgendaItem::startMove() | 623 | void KOAgendaItem::startMove() |
622 | { | 624 | { |
623 | mStartCellX = mCellX; | 625 | mStartCellX = mCellX; |
624 | mStartCellXWidth = mCellXWidth; | 626 | mStartCellXWidth = mCellXWidth; |
625 | mStartCellYTop = mCellYTop; | 627 | mStartCellYTop = mCellYTop; |
626 | mStartCellYBottom = mCellYBottom; | 628 | mStartCellYBottom = mCellYBottom; |
627 | } | 629 | } |
628 | 630 | ||
629 | void KOAgendaItem::resetMove() | 631 | void KOAgendaItem::resetMove() |
630 | { | 632 | { |
631 | mCellX = mStartCellX; | 633 | mCellX = mStartCellX; |
632 | mCellXWidth = mStartCellXWidth; | 634 | mCellXWidth = mStartCellXWidth; |
633 | mCellYTop = mStartCellYTop; | 635 | mCellYTop = mStartCellYTop; |
634 | mCellYBottom = mStartCellYBottom; | 636 | mCellYBottom = mStartCellYBottom; |
635 | } | 637 | } |
636 | 638 | ||
637 | void KOAgendaItem::moveRelative(int dx, int dy) | 639 | void KOAgendaItem::moveRelative(int dx, int dy) |
638 | { | 640 | { |
639 | int newX = cellX() + dx; | 641 | int newX = cellX() + dx; |
640 | int newXWidth = cellXWidth() + dx; | 642 | int newXWidth = cellXWidth() + dx; |
641 | int newYTop = cellYTop() + dy; | 643 | int newYTop = cellYTop() + dy; |
642 | int newYBottom = cellYBottom() + dy; | 644 | int newYBottom = cellYBottom() + dy; |
643 | setCellXY(newX,newYTop,newYBottom); | 645 | setCellXY(newX,newYTop,newYBottom); |
644 | setCellXWidth(newXWidth); | 646 | setCellXWidth(newXWidth); |
645 | } | 647 | } |
646 | 648 | ||
647 | void KOAgendaItem::expandTop(int dy) | 649 | void KOAgendaItem::expandTop(int dy) |
648 | { | 650 | { |
649 | int newYTop = cellYTop() + dy; | 651 | int newYTop = cellYTop() + dy; |
650 | int newYBottom = cellYBottom(); | 652 | int newYBottom = cellYBottom(); |
651 | if (newYTop > newYBottom) newYTop = newYBottom; | 653 | if (newYTop > newYBottom) newYTop = newYBottom; |
652 | setCellY(newYTop, newYBottom); | 654 | setCellY(newYTop, newYBottom); |
653 | } | 655 | } |
654 | 656 | ||
655 | void KOAgendaItem::expandBottom(int dy) | 657 | void KOAgendaItem::expandBottom(int dy) |
656 | { | 658 | { |
657 | int newYTop = cellYTop(); | 659 | int newYTop = cellYTop(); |
658 | int newYBottom = cellYBottom() + dy; | 660 | int newYBottom = cellYBottom() + dy; |
659 | if (newYBottom < newYTop) newYBottom = newYTop; | 661 | if (newYBottom < newYTop) newYBottom = newYTop; |
660 | setCellY(newYTop, newYBottom); | 662 | setCellY(newYTop, newYBottom); |
661 | } | 663 | } |
662 | 664 | ||
663 | void KOAgendaItem::expandLeft(int dx) | 665 | void KOAgendaItem::expandLeft(int dx) |
664 | { | 666 | { |
665 | int newX = cellX() + dx; | 667 | int newX = cellX() + dx; |
666 | int newXWidth = cellXWidth(); | 668 | int newXWidth = cellXWidth(); |
667 | if (newX > newXWidth) newX = newXWidth; | 669 | if (newX > newXWidth) newX = newXWidth; |
668 | setCellX(newX,newXWidth); | 670 | setCellX(newX,newXWidth); |
669 | } | 671 | } |
670 | 672 | ||
671 | void KOAgendaItem::expandRight(int dx) | 673 | void KOAgendaItem::expandRight(int dx) |
672 | { | 674 | { |
673 | int newX = cellX(); | 675 | int newX = cellX(); |
674 | int newXWidth = cellXWidth() + dx; | 676 | int newXWidth = cellXWidth() + dx; |
675 | if (newXWidth < newX) newXWidth = newX; | 677 | if (newXWidth < newX) newXWidth = newX; |
676 | setCellX(newX,newXWidth); | 678 | setCellX(newX,newXWidth); |
677 | } | 679 | } |
678 | 680 | ||
679 | QToolTipGroup *KOAgendaItem::toolTipGroup() | 681 | QToolTipGroup *KOAgendaItem::toolTipGroup() |
680 | { | 682 | { |
681 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); | 683 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); |
682 | return mToolTipGroup; | 684 | return mToolTipGroup; |
683 | } | 685 | } |
684 | 686 | ||
685 | void KOAgendaItem::dragEnterEvent( QDragEnterEvent *e ) | 687 | void KOAgendaItem::dragEnterEvent( QDragEnterEvent *e ) |
686 | { | 688 | { |
687 | #ifndef KORG_NODND | 689 | #ifndef KORG_NODND |
688 | if ( ICalDrag::canDecode( e ) || VCalDrag::canDecode( e ) || | 690 | if ( ICalDrag::canDecode( e ) || VCalDrag::canDecode( e ) || |
689 | !QTextDrag::canDecode( e ) ) { | 691 | !QTextDrag::canDecode( e ) ) { |
690 | e->ignore(); | 692 | e->ignore(); |
691 | return; | 693 | return; |
692 | } | 694 | } |
693 | e->accept(); | 695 | e->accept(); |
694 | #endif | 696 | #endif |
695 | } | 697 | } |
696 | 698 | ||
697 | void KOAgendaItem::dropEvent( QDropEvent *e ) | 699 | void KOAgendaItem::dropEvent( QDropEvent *e ) |
698 | { | 700 | { |
699 | #ifndef KORG_NODND | 701 | #ifndef KORG_NODND |
700 | QString text; | 702 | QString text; |
701 | if(QTextDrag::decode(e,text)) | 703 | if(QTextDrag::decode(e,text)) |
702 | { | 704 | { |
703 | kdDebug() << "Dropped : " << text << endl; | 705 | kdDebug() << "Dropped : " << text << endl; |
704 | QStringList emails = QStringList::split(",",text); | 706 | QStringList emails = QStringList::split(",",text); |
705 | for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { | 707 | for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { |
706 | kdDebug() << " Email: " << (*it) << endl; | 708 | kdDebug() << " Email: " << (*it) << endl; |
707 | int pos = (*it).find("<"); | 709 | int pos = (*it).find("<"); |
708 | QString name = (*it).left(pos); | 710 | QString name = (*it).left(pos); |
709 | QString email = (*it).mid(pos); | 711 | QString email = (*it).mid(pos); |
710 | if (!email.isEmpty()) { | 712 | if (!email.isEmpty()) { |
711 | mIncidence->addAttendee(new Attendee(name,email)); | 713 | mIncidence->addAttendee(new Attendee(name,email)); |
712 | } | 714 | } |
713 | } | 715 | } |
714 | } | 716 | } |
715 | #endif | 717 | #endif |
716 | } | 718 | } |
717 | 719 | ||
718 | 720 | ||
719 | QPtrList<KOAgendaItem> KOAgendaItem::conflictItems() | 721 | QPtrList<KOAgendaItem> KOAgendaItem::conflictItems() |
720 | { | 722 | { |
721 | return mConflictItems; | 723 | return mConflictItems; |
722 | } | 724 | } |
723 | 725 | ||
724 | void KOAgendaItem::setConflictItems(QPtrList<KOAgendaItem> ci) | 726 | void KOAgendaItem::setConflictItems(QPtrList<KOAgendaItem> ci) |
725 | { | 727 | { |
726 | mConflictItems = ci; | 728 | mConflictItems = ci; |
727 | KOAgendaItem *item; | 729 | KOAgendaItem *item; |
728 | for ( item=mConflictItems.first(); item != 0; | 730 | for ( item=mConflictItems.first(); item != 0; |
729 | item=mConflictItems.next() ) { | 731 | item=mConflictItems.next() ) { |
730 | item->addConflictItem(this); | 732 | item->addConflictItem(this); |
731 | } | 733 | } |
732 | } | 734 | } |
733 | 735 | ||
734 | void KOAgendaItem::addConflictItem(KOAgendaItem *ci) | 736 | void KOAgendaItem::addConflictItem(KOAgendaItem *ci) |
735 | { | 737 | { |
736 | if (mConflictItems.find(ci)<0) | 738 | if (mConflictItems.find(ci)<0) |
737 | mConflictItems.append(ci); | 739 | mConflictItems.append(ci); |
738 | } | 740 | } |