From 9707cf053ab0e64949518ebd2729d432435f583c Mon Sep 17 00:00:00 2001 From: zautrix Date: Mon, 21 Mar 2005 09:12:37 +0000 Subject: agenda mouse fix --- diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index 8c2996b..dcb46a8 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp @@ -175,7 +175,7 @@ KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent, mGridSpacingY = rowSize; mAllDayMode = false; #ifndef DESKTOP_VERSION - QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); + //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); #endif mHolidayMask = 0; init(); @@ -399,10 +399,14 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) static bool blockMoving = true; static bool leftMouseDown = false; static bool rightMouseDown = false; + static QTime rightClickTime; + bool rightButtonPressed = false; switch (me->type()) { case QEvent::MouseButtonPress: - if (me->button() == LeftButton) + rightClickTime.restart(); + if (me->button() == LeftButton) { leftMouseDown = true; + } else if (me->button() == RightButton) rightMouseDown = true; blockMoving = true; @@ -446,8 +450,10 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) break; case QEvent::MouseButtonRelease: + if ( rightClickTime.elapsed() > 700 && blockMoving ) + rightButtonPressed = true; if (object != viewport()) { - if (me->button() == RightButton) { + if (me->button() == RightButton || rightButtonPressed ) { if ( blockMoving ) { mClickedItem = (KOAgendaItem *)object; if (mActionItem ) { @@ -473,6 +479,7 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) mActionItem = 0; mActionType = NOP; mItemMoved = 0; + leftMouseDown = false; return true; } endItemAction(); @@ -480,7 +487,7 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) } } else { // ---------- viewport() - if (me->button() == RightButton) { //right click + if (me->button() == RightButton || rightButtonPressed ) { //right click if ( blockMoving ) { // we did mot moved the mouse much - popup menu if ( leftMouseDown ) { // we have a simulated right click - clear left mouse action endSelectAction( false ); // do not emit new event signal -- cgit v0.9.0.2