author | zautrix <zautrix> | 2005-03-26 11:03:22 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-26 11:03:22 (UTC) |
commit | ef825f1805452ba2cfb30cd7a41c392d3961f01e (patch) (unidiff) | |
tree | 60e896e2867bf3d90f0719f72c50add28bcf1d04 /korganizer/kolistview.cpp | |
parent | 6427570041c902840fe0f557415a07bb7aa8c031 (diff) | |
download | kdepimpi-ef825f1805452ba2cfb30cd7a41c392d3961f01e.zip kdepimpi-ef825f1805452ba2cfb30cd7a41c392d3961f01e.tar.gz kdepimpi-ef825f1805452ba2cfb30cd7a41c392d3961f01e.tar.bz2 |
next rry
-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) | |||
1153 | e->ignore(); | 1153 | e->ignore(); |
1154 | } | 1154 | } |
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 ); |
1163 | setMultiSelection( true); | 1165 | setMultiSelection( true); |
1164 | } | 1166 | } |
@@ -1172,12 +1174,45 @@ void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) | |||
1172 | return; | 1174 | return; |
1173 | } | 1175 | } |
1174 | KListView::contentsMouseDoubleClickEvent(e); | 1176 | KListView::contentsMouseDoubleClickEvent(e); |
1175 | } | 1177 | } |
1176 | 1178 | #if 0 | |
1179 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) | ||
1180 | { | ||
1181 | //qDebug("contentsMousePressEvent++++ "); | ||
1182 | KListView::contentsMousePressEvent( e ); | ||
1183 | if ( e->button() == RightButton ) { | ||
1184 | QListViewItem* ci = currentItem(); | ||
1185 | clearSelection () ; | ||
1186 | if ( ci ) | ||
1187 | ci->setSelected( true ); | ||
1188 | } | ||
1189 | } | ||
1190 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) | ||
1191 | { | ||
1192 | KListView::contentsMouseReleaseEvent(e); | ||
1193 | } | ||
1194 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) | ||
1195 | { | ||
1196 | KListView::contentsMouseMoveEvent(e); | ||
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 | } | ||
1177 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) | 1206 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) |
1178 | { | 1207 | { |
1179 | //qDebug("contentsMousePressEvent++++ "); | 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 | } | ||
1180 | KListView::contentsMousePressEvent( e ); | 1215 | KListView::contentsMousePressEvent( e ); |
1181 | if ( e->button() == RightButton ) { | 1216 | if ( e->button() == RightButton ) { |
1182 | QListViewItem* ci = currentItem(); | 1217 | QListViewItem* ci = currentItem(); |
1183 | clearSelection () ; | 1218 | clearSelection () ; |
@@ -1186,10 +1221,22 @@ void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) | |||
1186 | } | 1221 | } |
1187 | } | 1222 | } |
1188 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) | 1223 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) |
1189 | { | 1224 | { |
1225 | mPopupTimer->stop(); | ||
1190 | KListView::contentsMouseReleaseEvent(e); | 1226 | KListView::contentsMouseReleaseEvent(e); |
1191 | } | 1227 | } |
1192 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) | 1228 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) |
1193 | { | 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 | } | ||
1194 | KListView::contentsMouseMoveEvent(e); | 1240 | KListView::contentsMouseMoveEvent(e); |
1195 | } | 1241 | } |
1242 | |||