author | zautrix <zautrix> | 2005-02-17 09:44:18 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-17 09:44:18 (UTC) |
commit | d9565b4258279d70fa651e7e6ebe072c0f3755d6 (patch) (unidiff) | |
tree | 3d4aeffd7983b34f9e32392a7e855feb6ce52dde /korganizer | |
parent | 311181f1415625529db49ae73c6ee0b86e3ce86b (diff) | |
download | kdepimpi-d9565b4258279d70fa651e7e6ebe072c0f3755d6.zip kdepimpi-d9565b4258279d70fa651e7e6ebe072c0f3755d6.tar.gz kdepimpi-d9565b4258279d70fa651e7e6ebe072c0f3755d6.tar.bz2 |
popup agenda fix
-rw-r--r-- | korganizer/koagenda.cpp | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index ffa2678..a72e470 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp | |||
@@ -389,33 +389,32 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) | |||
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 bool block = true; | 398 | static bool block = true; |
399 | switch (me->type()) { | 399 | switch (me->type()) { |
400 | case QEvent::MouseButtonPress: | 400 | case QEvent::MouseButtonPress: |
401 | //qDebug("QEvent::MouseButtonPress: "); | 401 | //qDebug("QEvent::MouseButtonPress: "); |
402 | // kdDebug() << "koagenda: filtered button press" << endl; | 402 | // kdDebug() << "koagenda: filtered button press" << endl; |
403 | if (object != viewport()) { | 403 | if (object != viewport()) { |
404 | if (me->button() == RightButton) { | 404 | if (me->button() == RightButton) { |
405 | |||
406 | mClickedItem = (KOAgendaItem *)object; | 405 | mClickedItem = (KOAgendaItem *)object; |
407 | if (mClickedItem) { | 406 | if (mClickedItem) { |
408 | selectItem(mClickedItem); | 407 | selectItem(mClickedItem); |
409 | // emit showIncidencePopupSignal(mClickedItem->incidence()); | 408 | // emit showIncidencePopupSignal(mClickedItem->incidence()); |
410 | } | 409 | } |
411 | //mItemPopup->popup(QCursor::pos()); | 410 | //mItemPopup->popup(QCursor::pos()); |
412 | } else { | 411 | } else { |
413 | mActionItem = (KOAgendaItem *)object; | 412 | mActionItem = (KOAgendaItem *)object; |
414 | if (mActionItem) { | 413 | if (mActionItem) { |
415 | if ( mSelectionHeight > 0 ) { | 414 | if ( mSelectionHeight > 0 ) { |
416 | int selectionCellX = mSelectionCellX * mGridSpacingX; | 415 | int selectionCellX = mSelectionCellX * mGridSpacingX; |
417 | int selectionYTop = mSelectionYTop; | 416 | int selectionYTop = mSelectionYTop; |
418 | int gridSpacingX = mGridSpacingX; | 417 | int gridSpacingX = mGridSpacingX; |
419 | int selectionHeight = mSelectionHeight; | 418 | int selectionHeight = mSelectionHeight; |
420 | clearSelection(); | 419 | clearSelection(); |
421 | repaintContents( selectionCellX, selectionYTop, | 420 | repaintContents( selectionCellX, selectionYTop, |
@@ -441,42 +440,53 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) | |||
441 | block = false; | 440 | block = false; |
442 | } else { | 441 | } else { |
443 | blockNewEvent = false; | 442 | blockNewEvent = false; |
444 | setCursor(arrowCursor); | 443 | setCursor(arrowCursor); |
445 | startSelectAction(viewportPos); | 444 | startSelectAction(viewportPos); |
446 | } | 445 | } |
447 | } | 446 | } |
448 | break; | 447 | break; |
449 | 448 | ||
450 | case QEvent::MouseButtonRelease: | 449 | case QEvent::MouseButtonRelease: |
451 | //qDebug("QEvent::MouseButtonRelease: %d",blockNewEvent ); | 450 | //qDebug("QEvent::MouseButtonRelease: %d",blockNewEvent ); |
452 | if (me->button() == RightButton && blockNewEvent && !block) { | 451 | if (me->button() == RightButton && blockNewEvent && !block) { |
453 | int x,y; | 452 | int x,y; |
454 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 453 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
455 | int gx,gy; | 454 | int gx,gy; |
456 | contentsToGrid(x,y,gx,gy); | 455 | contentsToGrid(x,y,gx,gy); |
457 | if ( mCurrentCellY < mStartCellY +1 ) { | 456 | if ( object == viewport() ) { |
458 | //qDebug("mCurrentCellY %d mStartCellY %d ", mCurrentCellY,mStartCellY); | 457 | if ( mCurrentCellY < mStartCellY +1 ) { |
459 | mCurrentCellX = gx; | 458 | //qDebug("mCurrentCellY %d mStartCellY %d ", mCurrentCellY,mStartCellY); |
460 | mCurrentCellY = gy; | 459 | mCurrentCellX = gx; |
461 | mStartCellX = gx; | 460 | mCurrentCellY = gy; |
462 | mStartCellY = gy; | 461 | mStartCellX = gx; |
463 | mNewItemPopup->popup( viewport()->mapToGlobal( me->pos() ) ); | 462 | mStartCellY = gy; |
464 | break; | 463 | mNewItemPopup->popup( viewport()->mapToGlobal( me->pos() ) ); |
464 | break; | ||
465 | } else { | ||
466 | blockNewEvent = false; | ||
467 | } | ||
465 | } else { | 468 | } else { |
466 | blockNewEvent = false; | 469 | mClickedItem = (KOAgendaItem *)object; |
470 | if (mActionItem ) { | ||
471 | endItemAction(); | ||
472 | } | ||
473 | if (mClickedItem) { | ||
474 | selectItem(mClickedItem); | ||
475 | emit showIncidencePopupSignal(mClickedItem->incidence()); | ||
476 | } | ||
467 | } | 477 | } |
468 | } else if (me->button() == RightButton && block ) { | 478 | } else if (me->button() == RightButton && block ) { |
469 | if (object != viewport()) { | 479 | if (object != viewport()) { |
470 | mClickedItem = (KOAgendaItem *)object; | 480 | mClickedItem = (KOAgendaItem *)object; |
471 | if (mActionItem ) { | 481 | if (mActionItem ) { |
472 | endItemAction(); | 482 | endItemAction(); |
473 | } | 483 | } |
474 | if (mClickedItem) { | 484 | if (mClickedItem) { |
475 | selectItem(mClickedItem); | 485 | selectItem(mClickedItem); |
476 | emit showIncidencePopupSignal(mClickedItem->incidence()); | 486 | emit showIncidencePopupSignal(mClickedItem->incidence()); |
477 | } | 487 | } |
478 | } | 488 | } |
479 | break; | 489 | break; |
480 | } | 490 | } |
481 | block = true; | 491 | block = true; |
482 | if (mActionItem) { | 492 | if (mActionItem) { |