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 | |||
@@ -13,47 +13,62 @@ | |||
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <qdragobject.h> | 21 | #include <q3dragobject.h> |
22 | #include <qtimer.h> | 22 | #include <qtimer.h> |
23 | #include <qheader.h> | 23 | #include <q3header.h> |
24 | #include <qcursor.h> | 24 | #include <qcursor.h> |
25 | #include <qtooltip.h> | 25 | #include <qtooltip.h> |
26 | #include <qstyle.h> | 26 | #include <qstyle.h> |
27 | #include <qpainter.h> | 27 | #include <qpainter.h> |
28 | //Added by qt3to4: | ||
29 | #include <QDragLeaveEvent> | ||
30 | #include <QKeyEvent> | ||
31 | #include <Q3ValueList> | ||
32 | #include <Q3PtrList> | ||
33 | #include <QPixmap> | ||
34 | #include <QDragEnterEvent> | ||
35 | #include <QDragMoveEvent> | ||
36 | #include <QDropEvent> | ||
37 | #include <QResizeEvent> | ||
38 | #include <QFocusEvent> | ||
39 | #include <QMouseEvent> | ||
40 | #include <QEvent> | ||
41 | #include <QPaintEvent> | ||
28 | 42 | ||
29 | #include <kglobalsettings.h> | 43 | #include <kglobalsettings.h> |
30 | #include <kconfig.h> | 44 | #include <kconfig.h> |
31 | #include <kconfigbase.h> | 45 | #include <kconfigbase.h> |
32 | //US #include <kcursor.h> | 46 | //US #include <kcursor.h> |
33 | #include <kapplication.h> | 47 | #include <kapplication.h> |
34 | //US #include <kipc.h> | 48 | //US #include <kipc.h> |
35 | #include <kdebug.h> | 49 | #include <kdebug.h> |
36 | #ifdef _WIN32_ | 50 | #ifdef _WIN32_ |
37 | #define Q_WS_QWS | 51 | #define Q_WS_QWS |
38 | #endif | 52 | #endif |
39 | #ifndef _WIN32_ | 53 | #ifndef _WIN32_ |
40 | #define private public | 54 | #define private public |
41 | #include <qlistview.h> | 55 | #include <q3listview.h> |
42 | #undef private | 56 | #undef private |
43 | #endif | 57 | #endif |
44 | #include "klistview.h" | 58 | #include "klistview.h" |
45 | //US #include "klistviewlineedit.h" | 59 | //US #include "klistviewlineedit.h" |
46 | #ifndef DESKTOP_VERSION | 60 | #ifndef DESKTOP_VERSION |
47 | #include <qpe/qpeapplication.h> | 61 | #include <qpe/qpeapplication.h> |
48 | #endif | 62 | #endif |
63 | #include <Q3Action> | ||
49 | 64 | ||
50 | // /*US | 65 | // /*US |
51 | class KListView::Tooltip : public QToolTip | 66 | class KListView::Tooltip /* TODO:hacker:TODO: : public QToolTip */ |
52 | { | 67 | { |
53 | public: | 68 | public: |
54 | Tooltip (KListView* parent, QToolTipGroup* group = 0L); | 69 | Tooltip (KListView* parent, QToolTipGroup* group = 0L); |
55 | virtual ~Tooltip () {} | 70 | virtual ~Tooltip () {} |
56 | 71 | ||
57 | protected: | 72 | protected: |
58 | // */ | 73 | // */ |
59 | /** | 74 | /** |
@@ -62,17 +77,17 @@ protected: | |||
62 | // /*US | 77 | // /*US |
63 | virtual void maybeTip (const QPoint&); | 78 | virtual void maybeTip (const QPoint&); |
64 | 79 | ||
65 | private: | 80 | private: |
66 | KListView* mParent; | 81 | KListView* mParent; |
67 | }; | 82 | }; |
68 | 83 | ||
69 | KListView::Tooltip::Tooltip (KListView* parent, QToolTipGroup* group) | 84 | KListView::Tooltip::Tooltip (KListView* parent, QToolTipGroup* group) |
70 | : QToolTip (parent, group), | 85 | : /* XXX:hacker:XXX: QToolTip (parent, group), */ |
71 | mParent (parent) | 86 | mParent (parent) |
72 | { | 87 | { |
73 | } | 88 | } |
74 | 89 | ||
75 | void KListView::Tooltip::maybeTip (const QPoint&) | 90 | void KListView::Tooltip::maybeTip (const QPoint&) |
76 | { | 91 | { |
77 | // FIXME | 92 | // FIXME |
78 | } | 93 | } |
@@ -118,30 +133,30 @@ public: | |||
118 | //US connect(editor, SIGNAL(done(QListViewItem*,int)), listview, SLOT(doneEditing(QListViewItem*,int))); | 133 | //US connect(editor, SIGNAL(done(QListViewItem*,int)), listview, SLOT(doneEditing(QListViewItem*,int))); |
119 | } | 134 | } |
120 | 135 | ||
121 | ~KListViewPrivate () | 136 | ~KListViewPrivate () |
122 | { | 137 | { |
123 | //US delete editor; | 138 | //US delete editor; |
124 | } | 139 | } |
125 | 140 | ||
126 | QListViewItem* pCurrentItem; | 141 | Q3ListViewItem* pCurrentItem; |
127 | 142 | ||
128 | QTimer autoSelect; | 143 | QTimer autoSelect; |
129 | int autoSelectDelay; | 144 | int autoSelectDelay; |
130 | 145 | ||
131 | QTimer dragExpand; | 146 | QTimer dragExpand; |
132 | QListViewItem* dragOverItem; | 147 | Q3ListViewItem* dragOverItem; |
133 | QPoint dragOverPoint; | 148 | QPoint dragOverPoint; |
134 | 149 | ||
135 | QPoint startDragPos; | 150 | QPoint startDragPos; |
136 | int dragDelay; | 151 | int dragDelay; |
137 | 152 | ||
138 | //US KListViewLineEdit *editor; | 153 | //US KListViewLineEdit *editor; |
139 | QValueList<int> renameable; | 154 | Q3ValueList<int> renameable; |
140 | 155 | ||
141 | bool cursorInExecuteArea:1; | 156 | bool cursorInExecuteArea:1; |
142 | bool bUseSingle:1; | 157 | bool bUseSingle:1; |
143 | bool bChangeCursorOverItem:1; | 158 | bool bChangeCursorOverItem:1; |
144 | bool itemsMovable:1; | 159 | bool itemsMovable:1; |
145 | bool selectedBySimpleMove : 1; | 160 | bool selectedBySimpleMove : 1; |
146 | bool selectedUsingMouse:1; | 161 | bool selectedUsingMouse:1; |
147 | bool itemsRenameable:1; | 162 | bool itemsRenameable:1; |
@@ -165,18 +180,18 @@ public: | |||
165 | 180 | ||
166 | SelectionModeExt selectionMode; | 181 | SelectionModeExt selectionMode; |
167 | int contextMenuKey; | 182 | int contextMenuKey; |
168 | bool showContextMenusOnPress; | 183 | bool showContextMenusOnPress; |
169 | 184 | ||
170 | QRect mOldDropVisualizer; | 185 | QRect mOldDropVisualizer; |
171 | int mDropVisualizerWidth; | 186 | int mDropVisualizerWidth; |
172 | QRect mOldDropHighlighter; | 187 | QRect mOldDropHighlighter; |
173 | QListViewItem *afterItemDrop; | 188 | Q3ListViewItem *afterItemDrop; |
174 | QListViewItem *parentItemDrop; | 189 | Q3ListViewItem *parentItemDrop; |
175 | 190 | ||
176 | QColor alternateBackground; | 191 | QColor alternateBackground; |
177 | }; | 192 | }; |
178 | 193 | ||
179 | /*US | 194 | /*US |
180 | KListViewLineEdit::KListViewLineEdit(KListView *parent) | 195 | KListViewLineEdit::KListViewLineEdit(KListView *parent) |
181 | : KLineEdit(parent->viewport()), item(0), col(0), p(parent) | 196 | : KLineEdit(parent->viewport()), item(0), col(0), p(parent) |
182 | { | 197 | { |
@@ -221,51 +236,51 @@ void KListViewLineEdit::load(QListViewItem *i, int c) | |||
221 | show(); | 236 | show(); |
222 | setFocus(); | 237 | setFocus(); |
223 | } | 238 | } |
224 | */ | 239 | */ |
225 | /*Helper functions to for | 240 | /*Helper functions to for |
226 | *tabOrderedRename functionality. | 241 | *tabOrderedRename functionality. |
227 | */ | 242 | */ |
228 | 243 | ||
229 | static int nextCol (KListView *pl, QListViewItem *pi, int start, int dir) | 244 | static int nextCol (KListView *pl, Q3ListViewItem *pi, int start, int dir) |
230 | { | 245 | { |
231 | if (pi) | 246 | if (pi) |
232 | { | 247 | { |
233 | //Find the next renameable column in the current row | 248 | //Find the next renameable column in the current row |
234 | for (; ((dir == +1) ? (start < pl->columns()) : (start >= 0)); start += dir) | 249 | for (; ((dir == +1) ? (start < pl->columns()) : (start >= 0)); start += dir) |
235 | if (pl->isRenameable(start)) | 250 | if (pl->isRenameable(start)) |
236 | return start; | 251 | return start; |
237 | } | 252 | } |
238 | 253 | ||
239 | return -1; | 254 | return -1; |
240 | } | 255 | } |
241 | 256 | ||
242 | static QListViewItem *prevItem (QListViewItem *pi) | 257 | static Q3ListViewItem *prevItem (Q3ListViewItem *pi) |
243 | { | 258 | { |
244 | QListViewItem *pa = pi->itemAbove(); | 259 | Q3ListViewItem *pa = pi->itemAbove(); |
245 | 260 | ||
246 | /*Does what the QListViewItem::previousSibling() | 261 | /*Does what the QListViewItem::previousSibling() |
247 | *of my dreams would do. | 262 | *of my dreams would do. |
248 | */ | 263 | */ |
249 | if (pa && pa->parent() == pi->parent()) | 264 | if (pa && pa->parent() == pi->parent()) |
250 | return pa; | 265 | return pa; |
251 | 266 | ||
252 | return NULL; | 267 | return NULL; |
253 | } | 268 | } |
254 | 269 | ||
255 | static QListViewItem *lastQChild (QListViewItem *pi) | 270 | static Q3ListViewItem *lastQChild (Q3ListViewItem *pi) |
256 | { | 271 | { |
257 | if (pi) | 272 | if (pi) |
258 | { | 273 | { |
259 | /*Since there's no QListViewItem::lastChild(). | 274 | /*Since there's no QListViewItem::lastChild(). |
260 | *This finds the last sibling for the given | 275 | *This finds the last sibling for the given |
261 | *item. | 276 | *item. |
262 | */ | 277 | */ |
263 | for (QListViewItem *pt = pi->nextSibling(); pt; pt = pt->nextSibling()) | 278 | for (Q3ListViewItem *pt = pi->nextSibling(); pt; pt = pt->nextSibling()) |
264 | pi = pt; | 279 | pi = pt; |
265 | } | 280 | } |
266 | 281 | ||
267 | return pi; | 282 | return pi; |
268 | } | 283 | } |
269 | /*US | 284 | /*US |
270 | void KListViewLineEdit::selectNextCell (QListViewItem *pitem, int column, bool forward) | 285 | void KListViewLineEdit::selectNextCell (QListViewItem *pitem, int column, bool forward) |
271 | { | 286 | { |
@@ -323,20 +338,20 @@ void KListViewLineEdit::selectNextCell (QListViewItem *pitem, int column, bool f | |||
323 | bool KListViewLineEdit::event (QEvent *pe) | 338 | bool KListViewLineEdit::event (QEvent *pe) |
324 | { | 339 | { |
325 | if (pe->type() == QEvent::KeyPress) | 340 | if (pe->type() == QEvent::KeyPress) |
326 | { | 341 | { |
327 | QKeyEvent *k = (QKeyEvent *) pe; | 342 | QKeyEvent *k = (QKeyEvent *) pe; |
328 | 343 | ||
329 | if ((k->key() == Qt::Key_Backtab || k->key() == Qt::Key_Tab) && | 344 | if ((k->key() == Qt::Key_Backtab || k->key() == Qt::Key_Tab) && |
330 | p->tabOrderedRenaming() && p->itemsRenameable() && | 345 | p->tabOrderedRenaming() && p->itemsRenameable() && |
331 | !(k->state() & ControlButton || k->state() & AltButton)) | 346 | !(k->state() & Qt::ControlButton || k->state() & AltButton)) |
332 | { | 347 | { |
333 | selectNextCell(item, col, | 348 | selectNextCell(item, col, |
334 | (k->key() == Key_Tab && !(k->state() & ShiftButton))); | 349 | (k->key() == Key_Tab && !(k->state() & Qt::ShiftButton))); |
335 | return true; | 350 | return true; |
336 | } | 351 | } |
337 | } | 352 | } |
338 | 353 | ||
339 | return KLineEdit::event(pe); | 354 | return KLineEdit::event(pe); |
340 | } | 355 | } |
341 | 356 | ||
342 | void KListViewLineEdit::keyPressEvent(QKeyEvent *e) | 357 | void KListViewLineEdit::keyPressEvent(QKeyEvent *e) |
@@ -401,29 +416,29 @@ void KListViewLineEdit::slotSelectionChanged() | |||
401 | { | 416 | { |
402 | item = 0; | 417 | item = 0; |
403 | col = 0; | 418 | col = 0; |
404 | hide(); | 419 | hide(); |
405 | } | 420 | } |
406 | */ | 421 | */ |
407 | 422 | ||
408 | KListView::KListView( QWidget *parent, const char *name ,bool emulateRightMouse ) | 423 | KListView::KListView( QWidget *parent, const char *name ,bool emulateRightMouse ) |
409 | : QListView( parent, name ), | 424 | : Q3ListView( parent, name ), |
410 | d (new KListViewPrivate (this)) | 425 | d (new KListViewPrivate (this)) |
411 | { | 426 | { |
412 | #ifndef DESKTOP_VERSION | 427 | #ifndef DESKTOP_VERSION |
413 | if ( emulateRightMouse ) | 428 | if ( emulateRightMouse ) |
414 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 429 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
415 | #endif | 430 | #endif |
416 | //US setDragAutoScroll(true); | 431 | //US setDragAutoScroll(true); |
417 | 432 | ||
418 | connect( this, SIGNAL( onViewport() ), | 433 | connect( this, SIGNAL( onViewport() ), |
419 | this, SLOT( slotOnViewport() ) ); | 434 | this, SLOT( slotOnViewport() ) ); |
420 | connect( this, SIGNAL( onItem( QListViewItem * ) ), | 435 | connect( this, SIGNAL( onItem( Q3ListViewItem * ) ), |
421 | this, SLOT( slotOnItem( QListViewItem * ) ) ); | 436 | this, SLOT( slotOnItem( Q3ListViewItem * ) ) ); |
422 | 437 | ||
423 | connect (this, SIGNAL(contentsMoving(int,int)), | 438 | connect (this, SIGNAL(contentsMoving(int,int)), |
424 | this, SLOT(cleanDropVisualizer())); | 439 | this, SLOT(cleanDropVisualizer())); |
425 | connect (this, SIGNAL(contentsMoving(int,int)), | 440 | connect (this, SIGNAL(contentsMoving(int,int)), |
426 | this, SLOT(cleanItemHighlighter())); | 441 | this, SLOT(cleanItemHighlighter())); |
427 | 442 | ||
428 | /*US | 443 | /*US |
429 | slotSettingsChanged(KApplication::SETTINGS_MOUSE); | 444 | slotSettingsChanged(KApplication::SETTINGS_MOUSE); |
@@ -440,27 +455,27 @@ KListView::KListView( QWidget *parent, const char *name ,bool emulateRightMouse | |||
440 | connect(&d->autoSelect, SIGNAL( timeout() ), | 455 | connect(&d->autoSelect, SIGNAL( timeout() ), |
441 | this, SLOT( slotAutoSelect() ) ); | 456 | this, SLOT( slotAutoSelect() ) ); |
442 | connect(&d->dragExpand, SIGNAL( timeout() ), | 457 | connect(&d->dragExpand, SIGNAL( timeout() ), |
443 | this, SLOT( slotDragExpand() ) ); | 458 | this, SLOT( slotDragExpand() ) ); |
444 | 459 | ||
445 | // context menu handling | 460 | // context menu handling |
446 | if (d->showContextMenusOnPress) | 461 | if (d->showContextMenusOnPress) |
447 | { | 462 | { |
448 | connect (this, SIGNAL (rightButtonPressed (QListViewItem*, const QPoint&, int)), | 463 | connect (this, SIGNAL (rightButtonPressed (Q3ListViewItem*, const QPoint&, int)), |
449 | this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); | 464 | this, SLOT (emitContextMenu (Q3ListViewItem*, const QPoint&, int))); |
450 | } | 465 | } |
451 | else | 466 | else |
452 | { | 467 | { |
453 | connect (this, SIGNAL (rightButtonClicked (QListViewItem*, const QPoint&, int)), | 468 | connect (this, SIGNAL (rightButtonClicked (Q3ListViewItem*, const QPoint&, int)), |
454 | this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); | 469 | this, SLOT (emitContextMenu (Q3ListViewItem*, const QPoint&, int))); |
455 | } | 470 | } |
456 | 471 | ||
457 | connect (this, SIGNAL (menuShortCutPressed (KListView*, QListViewItem*)), | 472 | connect (this, SIGNAL (menuShortCutPressed (KListView*, Q3ListViewItem*)), |
458 | this, SLOT (emitContextMenu (KListView*, QListViewItem*))); | 473 | this, SLOT (emitContextMenu (KListView*, Q3ListViewItem*))); |
459 | 474 | ||
460 | 475 | ||
461 | //qDebug("KListView::KListView make alternate color configurable"); | 476 | //qDebug("KListView::KListView make alternate color configurable"); |
462 | d->alternateBackground = KGlobalSettings::alternateBackgroundColor(); | 477 | d->alternateBackground = KGlobalSettings::alternateBackgroundColor(); |
463 | } | 478 | } |
464 | 479 | ||
465 | 480 | ||
466 | 481 | ||
@@ -475,17 +490,17 @@ bool KListView::isExecuteArea( const QPoint& point ) | |||
475 | return isExecuteArea( point.x() ); | 490 | return isExecuteArea( point.x() ); |
476 | 491 | ||
477 | return false; | 492 | return false; |
478 | } | 493 | } |
479 | QSize KListView::sizeHint() const | 494 | QSize KListView::sizeHint() const |
480 | { | 495 | { |
481 | //qDebug("KListView::QSize sizeHint() "); | 496 | //qDebug("KListView::QSize sizeHint() "); |
482 | #ifdef DESKTOP_VERSION | 497 | #ifdef DESKTOP_VERSION |
483 | return QListView::sizeHint(); | 498 | return Q3ListView::sizeHint(); |
484 | #else | 499 | #else |
485 | return QSize ( 40, 40 ); | 500 | return QSize ( 40, 40 ); |
486 | #endif | 501 | #endif |
487 | 502 | ||
488 | } | 503 | } |
489 | bool KListView::isExecuteArea( int x ) | 504 | bool KListView::isExecuteArea( int x ) |
490 | { | 505 | { |
491 | if( allColumnsShowFocus() ) | 506 | if( allColumnsShowFocus() ) |
@@ -498,17 +513,17 @@ bool KListView::isExecuteArea( int x ) | |||
498 | for ( int index = 0; index < pos; index++ ) | 513 | for ( int index = 0; index < pos; index++ ) |
499 | offset += columnWidth( header()->mapToSection( index ) ); | 514 | offset += columnWidth( header()->mapToSection( index ) ); |
500 | 515 | ||
501 | x += contentsX(); // in case of a horizontal scrollbar | 516 | x += contentsX(); // in case of a horizontal scrollbar |
502 | return ( x > offset && x < ( offset + width ) ); | 517 | return ( x > offset && x < ( offset + width ) ); |
503 | } | 518 | } |
504 | } | 519 | } |
505 | 520 | ||
506 | void KListView::slotOnItem( QListViewItem *item ) | 521 | void KListView::slotOnItem( Q3ListViewItem *item ) |
507 | { | 522 | { |
508 | QPoint vp = viewport()->mapFromGlobal( QCursor::pos() ); | 523 | QPoint vp = viewport()->mapFromGlobal( QCursor::pos() ); |
509 | if ( item && isExecuteArea( vp.x() ) && (d->autoSelectDelay > -1) && d->bUseSingle ) { | 524 | if ( item && isExecuteArea( vp.x() ) && (d->autoSelectDelay > -1) && d->bUseSingle ) { |
510 | d->autoSelect.start( d->autoSelectDelay, true ); | 525 | d->autoSelect.start( d->autoSelectDelay, true ); |
511 | d->pCurrentItem = item; | 526 | d->pCurrentItem = item; |
512 | } | 527 | } |
513 | } | 528 | } |
514 | 529 | ||
@@ -529,22 +544,22 @@ void KListView::slotSettingsChanged(int category) | |||
529 | switch (category) | 544 | switch (category) |
530 | { | 545 | { |
531 | //US I create my private category (=1) to set the settings | 546 | //US I create my private category (=1) to set the settings |
532 | case 1: | 547 | case 1: |
533 | d->dragDelay = 2; | 548 | d->dragDelay = 2; |
534 | //US set explicitly d->bUseSingle = KGlobalSettings::singleClick(); | 549 | //US set explicitly d->bUseSingle = KGlobalSettings::singleClick(); |
535 | // qDebug("KListView::slotSettingsChanged: single%i", d->bUseSingle); | 550 | // qDebug("KListView::slotSettingsChanged: single%i", d->bUseSingle); |
536 | 551 | ||
537 | disconnect(this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), | 552 | disconnect(this, SIGNAL (mouseButtonClicked (int, Q3ListViewItem*, const QPoint &, int)), |
538 | this, SLOT (slotMouseButtonClicked (int, QListViewItem*, const QPoint &, int))); | 553 | this, SLOT (slotMouseButtonClicked (int, Q3ListViewItem*, const QPoint &, int))); |
539 | 554 | ||
540 | if( d->bUseSingle ) | 555 | if( d->bUseSingle ) |
541 | connect (this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), | 556 | connect (this, SIGNAL (mouseButtonClicked (int, Q3ListViewItem*, const QPoint &, int)), |
542 | this, SLOT (slotMouseButtonClicked( int, QListViewItem*, const QPoint &, int))); | 557 | this, SLOT (slotMouseButtonClicked( int, Q3ListViewItem*, const QPoint &, int))); |
543 | 558 | ||
544 | //US d->bChangeCursorOverItem = KGlobalSettings::changeCursorOverIcon(); | 559 | //US d->bChangeCursorOverItem = KGlobalSettings::changeCursorOverIcon(); |
545 | //US d->autoSelectDelay = KGlobalSettings::autoSelectDelay(); | 560 | //US d->autoSelectDelay = KGlobalSettings::autoSelectDelay(); |
546 | 561 | ||
547 | if( !d->bUseSingle || !d->bChangeCursorOverItem ) | 562 | if( !d->bUseSingle || !d->bChangeCursorOverItem ) |
548 | viewport()->unsetCursor(); | 563 | viewport()->unsetCursor(); |
549 | 564 | ||
550 | break; | 565 | break; |
@@ -606,17 +621,17 @@ void KListView::slotAutoSelect() | |||
606 | d->autoSelect.stop(); | 621 | d->autoSelect.stop(); |
607 | return; | 622 | return; |
608 | } | 623 | } |
609 | 624 | ||
610 | //Give this widget the keyboard focus. | 625 | //Give this widget the keyboard focus. |
611 | if( !hasFocus() ) | 626 | if( !hasFocus() ) |
612 | setFocus(); | 627 | setFocus(); |
613 | 628 | ||
614 | QListViewItem* previousItem = currentItem(); | 629 | Q3ListViewItem* previousItem = currentItem(); |
615 | setCurrentItem( d->pCurrentItem ); | 630 | setCurrentItem( d->pCurrentItem ); |
616 | 631 | ||
617 | #if 0 | 632 | #if 0 |
618 | #ifndef Q_WS_QWS | 633 | #ifndef Q_WS_QWS |
619 | // FIXME(E): Implement for Qt Embedded | 634 | // FIXME(E): Implement for Qt Embedded |
620 | if( d->pCurrentItem ) { | 635 | if( d->pCurrentItem ) { |
621 | //Shift pressed? | 636 | //Shift pressed? |
622 | if( (keybstate & ShiftMask) ) { | 637 | if( (keybstate & ShiftMask) ) { |
@@ -627,17 +642,17 @@ void KListView::slotAutoSelect() | |||
627 | if( !(keybstate & ControlMask) ) | 642 | if( !(keybstate & ControlMask) ) |
628 | clearSelection(); | 643 | clearSelection(); |
629 | 644 | ||
630 | bool select = !d->pCurrentItem->isSelected(); | 645 | bool select = !d->pCurrentItem->isSelected(); |
631 | bool update = viewport()->isUpdatesEnabled(); | 646 | bool update = viewport()->isUpdatesEnabled(); |
632 | viewport()->setUpdatesEnabled( false ); | 647 | viewport()->setUpdatesEnabled( false ); |
633 | 648 | ||
634 | bool down = previousItem->itemPos() < d->pCurrentItem->itemPos(); | 649 | bool down = previousItem->itemPos() < d->pCurrentItem->itemPos(); |
635 | QListViewItemIterator lit( down ? previousItem : d->pCurrentItem ); | 650 | Q3ListViewItemIterator lit( down ? previousItem : d->pCurrentItem ); |
636 | for ( ; lit.current(); ++lit ) { | 651 | for ( ; lit.current(); ++lit ) { |
637 | if ( down && lit.current() == d->pCurrentItem ) { | 652 | if ( down && lit.current() == d->pCurrentItem ) { |
638 | d->pCurrentItem->setSelected( select ); | 653 | d->pCurrentItem->setSelected( select ); |
639 | break; | 654 | break; |
640 | } | 655 | } |
641 | if ( !down && lit.current() == previousItem ) { | 656 | if ( !down && lit.current() == previousItem ) { |
642 | previousItem->setSelected( select ); | 657 | previousItem->setSelected( select ); |
643 | break; | 658 | break; |
@@ -646,17 +661,17 @@ void KListView::slotAutoSelect() | |||
646 | } | 661 | } |
647 | 662 | ||
648 | blockSignals( block ); | 663 | blockSignals( block ); |
649 | viewport()->setUpdatesEnabled( update ); | 664 | viewport()->setUpdatesEnabled( update ); |
650 | triggerUpdate(); | 665 | triggerUpdate(); |
651 | 666 | ||
652 | emit selectionChanged(); | 667 | emit selectionChanged(); |
653 | 668 | ||
654 | if( selectionMode() == QListView::Single ) | 669 | if( selectionMode() == Q3ListView::Single ) |
655 | emit selectionChanged( d->pCurrentItem ); | 670 | emit selectionChanged( d->pCurrentItem ); |
656 | } | 671 | } |
657 | else if( (keybstate & ControlMask) ) | 672 | else if( (keybstate & ControlMask) ) |
658 | setSelected( d->pCurrentItem, !d->pCurrentItem->isSelected() ); | 673 | setSelected( d->pCurrentItem, !d->pCurrentItem->isSelected() ); |
659 | else { | 674 | else { |
660 | bool block = signalsBlocked(); | 675 | bool block = signalsBlocked(); |
661 | blockSignals( true ); | 676 | blockSignals( true ); |
662 | 677 | ||
@@ -679,47 +694,47 @@ void KListView::slotHeaderChanged() | |||
679 | if (d->fullWidth && columns()) | 694 | if (d->fullWidth && columns()) |
680 | { | 695 | { |
681 | int w = 0; | 696 | int w = 0; |
682 | for (int i = 0; i < columns() - 1; ++i) w += columnWidth(i); | 697 | for (int i = 0; i < columns() - 1; ++i) w += columnWidth(i); |
683 | setColumnWidth( columns() - 1, viewport()->width() - w - 1 ); | 698 | setColumnWidth( columns() - 1, viewport()->width() - w - 1 ); |
684 | } | 699 | } |
685 | } | 700 | } |
686 | 701 | ||
687 | void KListView::emitExecute( int buttonstate, QListViewItem *item, const QPoint &pos, int c) | 702 | void KListView::emitExecute( int buttonstate, Q3ListViewItem *item, const QPoint &pos, int c) |
688 | { | 703 | { |
689 | // qDebug("KListView::emitExecute buttonstate=%i", buttonstate); | 704 | // qDebug("KListView::emitExecute buttonstate=%i", buttonstate); |
690 | if( isExecuteArea( viewport()->mapFromGlobal(pos) ) ) { | 705 | if( isExecuteArea( viewport()->mapFromGlobal(pos) ) ) { |
691 | 706 | ||
692 | // Double click mode ? | 707 | // Double click mode ? |
693 | if ( !d->bUseSingle ) | 708 | if ( !d->bUseSingle ) |
694 | { | 709 | { |
695 | emit executed( item ); | 710 | emit executed( item ); |
696 | emit executed( item, pos, c ); | 711 | emit executed( item, pos, c ); |
697 | } | 712 | } |
698 | else | 713 | else |
699 | { | 714 | { |
700 | //US special implementation for embedded systems | 715 | //US special implementation for embedded systems |
701 | d->autoSelect.stop(); | 716 | d->autoSelect.stop(); |
702 | 717 | ||
703 | //Dont emit executed if in SC mode and Shift or Ctrl are pressed | 718 | //Dont emit executed if in SC mode and Shift or Ctrl are pressed |
704 | if( !( (buttonstate==ShiftButton) || (buttonstate==ControlButton) )) { | 719 | if( !( (buttonstate==Qt::ShiftButton) || (buttonstate==Qt::ControlButton) )) { |
705 | // if( !( ((keybstate & ShiftMask) || (keybstate & ControlMask)) ) ) { | 720 | // if( !( ((keybstate & ShiftMask) || (keybstate & ControlMask)) ) ) { |
706 | 721 | ||
707 | emit executed( item ); | 722 | emit executed( item ); |
708 | emit executed( item, pos, c ); | 723 | emit executed( item, pos, c ); |
709 | } | 724 | } |
710 | } | 725 | } |
711 | } | 726 | } |
712 | } | 727 | } |
713 | 728 | ||
714 | void KListView::focusInEvent( QFocusEvent *fe ) | 729 | void KListView::focusInEvent( QFocusEvent *fe ) |
715 | { | 730 | { |
716 | // kdDebug()<<"KListView::focusInEvent()"<<endl; | 731 | // kdDebug()<<"KListView::focusInEvent()"<<endl; |
717 | QListView::focusInEvent( fe ); | 732 | Q3ListView::focusInEvent( fe ); |
718 | if ((d->selectedBySimpleMove) | 733 | if ((d->selectedBySimpleMove) |
719 | && (d->selectionMode == FileManager) | 734 | && (d->selectionMode == FileManager) |
720 | && (fe->reason()!=QFocusEvent::Popup) | 735 | && (fe->reason()!=QFocusEvent::Popup) |
721 | && (fe->reason()!=QFocusEvent::ActiveWindow) | 736 | && (fe->reason()!=QFocusEvent::ActiveWindow) |
722 | && (currentItem()!=0)) | 737 | && (currentItem()!=0)) |
723 | { | 738 | { |
724 | currentItem()->setSelected(true); | 739 | currentItem()->setSelected(true); |
725 | currentItem()->repaint(); | 740 | currentItem()->repaint(); |
@@ -742,41 +757,41 @@ void KListView::focusOutEvent( QFocusEvent *fe ) | |||
742 | /*US && (!d->editor->isVisible()) */ | 757 | /*US && (!d->editor->isVisible()) */ |
743 | ) | 758 | ) |
744 | { | 759 | { |
745 | currentItem()->setSelected(false); | 760 | currentItem()->setSelected(false); |
746 | currentItem()->repaint(); | 761 | currentItem()->repaint(); |
747 | emit selectionChanged(); | 762 | emit selectionChanged(); |
748 | }; | 763 | }; |
749 | 764 | ||
750 | QListView::focusOutEvent( fe ); | 765 | Q3ListView::focusOutEvent( fe ); |
751 | } | 766 | } |
752 | 767 | ||
753 | void KListView::leaveEvent( QEvent *e ) | 768 | void KListView::leaveEvent( QEvent *e ) |
754 | { | 769 | { |
755 | d->autoSelect.stop(); | 770 | d->autoSelect.stop(); |
756 | 771 | ||
757 | QListView::leaveEvent( e ); | 772 | Q3ListView::leaveEvent( e ); |
758 | } | 773 | } |
759 | 774 | ||
760 | bool KListView::event( QEvent *e ) | 775 | bool KListView::event( QEvent *e ) |
761 | { | 776 | { |
762 | if (e->type() == QEvent::ApplicationPaletteChange) { | 777 | if (e->type() == QEvent::ApplicationPaletteChange) { |
763 | //qDebug("KListView::event make alternate color configurable"); | 778 | //qDebug("KListView::event make alternate color configurable"); |
764 | //US d->alternateBackground=KGlobalSettings::alternateBackgroundColor(); | 779 | //US d->alternateBackground=KGlobalSettings::alternateBackgroundColor(); |
765 | d->alternateBackground = QColor(240, 240, 240); | 780 | d->alternateBackground = QColor(240, 240, 240); |
766 | } | 781 | } |
767 | 782 | ||
768 | return QListView::event(e); | 783 | return Q3ListView::event(e); |
769 | } | 784 | } |
770 | 785 | ||
771 | void KListView::contentsMousePressEvent( QMouseEvent *e ) | 786 | void KListView::contentsMousePressEvent( QMouseEvent *e ) |
772 | { | 787 | { |
773 | //qDebug("KListView::contentsMousePressEvent"); | 788 | //qDebug("KListView::contentsMousePressEvent"); |
774 | if( (selectionModeExt() == Extended) && (e->state() & ShiftButton) && !(e->state() & ControlButton) ) | 789 | if( (selectionModeExt() == Extended) && (e->state() & Qt::ShiftButton) && !(e->state() & Qt::ControlButton) ) |
775 | { | 790 | { |
776 | bool block = signalsBlocked(); | 791 | bool block = signalsBlocked(); |
777 | blockSignals( true ); | 792 | blockSignals( true ); |
778 | 793 | ||
779 | clearSelection(); | 794 | clearSelection(); |
780 | 795 | ||
781 | blockSignals( block ); | 796 | blockSignals( block ); |
782 | } | 797 | } |
@@ -788,48 +803,48 @@ void KListView::contentsMousePressEvent( QMouseEvent *e ) | |||
788 | { | 803 | { |
789 | currentItem()->setSelected(false); | 804 | currentItem()->setSelected(false); |
790 | currentItem()->repaint(); | 805 | currentItem()->repaint(); |
791 | // emit selectionChanged(); | 806 | // emit selectionChanged(); |
792 | }; | 807 | }; |
793 | }; | 808 | }; |
794 | 809 | ||
795 | QPoint p( contentsToViewport( e->pos() ) ); | 810 | QPoint p( contentsToViewport( e->pos() ) ); |
796 | QListViewItem *at = itemAt (p); | 811 | Q3ListViewItem *at = itemAt (p); |
797 | 812 | ||
798 | // true if the root decoration of the item "at" was clicked (i.e. the +/- sign) | 813 | // true if the root decoration of the item "at" was clicked (i.e. the +/- sign) |
799 | bool rootDecoClicked = at | 814 | bool rootDecoClicked = at |
800 | && ( p.x() <= header()->cellPos( header()->mapToActual( 0 ) ) + | 815 | && ( p.x() <= header()->cellPos( header()->mapToActual( 0 ) ) + |
801 | treeStepSize() * ( at->depth() + ( rootIsDecorated() ? 1 : 0) ) + itemMargin() ) | 816 | treeStepSize() * ( at->depth() + ( rootIsDecorated() ? 1 : 0) ) + itemMargin() ) |
802 | && ( p.x() >= header()->cellPos( header()->mapToActual( 0 ) ) ); | 817 | && ( p.x() >= header()->cellPos( header()->mapToActual( 0 ) ) ); |
803 | 818 | ||
804 | if (e->button() == LeftButton && !rootDecoClicked) | 819 | if (e->button() == Qt::LeftButton && !rootDecoClicked) |
805 | { | 820 | { |
806 | //Start a drag | 821 | //Start a drag |
807 | d->startDragPos = e->pos(); | 822 | d->startDragPos = e->pos(); |
808 | 823 | ||
809 | if (at) | 824 | if (at) |
810 | { | 825 | { |
811 | d->validDrag = true; | 826 | d->validDrag = true; |
812 | d->pressedOnSelected = at->isSelected(); | 827 | d->pressedOnSelected = at->isSelected(); |
813 | } | 828 | } |
814 | } | 829 | } |
815 | 830 | ||
816 | QListView::contentsMousePressEvent( e ); | 831 | Q3ListView::contentsMousePressEvent( e ); |
817 | } | 832 | } |
818 | 833 | ||
819 | void KListView::contentsMouseMoveEvent( QMouseEvent *e ) | 834 | void KListView::contentsMouseMoveEvent( QMouseEvent *e ) |
820 | { | 835 | { |
821 | if (!dragEnabled() || d->startDragPos.isNull() || !d->validDrag) { | 836 | if (!dragEnabled() || d->startDragPos.isNull() || !d->validDrag) { |
822 | QListView::contentsMouseMoveEvent (e); | 837 | Q3ListView::contentsMouseMoveEvent (e); |
823 | return; | 838 | return; |
824 | } | 839 | } |
825 | 840 | ||
826 | QPoint vp = contentsToViewport(e->pos()); | 841 | QPoint vp = contentsToViewport(e->pos()); |
827 | QListViewItem *item = itemAt( vp ); | 842 | Q3ListViewItem *item = itemAt( vp ); |
828 | 843 | ||
829 | //do we process cursor changes at all? | 844 | //do we process cursor changes at all? |
830 | if ( item && d->bChangeCursorOverItem && d->bUseSingle ) | 845 | if ( item && d->bChangeCursorOverItem && d->bUseSingle ) |
831 | { | 846 | { |
832 | //Cursor moved on a new item or in/out the execute area | 847 | //Cursor moved on a new item or in/out the execute area |
833 | if( (item != d->pCurrentItem) || | 848 | if( (item != d->pCurrentItem) || |
834 | (isExecuteArea(vp) != d->cursorInExecuteArea) ) | 849 | (isExecuteArea(vp) != d->cursorInExecuteArea) ) |
835 | { | 850 | { |
@@ -848,32 +863,32 @@ void KListView::contentsMouseMoveEvent( QMouseEvent *e ) | |||
848 | QPoint newPos = e->pos(); | 863 | QPoint newPos = e->pos(); |
849 | if (dragOn && d->validDrag && | 864 | if (dragOn && d->validDrag && |
850 | (newPos.x() > d->startDragPos.x()+d->dragDelay || | 865 | (newPos.x() > d->startDragPos.x()+d->dragDelay || |
851 | newPos.x() < d->startDragPos.x()-d->dragDelay || | 866 | newPos.x() < d->startDragPos.x()-d->dragDelay || |
852 | newPos.y() > d->startDragPos.y()+d->dragDelay || | 867 | newPos.y() > d->startDragPos.y()+d->dragDelay || |
853 | newPos.y() < d->startDragPos.y()-d->dragDelay)) | 868 | newPos.y() < d->startDragPos.y()-d->dragDelay)) |
854 | //(d->startDragPos - e->pos()).manhattanLength() > QApplication::startDragDistance()) | 869 | //(d->startDragPos - e->pos()).manhattanLength() > QApplication::startDragDistance()) |
855 | { | 870 | { |
856 | QListView::contentsMouseReleaseEvent( 0 ); | 871 | Q3ListView::contentsMouseReleaseEvent( 0 ); |
857 | startDrag(); | 872 | startDrag(); |
858 | d->startDragPos = QPoint(); | 873 | d->startDragPos = QPoint(); |
859 | d->validDrag = false; | 874 | d->validDrag = false; |
860 | } | 875 | } |
861 | } | 876 | } |
862 | 877 | ||
863 | void KListView::contentsMouseReleaseEvent( QMouseEvent *e ) | 878 | void KListView::contentsMouseReleaseEvent( QMouseEvent *e ) |
864 | { | 879 | { |
865 | if (e->button() == LeftButton) | 880 | if (e->button() == Qt::LeftButton) |
866 | { | 881 | { |
867 | // If the row was already selected, maybe we want to start an in-place editing | 882 | // If the row was already selected, maybe we want to start an in-place editing |
868 | if ( d->pressedOnSelected && itemsRenameable() ) | 883 | if ( d->pressedOnSelected && itemsRenameable() ) |
869 | { | 884 | { |
870 | QPoint p( contentsToViewport( e->pos() ) ); | 885 | QPoint p( contentsToViewport( e->pos() ) ); |
871 | QListViewItem *at = itemAt (p); | 886 | Q3ListViewItem *at = itemAt (p); |
872 | if ( at ) | 887 | if ( at ) |
873 | { | 888 | { |
874 | // true if the root decoration of the item "at" was clicked (i.e. the +/- sign) | 889 | // true if the root decoration of the item "at" was clicked (i.e. the +/- sign) |
875 | bool rootDecoClicked = | 890 | bool rootDecoClicked = |
876 | ( p.x() <= header()->cellPos( header()->mapToActual( 0 ) ) + | 891 | ( p.x() <= header()->cellPos( header()->mapToActual( 0 ) ) + |
877 | treeStepSize() * ( at->depth() + ( rootIsDecorated() ? 1 : 0) ) + itemMargin() ) | 892 | treeStepSize() * ( at->depth() + ( rootIsDecorated() ? 1 : 0) ) + itemMargin() ) |
878 | && ( p.x() >= header()->cellPos( header()->mapToActual( 0 ) ) ); | 893 | && ( p.x() >= header()->cellPos( header()->mapToActual( 0 ) ) ); |
879 | 894 | ||
@@ -885,50 +900,50 @@ void KListView::contentsMouseReleaseEvent( QMouseEvent *e ) | |||
885 | } | 900 | } |
886 | } | 901 | } |
887 | } | 902 | } |
888 | 903 | ||
889 | d->pressedOnSelected = false; | 904 | d->pressedOnSelected = false; |
890 | d->validDrag = false; | 905 | d->validDrag = false; |
891 | d->startDragPos = QPoint(); | 906 | d->startDragPos = QPoint(); |
892 | } | 907 | } |
893 | QListView::contentsMouseReleaseEvent( e ); | 908 | Q3ListView::contentsMouseReleaseEvent( e ); |
894 | } | 909 | } |
895 | 910 | ||
896 | void KListView::contentsMouseDoubleClickEvent ( QMouseEvent *e ) | 911 | void KListView::contentsMouseDoubleClickEvent ( QMouseEvent *e ) |
897 | { | 912 | { |
898 | //qDebug("KListView::contentsMouseDoubleClickEvent"); | 913 | //qDebug("KListView::contentsMouseDoubleClickEvent"); |
899 | // We don't want to call the parent method because it does setOpen, | 914 | // We don't want to call the parent method because it does setOpen, |
900 | // whereas we don't do it in single click mode... (David) | 915 | // whereas we don't do it in single click mode... (David) |
901 | //QListView::contentsMouseDoubleClickEvent( e ); | 916 | //QListView::contentsMouseDoubleClickEvent( e ); |
902 | 917 | ||
903 | QPoint vp = contentsToViewport(e->pos()); | 918 | QPoint vp = contentsToViewport(e->pos()); |
904 | QListViewItem *item = itemAt( vp ); | 919 | Q3ListViewItem *item = itemAt( vp ); |
905 | emit QListView::doubleClicked( item ); // we do it now | 920 | emit Q3ListView::doubleClicked( item ); // we do it now |
906 | 921 | ||
907 | int col = item ? header()->mapToLogical( header()->cellAt( vp.x() ) ) : -1; | 922 | int col = item ? header()->mapToLogical( header()->cellAt( vp.x() ) ) : -1; |
908 | 923 | ||
909 | if( item ) { | 924 | if( item ) { |
910 | //qDebug("KListView::contentsMouseDoubleClickEvent: emit doubleClicked"); | 925 | //qDebug("KListView::contentsMouseDoubleClickEvent: emit doubleClicked"); |
911 | 926 | ||
912 | emit doubleClicked( item, e->globalPos(), col ); | 927 | emit doubleClicked( item, e->globalPos(), col ); |
913 | 928 | ||
914 | if( (e->button() == LeftButton) && !d->bUseSingle ) { | 929 | if( (e->button() == Qt::LeftButton) && !d->bUseSingle ) { |
915 | //qDebug("KListView::contentsMouseDoubleClickEvent: emitExecute"); | 930 | //qDebug("KListView::contentsMouseDoubleClickEvent: emitExecute"); |
916 | 931 | ||
917 | emitExecute( e->button(), item, e->globalPos(), col); | 932 | emitExecute( e->button(), item, e->globalPos(), col); |
918 | } | 933 | } |
919 | } | 934 | } |
920 | } | 935 | } |
921 | 936 | ||
922 | void KListView::slotMouseButtonClicked( int btn, QListViewItem *item, const QPoint &pos, int c ) | 937 | void KListView::slotMouseButtonClicked( int btn, Q3ListViewItem *item, const QPoint &pos, int c ) |
923 | { | 938 | { |
924 | //qDebug("KListView::slotMouseButtonClicked"); | 939 | //qDebug("KListView::slotMouseButtonClicked"); |
925 | 940 | ||
926 | if( (btn == LeftButton) && item ) { | 941 | if( (btn == Qt::LeftButton) && item ) { |
927 | //qDebug("KListView::slotMouseButtonClicked: emitExecute"); | 942 | //qDebug("KListView::slotMouseButtonClicked: emitExecute"); |
928 | 943 | ||
929 | emitExecute(btn, item, pos, c); | 944 | emitExecute(btn, item, pos, c); |
930 | } | 945 | } |
931 | } | 946 | } |
932 | 947 | ||
933 | void KListView::contentsDropEvent(QDropEvent* e) | 948 | void KListView::contentsDropEvent(QDropEvent* e) |
934 | { | 949 | { |
@@ -956,35 +971,35 @@ qDebug("KListView::contentsDropEvent drag&drop not supported yet"); | |||
956 | emit dropped(this, e, parent, afterme); | 971 | emit dropped(this, e, parent, afterme); |
957 | 972 | ||
958 | } | 973 | } |
959 | } | 974 | } |
960 | */ | 975 | */ |
961 | 976 | ||
962 | } | 977 | } |
963 | 978 | ||
964 | void KListView::movableDropEvent (QListViewItem* parent, QListViewItem* afterme) | 979 | void KListView::movableDropEvent (Q3ListViewItem* parent, Q3ListViewItem* afterme) |
965 | { | 980 | { |
966 | QPtrList<QListViewItem> items, afterFirsts, afterNows; | 981 | Q3PtrList<Q3ListViewItem> items, afterFirsts, afterNows; |
967 | QListViewItem *current=currentItem(); | 982 | Q3ListViewItem *current=currentItem(); |
968 | bool hasMoved=false; | 983 | bool hasMoved=false; |
969 | for (QListViewItem *i = firstChild(), *iNext=0; i != 0; i = iNext) | 984 | for (Q3ListViewItem *i = firstChild(), *iNext=0; i != 0; i = iNext) |
970 | { | 985 | { |
971 | iNext=i->itemBelow(); | 986 | iNext=i->itemBelow(); |
972 | if (!i->isSelected()) | 987 | if (!i->isSelected()) |
973 | continue; | 988 | continue; |
974 | 989 | ||
975 | // don't drop an item after itself, or else | 990 | // don't drop an item after itself, or else |
976 | // it moves to the top of the list | 991 | // it moves to the top of the list |
977 | if (i==afterme) | 992 | if (i==afterme) |
978 | continue; | 993 | continue; |
979 | 994 | ||
980 | i->setSelected(false); | 995 | i->setSelected(false); |
981 | 996 | ||
982 | QListViewItem *afterFirst = i->itemAbove(); | 997 | Q3ListViewItem *afterFirst = i->itemAbove(); |
983 | 998 | ||
984 | if (!hasMoved) | 999 | if (!hasMoved) |
985 | { | 1000 | { |
986 | emit aboutToMove(); | 1001 | emit aboutToMove(); |
987 | hasMoved=true; | 1002 | hasMoved=true; |
988 | } | 1003 | } |
989 | 1004 | ||
990 | moveItem(i, parent, afterme); | 1005 | moveItem(i, parent, afterme); |
@@ -995,17 +1010,17 @@ void KListView::movableDropEvent (QListViewItem* parent, QListViewItem* afterme) | |||
995 | 1010 | ||
996 | items.append (i); | 1011 | items.append (i); |
997 | afterFirsts.append (afterFirst); | 1012 | afterFirsts.append (afterFirst); |
998 | afterNows.append (afterme); | 1013 | afterNows.append (afterme); |
999 | 1014 | ||
1000 | afterme = i; | 1015 | afterme = i; |
1001 | } | 1016 | } |
1002 | clearSelection(); | 1017 | clearSelection(); |
1003 | for (QListViewItem *i=items.first(); i != 0; i=items.next() ) | 1018 | for (Q3ListViewItem *i=items.first(); i != 0; i=items.next() ) |
1004 | i->setSelected(true); | 1019 | i->setSelected(true); |
1005 | if (current) | 1020 | if (current) |
1006 | setCurrentItem(current); | 1021 | setCurrentItem(current); |
1007 | 1022 | ||
1008 | emit moved(items,afterFirsts,afterNows); | 1023 | emit moved(items,afterFirsts,afterNows); |
1009 | 1024 | ||
1010 | if (firstChild()) | 1025 | if (firstChild()) |
1011 | emit moved(); | 1026 | emit moved(); |
@@ -1081,24 +1096,24 @@ void KListView::cleanDropVisualizer() | |||
1081 | } | 1096 | } |
1082 | } | 1097 | } |
1083 | 1098 | ||
1084 | int KListView::depthToPixels( int depth ) | 1099 | int KListView::depthToPixels( int depth ) |
1085 | { | 1100 | { |
1086 | return treeStepSize() * ( depth + (rootIsDecorated() ? 1 : 0) ) + itemMargin(); | 1101 | return treeStepSize() * ( depth + (rootIsDecorated() ? 1 : 0) ) + itemMargin(); |
1087 | } | 1102 | } |
1088 | 1103 | ||
1089 | void KListView::findDrop(const QPoint &pos, QListViewItem *&parent, QListViewItem *&after) | 1104 | void KListView::findDrop(const QPoint &pos, Q3ListViewItem *&parent, Q3ListViewItem *&after) |
1090 | { | 1105 | { |
1091 | QPoint p (contentsToViewport(pos)); | 1106 | QPoint p (contentsToViewport(pos)); |
1092 | 1107 | ||
1093 | // Get the position to put it in | 1108 | // Get the position to put it in |
1094 | QListViewItem *atpos = itemAt(p); | 1109 | Q3ListViewItem *atpos = itemAt(p); |
1095 | 1110 | ||
1096 | QListViewItem *above; | 1111 | Q3ListViewItem *above; |
1097 | if (!atpos) // put it at the end | 1112 | if (!atpos) // put it at the end |
1098 | above = lastItem(); | 1113 | above = lastItem(); |
1099 | else | 1114 | else |
1100 | { | 1115 | { |
1101 | // Get the closest item before us ('atpos' or the one above, if any) | 1116 | // Get the closest item before us ('atpos' or the one above, if any) |
1102 | if (p.y() - itemRect(atpos).topLeft().y() < (atpos->height()/2)) | 1117 | if (p.y() - itemRect(atpos).topLeft().y() < (atpos->height()/2)) |
1103 | above = atpos->itemAbove(); | 1118 | above = atpos->itemAbove(); |
1104 | else | 1119 | else |
@@ -1118,18 +1133,18 @@ void KListView::findDrop(const QPoint &pos, QListViewItem *&parent, QListViewIte | |||
1118 | parent = above; | 1133 | parent = above; |
1119 | after = 0L; | 1134 | after = 0L; |
1120 | return; | 1135 | return; |
1121 | } | 1136 | } |
1122 | } | 1137 | } |
1123 | 1138 | ||
1124 | // Ok, there's one more level of complexity. We may want to become a new | 1139 | // Ok, there's one more level of complexity. We may want to become a new |
1125 | // sibling, but of an upper-level group, rather than the "above" item | 1140 | // sibling, but of an upper-level group, rather than the "above" item |
1126 | QListViewItem * betterAbove = above->parent(); | 1141 | Q3ListViewItem * betterAbove = above->parent(); |
1127 | QListViewItem * last = above; | 1142 | Q3ListViewItem * last = above; |
1128 | while ( betterAbove ) | 1143 | while ( betterAbove ) |
1129 | { | 1144 | { |
1130 | // We are allowed to become a sibling of "betterAbove" only if we are | 1145 | // We are allowed to become a sibling of "betterAbove" only if we are |
1131 | // after its last child | 1146 | // after its last child |
1132 | if ( last->nextSibling() == 0 ) | 1147 | if ( last->nextSibling() == 0 ) |
1133 | { | 1148 | { |
1134 | if (p.x() < depthToPixels ( betterAbove->depth() + 1 )) | 1149 | if (p.x() < depthToPixels ( betterAbove->depth() + 1 )) |
1135 | above = betterAbove; // store this one, but don't stop yet, there may be a better one | 1150 | above = betterAbove; // store this one, but don't stop yet, there may be a better one |
@@ -1141,31 +1156,31 @@ void KListView::findDrop(const QPoint &pos, QListViewItem *&parent, QListViewIte | |||
1141 | break; // we're among the child of betterAbove, not after the last one | 1156 | break; // we're among the child of betterAbove, not after the last one |
1142 | } | 1157 | } |
1143 | } | 1158 | } |
1144 | // set as sibling | 1159 | // set as sibling |
1145 | after = above; | 1160 | after = above; |
1146 | parent = after ? after->parent() : 0L ; | 1161 | parent = after ? after->parent() : 0L ; |
1147 | } | 1162 | } |
1148 | 1163 | ||
1149 | QListViewItem* KListView::lastChild () const | 1164 | Q3ListViewItem* KListView::lastChild () const |
1150 | { | 1165 | { |
1151 | QListViewItem* lastchild = firstChild(); | 1166 | Q3ListViewItem* lastchild = firstChild(); |
1152 | 1167 | ||
1153 | if (lastchild) | 1168 | if (lastchild) |
1154 | for (; lastchild->nextSibling(); lastchild = lastchild->nextSibling()); | 1169 | for (; lastchild->nextSibling(); lastchild = lastchild->nextSibling()); |
1155 | 1170 | ||
1156 | return lastchild; | 1171 | return lastchild; |
1157 | } | 1172 | } |
1158 | 1173 | ||
1159 | QListViewItem *KListView::lastItem() const | 1174 | Q3ListViewItem *KListView::lastItem() const |
1160 | { | 1175 | { |
1161 | QListViewItem* last = lastChild(); | 1176 | Q3ListViewItem* last = lastChild(); |
1162 | 1177 | ||
1163 | for (QListViewItemIterator it (last); it.current(); ++it) | 1178 | for (Q3ListViewItemIterator it (last); it.current(); ++it) |
1164 | last = it.current(); | 1179 | last = it.current(); |
1165 | 1180 | ||
1166 | return last; | 1181 | return last; |
1167 | } | 1182 | } |
1168 | 1183 | ||
1169 | KLineEdit *KListView::renameLineEdit() const | 1184 | KLineEdit *KListView::renameLineEdit() const |
1170 | { | 1185 | { |
1171 | //US return d->editor; | 1186 | //US return d->editor; |
@@ -1182,22 +1197,22 @@ qDebug("KListView::startDrag drag&drop not supported yet."); | |||
1182 | if (!drag) | 1197 | if (!drag) |
1183 | return; | 1198 | return; |
1184 | 1199 | ||
1185 | if (drag->drag() && drag->target() != viewport()) | 1200 | if (drag->drag() && drag->target() != viewport()) |
1186 | emit moved(); | 1201 | emit moved(); |
1187 | */ | 1202 | */ |
1188 | } | 1203 | } |
1189 | 1204 | ||
1190 | QDragObject *KListView::dragObject() | 1205 | Q3DragObject *KListView::dragObject() |
1191 | { | 1206 | { |
1192 | if (!currentItem()) | 1207 | if (!currentItem()) |
1193 | return 0; | 1208 | return 0; |
1194 | 1209 | ||
1195 | return new QStoredDrag("application/x-qlistviewitem", viewport()); | 1210 | return new Q3StoredDrag("application/x-qlistviewitem", viewport()); |
1196 | } | 1211 | } |
1197 | 1212 | ||
1198 | void KListView::setItemsMovable(bool b) | 1213 | void KListView::setItemsMovable(bool b) |
1199 | { | 1214 | { |
1200 | d->itemsMovable=b; | 1215 | d->itemsMovable=b; |
1201 | } | 1216 | } |
1202 | 1217 | ||
1203 | bool KListView::itemsMovable() const | 1218 | bool KListView::itemsMovable() const |
@@ -1241,29 +1256,29 @@ bool KListView::dropVisualizer() const | |||
1241 | return d->dropVisualizer; | 1256 | return d->dropVisualizer; |
1242 | } | 1257 | } |
1243 | 1258 | ||
1244 | void KListView::setDropVisualizer(bool b) | 1259 | void KListView::setDropVisualizer(bool b) |
1245 | { | 1260 | { |
1246 | d->dropVisualizer=b; | 1261 | d->dropVisualizer=b; |
1247 | } | 1262 | } |
1248 | 1263 | ||
1249 | QPtrList<QListViewItem> KListView::selectedItems() const | 1264 | Q3PtrList<Q3ListViewItem> KListView::selectedItems() const |
1250 | { | 1265 | { |
1251 | QPtrList<QListViewItem> list; | 1266 | Q3PtrList<Q3ListViewItem> list; |
1252 | for (QListViewItem *i=firstChild(); i!=0; i=i->itemBelow()) | 1267 | for (Q3ListViewItem *i=firstChild(); i!=0; i=i->itemBelow()) |
1253 | if (i->isSelected()) list.append(i); | 1268 | if (i->isSelected()) list.append(i); |
1254 | return list; | 1269 | return list; |
1255 | } | 1270 | } |
1256 | 1271 | ||
1257 | 1272 | ||
1258 | void KListView::moveItem(QListViewItem *item, QListViewItem *parent, QListViewItem *after) | 1273 | void KListView::moveItem(Q3ListViewItem *item, Q3ListViewItem *parent, Q3ListViewItem *after) |
1259 | { | 1274 | { |
1260 | // sanity check - don't move a item into it's own child structure | 1275 | // sanity check - don't move a item into it's own child structure |
1261 | QListViewItem *i = parent; | 1276 | Q3ListViewItem *i = parent; |
1262 | while(i) | 1277 | while(i) |
1263 | { | 1278 | { |
1264 | if(i == item) | 1279 | if(i == item) |
1265 | return; | 1280 | return; |
1266 | i = i->parent(); | 1281 | i = i->parent(); |
1267 | } | 1282 | } |
1268 | 1283 | ||
1269 | // Basically reimplementing the QListViewItem(QListViewItem*, QListViewItem*) constructor | 1284 | // Basically reimplementing the QListViewItem(QListViewItem*, QListViewItem*) constructor |
@@ -1291,29 +1306,29 @@ qDebug("KListView::contentsDragEnterEvent drag&drop not supported yet."); | |||
1291 | */ | 1306 | */ |
1292 | } | 1307 | } |
1293 | 1308 | ||
1294 | void KListView::setDropVisualizerWidth (int w) | 1309 | void KListView::setDropVisualizerWidth (int w) |
1295 | { | 1310 | { |
1296 | d->mDropVisualizerWidth = w > 0 ? w : 1; | 1311 | d->mDropVisualizerWidth = w > 0 ? w : 1; |
1297 | } | 1312 | } |
1298 | 1313 | ||
1299 | QRect KListView::drawDropVisualizer(QPainter *p, QListViewItem *parent, | 1314 | QRect KListView::drawDropVisualizer(QPainter *p, Q3ListViewItem *parent, |
1300 | QListViewItem *after) | 1315 | Q3ListViewItem *after) |
1301 | { | 1316 | { |
1302 | QRect insertmarker; | 1317 | QRect insertmarker; |
1303 | 1318 | ||
1304 | if (!after && !parent) | 1319 | if (!after && !parent) |
1305 | insertmarker = QRect (0, 0, viewport()->width(), d->mDropVisualizerWidth/2); | 1320 | insertmarker = QRect (0, 0, viewport()->width(), d->mDropVisualizerWidth/2); |
1306 | else | 1321 | else |
1307 | { | 1322 | { |
1308 | int level = 0; | 1323 | int level = 0; |
1309 | if (after) | 1324 | if (after) |
1310 | { | 1325 | { |
1311 | QListViewItem* it = 0L; | 1326 | Q3ListViewItem* it = 0L; |
1312 | if (after->isOpen()) | 1327 | if (after->isOpen()) |
1313 | { | 1328 | { |
1314 | // Look for the last child (recursively) | 1329 | // Look for the last child (recursively) |
1315 | it = after->firstChild(); | 1330 | it = after->firstChild(); |
1316 | if (it) | 1331 | if (it) |
1317 | while (it->nextSibling() || it->firstChild()) | 1332 | while (it->nextSibling() || it->firstChild()) |
1318 | if ( it->nextSibling() ) | 1333 | if ( it->nextSibling() ) |
1319 | it = it->nextSibling(); | 1334 | it = it->nextSibling(); |
@@ -1333,22 +1348,22 @@ QRect KListView::drawDropVisualizer(QPainter *p, QListViewItem *parent, | |||
1333 | insertmarker.setRight (viewport()->width()); | 1348 | insertmarker.setRight (viewport()->width()); |
1334 | insertmarker.setTop (insertmarker.bottom() - d->mDropVisualizerWidth/2 + 1); | 1349 | insertmarker.setTop (insertmarker.bottom() - d->mDropVisualizerWidth/2 + 1); |
1335 | insertmarker.setBottom (insertmarker.bottom() + d->mDropVisualizerWidth/2); | 1350 | insertmarker.setBottom (insertmarker.bottom() + d->mDropVisualizerWidth/2); |
1336 | } | 1351 | } |
1337 | 1352 | ||
1338 | // This is not used anymore, at least by KListView itself (see viewportPaintEvent) | 1353 | // This is not used anymore, at least by KListView itself (see viewportPaintEvent) |
1339 | // Remove for KDE 3.0. | 1354 | // Remove for KDE 3.0. |
1340 | if (p) | 1355 | if (p) |
1341 | p->fillRect(insertmarker, Dense4Pattern); | 1356 | p->fillRect(insertmarker, Qt::Dense4Pattern); |
1342 | 1357 | ||
1343 | return insertmarker; | 1358 | return insertmarker; |
1344 | } | 1359 | } |
1345 | 1360 | ||
1346 | QRect KListView::drawItemHighlighter(QPainter *painter, QListViewItem *item) | 1361 | QRect KListView::drawItemHighlighter(QPainter *painter, Q3ListViewItem *item) |
1347 | { | 1362 | { |
1348 | QRect r; | 1363 | QRect r; |
1349 | 1364 | ||
1350 | if (item) | 1365 | if (item) |
1351 | { | 1366 | { |
1352 | r = itemRect(item); | 1367 | r = itemRect(item); |
1353 | r.setLeft(r.left()+(item->depth()+1)*treeStepSize()); | 1368 | r.setLeft(r.left()+(item->depth()+1)*treeStepSize()); |
1354 | if (painter) { | 1369 | if (painter) { |
@@ -1371,17 +1386,17 @@ void KListView::cleanItemHighlighter () | |||
1371 | if (d->mOldDropHighlighter.isValid()) | 1386 | if (d->mOldDropHighlighter.isValid()) |
1372 | { | 1387 | { |
1373 | QRect rect=d->mOldDropHighlighter; | 1388 | QRect rect=d->mOldDropHighlighter; |
1374 | d->mOldDropHighlighter = QRect(); | 1389 | d->mOldDropHighlighter = QRect(); |
1375 | viewport()->repaint(rect, true); | 1390 | viewport()->repaint(rect, true); |
1376 | } | 1391 | } |
1377 | } | 1392 | } |
1378 | 1393 | ||
1379 | void KListView::rename(QListViewItem *item, int c) | 1394 | void KListView::rename(Q3ListViewItem *item, int c) |
1380 | { | 1395 | { |
1381 | if (d->renameable.contains(c)) | 1396 | if (d->renameable.contains(c)) |
1382 | { | 1397 | { |
1383 | ensureItemVisible(item); | 1398 | ensureItemVisible(item); |
1384 | //US d->editor->load(item,c); | 1399 | //US d->editor->load(item,c); |
1385 | qDebug("KListView::rename has to be verified"); | 1400 | qDebug("KListView::rename has to be verified"); |
1386 | 1401 | ||
1387 | } | 1402 | } |
@@ -1398,17 +1413,17 @@ void KListView::setRenameable (int col, bool yesno) | |||
1398 | 1413 | ||
1399 | d->renameable.remove(col); | 1414 | d->renameable.remove(col); |
1400 | if (yesno && d->renameable.find(col)==d->renameable.end()) | 1415 | if (yesno && d->renameable.find(col)==d->renameable.end()) |
1401 | d->renameable+=col; | 1416 | d->renameable+=col; |
1402 | else if (!yesno && d->renameable.find(col)!=d->renameable.end()) | 1417 | else if (!yesno && d->renameable.find(col)!=d->renameable.end()) |
1403 | d->renameable.remove(col); | 1418 | d->renameable.remove(col); |
1404 | } | 1419 | } |
1405 | 1420 | ||
1406 | void KListView::doneEditing(QListViewItem *item, int row) | 1421 | void KListView::doneEditing(Q3ListViewItem *item, int row) |
1407 | { | 1422 | { |
1408 | emit itemRenamed(item, item->text(row), row); | 1423 | emit itemRenamed(item, item->text(row), row); |
1409 | emit itemRenamed(item); | 1424 | emit itemRenamed(item); |
1410 | } | 1425 | } |
1411 | 1426 | ||
1412 | bool KListView::acceptDrag(QDropEvent* e) const | 1427 | bool KListView::acceptDrag(QDropEvent* e) const |
1413 | { | 1428 | { |
1414 | qDebug("KListView::acceptDrag drag&drop not supported yet"); | 1429 | qDebug("KListView::acceptDrag drag&drop not supported yet"); |
@@ -1442,22 +1457,22 @@ void KListView::setDropHighlighter(bool b) | |||
1442 | d->dropHighlighter=b; | 1457 | d->dropHighlighter=b; |
1443 | } | 1458 | } |
1444 | 1459 | ||
1445 | bool KListView::dropHighlighter() const | 1460 | bool KListView::dropHighlighter() const |
1446 | { | 1461 | { |
1447 | return d->dropHighlighter; | 1462 | return d->dropHighlighter; |
1448 | } | 1463 | } |
1449 | 1464 | ||
1450 | bool KListView::showTooltip(QListViewItem *item, const QPoint &, int column) const | 1465 | bool KListView::showTooltip(Q3ListViewItem *item, const QPoint &, int column) const |
1451 | { | 1466 | { |
1452 | return ((tooltip(item, column).length()>0) && (column==tooltipColumn())); | 1467 | return ((tooltip(item, column).length()>0) && (column==tooltipColumn())); |
1453 | } | 1468 | } |
1454 | 1469 | ||
1455 | QString KListView::tooltip(QListViewItem *item, int column) const | 1470 | QString KListView::tooltip(Q3ListViewItem *item, int column) const |
1456 | { | 1471 | { |
1457 | return item->text(column); | 1472 | return item->text(column); |
1458 | } | 1473 | } |
1459 | 1474 | ||
1460 | void KListView::setTabOrderedRenaming(bool b) | 1475 | void KListView::setTabOrderedRenaming(bool b) |
1461 | { | 1476 | { |
1462 | d->tabRename = b; | 1477 | d->tabRename = b; |
1463 | } | 1478 | } |
@@ -1477,17 +1492,17 @@ void KListView::keyPressEvent (QKeyEvent* e) | |||
1477 | } | 1492 | } |
1478 | if (e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace) | 1493 | if (e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace) |
1479 | { | 1494 | { |
1480 | emit signalDelete ( ); | 1495 | emit signalDelete ( ); |
1481 | return; | 1496 | return; |
1482 | } | 1497 | } |
1483 | 1498 | ||
1484 | if (d->selectionMode != FileManager) | 1499 | if (d->selectionMode != FileManager) |
1485 | QListView::keyPressEvent (e); | 1500 | Q3ListView::keyPressEvent (e); |
1486 | else | 1501 | else |
1487 | fileManagerKeyPressEvent (e); | 1502 | fileManagerKeyPressEvent (e); |
1488 | } | 1503 | } |
1489 | 1504 | ||
1490 | void KListView::activateAutomaticSelection() | 1505 | void KListView::activateAutomaticSelection() |
1491 | { | 1506 | { |
1492 | d->selectedBySimpleMove=true; | 1507 | d->selectedBySimpleMove=true; |
1493 | d->selectedUsingMouse=false; | 1508 | d->selectedUsingMouse=false; |
@@ -1508,80 +1523,80 @@ void KListView::deactivateAutomaticSelection() | |||
1508 | bool KListView::automaticSelection() const | 1523 | bool KListView::automaticSelection() const |
1509 | { | 1524 | { |
1510 | return d->selectedBySimpleMove; | 1525 | return d->selectedBySimpleMove; |
1511 | } | 1526 | } |
1512 | 1527 | ||
1513 | void KListView::fileManagerKeyPressEvent (QKeyEvent* e) | 1528 | void KListView::fileManagerKeyPressEvent (QKeyEvent* e) |
1514 | { | 1529 | { |
1515 | //don't care whether it's on the keypad or not | 1530 | //don't care whether it's on the keypad or not |
1516 | int e_state=(e->state() & ~Keypad); | 1531 | int e_state=(e->state() & ~Qt::Keypad); |
1517 | 1532 | ||
1518 | int oldSelectionDirection(d->selectionDirection); | 1533 | int oldSelectionDirection(d->selectionDirection); |
1519 | 1534 | ||
1520 | if ((e->key()!=Key_Shift) && (e->key()!=Key_Control) | 1535 | if ((e->key()!=Qt::Key_Shift) && (e->key()!=Qt::Key_Control) |
1521 | && (e->key()!=Key_Meta) && (e->key()!=Key_Alt)) | 1536 | && (e->key()!=Qt::Key_Meta) && (e->key()!=Qt::Key_Alt)) |
1522 | { | 1537 | { |
1523 | if ((e_state==ShiftButton) && (!d->wasShiftEvent) && (!d->selectedBySimpleMove)) | 1538 | if ((e_state==Qt::ShiftButton) && (!d->wasShiftEvent) && (!d->selectedBySimpleMove)) |
1524 | selectAll(FALSE); | 1539 | selectAll(FALSE); |
1525 | d->selectionDirection=0; | 1540 | d->selectionDirection=0; |
1526 | d->wasShiftEvent = (e_state == ShiftButton); | 1541 | d->wasShiftEvent = (e_state == Qt::ShiftButton); |
1527 | }; | 1542 | }; |
1528 | 1543 | ||
1529 | //d->wasShiftEvent = (e_state == ShiftButton); | 1544 | //d->wasShiftEvent = (e_state == Qt::ShiftButton); |
1530 | 1545 | ||
1531 | 1546 | ||
1532 | QListViewItem* item = currentItem(); | 1547 | Q3ListViewItem* item = currentItem(); |
1533 | if (item==0) return; | 1548 | if (item==0) return; |
1534 | 1549 | ||
1535 | QListViewItem* repaintItem1 = item; | 1550 | Q3ListViewItem* repaintItem1 = item; |
1536 | QListViewItem* repaintItem2 = 0L; | 1551 | Q3ListViewItem* repaintItem2 = 0L; |
1537 | QListViewItem* visItem = 0L; | 1552 | Q3ListViewItem* visItem = 0L; |
1538 | 1553 | ||
1539 | QListViewItem* nextItem = 0L; | 1554 | Q3ListViewItem* nextItem = 0L; |
1540 | int items = 0; | 1555 | int items = 0; |
1541 | 1556 | ||
1542 | bool shiftOrCtrl((e_state==ControlButton) || (e_state==ShiftButton)); | 1557 | bool shiftOrCtrl((e_state==Qt::ControlButton) || (e_state==Qt::ShiftButton)); |
1543 | int selectedItems(0); | 1558 | int selectedItems(0); |
1544 | for (QListViewItem *tmpItem=firstChild(); tmpItem!=0; tmpItem=tmpItem->nextSibling()) | 1559 | for (Q3ListViewItem *tmpItem=firstChild(); tmpItem!=0; tmpItem=tmpItem->nextSibling()) |
1545 | if (tmpItem->isSelected()) selectedItems++; | 1560 | if (tmpItem->isSelected()) selectedItems++; |
1546 | 1561 | ||
1547 | if (((selectedItems==0) || ((selectedItems==1) && (d->selectedUsingMouse))) | 1562 | if (((selectedItems==0) || ((selectedItems==1) && (d->selectedUsingMouse))) |
1548 | && (e_state==NoButton) | 1563 | && (e_state==Qt::NoButton) |
1549 | && ((e->key()==Key_Down) | 1564 | && ((e->key()==Qt::Key_Down) |
1550 | || (e->key()==Key_Up) | 1565 | || (e->key()==Qt::Key_Up) |
1551 | || (e->key()==Key_Next) | 1566 | || (e->key()==Qt::Key_Next) |
1552 | || (e->key()==Key_Prior) | 1567 | || (e->key()==Qt::Key_Prior) |
1553 | || (e->key()==Key_Home) | 1568 | || (e->key()==Qt::Key_Home) |
1554 | || (e->key()==Key_End))) | 1569 | || (e->key()==Qt::Key_End))) |
1555 | { | 1570 | { |
1556 | d->selectedBySimpleMove=true; | 1571 | d->selectedBySimpleMove=true; |
1557 | d->selectedUsingMouse=false; | 1572 | d->selectedUsingMouse=false; |
1558 | } | 1573 | } |
1559 | else if (selectedItems>1) | 1574 | else if (selectedItems>1) |
1560 | d->selectedBySimpleMove=false; | 1575 | d->selectedBySimpleMove=false; |
1561 | 1576 | ||
1562 | bool emitSelectionChanged(false); | 1577 | bool emitSelectionChanged(false); |
1563 | 1578 | ||
1564 | switch (e->key()) | 1579 | switch (e->key()) |
1565 | { | 1580 | { |
1566 | case Key_Escape: | 1581 | case Qt::Key_Escape: |
1567 | selectAll(FALSE); | 1582 | selectAll(FALSE); |
1568 | emitSelectionChanged=TRUE; | 1583 | emitSelectionChanged=TRUE; |
1569 | break; | 1584 | break; |
1570 | 1585 | ||
1571 | case Key_Space: | 1586 | case Qt::Key_Space: |
1572 | //toggle selection of current item | 1587 | //toggle selection of current item |
1573 | if (d->selectedBySimpleMove) | 1588 | if (d->selectedBySimpleMove) |
1574 | d->selectedBySimpleMove=false; | 1589 | d->selectedBySimpleMove=false; |
1575 | item->setSelected(!item->isSelected()); | 1590 | item->setSelected(!item->isSelected()); |
1576 | emitSelectionChanged=TRUE; | 1591 | emitSelectionChanged=TRUE; |
1577 | break; | 1592 | break; |
1578 | 1593 | ||
1579 | case Key_Insert: | 1594 | case Qt::Key_Insert: |
1580 | //toggle selection of current item and move to the next item | 1595 | //toggle selection of current item and move to the next item |
1581 | if (d->selectedBySimpleMove) | 1596 | if (d->selectedBySimpleMove) |
1582 | { | 1597 | { |
1583 | d->selectedBySimpleMove=false; | 1598 | d->selectedBySimpleMove=false; |
1584 | if (!item->isSelected()) item->setSelected(TRUE); | 1599 | if (!item->isSelected()) item->setSelected(TRUE); |
1585 | } | 1600 | } |
1586 | else | 1601 | else |
1587 | { | 1602 | { |
@@ -1595,17 +1610,17 @@ void KListView::fileManagerKeyPressEvent (QKeyEvent* e) | |||
1595 | repaintItem2=nextItem; | 1610 | repaintItem2=nextItem; |
1596 | visItem=nextItem; | 1611 | visItem=nextItem; |
1597 | setCurrentItem(nextItem); | 1612 | setCurrentItem(nextItem); |
1598 | }; | 1613 | }; |
1599 | d->selectionDirection=1; | 1614 | d->selectionDirection=1; |
1600 | emitSelectionChanged=TRUE; | 1615 | emitSelectionChanged=TRUE; |
1601 | break; | 1616 | break; |
1602 | 1617 | ||
1603 | case Key_Down: | 1618 | case Qt::Key_Down: |
1604 | nextItem=item->itemBelow(); | 1619 | nextItem=item->itemBelow(); |
1605 | //toggle selection of current item and move to the next item | 1620 | //toggle selection of current item and move to the next item |
1606 | if (shiftOrCtrl) | 1621 | if (shiftOrCtrl) |
1607 | { | 1622 | { |
1608 | d->selectionDirection=1; | 1623 | d->selectionDirection=1; |
1609 | if (d->selectedBySimpleMove) | 1624 | if (d->selectedBySimpleMove) |
1610 | d->selectedBySimpleMove=false; | 1625 | d->selectedBySimpleMove=false; |
1611 | else | 1626 | else |
@@ -1628,17 +1643,17 @@ void KListView::fileManagerKeyPressEvent (QKeyEvent* e) | |||
1628 | if (d->selectedBySimpleMove) | 1643 | if (d->selectedBySimpleMove) |
1629 | nextItem->setSelected(true); | 1644 | nextItem->setSelected(true); |
1630 | repaintItem2=nextItem; | 1645 | repaintItem2=nextItem; |
1631 | visItem=nextItem; | 1646 | visItem=nextItem; |
1632 | setCurrentItem(nextItem); | 1647 | setCurrentItem(nextItem); |
1633 | }; | 1648 | }; |
1634 | break; | 1649 | break; |
1635 | 1650 | ||
1636 | case Key_Up: | 1651 | case Qt::Key_Up: |
1637 | nextItem=item->itemAbove(); | 1652 | nextItem=item->itemAbove(); |
1638 | d->selectionDirection=-1; | 1653 | d->selectionDirection=-1; |
1639 | //move to the prev. item and toggle selection of this one | 1654 | //move to the prev. item and toggle selection of this one |
1640 | // => No, can't select the last item, with this. For symmetry, let's | 1655 | // => No, can't select the last item, with this. For symmetry, let's |
1641 | // toggle selection and THEN move up, just like we do in down (David) | 1656 | // toggle selection and THEN move up, just like we do in down (David) |
1642 | if (shiftOrCtrl) | 1657 | if (shiftOrCtrl) |
1643 | { | 1658 | { |
1644 | if (d->selectedBySimpleMove) | 1659 | if (d->selectedBySimpleMove) |
@@ -1663,17 +1678,17 @@ void KListView::fileManagerKeyPressEvent (QKeyEvent* e) | |||
1663 | if (d->selectedBySimpleMove) | 1678 | if (d->selectedBySimpleMove) |
1664 | nextItem->setSelected(true); | 1679 | nextItem->setSelected(true); |
1665 | repaintItem2=nextItem; | 1680 | repaintItem2=nextItem; |
1666 | visItem=nextItem; | 1681 | visItem=nextItem; |
1667 | setCurrentItem(nextItem); | 1682 | setCurrentItem(nextItem); |
1668 | }; | 1683 | }; |
1669 | break; | 1684 | break; |
1670 | 1685 | ||
1671 | case Key_End: | 1686 | case Qt::Key_End: |
1672 | //move to the last item and toggle selection of all items inbetween | 1687 | //move to the last item and toggle selection of all items inbetween |
1673 | nextItem=item; | 1688 | nextItem=item; |
1674 | if (d->selectedBySimpleMove) | 1689 | if (d->selectedBySimpleMove) |
1675 | item->setSelected(false); | 1690 | item->setSelected(false); |
1676 | if (shiftOrCtrl) | 1691 | if (shiftOrCtrl) |
1677 | d->selectedBySimpleMove=false; | 1692 | d->selectedBySimpleMove=false; |
1678 | 1693 | ||
1679 | while(nextItem!=0) | 1694 | while(nextItem!=0) |
@@ -1688,17 +1703,17 @@ void KListView::fileManagerKeyPressEvent (QKeyEvent* e) | |||
1688 | visItem=nextItem; | 1703 | visItem=nextItem; |
1689 | setCurrentItem(nextItem); | 1704 | setCurrentItem(nextItem); |
1690 | } | 1705 | } |
1691 | nextItem=nextItem->itemBelow(); | 1706 | nextItem=nextItem->itemBelow(); |
1692 | } | 1707 | } |
1693 | emitSelectionChanged=TRUE; | 1708 | emitSelectionChanged=TRUE; |
1694 | break; | 1709 | break; |
1695 | 1710 | ||
1696 | case Key_Home: | 1711 | case Qt::Key_Home: |
1697 | // move to the first item and toggle selection of all items inbetween | 1712 | // move to the first item and toggle selection of all items inbetween |
1698 | nextItem = firstChild(); | 1713 | nextItem = firstChild(); |
1699 | visItem = nextItem; | 1714 | visItem = nextItem; |
1700 | repaintItem2 = visItem; | 1715 | repaintItem2 = visItem; |
1701 | if (d->selectedBySimpleMove) | 1716 | if (d->selectedBySimpleMove) |
1702 | item->setSelected(false); | 1717 | item->setSelected(false); |
1703 | if (shiftOrCtrl) | 1718 | if (shiftOrCtrl) |
1704 | { | 1719 | { |
@@ -1710,17 +1725,17 @@ void KListView::fileManagerKeyPressEvent (QKeyEvent* e) | |||
1710 | nextItem = nextItem->itemBelow(); | 1725 | nextItem = nextItem->itemBelow(); |
1711 | } | 1726 | } |
1712 | item->setSelected( !item->isSelected() ); | 1727 | item->setSelected( !item->isSelected() ); |
1713 | } | 1728 | } |
1714 | setCurrentItem( firstChild() ); | 1729 | setCurrentItem( firstChild() ); |
1715 | emitSelectionChanged=TRUE; | 1730 | emitSelectionChanged=TRUE; |
1716 | break; | 1731 | break; |
1717 | 1732 | ||
1718 | case Key_Next: | 1733 | case Qt::Key_Next: |
1719 | items=visibleHeight()/item->height(); | 1734 | items=visibleHeight()/item->height(); |
1720 | nextItem=item; | 1735 | nextItem=item; |
1721 | if (d->selectedBySimpleMove) | 1736 | if (d->selectedBySimpleMove) |
1722 | item->setSelected(false); | 1737 | item->setSelected(false); |
1723 | if (shiftOrCtrl) | 1738 | if (shiftOrCtrl) |
1724 | { | 1739 | { |
1725 | d->selectedBySimpleMove=false; | 1740 | d->selectedBySimpleMove=false; |
1726 | d->selectionDirection=1; | 1741 | d->selectionDirection=1; |
@@ -1746,17 +1761,17 @@ void KListView::fileManagerKeyPressEvent (QKeyEvent* e) | |||
1746 | emit selectionChanged(); | 1761 | emit selectionChanged(); |
1747 | } | 1762 | } |
1748 | return; | 1763 | return; |
1749 | } | 1764 | } |
1750 | nextItem=nextItem->itemBelow(); | 1765 | nextItem=nextItem->itemBelow(); |
1751 | } | 1766 | } |
1752 | break; | 1767 | break; |
1753 | 1768 | ||
1754 | case Key_Prior: | 1769 | case Qt::Key_Prior: |
1755 | items=visibleHeight()/item->height(); | 1770 | items=visibleHeight()/item->height(); |
1756 | nextItem=item; | 1771 | nextItem=item; |
1757 | if (d->selectedBySimpleMove) | 1772 | if (d->selectedBySimpleMove) |
1758 | item->setSelected(false); | 1773 | item->setSelected(false); |
1759 | if (shiftOrCtrl) | 1774 | if (shiftOrCtrl) |
1760 | { | 1775 | { |
1761 | d->selectionDirection=-1; | 1776 | d->selectionDirection=-1; |
1762 | d->selectedBySimpleMove=false; | 1777 | d->selectedBySimpleMove=false; |
@@ -1780,35 +1795,35 @@ void KListView::fileManagerKeyPressEvent (QKeyEvent* e) | |||
1780 | emit selectionChanged(); | 1795 | emit selectionChanged(); |
1781 | } | 1796 | } |
1782 | return; | 1797 | return; |
1783 | } | 1798 | } |
1784 | nextItem=nextItem->itemAbove(); | 1799 | nextItem=nextItem->itemAbove(); |
1785 | } | 1800 | } |
1786 | break; | 1801 | break; |
1787 | 1802 | ||
1788 | case Key_Minus: | 1803 | case Qt::Key_Minus: |
1789 | if ( item->isOpen() ) | 1804 | if ( item->isOpen() ) |
1790 | setOpen( item, FALSE ); | 1805 | setOpen( item, FALSE ); |
1791 | break; | 1806 | break; |
1792 | case Key_Plus: | 1807 | case Qt::Key_Plus: |
1793 | if ( !item->isOpen() && (item->isExpandable() || item->childCount()) ) | 1808 | if ( !item->isOpen() && (item->isExpandable() || item->childCount()) ) |
1794 | setOpen( item, TRUE ); | 1809 | setOpen( item, TRUE ); |
1795 | break; | 1810 | break; |
1796 | default: | 1811 | default: |
1797 | bool realKey = ((e->key()!=Key_Shift) && (e->key()!=Key_Control) | 1812 | bool realKey = ((e->key()!=Qt::Key_Shift) && (e->key()!=Qt::Key_Control) |
1798 | && (e->key()!=Key_Meta) && (e->key()!=Key_Alt)); | 1813 | && (e->key()!=Qt::Key_Meta) && (e->key()!=Qt::Key_Alt)); |
1799 | 1814 | ||
1800 | bool selectCurrentItem = (d->selectedBySimpleMove) && (item->isSelected()); | 1815 | bool selectCurrentItem = (d->selectedBySimpleMove) && (item->isSelected()); |
1801 | if (realKey && selectCurrentItem) | 1816 | if (realKey && selectCurrentItem) |
1802 | item->setSelected(false); | 1817 | item->setSelected(false); |
1803 | //this is mainly for the "goto filename beginning with pressed char" feature (aleXXX) | 1818 | //this is mainly for the "goto filename beginning with pressed char" feature (aleXXX) |
1804 | QListView::SelectionMode oldSelectionMode = selectionMode(); | 1819 | Q3ListView::SelectionMode oldSelectionMode = selectionMode(); |
1805 | setSelectionMode (QListView::Multi); | 1820 | setSelectionMode (Q3ListView::Multi); |
1806 | QListView::keyPressEvent (e); | 1821 | Q3ListView::keyPressEvent (e); |
1807 | setSelectionMode (oldSelectionMode); | 1822 | setSelectionMode (oldSelectionMode); |
1808 | if (realKey && selectCurrentItem) | 1823 | if (realKey && selectCurrentItem) |
1809 | { | 1824 | { |
1810 | currentItem()->setSelected(true); | 1825 | currentItem()->setSelected(true); |
1811 | emitSelectionChanged=TRUE; | 1826 | emitSelectionChanged=TRUE; |
1812 | } | 1827 | } |
1813 | repaintItem2=currentItem(); | 1828 | repaintItem2=currentItem(); |
1814 | if (realKey) | 1829 | if (realKey) |
@@ -1845,119 +1860,119 @@ void KListView::setSelectionModeExt (SelectionModeExt mode) | |||
1845 | d->selectionMode = mode; | 1860 | d->selectionMode = mode; |
1846 | 1861 | ||
1847 | switch (mode) | 1862 | switch (mode) |
1848 | { | 1863 | { |
1849 | case Single: | 1864 | case Single: |
1850 | case Multi: | 1865 | case Multi: |
1851 | case Extended: | 1866 | case Extended: |
1852 | case NoSelection: | 1867 | case NoSelection: |
1853 | setSelectionMode (static_cast<QListView::SelectionMode>(static_cast<int>(mode))); | 1868 | setSelectionMode (static_cast<Q3ListView::SelectionMode>(static_cast<int>(mode))); |
1854 | break; | 1869 | break; |
1855 | 1870 | ||
1856 | case FileManager: | 1871 | case FileManager: |
1857 | setSelectionMode (QListView::Extended); | 1872 | setSelectionMode (Q3ListView::Extended); |
1858 | break; | 1873 | break; |
1859 | 1874 | ||
1860 | default: | 1875 | default: |
1861 | kdWarning () << "Warning: illegal selection mode " << int(mode) << " set!" << endl; | 1876 | kdWarning () << "Warning: illegal selection mode " << int(mode) << " set!" << endl; |
1862 | break; | 1877 | break; |
1863 | } | 1878 | } |
1864 | } | 1879 | } |
1865 | 1880 | ||
1866 | KListView::SelectionModeExt KListView::selectionModeExt () const | 1881 | KListView::SelectionModeExt KListView::selectionModeExt () const |
1867 | { | 1882 | { |
1868 | return d->selectionMode; | 1883 | return d->selectionMode; |
1869 | } | 1884 | } |
1870 | 1885 | ||
1871 | int KListView::itemIndex( const QListViewItem *item ) const | 1886 | int KListView::itemIndex( const Q3ListViewItem *item ) const |
1872 | { | 1887 | { |
1873 | if ( !item ) | 1888 | if ( !item ) |
1874 | return -1; | 1889 | return -1; |
1875 | 1890 | ||
1876 | if ( item == firstChild() ) | 1891 | if ( item == firstChild() ) |
1877 | return 0; | 1892 | return 0; |
1878 | else { | 1893 | else { |
1879 | QListViewItemIterator it(firstChild()); | 1894 | Q3ListViewItemIterator it(firstChild()); |
1880 | uint j = 0; | 1895 | uint j = 0; |
1881 | for (; it.current() && it.current() != item; ++it, ++j ); | 1896 | for (; it.current() && it.current() != item; ++it, ++j ); |
1882 | 1897 | ||
1883 | if( !it.current() ) | 1898 | if( !it.current() ) |
1884 | return -1; | 1899 | return -1; |
1885 | 1900 | ||
1886 | return j; | 1901 | return j; |
1887 | } | 1902 | } |
1888 | } | 1903 | } |
1889 | 1904 | ||
1890 | QListViewItem* KListView::itemAtIndex(int index) | 1905 | Q3ListViewItem* KListView::itemAtIndex(int index) |
1891 | { | 1906 | { |
1892 | if (index<0) | 1907 | if (index<0) |
1893 | return 0; | 1908 | return 0; |
1894 | 1909 | ||
1895 | int j(0); | 1910 | int j(0); |
1896 | for (QListViewItemIterator it=firstChild(); it.current(); it++) | 1911 | for (Q3ListViewItemIterator it=firstChild(); it.current(); it++) |
1897 | { | 1912 | { |
1898 | if (j==index) | 1913 | if (j==index) |
1899 | return it.current(); | 1914 | return it.current(); |
1900 | j++; | 1915 | j++; |
1901 | }; | 1916 | }; |
1902 | return 0; | 1917 | return 0; |
1903 | } | 1918 | } |
1904 | 1919 | ||
1905 | 1920 | ||
1906 | void KListView::emitContextMenu (KListView*, QListViewItem* i) | 1921 | void KListView::emitContextMenu (KListView*, Q3ListViewItem* i) |
1907 | { | 1922 | { |
1908 | QPoint p; | 1923 | QPoint p; |
1909 | // qDebug("KListView::emitContextMenu "); | 1924 | // qDebug("KListView::emitContextMenu "); |
1910 | 1925 | ||
1911 | if (i) | 1926 | if (i) |
1912 | p = viewport()->mapToGlobal(itemRect(i).center()); | 1927 | p = viewport()->mapToGlobal(itemRect(i).center()); |
1913 | else | 1928 | else |
1914 | p = mapToGlobal(rect().center()); | 1929 | p = mapToGlobal(rect().center()); |
1915 | 1930 | ||
1916 | emit contextMenu (this, i, p); | 1931 | emit contextMenu (this, i, p); |
1917 | } | 1932 | } |
1918 | 1933 | ||
1919 | void KListView::emitContextMenu (QListViewItem* i, const QPoint& p, int col) | 1934 | void KListView::emitContextMenu (Q3ListViewItem* i, const QPoint& p, int col) |
1920 | { | 1935 | { |
1921 | QListViewItem* item = i; | 1936 | Q3ListViewItem* item = i; |
1922 | int c = col; | 1937 | int c = col; |
1923 | // do not trust the values for QListViewItem* i and int col; | 1938 | // do not trust the values for QListViewItem* i and int col; |
1924 | // qDebug("KListView::emitContextMenu col"); | 1939 | // qDebug("KListView::emitContextMenu col"); |
1925 | if ( col == -1 ) { | 1940 | if ( col == -1 ) { |
1926 | QPoint pp = viewport()->mapFromGlobal(p); | 1941 | QPoint pp = viewport()->mapFromGlobal(p); |
1927 | item = itemAt( pp); | 1942 | item = itemAt( pp); |
1928 | c = header()->sectionAt(pp.x() ); | 1943 | c = header()->sectionAt(pp.x() ); |
1929 | } | 1944 | } |
1930 | emit contextRequest( item, p, c ); | 1945 | emit contextRequest( item, p, c ); |
1931 | emit contextMenu (this, item, p); | 1946 | emit contextMenu (this, item, p); |
1932 | } | 1947 | } |
1933 | 1948 | ||
1934 | void KListView::setAcceptDrops (bool val) | 1949 | void KListView::setAcceptDrops (bool val) |
1935 | { | 1950 | { |
1936 | QListView::setAcceptDrops (val); | 1951 | Q3ListView::setAcceptDrops (val); |
1937 | viewport()->setAcceptDrops (val); | 1952 | viewport()->setAcceptDrops (val); |
1938 | } | 1953 | } |
1939 | 1954 | ||
1940 | int KListView::dropVisualizerWidth () const | 1955 | int KListView::dropVisualizerWidth () const |
1941 | { | 1956 | { |
1942 | return d->mDropVisualizerWidth; | 1957 | return d->mDropVisualizerWidth; |
1943 | } | 1958 | } |
1944 | 1959 | ||
1945 | 1960 | ||
1946 | void KListView::viewportPaintEvent(QPaintEvent *e) | 1961 | void KListView::viewportPaintEvent(QPaintEvent *e) |
1947 | { | 1962 | { |
1948 | QListView::viewportPaintEvent(e); | 1963 | Q3ListView::viewportPaintEvent(e); |
1949 | 1964 | ||
1950 | if (d->mOldDropVisualizer.isValid() && e->rect().intersects(d->mOldDropVisualizer)) | 1965 | if (d->mOldDropVisualizer.isValid() && e->rect().intersects(d->mOldDropVisualizer)) |
1951 | { | 1966 | { |
1952 | QPainter painter(viewport()); | 1967 | QPainter painter(viewport()); |
1953 | 1968 | ||
1954 | // This is where we actually draw the drop-visualizer | 1969 | // This is where we actually draw the drop-visualizer |
1955 | painter.fillRect(d->mOldDropVisualizer, Dense4Pattern); | 1970 | painter.fillRect(d->mOldDropVisualizer, Qt::Dense4Pattern); |
1956 | } | 1971 | } |
1957 | if (d->mOldDropHighlighter.isValid() && e->rect().intersects(d->mOldDropHighlighter)) | 1972 | if (d->mOldDropHighlighter.isValid() && e->rect().intersects(d->mOldDropHighlighter)) |
1958 | { | 1973 | { |
1959 | QPainter painter(viewport()); | 1974 | QPainter painter(viewport()); |
1960 | 1975 | ||
1961 | qDebug("KListView::viewportPaintEvent has to be verified"); | 1976 | qDebug("KListView::viewportPaintEvent has to be verified"); |
1962 | 1977 | ||
1963 | // This is where we actually draw the drop-highlighter | 1978 | // This is where we actually draw the drop-highlighter |
@@ -1983,43 +1998,43 @@ void KListView::setFullWidth(bool fullWidth) | |||
1983 | 1998 | ||
1984 | bool KListView::fullWidth() const | 1999 | bool KListView::fullWidth() const |
1985 | { | 2000 | { |
1986 | return d->fullWidth; | 2001 | return d->fullWidth; |
1987 | } | 2002 | } |
1988 | 2003 | ||
1989 | int KListView::addColumn(const QString& label, int width) | 2004 | int KListView::addColumn(const QString& label, int width) |
1990 | { | 2005 | { |
1991 | int result = QListView::addColumn(label, width); | 2006 | int result = Q3ListView::addColumn(label, width); |
1992 | if (d->fullWidth) { | 2007 | if (d->fullWidth) { |
1993 | //US header()->setStretchEnabled(false, columns()-2); | 2008 | //US header()->setStretchEnabled(false, columns()-2); |
1994 | //US header()->setStretchEnabled(true, columns()-1); | 2009 | //US header()->setStretchEnabled(true, columns()-1); |
1995 | } | 2010 | } |
1996 | return result; | 2011 | return result; |
1997 | } | 2012 | } |
1998 | 2013 | ||
1999 | int KListView::addColumn(const QIconSet& iconset, const QString& label, int width) | 2014 | int KListView::addColumn(const QIcon& iconset, const QString& label, int width) |
2000 | { | 2015 | { |
2001 | int result = QListView::addColumn(iconset, label, width); | 2016 | int result = Q3ListView::addColumn(iconset, label, width); |
2002 | if (d->fullWidth) { | 2017 | if (d->fullWidth) { |
2003 | //US header()->setStretchEnabled(false, columns()-2); | 2018 | //US header()->setStretchEnabled(false, columns()-2); |
2004 | //US header()->setStretchEnabled(true, columns()-1); | 2019 | //US header()->setStretchEnabled(true, columns()-1); |
2005 | } | 2020 | } |
2006 | return result; | 2021 | return result; |
2007 | } | 2022 | } |
2008 | 2023 | ||
2009 | void KListView::removeColumn(int index) | 2024 | void KListView::removeColumn(int index) |
2010 | { | 2025 | { |
2011 | QListView::removeColumn(index); | 2026 | Q3ListView::removeColumn(index); |
2012 | //US if (d->fullWidth && index == columns()) header()->setStretchEnabled(true, columns()-1); | 2027 | //US if (d->fullWidth && index == columns()) header()->setStretchEnabled(true, columns()-1); |
2013 | } | 2028 | } |
2014 | 2029 | ||
2015 | void KListView::viewportResizeEvent(QResizeEvent* e) | 2030 | void KListView::viewportResizeEvent(QResizeEvent* e) |
2016 | { | 2031 | { |
2017 | QListView::viewportResizeEvent(e); | 2032 | Q3ListView::viewportResizeEvent(e); |
2018 | } | 2033 | } |
2019 | 2034 | ||
2020 | const QColor &KListView::alternateBackground() const | 2035 | const QColor &KListView::alternateBackground() const |
2021 | { | 2036 | { |
2022 | return d->alternateBackground; | 2037 | return d->alternateBackground; |
2023 | } | 2038 | } |
2024 | 2039 | ||
2025 | void KListView::setAlternateBackground(const QColor &c) | 2040 | void KListView::setAlternateBackground(const QColor &c) |
@@ -2065,81 +2080,81 @@ void KListView::restoreLayout(KConfig *config, const QString &group) | |||
2065 | if (!langLst.isEmpty()) | 2080 | if (!langLst.isEmpty()) |
2066 | setSorting(config->readNumEntry("SortColumn"), config->readBoolEntry("SortAscending", true)); | 2081 | setSorting(config->readNumEntry("SortColumn"), config->readBoolEntry("SortAscending", true)); |
2067 | } | 2082 | } |
2068 | 2083 | ||
2069 | void KListView::setSorting(int column, bool ascending) | 2084 | void KListView::setSorting(int column, bool ascending) |
2070 | { | 2085 | { |
2071 | d->sortColumn = column; | 2086 | d->sortColumn = column; |
2072 | d->sortAscending = ascending; | 2087 | d->sortAscending = ascending; |
2073 | QListView::setSorting(column, ascending); | 2088 | Q3ListView::setSorting(column, ascending); |
2074 | } | 2089 | } |
2075 | 2090 | ||
2076 | int KListView::columnSorted(void) const | 2091 | int KListView::columnSorted(void) const |
2077 | { | 2092 | { |
2078 | return d->sortColumn; | 2093 | return d->sortColumn; |
2079 | } | 2094 | } |
2080 | 2095 | ||
2081 | bool KListView::ascendingSort(void) const | 2096 | bool KListView::ascendingSort(void) const |
2082 | { | 2097 | { |
2083 | return d->sortAscending; | 2098 | return d->sortAscending; |
2084 | } | 2099 | } |
2085 | 2100 | ||
2086 | KListViewItem::KListViewItem(QListView *parent) | 2101 | KListViewItem::KListViewItem(Q3ListView *parent) |
2087 | : QListViewItem(parent) | 2102 | : Q3ListViewItem(parent) |
2088 | { | 2103 | { |
2089 | init(); | 2104 | init(); |
2090 | } | 2105 | } |
2091 | 2106 | ||
2092 | KListViewItem::KListViewItem(QListViewItem *parent) | 2107 | KListViewItem::KListViewItem(Q3ListViewItem *parent) |
2093 | : QListViewItem(parent) | 2108 | : Q3ListViewItem(parent) |
2094 | { | 2109 | { |
2095 | init(); | 2110 | init(); |
2096 | } | 2111 | } |
2097 | 2112 | ||
2098 | KListViewItem::KListViewItem(QListView *parent, QListViewItem *after) | 2113 | KListViewItem::KListViewItem(Q3ListView *parent, Q3ListViewItem *after) |
2099 | : QListViewItem(parent, after) | 2114 | : Q3ListViewItem(parent, after) |
2100 | { | 2115 | { |
2101 | init(); | 2116 | init(); |
2102 | } | 2117 | } |
2103 | 2118 | ||
2104 | KListViewItem::KListViewItem(QListViewItem *parent, QListViewItem *after) | 2119 | KListViewItem::KListViewItem(Q3ListViewItem *parent, Q3ListViewItem *after) |
2105 | : QListViewItem(parent, after) | 2120 | : Q3ListViewItem(parent, after) |
2106 | { | 2121 | { |
2107 | init(); | 2122 | init(); |
2108 | } | 2123 | } |
2109 | 2124 | ||
2110 | KListViewItem::KListViewItem(QListView *parent, | 2125 | KListViewItem::KListViewItem(Q3ListView *parent, |
2111 | QString label1, QString label2, QString label3, QString label4, | 2126 | QString label1, QString label2, QString label3, QString label4, |
2112 | QString label5, QString label6, QString label7, QString label8) | 2127 | QString label5, QString label6, QString label7, QString label8) |
2113 | : QListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8) | 2128 | : Q3ListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8) |
2114 | { | 2129 | { |
2115 | init(); | 2130 | init(); |
2116 | } | 2131 | } |
2117 | 2132 | ||
2118 | KListViewItem::KListViewItem(QListViewItem *parent, | 2133 | KListViewItem::KListViewItem(Q3ListViewItem *parent, |
2119 | QString label1, QString label2, QString label3, QString label4, | 2134 | QString label1, QString label2, QString label3, QString label4, |
2120 | QString label5, QString label6, QString label7, QString label8) | 2135 | QString label5, QString label6, QString label7, QString label8) |
2121 | : QListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8) | 2136 | : Q3ListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8) |
2122 | { | 2137 | { |
2123 | init(); | 2138 | init(); |
2124 | } | 2139 | } |
2125 | 2140 | ||
2126 | KListViewItem::KListViewItem(QListView *parent, QListViewItem *after, | 2141 | KListViewItem::KListViewItem(Q3ListView *parent, Q3ListViewItem *after, |
2127 | QString label1, QString label2, QString label3, QString label4, | 2142 | QString label1, QString label2, QString label3, QString label4, |
2128 | QString label5, QString label6, QString label7, QString label8) | 2143 | QString label5, QString label6, QString label7, QString label8) |
2129 | : QListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8) | 2144 | : Q3ListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8) |
2130 | { | 2145 | { |
2131 | init(); | 2146 | init(); |
2132 | } | 2147 | } |
2133 | 2148 | ||
2134 | KListViewItem::KListViewItem(QListViewItem *parent, QListViewItem *after, | 2149 | KListViewItem::KListViewItem(Q3ListViewItem *parent, Q3ListViewItem *after, |
2135 | QString label1, QString label2, QString label3, QString label4, | 2150 | QString label1, QString label2, QString label3, QString label4, |
2136 | QString label5, QString label6, QString label7, QString label8) | 2151 | QString label5, QString label6, QString label7, QString label8) |
2137 | : QListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8) | 2152 | : Q3ListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8) |
2138 | { | 2153 | { |
2139 | init(); | 2154 | init(); |
2140 | } | 2155 | } |
2141 | 2156 | ||
2142 | KListViewItem::~KListViewItem() | 2157 | KListViewItem::~KListViewItem() |
2143 | { | 2158 | { |
2144 | } | 2159 | } |
2145 | 2160 | ||
@@ -2207,22 +2222,22 @@ void KListViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, in | |||
2207 | if (pm && !pm->isNull()) | 2222 | if (pm && !pm->isNull()) |
2208 | { | 2223 | { |
2209 | _cg.setBrush(QColorGroup::Base, QBrush(backgroundColor(), *pm)); | 2224 | _cg.setBrush(QColorGroup::Base, QBrush(backgroundColor(), *pm)); |
2210 | QPoint o = p->brushOrigin(); | 2225 | QPoint o = p->brushOrigin(); |
2211 | p->setBrushOrigin( o.x()-listView()->contentsX(), o.y()-listView()->contentsY() ); | 2226 | p->setBrushOrigin( o.x()-listView()->contentsX(), o.y()-listView()->contentsY() ); |
2212 | } | 2227 | } |
2213 | else if (isAlternate()) { | 2228 | else if (isAlternate()) { |
2214 | //US if (listView()->viewport()->backgroundMode()==Qt::FixedColor) | 2229 | //US if (listView()->viewport()->backgroundMode()==Qt::FixedColor) |
2215 | if (listView()->viewport()->backgroundMode()==QWidget::PaletteBackground) | 2230 | if (listView()->viewport()->backgroundMode()==Qt::PaletteBackground) |
2216 | _cg.setColor(QColorGroup::Background, static_cast< KListView* >(listView())->alternateBackground()); | 2231 | _cg.setColor(QColorGroup::Background, static_cast< KListView* >(listView())->alternateBackground()); |
2217 | else | 2232 | else |
2218 | _cg.setColor(QColorGroup::Base, static_cast< KListView* >(listView())->alternateBackground()); | 2233 | _cg.setColor(QColorGroup::Base, static_cast< KListView* >(listView())->alternateBackground()); |
2219 | } | 2234 | } |
2220 | QListViewItem::paintCell(p, _cg, column, width, alignment); | 2235 | Q3ListViewItem::paintCell(p, _cg, column, width, alignment); |
2221 | } | 2236 | } |
2222 | 2237 | ||
2223 | //US we do not have a "global KDE" variable to setup singleClick functionality | 2238 | //US we do not have a "global KDE" variable to setup singleClick functionality |
2224 | void KListView::setSingleClick(bool s) | 2239 | void KListView::setSingleClick(bool s) |
2225 | { | 2240 | { |
2226 | d->bUseSingle = s; | 2241 | d->bUseSingle = s; |
2227 | slotSettingsChanged(1); | 2242 | slotSettingsChanged(1); |
2228 | // qDebug("KListView::setSingleClick: single %i", d->bUseSingle); | 2243 | // qDebug("KListView::setSingleClick: single %i", d->bUseSingle); |