author | zautrix <zautrix> | 2005-03-21 09:12:37 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-21 09:12:37 (UTC) |
commit | cd02f3880c5567a4bbb7b56e7034787005df7da8 (patch) (unidiff) | |
tree | e55e325b4688733b59232363c1d9c8e1eddb691d | |
parent | 9707cf053ab0e64949518ebd2729d432435f583c (diff) | |
download | kdepimpi-cd02f3880c5567a4bbb7b56e7034787005df7da8.zip kdepimpi-cd02f3880c5567a4bbb7b56e7034787005df7da8.tar.gz kdepimpi-cd02f3880c5567a4bbb7b56e7034787005df7da8.tar.bz2 |
agenda mouse fix
-rw-r--r-- | korganizer/koagenda.cpp | 2 | ||||
-rw-r--r-- | korganizer/koagendaitem.cpp | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index dcb46a8..5420822 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp | |||
@@ -197,513 +197,513 @@ KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,WFlags f) : | |||
197 | #ifndef DESKTOP_VERSION | 197 | #ifndef DESKTOP_VERSION |
198 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 198 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
199 | #endif | 199 | #endif |
200 | mHolidayMask = 0; | 200 | mHolidayMask = 0; |
201 | init(); | 201 | init(); |
202 | } | 202 | } |
203 | 203 | ||
204 | 204 | ||
205 | KOAgenda::~KOAgenda() | 205 | KOAgenda::~KOAgenda() |
206 | { | 206 | { |
207 | if(mMarcusBains) delete mMarcusBains; | 207 | if(mMarcusBains) delete mMarcusBains; |
208 | 208 | ||
209 | } | 209 | } |
210 | 210 | ||
211 | Incidence *KOAgenda::selectedIncidence() const | 211 | Incidence *KOAgenda::selectedIncidence() const |
212 | { | 212 | { |
213 | return (mSelectedItem ? mSelectedItem->incidence() : 0); | 213 | return (mSelectedItem ? mSelectedItem->incidence() : 0); |
214 | } | 214 | } |
215 | 215 | ||
216 | 216 | ||
217 | QDate KOAgenda::selectedIncidenceDate() const | 217 | QDate KOAgenda::selectedIncidenceDate() const |
218 | { | 218 | { |
219 | return (mSelectedItem ? mSelectedItem->itemDate() : QDate()); | 219 | return (mSelectedItem ? mSelectedItem->itemDate() : QDate()); |
220 | } | 220 | } |
221 | 221 | ||
222 | 222 | ||
223 | void KOAgenda::init() | 223 | void KOAgenda::init() |
224 | { | 224 | { |
225 | mNewItemPopup = new QPopupMenu( this ); | 225 | mNewItemPopup = new QPopupMenu( this ); |
226 | connect ( mNewItemPopup, SIGNAL (activated ( int ) ), this, SLOT ( newItem(int)) ); | 226 | connect ( mNewItemPopup, SIGNAL (activated ( int ) ), this, SLOT ( newItem(int)) ); |
227 | QString pathString = ""; | 227 | QString pathString = ""; |
228 | if ( !KOPrefs::instance()->mToolBarMiniIcons ) { | 228 | if ( !KOPrefs::instance()->mToolBarMiniIcons ) { |
229 | if ( QApplication::desktop()->width() < 480 ) | 229 | if ( QApplication::desktop()->width() < 480 ) |
230 | pathString += "icons16/"; | 230 | pathString += "icons16/"; |
231 | } else | 231 | } else |
232 | pathString += "iconsmini/"; | 232 | pathString += "iconsmini/"; |
233 | 233 | ||
234 | mNewItemPopup->insertItem ( SmallIcon( pathString +"newevent" ), i18n("New Event..."), 1 ); | 234 | mNewItemPopup->insertItem ( SmallIcon( pathString +"newevent" ), i18n("New Event..."), 1 ); |
235 | mNewItemPopup->insertItem ( SmallIcon( pathString +"newtodo" ), i18n("New Todo..."),2 ); | 235 | mNewItemPopup->insertItem ( SmallIcon( pathString +"newtodo" ), i18n("New Todo..."),2 ); |
236 | mNewItemPopup->insertSeparator ( ); | 236 | mNewItemPopup->insertSeparator ( ); |
237 | mNewItemPopup->insertItem ( SmallIcon( pathString +"day" ), i18n("Day view"),3 ); | 237 | mNewItemPopup->insertItem ( SmallIcon( pathString +"day" ), i18n("Day view"),3 ); |
238 | mNewItemPopup->insertItem ( SmallIcon( pathString +"xdays" ), i18n("Next days"),8 ); | 238 | mNewItemPopup->insertItem ( SmallIcon( pathString +"xdays" ), i18n("Next days"),8 ); |
239 | mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next week"),4 ); | 239 | mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next week"),4 ); |
240 | mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next two weeks"),5 ); | 240 | mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next two weeks"),5 ); |
241 | mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("Next month"),6 ); | 241 | mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("Next month"),6 ); |
242 | mNewItemPopup->insertItem ( SmallIcon( pathString +"journal" ), i18n("Journal view"),7 ); | 242 | mNewItemPopup->insertItem ( SmallIcon( pathString +"journal" ), i18n("Journal view"),7 ); |
243 | #ifndef _WIN32_ | 243 | #ifndef _WIN32_ |
244 | int wflags = viewport()-> getWFlags() |WRepaintNoErase;//WResizeNoErase | 244 | int wflags = viewport()-> getWFlags() |WRepaintNoErase;//WResizeNoErase |
245 | viewport()->setWFlags ( wflags); | 245 | viewport()->setWFlags ( wflags); |
246 | #endif | 246 | #endif |
247 | mGridSpacingX = 80; | 247 | mGridSpacingX = 80; |
248 | mResizeBorderWidth = 8; | 248 | mResizeBorderWidth = 8; |
249 | mScrollBorderWidth = 8; | 249 | mScrollBorderWidth = 8; |
250 | mScrollDelay = 30; | 250 | mScrollDelay = 30; |
251 | mScrollOffset = 10; | 251 | mScrollOffset = 10; |
252 | mPaintPixmap.resize( 20,20); | 252 | mPaintPixmap.resize( 20,20); |
253 | //enableClipper(true); | 253 | //enableClipper(true); |
254 | 254 | ||
255 | // Grab key strokes for keyboard navigation of agenda. Seems to have no | 255 | // Grab key strokes for keyboard navigation of agenda. Seems to have no |
256 | // effect. Has to be fixed. | 256 | // effect. Has to be fixed. |
257 | setFocusPolicy(WheelFocus); | 257 | setFocusPolicy(WheelFocus); |
258 | 258 | ||
259 | connect(&mScrollUpTimer,SIGNAL(timeout()),SLOT(scrollUp())); | 259 | connect(&mScrollUpTimer,SIGNAL(timeout()),SLOT(scrollUp())); |
260 | connect(&mScrollDownTimer,SIGNAL(timeout()),SLOT(scrollDown())); | 260 | connect(&mScrollDownTimer,SIGNAL(timeout()),SLOT(scrollDown())); |
261 | connect(&mResizeTimer,SIGNAL(timeout()),SLOT(finishResize())); | 261 | connect(&mResizeTimer,SIGNAL(timeout()),SLOT(finishResize())); |
262 | 262 | ||
263 | mStartCellX = 0; | 263 | mStartCellX = 0; |
264 | mStartCellY = 0; | 264 | mStartCellY = 0; |
265 | mCurrentCellX = 0; | 265 | mCurrentCellX = 0; |
266 | mCurrentCellY = 0; | 266 | mCurrentCellY = 0; |
267 | 267 | ||
268 | mSelectionCellX = 0; | 268 | mSelectionCellX = 0; |
269 | mSelectionYTop = 0; | 269 | mSelectionYTop = 0; |
270 | mSelectionHeight = 0; | 270 | mSelectionHeight = 0; |
271 | 271 | ||
272 | mOldLowerScrollValue = -1; | 272 | mOldLowerScrollValue = -1; |
273 | mOldUpperScrollValue = -1; | 273 | mOldUpperScrollValue = -1; |
274 | 274 | ||
275 | mClickedItem = 0; | 275 | mClickedItem = 0; |
276 | 276 | ||
277 | mActionItem = 0; | 277 | mActionItem = 0; |
278 | mActionType = NOP; | 278 | mActionType = NOP; |
279 | mItemMoved = false; | 279 | mItemMoved = false; |
280 | 280 | ||
281 | mSelectedItem = 0; | 281 | mSelectedItem = 0; |
282 | 282 | ||
283 | // mItems.setAutoDelete(true); | 283 | // mItems.setAutoDelete(true); |
284 | 284 | ||
285 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); | 285 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); |
286 | 286 | ||
287 | viewport()->update(); | 287 | viewport()->update(); |
288 | 288 | ||
289 | setMinimumSize(30, 1); | 289 | setMinimumSize(30, 1); |
290 | // setMaximumHeight(mGridSpacingY * mRows + 5); | 290 | // setMaximumHeight(mGridSpacingY * mRows + 5); |
291 | 291 | ||
292 | // Disable horizontal scrollbar. This is a hack. The geometry should be | 292 | // Disable horizontal scrollbar. This is a hack. The geometry should be |
293 | // controlled in a way that the contents horizontally always fits. Then it is | 293 | // controlled in a way that the contents horizontally always fits. Then it is |
294 | // not necessary to turn off the scrollbar. | 294 | // not necessary to turn off the scrollbar. |
295 | setHScrollBarMode(AlwaysOff); | 295 | setHScrollBarMode(AlwaysOff); |
296 | if ( ! mAllDayMode ) | 296 | if ( ! mAllDayMode ) |
297 | setVScrollBarMode(AlwaysOn); | 297 | setVScrollBarMode(AlwaysOn); |
298 | else | 298 | else |
299 | setVScrollBarMode(AlwaysOff); | 299 | setVScrollBarMode(AlwaysOff); |
300 | 300 | ||
301 | setStartHour(KOPrefs::instance()->mDayBegins); | 301 | setStartHour(KOPrefs::instance()->mDayBegins); |
302 | 302 | ||
303 | calculateWorkingHours(); | 303 | calculateWorkingHours(); |
304 | 304 | ||
305 | connect(verticalScrollBar(),SIGNAL(valueChanged(int)), | 305 | connect(verticalScrollBar(),SIGNAL(valueChanged(int)), |
306 | SLOT(checkScrollBoundaries(int))); | 306 | SLOT(checkScrollBoundaries(int))); |
307 | 307 | ||
308 | // Create the Marcus Bains line. | 308 | // Create the Marcus Bains line. |
309 | if(mAllDayMode) | 309 | if(mAllDayMode) |
310 | mMarcusBains = 0; | 310 | mMarcusBains = 0; |
311 | else { | 311 | else { |
312 | mMarcusBains = new MarcusBains(this); | 312 | mMarcusBains = new MarcusBains(this); |
313 | addChild(mMarcusBains); | 313 | addChild(mMarcusBains); |
314 | } | 314 | } |
315 | } | 315 | } |
316 | 316 | ||
317 | void KOAgenda::clear() | 317 | void KOAgenda::clear() |
318 | { | 318 | { |
319 | KOAgendaItem *item; | 319 | KOAgendaItem *item; |
320 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 320 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
321 | mUnusedItems.append( item ); | 321 | mUnusedItems.append( item ); |
322 | //item->hide(); | 322 | //item->hide(); |
323 | } | 323 | } |
324 | mItems.clear(); | 324 | mItems.clear(); |
325 | mSelectedItem = 0; | 325 | mSelectedItem = 0; |
326 | clearSelection(); | 326 | clearSelection(); |
327 | } | 327 | } |
328 | 328 | ||
329 | void KOAgenda::clearSelection() | 329 | void KOAgenda::clearSelection() |
330 | { | 330 | { |
331 | mSelectionCellX = 0; | 331 | mSelectionCellX = 0; |
332 | mSelectionYTop = 0; | 332 | mSelectionYTop = 0; |
333 | mSelectionHeight = 0; | 333 | mSelectionHeight = 0; |
334 | } | 334 | } |
335 | 335 | ||
336 | void KOAgenda::marcus_bains() | 336 | void KOAgenda::marcus_bains() |
337 | { | 337 | { |
338 | if(mMarcusBains) mMarcusBains->updateLocation(true); | 338 | if(mMarcusBains) mMarcusBains->updateLocation(true); |
339 | } | 339 | } |
340 | 340 | ||
341 | 341 | ||
342 | void KOAgenda::changeColumns(int columns) | 342 | void KOAgenda::changeColumns(int columns) |
343 | { | 343 | { |
344 | if (columns == 0) { | 344 | if (columns == 0) { |
345 | kdDebug() << "KOAgenda::changeColumns() called with argument 0" << endl; | 345 | kdDebug() << "KOAgenda::changeColumns() called with argument 0" << endl; |
346 | return; | 346 | return; |
347 | } | 347 | } |
348 | 348 | ||
349 | clear(); | 349 | clear(); |
350 | 350 | ||
351 | mColumns = columns; | 351 | mColumns = columns; |
352 | // setMinimumSize(mColumns * 10, mGridSpacingY + 1); | 352 | // setMinimumSize(mColumns * 10, mGridSpacingY + 1); |
353 | // init(); | 353 | // init(); |
354 | // update(); | 354 | // update(); |
355 | //qDebug("KOAgenda::changeColumns "); | 355 | //qDebug("KOAgenda::changeColumns "); |
356 | computeSizes(); | 356 | computeSizes(); |
357 | // QResizeEvent event( size(), size() ); | 357 | // QResizeEvent event( size(), size() ); |
358 | 358 | ||
359 | //QApplication::sendEvent( this, &event ); | 359 | //QApplication::sendEvent( this, &event ); |
360 | } | 360 | } |
361 | 361 | ||
362 | /* | 362 | /* |
363 | This is the eventFilter function, which gets all events from the KOAgendaItems | 363 | This is the eventFilter function, which gets all events from the KOAgendaItems |
364 | contained in the agenda. It has to handle moving and resizing for all items. | 364 | contained in the agenda. It has to handle moving and resizing for all items. |
365 | */ | 365 | */ |
366 | bool KOAgenda::eventFilter ( QObject *object, QEvent *event ) | 366 | bool KOAgenda::eventFilter ( QObject *object, QEvent *event ) |
367 | { | 367 | { |
368 | // kdDebug() << "KOAgenda::eventFilter" << endl; | 368 | // kdDebug() << "KOAgenda::eventFilter" << endl; |
369 | switch(event->type()) { | 369 | switch(event->type()) { |
370 | case QEvent::MouseButtonPress: | 370 | case QEvent::MouseButtonPress: |
371 | case QEvent::MouseButtonDblClick: | 371 | case QEvent::MouseButtonDblClick: |
372 | case QEvent::MouseButtonRelease: | 372 | case QEvent::MouseButtonRelease: |
373 | case QEvent::MouseMove: | 373 | case QEvent::MouseMove: |
374 | return eventFilter_mouse(object, static_cast<QMouseEvent *>(event)); | 374 | return eventFilter_mouse(object, static_cast<QMouseEvent *>(event)); |
375 | 375 | ||
376 | case (QEvent::Leave): | 376 | case (QEvent::Leave): |
377 | if (!mActionItem) | 377 | if (!mActionItem) |
378 | setCursor(arrowCursor); | 378 | setCursor(arrowCursor); |
379 | return true; | 379 | return true; |
380 | 380 | ||
381 | default: | 381 | default: |
382 | return QScrollView::eventFilter(object,event); | 382 | return QScrollView::eventFilter(object,event); |
383 | } | 383 | } |
384 | } | 384 | } |
385 | 385 | ||
386 | 386 | ||
387 | bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) | 387 | bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) |
388 | { | 388 | { |
389 | //qDebug("KOAgenda::eventFilter_mous "); | 389 | //qDebug("KOAgenda::eventFilter_mous "); |
390 | QPoint viewportPos; | 390 | QPoint viewportPos; |
391 | if (object != viewport()) { | 391 | if (object != viewport()) { |
392 | viewportPos = ((QWidget *)object)->mapToParent(me->pos()); | 392 | viewportPos = ((QWidget *)object)->mapToParent(me->pos()); |
393 | } else { | 393 | } else { |
394 | viewportPos = me->pos(); | 394 | viewportPos = me->pos(); |
395 | } | 395 | } |
396 | static int startX = 0; | 396 | static int startX = 0; |
397 | static int startY = 0; | 397 | static int startY = 0; |
398 | static int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 15 : 20 ); | 398 | static int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 15 : 20 ); |
399 | static bool blockMoving = true; | 399 | static bool blockMoving = true; |
400 | static bool leftMouseDown = false; | 400 | static bool leftMouseDown = false; |
401 | static bool rightMouseDown = false; | 401 | static bool rightMouseDown = false; |
402 | static QTime rightClickTime; | 402 | static QTime rightClickTime; |
403 | bool rightButtonPressed = false; | 403 | bool rightButtonPressed = false; |
404 | switch (me->type()) { | 404 | switch (me->type()) { |
405 | case QEvent::MouseButtonPress: | 405 | case QEvent::MouseButtonPress: |
406 | rightClickTime.restart(); | 406 | rightClickTime.restart(); |
407 | if (me->button() == LeftButton) { | 407 | if (me->button() == LeftButton) { |
408 | leftMouseDown = true; | 408 | leftMouseDown = true; |
409 | } | 409 | } |
410 | else if (me->button() == RightButton) | 410 | else if (me->button() == RightButton) |
411 | rightMouseDown = true; | 411 | rightMouseDown = true; |
412 | blockMoving = true; | 412 | blockMoving = true; |
413 | startX = viewportPos.x(); | 413 | startX = viewportPos.x(); |
414 | startY = viewportPos.y(); | 414 | startY = viewportPos.y(); |
415 | if (object != viewport()) { | 415 | if (object != viewport()) { |
416 | if (me->button() == RightButton) { | 416 | if (me->button() == RightButton) { |
417 | mClickedItem = (KOAgendaItem *)object; | 417 | mClickedItem = (KOAgendaItem *)object; |
418 | if (mClickedItem) { | 418 | if (mClickedItem) { |
419 | selectItem(mClickedItem); | 419 | selectItem(mClickedItem); |
420 | } | 420 | } |
421 | } else if (me->button() == LeftButton) { | 421 | } else if (me->button() == LeftButton) { |
422 | mActionItem = (KOAgendaItem *)object; | 422 | mActionItem = (KOAgendaItem *)object; |
423 | if (mActionItem) { | 423 | if (mActionItem) { |
424 | if ( mSelectionHeight > 0 ) { | 424 | if ( mSelectionHeight > 0 ) { |
425 | int selectionCellX = mSelectionCellX * mGridSpacingX; | 425 | int selectionCellX = mSelectionCellX * mGridSpacingX; |
426 | int selectionYTop = mSelectionYTop; | 426 | int selectionYTop = mSelectionYTop; |
427 | int gridSpacingX = mGridSpacingX; | 427 | int gridSpacingX = mGridSpacingX; |
428 | int selectionHeight = mSelectionHeight; | 428 | int selectionHeight = mSelectionHeight; |
429 | clearSelection(); | 429 | clearSelection(); |
430 | repaintContents( selectionCellX, selectionYTop, | 430 | repaintContents( selectionCellX, selectionYTop, |
431 | gridSpacingX, selectionHeight,false ); | 431 | gridSpacingX, selectionHeight,false ); |
432 | } | 432 | } |
433 | selectItem(mActionItem); | 433 | selectItem(mActionItem); |
434 | Incidence *incidence = mActionItem->incidence(); | 434 | Incidence *incidence = mActionItem->incidence(); |
435 | if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) { | 435 | if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) { |
436 | mActionItem = 0; | 436 | mActionItem = 0; |
437 | } else { | 437 | } else { |
438 | startItemAction(viewportPos); | 438 | startItemAction(viewportPos); |
439 | } | 439 | } |
440 | } | 440 | } |
441 | } | 441 | } |
442 | } else { // ---------- viewport() | 442 | } else { // ---------- viewport() |
443 | selectItem(0); | 443 | selectItem(0); |
444 | mActionItem = 0; | 444 | mActionItem = 0; |
445 | if (me->button() == LeftButton ) { | 445 | if (me->button() == LeftButton ) { |
446 | setCursor(arrowCursor); | 446 | setCursor(arrowCursor); |
447 | startSelectAction(viewportPos); | 447 | startSelectAction(viewportPos); |
448 | } | 448 | } |
449 | } | 449 | } |
450 | break; | 450 | break; |
451 | 451 | ||
452 | case QEvent::MouseButtonRelease: | 452 | case QEvent::MouseButtonRelease: |
453 | if ( rightClickTime.elapsed() > 700 && blockMoving ) | 453 | if ( rightClickTime.elapsed() > 500 && blockMoving ) |
454 | rightButtonPressed = true; | 454 | rightButtonPressed = true; |
455 | if (object != viewport()) { | 455 | if (object != viewport()) { |
456 | if (me->button() == RightButton || rightButtonPressed ) { | 456 | if (me->button() == RightButton || rightButtonPressed ) { |
457 | if ( blockMoving ) { | 457 | if ( blockMoving ) { |
458 | mClickedItem = (KOAgendaItem *)object; | 458 | mClickedItem = (KOAgendaItem *)object; |
459 | if (mActionItem ) { | 459 | if (mActionItem ) { |
460 | endItemAction(); | 460 | endItemAction(); |
461 | } | 461 | } |
462 | leftMouseDown = false; // no more leftMouse computation | 462 | leftMouseDown = false; // no more leftMouse computation |
463 | if (mClickedItem) { | 463 | if (mClickedItem) { |
464 | selectItem(mClickedItem); | 464 | selectItem(mClickedItem); |
465 | emit showIncidencePopupSignal(mClickedItem->incidence()); | 465 | emit showIncidencePopupSignal(mClickedItem->incidence()); |
466 | } | 466 | } |
467 | } | 467 | } |
468 | } else if (me->button() == LeftButton && leftMouseDown) { | 468 | } else if (me->button() == LeftButton && leftMouseDown) { |
469 | if (mActionItem) { | 469 | if (mActionItem) { |
470 | QPoint clipperPos = clipper()->mapFromGlobal(viewport()->mapToGlobal(viewportPos)); | 470 | QPoint clipperPos = clipper()->mapFromGlobal(viewport()->mapToGlobal(viewportPos)); |
471 | //qDebug(" %d %d %d ",clipperPos.y(),visibleHeight() , 9 ); | 471 | //qDebug(" %d %d %d ",clipperPos.y(),visibleHeight() , 9 ); |
472 | if ( mActionType == MOVE && (clipperPos.y() > visibleHeight()-2 ||clipperPos.y() < 0 ) ) { | 472 | if ( mActionType == MOVE && (clipperPos.y() > visibleHeight()-2 ||clipperPos.y() < 0 ) ) { |
473 | mScrollUpTimer.stop(); | 473 | mScrollUpTimer.stop(); |
474 | mScrollDownTimer.stop(); | 474 | mScrollDownTimer.stop(); |
475 | mActionItem->resetMove(); | 475 | mActionItem->resetMove(); |
476 | placeSubCells( mActionItem ); | 476 | placeSubCells( mActionItem ); |
477 | // emit startDragSignal( mActionItem->incidence() ); | 477 | // emit startDragSignal( mActionItem->incidence() ); |
478 | setCursor( arrowCursor ); | 478 | setCursor( arrowCursor ); |
479 | mActionItem = 0; | 479 | mActionItem = 0; |
480 | mActionType = NOP; | 480 | mActionType = NOP; |
481 | mItemMoved = 0; | 481 | mItemMoved = 0; |
482 | leftMouseDown = false; | 482 | leftMouseDown = false; |
483 | return true; | 483 | return true; |
484 | } | 484 | } |
485 | endItemAction(); | 485 | endItemAction(); |
486 | } | 486 | } |
487 | } | 487 | } |
488 | 488 | ||
489 | } else { // ---------- viewport() | 489 | } else { // ---------- viewport() |
490 | if (me->button() == RightButton || rightButtonPressed ) { //right click | 490 | if (me->button() == RightButton || rightButtonPressed ) { //right click |
491 | if ( blockMoving ) { // we did mot moved the mouse much - popup menu | 491 | if ( blockMoving ) { // we did mot moved the mouse much - popup menu |
492 | if ( leftMouseDown ) { // we have a simulated right click - clear left mouse action | 492 | if ( leftMouseDown ) { // we have a simulated right click - clear left mouse action |
493 | endSelectAction( false ); // do not emit new event signal | 493 | endSelectAction( false ); // do not emit new event signal |
494 | leftMouseDown = false; // no more leftMouse computation | 494 | leftMouseDown = false; // no more leftMouse computation |
495 | } | 495 | } |
496 | int x,y; | 496 | int x,y; |
497 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 497 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
498 | int gx,gy; | 498 | int gx,gy; |
499 | contentsToGrid(x,y,gx,gy); | 499 | contentsToGrid(x,y,gx,gy); |
500 | mCurrentCellX = gx; | 500 | mCurrentCellX = gx; |
501 | mCurrentCellY = gy; | 501 | mCurrentCellY = gy; |
502 | mStartCellX = gx; | 502 | mStartCellX = gx; |
503 | mStartCellY = gy; | 503 | mStartCellY = gy; |
504 | mNewItemPopup->popup( viewport()->mapToGlobal( me->pos() ) ); | 504 | mNewItemPopup->popup( viewport()->mapToGlobal( me->pos() ) ); |
505 | } | 505 | } |
506 | } | 506 | } |
507 | else if (me->button() == LeftButton && leftMouseDown ) { //left click | 507 | else if (me->button() == LeftButton && leftMouseDown ) { //left click |
508 | endSelectAction( true ); // emit new event signal | 508 | endSelectAction( true ); // emit new event signal |
509 | } | 509 | } |
510 | } | 510 | } |
511 | if (me->button() == LeftButton) | 511 | if (me->button() == LeftButton) |
512 | leftMouseDown = false; | 512 | leftMouseDown = false; |
513 | else if (me->button() == RightButton) | 513 | else if (me->button() == RightButton) |
514 | rightMouseDown = false; | 514 | rightMouseDown = false; |
515 | break; | 515 | break; |
516 | 516 | ||
517 | case QEvent::MouseMove: | 517 | case QEvent::MouseMove: |
518 | if ( !rightMouseDown && !leftMouseDown ) | 518 | if ( !rightMouseDown && !leftMouseDown ) |
519 | return true; | 519 | return true; |
520 | if ( blockMoving ) { | 520 | if ( blockMoving ) { |
521 | int dX, dY; | 521 | int dX, dY; |
522 | dX = startX - viewportPos.x(); | 522 | dX = startX - viewportPos.x(); |
523 | if ( dX < 0 ) | 523 | if ( dX < 0 ) |
524 | dX = -dX; | 524 | dX = -dX; |
525 | dY = viewportPos.y() - startY; | 525 | dY = viewportPos.y() - startY; |
526 | if ( dY < 0 ) | 526 | if ( dY < 0 ) |
527 | dY = -dY; | 527 | dY = -dY; |
528 | //qDebug("%d %d %d ", dX, dY , blockmoveDist ); | 528 | //qDebug("%d %d %d ", dX, dY , blockmoveDist ); |
529 | if ( dX > blockmoveDist || dY > blockmoveDist ) { | 529 | if ( dX > blockmoveDist || dY > blockmoveDist ) { |
530 | blockMoving = false; | 530 | blockMoving = false; |
531 | } | 531 | } |
532 | } | 532 | } |
533 | if (object != viewport()) { | 533 | if (object != viewport()) { |
534 | KOAgendaItem *moveItem = (KOAgendaItem *)object; | 534 | KOAgendaItem *moveItem = (KOAgendaItem *)object; |
535 | if (!moveItem->incidence()->isReadOnly() ) { | 535 | if (!moveItem->incidence()->isReadOnly() ) { |
536 | if (!mActionItem) | 536 | if (!mActionItem) |
537 | setNoActionCursor(moveItem,viewportPos); | 537 | setNoActionCursor(moveItem,viewportPos); |
538 | else { | 538 | else { |
539 | if ( !blockMoving ) | 539 | if ( !blockMoving ) |
540 | performItemAction(viewportPos); | 540 | performItemAction(viewportPos); |
541 | } | 541 | } |
542 | } | 542 | } |
543 | } else { // ---------- viewport() | 543 | } else { // ---------- viewport() |
544 | if ( mActionType == SELECT ) { | 544 | if ( mActionType == SELECT ) { |
545 | performSelectAction( viewportPos ); | 545 | performSelectAction( viewportPos ); |
546 | } | 546 | } |
547 | } | 547 | } |
548 | break; | 548 | break; |
549 | 549 | ||
550 | case QEvent::MouseButtonDblClick: | 550 | case QEvent::MouseButtonDblClick: |
551 | if (object == viewport()) { | 551 | if (object == viewport()) { |
552 | selectItem(0); | 552 | selectItem(0); |
553 | int x,y; | 553 | int x,y; |
554 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 554 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
555 | int gx,gy; | 555 | int gx,gy; |
556 | contentsToGrid(x,y,gx,gy); | 556 | contentsToGrid(x,y,gx,gy); |
557 | emit newEventSignal(gx,gy); | 557 | emit newEventSignal(gx,gy); |
558 | } else { | 558 | } else { |
559 | KOAgendaItem *doubleClickedItem = (KOAgendaItem *)object; | 559 | KOAgendaItem *doubleClickedItem = (KOAgendaItem *)object; |
560 | selectItem(doubleClickedItem); | 560 | selectItem(doubleClickedItem); |
561 | if ( KOPrefs::instance()->mEditOnDoubleClick ) | 561 | if ( KOPrefs::instance()->mEditOnDoubleClick ) |
562 | emit editIncidenceSignal(doubleClickedItem->incidence()); | 562 | emit editIncidenceSignal(doubleClickedItem->incidence()); |
563 | else | 563 | else |
564 | emit showIncidenceSignal(doubleClickedItem->incidence()); | 564 | emit showIncidenceSignal(doubleClickedItem->incidence()); |
565 | } | 565 | } |
566 | break; | 566 | break; |
567 | 567 | ||
568 | default: | 568 | default: |
569 | break; | 569 | break; |
570 | } | 570 | } |
571 | return true; | 571 | return true; |
572 | } | 572 | } |
573 | 573 | ||
574 | void KOAgenda::newItem( int item ) | 574 | void KOAgenda::newItem( int item ) |
575 | { | 575 | { |
576 | if ( item == 1 ) { //new event | 576 | if ( item == 1 ) { //new event |
577 | newEventSignal(mStartCellX ,mStartCellY ); | 577 | newEventSignal(mStartCellX ,mStartCellY ); |
578 | } else | 578 | } else |
579 | if ( item == 2 ) { //new event | 579 | if ( item == 2 ) { //new event |
580 | newTodoSignal(mStartCellX ,mStartCellY ); | 580 | newTodoSignal(mStartCellX ,mStartCellY ); |
581 | } else | 581 | } else |
582 | { | 582 | { |
583 | QDate day = mSelectedDates[mStartCellX]; | 583 | QDate day = mSelectedDates[mStartCellX]; |
584 | emit showDateView( item, day ); | 584 | emit showDateView( item, day ); |
585 | // 3Day view | 585 | // 3Day view |
586 | // 4Week view | 586 | // 4Week view |
587 | // 5Month view | 587 | // 5Month view |
588 | // 6Journal view | 588 | // 6Journal view |
589 | } | 589 | } |
590 | } | 590 | } |
591 | void KOAgenda::startSelectAction(QPoint viewportPos) | 591 | void KOAgenda::startSelectAction(QPoint viewportPos) |
592 | { | 592 | { |
593 | //emit newStartSelectSignal(); | 593 | //emit newStartSelectSignal(); |
594 | 594 | ||
595 | mActionType = SELECT; | 595 | mActionType = SELECT; |
596 | 596 | ||
597 | int x,y; | 597 | int x,y; |
598 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 598 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
599 | int gx,gy; | 599 | int gx,gy; |
600 | contentsToGrid(x,y,gx,gy); | 600 | contentsToGrid(x,y,gx,gy); |
601 | 601 | ||
602 | mStartCellX = gx; | 602 | mStartCellX = gx; |
603 | mStartCellY = gy; | 603 | mStartCellY = gy; |
604 | mCurrentCellX = gx; | 604 | mCurrentCellX = gx; |
605 | mCurrentCellY = gy; | 605 | mCurrentCellY = gy; |
606 | 606 | ||
607 | // Store coordinates of old selection | 607 | // Store coordinates of old selection |
608 | int selectionX = mSelectionCellX * mGridSpacingX; | 608 | int selectionX = mSelectionCellX * mGridSpacingX; |
609 | int selectionYTop = mSelectionYTop; | 609 | int selectionYTop = mSelectionYTop; |
610 | int selectionHeight = mSelectionHeight; | 610 | int selectionHeight = mSelectionHeight; |
611 | 611 | ||
612 | // Store new selection | 612 | // Store new selection |
613 | mSelectionCellX = gx; | 613 | mSelectionCellX = gx; |
614 | mSelectionYTop = gy * mGridSpacingY; | 614 | mSelectionYTop = gy * mGridSpacingY; |
615 | mSelectionHeight = mGridSpacingY; | 615 | mSelectionHeight = mGridSpacingY; |
616 | 616 | ||
617 | // Clear old selection | 617 | // Clear old selection |
618 | repaintContents( selectionX, selectionYTop, | 618 | repaintContents( selectionX, selectionYTop, |
619 | mGridSpacingX, selectionHeight,false ); | 619 | mGridSpacingX, selectionHeight,false ); |
620 | 620 | ||
621 | // Paint new selection | 621 | // Paint new selection |
622 | // repaintContents( mSelectionCellX * mGridSpacingX, mSelectionYTop, | 622 | // repaintContents( mSelectionCellX * mGridSpacingX, mSelectionYTop, |
623 | // mGridSpacingX, mSelectionHeight ); | 623 | // mGridSpacingX, mSelectionHeight ); |
624 | } | 624 | } |
625 | 625 | ||
626 | void KOAgenda::performSelectAction(QPoint viewportPos) | 626 | void KOAgenda::performSelectAction(QPoint viewportPos) |
627 | { | 627 | { |
628 | int x,y; | 628 | int x,y; |
629 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 629 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
630 | int gx,gy; | 630 | int gx,gy; |
631 | contentsToGrid(x,y,gx,gy); | 631 | contentsToGrid(x,y,gx,gy); |
632 | 632 | ||
633 | QPoint clipperPos = clipper()-> | 633 | QPoint clipperPos = clipper()-> |
634 | mapFromGlobal(viewport()->mapToGlobal(viewportPos)); | 634 | mapFromGlobal(viewport()->mapToGlobal(viewportPos)); |
635 | 635 | ||
636 | // Scroll if cursor was moved to upper or lower end of agenda. | 636 | // Scroll if cursor was moved to upper or lower end of agenda. |
637 | if (clipperPos.y() < mScrollBorderWidth) { | 637 | if (clipperPos.y() < mScrollBorderWidth) { |
638 | mScrollUpTimer.start(mScrollDelay); | 638 | mScrollUpTimer.start(mScrollDelay); |
639 | } else if (visibleHeight() - clipperPos.y() < | 639 | } else if (visibleHeight() - clipperPos.y() < |
640 | mScrollBorderWidth) { | 640 | mScrollBorderWidth) { |
641 | mScrollDownTimer.start(mScrollDelay); | 641 | mScrollDownTimer.start(mScrollDelay); |
642 | } else { | 642 | } else { |
643 | mScrollUpTimer.stop(); | 643 | mScrollUpTimer.stop(); |
644 | mScrollDownTimer.stop(); | 644 | mScrollDownTimer.stop(); |
645 | } | 645 | } |
646 | 646 | ||
647 | if ( gy > mCurrentCellY ) { | 647 | if ( gy > mCurrentCellY ) { |
648 | mSelectionHeight = ( gy + 1 ) * mGridSpacingY - mSelectionYTop; | 648 | mSelectionHeight = ( gy + 1 ) * mGridSpacingY - mSelectionYTop; |
649 | 649 | ||
650 | #if 0 | 650 | #if 0 |
651 | // FIXME: Repaint only the newly selected region | 651 | // FIXME: Repaint only the newly selected region |
652 | repaintContents( mSelectionCellX * mGridSpacingX, | 652 | repaintContents( mSelectionCellX * mGridSpacingX, |
653 | mCurrentCellY + mGridSpacingY, | 653 | mCurrentCellY + mGridSpacingY, |
654 | mGridSpacingX, | 654 | mGridSpacingX, |
655 | mSelectionHeight - ( gy - mCurrentCellY - 1 ) * mGridSpacingY ); | 655 | mSelectionHeight - ( gy - mCurrentCellY - 1 ) * mGridSpacingY ); |
656 | #else | 656 | #else |
657 | repaintContents( (KOGlobals::self()->reverseLayout() ? | 657 | repaintContents( (KOGlobals::self()->reverseLayout() ? |
658 | mColumns - 1 - mSelectionCellX : mSelectionCellX) * | 658 | mColumns - 1 - mSelectionCellX : mSelectionCellX) * |
659 | mGridSpacingX, mSelectionYTop, | 659 | mGridSpacingX, mSelectionYTop, |
660 | mGridSpacingX, mSelectionHeight , false); | 660 | mGridSpacingX, mSelectionHeight , false); |
661 | #endif | 661 | #endif |
662 | 662 | ||
663 | mCurrentCellY = gy; | 663 | mCurrentCellY = gy; |
664 | } else if ( gy < mCurrentCellY ) { | 664 | } else if ( gy < mCurrentCellY ) { |
665 | if ( gy >= mStartCellY ) { | 665 | if ( gy >= mStartCellY ) { |
666 | int selectionHeight = mSelectionHeight; | 666 | int selectionHeight = mSelectionHeight; |
667 | mSelectionHeight = ( gy + 1 ) * mGridSpacingY - mSelectionYTop; | 667 | mSelectionHeight = ( gy + 1 ) * mGridSpacingY - mSelectionYTop; |
668 | 668 | ||
669 | repaintContents( (KOGlobals::self()->reverseLayout() ? | 669 | repaintContents( (KOGlobals::self()->reverseLayout() ? |
670 | mColumns - 1 - mSelectionCellX : mSelectionCellX) * | 670 | mColumns - 1 - mSelectionCellX : mSelectionCellX) * |
671 | mGridSpacingX, mSelectionYTop, | 671 | mGridSpacingX, mSelectionYTop, |
672 | mGridSpacingX, selectionHeight,false ); | 672 | mGridSpacingX, selectionHeight,false ); |
673 | 673 | ||
674 | mCurrentCellY = gy; | 674 | mCurrentCellY = gy; |
675 | } else { | 675 | } else { |
676 | } | 676 | } |
677 | } | 677 | } |
678 | } | 678 | } |
679 | 679 | ||
680 | void KOAgenda::endSelectAction( bool emitNewEvent ) | 680 | void KOAgenda::endSelectAction( bool emitNewEvent ) |
681 | { | 681 | { |
682 | mActionType = NOP; | 682 | mActionType = NOP; |
683 | mScrollUpTimer.stop(); | 683 | mScrollUpTimer.stop(); |
684 | mScrollDownTimer.stop(); | 684 | mScrollDownTimer.stop(); |
685 | 685 | ||
686 | emit newTimeSpanSignal(mStartCellX,mStartCellY,mCurrentCellX,mCurrentCellY); | 686 | emit newTimeSpanSignal(mStartCellX,mStartCellY,mCurrentCellX,mCurrentCellY); |
687 | if ( emitNewEvent && mStartCellY < mCurrentCellY ) { | 687 | if ( emitNewEvent && mStartCellY < mCurrentCellY ) { |
688 | qDebug("ew event signal "); | 688 | qDebug("ew event signal "); |
689 | emit newEventSignal(mStartCellX,mStartCellY,mCurrentCellX,mCurrentCellY); | 689 | emit newEventSignal(mStartCellX,mStartCellY,mCurrentCellX,mCurrentCellY); |
690 | } | 690 | } |
691 | } | 691 | } |
692 | 692 | ||
693 | void KOAgenda::startItemAction(QPoint viewportPos) | 693 | void KOAgenda::startItemAction(QPoint viewportPos) |
694 | { | 694 | { |
695 | int x,y; | 695 | int x,y; |
696 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 696 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
697 | int gx,gy; | 697 | int gx,gy; |
698 | contentsToGrid(x,y,gx,gy); | 698 | contentsToGrid(x,y,gx,gy); |
699 | 699 | ||
700 | mStartCellX = gx; | 700 | mStartCellX = gx; |
701 | mStartCellY = gy; | 701 | mStartCellY = gy; |
702 | mCurrentCellX = gx; | 702 | mCurrentCellX = gx; |
703 | mCurrentCellY = gy; | 703 | mCurrentCellY = gy; |
704 | 704 | ||
705 | if (mAllDayMode) { | 705 | if (mAllDayMode) { |
706 | int gridDistanceX = (x - gx * mGridSpacingX); | 706 | int gridDistanceX = (x - gx * mGridSpacingX); |
707 | if (gridDistanceX < mResizeBorderWidth && | 707 | if (gridDistanceX < mResizeBorderWidth && |
708 | mActionItem->cellX() == mCurrentCellX) { | 708 | mActionItem->cellX() == mCurrentCellX) { |
709 | mActionType = RESIZELEFT; | 709 | mActionType = RESIZELEFT; |
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index 042a789..0ea2860 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp | |||
@@ -1,341 +1,341 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <qlabel.h> | 20 | #include <qlabel.h> |
21 | #include <qlayout.h> | 21 | #include <qlayout.h> |
22 | #include <qhbox.h> | 22 | #include <qhbox.h> |
23 | #include <qvbox.h> | 23 | #include <qvbox.h> |
24 | #include <qtooltip.h> | 24 | #include <qtooltip.h> |
25 | #include <qwhatsthis.h> | 25 | #include <qwhatsthis.h> |
26 | #include <qdragobject.h> | 26 | #include <qdragobject.h> |
27 | #include <qdrawutil.h> | 27 | #include <qdrawutil.h> |
28 | #include <qpainter.h> | 28 | #include <qpainter.h> |
29 | 29 | ||
30 | #include <kiconloader.h> | 30 | #include <kiconloader.h> |
31 | #include <kdebug.h> | 31 | #include <kdebug.h> |
32 | #include <kglobal.h> | 32 | #include <kglobal.h> |
33 | #include <klocale.h> | 33 | #include <klocale.h> |
34 | #ifndef DESKTOP_VERSION | 34 | #ifndef DESKTOP_VERSION |
35 | #include <qpe/qpeapplication.h> | 35 | #include <qpe/qpeapplication.h> |
36 | #define AGENDA_ICON_SIZE 5 | 36 | #define AGENDA_ICON_SIZE 5 |
37 | #else | 37 | #else |
38 | #define AGENDA_ICON_SIZE 7 | 38 | #define AGENDA_ICON_SIZE 7 |
39 | #endif | 39 | #endif |
40 | #include <libkcal/icaldrag.h> | 40 | #include <libkcal/icaldrag.h> |
41 | #include <libkcal/vcaldrag.h> | 41 | #include <libkcal/vcaldrag.h> |
42 | #include <libkcal/kincidenceformatter.h> | 42 | #include <libkcal/kincidenceformatter.h> |
43 | extern int globalFlagBlockAgenda; | 43 | extern int globalFlagBlockAgenda; |
44 | extern int globalFlagBlockAgendaItemPaint; | 44 | extern int globalFlagBlockAgendaItemPaint; |
45 | extern int globalFlagBlockAgendaItemUpdate; | 45 | extern int globalFlagBlockAgendaItemUpdate; |
46 | 46 | ||
47 | #include "koprefs.h" | 47 | #include "koprefs.h" |
48 | 48 | ||
49 | #include "koagendaitem.h" | 49 | #include "koagendaitem.h" |
50 | //#include "koagendaitem.moc" | 50 | //#include "koagendaitem.moc" |
51 | 51 | ||
52 | 52 | ||
53 | //-------------------------------------------------------------------------- | 53 | //-------------------------------------------------------------------------- |
54 | 54 | ||
55 | QToolTipGroup *KOAgendaItem::mToolTipGroup = 0; | 55 | QToolTipGroup *KOAgendaItem::mToolTipGroup = 0; |
56 | 56 | ||
57 | //-------------------------------------------------------------------------- | 57 | //-------------------------------------------------------------------------- |
58 | 58 | ||
59 | class KOAgendaItemWhatsThis :public QWhatsThis | 59 | class KOAgendaItemWhatsThis :public QWhatsThis |
60 | { | 60 | { |
61 | public: | 61 | public: |
62 | KOAgendaItemWhatsThis( KOAgendaItem* view ) : QWhatsThis( view ),_view (view) { }; | 62 | KOAgendaItemWhatsThis( KOAgendaItem* view ) : QWhatsThis( view ),_view (view) { }; |
63 | 63 | ||
64 | protected: | 64 | protected: |
65 | virtual QString text( const QPoint& ) | 65 | virtual QString text( const QPoint& ) |
66 | { | 66 | { |
67 | return _view->getWhatsThisText() ; | 67 | return _view->getWhatsThisText() ; |
68 | } | 68 | } |
69 | private: | 69 | private: |
70 | KOAgendaItem * _view; | 70 | KOAgendaItem * _view; |
71 | }; | 71 | }; |
72 | 72 | ||
73 | KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, | 73 | KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, |
74 | const char *name,WFlags) : | 74 | const char *name,WFlags) : |
75 | QWidget(parent, name), mIncidence(incidence), mDate(qd) | 75 | QWidget(parent, name), mIncidence(incidence), mDate(qd) |
76 | { | 76 | { |
77 | #ifndef DESKTOP_VERSION | 77 | #ifndef DESKTOP_VERSION |
78 | QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); | 78 | //QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); |
79 | #endif | 79 | #endif |
80 | new KOAgendaItemWhatsThis(this); | 80 | new KOAgendaItemWhatsThis(this); |
81 | int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase | 81 | int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase |
82 | setWFlags ( wflags); | 82 | setWFlags ( wflags); |
83 | mAllDay = allday; | 83 | mAllDay = allday; |
84 | init ( incidence, qd ); | 84 | init ( incidence, qd ); |
85 | setMouseTracking(true); | 85 | //setMouseTracking(true); |
86 | //setAcceptDrops(true); | 86 | //setAcceptDrops(true); |
87 | xPaintCoord = -1; | 87 | xPaintCoord = -1; |
88 | yPaintCoord = -1; | 88 | yPaintCoord = -1; |
89 | } | 89 | } |
90 | QString KOAgendaItem::getWhatsThisText() | 90 | QString KOAgendaItem::getWhatsThisText() |
91 | { | 91 | { |
92 | if ( mIncidence ) | 92 | if ( mIncidence ) |
93 | return KIncidenceFormatter::instance()->getFormattedText( mIncidence, | 93 | return KIncidenceFormatter::instance()->getFormattedText( mIncidence, |
94 | KOPrefs::instance()->mWTshowDetails, | 94 | KOPrefs::instance()->mWTshowDetails, |
95 | KOPrefs::instance()->mWTshowCreated, | 95 | KOPrefs::instance()->mWTshowCreated, |
96 | KOPrefs::instance()->mWTshowChanged); | 96 | KOPrefs::instance()->mWTshowChanged); |
97 | return "KOAgendaItem::getWhatsThisText()::internal error"; | 97 | return "KOAgendaItem::getWhatsThisText()::internal error"; |
98 | } | 98 | } |
99 | void KOAgendaItem::init ( Incidence *incidence, QDate qd ) | 99 | void KOAgendaItem::init ( Incidence *incidence, QDate qd ) |
100 | { | 100 | { |
101 | mIncidence = incidence; | 101 | mIncidence = incidence; |
102 | mDate = qd; | 102 | mDate = qd; |
103 | mFirstMultiItem = 0; | 103 | mFirstMultiItem = 0; |
104 | mNextMultiItem = 0; | 104 | mNextMultiItem = 0; |
105 | mLastMultiItem = 0; | 105 | mLastMultiItem = 0; |
106 | computeText(); | 106 | computeText(); |
107 | 107 | ||
108 | if ( (incidence->type() == "Todo") && | 108 | if ( (incidence->type() == "Todo") && |
109 | ( !((static_cast<Todo*>(incidence))->isCompleted()) && | 109 | ( !((static_cast<Todo*>(incidence))->isCompleted()) && |
110 | ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) { | 110 | ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) { |
111 | if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date()) | 111 | if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date()) |
112 | mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; | 112 | mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; |
113 | else | 113 | else |
114 | mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; | 114 | mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; |
115 | } | 115 | } |
116 | else { | 116 | else { |
117 | QStringList categories = mIncidence->categories(); | 117 | QStringList categories = mIncidence->categories(); |
118 | QString cat = categories.first(); | 118 | QString cat = categories.first(); |
119 | if (cat.isEmpty()) { | 119 | if (cat.isEmpty()) { |
120 | if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) | 120 | if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) |
121 | mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; | 121 | mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; |
122 | else | 122 | else |
123 | mBackgroundColor =KOPrefs::instance()->mEventColor; | 123 | mBackgroundColor =KOPrefs::instance()->mEventColor; |
124 | } else { | 124 | } else { |
125 | mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); | 125 | mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); |
126 | if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) { | 126 | if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) { |
127 | if ( mBackgroundColor == KOPrefs::instance()->mEventColor ) | 127 | if ( mBackgroundColor == KOPrefs::instance()->mEventColor ) |
128 | mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; | 128 | mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; |
129 | } | 129 | } |
130 | } | 130 | } |
131 | 131 | ||
132 | } | 132 | } |
133 | mColorGroup = QColorGroup( mBackgroundColor.light(), | 133 | mColorGroup = QColorGroup( mBackgroundColor.light(), |
134 | mBackgroundColor.dark(),mBackgroundColor.light(), | 134 | mBackgroundColor.dark(),mBackgroundColor.light(), |
135 | mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ; | 135 | mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ; |
136 | setBackgroundColor( mBackgroundColor ); | 136 | setBackgroundColor( mBackgroundColor ); |
137 | 137 | ||
138 | mConflictItems.clear(); | 138 | mConflictItems.clear(); |
139 | setCellXY(0,0,1); | 139 | setCellXY(0,0,1); |
140 | setCellXWidth(0); | 140 | setCellXWidth(0); |
141 | setSubCell(0); | 141 | setSubCell(0); |
142 | setSubCells(1); | 142 | setSubCells(1); |
143 | setMultiItem(0,0,0); | 143 | setMultiItem(0,0,0); |
144 | startMove(); | 144 | startMove(); |
145 | mSelected = true; | 145 | mSelected = true; |
146 | select(false); | 146 | select(false); |
147 | QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); | 147 | QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); |
148 | mFontPixelSize = fontinf.height();; | 148 | mFontPixelSize = fontinf.height();; |
149 | hide(); | 149 | hide(); |
150 | xPaintCoord = -1; | 150 | xPaintCoord = -1; |
151 | yPaintCoord = -1; | 151 | yPaintCoord = -1; |
152 | } | 152 | } |
153 | 153 | ||
154 | 154 | ||
155 | KOAgendaItem::~KOAgendaItem() | 155 | KOAgendaItem::~KOAgendaItem() |
156 | { | 156 | { |
157 | // qDebug("deleteKOAgendaItem::~KOAgendaItem( "); | 157 | // qDebug("deleteKOAgendaItem::~KOAgendaItem( "); |
158 | 158 | ||
159 | } | 159 | } |
160 | 160 | ||
161 | void KOAgendaItem::recreateIncidence() | 161 | void KOAgendaItem::recreateIncidence() |
162 | { | 162 | { |
163 | #if 0 | 163 | #if 0 |
164 | Incidence* newInc = mIncidence->clone(); | 164 | Incidence* newInc = mIncidence->clone(); |
165 | newInc->recreate(); | 165 | newInc->recreate(); |
166 | if ( mIncidence->doesRecur() ) { | 166 | if ( mIncidence->doesRecur() ) { |
167 | mIncidence->addExDate( mDate ); | 167 | mIncidence->addExDate( mDate ); |
168 | newInc->recurrence()->unsetRecurs(); | 168 | newInc->recurrence()->unsetRecurs(); |
169 | int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); | 169 | int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); |
170 | QTime tim = mIncidence->dtStart().time(); | 170 | QTime tim = mIncidence->dtStart().time(); |
171 | newInc->setDtStart( QDateTime(mDate, tim) ); | 171 | newInc->setDtStart( QDateTime(mDate, tim) ); |
172 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); | 172 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); |
173 | } | 173 | } |
174 | #endif | 174 | #endif |
175 | mIncidence = mIncidence->recreateCloneException( mDate ); | 175 | mIncidence = mIncidence->recreateCloneException( mDate ); |
176 | } | 176 | } |
177 | bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) | 177 | bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) |
178 | { | 178 | { |
179 | int size = AGENDA_ICON_SIZE; | 179 | int size = AGENDA_ICON_SIZE; |
180 | 180 | ||
181 | int yOff = 0; | 181 | int yOff = 0; |
182 | int xOff = 0; | 182 | int xOff = 0; |
183 | int x = pos().x() +3; | 183 | int x = pos().x() +3; |
184 | int y; | 184 | int y; |
185 | if ( mAllDay ) | 185 | if ( mAllDay ) |
186 | y = pos().y()+3; | 186 | y = pos().y()+3; |
187 | else | 187 | else |
188 | y = mCellYTop * ( height() / cellHeight() ) +3; | 188 | y = mCellYTop * ( height() / cellHeight() ) +3; |
189 | if (mIncidence->cancelled()) { | 189 | if (mIncidence->cancelled()) { |
190 | int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x; | 190 | int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x; |
191 | int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y; | 191 | int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y; |
192 | p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 ); | 192 | p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 ); |
193 | p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos ); | 193 | p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos ); |
194 | if ( horLayout ) | 194 | if ( horLayout ) |
195 | ++xOff; | 195 | ++xOff; |
196 | else | 196 | else |
197 | ++yOff; | 197 | ++yOff; |
198 | } | 198 | } |
199 | if (mIncidence->isAlarmEnabled()) { | 199 | if (mIncidence->isAlarmEnabled()) { |
200 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red ); | 200 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red ); |
201 | if ( horLayout ) | 201 | if ( horLayout ) |
202 | ++xOff; | 202 | ++xOff; |
203 | else | 203 | else |
204 | ++yOff; | 204 | ++yOff; |
205 | } | 205 | } |
206 | if (mIncidence->recurrence()->doesRecur()) { | 206 | if (mIncidence->recurrence()->doesRecur()) { |
207 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue ); | 207 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue ); |
208 | if ( horLayout ) | 208 | if ( horLayout ) |
209 | ++xOff; | 209 | ++xOff; |
210 | else | 210 | else |
211 | ++yOff; | 211 | ++yOff; |
212 | } | 212 | } |
213 | if (mIncidence->description().length() > 0) { | 213 | if (mIncidence->description().length() > 0) { |
214 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen ); | 214 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen ); |
215 | if ( horLayout ) | 215 | if ( horLayout ) |
216 | ++xOff; | 216 | ++xOff; |
217 | else | 217 | else |
218 | ++yOff; | 218 | ++yOff; |
219 | } | 219 | } |
220 | if (mIncidence->isReadOnly()) { | 220 | if (mIncidence->isReadOnly()) { |
221 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white ); | 221 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white ); |
222 | if ( horLayout ) | 222 | if ( horLayout ) |
223 | ++xOff; | 223 | ++xOff; |
224 | else | 224 | else |
225 | ++yOff; | 225 | ++yOff; |
226 | } | 226 | } |
227 | 227 | ||
228 | if (mIncidence->attendeeCount()>0) { | 228 | if (mIncidence->attendeeCount()>0) { |
229 | 229 | ||
230 | if (mIncidence->organizer() == KOPrefs::instance()->email()) { | 230 | if (mIncidence->organizer() == KOPrefs::instance()->email()) { |
231 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black ); | 231 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black ); |
232 | if ( horLayout ) | 232 | if ( horLayout ) |
233 | ++xOff; | 233 | ++xOff; |
234 | else | 234 | else |
235 | ++yOff; | 235 | ++yOff; |
236 | } else { | 236 | } else { |
237 | Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); | 237 | Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); |
238 | if (me!=0) { | 238 | if (me!=0) { |
239 | 239 | ||
240 | 240 | ||
241 | } else { | 241 | } else { |
242 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow ); | 242 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow ); |
243 | if ( horLayout ) | 243 | if ( horLayout ) |
244 | ++xOff; | 244 | ++xOff; |
245 | else | 245 | else |
246 | ++yOff; | 246 | ++yOff; |
247 | 247 | ||
248 | } | 248 | } |
249 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow ); | 249 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow ); |
250 | if ( horLayout ) | 250 | if ( horLayout ) |
251 | ++xOff; | 251 | ++xOff; |
252 | else | 252 | else |
253 | ++yOff; | 253 | ++yOff; |
254 | 254 | ||
255 | } | 255 | } |
256 | 256 | ||
257 | } | 257 | } |
258 | return ( yOff || xOff ); | 258 | return ( yOff || xOff ); |
259 | } | 259 | } |
260 | 260 | ||
261 | 261 | ||
262 | void KOAgendaItem::select(bool selected) | 262 | void KOAgendaItem::select(bool selected) |
263 | { | 263 | { |
264 | //qDebug("select %d %d",firstMultiItem(), nextMultiItem() ); | 264 | //qDebug("select %d %d",firstMultiItem(), nextMultiItem() ); |
265 | if (mSelected == selected) return; | 265 | if (mSelected == selected) return; |
266 | mSelected = selected; | 266 | mSelected = selected; |
267 | if ( ! isVisible() ) | 267 | if ( ! isVisible() ) |
268 | return; | 268 | return; |
269 | if ( firstMultiItem() ) | 269 | if ( firstMultiItem() ) |
270 | firstMultiItem()->select( selected ); | 270 | firstMultiItem()->select( selected ); |
271 | if ( !firstMultiItem() && nextMultiItem() ) { | 271 | if ( !firstMultiItem() && nextMultiItem() ) { |
272 | KOAgendaItem * placeItem = nextMultiItem(); | 272 | KOAgendaItem * placeItem = nextMultiItem(); |
273 | while ( placeItem ) { | 273 | while ( placeItem ) { |
274 | placeItem->select( selected ); | 274 | placeItem->select( selected ); |
275 | placeItem = placeItem->nextMultiItem(); | 275 | placeItem = placeItem->nextMultiItem(); |
276 | } | 276 | } |
277 | } | 277 | } |
278 | globalFlagBlockAgendaItemUpdate = 0; | 278 | globalFlagBlockAgendaItemUpdate = 0; |
279 | paintMe( selected ); | 279 | paintMe( selected ); |
280 | globalFlagBlockAgendaItemUpdate = 1; | 280 | globalFlagBlockAgendaItemUpdate = 1; |
281 | repaint( false ); | 281 | repaint( false ); |
282 | } | 282 | } |
283 | 283 | ||
284 | 284 | ||
285 | /* | 285 | /* |
286 | The eventFilter has to filter the mouse events of the agenda item childs. The | 286 | The eventFilter has to filter the mouse events of the agenda item childs. The |
287 | events are fed into the event handling method of KOAgendaItem. This allows the | 287 | events are fed into the event handling method of KOAgendaItem. This allows the |
288 | KOAgenda to handle the KOAgendaItems by using an eventFilter. | 288 | KOAgenda to handle the KOAgendaItems by using an eventFilter. |
289 | */ | 289 | */ |
290 | bool KOAgendaItem::eventFilter ( QObject *object, QEvent *e ) | 290 | bool KOAgendaItem::eventFilter ( QObject *object, QEvent *e ) |
291 | { | 291 | { |
292 | if (e->type() == QEvent::MouseButtonPress || | 292 | if (e->type() == QEvent::MouseButtonPress || |
293 | e->type() == QEvent::MouseButtonDblClick || | 293 | e->type() == QEvent::MouseButtonDblClick || |
294 | e->type() == QEvent::MouseButtonRelease || | 294 | e->type() == QEvent::MouseButtonRelease || |
295 | e->type() == QEvent::MouseMove) { | 295 | e->type() == QEvent::MouseMove) { |
296 | QMouseEvent *me = (QMouseEvent *)e; | 296 | QMouseEvent *me = (QMouseEvent *)e; |
297 | QPoint itemPos = this->mapFromGlobal(((QWidget *)object)-> | 297 | QPoint itemPos = this->mapFromGlobal(((QWidget *)object)-> |
298 | mapToGlobal(me->pos())); | 298 | mapToGlobal(me->pos())); |
299 | QMouseEvent returnEvent (e->type(),itemPos,me->button(),me->state()); | 299 | QMouseEvent returnEvent (e->type(),itemPos,me->button(),me->state()); |
300 | return event(&returnEvent); | 300 | return event(&returnEvent); |
301 | } else { | 301 | } else { |
302 | return false; | 302 | return false; |
303 | } | 303 | } |
304 | } | 304 | } |
305 | void KOAgendaItem::repaintMe( ) | 305 | void KOAgendaItem::repaintMe( ) |
306 | { | 306 | { |
307 | paintMe ( mSelected ); | 307 | paintMe ( mSelected ); |
308 | } | 308 | } |
309 | void KOAgendaItem::paintMe( bool selected, QPainter* paint ) | 309 | void KOAgendaItem::paintMe( bool selected, QPainter* paint ) |
310 | { | 310 | { |
311 | if ( globalFlagBlockAgendaItemUpdate && ! selected) | 311 | if ( globalFlagBlockAgendaItemUpdate && ! selected) |
312 | return; | 312 | return; |
313 | QPainter pa; | 313 | QPainter pa; |
314 | 314 | ||
315 | if ( mSelected ) { | 315 | if ( mSelected ) { |
316 | pa.begin( paintPixSel() ); | 316 | pa.begin( paintPixSel() ); |
317 | } else { | 317 | } else { |
318 | if ( mAllDay ) | 318 | if ( mAllDay ) |
319 | pa.begin( paintPixAllday() ); | 319 | pa.begin( paintPixAllday() ); |
320 | else | 320 | else |
321 | pa.begin( paintPix() ); | 321 | pa.begin( paintPix() ); |
322 | } | 322 | } |
323 | int x, yy, w, h; | 323 | int x, yy, w, h; |
324 | float nfh = 7.0; | 324 | float nfh = 7.0; |
325 | x = pos().x(); w = width(); h = height (); | 325 | x = pos().x(); w = width(); h = height (); |
326 | if ( mAllDay ) | 326 | if ( mAllDay ) |
327 | yy = y(); | 327 | yy = y(); |
328 | else | 328 | else |
329 | yy = mCellYTop * ( height() / cellHeight() ); | 329 | yy = mCellYTop * ( height() / cellHeight() ); |
330 | xPaintCoord= x; | 330 | xPaintCoord= x; |
331 | yPaintCoord = yy; | 331 | yPaintCoord = yy; |
332 | wPaintCoord = width(); | 332 | wPaintCoord = width(); |
333 | hPaintCoord = height(); | 333 | hPaintCoord = height(); |
334 | //qDebug("paintMe %s %d %d %d %d",incidence()->summary().latin1(), x, yy, width(), height()); | 334 | //qDebug("paintMe %s %d %d %d %d",incidence()->summary().latin1(), x, yy, width(), height()); |
335 | if ( paint == 0 ) | 335 | if ( paint == 0 ) |
336 | paint = &pa; | 336 | paint = &pa; |
337 | bool horLayout = ( w < h ); | 337 | bool horLayout = ( w < h ); |
338 | int maxhei = mFontPixelSize+4; | 338 | int maxhei = mFontPixelSize+4; |
339 | if ( horLayout ) | 339 | if ( horLayout ) |
340 | maxhei += AGENDA_ICON_SIZE -4; | 340 | maxhei += AGENDA_ICON_SIZE -4; |
341 | bool small = ( h < maxhei ); | 341 | bool small = ( h < maxhei ); |