author | zautrix <zautrix> | 2005-03-29 00:10:48 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-29 00:10:48 (UTC) |
commit | a5d52c19d2cd9b008e5cf41d5c7d2c193df7ee46 (patch) (side-by-side diff) | |
tree | b9f1b2710da1cd0105382831ac0a3e3d7d44f09c /korganizer/komonthview.cpp | |
parent | 4e7c45695672ecdbd0cd14cac0ea29a8e134ee78 (diff) | |
download | kdepimpi-a5d52c19d2cd9b008e5cf41d5c7d2c193df7ee46.zip kdepimpi-a5d52c19d2cd9b008e5cf41d5c7d2c193df7ee46.tar.gz kdepimpi-a5d52c19d2cd9b008e5cf41d5c7d2c193df7ee46.tar.bz2 |
fix
-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 @@ -121,32 +121,36 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e) break; case Key_Up: if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { e->ignore(); break; } - setCurrentItem((currentItem()+count()-1)%count()); - if(!itemVisible(currentItem())) { - if((unsigned int) currentItem() == (count()-1)) { - setTopItem(currentItem()-numItemsVisible()+1); - } else { - setTopItem(topItem()-1); + if ( count() ) { + setCurrentItem((currentItem()+count()-1)%count()); + if(!itemVisible(currentItem())) { + if((unsigned int) currentItem() == (count()-1)) { + setTopItem(currentItem()-numItemsVisible()+1); + } else { + setTopItem(topItem()-1); + } } } break; case Key_Down: if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { e->ignore(); break; } - setCurrentItem((currentItem()+1)%count()); - if(!itemVisible(currentItem())) { - if(currentItem() == 0) { - setTopItem(0); - } else { - setTopItem(topItem()+1); + if ( count () ) { + setCurrentItem((currentItem()+1)%count()); + if(!itemVisible(currentItem())) { + if(currentItem() == 0) { + setTopItem(0); + } else { + setTopItem(topItem()+1); + } } } break; case Key_I: QTimer::singleShot( 11, this, SLOT ( oneDown() ) ); e->ignore(); @@ -159,18 +163,20 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e) break; } } void KNoScrollListBox::oneDown() { - setCurrentItem((currentItem()+1)%count()); - if(!itemVisible(currentItem())) { - if(currentItem() == 0) { - setTopItem(0); - } else { - setTopItem(topItem()+1); + if ( count () ) { + setCurrentItem((currentItem()+1)%count()); + if(!itemVisible(currentItem())) { + if(currentItem() == 0) { + setTopItem(0); + } else { + setTopItem(topItem()+1); + } } } } void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) { switch(e->key()) { |