author | zautrix <zautrix> | 2005-04-01 13:07:01 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-01 13:07:01 (UTC) |
commit | 93003b1f8348f112648d3cc20acb21b062220e21 (patch) (unidiff) | |
tree | 901bebe154a15f05296158db5da3689b849e8281 /korganizer | |
parent | f8e027db1d950ec27a3c47fc2a5ea2fe49ae9772 (diff) | |
download | kdepimpi-93003b1f8348f112648d3cc20acb21b062220e21.zip kdepimpi-93003b1f8348f112648d3cc20acb21b062220e21.tar.gz kdepimpi-93003b1f8348f112648d3cc20acb21b062220e21.tar.bz2 |
fixes
-rw-r--r-- | korganizer/kolistview.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 09d70f1..15e094d 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -1026,217 +1026,217 @@ void KOListView::clear() | |||
1026 | 1026 | ||
1027 | Incidence* KOListView::currentItem() | 1027 | Incidence* KOListView::currentItem() |
1028 | { | 1028 | { |
1029 | if ( mListView->currentItem() ) | 1029 | if ( mListView->currentItem() ) |
1030 | return ((KOListViewItem*) mListView->currentItem())->data(); | 1030 | return ((KOListViewItem*) mListView->currentItem())->data(); |
1031 | return 0; | 1031 | return 0; |
1032 | } | 1032 | } |
1033 | void KOListView::keyPressEvent ( QKeyEvent *e) | 1033 | void KOListView::keyPressEvent ( QKeyEvent *e) |
1034 | { | 1034 | { |
1035 | 1035 | ||
1036 | if ( e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace ) { | 1036 | if ( e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace ) { |
1037 | deleteAll(); | 1037 | deleteAll(); |
1038 | return; | 1038 | return; |
1039 | } | 1039 | } |
1040 | 1040 | ||
1041 | e->ignore(); | 1041 | e->ignore(); |
1042 | } | 1042 | } |
1043 | void KOListViewListView::keyPressEvent ( QKeyEvent *e) | 1043 | void KOListViewListView::keyPressEvent ( QKeyEvent *e) |
1044 | { | 1044 | { |
1045 | 1045 | ||
1046 | switch ( e->key() ) { | 1046 | switch ( e->key() ) { |
1047 | case Qt::Key_Down: | 1047 | case Qt::Key_Down: |
1048 | if ( e->state() == ShiftButton ) { | 1048 | if ( e->state() == ShiftButton ) { |
1049 | QListViewItem* cn = currentItem(); | 1049 | QListViewItem* cn = currentItem(); |
1050 | if ( !cn ) | 1050 | if ( !cn ) |
1051 | cn = firstChild(); | 1051 | cn = firstChild(); |
1052 | if ( !cn ) | 1052 | if ( !cn ) |
1053 | return; | 1053 | return; |
1054 | while ( cn->nextSibling() ) | 1054 | while ( cn->nextSibling() ) |
1055 | cn = cn->nextSibling(); | 1055 | cn = cn->nextSibling(); |
1056 | setCurrentItem ( cn ); | 1056 | setCurrentItem ( cn ); |
1057 | ensureItemVisible ( cn ); | 1057 | ensureItemVisible ( cn ); |
1058 | 1058 | ||
1059 | e->accept(); | 1059 | e->accept(); |
1060 | return; | 1060 | return; |
1061 | } | 1061 | } |
1062 | if ( e->state() == ControlButton ) { | 1062 | if ( e->state() == ControlButton ) { |
1063 | int count = childCount (); | 1063 | int count = childCount (); |
1064 | int jump = count / 5; | 1064 | int jump = count / 5; |
1065 | QListViewItem* cn; | 1065 | QListViewItem* cn; |
1066 | cn = currentItem(); | 1066 | cn = currentItem(); |
1067 | if ( ! cn ) | 1067 | if ( ! cn ) |
1068 | return; | 1068 | return; |
1069 | if ( jump == 0 ) | 1069 | if ( jump == 0 ) |
1070 | jump = 1; | 1070 | jump = 1; |
1071 | while ( jump && cn->nextSibling() ) { | 1071 | while ( jump && cn->nextSibling() ) { |
1072 | cn = cn->nextSibling(); | 1072 | cn = cn->nextSibling(); |
1073 | --jump; | 1073 | --jump; |
1074 | } | 1074 | } |
1075 | setCurrentItem ( cn ); | 1075 | setCurrentItem ( cn ); |
1076 | ensureItemVisible ( cn ); | 1076 | ensureItemVisible ( cn ); |
1077 | 1077 | ||
1078 | } else | 1078 | } else |
1079 | QListView::keyPressEvent ( e ) ; | 1079 | QListView::keyPressEvent ( e ) ; |
1080 | e->accept(); | 1080 | e->accept(); |
1081 | break; | 1081 | break; |
1082 | 1082 | ||
1083 | case Qt::Key_Up: | 1083 | case Qt::Key_Up: |
1084 | if ( e->state() == ShiftButton ) { | 1084 | if ( e->state() == ShiftButton ) { |
1085 | QListViewItem* cn = firstChild(); | 1085 | QListViewItem* cn = firstChild(); |
1086 | if ( cn ) { | 1086 | if ( cn ) { |
1087 | setCurrentItem ( cn ); | 1087 | setCurrentItem ( cn ); |
1088 | ensureItemVisible ( cn ); | 1088 | ensureItemVisible ( cn ); |
1089 | } | 1089 | } |
1090 | e->accept(); | 1090 | e->accept(); |
1091 | return; | 1091 | return; |
1092 | } | 1092 | } |
1093 | if ( e->state() == ControlButton ) { | 1093 | if ( e->state() == ControlButton ) { |
1094 | int count = childCount (); | 1094 | int count = childCount (); |
1095 | int jump = count / 5; | 1095 | int jump = count / 5; |
1096 | QListViewItem* cn; | 1096 | QListViewItem* cn; |
1097 | cn = currentItem(); | 1097 | cn = currentItem(); |
1098 | if ( ! cn ) | 1098 | if ( ! cn ) |
1099 | return; | 1099 | return; |
1100 | if ( jump == 0 ) | 1100 | if ( jump == 0 ) |
1101 | jump = 1; | 1101 | jump = 1; |
1102 | while ( jump && cn->itemAbove ()) { | 1102 | while ( jump && cn->itemAbove ()) { |
1103 | cn = cn->itemAbove (); | 1103 | cn = cn->itemAbove (); |
1104 | --jump; | 1104 | --jump; |
1105 | } | 1105 | } |
1106 | setCurrentItem ( cn ); | 1106 | setCurrentItem ( cn ); |
1107 | ensureItemVisible ( cn ); | 1107 | ensureItemVisible ( cn ); |
1108 | } else | 1108 | } else |
1109 | QListView::keyPressEvent ( e ) ; | 1109 | QListView::keyPressEvent ( e ) ; |
1110 | e->accept(); | 1110 | e->accept(); |
1111 | break; | 1111 | break; |
1112 | case Qt::Key_I: { | 1112 | case Qt::Key_I: { |
1113 | QListViewItem* cn; | 1113 | QListViewItem* cn; |
1114 | cn = currentItem(); | 1114 | cn = currentItem(); |
1115 | if ( cn ) { | 1115 | if ( cn ) { |
1116 | KOListViewItem* ci = (KOListViewItem*)( cn ); | 1116 | KOListViewItem* ci = (KOListViewItem*)( cn ); |
1117 | if ( ci ){ | 1117 | if ( ci ){ |
1118 | //emit showIncidence( ci->data()); | 1118 | //emit showIncidence( ci->data()); |
1119 | cn = cn->nextSibling(); | 1119 | cn = cn->nextSibling(); |
1120 | if ( cn ) { | 1120 | if ( cn ) { |
1121 | setCurrentItem ( cn ); | 1121 | setCurrentItem ( cn ); |
1122 | ensureItemVisible ( cn ); | 1122 | ensureItemVisible ( cn ); |
1123 | } | 1123 | } |
1124 | emit showIncidence( ci->data()); | 1124 | emit showIncidence( ci->data()); |
1125 | } | 1125 | } |
1126 | } | 1126 | } |
1127 | e->accept(); | 1127 | e->accept(); |
1128 | } | 1128 | } |
1129 | break; | 1129 | break; |
1130 | case Qt::Key_Return: | 1130 | case Qt::Key_Return: |
1131 | case Qt::Key_Enter: | 1131 | case Qt::Key_Enter: |
1132 | { | 1132 | { |
1133 | QListViewItem* cn; | 1133 | QListViewItem* cn; |
1134 | cn = currentItem(); | 1134 | cn = currentItem(); |
1135 | if ( cn ) { | 1135 | if ( cn ) { |
1136 | KOListViewItem* ci = (KOListViewItem*)( cn ); | 1136 | KOListViewItem* ci = (KOListViewItem*)( cn ); |
1137 | if ( ci ){ | 1137 | if ( ci ){ |
1138 | if ( e->state() == ShiftButton ) | 1138 | if ( e->state() == ShiftButton ) |
1139 | ci->setSelected( false ); | 1139 | ci->setSelected( false ); |
1140 | else | 1140 | else |
1141 | ci->setSelected( true ); | 1141 | ci->setSelected( true ); |
1142 | cn = cn->nextSibling(); | 1142 | cn = cn->nextSibling(); |
1143 | if ( cn ) { | 1143 | if ( cn ) { |
1144 | setCurrentItem ( cn ); | 1144 | setCurrentItem ( cn ); |
1145 | ensureItemVisible ( cn ); | 1145 | ensureItemVisible ( cn ); |
1146 | } | 1146 | } |
1147 | } | 1147 | } |
1148 | } | 1148 | } |
1149 | e->accept(); | 1149 | e->accept(); |
1150 | } | 1150 | } |
1151 | break; | 1151 | break; |
1152 | default: | 1152 | default: |
1153 | e->ignore(); | 1153 | e->ignore(); |
1154 | } | 1154 | } |
1155 | } | 1155 | } |
1156 | KOListViewListView::KOListViewListView(KOListView * lv ) | 1156 | KOListViewListView::KOListViewListView(KOListView * lv ) |
1157 | : KListView( lv, "kolistlistview", false ) | 1157 | : KListView( lv, "kolistlistview", false ) |
1158 | { | 1158 | { |
1159 | mPopupTimer = new QTimer(this); | 1159 | mPopupTimer = new QTimer(this); |
1160 | connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); | 1160 | connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); |
1161 | #ifndef DESKTOP_VERSION | 1161 | #ifndef DESKTOP_VERSION |
1162 | //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); | 1162 | //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); |
1163 | #endif | 1163 | #endif |
1164 | setSelectionMode( QListView::Multi ); | 1164 | setSelectionMode( QListView::Multi ); |
1165 | setMultiSelection( true); | 1165 | setMultiSelection( true); |
1166 | } | 1166 | } |
1167 | void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) | 1167 | void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) |
1168 | { | 1168 | { |
1169 | if (!e) return; | 1169 | if (!e) return; |
1170 | QPoint vp = contentsToViewport(e->pos()); | 1170 | QPoint vp = contentsToViewport(e->pos()); |
1171 | QListViewItem *item = itemAt(vp); | 1171 | QListViewItem *item = itemAt(vp); |
1172 | if (!item) { | 1172 | if (!item) { |
1173 | emit newEvent(); | 1173 | emit newEvent(); |
1174 | return; | 1174 | return; |
1175 | } | 1175 | } |
1176 | KListView::contentsMouseDoubleClickEvent(e); | 1176 | KListView::contentsMouseDoubleClickEvent(e); |
1177 | } | 1177 | } |
1178 | #if 0 | 1178 | #if 0 |
1179 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) | 1179 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) |
1180 | { | 1180 | { |
1181 | //qDebug("contentsMousePressEvent++++ "); | 1181 | //qDebug("contentsMousePressEvent++++ "); |
1182 | KListView::contentsMousePressEvent( e ); | 1182 | KListView::contentsMousePressEvent( e ); |
1183 | if ( e->button() == RightButton ) { | 1183 | if ( e->button() == RightButton ) { |
1184 | QListViewItem* ci = currentItem(); | 1184 | QListViewItem* ci = currentItem(); |
1185 | clearSelection () ; | 1185 | clearSelection () ; |
1186 | if ( ci ) | 1186 | if ( ci ) |
1187 | ci->setSelected( true ); | 1187 | ci->setSelected( true ); |
1188 | } | 1188 | } |
1189 | } | 1189 | } |
1190 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) | 1190 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) |
1191 | { | 1191 | { |
1192 | KListView::contentsMouseReleaseEvent(e); | 1192 | KListView::contentsMouseReleaseEvent(e); |
1193 | } | 1193 | } |
1194 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) | 1194 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) |
1195 | { | 1195 | { |
1196 | KListView::contentsMouseMoveEvent(e); | 1196 | KListView::contentsMouseMoveEvent(e); |
1197 | } | 1197 | } |
1198 | #endif | 1198 | #endif |
1199 | void KOListViewListView::popupMenu() | 1199 | void KOListViewListView::popupMenu() |
1200 | { | 1200 | { |
1201 | mPopupTimer->stop(); | 1201 | mPopupTimer->stop(); |
1202 | //qDebug("HUUUUUUUUUUUUUUUUUUUU "); | 1202 | //qDebug("HUUUUUUUUUUUUUUUUUUUU "); |
1203 | QMouseEvent* e = new QMouseEvent( QEvent::MouseButtonPress, mEventPos ,mEventGlobalPos, RightButton , RightButton ); | 1203 | QMouseEvent* e = new QMouseEvent( QEvent::MouseButtonPress, mEventPos ,mEventGlobalPos, RightButton , RightButton ); |
1204 | QApplication::postEvent( this->viewport(), e ); | 1204 | QApplication::postEvent( this->viewport(), e ); |
1205 | } | 1205 | } |
1206 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) | 1206 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) |
1207 | { | 1207 | { |
1208 | //qDebug("contentsMousePressEvent++++ "); | 1208 | //qDebug("contentsMousePressEvent++++ "); |
1209 | mYMousePos = mapToGlobal( (e->pos())).y(); | 1209 | mYMousePos = mapToGlobal( (e->pos())).y(); |
1210 | if ( e->button() == LeftButton ) { | 1210 | if ( e->button() == LeftButton ) { |
1211 | mPopupTimer->start( 600 ); | 1211 | mPopupTimer->start( 600 ); |
1212 | mEventPos = e->pos(); | 1212 | mEventPos = e->pos(); |
1213 | mEventGlobalPos = e->globalPos(); | 1213 | mEventGlobalPos = e->globalPos(); |
1214 | } | 1214 | } |
1215 | KListView::contentsMousePressEvent( e ); | 1215 | KListView::contentsMousePressEvent( e ); |
1216 | if ( e->button() == RightButton ) { | 1216 | if ( e->button() == RightButton ) { |
1217 | QListViewItem* ci = currentItem(); | 1217 | QListViewItem* ci = currentItem(); |
1218 | clearSelection(); | 1218 | //clearSelection(); |
1219 | if ( ci ) | 1219 | if ( ci ) |
1220 | ci->setSelected( true ); | 1220 | ci->setSelected( true ); |
1221 | } | 1221 | } |
1222 | } | 1222 | } |
1223 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) | 1223 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) |
1224 | { | 1224 | { |
1225 | mPopupTimer->stop(); | 1225 | mPopupTimer->stop(); |
1226 | KListView::contentsMouseReleaseEvent(e); | 1226 | KListView::contentsMouseReleaseEvent(e); |
1227 | } | 1227 | } |
1228 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) | 1228 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) |
1229 | { | 1229 | { |
1230 | // qDebug("contentsMouseMoveEv....... "); | 1230 | // qDebug("contentsMouseMoveEv....... "); |
1231 | // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() ); | 1231 | // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() ); |
1232 | int diff = mYMousePos - mapToGlobal( (e->pos())).y(); | 1232 | int diff = mYMousePos - mapToGlobal( (e->pos())).y(); |
1233 | if ( diff < 0 ) diff = -diff; | 1233 | if ( diff < 0 ) diff = -diff; |
1234 | if ( diff > 15 ) | 1234 | if ( diff > 15 ) |
1235 | mPopupTimer->stop(); | 1235 | mPopupTimer->stop(); |
1236 | else { | 1236 | else { |
1237 | mEventPos = e->pos(); | 1237 | mEventPos = e->pos(); |
1238 | mEventGlobalPos = e->globalPos(); | 1238 | mEventGlobalPos = e->globalPos(); |
1239 | } | 1239 | } |
1240 | KListView::contentsMouseMoveEvent(e); | 1240 | KListView::contentsMouseMoveEvent(e); |
1241 | } | 1241 | } |
1242 | 1242 | ||