summaryrefslogtreecommitdiffabout
path: root/korganizer/kolistview.cpp
Unidiff
Diffstat (limited to 'korganizer/kolistview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kolistview.cpp2
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
@@ -894,297 +894,297 @@ void KOListView::changeEventDisplay(Event *event, int action)
894 case KOGlobals::EVENTADDED: 894 case KOGlobals::EVENTADDED:
895 addIncidence( event ); 895 addIncidence( event );
896 break; 896 break;
897 case KOGlobals::EVENTEDITED: 897 case KOGlobals::EVENTEDITED:
898 item = getItemForEvent(event); 898 item = getItemForEvent(event);
899 if (item) { 899 if (item) {
900 mUidDict.remove( event->uid() ); 900 mUidDict.remove( event->uid() );
901 delete item; 901 delete item;
902 addIncidence( event ); 902 addIncidence( event );
903 } 903 }
904 break; 904 break;
905 case KOGlobals::EVENTDELETED: 905 case KOGlobals::EVENTDELETED:
906 item = getItemForEvent(event); 906 item = getItemForEvent(event);
907 if (item) { 907 if (item) {
908 mUidDict.remove( event->uid() ); 908 mUidDict.remove( event->uid() );
909 delete item; 909 delete item;
910 } 910 }
911 break; 911 break;
912 default: 912 default:
913 ; 913 ;
914 } 914 }
915} 915}
916 916
917KOListViewItem *KOListView::getItemForEvent(Event *event) 917KOListViewItem *KOListView::getItemForEvent(Event *event)
918{ 918{
919 KOListViewItem *item = (KOListViewItem *)mListView->firstChild(); 919 KOListViewItem *item = (KOListViewItem *)mListView->firstChild();
920 while (item) { 920 while (item) {
921 if (item->data() == event) return item; 921 if (item->data() == event) return item;
922 item = (KOListViewItem *)item->nextSibling(); 922 item = (KOListViewItem *)item->nextSibling();
923 } 923 }
924 return 0; 924 return 0;
925} 925}
926 926
927void KOListView::defaultItemAction(QListViewItem *i) 927void KOListView::defaultItemAction(QListViewItem *i)
928{ 928{
929 KOListViewItem *item = static_cast<KOListViewItem *>( i ); 929 KOListViewItem *item = static_cast<KOListViewItem *>( i );
930 if ( item ) defaultAction( item->data() ); 930 if ( item ) defaultAction( item->data() );
931 931
932} 932}
933 933
934void KOListView::popupMenu(QListViewItem *item,const QPoint &,int) 934void KOListView::popupMenu(QListViewItem *item,const QPoint &,int)
935{ 935{
936 mActiveItem = (KOListViewItem *)item; 936 mActiveItem = (KOListViewItem *)item;
937 if (mActiveItem) { 937 if (mActiveItem) {
938 Incidence *incidence = mActiveItem->data(); 938 Incidence *incidence = mActiveItem->data();
939 mPopupMenu->showIncidencePopup(incidence); 939 mPopupMenu->showIncidencePopup(incidence);
940 940
941 /* 941 /*
942 if ( incidence && incidence->type() == "Event" ) { 942 if ( incidence && incidence->type() == "Event" ) {
943 Event *event = static_cast<Event *>( incidence ); 943 Event *event = static_cast<Event *>( incidence );
944 mPopupMenu->showEventPopup(event); 944 mPopupMenu->showEventPopup(event);
945 } 945 }
946 */ 946 */
947 } 947 }
948} 948}
949 949
950void KOListView::readSettings(KConfig *config, QString setting) 950void KOListView::readSettings(KConfig *config, QString setting)
951{ 951{
952 // qDebug("KOListView::readSettings "); 952 // qDebug("KOListView::readSettings ");
953 mListView->restoreLayout(config,setting); 953 mListView->restoreLayout(config,setting);
954} 954}
955 955
956void KOListView::writeSettings(KConfig *config, QString setting) 956void KOListView::writeSettings(KConfig *config, QString setting)
957{ 957{
958 // qDebug("KOListView::writeSettings "); 958 // qDebug("KOListView::writeSettings ");
959 mListView->saveLayout(config, setting); 959 mListView->saveLayout(config, setting);
960} 960}
961 961
962void KOListView::processSelectionChange(QListViewItem *) 962void KOListView::processSelectionChange(QListViewItem *)
963{ 963{
964 964
965 KOListViewItem *item = 965 KOListViewItem *item =
966 static_cast<KOListViewItem *>( mListView->currentItem() ); 966 static_cast<KOListViewItem *>( mListView->currentItem() );
967 967
968 if ( !item ) { 968 if ( !item ) {
969 emit incidenceSelected( 0 ); 969 emit incidenceSelected( 0 );
970 } else { 970 } else {
971 emit incidenceSelected( item->data() ); 971 emit incidenceSelected( item->data() );
972 } 972 }
973} 973}
974 974
975void KOListView::clearSelection() 975void KOListView::clearSelection()
976{ 976{
977 mListView->selectAll( false ); 977 mListView->selectAll( false );
978} 978}
979void KOListView::allSelection() 979void KOListView::allSelection()
980{ 980{
981 mListView->selectAll( true ); 981 mListView->selectAll( true );
982} 982}
983 983
984void KOListView::clear() 984void KOListView::clear()
985{ 985{
986 mListView->clear(); 986 mListView->clear();
987 mUidDict.clear(); 987 mUidDict.clear();
988} 988}
989 989
990Incidence* KOListView::currentItem() 990Incidence* 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}
996void KOListView::keyPressEvent ( QKeyEvent *e) 996void 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}
1006void KOListViewListView::keyPressEvent ( QKeyEvent *e) 1006void 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}
1119KOListViewListView::KOListViewListView(KOListView * lv ) 1119KOListViewListView::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}
1132void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) 1132void 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
1145void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) 1145void 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}
1158void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) 1158void 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}
1181void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) 1181void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e)
1182{ 1182{
1183 // qDebug("contentsMouseMoveEv....... "); 1183 // qDebug("contentsMouseMoveEv....... ");
1184 // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() ); 1184 // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() );
1185 int diff = mYMousePos - mapToGlobal( (e->pos())).y(); 1185 int diff = mYMousePos - mapToGlobal( (e->pos())).y();
1186 if ( diff < 0 ) diff = -diff; 1186 if ( diff < 0 ) diff = -diff;
1187 if ( diff > 20 ) 1187 if ( diff > 20 )
1188 mAllowPopupMenu = false; 1188 mAllowPopupMenu = false;
1189 KListView::contentsMouseMoveEvent(e); 1189 KListView::contentsMouseMoveEvent(e);
1190} 1190}