summaryrefslogtreecommitdiffabout
path: root/microkde/kdeui/klistbox.cpp
Unidiff
Diffstat (limited to 'microkde/kdeui/klistbox.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kdeui/klistbox.cpp56
1 files changed, 31 insertions, 25 deletions
diff --git a/microkde/kdeui/klistbox.cpp b/microkde/kdeui/klistbox.cpp
index c65b892..71020b3 100644
--- a/microkde/kdeui/klistbox.cpp
+++ b/microkde/kdeui/klistbox.cpp
@@ -16,6 +16,11 @@
16 Boston, MA 02111-1307, USA. 16 Boston, MA 02111-1307, USA.
17*/ 17*/
18#include <qtimer.h> 18#include <qtimer.h>
19//Added by qt3to4:
20#include <QEvent>
21#include <QMouseEvent>
22#include <QKeyEvent>
23#include <QFocusEvent>
19 24
20#include <kglobalsettings.h> 25#include <kglobalsettings.h>
21//US#include <kcursor.h> 26//US#include <kcursor.h>
@@ -26,22 +31,23 @@
26#include "klistbox.h" 31#include "klistbox.h"
27 32
28#ifdef Q_WS_X11 33#ifdef Q_WS_X11
34#include <QX11Info>
29#include <X11/Xlib.h> 35#include <X11/Xlib.h>
30#endif 36#endif
31#ifdef _WIN32_ 37#ifdef _WIN32_
32#define Q_WS_QWS 38#define Q_WS_QWS
33#endif 39#endif
34KListBox::KListBox( QWidget *parent, const char *name, WFlags f ) 40KListBox::KListBox( QWidget *parent, const char *name, Qt::WFlags f )
35 : QListBox( parent, name, f ) 41 : Q3ListBox( parent, name, f )
36{ 42{
37 connect( this, SIGNAL( onViewport() ), 43 connect( this, SIGNAL( onViewport() ),
38 this, SLOT( slotOnViewport() ) ); 44 this, SLOT( slotOnViewport() ) );
39 connect( this, SIGNAL( onItem( QListBoxItem * ) ), 45 connect( this, SIGNAL( onItem( Q3ListBoxItem * ) ),
40 this, SLOT( slotOnItem( QListBoxItem * ) ) ); 46 this, SLOT( slotOnItem( Q3ListBoxItem * ) ) );
41 47
42 connect( this, SIGNAL( mouseButtonClicked( int, QListBoxItem *, 48 connect( this, SIGNAL( mouseButtonClicked( int, Q3ListBoxItem *,
43 const QPoint & ) ), 49 const QPoint & ) ),
44 this, SLOT( slotMouseButtonClicked( int, QListBoxItem *, 50 this, SLOT( slotMouseButtonClicked( int, Q3ListBoxItem *,
45 const QPoint & ) ) ); 51 const QPoint & ) ) );
46/*US 52/*US
47 53
@@ -60,7 +66,7 @@ KListBox::KListBox( QWidget *parent, const char *name, WFlags f )
60 this, SLOT( slotAutoSelect() ) ); 66 this, SLOT( slotAutoSelect() ) );
61} 67}
62 68
63void KListBox::slotOnItem( QListBoxItem *item ) 69void KListBox::slotOnItem( Q3ListBoxItem *item )
64{ 70{
65/*US 71/*US
66 if ( item && m_bChangeCursorOverItem && m_bUseSingle ) 72 if ( item && m_bChangeCursorOverItem && m_bUseSingle )
@@ -139,11 +145,11 @@ void KListBox::slotAutoSelect()
139 Window child; 145 Window child;
140 int root_x, root_y, win_x, win_y; 146 int root_x, root_y, win_x, win_y;
141 uint keybstate; 147 uint keybstate;
142 XQueryPointer( qt_xdisplay(), qt_xrootwin(), &root, &child, 148 XQueryPointer( x11Info().display(), x11Info().appRootWindow(), &root, &child,
143 &root_x, &root_y, &win_x, &win_y, &keybstate ); 149 &root_x, &root_y, &win_x, &win_y, &keybstate );
144#endif 150#endif
145 151
146 QListBoxItem* previousItem = item( currentItem() ); 152 Q3ListBoxItem* previousItem = item( currentItem() );
147 setCurrentItem( m_pCurrentItem ); 153 setCurrentItem( m_pCurrentItem );
148 154
149 if( m_pCurrentItem ) { 155 if( m_pCurrentItem ) {
@@ -167,7 +173,7 @@ void KListBox::slotAutoSelect()
167 viewport()->setUpdatesEnabled( false ); 173 viewport()->setUpdatesEnabled( false );
168 174
169 bool down = index( previousItem ) < index( m_pCurrentItem ); 175 bool down = index( previousItem ) < index( m_pCurrentItem );
170 QListBoxItem* it = down ? previousItem : m_pCurrentItem; 176 Q3ListBoxItem* it = down ? previousItem : m_pCurrentItem;
171 for (;it ; it = it->next() ) { 177 for (;it ; it = it->next() ) {
172 if ( down && it == m_pCurrentItem ) { 178 if ( down && it == m_pCurrentItem ) {
173 setSelected( m_pCurrentItem, select ); 179 setSelected( m_pCurrentItem, select );
@@ -186,7 +192,7 @@ void KListBox::slotAutoSelect()
186 192
187 emit selectionChanged(); 193 emit selectionChanged();
188 194
189 if( selectionMode() == QListBox::Single ) 195 if( selectionMode() == Q3ListBox::Single )
190 emit selectionChanged( m_pCurrentItem ); 196 emit selectionChanged( m_pCurrentItem );
191 } 197 }
192#ifndef Q_WS_QWS //FIXME 198#ifndef Q_WS_QWS //FIXME
@@ -213,14 +219,14 @@ void KListBox::slotAutoSelect()
213#endif 219#endif
214} 220}
215 221
216void KListBox::emitExecute( QListBoxItem *item, const QPoint &pos ) 222void KListBox::emitExecute( Q3ListBoxItem *item, const QPoint &pos )
217{ 223{
218#ifdef Q_WS_X11 //FIXME 224#ifdef Q_WS_X11 //FIXME
219 Window root; 225 Window root;
220 Window child; 226 Window child;
221 int root_x, root_y, win_x, win_y; 227 int root_x, root_y, win_x, win_y;
222 uint keybstate; 228 uint keybstate;
223 XQueryPointer( qt_xdisplay(), qt_xrootwin(), &root, &child, 229 XQueryPointer( x11Info().display(), x11Info().appRootWindow(), &root, &child,
224 &root_x, &root_y, &win_x, &win_y, &keybstate ); 230 &root_x, &root_y, &win_x, &win_y, &keybstate );
225#endif 231#endif
226 232
@@ -246,17 +252,17 @@ void KListBox::emitExecute( QListBoxItem *item, const QPoint &pos )
246// 252//
247void KListBox::keyPressEvent(QKeyEvent *e) 253void KListBox::keyPressEvent(QKeyEvent *e)
248{ 254{
249 if( e->key() == Key_Escape ) 255 if( e->key() == Qt::Key_Escape )
250 { 256 {
251 e->ignore(); 257 e->ignore();
252 } 258 }
253 else if( e->key() == Key_F1 ) 259 else if( e->key() == Qt::Key_F1 )
254 { 260 {
255 e->ignore(); 261 e->ignore();
256 } 262 }
257 else 263 else
258 { 264 {
259 QListBox::keyPressEvent(e); 265 Q3ListBox::keyPressEvent(e);
260 } 266 }
261} 267}
262 268
@@ -264,19 +270,19 @@ void KListBox::focusOutEvent( QFocusEvent *fe )
264{ 270{
265 m_pAutoSelect->stop(); 271 m_pAutoSelect->stop();
266 272
267 QListBox::focusOutEvent( fe ); 273 Q3ListBox::focusOutEvent( fe );
268} 274}
269 275
270void KListBox::leaveEvent( QEvent *e ) 276void KListBox::leaveEvent( QEvent *e )
271{ 277{
272 m_pAutoSelect->stop(); 278 m_pAutoSelect->stop();
273 279
274 QListBox::leaveEvent( e ); 280 Q3ListBox::leaveEvent( e );
275} 281}
276 282
277void KListBox::contentsMousePressEvent( QMouseEvent *e ) 283void KListBox::contentsMousePressEvent( QMouseEvent *e )
278{ 284{
279 if( (selectionMode() == Extended) && (e->state() & ShiftButton) && !(e->state() & ControlButton) ) { 285 if( (selectionMode() == Extended) && (e->state() & Qt::ShiftButton) && !(e->state() & Qt::ControlButton) ) {
280 bool block = signalsBlocked(); 286 bool block = signalsBlocked();
281 blockSignals( true ); 287 blockSignals( true );
282 288
@@ -285,26 +291,26 @@ void KListBox::contentsMousePressEvent( QMouseEvent *e )
285 blockSignals( block ); 291 blockSignals( block );
286 } 292 }
287 293
288 QListBox::contentsMousePressEvent( e ); 294 Q3ListBox::contentsMousePressEvent( e );
289} 295}
290 296
291void KListBox::contentsMouseDoubleClickEvent ( QMouseEvent * e ) 297void KListBox::contentsMouseDoubleClickEvent ( QMouseEvent * e )
292{ 298{
293 QListBox::contentsMouseDoubleClickEvent( e ); 299 Q3ListBox::contentsMouseDoubleClickEvent( e );
294 300
295 QListBoxItem* item = itemAt( e->pos() ); 301 Q3ListBoxItem* item = itemAt( e->pos() );
296 302
297 if( item ) { 303 if( item ) {
298 emit doubleClicked( item, e->globalPos() ); 304 emit doubleClicked( item, e->globalPos() );
299 305
300 if( (e->button() == LeftButton) && !m_bUseSingle ) 306 if( (e->button() == Qt::LeftButton) && !m_bUseSingle )
301 emitExecute( item, e->globalPos() ); 307 emitExecute( item, e->globalPos() );
302 } 308 }
303} 309}
304 310
305void KListBox::slotMouseButtonClicked( int btn, QListBoxItem *item, const QPoint &pos ) 311void KListBox::slotMouseButtonClicked( int btn, Q3ListBoxItem *item, const QPoint &pos )
306{ 312{
307 if( (btn == LeftButton) && item ) 313 if( (btn == Qt::LeftButton) && item )
308 emitExecute( item, pos ); 314 emitExecute( item, pos );
309} 315}
310 316