summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp42
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
@@ -121,32 +121,36 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
121 break; 121 break;
122 case Key_Up: 122 case Key_Up:
123 if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { 123 if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) {
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;
136 case Key_Down: 138 case Key_Down:
137 if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { 139 if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) {
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;
150 case Key_I: 154 case Key_I:
151 QTimer::singleShot( 11, this, SLOT ( oneDown() ) ); 155 QTimer::singleShot( 11, this, SLOT ( oneDown() ) );
152 e->ignore(); 156 e->ignore();
@@ -159,18 +163,20 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
159 break; 163 break;
160 } 164 }
161} 165}
162 166
163void KNoScrollListBox::oneDown() 167void 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}
174void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) 180void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e)
175{ 181{
176 switch(e->key()) { 182 switch(e->key()) {