-rw-r--r-- | korganizer/koagenda.cpp | 77 | ||||
-rw-r--r-- | korganizer/koagendaitem.cpp | 2 | ||||
-rw-r--r-- | korganizer/kolistview.cpp | 46 | ||||
-rw-r--r-- | korganizer/kolistview.h | 2 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 11 |
5 files changed, 48 insertions, 90 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, | |||
177 | #ifndef DESKTOP_VERSION | 177 | #ifndef DESKTOP_VERSION |
178 | //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 178 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
179 | #endif | 179 | #endif |
@@ -400,4 +400,2 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) | |||
400 | static bool leftMouseDown = false; | 400 | static bool leftMouseDown = false; |
401 | static bool rightMouseDown = false; | ||
402 | static QTime rightClickTime; | ||
403 | bool rightButtonPressed = false; | 401 | bool rightButtonPressed = false; |
@@ -405,3 +403,2 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) | |||
405 | case QEvent::MouseButtonPress: | 403 | case QEvent::MouseButtonPress: |
406 | rightClickTime.restart(); | ||
407 | if (me->button() == LeftButton) { | 404 | if (me->button() == LeftButton) { |
@@ -409,4 +406,5 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) | |||
409 | } | 406 | } |
410 | else if (me->button() == RightButton) | 407 | else if (me->button() == RightButton) { |
411 | rightMouseDown = true; | 408 | leftMouseDown = false; |
409 | } | ||
412 | blockMoving = true; | 410 | blockMoving = true; |
@@ -414,8 +412,14 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) | |||
414 | startY = viewportPos.y(); | 412 | startY = viewportPos.y(); |
415 | if (object != viewport()) { | 413 | if (object != viewport()) { // item clicked ************** |
416 | if (me->button() == RightButton) { | 414 | if (me->button() == RightButton) { |
415 | leftMouseDown = false; | ||
417 | mClickedItem = (KOAgendaItem *)object; | 416 | mClickedItem = (KOAgendaItem *)object; |
417 | if (mActionItem ) { | ||
418 | endItemAction(); | ||
419 | } | ||
418 | if (mClickedItem) { | 420 | if (mClickedItem) { |
419 | selectItem(mClickedItem); | 421 | selectItem(mClickedItem); |
420 | } | 422 | emit showIncidencePopupSignal(mClickedItem->incidence()); |
423 | } | ||
424 | return true; | ||
421 | } else if (me->button() == LeftButton) { | 425 | } else if (me->button() == LeftButton) { |
@@ -447,2 +451,17 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) | |||
447 | startSelectAction(viewportPos); | 451 | startSelectAction(viewportPos); |
452 | } else if (me->button() == RightButton ) { | ||
453 | setCursor(arrowCursor); | ||
454 | if ( leftMouseDown ) { // we have a simulated right click - clear left mouse action | ||
455 | endSelectAction( false ); // do not emit new event signal | ||
456 | leftMouseDown = false; // no more leftMouse computation | ||
457 | } | ||
458 | int x,y; | ||
459 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | ||
460 | int gx,gy; | ||
461 | contentsToGrid(x,y,gx,gy); | ||
462 | mCurrentCellX = gx; | ||
463 | mCurrentCellY = gy; | ||
464 | mStartCellX = gx; | ||
465 | mStartCellY = gy; | ||
466 | mNewItemPopup->popup( viewport()->mapToGlobal( me->pos() ) ); | ||
448 | } | 467 | } |
@@ -452,18 +471,5 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) | |||
452 | case QEvent::MouseButtonRelease: | 471 | case QEvent::MouseButtonRelease: |
453 | if ( rightClickTime.elapsed() > 500 && blockMoving ) | 472 | |
454 | rightButtonPressed = true; | ||
455 | if (object != viewport()) { | 473 | if (object != viewport()) { |
456 | if (me->button() == RightButton || rightButtonPressed ) { | 474 | if (me->button() == LeftButton && leftMouseDown) { |
457 | if ( blockMoving ) { | ||
458 | mClickedItem = (KOAgendaItem *)object; | ||
459 | if (mActionItem ) { | ||
460 | endItemAction(); | ||
461 | } | ||
462 | leftMouseDown = false; // no more leftMouse computation | ||
463 | if (mClickedItem) { | ||
464 | selectItem(mClickedItem); | ||
465 | emit showIncidencePopupSignal(mClickedItem->incidence()); | ||
466 | } | ||
467 | } | ||
468 | } else if (me->button() == LeftButton && leftMouseDown) { | ||
469 | if (mActionItem) { | 475 | if (mActionItem) { |
@@ -489,20 +495,3 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) | |||
489 | } else { // ---------- viewport() | 495 | } else { // ---------- viewport() |
490 | if (me->button() == RightButton || rightButtonPressed ) { //right click | 496 | if (me->button() == LeftButton && leftMouseDown ) { //left click |
491 | if ( blockMoving ) { // we did mot moved the mouse much - popup menu | ||
492 | if ( leftMouseDown ) { // we have a simulated right click - clear left mouse action | ||
493 | endSelectAction( false ); // do not emit new event signal | ||
494 | leftMouseDown = false; // no more leftMouse computation | ||
495 | } | ||
496 | int x,y; | ||
497 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | ||
498 | int gx,gy; | ||
499 | contentsToGrid(x,y,gx,gy); | ||
500 | mCurrentCellX = gx; | ||
501 | mCurrentCellY = gy; | ||
502 | mStartCellX = gx; | ||
503 | mStartCellY = gy; | ||
504 | mNewItemPopup->popup( viewport()->mapToGlobal( me->pos() ) ); | ||
505 | } | ||
506 | } | ||
507 | else if (me->button() == LeftButton && leftMouseDown ) { //left click | ||
508 | endSelectAction( true ); // emit new event signal | 497 | endSelectAction( true ); // emit new event signal |
@@ -512,4 +501,3 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) | |||
512 | leftMouseDown = false; | 501 | leftMouseDown = false; |
513 | else if (me->button() == RightButton) | 502 | |
514 | rightMouseDown = false; | ||
515 | break; | 503 | break; |
@@ -517,3 +505,3 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) | |||
517 | case QEvent::MouseMove: | 505 | case QEvent::MouseMove: |
518 | if ( !rightMouseDown && !leftMouseDown ) | 506 | if ( !leftMouseDown ) |
519 | return true; | 507 | return true; |
@@ -552,3 +540,2 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) | |||
552 | leftMouseDown = false; | 540 | leftMouseDown = false; |
553 | rightMouseDown = false; | ||
554 | if (object == viewport()) { | 541 | if (object == viewport()) { |
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index b30ad75..905c1bf 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp | |||
@@ -77,3 +77,3 @@ KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool | |||
77 | #ifndef DESKTOP_VERSION | 77 | #ifndef DESKTOP_VERSION |
78 | //QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); | 78 | QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); |
79 | #endif | 79 | #endif |
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 3519985..6b63d7f 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -310,3 +310,3 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent, | |||
310 | this,SLOT(defaultItemAction(QListViewItem *))); | 310 | this,SLOT(defaultItemAction(QListViewItem *))); |
311 | QObject::connect(mListView,SIGNAL(rightButtonClicked ( QListViewItem *, | 311 | QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *, |
312 | const QPoint &, int )), | 312 | const QPoint &, int )), |
@@ -1161,8 +1161,4 @@ KOListViewListView::KOListViewListView(KOListView * lv ) | |||
1161 | #endif | 1161 | #endif |
1162 | mYMousePos = -1000; | ||
1163 | setSelectionMode( QListView::Multi ); | 1162 | setSelectionMode( QListView::Multi ); |
1164 | setMultiSelection( true); | 1163 | setMultiSelection( true); |
1165 | mAllowPopupMenu = true; | ||
1166 | mMouseDown = false; | ||
1167 | |||
1168 | } | 1164 | } |
@@ -1180,3 +1176,2 @@ void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) | |||
1180 | 1176 | ||
1181 | |||
1182 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) | 1177 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) |
@@ -1184,11 +1179,9 @@ void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) | |||
1184 | //qDebug("contentsMousePressEvent++++ "); | 1179 | //qDebug("contentsMousePressEvent++++ "); |
1185 | if (! mMouseDown ) { | ||
1186 | mAllowPopupMenu = true; | ||
1187 | mYMousePos = mapToGlobal( (e->pos())).y(); | ||
1188 | } | ||
1189 | if ( e->button() == RightButton && mMouseDown ) | ||
1190 | return; | ||
1191 | if ( e->button() == LeftButton ) | ||
1192 | mMouseDown = true; | ||
1193 | KListView::contentsMousePressEvent( e ); | 1180 | KListView::contentsMousePressEvent( e ); |
1181 | if ( e->button() == RightButton ) { | ||
1182 | QListViewItem* ci = currentItem(); | ||
1183 | clearSelection () ; | ||
1184 | if ( ci ) | ||
1185 | ci->setSelected( true ); | ||
1186 | } | ||
1194 | } | 1187 | } |
@@ -1196,21 +1189,2 @@ void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) | |||
1196 | { | 1189 | { |
1197 | //qDebug("contentsMouseReleaseEv---- "); | ||
1198 | if ( ! mMouseDown ) { | ||
1199 | if ( e->button() == RightButton && ! mAllowPopupMenu ) | ||
1200 | return; | ||
1201 | QListViewItem* ci = currentItem(); | ||
1202 | if ( ci ) | ||
1203 | ci->setSelected( true ); | ||
1204 | KListView::contentsMouseReleaseEvent(e); | ||
1205 | return; | ||
1206 | } | ||
1207 | if ( e->button() == LeftButton ) | ||
1208 | mMouseDown = false; | ||
1209 | if ( e->button() == RightButton && ! mAllowPopupMenu ) | ||
1210 | return; | ||
1211 | if ( e->button() == RightButton ) { | ||
1212 | QListViewItem* ci = currentItem(); | ||
1213 | if ( ci ) | ||
1214 | ci->setSelected( true ); | ||
1215 | } | ||
1216 | KListView::contentsMouseReleaseEvent(e); | 1190 | KListView::contentsMouseReleaseEvent(e); |
@@ -1219,8 +1193,2 @@ void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) | |||
1219 | { | 1193 | { |
1220 | // qDebug("contentsMouseMoveEv....... "); | ||
1221 | // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() ); | ||
1222 | int diff = mYMousePos - mapToGlobal( (e->pos())).y(); | ||
1223 | if ( diff < 0 ) diff = -diff; | ||
1224 | if ( diff > 20 ) | ||
1225 | mAllowPopupMenu = false; | ||
1226 | KListView::contentsMouseMoveEvent(e); | 1194 | KListView::contentsMouseMoveEvent(e); |
diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h index 0d9c525..eca71e2 100644 --- a/korganizer/kolistview.h +++ b/korganizer/kolistview.h | |||
@@ -225,5 +225,3 @@ class KOListViewListView : public KListView | |||
225 | void contentsMouseMoveEvent(QMouseEvent *e); | 225 | void contentsMouseMoveEvent(QMouseEvent *e); |
226 | bool mAllowPopupMenu; | ||
227 | bool mMouseDown; | 226 | bool mMouseDown; |
228 | int mYMousePos; | ||
229 | }; | 227 | }; |
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 12233ee..9085775 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -516,2 +516,7 @@ void MonthViewCell::startUpdateCell() | |||
516 | } | 516 | } |
517 | if ( mAvailItemList.count() > 20 ) { | ||
518 | mAvailItemList.setAutoDelete( true ); | ||
519 | mAvailItemList.clear(); | ||
520 | mAvailItemList.setAutoDelete( false ); | ||
521 | } | ||
517 | /* | 522 | /* |
@@ -819,3 +824,2 @@ void MonthViewCell::enableScrollBars( bool enabled ) | |||
819 | if ( enabled ) { | 824 | if ( enabled ) { |
820 | |||
821 | QListBoxItem *fi = firstItem (); | 825 | QListBoxItem *fi = firstItem (); |
@@ -824,5 +828,6 @@ void MonthViewCell::enableScrollBars( bool enabled ) | |||
824 | int hei = numRows () * ihei; | 828 | int hei = numRows () * ihei; |
825 | if ( hei < height() - horizontalScrollBar()->height () ) | 829 | if ( hei < height() - horizontalScrollBar()->height () ) { |
826 | setVScrollBarMode(QScrollView::AlwaysOff); | 830 | setVScrollBarMode(QScrollView::AlwaysOff); |
827 | else | 831 | } |
832 | else | ||
828 | setVScrollBarMode(QScrollView::Auto); | 833 | setVScrollBarMode(QScrollView::Auto); |