author | zautrix <zautrix> | 2005-02-25 11:29:28 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-25 11:29:28 (UTC) |
commit | ff810f8f74f6928e664bf52f8e8d128edb8ac5ad (patch) (unidiff) | |
tree | d5473801c69b42d90879104fc4d05a5ad9b69e87 /korganizer/kolistview.cpp | |
parent | ff8a2f593fae5ffe82f889ab70d32bf02a45f4fb (diff) | |
download | kdepimpi-ff810f8f74f6928e664bf52f8e8d128edb8ac5ad.zip kdepimpi-ff810f8f74f6928e664bf52f8e8d128edb8ac5ad.tar.gz kdepimpi-ff810f8f74f6928e664bf52f8e8d128edb8ac5ad.tar.bz2 |
many small 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 6acee75..710a9f9 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -990,194 +990,194 @@ void KOListView::clear() | |||
990 | Incidence* KOListView::currentItem() | 990 | Incidence* KOListView::currentItem() |
991 | { | 991 | { |
992 | if ( mListView->currentItem() ) | 992 | if ( mListView->currentItem() ) |
993 | return ((KOListViewItem*) mListView->currentItem())->data(); | 993 | return ((KOListViewItem*) mListView->currentItem())->data(); |
994 | return 0; | 994 | return 0; |
995 | } | 995 | } |
996 | void KOListView::keyPressEvent ( QKeyEvent *e) | 996 | void KOListView::keyPressEvent ( QKeyEvent *e) |
997 | { | 997 | { |
998 | 998 | ||
999 | if ( e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace ) { | 999 | if ( e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace ) { |
1000 | deleteAll(); | 1000 | deleteAll(); |
1001 | return; | 1001 | return; |
1002 | } | 1002 | } |
1003 | 1003 | ||
1004 | e->ignore(); | 1004 | e->ignore(); |
1005 | } | 1005 | } |
1006 | void KOListViewListView::keyPressEvent ( QKeyEvent *e) | 1006 | void KOListViewListView::keyPressEvent ( QKeyEvent *e) |
1007 | { | 1007 | { |
1008 | 1008 | ||
1009 | switch ( e->key() ) { | 1009 | switch ( e->key() ) { |
1010 | case Qt::Key_Down: | 1010 | case Qt::Key_Down: |
1011 | if ( e->state() == ShiftButton ) { | 1011 | if ( e->state() == ShiftButton ) { |
1012 | QListViewItem* cn = currentItem(); | 1012 | QListViewItem* cn = currentItem(); |
1013 | if ( !cn ) | 1013 | if ( !cn ) |
1014 | cn = firstChild(); | 1014 | cn = firstChild(); |
1015 | if ( !cn ) | 1015 | if ( !cn ) |
1016 | return; | 1016 | return; |
1017 | while ( cn->nextSibling() ) | 1017 | while ( cn->nextSibling() ) |
1018 | cn = cn->nextSibling(); | 1018 | cn = cn->nextSibling(); |
1019 | setCurrentItem ( cn ); | 1019 | setCurrentItem ( cn ); |
1020 | ensureItemVisible ( cn ); | 1020 | ensureItemVisible ( cn ); |
1021 | 1021 | ||
1022 | e->accept(); | 1022 | e->accept(); |
1023 | return; | 1023 | return; |
1024 | } | 1024 | } |
1025 | if ( e->state() == ControlButton ) { | 1025 | if ( e->state() == ControlButton ) { |
1026 | int count = childCount (); | 1026 | int count = childCount (); |
1027 | int jump = count / 5; | 1027 | int jump = count / 5; |
1028 | QListViewItem* cn; | 1028 | QListViewItem* cn; |
1029 | cn = currentItem(); | 1029 | cn = currentItem(); |
1030 | if ( ! cn ) | 1030 | if ( ! cn ) |
1031 | return; | 1031 | return; |
1032 | if ( jump == 0 ) | 1032 | if ( jump == 0 ) |
1033 | jump = 1; | 1033 | jump = 1; |
1034 | while ( jump && cn->nextSibling() ) { | 1034 | while ( jump && cn->nextSibling() ) { |
1035 | cn = cn->nextSibling(); | 1035 | cn = cn->nextSibling(); |
1036 | --jump; | 1036 | --jump; |
1037 | } | 1037 | } |
1038 | setCurrentItem ( cn ); | 1038 | setCurrentItem ( cn ); |
1039 | ensureItemVisible ( cn ); | 1039 | ensureItemVisible ( cn ); |
1040 | 1040 | ||
1041 | } else | 1041 | } else |
1042 | QListView::keyPressEvent ( e ) ; | 1042 | QListView::keyPressEvent ( e ) ; |
1043 | e->accept(); | 1043 | e->accept(); |
1044 | break; | 1044 | break; |
1045 | 1045 | ||
1046 | case Qt::Key_Up: | 1046 | case Qt::Key_Up: |
1047 | if ( e->state() == ShiftButton ) { | 1047 | if ( e->state() == ShiftButton ) { |
1048 | QListViewItem* cn = firstChild(); | 1048 | QListViewItem* cn = firstChild(); |
1049 | if ( cn ) { | 1049 | if ( cn ) { |
1050 | setCurrentItem ( cn ); | 1050 | setCurrentItem ( cn ); |
1051 | ensureItemVisible ( cn ); | 1051 | ensureItemVisible ( cn ); |
1052 | } | 1052 | } |
1053 | e->accept(); | 1053 | e->accept(); |
1054 | return; | 1054 | return; |
1055 | } | 1055 | } |
1056 | if ( e->state() == ControlButton ) { | 1056 | if ( e->state() == ControlButton ) { |
1057 | int count = childCount (); | 1057 | int count = childCount (); |
1058 | int jump = count / 5; | 1058 | int jump = count / 5; |
1059 | QListViewItem* cn; | 1059 | QListViewItem* cn; |
1060 | cn = currentItem(); | 1060 | cn = currentItem(); |
1061 | if ( ! cn ) | 1061 | if ( ! cn ) |
1062 | return; | 1062 | return; |
1063 | if ( jump == 0 ) | 1063 | if ( jump == 0 ) |
1064 | jump = 1; | 1064 | jump = 1; |
1065 | while ( jump && cn->itemAbove ()) { | 1065 | while ( jump && cn->itemAbove ()) { |
1066 | cn = cn->itemAbove (); | 1066 | cn = cn->itemAbove (); |
1067 | --jump; | 1067 | --jump; |
1068 | } | 1068 | } |
1069 | setCurrentItem ( cn ); | 1069 | setCurrentItem ( cn ); |
1070 | ensureItemVisible ( cn ); | 1070 | ensureItemVisible ( cn ); |
1071 | } else | 1071 | } else |
1072 | QListView::keyPressEvent ( e ) ; | 1072 | QListView::keyPressEvent ( e ) ; |
1073 | e->accept(); | 1073 | e->accept(); |
1074 | break; | 1074 | break; |
1075 | case Qt::Key_I: { | 1075 | case Qt::Key_I: { |
1076 | QListViewItem* cn; | 1076 | QListViewItem* cn; |
1077 | cn = currentItem(); | 1077 | cn = currentItem(); |
1078 | if ( cn ) { | 1078 | if ( cn ) { |
1079 | KOListViewItem* ci = (KOListViewItem*)( cn ); | 1079 | KOListViewItem* ci = (KOListViewItem*)( cn ); |
1080 | if ( ci ){ | 1080 | if ( ci ){ |
1081 | //emit showIncidence( ci->data()); | 1081 | //emit showIncidence( ci->data()); |
1082 | cn = cn->nextSibling(); | 1082 | cn = cn->nextSibling(); |
1083 | if ( cn ) { | 1083 | if ( cn ) { |
1084 | setCurrentItem ( cn ); | 1084 | setCurrentItem ( cn ); |
1085 | ensureItemVisible ( cn ); | 1085 | ensureItemVisible ( cn ); |
1086 | emit showIncidence( ci->data()); | ||
1087 | } | 1086 | } |
1087 | emit showIncidence( ci->data()); | ||
1088 | } | 1088 | } |
1089 | } | 1089 | } |
1090 | e->accept(); | 1090 | e->accept(); |
1091 | } | 1091 | } |
1092 | break; | 1092 | break; |
1093 | case Qt::Key_Return: | 1093 | case Qt::Key_Return: |
1094 | case Qt::Key_Enter: | 1094 | case Qt::Key_Enter: |
1095 | { | 1095 | { |
1096 | QListViewItem* cn; | 1096 | QListViewItem* cn; |
1097 | cn = currentItem(); | 1097 | cn = currentItem(); |
1098 | if ( cn ) { | 1098 | if ( cn ) { |
1099 | KOListViewItem* ci = (KOListViewItem*)( cn ); | 1099 | KOListViewItem* ci = (KOListViewItem*)( cn ); |
1100 | if ( ci ){ | 1100 | if ( ci ){ |
1101 | if ( e->state() == ShiftButton ) | 1101 | if ( e->state() == ShiftButton ) |
1102 | ci->setSelected( false ); | 1102 | ci->setSelected( false ); |
1103 | else | 1103 | else |
1104 | ci->setSelected( true ); | 1104 | ci->setSelected( true ); |
1105 | cn = cn->nextSibling(); | 1105 | cn = cn->nextSibling(); |
1106 | if ( cn ) { | 1106 | if ( cn ) { |
1107 | setCurrentItem ( cn ); | 1107 | setCurrentItem ( cn ); |
1108 | ensureItemVisible ( cn ); | 1108 | ensureItemVisible ( cn ); |
1109 | } | 1109 | } |
1110 | } | 1110 | } |
1111 | } | 1111 | } |
1112 | e->accept(); | 1112 | e->accept(); |
1113 | } | 1113 | } |
1114 | break; | 1114 | break; |
1115 | default: | 1115 | default: |
1116 | e->ignore(); | 1116 | e->ignore(); |
1117 | } | 1117 | } |
1118 | } | 1118 | } |
1119 | KOListViewListView::KOListViewListView(KOListView * lv ) | 1119 | KOListViewListView::KOListViewListView(KOListView * lv ) |
1120 | : KListView( lv ) | 1120 | : KListView( lv ) |
1121 | { | 1121 | { |
1122 | #ifndef DESKTOP_VERSION | 1122 | #ifndef DESKTOP_VERSION |
1123 | QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); | 1123 | QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); |
1124 | #endif | 1124 | #endif |
1125 | mYMousePos = -1000; | 1125 | mYMousePos = -1000; |
1126 | setSelectionMode( QListView::Multi ); | 1126 | setSelectionMode( QListView::Multi ); |
1127 | setMultiSelection( true); | 1127 | setMultiSelection( true); |
1128 | mAllowPopupMenu = true; | 1128 | mAllowPopupMenu = true; |
1129 | mMouseDown = false; | 1129 | mMouseDown = false; |
1130 | 1130 | ||
1131 | } | 1131 | } |
1132 | void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) | 1132 | void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) |
1133 | { | 1133 | { |
1134 | if (!e) return; | 1134 | if (!e) return; |
1135 | QPoint vp = contentsToViewport(e->pos()); | 1135 | QPoint vp = contentsToViewport(e->pos()); |
1136 | QListViewItem *item = itemAt(vp); | 1136 | QListViewItem *item = itemAt(vp); |
1137 | if (!item) { | 1137 | if (!item) { |
1138 | emit newEvent(); | 1138 | emit newEvent(); |
1139 | return; | 1139 | return; |
1140 | } | 1140 | } |
1141 | KListView::contentsMouseDoubleClickEvent(e); | 1141 | KListView::contentsMouseDoubleClickEvent(e); |
1142 | } | 1142 | } |
1143 | 1143 | ||
1144 | 1144 | ||
1145 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) | 1145 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) |
1146 | { | 1146 | { |
1147 | //qDebug("contentsMousePressEvent++++ "); | 1147 | //qDebug("contentsMousePressEvent++++ "); |
1148 | if (! mMouseDown ) { | 1148 | if (! mMouseDown ) { |
1149 | mAllowPopupMenu = true; | 1149 | mAllowPopupMenu = true; |
1150 | mYMousePos = mapToGlobal( (e->pos())).y(); | 1150 | mYMousePos = mapToGlobal( (e->pos())).y(); |
1151 | } | 1151 | } |
1152 | if ( e->button() == RightButton && mMouseDown ) | 1152 | if ( e->button() == RightButton && mMouseDown ) |
1153 | return; | 1153 | return; |
1154 | if ( e->button() == LeftButton ) | 1154 | if ( e->button() == LeftButton ) |
1155 | mMouseDown = true; | 1155 | mMouseDown = true; |
1156 | KListView::contentsMousePressEvent( e ); | 1156 | KListView::contentsMousePressEvent( e ); |
1157 | } | 1157 | } |
1158 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) | 1158 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) |
1159 | { | 1159 | { |
1160 | //qDebug("contentsMouseReleaseEv---- "); | 1160 | //qDebug("contentsMouseReleaseEv---- "); |
1161 | if ( ! mMouseDown ) { | 1161 | if ( ! mMouseDown ) { |
1162 | if ( e->button() == RightButton && ! mAllowPopupMenu ) | 1162 | if ( e->button() == RightButton && ! mAllowPopupMenu ) |
1163 | return; | 1163 | return; |
1164 | QListViewItem* ci = currentItem(); | 1164 | QListViewItem* ci = currentItem(); |
1165 | if ( ci ) | 1165 | if ( ci ) |
1166 | ci->setSelected( true ); | 1166 | ci->setSelected( true ); |
1167 | KListView::contentsMouseReleaseEvent(e); | 1167 | KListView::contentsMouseReleaseEvent(e); |
1168 | return; | 1168 | return; |
1169 | } | 1169 | } |
1170 | if ( e->button() == LeftButton ) | 1170 | if ( e->button() == LeftButton ) |
1171 | mMouseDown = false; | 1171 | mMouseDown = false; |
1172 | if ( e->button() == RightButton && ! mAllowPopupMenu ) | 1172 | if ( e->button() == RightButton && ! mAllowPopupMenu ) |
1173 | return; | 1173 | return; |
1174 | if ( e->button() == RightButton ) { | 1174 | if ( e->button() == RightButton ) { |
1175 | QListViewItem* ci = currentItem(); | 1175 | QListViewItem* ci = currentItem(); |
1176 | if ( ci ) | 1176 | if ( ci ) |
1177 | ci->setSelected( true ); | 1177 | ci->setSelected( true ); |
1178 | } | 1178 | } |
1179 | KListView::contentsMouseReleaseEvent(e); | 1179 | KListView::contentsMouseReleaseEvent(e); |
1180 | } | 1180 | } |
1181 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) | 1181 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) |
1182 | { | 1182 | { |
1183 | // qDebug("contentsMouseMoveEv....... "); | 1183 | // qDebug("contentsMouseMoveEv....... "); |