-rw-r--r-- | korganizer/komonthview.cpp | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index d825493..940d288 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -124,12 +124,14 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e) | |||
124 | e->ignore(); | 124 | e->ignore(); |
125 | break; | 125 | break; |
126 | } | 126 | } |
127 | setCurrentItem((currentItem()+count()-1)%count()); | 127 | if ( count() ) { |
128 | if(!itemVisible(currentItem())) { | 128 | setCurrentItem((currentItem()+count()-1)%count()); |
129 | if((unsigned int) currentItem() == (count()-1)) { | 129 | if(!itemVisible(currentItem())) { |
130 | setTopItem(currentItem()-numItemsVisible()+1); | 130 | if((unsigned int) currentItem() == (count()-1)) { |
131 | } else { | 131 | setTopItem(currentItem()-numItemsVisible()+1); |
132 | setTopItem(topItem()-1); | 132 | } else { |
133 | setTopItem(topItem()-1); | ||
134 | } | ||
133 | } | 135 | } |
134 | } | 136 | } |
135 | break; | 137 | break; |
@@ -138,12 +140,14 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e) | |||
138 | e->ignore(); | 140 | e->ignore(); |
139 | break; | 141 | break; |
140 | } | 142 | } |
141 | setCurrentItem((currentItem()+1)%count()); | 143 | if ( count () ) { |
142 | if(!itemVisible(currentItem())) { | 144 | setCurrentItem((currentItem()+1)%count()); |
143 | if(currentItem() == 0) { | 145 | if(!itemVisible(currentItem())) { |
144 | setTopItem(0); | 146 | if(currentItem() == 0) { |
145 | } else { | 147 | setTopItem(0); |
146 | setTopItem(topItem()+1); | 148 | } else { |
149 | setTopItem(topItem()+1); | ||
150 | } | ||
147 | } | 151 | } |
148 | } | 152 | } |
149 | break; | 153 | break; |
@@ -162,12 +166,14 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e) | |||
162 | 166 | ||
163 | void KNoScrollListBox::oneDown() | 167 | void KNoScrollListBox::oneDown() |
164 | { | 168 | { |
165 | setCurrentItem((currentItem()+1)%count()); | 169 | if ( count () ) { |
166 | if(!itemVisible(currentItem())) { | 170 | setCurrentItem((currentItem()+1)%count()); |
167 | if(currentItem() == 0) { | 171 | if(!itemVisible(currentItem())) { |
168 | setTopItem(0); | 172 | if(currentItem() == 0) { |
169 | } else { | 173 | setTopItem(0); |
170 | setTopItem(topItem()+1); | 174 | } else { |
175 | setTopItem(topItem()+1); | ||
176 | } | ||
171 | } | 177 | } |
172 | } | 178 | } |
173 | } | 179 | } |