-rw-r--r-- | korganizer/kolistview.cpp | 53 |
1 files changed, 50 insertions, 3 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 6b63d7f..09d70f1 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp @@ -1153,12 +1153,14 @@ void KOListViewListView::keyPressEvent ( QKeyEvent *e) e->ignore(); } } KOListViewListView::KOListViewListView(KOListView * lv ) - : KListView( lv ) + : KListView( lv, "kolistlistview", false ) { + mPopupTimer = new QTimer(this); + connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); #ifndef DESKTOP_VERSION - QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); + //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); #endif setSelectionMode( QListView::Multi ); setMultiSelection( true); } @@ -1172,12 +1174,45 @@ void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) return; } KListView::contentsMouseDoubleClickEvent(e); } - +#if 0 +void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) +{ + //qDebug("contentsMousePressEvent++++ "); + KListView::contentsMousePressEvent( e ); + if ( e->button() == RightButton ) { + QListViewItem* ci = currentItem(); + clearSelection () ; + if ( ci ) + ci->setSelected( true ); + } +} +void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) +{ + KListView::contentsMouseReleaseEvent(e); +} +void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) +{ + KListView::contentsMouseMoveEvent(e); +} +#endif +void KOListViewListView::popupMenu() +{ + mPopupTimer->stop(); + //qDebug("HUUUUUUUUUUUUUUUUUUUU "); + QMouseEvent* e = new QMouseEvent( QEvent::MouseButtonPress, mEventPos ,mEventGlobalPos, RightButton , RightButton ); + QApplication::postEvent( this->viewport(), e ); +} void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) { //qDebug("contentsMousePressEvent++++ "); + mYMousePos = mapToGlobal( (e->pos())).y(); + if ( e->button() == LeftButton ) { + mPopupTimer->start( 600 ); + mEventPos = e->pos(); + mEventGlobalPos = e->globalPos(); + } KListView::contentsMousePressEvent( e ); if ( e->button() == RightButton ) { QListViewItem* ci = currentItem(); clearSelection () ; @@ -1186,10 +1221,22 @@ void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) } } void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) { + mPopupTimer->stop(); KListView::contentsMouseReleaseEvent(e); } void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) { + // qDebug("contentsMouseMoveEv....... "); + // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() ); + int diff = mYMousePos - mapToGlobal( (e->pos())).y(); + if ( diff < 0 ) diff = -diff; + if ( diff > 15 ) + mPopupTimer->stop(); + else { + mEventPos = e->pos(); + mEventGlobalPos = e->globalPos(); + } KListView::contentsMouseMoveEvent(e); } + |