-rw-r--r-- | korganizer/komonthview.cpp | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 437debe..10e4f1d 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -115,7 +115,10 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e) | |||
115 | scrollBy(-4,0); | 115 | scrollBy(-4,0); |
116 | break; | 116 | break; |
117 | case Key_Up: | 117 | case Key_Up: |
118 | if(!count()) break; | 118 | if(count() < 2) { |
119 | e->ignore(); | ||
120 | break; | ||
121 | } | ||
119 | setCurrentItem((currentItem()+count()-1)%count()); | 122 | setCurrentItem((currentItem()+count()-1)%count()); |
120 | if(!itemVisible(currentItem())) { | 123 | if(!itemVisible(currentItem())) { |
121 | if((unsigned int) currentItem() == (count()-1)) { | 124 | if((unsigned int) currentItem() == (count()-1)) { |
@@ -126,7 +129,10 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e) | |||
126 | } | 129 | } |
127 | break; | 130 | break; |
128 | case Key_Down: | 131 | case Key_Down: |
129 | if(!count()) break; | 132 | if(count() < 2) { |
133 | e->ignore(); | ||
134 | break; | ||
135 | } | ||
130 | setCurrentItem((currentItem()+1)%count()); | 136 | setCurrentItem((currentItem()+1)%count()); |
131 | if(!itemVisible(currentItem())) { | 137 | if(!itemVisible(currentItem())) { |
132 | if(currentItem() == 0) { | 138 | if(currentItem() == 0) { |
@@ -949,6 +955,7 @@ void KOMonthView::changeEventDisplay(Event *, int) | |||
949 | 955 | ||
950 | void KOMonthView::updateView() | 956 | void KOMonthView::updateView() |
951 | { | 957 | { |
958 | |||
952 | if ( !updatePossible ) | 959 | if ( !updatePossible ) |
953 | return; | 960 | return; |
954 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); | 961 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); |
@@ -960,6 +967,7 @@ void KOMonthView::updateView() | |||
960 | //qDebug("KOMonthView::updateView() "); | 967 | //qDebug("KOMonthView::updateView() "); |
961 | processSelectionChange(); | 968 | processSelectionChange(); |
962 | // qDebug("---------------------------------------------------------------------+ "); | 969 | // qDebug("---------------------------------------------------------------------+ "); |
970 | setFocus(); | ||
963 | } | 971 | } |
964 | 972 | ||
965 | void KOMonthView::resizeEvent(QResizeEvent * e) | 973 | void KOMonthView::resizeEvent(QResizeEvent * e) |
@@ -1123,7 +1131,24 @@ void KOMonthView::clearSelection() | |||
1123 | } | 1131 | } |
1124 | void KOMonthView::keyPressEvent ( QKeyEvent * e ) | 1132 | void KOMonthView::keyPressEvent ( QKeyEvent * e ) |
1125 | { | 1133 | { |
1126 | 1134 | switch(e->key()) { | |
1135 | break; | ||
1136 | case Key_Up: | ||
1137 | { | ||
1138 | emit prevMonth(); | ||
1139 | setFocus(); | ||
1140 | } | ||
1141 | e->accept(); | ||
1142 | break; | ||
1143 | case Key_Down: | ||
1144 | { | ||
1145 | emit nextMonth(); | ||
1146 | setFocus(); | ||
1147 | } | ||
1148 | e->accept(); | ||
1149 | break; | ||
1150 | default: | ||
1127 | e->ignore(); | 1151 | e->ignore(); |
1128 | 1152 | break; | |
1153 | } | ||
1129 | } | 1154 | } |