-rw-r--r-- | korganizer/kolistview.cpp | 55 |
1 files changed, 51 insertions, 4 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 6b63d7f..09d70f1 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -1155,8 +1155,10 @@ void KOListViewListView::keyPressEvent ( QKeyEvent *e) | |||
1155 | } | 1155 | } |
1156 | KOListViewListView::KOListViewListView(KOListView * lv ) | 1156 | KOListViewListView::KOListViewListView(KOListView * lv ) |
1157 | : KListView( lv ) | 1157 | : KListView( lv, "kolistlistview", false ) |
1158 | { | 1158 | { |
1159 | mPopupTimer = new QTimer(this); | ||
1160 | connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); | ||
1159 | #ifndef DESKTOP_VERSION | 1161 | #ifndef DESKTOP_VERSION |
1160 | QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); | 1162 | //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); |
1161 | #endif | 1163 | #endif |
1162 | setSelectionMode( QListView::Multi ); | 1164 | setSelectionMode( QListView::Multi ); |
@@ -1174,5 +1176,5 @@ void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) | |||
1174 | KListView::contentsMouseDoubleClickEvent(e); | 1176 | KListView::contentsMouseDoubleClickEvent(e); |
1175 | } | 1177 | } |
1176 | 1178 | #if 0 | |
1177 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) | 1179 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) |
1178 | { | 1180 | { |
@@ -1194,2 +1196,47 @@ void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) | |||
1194 | KListView::contentsMouseMoveEvent(e); | 1196 | KListView::contentsMouseMoveEvent(e); |
1195 | } | 1197 | } |
1198 | #endif | ||
1199 | void KOListViewListView::popupMenu() | ||
1200 | { | ||
1201 | mPopupTimer->stop(); | ||
1202 | //qDebug("HUUUUUUUUUUUUUUUUUUUU "); | ||
1203 | QMouseEvent* e = new QMouseEvent( QEvent::MouseButtonPress, mEventPos ,mEventGlobalPos, RightButton , RightButton ); | ||
1204 | QApplication::postEvent( this->viewport(), e ); | ||
1205 | } | ||
1206 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) | ||
1207 | { | ||
1208 | //qDebug("contentsMousePressEvent++++ "); | ||
1209 | mYMousePos = mapToGlobal( (e->pos())).y(); | ||
1210 | if ( e->button() == LeftButton ) { | ||
1211 | mPopupTimer->start( 600 ); | ||
1212 | mEventPos = e->pos(); | ||
1213 | mEventGlobalPos = e->globalPos(); | ||
1214 | } | ||
1215 | KListView::contentsMousePressEvent( e ); | ||
1216 | if ( e->button() == RightButton ) { | ||
1217 | QListViewItem* ci = currentItem(); | ||
1218 | clearSelection(); | ||
1219 | if ( ci ) | ||
1220 | ci->setSelected( true ); | ||
1221 | } | ||
1222 | } | ||
1223 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) | ||
1224 | { | ||
1225 | mPopupTimer->stop(); | ||
1226 | KListView::contentsMouseReleaseEvent(e); | ||
1227 | } | ||
1228 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) | ||
1229 | { | ||
1230 | // qDebug("contentsMouseMoveEv....... "); | ||
1231 | // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() ); | ||
1232 | int diff = mYMousePos - mapToGlobal( (e->pos())).y(); | ||
1233 | if ( diff < 0 ) diff = -diff; | ||
1234 | if ( diff > 15 ) | ||
1235 | mPopupTimer->stop(); | ||
1236 | else { | ||
1237 | mEventPos = e->pos(); | ||
1238 | mEventGlobalPos = e->globalPos(); | ||
1239 | } | ||
1240 | KListView::contentsMouseMoveEvent(e); | ||
1241 | } | ||
1242 | |||