summaryrefslogtreecommitdiffabout
path: root/korganizer/koagenda.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/koagenda.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagenda.cpp77
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
@@ -177,3 +177,3 @@ KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent,
#ifndef DESKTOP_VERSION
- //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
+ QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
#endif
@@ -400,4 +400,2 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
static bool leftMouseDown = false;
- static bool rightMouseDown = false;
- static QTime rightClickTime;
bool rightButtonPressed = false;
@@ -405,3 +403,2 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
case QEvent::MouseButtonPress:
- rightClickTime.restart();
if (me->button() == LeftButton) {
@@ -409,4 +406,5 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
}
- else if (me->button() == RightButton)
- rightMouseDown = true;
+ else if (me->button() == RightButton) {
+ leftMouseDown = false;
+ }
blockMoving = true;
@@ -414,8 +412,14 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
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) {
@@ -447,2 +451,17 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
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() ) );
}
@@ -452,18 +471,5 @@ 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) {
@@ -489,20 +495,3 @@ 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
@@ -512,4 +501,3 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
leftMouseDown = false;
- else if (me->button() == RightButton)
- rightMouseDown = false;
+
break;
@@ -517,3 +505,3 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
case QEvent::MouseMove:
- if ( !rightMouseDown && !leftMouseDown )
+ if ( !leftMouseDown )
return true;
@@ -552,3 +540,2 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
leftMouseDown = false;
- rightMouseDown = false;
if (object == viewport()) {