-rw-r--r-- | korganizer/komonthview.cpp | 27 | ||||
-rw-r--r-- | korganizer/komonthview.h | 5 |
2 files changed, 29 insertions, 3 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index ab9a4b6..9f7db69 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -84,4 +84,5 @@ KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) | |||
84 | #endif | 84 | #endif |
85 | mWT = new KNOWhatsThis(this); | 85 | mWT = new KNOWhatsThis(this); |
86 | resetOnFocusIn = true; | ||
86 | } | 87 | } |
87 | KNoScrollListBox::~KNoScrollListBox() | 88 | KNoScrollListBox::~KNoScrollListBox() |
@@ -89,4 +90,25 @@ KNoScrollListBox::~KNoScrollListBox() | |||
89 | 90 | ||
90 | } | 91 | } |
92 | |||
93 | |||
94 | void KNoScrollListBox::focusInEvent ( QFocusEvent * e ) | ||
95 | { | ||
96 | QListBox::focusInEvent ( e ); | ||
97 | QListBoxItem * i = item ( 0 ); | ||
98 | if ( i && resetOnFocusIn ) { | ||
99 | setCurrentItem( i ); | ||
100 | setSelected ( 0, true ); | ||
101 | } | ||
102 | resetOnFocusIn = true; | ||
103 | } | ||
104 | void KNoScrollListBox::focusOutEvent ( QFocusEvent * e ) | ||
105 | { | ||
106 | int i = currentItem (); | ||
107 | if ( i >= 0 ) { | ||
108 | setSelected ( i, false ); | ||
109 | } | ||
110 | QListBox::focusOutEvent ( e ); | ||
111 | } | ||
112 | |||
91 | QString KNoScrollListBox::getWhatsThisText(QPoint p) | 113 | QString KNoScrollListBox::getWhatsThisText(QPoint p) |
92 | { | 114 | { |
@@ -153,5 +175,5 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e) | |||
153 | break; | 175 | break; |
154 | case Key_I: | 176 | case Key_I: |
155 | QTimer::singleShot( 11, this, SLOT ( oneDown() ) ); | 177 | QTimer::singleShot( 1, this, SLOT ( oneDown() ) ); |
156 | e->ignore(); | 178 | e->ignore(); |
157 | break; | 179 | break; |
@@ -178,5 +200,6 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e) | |||
178 | void KNoScrollListBox::oneDown() | 200 | void KNoScrollListBox::oneDown() |
179 | { | 201 | { |
180 | if ( count () ) { | 202 | if ( count () ) { |
203 | resetOnFocusIn = false; | ||
181 | setCurrentItem((currentItem()+1)%count()); | 204 | setCurrentItem((currentItem()+1)%count()); |
182 | if(!itemVisible(currentItem())) { | 205 | if(!itemVisible(currentItem())) { |
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index 88050fe..e04cdf5 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h | |||
@@ -88,7 +88,10 @@ class KNoScrollListBox: public QListBox | |||
88 | void keyPressEvent(QKeyEvent *); | 88 | void keyPressEvent(QKeyEvent *); |
89 | void keyReleaseEvent(QKeyEvent *); | 89 | void keyReleaseEvent(QKeyEvent *); |
90 | void mousePressEvent(QMouseEvent *); | 90 | void mousePressEvent(QMouseEvent *); |
91 | void focusInEvent ( QFocusEvent * ); | ||
92 | void focusOutEvent ( QFocusEvent * ); | ||
91 | 93 | ||
92 | private: | 94 | private: |
95 | bool resetOnFocusIn; | ||
93 | KNOWhatsThis * mWT; | 96 | KNOWhatsThis * mWT; |
94 | }; | 97 | }; |