-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 @@ -166,25 +166,25 @@ void MarcusBains::updateLocation(bool recalculate) */ KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent, const char *name,WFlags f) : QScrollView(parent,name,f) { mColumns = columns; mRows = rows; mGridSpacingY = rowSize; mAllDayMode = false; #ifndef DESKTOP_VERSION - QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); + //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); #endif mHolidayMask = 0; init(); } /* Create an agenda widget with columns columns and one row. This is used for all-day events. */ KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,WFlags f) : QScrollView(parent,name,f) { @@ -390,28 +390,32 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) QPoint viewportPos; if (object != viewport()) { viewportPos = ((QWidget *)object)->mapToParent(me->pos()); } else { viewportPos = me->pos(); } static int startX = 0; static int startY = 0; static int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 15 : 20 ); 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; startX = viewportPos.x(); startY = viewportPos.y(); if (object != viewport()) { if (me->button() == RightButton) { mClickedItem = (KOAgendaItem *)object; if (mClickedItem) { selectItem(mClickedItem); } } else if (me->button() == LeftButton) { @@ -437,26 +441,28 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) } } else { // ---------- viewport() selectItem(0); mActionItem = 0; if (me->button() == LeftButton ) { setCursor(arrowCursor); startSelectAction(viewportPos); } } 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 ) { endItemAction(); } leftMouseDown = false; // no more leftMouse computation if (mClickedItem) { selectItem(mClickedItem); emit showIncidencePopupSignal(mClickedItem->incidence()); } } } else if (me->button() == LeftButton && leftMouseDown) { @@ -464,32 +470,33 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) QPoint clipperPos = clipper()->mapFromGlobal(viewport()->mapToGlobal(viewportPos)); //qDebug(" %d %d %d ",clipperPos.y(),visibleHeight() , 9 ); if ( mActionType == MOVE && (clipperPos.y() > visibleHeight()-2 ||clipperPos.y() < 0 ) ) { mScrollUpTimer.stop(); mScrollDownTimer.stop(); mActionItem->resetMove(); placeSubCells( mActionItem ); // emit startDragSignal( mActionItem->incidence() ); setCursor( arrowCursor ); mActionItem = 0; mActionType = NOP; mItemMoved = 0; + leftMouseDown = false; return true; } endItemAction(); } } } 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 leftMouseDown = false; // no more leftMouse computation } int x,y; viewportToContents(viewportPos.x(),viewportPos.y(),x,y); int gx,gy; contentsToGrid(x,y,gx,gy); mCurrentCellX = gx; mCurrentCellY = gy; mStartCellX = gx; |