-rw-r--r-- | korganizer/komonthview.cpp | 25 | ||||
-rw-r--r-- | korganizer/komonthview.h | 3 |
2 files changed, 27 insertions, 1 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index ab9a4b6..9f7db69 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -83,11 +83,33 @@ KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); #endif mWT = new KNOWhatsThis(this); + resetOnFocusIn = true; } KNoScrollListBox::~KNoScrollListBox() { } + + +void KNoScrollListBox::focusInEvent ( QFocusEvent * e ) +{ + QListBox::focusInEvent ( e ); + QListBoxItem * i = item ( 0 ); + if ( i && resetOnFocusIn ) { + setCurrentItem( i ); + setSelected ( 0, true ); + } + resetOnFocusIn = true; +} +void KNoScrollListBox::focusOutEvent ( QFocusEvent * e ) +{ + int i = currentItem (); + if ( i >= 0 ) { + setSelected ( i, false ); + } + QListBox::focusOutEvent ( e ); +} + QString KNoScrollListBox::getWhatsThisText(QPoint p) { QListBoxItem* item = itemAt ( p ); @@ -152,7 +174,7 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e) } break; case Key_I: - QTimer::singleShot( 11, this, SLOT ( oneDown() ) ); + QTimer::singleShot( 1, this, SLOT ( oneDown() ) ); e->ignore(); break; case Key_Return: @@ -178,6 +200,7 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e) void KNoScrollListBox::oneDown() { if ( count () ) { + resetOnFocusIn = false; setCurrentItem((currentItem()+1)%count()); if(!itemVisible(currentItem())) { if(currentItem() == 0) { diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index 88050fe..e04cdf5 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h @@ -88,8 +88,11 @@ class KNoScrollListBox: public QListBox void keyPressEvent(QKeyEvent *); void keyReleaseEvent(QKeyEvent *); void mousePressEvent(QMouseEvent *); + void focusInEvent ( QFocusEvent * ); + void focusOutEvent ( QFocusEvent * ); private: + bool resetOnFocusIn; KNOWhatsThis * mWT; }; |