Diffstat (limited to 'microkde/kdeui/klistview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | microkde/kdeui/klistview.cpp | 337 |
1 files changed, 176 insertions, 161 deletions
diff --git a/microkde/kdeui/klistview.cpp b/microkde/kdeui/klistview.cpp index 60f3084..0e98160 100644 --- a/microkde/kdeui/klistview.cpp +++ b/microkde/kdeui/klistview.cpp @@ -18,13 +18,27 @@ Boston, MA 02111-1307, USA. */ -#include <qdragobject.h> +#include <q3dragobject.h> #include <qtimer.h> -#include <qheader.h> +#include <q3header.h> #include <qcursor.h> #include <qtooltip.h> #include <qstyle.h> #include <qpainter.h> +//Added by qt3to4: +#include <QDragLeaveEvent> +#include <QKeyEvent> +#include <Q3ValueList> +#include <Q3PtrList> +#include <QPixmap> +#include <QDragEnterEvent> +#include <QDragMoveEvent> +#include <QDropEvent> +#include <QResizeEvent> +#include <QFocusEvent> +#include <QMouseEvent> +#include <QEvent> +#include <QPaintEvent> #include <kglobalsettings.h> #include <kconfig.h> @@ -38,7 +52,7 @@ #endif #ifndef _WIN32_ #define private public -#include <qlistview.h> +#include <q3listview.h> #undef private #endif #include "klistview.h" @@ -46,9 +60,10 @@ #ifndef DESKTOP_VERSION #include <qpe/qpeapplication.h> #endif +#include <Q3Action> // /*US -class KListView::Tooltip : public QToolTip +class KListView::Tooltip /* TODO:hacker:TODO: : public QToolTip */ { public: Tooltip (KListView* parent, QToolTipGroup* group = 0L); @@ -67,7 +82,7 @@ private: }; KListView::Tooltip::Tooltip (KListView* parent, QToolTipGroup* group) - : QToolTip (parent, group), + : /* XXX:hacker:XXX: QToolTip (parent, group), */ mParent (parent) { } @@ -123,20 +138,20 @@ public: //US delete editor; } - QListViewItem* pCurrentItem; + Q3ListViewItem* pCurrentItem; QTimer autoSelect; int autoSelectDelay; QTimer dragExpand; - QListViewItem* dragOverItem; + Q3ListViewItem* dragOverItem; QPoint dragOverPoint; QPoint startDragPos; int dragDelay; //US KListViewLineEdit *editor; - QValueList<int> renameable; + Q3ValueList<int> renameable; bool cursorInExecuteArea:1; bool bUseSingle:1; @@ -170,8 +185,8 @@ public: QRect mOldDropVisualizer; int mDropVisualizerWidth; QRect mOldDropHighlighter; - QListViewItem *afterItemDrop; - QListViewItem *parentItemDrop; + Q3ListViewItem *afterItemDrop; + Q3ListViewItem *parentItemDrop; QColor alternateBackground; }; @@ -226,7 +241,7 @@ void KListViewLineEdit::load(QListViewItem *i, int c) * tabOrderedRename functionality. */ -static int nextCol (KListView *pl, QListViewItem *pi, int start, int dir) +static int nextCol (KListView *pl, Q3ListViewItem *pi, int start, int dir) { if (pi) { @@ -239,9 +254,9 @@ static int nextCol (KListView *pl, QListViewItem *pi, int start, int dir) return -1; } -static QListViewItem *prevItem (QListViewItem *pi) +static Q3ListViewItem *prevItem (Q3ListViewItem *pi) { - QListViewItem *pa = pi->itemAbove(); + Q3ListViewItem *pa = pi->itemAbove(); /* Does what the QListViewItem::previousSibling() * of my dreams would do. @@ -252,7 +267,7 @@ static QListViewItem *prevItem (QListViewItem *pi) return NULL; } -static QListViewItem *lastQChild (QListViewItem *pi) +static Q3ListViewItem *lastQChild (Q3ListViewItem *pi) { if (pi) { @@ -260,7 +275,7 @@ static QListViewItem *lastQChild (QListViewItem *pi) * This finds the last sibling for the given * item. */ - for (QListViewItem *pt = pi->nextSibling(); pt; pt = pt->nextSibling()) + for (Q3ListViewItem *pt = pi->nextSibling(); pt; pt = pt->nextSibling()) pi = pt; } @@ -328,10 +343,10 @@ bool KListViewLineEdit::event (QEvent *pe) if ((k->key() == Qt::Key_Backtab || k->key() == Qt::Key_Tab) && p->tabOrderedRenaming() && p->itemsRenameable() && - !(k->state() & ControlButton || k->state() & AltButton)) + !(k->state() & Qt::ControlButton || k->state() & AltButton)) { selectNextCell(item, col, - (k->key() == Key_Tab && !(k->state() & ShiftButton))); + (k->key() == Key_Tab && !(k->state() & Qt::ShiftButton))); return true; } } @@ -406,7 +421,7 @@ void KListViewLineEdit::slotSelectionChanged() */ KListView::KListView( QWidget *parent, const char *name ,bool emulateRightMouse ) - : QListView( parent, name ), + : Q3ListView( parent, name ), d (new KListViewPrivate (this)) { #ifndef DESKTOP_VERSION @@ -417,8 +432,8 @@ KListView::KListView( QWidget *parent, const char *name ,bool emulateRightMouse connect( this, SIGNAL( onViewport() ), this, SLOT( slotOnViewport() ) ); - connect( this, SIGNAL( onItem( QListViewItem * ) ), - this, SLOT( slotOnItem( QListViewItem * ) ) ); + connect( this, SIGNAL( onItem( Q3ListViewItem * ) ), + this, SLOT( slotOnItem( Q3ListViewItem * ) ) ); connect (this, SIGNAL(contentsMoving(int,int)), this, SLOT(cleanDropVisualizer())); @@ -445,17 +460,17 @@ KListView::KListView( QWidget *parent, const char *name ,bool emulateRightMouse // context menu handling if (d->showContextMenusOnPress) { - connect (this, SIGNAL (rightButtonPressed (QListViewItem*, const QPoint&, int)), - this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); + connect (this, SIGNAL (rightButtonPressed (Q3ListViewItem*, const QPoint&, int)), + this, SLOT (emitContextMenu (Q3ListViewItem*, const QPoint&, int))); } else { - connect (this, SIGNAL (rightButtonClicked (QListViewItem*, const QPoint&, int)), - this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); + connect (this, SIGNAL (rightButtonClicked (Q3ListViewItem*, const QPoint&, int)), + this, SLOT (emitContextMenu (Q3ListViewItem*, const QPoint&, int))); } - connect (this, SIGNAL (menuShortCutPressed (KListView*, QListViewItem*)), - this, SLOT (emitContextMenu (KListView*, QListViewItem*))); + connect (this, SIGNAL (menuShortCutPressed (KListView*, Q3ListViewItem*)), + this, SLOT (emitContextMenu (KListView*, Q3ListViewItem*))); //qDebug("KListView::KListView make alternate color configurable"); @@ -480,7 +495,7 @@ QSize KListView::sizeHint() const { //qDebug("KListView::QSize sizeHint() "); #ifdef DESKTOP_VERSION - return QListView::sizeHint(); + return Q3ListView::sizeHint(); #else return QSize ( 40, 40 ); #endif @@ -503,7 +518,7 @@ bool KListView::isExecuteArea( int x ) } } -void KListView::slotOnItem( QListViewItem *item ) +void KListView::slotOnItem( Q3ListViewItem *item ) { QPoint vp = viewport()->mapFromGlobal( QCursor::pos() ); if ( item && isExecuteArea( vp.x() ) && (d->autoSelectDelay > -1) && d->bUseSingle ) { @@ -534,12 +549,12 @@ void KListView::slotSettingsChanged(int category) //US set explicitly d->bUseSingle = KGlobalSettings::singleClick(); // qDebug("KListView::slotSettingsChanged: single%i", d->bUseSingle); - disconnect(this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), - this, SLOT (slotMouseButtonClicked (int, QListViewItem*, const QPoint &, int))); + disconnect(this, SIGNAL (mouseButtonClicked (int, Q3ListViewItem*, const QPoint &, int)), + this, SLOT (slotMouseButtonClicked (int, Q3ListViewItem*, const QPoint &, int))); if( d->bUseSingle ) - connect (this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), - this, SLOT (slotMouseButtonClicked( int, QListViewItem*, const QPoint &, int))); + connect (this, SIGNAL (mouseButtonClicked (int, Q3ListViewItem*, const QPoint &, int)), + this, SLOT (slotMouseButtonClicked( int, Q3ListViewItem*, const QPoint &, int))); //US d->bChangeCursorOverItem = KGlobalSettings::changeCursorOverIcon(); //US d->autoSelectDelay = KGlobalSettings::autoSelectDelay(); @@ -611,7 +626,7 @@ void KListView::slotAutoSelect() if( !hasFocus() ) setFocus(); - QListViewItem* previousItem = currentItem(); + Q3ListViewItem* previousItem = currentItem(); setCurrentItem( d->pCurrentItem ); #if 0 @@ -632,7 +647,7 @@ void KListView::slotAutoSelect() viewport()->setUpdatesEnabled( false ); bool down = previousItem->itemPos() < d->pCurrentItem->itemPos(); - QListViewItemIterator lit( down ? previousItem : d->pCurrentItem ); + Q3ListViewItemIterator lit( down ? previousItem : d->pCurrentItem ); for ( ; lit.current(); ++lit ) { if ( down && lit.current() == d->pCurrentItem ) { d->pCurrentItem->setSelected( select ); @@ -651,7 +666,7 @@ void KListView::slotAutoSelect() emit selectionChanged(); - if( selectionMode() == QListView::Single ) + if( selectionMode() == Q3ListView::Single ) emit selectionChanged( d->pCurrentItem ); } else if( (keybstate & ControlMask) ) @@ -684,7 +699,7 @@ void KListView::slotHeaderChanged() } } -void KListView::emitExecute( int buttonstate, QListViewItem *item, const QPoint &pos, int c) +void KListView::emitExecute( int buttonstate, Q3ListViewItem *item, const QPoint &pos, int c) { // qDebug("KListView::emitExecute buttonstate=%i", buttonstate); if( isExecuteArea( viewport()->mapFromGlobal(pos) ) ) { @@ -701,7 +716,7 @@ void KListView::emitExecute( int buttonstate, QListViewItem *item, const QPoint d->autoSelect.stop(); //Dont emit executed if in SC mode and Shift or Ctrl are pressed - if( !( (buttonstate==ShiftButton) || (buttonstate==ControlButton) )) { + if( !( (buttonstate==Qt::ShiftButton) || (buttonstate==Qt::ControlButton) )) { // if( !( ((keybstate & ShiftMask) || (keybstate & ControlMask)) ) ) { emit executed( item ); @@ -714,7 +729,7 @@ void KListView::emitExecute( int buttonstate, QListViewItem *item, const QPoint void KListView::focusInEvent( QFocusEvent *fe ) { // kdDebug()<<"KListView::focusInEvent()"<<endl; - QListView::focusInEvent( fe ); + Q3ListView::focusInEvent( fe ); if ((d->selectedBySimpleMove) && (d->selectionMode == FileManager) && (fe->reason()!=QFocusEvent::Popup) @@ -747,14 +762,14 @@ void KListView::focusOutEvent( QFocusEvent *fe ) emit selectionChanged(); }; - QListView::focusOutEvent( fe ); + Q3ListView::focusOutEvent( fe ); } void KListView::leaveEvent( QEvent *e ) { d->autoSelect.stop(); - QListView::leaveEvent( e ); + Q3ListView::leaveEvent( e ); } bool KListView::event( QEvent *e ) @@ -765,13 +780,13 @@ bool KListView::event( QEvent *e ) d->alternateBackground = QColor(240, 240, 240); } - return QListView::event(e); + return Q3ListView::event(e); } void KListView::contentsMousePressEvent( QMouseEvent *e ) { //qDebug("KListView::contentsMousePressEvent"); - if( (selectionModeExt() == Extended) && (e->state() & ShiftButton) && !(e->state() & ControlButton) ) + if( (selectionModeExt() == Extended) && (e->state() & Qt::ShiftButton) && !(e->state() & Qt::ControlButton) ) { bool block = signalsBlocked(); blockSignals( true ); @@ -793,7 +808,7 @@ void KListView::contentsMousePressEvent( QMouseEvent *e ) }; QPoint p( contentsToViewport( e->pos() ) ); - QListViewItem *at = itemAt (p); + Q3ListViewItem *at = itemAt (p); // true if the root decoration of the item "at" was clicked (i.e. the +/- sign) bool rootDecoClicked = at @@ -801,7 +816,7 @@ void KListView::contentsMousePressEvent( QMouseEvent *e ) treeStepSize() * ( at->depth() + ( rootIsDecorated() ? 1 : 0) ) + itemMargin() ) && ( p.x() >= header()->cellPos( header()->mapToActual( 0 ) ) ); - if (e->button() == LeftButton && !rootDecoClicked) + if (e->button() == Qt::LeftButton && !rootDecoClicked) { //Start a drag d->startDragPos = e->pos(); @@ -813,18 +828,18 @@ void KListView::contentsMousePressEvent( QMouseEvent *e ) } } - QListView::contentsMousePressEvent( e ); + Q3ListView::contentsMousePressEvent( e ); } void KListView::contentsMouseMoveEvent( QMouseEvent *e ) { if (!dragEnabled() || d->startDragPos.isNull() || !d->validDrag) { - QListView::contentsMouseMoveEvent (e); + Q3ListView::contentsMouseMoveEvent (e); return; } QPoint vp = contentsToViewport(e->pos()); - QListViewItem *item = itemAt( vp ); + Q3ListViewItem *item = itemAt( vp ); //do we process cursor changes at all? if ( item && d->bChangeCursorOverItem && d->bUseSingle ) @@ -853,7 +868,7 @@ void KListView::contentsMouseMoveEvent( QMouseEvent *e ) newPos.y() < d->startDragPos.y()-d->dragDelay)) //(d->startDragPos - e->pos()).manhattanLength() > QApplication::startDragDistance()) { - QListView::contentsMouseReleaseEvent( 0 ); + Q3ListView::contentsMouseReleaseEvent( 0 ); startDrag(); d->startDragPos = QPoint(); d->validDrag = false; @@ -862,13 +877,13 @@ void KListView::contentsMouseMoveEvent( QMouseEvent *e ) void KListView::contentsMouseReleaseEvent( QMouseEvent *e ) { - if (e->button() == LeftButton) + if (e->button() == Qt::LeftButton) { // If the row was already selected, maybe we want to start an in-place editing if ( d->pressedOnSelected && itemsRenameable() ) { QPoint p( contentsToViewport( e->pos() ) ); - QListViewItem *at = itemAt (p); + Q3ListViewItem *at = itemAt (p); if ( at ) { // true if the root decoration of the item "at" was clicked (i.e. the +/- sign) @@ -890,7 +905,7 @@ void KListView::contentsMouseReleaseEvent( QMouseEvent *e ) d->validDrag = false; d->startDragPos = QPoint(); } - QListView::contentsMouseReleaseEvent( e ); + Q3ListView::contentsMouseReleaseEvent( e ); } void KListView::contentsMouseDoubleClickEvent ( QMouseEvent *e ) @@ -901,8 +916,8 @@ void KListView::contentsMouseDoubleClickEvent ( QMouseEvent *e ) //QListView::contentsMouseDoubleClickEvent( e ); QPoint vp = contentsToViewport(e->pos()); - QListViewItem *item = itemAt( vp ); - emit QListView::doubleClicked( item ); // we do it now + Q3ListViewItem *item = itemAt( vp ); + emit Q3ListView::doubleClicked( item ); // we do it now int col = item ? header()->mapToLogical( header()->cellAt( vp.x() ) ) : -1; @@ -911,7 +926,7 @@ void KListView::contentsMouseDoubleClickEvent ( QMouseEvent *e ) emit doubleClicked( item, e->globalPos(), col ); - if( (e->button() == LeftButton) && !d->bUseSingle ) { + if( (e->button() == Qt::LeftButton) && !d->bUseSingle ) { //qDebug("KListView::contentsMouseDoubleClickEvent: emitExecute"); emitExecute( e->button(), item, e->globalPos(), col); @@ -919,11 +934,11 @@ void KListView::contentsMouseDoubleClickEvent ( QMouseEvent *e ) } } -void KListView::slotMouseButtonClicked( int btn, QListViewItem *item, const QPoint &pos, int c ) +void KListView::slotMouseButtonClicked( int btn, Q3ListViewItem *item, const QPoint &pos, int c ) { //qDebug("KListView::slotMouseButtonClicked"); - if( (btn == LeftButton) && item ) { + if( (btn == Qt::LeftButton) && item ) { //qDebug("KListView::slotMouseButtonClicked: emitExecute"); emitExecute(btn, item, pos, c); @@ -961,12 +976,12 @@ qDebug("KListView::contentsDropEvent drag&drop not supported yet"); } -void KListView::movableDropEvent (QListViewItem* parent, QListViewItem* afterme) +void KListView::movableDropEvent (Q3ListViewItem* parent, Q3ListViewItem* afterme) { - QPtrList<QListViewItem> items, afterFirsts, afterNows; - QListViewItem *current=currentItem(); + Q3PtrList<Q3ListViewItem> items, afterFirsts, afterNows; + Q3ListViewItem *current=currentItem(); bool hasMoved=false; - for (QListViewItem *i = firstChild(), *iNext=0; i != 0; i = iNext) + for (Q3ListViewItem *i = firstChild(), *iNext=0; i != 0; i = iNext) { iNext=i->itemBelow(); if (!i->isSelected()) @@ -979,7 +994,7 @@ void KListView::movableDropEvent (QListViewItem* parent, QListViewItem* afterme) i->setSelected(false); - QListViewItem *afterFirst = i->itemAbove(); + Q3ListViewItem *afterFirst = i->itemAbove(); if (!hasMoved) { @@ -1000,7 +1015,7 @@ void KListView::movableDropEvent (QListViewItem* parent, QListViewItem* afterme) afterme = i; } clearSelection(); - for (QListViewItem *i=items.first(); i != 0; i=items.next() ) + for (Q3ListViewItem *i=items.first(); i != 0; i=items.next() ) i->setSelected(true); if (current) setCurrentItem(current); @@ -1086,14 +1101,14 @@ int KListView::depthToPixels( int depth ) return treeStepSize() * ( depth + (rootIsDecorated() ? 1 : 0) ) + itemMargin(); } -void KListView::findDrop(const QPoint &pos, QListViewItem *&parent, QListViewItem *&after) +void KListView::findDrop(const QPoint &pos, Q3ListViewItem *&parent, Q3ListViewItem *&after) { QPoint p (contentsToViewport(pos)); // Get the position to put it in - QListViewItem *atpos = itemAt(p); + Q3ListViewItem *atpos = itemAt(p); - QListViewItem *above; + Q3ListViewItem *above; if (!atpos) // put it at the end above = lastItem(); else @@ -1123,8 +1138,8 @@ void KListView::findDrop(const QPoint &pos, QListViewItem *&parent, QListViewIte // Ok, there's one more level of complexity. We may want to become a new // sibling, but of an upper-level group, rather than the "above" item - QListViewItem * betterAbove = above->parent(); - QListViewItem * last = above; + Q3ListViewItem * betterAbove = above->parent(); + Q3ListViewItem * last = above; while ( betterAbove ) { // We are allowed to become a sibling of "betterAbove" only if we are @@ -1146,9 +1161,9 @@ void KListView::findDrop(const QPoint &pos, QListViewItem *&parent, QListViewIte parent = after ? after->parent() : 0L ; } -QListViewItem* KListView::lastChild () const +Q3ListViewItem* KListView::lastChild () const { - QListViewItem* lastchild = firstChild(); + Q3ListViewItem* lastchild = firstChild(); if (lastchild) for (; lastchild->nextSibling(); lastchild = lastchild->nextSibling()); @@ -1156,11 +1171,11 @@ QListViewItem* KListView::lastChild () const return lastchild; } -QListViewItem *KListView::lastItem() const +Q3ListViewItem *KListView::lastItem() const { - QListViewItem* last = lastChild(); + Q3ListViewItem* last = lastChild(); - for (QListViewItemIterator it (last); it.current(); ++it) + for (Q3ListViewItemIterator it (last); it.current(); ++it) last = it.current(); return last; @@ -1187,12 +1202,12 @@ qDebug("KListView::startDrag drag&drop not supported yet."); */ } -QDragObject *KListView::dragObject() +Q3DragObject *KListView::dragObject() { if (!currentItem()) return 0; - return new QStoredDrag("application/x-qlistviewitem", viewport()); + return new Q3StoredDrag("application/x-qlistviewitem", viewport()); } void KListView::setItemsMovable(bool b) @@ -1246,19 +1261,19 @@ void KListView::setDropVisualizer(bool b) d->dropVisualizer=b; } -QPtrList<QListViewItem> KListView::selectedItems() const +Q3PtrList<Q3ListViewItem> KListView::selectedItems() const { - QPtrList<QListViewItem> list; - for (QListViewItem *i=firstChild(); i!=0; i=i->itemBelow()) + Q3PtrList<Q3ListViewItem> list; + for (Q3ListViewItem *i=firstChild(); i!=0; i=i->itemBelow()) if (i->isSelected()) list.append(i); return list; } -void KListView::moveItem(QListViewItem *item, QListViewItem *parent, QListViewItem *after) +void KListView::moveItem(Q3ListViewItem *item, Q3ListViewItem *parent, Q3ListViewItem *after) { // sanity check - don't move a item into it's own child structure - QListViewItem *i = parent; + Q3ListViewItem *i = parent; while(i) { if(i == item) @@ -1296,8 +1311,8 @@ void KListView::setDropVisualizerWidth (int w) d->mDropVisualizerWidth = w > 0 ? w : 1; } -QRect KListView::drawDropVisualizer(QPainter *p, QListViewItem *parent, - QListViewItem *after) +QRect KListView::drawDropVisualizer(QPainter *p, Q3ListViewItem *parent, + Q3ListViewItem *after) { QRect insertmarker; @@ -1308,7 +1323,7 @@ QRect KListView::drawDropVisualizer(QPainter *p, QListViewItem *parent, int level = 0; if (after) { - QListViewItem* it = 0L; + Q3ListViewItem* it = 0L; if (after->isOpen()) { // Look for the last child (recursively) @@ -1338,12 +1353,12 @@ QRect KListView::drawDropVisualizer(QPainter *p, QListViewItem *parent, // This is not used anymore, at least by KListView itself (see viewportPaintEvent) // Remove for KDE 3.0. if (p) - p->fillRect(insertmarker, Dense4Pattern); + p->fillRect(insertmarker, Qt::Dense4Pattern); return insertmarker; } -QRect KListView::drawItemHighlighter(QPainter *painter, QListViewItem *item) +QRect KListView::drawItemHighlighter(QPainter *painter, Q3ListViewItem *item) { QRect r; @@ -1376,7 +1391,7 @@ void KListView::cleanItemHighlighter () } } -void KListView::rename(QListViewItem *item, int c) +void KListView::rename(Q3ListViewItem *item, int c) { if (d->renameable.contains(c)) { @@ -1403,7 +1418,7 @@ void KListView::setRenameable (int col, bool yesno) d->renameable.remove(col); } -void KListView::doneEditing(QListViewItem *item, int row) +void KListView::doneEditing(Q3ListViewItem *item, int row) { emit itemRenamed(item, item->text(row), row); emit itemRenamed(item); @@ -1447,12 +1462,12 @@ bool KListView::dropHighlighter() const return d->dropHighlighter; } -bool KListView::showTooltip(QListViewItem *item, const QPoint &, int column) const +bool KListView::showTooltip(Q3ListViewItem *item, const QPoint &, int column) const { return ((tooltip(item, column).length()>0) && (column==tooltipColumn())); } -QString KListView::tooltip(QListViewItem *item, int column) const +QString KListView::tooltip(Q3ListViewItem *item, int column) const { return item->text(column); } @@ -1482,7 +1497,7 @@ void KListView::keyPressEvent (QKeyEvent* e) } if (d->selectionMode != FileManager) - QListView::keyPressEvent (e); + Q3ListView::keyPressEvent (e); else fileManagerKeyPressEvent (e); } @@ -1513,45 +1528,45 @@ bool KListView::automaticSelection() const void KListView::fileManagerKeyPressEvent (QKeyEvent* e) { //don't care whether it's on the keypad or not - int e_state=(e->state() & ~Keypad); + int e_state=(e->state() & ~Qt::Keypad); int oldSelectionDirection(d->selectionDirection); - if ((e->key()!=Key_Shift) && (e->key()!=Key_Control) - && (e->key()!=Key_Meta) && (e->key()!=Key_Alt)) + if ((e->key()!=Qt::Key_Shift) && (e->key()!=Qt::Key_Control) + && (e->key()!=Qt::Key_Meta) && (e->key()!=Qt::Key_Alt)) { - if ((e_state==ShiftButton) && (!d->wasShiftEvent) && (!d->selectedBySimpleMove)) + if ((e_state==Qt::ShiftButton) && (!d->wasShiftEvent) && (!d->selectedBySimpleMove)) selectAll(FALSE); d->selectionDirection=0; - d->wasShiftEvent = (e_state == ShiftButton); + d->wasShiftEvent = (e_state == Qt::ShiftButton); }; - //d->wasShiftEvent = (e_state == ShiftButton); + //d->wasShiftEvent = (e_state == Qt::ShiftButton); - QListViewItem* item = currentItem(); + Q3ListViewItem* item = currentItem(); if (item==0) return; - QListViewItem* repaintItem1 = item; - QListViewItem* repaintItem2 = 0L; - QListViewItem* visItem = 0L; + Q3ListViewItem* repaintItem1 = item; + Q3ListViewItem* repaintItem2 = 0L; + Q3ListViewItem* visItem = 0L; - QListViewItem* nextItem = 0L; + Q3ListViewItem* nextItem = 0L; int items = 0; - bool shiftOrCtrl((e_state==ControlButton) || (e_state==ShiftButton)); + bool shiftOrCtrl((e_state==Qt::ControlButton) || (e_state==Qt::ShiftButton)); int selectedItems(0); - for (QListViewItem *tmpItem=firstChild(); tmpItem!=0; tmpItem=tmpItem->nextSibling()) + for (Q3ListViewItem *tmpItem=firstChild(); tmpItem!=0; tmpItem=tmpItem->nextSibling()) if (tmpItem->isSelected()) selectedItems++; if (((selectedItems==0) || ((selectedItems==1) && (d->selectedUsingMouse))) - && (e_state==NoButton) - && ((e->key()==Key_Down) - || (e->key()==Key_Up) - || (e->key()==Key_Next) - || (e->key()==Key_Prior) - || (e->key()==Key_Home) - || (e->key()==Key_End))) + && (e_state==Qt::NoButton) + && ((e->key()==Qt::Key_Down) + || (e->key()==Qt::Key_Up) + || (e->key()==Qt::Key_Next) + || (e->key()==Qt::Key_Prior) + || (e->key()==Qt::Key_Home) + || (e->key()==Qt::Key_End))) { d->selectedBySimpleMove=true; d->selectedUsingMouse=false; @@ -1563,12 +1578,12 @@ void KListView::fileManagerKeyPressEvent (QKeyEvent* e) switch (e->key()) { - case Key_Escape: + case Qt::Key_Escape: selectAll(FALSE); emitSelectionChanged=TRUE; break; - case Key_Space: + case Qt::Key_Space: //toggle selection of current item if (d->selectedBySimpleMove) d->selectedBySimpleMove=false; @@ -1576,7 +1591,7 @@ void KListView::fileManagerKeyPressEvent (QKeyEvent* e) emitSelectionChanged=TRUE; break; - case Key_Insert: + case Qt::Key_Insert: //toggle selection of current item and move to the next item if (d->selectedBySimpleMove) { @@ -1600,7 +1615,7 @@ void KListView::fileManagerKeyPressEvent (QKeyEvent* e) emitSelectionChanged=TRUE; break; - case Key_Down: + case Qt::Key_Down: nextItem=item->itemBelow(); //toggle selection of current item and move to the next item if (shiftOrCtrl) @@ -1633,7 +1648,7 @@ void KListView::fileManagerKeyPressEvent (QKeyEvent* e) }; break; - case Key_Up: + case Qt::Key_Up: nextItem=item->itemAbove(); d->selectionDirection=-1; //move to the prev. item and toggle selection of this one @@ -1668,7 +1683,7 @@ void KListView::fileManagerKeyPressEvent (QKeyEvent* e) }; break; - case Key_End: + case Qt::Key_End: //move to the last item and toggle selection of all items inbetween nextItem=item; if (d->selectedBySimpleMove) @@ -1693,7 +1708,7 @@ void KListView::fileManagerKeyPressEvent (QKeyEvent* e) emitSelectionChanged=TRUE; break; - case Key_Home: + case Qt::Key_Home: // move to the first item and toggle selection of all items inbetween nextItem = firstChild(); visItem = nextItem; @@ -1715,7 +1730,7 @@ void KListView::fileManagerKeyPressEvent (QKeyEvent* e) emitSelectionChanged=TRUE; break; - case Key_Next: + case Qt::Key_Next: items=visibleHeight()/item->height(); nextItem=item; if (d->selectedBySimpleMove) @@ -1751,7 +1766,7 @@ void KListView::fileManagerKeyPressEvent (QKeyEvent* e) } break; - case Key_Prior: + case Qt::Key_Prior: items=visibleHeight()/item->height(); nextItem=item; if (d->selectedBySimpleMove) @@ -1785,25 +1800,25 @@ void KListView::fileManagerKeyPressEvent (QKeyEvent* e) } break; - case Key_Minus: + case Qt::Key_Minus: if ( item->isOpen() ) setOpen( item, FALSE ); break; - case Key_Plus: + case Qt::Key_Plus: if ( !item->isOpen() && (item->isExpandable() || item->childCount()) ) setOpen( item, TRUE ); break; default: - bool realKey = ((e->key()!=Key_Shift) && (e->key()!=Key_Control) - && (e->key()!=Key_Meta) && (e->key()!=Key_Alt)); + bool realKey = ((e->key()!=Qt::Key_Shift) && (e->key()!=Qt::Key_Control) + && (e->key()!=Qt::Key_Meta) && (e->key()!=Qt::Key_Alt)); bool selectCurrentItem = (d->selectedBySimpleMove) && (item->isSelected()); if (realKey && selectCurrentItem) item->setSelected(false); //this is mainly for the "goto filename beginning with pressed char" feature (aleXXX) - QListView::SelectionMode oldSelectionMode = selectionMode(); - setSelectionMode (QListView::Multi); - QListView::keyPressEvent (e); + Q3ListView::SelectionMode oldSelectionMode = selectionMode(); + setSelectionMode (Q3ListView::Multi); + Q3ListView::keyPressEvent (e); setSelectionMode (oldSelectionMode); if (realKey && selectCurrentItem) { @@ -1850,11 +1865,11 @@ void KListView::setSelectionModeExt (SelectionModeExt mode) case Multi: case Extended: case NoSelection: - setSelectionMode (static_cast<QListView::SelectionMode>(static_cast<int>(mode))); + setSelectionMode (static_cast<Q3ListView::SelectionMode>(static_cast<int>(mode))); break; case FileManager: - setSelectionMode (QListView::Extended); + setSelectionMode (Q3ListView::Extended); break; default: @@ -1868,7 +1883,7 @@ KListView::SelectionModeExt KListView::selectionModeExt () const return d->selectionMode; } -int KListView::itemIndex( const QListViewItem *item ) const +int KListView::itemIndex( const Q3ListViewItem *item ) const { if ( !item ) return -1; @@ -1876,7 +1891,7 @@ int KListView::itemIndex( const QListViewItem *item ) const if ( item == firstChild() ) return 0; else { - QListViewItemIterator it(firstChild()); + Q3ListViewItemIterator it(firstChild()); uint j = 0; for (; it.current() && it.current() != item; ++it, ++j ); @@ -1887,13 +1902,13 @@ int KListView::itemIndex( const QListViewItem *item ) const } } -QListViewItem* KListView::itemAtIndex(int index) +Q3ListViewItem* KListView::itemAtIndex(int index) { if (index<0) return 0; int j(0); - for (QListViewItemIterator it=firstChild(); it.current(); it++) + for (Q3ListViewItemIterator it=firstChild(); it.current(); it++) { if (j==index) return it.current(); @@ -1903,7 +1918,7 @@ QListViewItem* KListView::itemAtIndex(int index) } -void KListView::emitContextMenu (KListView*, QListViewItem* i) +void KListView::emitContextMenu (KListView*, Q3ListViewItem* i) { QPoint p; // qDebug("KListView::emitContextMenu "); @@ -1916,9 +1931,9 @@ void KListView::emitContextMenu (KListView*, QListViewItem* i) emit contextMenu (this, i, p); } -void KListView::emitContextMenu (QListViewItem* i, const QPoint& p, int col) +void KListView::emitContextMenu (Q3ListViewItem* i, const QPoint& p, int col) { - QListViewItem* item = i; + Q3ListViewItem* item = i; int c = col; // do not trust the values for QListViewItem* i and int col; // qDebug("KListView::emitContextMenu col"); @@ -1933,7 +1948,7 @@ void KListView::emitContextMenu (QListViewItem* i, const QPoint& p, int col) void KListView::setAcceptDrops (bool val) { - QListView::setAcceptDrops (val); + Q3ListView::setAcceptDrops (val); viewport()->setAcceptDrops (val); } @@ -1945,14 +1960,14 @@ int KListView::dropVisualizerWidth () const void KListView::viewportPaintEvent(QPaintEvent *e) { - QListView::viewportPaintEvent(e); + Q3ListView::viewportPaintEvent(e); if (d->mOldDropVisualizer.isValid() && e->rect().intersects(d->mOldDropVisualizer)) { QPainter painter(viewport()); // This is where we actually draw the drop-visualizer - painter.fillRect(d->mOldDropVisualizer, Dense4Pattern); + painter.fillRect(d->mOldDropVisualizer, Qt::Dense4Pattern); } if (d->mOldDropHighlighter.isValid() && e->rect().intersects(d->mOldDropHighlighter)) { @@ -1988,7 +2003,7 @@ bool KListView::fullWidth() const int KListView::addColumn(const QString& label, int width) { - int result = QListView::addColumn(label, width); + int result = Q3ListView::addColumn(label, width); if (d->fullWidth) { //US header()->setStretchEnabled(false, columns()-2); //US header()->setStretchEnabled(true, columns()-1); @@ -1996,9 +2011,9 @@ int KListView::addColumn(const QString& label, int width) return result; } -int KListView::addColumn(const QIconSet& iconset, const QString& label, int width) +int KListView::addColumn(const QIcon& iconset, const QString& label, int width) { - int result = QListView::addColumn(iconset, label, width); + int result = Q3ListView::addColumn(iconset, label, width); if (d->fullWidth) { //US header()->setStretchEnabled(false, columns()-2); //US header()->setStretchEnabled(true, columns()-1); @@ -2008,13 +2023,13 @@ int KListView::addColumn(const QIconSet& iconset, const QString& label, int widt void KListView::removeColumn(int index) { - QListView::removeColumn(index); + Q3ListView::removeColumn(index); //US if (d->fullWidth && index == columns()) header()->setStretchEnabled(true, columns()-1); } void KListView::viewportResizeEvent(QResizeEvent* e) { - QListView::viewportResizeEvent(e); + Q3ListView::viewportResizeEvent(e); } const QColor &KListView::alternateBackground() const @@ -2070,7 +2085,7 @@ void KListView::setSorting(int column, bool ascending) { d->sortColumn = column; d->sortAscending = ascending; - QListView::setSorting(column, ascending); + Q3ListView::setSorting(column, ascending); } int KListView::columnSorted(void) const @@ -2083,58 +2098,58 @@ bool KListView::ascendingSort(void) const return d->sortAscending; } -KListViewItem::KListViewItem(QListView *parent) - : QListViewItem(parent) +KListViewItem::KListViewItem(Q3ListView *parent) + : Q3ListViewItem(parent) { init(); } -KListViewItem::KListViewItem(QListViewItem *parent) - : QListViewItem(parent) +KListViewItem::KListViewItem(Q3ListViewItem *parent) + : Q3ListViewItem(parent) { init(); } -KListViewItem::KListViewItem(QListView *parent, QListViewItem *after) - : QListViewItem(parent, after) +KListViewItem::KListViewItem(Q3ListView *parent, Q3ListViewItem *after) + : Q3ListViewItem(parent, after) { init(); } -KListViewItem::KListViewItem(QListViewItem *parent, QListViewItem *after) - : QListViewItem(parent, after) +KListViewItem::KListViewItem(Q3ListViewItem *parent, Q3ListViewItem *after) + : Q3ListViewItem(parent, after) { init(); } -KListViewItem::KListViewItem(QListView *parent, +KListViewItem::KListViewItem(Q3ListView *parent, QString label1, QString label2, QString label3, QString label4, QString label5, QString label6, QString label7, QString label8) - : QListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8) + : Q3ListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8) { init(); } -KListViewItem::KListViewItem(QListViewItem *parent, +KListViewItem::KListViewItem(Q3ListViewItem *parent, QString label1, QString label2, QString label3, QString label4, QString label5, QString label6, QString label7, QString label8) - : QListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8) + : Q3ListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8) { init(); } -KListViewItem::KListViewItem(QListView *parent, QListViewItem *after, +KListViewItem::KListViewItem(Q3ListView *parent, Q3ListViewItem *after, QString label1, QString label2, QString label3, QString label4, QString label5, QString label6, QString label7, QString label8) - : QListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8) + : Q3ListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8) { init(); } -KListViewItem::KListViewItem(QListViewItem *parent, QListViewItem *after, +KListViewItem::KListViewItem(Q3ListViewItem *parent, Q3ListViewItem *after, QString label1, QString label2, QString label3, QString label4, QString label5, QString label6, QString label7, QString label8) - : QListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8) + : Q3ListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8) { init(); } @@ -2212,12 +2227,12 @@ void KListViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, in } else if (isAlternate()) { //US if (listView()->viewport()->backgroundMode()==Qt::FixedColor) - if (listView()->viewport()->backgroundMode()==QWidget::PaletteBackground) + if (listView()->viewport()->backgroundMode()==Qt::PaletteBackground) _cg.setColor(QColorGroup::Background, static_cast< KListView* >(listView())->alternateBackground()); else _cg.setColor(QColorGroup::Base, static_cast< KListView* >(listView())->alternateBackground()); } - QListViewItem::paintCell(p, _cg, column, width, alignment); + Q3ListViewItem::paintCell(p, _cg, column, width, alignment); } //US we do not have a "global KDE" variable to setup singleClick functionality |