-rw-r--r-- | korganizer/koagenda.cpp | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index 0aef929..ffa2678 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp @@ -439,26 +439,32 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) if (me->button() == RightButton ) { blockNewEvent = true; - //qDebug("right "); + block = false; + } else { + blockNewEvent = false; + setCursor(arrowCursor); + startSelectAction(viewportPos); + } + } + break; + + case QEvent::MouseButtonRelease: + //qDebug("QEvent::MouseButtonRelease: %d",blockNewEvent ); + if (me->button() == RightButton && blockNewEvent && !block) { int x,y; viewportToContents(viewportPos.x(),viewportPos.y(),x,y); int gx,gy; contentsToGrid(x,y,gx,gy); - mStartCellX = gx; - mStartCellY = gy; + if ( mCurrentCellY < mStartCellY +1 ) { + //qDebug("mCurrentCellY %d mStartCellY %d ", mCurrentCellY,mStartCellY); mCurrentCellX = gx; mCurrentCellY = gy; + mStartCellX = gx; + mStartCellY = gy; mNewItemPopup->popup( viewport()->mapToGlobal( me->pos() ) ); - + break; } else { blockNewEvent = false; - setCursor(arrowCursor); - startSelectAction(viewportPos); } - } - break; - - case QEvent::MouseButtonRelease: - //qDebug("QEvent::MouseButtonRelease: "); - if (me->button() == RightButton && block ) { + } else if (me->button() == RightButton && block ) { if (object != viewport()) { mClickedItem = (KOAgendaItem *)object; @@ -492,5 +498,4 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) } else if ( mActionType == SELECT ) { if (me->button() == RightButton ) { - } else { endSelectAction( !blockNewEvent ); |