summaryrefslogtreecommitdiffabout
path: root/microkde/kdeui/klistbox.cpp
Side-by-side diff
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
@@ -13,38 +13,44 @@
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <qtimer.h>
+//Added by qt3to4:
+#include <QEvent>
+#include <QMouseEvent>
+#include <QKeyEvent>
+#include <QFocusEvent>
#include <kglobalsettings.h>
//US#include <kcursor.h>
#include <kapplication.h>
//US#include <kipc.h>
#include <kdebug.h>
#include "klistbox.h"
#ifdef Q_WS_X11
+#include <QX11Info>
#include <X11/Xlib.h>
#endif
#ifdef _WIN32_
#define Q_WS_QWS
#endif
-KListBox::KListBox( QWidget *parent, const char *name, WFlags f )
- : QListBox( parent, name, f )
+KListBox::KListBox( QWidget *parent, const char *name, Qt::WFlags f )
+ : Q3ListBox( parent, name, f )
{
connect( this, SIGNAL( onViewport() ),
this, SLOT( slotOnViewport() ) );
- connect( this, SIGNAL( onItem( QListBoxItem * ) ),
- this, SLOT( slotOnItem( QListBoxItem * ) ) );
+ connect( this, SIGNAL( onItem( Q3ListBoxItem * ) ),
+ this, SLOT( slotOnItem( Q3ListBoxItem * ) ) );
- connect( this, SIGNAL( mouseButtonClicked( int, QListBoxItem *,
+ connect( this, SIGNAL( mouseButtonClicked( int, Q3ListBoxItem *,
const QPoint & ) ),
- this, SLOT( slotMouseButtonClicked( int, QListBoxItem *,
+ this, SLOT( slotMouseButtonClicked( int, Q3ListBoxItem *,
const QPoint & ) ) );
/*US
slotSettingsChanged(KApplication::SETTINGS_MOUSE);
if (kapp)
{
@@ -57,13 +63,13 @@ KListBox::KListBox( QWidget *parent, const char *name, WFlags f )
m_bUseSingle = true;
m_pAutoSelect = new QTimer( this );
connect( m_pAutoSelect, SIGNAL( timeout() ),
this, SLOT( slotAutoSelect() ) );
}
-void KListBox::slotOnItem( QListBoxItem *item )
+void KListBox::slotOnItem( Q3ListBoxItem *item )
{
/*US
if ( item && m_bChangeCursorOverItem && m_bUseSingle )
viewport()->setCursor( KCursor().handCursor() );
*/
if ( item && (m_autoSelectDelay > -1) && m_bUseSingle ) {
@@ -136,17 +142,17 @@ void KListBox::slotAutoSelect()
#ifdef Q_WS_X11 //FIXME
Window root;
Window child;
int root_x, root_y, win_x, win_y;
uint keybstate;
- XQueryPointer( qt_xdisplay(), qt_xrootwin(), &root, &child,
+ XQueryPointer( x11Info().display(), x11Info().appRootWindow(), &root, &child,
&root_x, &root_y, &win_x, &win_y, &keybstate );
#endif
- QListBoxItem* previousItem = item( currentItem() );
+ Q3ListBoxItem* previousItem = item( currentItem() );
setCurrentItem( m_pCurrentItem );
if( m_pCurrentItem ) {
#ifndef Q_WS_QWS //FIXME
//Shift pressed?
if( (keybstate & ShiftMask) ) {
@@ -164,13 +170,13 @@ void KListBox::slotAutoSelect()
//US bool select = !m_pCurrentItem->isSelected();
bool select = !m_pCurrentItem->selected();
bool update = viewport()->isUpdatesEnabled();
viewport()->setUpdatesEnabled( false );
bool down = index( previousItem ) < index( m_pCurrentItem );
- QListBoxItem* it = down ? previousItem : m_pCurrentItem;
+ Q3ListBoxItem* it = down ? previousItem : m_pCurrentItem;
for (;it ; it = it->next() ) {
if ( down && it == m_pCurrentItem ) {
setSelected( m_pCurrentItem, select );
break;
}
if ( !down && it == previousItem ) {
@@ -183,13 +189,13 @@ void KListBox::slotAutoSelect()
blockSignals( block );
viewport()->setUpdatesEnabled( update );
triggerUpdate( false );
emit selectionChanged();
- if( selectionMode() == QListBox::Single )
+ if( selectionMode() == Q3ListBox::Single )
emit selectionChanged( m_pCurrentItem );
}
#ifndef Q_WS_QWS //FIXME
else if( (keybstate & ControlMask) )
setSelected( m_pCurrentItem, !m_pCurrentItem->isSelected() );
#endif
@@ -210,20 +216,20 @@ void KListBox::slotAutoSelect()
}
else
kdDebug() << "Thats not supposed to happen!!!!" << endl;
#endif
}
-void KListBox::emitExecute( QListBoxItem *item, const QPoint &pos )
+void KListBox::emitExecute( Q3ListBoxItem *item, const QPoint &pos )
{
#ifdef Q_WS_X11 //FIXME
Window root;
Window child;
int root_x, root_y, win_x, win_y;
uint keybstate;
- XQueryPointer( qt_xdisplay(), qt_xrootwin(), &root, &child,
+ XQueryPointer( x11Info().display(), x11Info().appRootWindow(), &root, &child,
&root_x, &root_y, &win_x, &win_y, &keybstate );
#endif
m_pAutoSelect->stop();
#ifndef Q_WS_QWS //FIXME
@@ -243,71 +249,71 @@ void KListBox::emitExecute( QListBoxItem *item, const QPoint &pos )
// F1 (and combinations) and Escape since these are used
// to start help or close the dialog. This functionality
// should be done in QListView but it is not (at least now)
//
void KListBox::keyPressEvent(QKeyEvent *e)
{
- if( e->key() == Key_Escape )
+ if( e->key() == Qt::Key_Escape )
{
e->ignore();
}
- else if( e->key() == Key_F1 )
+ else if( e->key() == Qt::Key_F1 )
{
e->ignore();
}
else
{
- QListBox::keyPressEvent(e);
+ Q3ListBox::keyPressEvent(e);
}
}
void KListBox::focusOutEvent( QFocusEvent *fe )
{
m_pAutoSelect->stop();
- QListBox::focusOutEvent( fe );
+ Q3ListBox::focusOutEvent( fe );
}
void KListBox::leaveEvent( QEvent *e )
{
m_pAutoSelect->stop();
- QListBox::leaveEvent( e );
+ Q3ListBox::leaveEvent( e );
}
void KListBox::contentsMousePressEvent( QMouseEvent *e )
{
- if( (selectionMode() == Extended) && (e->state() & ShiftButton) && !(e->state() & ControlButton) ) {
+ if( (selectionMode() == Extended) && (e->state() & Qt::ShiftButton) && !(e->state() & Qt::ControlButton) ) {
bool block = signalsBlocked();
blockSignals( true );
clearSelection();
blockSignals( block );
}
- QListBox::contentsMousePressEvent( e );
+ Q3ListBox::contentsMousePressEvent( e );
}
void KListBox::contentsMouseDoubleClickEvent ( QMouseEvent * e )
{
- QListBox::contentsMouseDoubleClickEvent( e );
+ Q3ListBox::contentsMouseDoubleClickEvent( e );
- QListBoxItem* item = itemAt( e->pos() );
+ Q3ListBoxItem* item = itemAt( e->pos() );
if( item ) {
emit doubleClicked( item, e->globalPos() );
- if( (e->button() == LeftButton) && !m_bUseSingle )
+ if( (e->button() == Qt::LeftButton) && !m_bUseSingle )
emitExecute( item, e->globalPos() );
}
}
-void KListBox::slotMouseButtonClicked( int btn, QListBoxItem *item, const QPoint &pos )
+void KListBox::slotMouseButtonClicked( int btn, Q3ListBoxItem *item, const QPoint &pos )
{
- if( (btn == LeftButton) && item )
+ if( (btn == Qt::LeftButton) && item )
emitExecute( item, pos );
}
void KListBox::virtual_hook( int, void* )
{ /*BASE::virtual_hook( id, data );*/ }