author | zautrix <zautrix> | 2005-03-25 18:26:36 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-25 18:26:36 (UTC) |
commit | 89a72c007045dcfa5dbf57012b4cf0c2aebd1495 (patch) (side-by-side diff) | |
tree | 6accbe5706b724e307d1590152fa2d2c78cdef70 /korganizer/koagenda.cpp | |
parent | 3326831dbf6f962e97a978781361db5198f6a035 (diff) | |
download | kdepimpi-89a72c007045dcfa5dbf57012b4cf0c2aebd1495.zip kdepimpi-89a72c007045dcfa5dbf57012b4cf0c2aebd1495.tar.gz kdepimpi-89a72c007045dcfa5dbf57012b4cf0c2aebd1495.tar.bz2 |
layout fixes
-rw-r--r-- | korganizer/koagenda.cpp | 77 |
1 files changed, 32 insertions, 45 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index 2820ca2..66ad4ec 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp @@ -176,5 +176,5 @@ KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent, mAllDayMode = false; #ifndef DESKTOP_VERSION - //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); + QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); #endif mHolidayMask = 0; @@ -399,24 +399,28 @@ 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: - rightClickTime.restart(); if (me->button() == LeftButton) { leftMouseDown = true; } - else if (me->button() == RightButton) - rightMouseDown = true; + else if (me->button() == RightButton) { + leftMouseDown = false; + } blockMoving = true; startX = viewportPos.x(); startY = viewportPos.y(); - if (object != viewport()) { + if (object != viewport()) { // item clicked ************** if (me->button() == RightButton) { + leftMouseDown = false; mClickedItem = (KOAgendaItem *)object; + if (mActionItem ) { + endItemAction(); + } if (mClickedItem) { selectItem(mClickedItem); - } + emit showIncidencePopupSignal(mClickedItem->incidence()); + } + return true; } else if (me->button() == LeftButton) { mActionItem = (KOAgendaItem *)object; @@ -446,4 +450,19 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) setCursor(arrowCursor); startSelectAction(viewportPos); + } else if (me->button() == RightButton ) { + setCursor(arrowCursor); + 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; + mStartCellY = gy; + mNewItemPopup->popup( viewport()->mapToGlobal( me->pos() ) ); } } @@ -451,20 +470,7 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) case QEvent::MouseButtonRelease: - if ( rightClickTime.elapsed() > 500 && blockMoving ) - rightButtonPressed = true; + if (object != viewport()) { - 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) { + if (me->button() == LeftButton && leftMouseDown) { if (mActionItem) { QPoint clipperPos = clipper()->mapFromGlobal(viewport()->mapToGlobal(viewportPos)); @@ -488,22 +494,5 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) } else { // ---------- viewport() - 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; - mStartCellY = gy; - mNewItemPopup->popup( viewport()->mapToGlobal( me->pos() ) ); - } - } - else if (me->button() == LeftButton && leftMouseDown ) { //left click + if (me->button() == LeftButton && leftMouseDown ) { //left click endSelectAction( true ); // emit new event signal } @@ -511,10 +500,9 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) if (me->button() == LeftButton) leftMouseDown = false; - else if (me->button() == RightButton) - rightMouseDown = false; + break; case QEvent::MouseMove: - if ( !rightMouseDown && !leftMouseDown ) + if ( !leftMouseDown ) return true; if ( blockMoving ) { @@ -551,5 +539,4 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) blockMoving = false; leftMouseDown = false; - rightMouseDown = false; if (object == viewport()) { selectItem(0); |