author | zautrix <zautrix> | 2005-03-21 09:12:37 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-21 09:12:37 (UTC) |
commit | 9707cf053ab0e64949518ebd2729d432435f583c (patch) (unidiff) | |
tree | dad8fca3e1eafc17062f1f183f50bfdb3fac5b8b /korganizer | |
parent | e0351d382e7344191c3a7963eefe3396f816f7a0 (diff) | |
download | kdepimpi-9707cf053ab0e64949518ebd2729d432435f583c.zip kdepimpi-9707cf053ab0e64949518ebd2729d432435f583c.tar.gz kdepimpi-9707cf053ab0e64949518ebd2729d432435f583c.tar.bz2 |
agenda mouse fix
-rw-r--r-- | korganizer/koagenda.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index 8c2996b..dcb46a8 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp | |||
@@ -172,13 +172,13 @@ KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent, | |||
172 | 172 | ||
173 | mColumns = columns; | 173 | mColumns = columns; |
174 | mRows = rows; | 174 | mRows = rows; |
175 | mGridSpacingY = rowSize; | 175 | mGridSpacingY = rowSize; |
176 | mAllDayMode = false; | 176 | mAllDayMode = false; |
177 | #ifndef DESKTOP_VERSION | 177 | #ifndef DESKTOP_VERSION |
178 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 178 | //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
179 | #endif | 179 | #endif |
180 | mHolidayMask = 0; | 180 | mHolidayMask = 0; |
181 | init(); | 181 | init(); |
182 | } | 182 | } |
183 | 183 | ||
184 | /* | 184 | /* |
@@ -396,16 +396,20 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) | |||
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; | ||
403 | bool rightButtonPressed = false; | ||
402 | switch (me->type()) { | 404 | switch (me->type()) { |
403 | case QEvent::MouseButtonPress: | 405 | case QEvent::MouseButtonPress: |
404 | if (me->button() == LeftButton) | 406 | rightClickTime.restart(); |
407 | if (me->button() == LeftButton) { | ||
405 | leftMouseDown = true; | 408 | leftMouseDown = true; |
409 | } | ||
406 | else if (me->button() == RightButton) | 410 | else if (me->button() == RightButton) |
407 | rightMouseDown = true; | 411 | rightMouseDown = true; |
408 | blockMoving = true; | 412 | blockMoving = true; |
409 | startX = viewportPos.x(); | 413 | startX = viewportPos.x(); |
410 | startY = viewportPos.y(); | 414 | startY = viewportPos.y(); |
411 | if (object != viewport()) { | 415 | if (object != viewport()) { |
@@ -443,14 +447,16 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) | |||
443 | startSelectAction(viewportPos); | 447 | startSelectAction(viewportPos); |
444 | } | 448 | } |
445 | } | 449 | } |
446 | break; | 450 | break; |
447 | 451 | ||
448 | case QEvent::MouseButtonRelease: | 452 | case QEvent::MouseButtonRelease: |
453 | if ( rightClickTime.elapsed() > 700 && blockMoving ) | ||
454 | rightButtonPressed = true; | ||
449 | if (object != viewport()) { | 455 | if (object != viewport()) { |
450 | if (me->button() == RightButton) { | 456 | if (me->button() == RightButton || rightButtonPressed ) { |
451 | if ( blockMoving ) { | 457 | if ( blockMoving ) { |
452 | mClickedItem = (KOAgendaItem *)object; | 458 | mClickedItem = (KOAgendaItem *)object; |
453 | if (mActionItem ) { | 459 | if (mActionItem ) { |
454 | endItemAction(); | 460 | endItemAction(); |
455 | } | 461 | } |
456 | leftMouseDown = false; // no more leftMouse computation | 462 | leftMouseDown = false; // no more leftMouse computation |
@@ -470,20 +476,21 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) | |||
470 | placeSubCells( mActionItem ); | 476 | placeSubCells( mActionItem ); |
471 | // emit startDragSignal( mActionItem->incidence() ); | 477 | // emit startDragSignal( mActionItem->incidence() ); |
472 | setCursor( arrowCursor ); | 478 | setCursor( arrowCursor ); |
473 | mActionItem = 0; | 479 | mActionItem = 0; |
474 | mActionType = NOP; | 480 | mActionType = NOP; |
475 | mItemMoved = 0; | 481 | mItemMoved = 0; |
482 | leftMouseDown = false; | ||
476 | return true; | 483 | return true; |
477 | } | 484 | } |
478 | endItemAction(); | 485 | endItemAction(); |
479 | } | 486 | } |
480 | } | 487 | } |
481 | 488 | ||
482 | } else { // ---------- viewport() | 489 | } else { // ---------- viewport() |
483 | if (me->button() == RightButton) { //right click | 490 | if (me->button() == RightButton || rightButtonPressed ) { //right click |
484 | if ( blockMoving ) { // we did mot moved the mouse much - popup menu | 491 | if ( blockMoving ) { // we did mot moved the mouse much - popup menu |
485 | 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 |
486 | endSelectAction( false ); // do not emit new event signal | 493 | endSelectAction( false ); // do not emit new event signal |
487 | leftMouseDown = false; // no more leftMouse computation | 494 | leftMouseDown = false; // no more leftMouse computation |
488 | } | 495 | } |
489 | int x,y; | 496 | int x,y; |