summaryrefslogtreecommitdiffabout
path: root/microkde/kdeui/klistview.h
Unidiff
Diffstat (limited to 'microkde/kdeui/klistview.h') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kdeui/klistview.h121
1 files changed, 66 insertions, 55 deletions
diff --git a/microkde/kdeui/klistview.h b/microkde/kdeui/klistview.h
index 9f0d9fd..2176525 100644
--- a/microkde/kdeui/klistview.h
+++ b/microkde/kdeui/klistview.h
@@ -11,35 +11,46 @@
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
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#ifndef KLISTVIEW_H 20#ifndef KLISTVIEW_H
21#define KLISTVIEW_H 21#define KLISTVIEW_H
22 22
23#include <qlistview.h> 23#include <q3listview.h>
24 24
25#include <qptrlist.h> 25#include <q3ptrlist.h>
26//Added by qt3to4:
27#include <QDragMoveEvent>
28#include <QDropEvent>
29#include <QDragLeaveEvent>
30#include <QPaintEvent>
31#include <QResizeEvent>
32#include <QFocusEvent>
33#include <QMouseEvent>
34#include <QKeyEvent>
35#include <QEvent>
36#include <QDragEnterEvent>
26 37
27//US 38//US
28class QDropEvent; 39class QDropEvent;
29class QDragLeaveEvent; 40class QDragLeaveEvent;
30class QDragMoveEvent; 41class QDragMoveEvent;
31class QDragEnterEvent; 42class QDragEnterEvent;
32 43
33class QDragObject; 44class Q3DragObject;
34class KConfig; 45class KConfig;
35class KLineEdit; 46class KLineEdit;
36/** 47/**
37 * This Widget extends the functionality of QListView to honor the system 48 * This Widget extends the functionality of QListView to honor the system
38 * wide settings for Single Click/Double Click mode, AutoSelection and 49 * wide settings for Single Click/Double Click mode, AutoSelection and
39 * ChangeCursorOverLink (TM). 50 * ChangeCursorOverLink (TM).
40 * 51 *
41 * There is a new signal executed(). It gets connected to either 52 * There is a new signal executed(). It gets connected to either
42 * @ref QListView::clicked() or @ref QListView::doubleClicked() depending on the KDE 53 * @ref QListView::clicked() or @ref QListView::doubleClicked() depending on the KDE
43 * wide Single Click/Double Click settings. It is strongly recommended that 54 * wide Single Click/Double Click settings. It is strongly recommended that
44 * you use this signal instead of the above mentioned. This way you dont 55 * you use this signal instead of the above mentioned. This way you dont
45 * need to care about the current settings. 56 * need to care about the current settings.
@@ -48,25 +59,25 @@ class KLineEdit;
48 * 59 *
49 * Drag-and-Drop is supported with the signal @ref #dropped(), just @ref #setAcceptDrops(true) 60 * Drag-and-Drop is supported with the signal @ref #dropped(), just @ref #setAcceptDrops(true)
50 * and connect it to a suitable slot. 61 * and connect it to a suitable slot.
51 * To see where you are dropping, @ref setDropVisualizer(true). 62 * To see where you are dropping, @ref setDropVisualizer(true).
52 * And also you'll need @ref acceptDrag(QDropEvent*) 63 * And also you'll need @ref acceptDrag(QDropEvent*)
53 * 64 *
54 * KListView is drag-enabled, too: to benefit from that you've got derive from it. 65 * KListView is drag-enabled, too: to benefit from that you've got derive from it.
55 * Reimplement @ref dragObject() and (possibly) @ref startDrag(), 66 * Reimplement @ref dragObject() and (possibly) @ref startDrag(),
56 * and @ref setDragEnabled(true). 67 * and @ref setDragEnabled(true).
57 * 68 *
58 * @version $Id$ 69 * @version $Id$
59 */ 70 */
60class KListView : public QListView 71class KListView : public Q3ListView
61{ 72{
62 Q_OBJECT 73 Q_OBJECT
63 Q_ENUMS( SelectionModeExt ) 74 Q_ENUMS( SelectionModeExt )
64 Q_PROPERTY( bool fullWidth READ fullWidth WRITE setFullWidth ) 75 Q_PROPERTY( bool fullWidth READ fullWidth WRITE setFullWidth )
65 Q_PROPERTY( bool itemsMovable READ itemsMovable WRITE setItemsMovable ) 76 Q_PROPERTY( bool itemsMovable READ itemsMovable WRITE setItemsMovable )
66 Q_PROPERTY( bool itemsRenameable READ itemsRenameable WRITE setItemsRenameable ) 77 Q_PROPERTY( bool itemsRenameable READ itemsRenameable WRITE setItemsRenameable )
67 Q_PROPERTY( bool dragEnabled READ dragEnabled WRITE setDragEnabled ) 78 Q_PROPERTY( bool dragEnabled READ dragEnabled WRITE setDragEnabled )
68 Q_PROPERTY( bool autoOpen READ autoOpen WRITE setAutoOpen ) 79 Q_PROPERTY( bool autoOpen READ autoOpen WRITE setAutoOpen )
69 Q_PROPERTY( bool dropVisualizer READ dropVisualizer WRITE setDropVisualizer ) 80 Q_PROPERTY( bool dropVisualizer READ dropVisualizer WRITE setDropVisualizer )
70//US Q_PROPERTY( int tooltipColumn READ tooltipColumn WRITE setTooltipColumn ) 81//US Q_PROPERTY( int tooltipColumn READ tooltipColumn WRITE setTooltipColumn )
71 Q_PROPERTY( int dropVisualizerWidth READ dropVisualizerWidth WRITE setDropVisualizerWidth ) 82 Q_PROPERTY( int dropVisualizerWidth READ dropVisualizerWidth WRITE setDropVisualizerWidth )
72 Q_PROPERTY( QColor alternateBackground READ alternateBackground WRITE setAlternateBackground ) 83 Q_PROPERTY( QColor alternateBackground READ alternateBackground WRITE setAlternateBackground )
@@ -97,33 +108,33 @@ public:
97 * item to (including) the item one page up 108 * item to (including) the item one page up
98 * 109 *
99 * The combinations work the same with SHIFT instead of CTRL, except 110 * The combinations work the same with SHIFT instead of CTRL, except
100 * that if you start selecting something using SHIFT everything selected 111 * that if you start selecting something using SHIFT everything selected
101 * before will be deselected first. 112 * before will be deselected first.
102 * 113 *
103 * Additionally the current item is always selected automatically when 114 * Additionally the current item is always selected automatically when
104 * navigating using the keyboard, except other items were selected explicitely. 115 * navigating using the keyboard, except other items were selected explicitely.
105 * 116 *
106 * This way e.g. SHIFT+up/PgUp then SHIFT+down/PgDn leaves no item selected 117 * This way e.g. SHIFT+up/PgUp then SHIFT+down/PgDn leaves no item selected
107 */ 118 */
108 enum SelectionModeExt { 119 enum SelectionModeExt {
109 Single = QListView::Single, 120 Single = Q3ListView::Single,
110 Multi = QListView::Multi, 121 Multi = Q3ListView::Multi,
111 Extended = QListView::Extended, 122 Extended = Q3ListView::Extended,
112 NoSelection = QListView::NoSelection, 123 NoSelection = Q3ListView::NoSelection,
113 FileManager 124 FileManager
114 }; 125 };
115 void repaintContents( bool erase = true ) 126 void repaintContents( bool erase = true )
116 { 127 {
117 QScrollView::repaintContents( contentsX(), contentsY(), 128 Q3ScrollView::repaintContents( contentsX(), contentsY(),
118 visibleWidth(), visibleHeight(), erase ); 129 visibleWidth(), visibleHeight(), erase );
119 }; 130 };
120 /** 131 /**
121 * Constructor. 132 * Constructor.
122 * 133 *
123 * The parameters @p parent and @p name are handled by 134 * The parameters @p parent and @p name are handled by
124 * @ref QListView, as usual. 135 * @ref QListView, as usual.
125 */ 136 */
126 KListView (QWidget *parent = 0, const char *name = 0, bool emulateRightMouse = true ); 137 KListView (QWidget *parent = 0, const char *name = 0, bool emulateRightMouse = true );
127 138
128 /** 139 /**
129 * Destructor. 140 * Destructor.
@@ -152,44 +163,44 @@ public:
152 virtual bool isExecuteArea( const QPoint& point ); 163 virtual bool isExecuteArea( const QPoint& point );
153 164
154 /** 165 /**
155 * Same thing, but from an x coordinate only. This only checks if x is in 166 * Same thing, but from an x coordinate only. This only checks if x is in
156 * the first column (if all columns don't show focus), without testing if 167 * the first column (if all columns don't show focus), without testing if
157 * the y coordinate is over an item or not. 168 * the y coordinate is over an item or not.
158 */ 169 */
159 bool isExecuteArea( int x ); 170 bool isExecuteArea( int x );
160 171
161 /** 172 /**
162 * @return a list containing the currently selected items. 173 * @return a list containing the currently selected items.
163 */ 174 */
164 QPtrList<QListViewItem> selectedItems() const; // ### BIC: KDE 4: use an implicitly shared class! (QValueList?) 175 Q3PtrList<Q3ListViewItem> selectedItems() const; // ### BIC: KDE 4: use an implicitly shared class! (QValueList?)
165 176
166 /** 177 /**
167 * Arbitrarily move @p item to @p parent, positioned immediately after item @p after. 178 * Arbitrarily move @p item to @p parent, positioned immediately after item @p after.
168 */ 179 */
169 void moveItem(QListViewItem *item, QListViewItem *parent, QListViewItem *after); 180 void moveItem(Q3ListViewItem *item, Q3ListViewItem *parent, Q3ListViewItem *after);
170 181
171 /** 182 /**
172 * @return the last item (not child!) of this listview. 183 * @return the last item (not child!) of this listview.
173 * 184 *
174 * @see lastChild() 185 * @see lastChild()
175 */ 186 */
176 QListViewItem *lastItem() const; 187 Q3ListViewItem *lastItem() const;
177 188
178 /** 189 /**
179 * @return the last child of this listview. 190 * @return the last child of this listview.
180 * 191 *
181 * @see lastItem() 192 * @see lastItem()
182 */ 193 */
183 QListViewItem* lastChild () const; 194 Q3ListViewItem* lastChild () const;
184 195
185 /** 196 /**
186 * @return the lineedit used for inline renaming. 197 * @return the lineedit used for inline renaming.
187 * Use that to setup a @ref KCompletion or @ref QValidator for the lineedit 198 * Use that to setup a @ref KCompletion or @ref QValidator for the lineedit
188 * 199 *
189 * @since 3.2 200 * @since 3.2
190 */ 201 */
191 KLineEdit* renameLineEdit() const; 202 KLineEdit* renameLineEdit() const;
192 203
193 /** 204 /**
194 * @returns if it is legal to move items in the list view. True by default. 205 * @returns if it is legal to move items in the list view. True by default.
195 * 206 *
@@ -267,32 +278,32 @@ public:
267 * @return the "extended" selection mode of this listview. 278 * @return the "extended" selection mode of this listview.
268 * 279 *
269 * @see SelectionModeExt 280 * @see SelectionModeExt
270 * @see setSelectionModeExt 281 * @see setSelectionModeExt
271 */ 282 */
272 SelectionModeExt selectionModeExt () const; 283 SelectionModeExt selectionModeExt () const;
273 284
274 /** 285 /**
275 * Returns the index of @p item within the item tree or -1 if 286 * Returns the index of @p item within the item tree or -1 if
276 * @p item doesn't exist in this list view. This function takes 287 * @p item doesn't exist in this list view. This function takes
277 * all items into account not only the visible ones. 288 * all items into account not only the visible ones.
278 */ 289 */
279 int itemIndex( const QListViewItem *item ) const; 290 int itemIndex( const Q3ListViewItem *item ) const;
280 291
281 /** 292 /**
282 * Returns the item of @p index within the item tree or 0 if 293 * Returns the item of @p index within the item tree or 0 if
283 * @p index doesn't exist in this list view. This function takes 294 * @p index doesn't exist in this list view. This function takes
284 * all items into account not only the visible ones. 295 * all items into account not only the visible ones.
285 */ 296 */
286 QListViewItem* itemAtIndex(int index); 297 Q3ListViewItem* itemAtIndex(int index);
287 298
288 /** 299 /**
289 * @deprecated 300 * @deprecated
290 * @see #setFullWidth() 301 * @see #setFullWidth()
291 */ 302 */
292 void setFullWidth(); 303 void setFullWidth();
293 304
294 /** 305 /**
295 * Let the last column fit exactly all the available width. 306 * Let the last column fit exactly all the available width.
296 * 307 *
297 * @see #fullWidth() 308 * @see #fullWidth()
298 */ 309 */
@@ -305,25 +316,25 @@ public:
305 */ 316 */
306 bool fullWidth() const; 317 bool fullWidth() const;
307 318
308 /** 319 /**
309 * Reimplemented for full width support 320 * Reimplemented for full width support
310 * 321 *
311 * @see #removeColumn() 322 * @see #removeColumn()
312 */ 323 */
313 virtual int addColumn(const QString& label, int width = -1); 324 virtual int addColumn(const QString& label, int width = -1);
314 /** 325 /**
315 * Reimplemented for full width support 326 * Reimplemented for full width support
316 */ 327 */
317 virtual int addColumn(const QIconSet& iconset, const QString& label, int width = -1); 328 virtual int addColumn(const QIcon& iconset, const QString& label, int width = -1);
318 /** 329 /**
319 * Reimplemented for full width support 330 * Reimplemented for full width support
320 * 331 *
321 * @see #addColumn() 332 * @see #addColumn()
322 */ 333 */
323 virtual void removeColumn(int index); 334 virtual void removeColumn(int index);
324 335
325 /** 336 /**
326 * sets the alternate background background color. 337 * sets the alternate background background color.
327 * This only has an effect if the items are KListViewItems 338 * This only has an effect if the items are KListViewItems
328 * 339 *
329 * @param c the color to use for every other item. Set to an invalid 340 * @param c the color to use for every other item. Set to an invalid
@@ -379,108 +390,108 @@ public:
379 390
380signals: 391signals:
381 392
382 /** 393 /**
383 * This signal is emitted whenever the user executes an listview item. 394 * This signal is emitted whenever the user executes an listview item.
384 * That means depending on the KDE wide Single Click/Double Click 395 * That means depending on the KDE wide Single Click/Double Click
385 * setting the user clicked or double clicked on that item. 396 * setting the user clicked or double clicked on that item.
386 * @param item is the pointer to the executed listview item. 397 * @param item is the pointer to the executed listview item.
387 * 398 *
388 * Note that you may not delete any @ref QListViewItem objects in slots 399 * Note that you may not delete any @ref QListViewItem objects in slots
389 * connected to this signal. 400 * connected to this signal.
390 */ 401 */
391 void executed( QListViewItem *item ); 402 void executed( Q3ListViewItem *item );
392 403
393 /** 404 /**
394 * This signal is emitted whenever the user executes an listview item. 405 * This signal is emitted whenever the user executes an listview item.
395 * That means depending on the KDE wide Single Click/Double Click 406 * That means depending on the KDE wide Single Click/Double Click
396 * setting the user clicked or double clicked on that item. 407 * setting the user clicked or double clicked on that item.
397 * @param item is the pointer to the executed listview item. 408 * @param item is the pointer to the executed listview item.
398 * @param pos is the position where the user has clicked 409 * @param pos is the position where the user has clicked
399 * @param c is the column into which the user clicked. 410 * @param c is the column into which the user clicked.
400 * 411 *
401 * Note that you may not delete any @ref QListViewItem objects in slots 412 * Note that you may not delete any @ref QListViewItem objects in slots
402 * connected to this signal. 413 * connected to this signal.
403 */ 414 */
404 void executed( QListViewItem *item, const QPoint &pos, int c ); 415 void executed( Q3ListViewItem *item, const QPoint &pos, int c );
405 416
406 /** 417 /**
407 * This signal gets emitted whenever the user double clicks into the 418 * This signal gets emitted whenever the user double clicks into the
408 * listview. 419 * listview.
409 * @param item is the pointer to the clicked listview item. 420 * @param item is the pointer to the clicked listview item.
410 * @param pos is the position where the user has clicked, and 421 * @param pos is the position where the user has clicked, and
411 * @param c is the column into which the user clicked. 422 * @param c is the column into which the user clicked.
412 * 423 *
413 * Note that you may not delete any @ref QListViewItem objects in slots 424 * Note that you may not delete any @ref QListViewItem objects in slots
414 * connected to this signal. 425 * connected to this signal.
415 * 426 *
416 * This signal is more or less here for the sake of completeness. 427 * This signal is more or less here for the sake of completeness.
417 * You should normally not need to use this. In most cases its better 428 * You should normally not need to use this. In most cases its better
418 * to use @ref #executed() instead. 429 * to use @ref #executed() instead.
419 */ 430 */
420 void doubleClicked( QListViewItem *item, const QPoint &pos, int c ); 431 void doubleClicked( Q3ListViewItem *item, const QPoint &pos, int c );
421 void contextRequest( QListViewItem *item, const QPoint &pos, int c ); 432 void contextRequest( Q3ListViewItem *item, const QPoint &pos, int c );
422 433
423 /** 434 /**
424 * This signal gets emitted whenever something acceptable is 435 * This signal gets emitted whenever something acceptable is
425 * dropped onto the listview. 436 * dropped onto the listview.
426 * 437 *
427 * @param e is the drop event itself (it has already been accepted) 438 * @param e is the drop event itself (it has already been accepted)
428 * @param after is the item after which the drop occured (or 0L, if 439 * @param after is the item after which the drop occured (or 0L, if
429 * the drop was above all items) 440 * the drop was above all items)
430 * 441 *
431 * @see #acceptDrop() 442 * @see #acceptDrop()
432 */ 443 */
433 void dropped (QDropEvent * e, QListViewItem *after); 444 void dropped (QDropEvent * e, Q3ListViewItem *after);
434 445
435 /** 446 /**
436 * This signal gets emitted whenever something acceptable is 447 * This signal gets emitted whenever something acceptable is
437 * dropped onto the listview. 448 * dropped onto the listview.
438 * 449 *
439 * This is an overloaded version of the above (provided to simplify 450 * This is an overloaded version of the above (provided to simplify
440 * processing drops outside of the class). 451 * processing drops outside of the class).
441 * 452 *
442 * @param list is the listview 453 * @param list is the listview
443 * @param e is the drop event itself (it has already been accepted) 454 * @param e is the drop event itself (it has already been accepted)
444 * @param after is the item after which the drop occured (or 0L, if 455 * @param after is the item after which the drop occured (or 0L, if
445 * the drop was above all items 456 * the drop was above all items
446 */ 457 */
447 void dropped (KListView* list, QDropEvent* e, QListViewItem* after); 458 void dropped (KListView* list, QDropEvent* e, Q3ListViewItem* after);
448 459
449 /** 460 /**
450 * This signal gets emitted whenever something acceptable is 461 * This signal gets emitted whenever something acceptable is
451 * dropped onto the listview. 462 * dropped onto the listview.
452 * 463 *
453 * This function also provides a parent, in the event that your listview 464 * This function also provides a parent, in the event that your listview
454 * is a tree 465 * is a tree
455 * @param list is the listview 466 * @param list is the listview
456 * @param e is the drop event itself (it has already been accepted) 467 * @param e is the drop event itself (it has already been accepted)
457 * @param parent the item that is to be the parent of the new item 468 * @param parent the item that is to be the parent of the new item
458 * @param after is the item after which the drop occured (or 0L, if 469 * @param after is the item after which the drop occured (or 0L, if
459 * the drop was above all items 470 * the drop was above all items
460 */ 471 */
461 void dropped (KListView* list, QDropEvent* e, QListViewItem* parent, QListViewItem* after); 472 void dropped (KListView* list, QDropEvent* e, Q3ListViewItem* parent, Q3ListViewItem* after);
462 473
463 /** 474 /**
464 * This signal gets emitted whenever something acceptable is 475 * This signal gets emitted whenever something acceptable is
465 * dropped onto the listview. 476 * dropped onto the listview.
466 * 477 *
467 * This function also provides a parent, in the event that your listview 478 * This function also provides a parent, in the event that your listview
468 * is a tree 479 * is a tree
469 * @param e is the drop event itself (it has already been accepted) 480 * @param e is the drop event itself (it has already been accepted)
470 * @param parent the item that is to be the parent of the new item 481 * @param parent the item that is to be the parent of the new item
471 * @param after is the item after which the drop occured (or 0L, if 482 * @param after is the item after which the drop occured (or 0L, if
472 * the drop was above all items 483 * the drop was above all items
473 */ 484 */
474 void dropped (QDropEvent* e, QListViewItem* parent, QListViewItem* after); 485 void dropped (QDropEvent* e, Q3ListViewItem* parent, Q3ListViewItem* after);
475 486
476 /** 487 /**
477 * This signal is emitted when ever the user moves an item in the list via 488 * This signal is emitted when ever the user moves an item in the list via
478 * DnD. 489 * DnD.
479 * If more than one item is moved at the same time, this signal is only emitted 490 * If more than one item is moved at the same time, this signal is only emitted
480 * once. 491 * once.
481 */ 492 */
482 void moved(); 493 void moved();
483 494
484 /** 495 /**
485 * Connect to this signal if you want to do some preprocessing before 496 * Connect to this signal if you want to do some preprocessing before
486 * a move is made, for example, to disable sorting 497 * a move is made, for example, to disable sorting
@@ -493,76 +504,76 @@ signals:
493 504
494 /** 505 /**
495 * This signal is emitted when ever the user moves an item in the list via 506 * This signal is emitted when ever the user moves an item in the list via
496 * DnD. 507 * DnD.
497 * If more than one item is moved at the same time, @p afterFirst and 508 * If more than one item is moved at the same time, @p afterFirst and
498 * @p afterNow will reflect what was true before the move. 509 * @p afterNow will reflect what was true before the move.
499 * This differs from @ref moved(), so be careful. All the items will have been 510 * This differs from @ref moved(), so be careful. All the items will have been
500 * moved before @ref moved() is emitted, which is not true in this method. // FIXME 511 * moved before @ref moved() is emitted, which is not true in this method. // FIXME
501 * @param item the item that was moved 512 * @param item the item that was moved
502 * @param afterFirst the item that parameter item was in before the move, in the list 513 * @param afterFirst the item that parameter item was in before the move, in the list
503 * @param afterNow the item it's currently after. 514 * @param afterNow the item it's currently after.
504 */ 515 */
505 void moved (QListViewItem *item, QListViewItem *afterFirst, QListViewItem *afterNow); 516 void moved (Q3ListViewItem *item, Q3ListViewItem *afterFirst, Q3ListViewItem *afterNow);
506 517
507 518
508 /** 519 /**
509 * This signal is emitted after all the items have been moved. It reports info for 520 * This signal is emitted after all the items have been moved. It reports info for
510 * each and every item moved, in order. The first element in @p items associates 521 * each and every item moved, in order. The first element in @p items associates
511 * with the first of afterFirst and afterNow. 522 * with the first of afterFirst and afterNow.
512 */ 523 */
513 void moved(QPtrList<QListViewItem> &items, QPtrList<QListViewItem> &afterFirst, QPtrList<QListViewItem> &afterNow); 524 void moved(Q3PtrList<Q3ListViewItem> &items, Q3PtrList<Q3ListViewItem> &afterFirst, Q3PtrList<Q3ListViewItem> &afterNow);
514 525
515 /** 526 /**
516 * This signal gets emitted when an item is renamed via in-place renaming. 527 * This signal gets emitted when an item is renamed via in-place renaming.
517 * 528 *
518 * @param item is the renamed item. 529 * @param item is the renamed item.
519 * @param str is the new value of column @p col. 530 * @param str is the new value of column @p col.
520 * @param col is the renamed column. 531 * @param col is the renamed column.
521 */ 532 */
522 void itemRenamed(QListViewItem* item, const QString &str, int col); 533 void itemRenamed(Q3ListViewItem* item, const QString &str, int col);
523 534
524 /** 535 /**
525 * Same as above, but without the extra information. 536 * Same as above, but without the extra information.
526 */ 537 */
527 void itemRenamed(QListViewItem* item); 538 void itemRenamed(Q3ListViewItem* item);
528 void signalDelete(); 539 void signalDelete();
529 540
530 /** 541 /**
531 * This signal is emitted when the shortcut key for popup-menus is pressed. 542 * This signal is emitted when the shortcut key for popup-menus is pressed.
532 * 543 *
533 * Normally you should not use this, just connect a slot to signal 544 * Normally you should not use this, just connect a slot to signal
534 * @ref contextMenu (KListView*, QListViewItem*, const QPoint&) to correctly 545 * @ref contextMenu (KListView*, QListViewItem*, const QPoint&) to correctly
535 * handle showing context menus regardless of settings. 546 * handle showing context menus regardless of settings.
536 * 547 *
537 * @param list is this listview. 548 * @param list is this listview.
538 * @param item is the @ref currentItem() at the time the key was pressed. May be 0L. 549 * @param item is the @ref currentItem() at the time the key was pressed. May be 0L.
539 */ 550 */
540 void menuShortCutPressed (KListView* list, QListViewItem* item); 551 void menuShortCutPressed (KListView* list, Q3ListViewItem* item);
541 552
542 /** 553 /**
543 * This signal is emitted whenever a context-menu should be shown for item @p i. 554 * This signal is emitted whenever a context-menu should be shown for item @p i.
544 * It automatically adjusts for all settings involved (Menu key, showMenuOnPress/Click). 555 * It automatically adjusts for all settings involved (Menu key, showMenuOnPress/Click).
545 * 556 *
546 * @param l is this listview. 557 * @param l is this listview.
547 * @param i is the item for which the menu should be shown. May be 0L. 558 * @param i is the item for which the menu should be shown. May be 0L.
548 * @param p is the point at which the menu should be shown. 559 * @param p is the point at which the menu should be shown.
549 */ 560 */
550 void contextMenu (KListView* l, QListViewItem* i, const QPoint& p); 561 void contextMenu (KListView* l, Q3ListViewItem* i, const QPoint& p);
551 562
552public slots: 563public slots:
553 /** 564 /**
554 * Rename column @p c of @p item. 565 * Rename column @p c of @p item.
555 */ 566 */
556 virtual void rename(QListViewItem *item, int c); 567 virtual void rename(Q3ListViewItem *item, int c);
557 568
558 /** 569 /**
559 * By default, if you called setItemsRenameable(true), 570 * By default, if you called setItemsRenameable(true),
560 * only the first column is renameable. 571 * only the first column is renameable.
561 * Use this function to enable the feature on other columns. 572 * Use this function to enable the feature on other columns.
562 * 573 *
563 * If you want more intelligent (dynamic) selection, 574 * If you want more intelligent (dynamic) selection,
564 * you'll have to derive from KListView, 575 * you'll have to derive from KListView,
565 * and override @ref rename() and call only call it 576 * and override @ref rename() and call only call it
566 * if you want the item to be renamed. 577 * if you want the item to be renamed.
567 */ 578 */
568 void setRenameable (int column, bool yesno=true); 579 void setRenameable (int column, bool yesno=true);
@@ -664,41 +675,41 @@ protected:
664 return (p.y() > (rect.top() + (rect.bottom() - rect.top())/2)); 675 return (p.y() > (rect.top() + (rect.bottom() - rect.top())/2));
665 } 676 }
666 677
667 /** 678 /**
668 * An overloaded version of below(const QRect&, const QPoint&). 679 * An overloaded version of below(const QRect&, const QPoint&).
669 * 680 *
670 * It differs from the above only in what arguments it takes. 681 * It differs from the above only in what arguments it takes.
671 * 682 *
672 * @param i the item whose rect() is passed to the above function. 683 * @param i the item whose rect() is passed to the above function.
673 * @param p is translated from contents coordinates to viewport coordinates 684 * @param p is translated from contents coordinates to viewport coordinates
674 * before being passed to the above function. 685 * before being passed to the above function.
675 */ 686 */
676 inline bool below (QListViewItem* i, const QPoint& p) 687 inline bool below (Q3ListViewItem* i, const QPoint& p)
677 { 688 {
678 return below (itemRect(i), contentsToViewport(p)); 689 return below (itemRect(i), contentsToViewport(p));
679 } 690 }
680 691
681 /** 692 /**
682 * Reimplemented to reload the alternate background in palette changes. 693 * Reimplemented to reload the alternate background in palette changes.
683 * @internal 694 * @internal
684 */ 695 */
685 virtual bool event( QEvent * ); 696 virtual bool event( QEvent * );
686 697
687 /** 698 /**
688 * Emit signal @ref #executed. 699 * Emit signal @ref #executed.
689 * @internal 700 * @internal
690 */ 701 */
691 //US I added buttonstate to pass the current keyboard status 702 //US I added buttonstate to pass the current keyboard status
692 void emitExecute( int buttonstate, QListViewItem *item, const QPoint &pos, int c); 703 void emitExecute( int buttonstate, Q3ListViewItem *item, const QPoint &pos, int c);
693 704
694 /** 705 /**
695 * Reimplemented for internal reasons. 706 * Reimplemented for internal reasons.
696 * Further reimplementations should call this function or else 707 * Further reimplementations should call this function or else
697 * some features may not work correctly. 708 * some features may not work correctly.
698 * 709 *
699 * The API is unaffected. 710 * The API is unaffected.
700 */ 711 */
701 virtual void focusInEvent(QFocusEvent* fe); 712 virtual void focusInEvent(QFocusEvent* fe);
702 713
703 /** 714 /**
704 * Reimplemented for internal reasons. 715 * Reimplemented for internal reasons.
@@ -712,30 +723,30 @@ protected:
712 /** 723 /**
713 * Reimplemented for internal reasons. 724 * Reimplemented for internal reasons.
714 * Further reimplementations should call this function or else 725 * Further reimplementations should call this function or else
715 * some features may not work correctly. 726 * some features may not work correctly.
716 * 727 *
717 * The API is unaffected. 728 * The API is unaffected.
718 */ 729 */
719 virtual void leaveEvent( QEvent *e ); 730 virtual void leaveEvent( QEvent *e );
720 731
721 /** 732 /**
722 * @return the tooltip for @p column of @p item. 733 * @return the tooltip for @p column of @p item.
723 */ 734 */
724 virtual QString tooltip(QListViewItem* item, int column) const; 735 virtual QString tooltip(Q3ListViewItem* item, int column) const;
725 736
726 /** 737 /**
727 * @return whether the tooltip for @p column of @p item shall be shown at point @p pos. 738 * @return whether the tooltip for @p column of @p item shall be shown at point @p pos.
728 */ 739 */
729 virtual bool showTooltip(QListViewItem *item, const QPoint &pos, int column) const; 740 virtual bool showTooltip(Q3ListViewItem *item, const QPoint &pos, int column) const;
730 741
731 /** 742 /**
732 * Reimplemented for internal reasons. 743 * Reimplemented for internal reasons.
733 * Further reimplementations should call this function or else 744 * Further reimplementations should call this function or else
734 * some features may not work correctly. 745 * some features may not work correctly.
735 * 746 *
736 * The API is unaffected. 747 * The API is unaffected.
737 */ 748 */
738 virtual void contentsDragMoveEvent (QDragMoveEvent *event); 749 virtual void contentsDragMoveEvent (QDragMoveEvent *event);
739 750
740 /** 751 /**
741 * Reimplemented for internal reasons. 752 * Reimplemented for internal reasons.
@@ -796,49 +807,49 @@ protected:
796 * Further reimplementations should call this function or else 807 * Further reimplementations should call this function or else
797 * some features may not work correctly. 808 * some features may not work correctly.
798 * 809 *
799 * The API is unaffected. 810 * The API is unaffected.
800 */ 811 */
801 virtual void contentsDragEnterEvent (QDragEnterEvent *); 812 virtual void contentsDragEnterEvent (QDragEnterEvent *);
802 813
803 /** 814 /**
804 * @return a dragobject encoding the current selection. 815 * @return a dragobject encoding the current selection.
805 * 816 *
806 * @see setDragEnabled() 817 * @see setDragEnabled()
807 */ 818 */
808 virtual QDragObject *dragObject(); 819 virtual Q3DragObject *dragObject();
809 820
810 /** 821 /**
811 * @return true if the @p event provides some acceptable 822 * @return true if the @p event provides some acceptable
812 * format. 823 * format.
813 * A common mistake is to forget the "const" in your reimplementation 824 * A common mistake is to forget the "const" in your reimplementation
814 */ 825 */
815 virtual bool acceptDrag (QDropEvent* event) const; 826 virtual bool acceptDrag (QDropEvent* event) const;
816 827
817 /** 828 /**
818 * Paint the drag line. If painter is null, don't try to :) 829 * Paint the drag line. If painter is null, don't try to :)
819 * 830 *
820 * If after == 0 then the marker should be drawn at the top. 831 * If after == 0 then the marker should be drawn at the top.
821 * 832 *
822 * @return the rectangle that you painted to. 833 * @return the rectangle that you painted to.
823 */ 834 */
824 virtual QRect drawDropVisualizer (QPainter *p, QListViewItem *parent, QListViewItem *after); 835 virtual QRect drawDropVisualizer (QPainter *p, Q3ListViewItem *parent, Q3ListViewItem *after);
825 836
826 /** 837 /**
827 * Paint the drag rectangle. If painter is null, don't try to :) 838 * Paint the drag rectangle. If painter is null, don't try to :)
828 * 839 *
829 * 840 *
830 * @return the rectangle that you painted to. 841 * @return the rectangle that you painted to.
831 */ 842 */
832 virtual QRect drawItemHighlighter(QPainter *painter, QListViewItem *item); 843 virtual QRect drawItemHighlighter(QPainter *painter, Q3ListViewItem *item);
833 844
834 /** 845 /**
835 * This method calls @ref dragObject() and starts the drag. 846 * This method calls @ref dragObject() and starts the drag.
836 * 847 *
837 * Reimplement it to do fancy stuff like setting a pixmap or 848 * Reimplement it to do fancy stuff like setting a pixmap or
838 * using a non-default DragMode 849 * using a non-default DragMode
839 */ 850 */
840 virtual void startDrag(); 851 virtual void startDrag();
841 852
842 /** 853 /**
843 * Reimplemented for internal reasons. 854 * Reimplemented for internal reasons.
844 * Further reimplementations should call this function or else 855 * Further reimplementations should call this function or else
@@ -877,52 +888,52 @@ protected:
877 /** 888 /**
878 * Reimplemented for setFullWidth() 889 * Reimplemented for setFullWidth()
879 */ 890 */
880 virtual void viewportResizeEvent(QResizeEvent* e); 891 virtual void viewportResizeEvent(QResizeEvent* e);
881 892
882protected slots: 893protected slots:
883 /** 894 /**
884 * Update internal settings whenever the global ones change. 895 * Update internal settings whenever the global ones change.
885 * @internal 896 * @internal
886 */ 897 */
887 void slotSettingsChanged(int); 898 void slotSettingsChanged(int);
888 899
889 void slotMouseButtonClicked( int btn, QListViewItem *item, const QPoint &pos, int c ); 900 void slotMouseButtonClicked( int btn, Q3ListViewItem *item, const QPoint &pos, int c );
890 void doneEditing(QListViewItem *item, int row); 901 void doneEditing(Q3ListViewItem *item, int row);
891 902
892 /** 903 /**
893 * Repaint the rect where I was drawing the drop line. 904 * Repaint the rect where I was drawing the drop line.
894 */ 905 */
895 void cleanDropVisualizer(); 906 void cleanDropVisualizer();
896 907
897 /** 908 /**
898 * Repaint the rect where I was drawing the drop rectangle. 909 * Repaint the rect where I was drawing the drop rectangle.
899 */ 910 */
900 void cleanItemHighlighter(); 911 void cleanItemHighlighter();
901 912
902 /** 913 /**
903 * Emit the @ref contextMenu signal. This slot is for mouse actions. 914 * Emit the @ref contextMenu signal. This slot is for mouse actions.
904 */ 915 */
905 void emitContextMenu (QListViewItem*, const QPoint&, int); 916 void emitContextMenu (Q3ListViewItem*, const QPoint&, int);
906 917
907 /** 918 /**
908 * Emit the @ref #contextMenu signal. This slot is for key presses. 919 * Emit the @ref #contextMenu signal. This slot is for key presses.
909 */ 920 */
910 void emitContextMenu (KListView*, QListViewItem*); 921 void emitContextMenu (KListView*, Q3ListViewItem*);
911 922
912 /** 923 /**
913 * Accessory slot for AutoSelect 924 * Accessory slot for AutoSelect
914 * @internal 925 * @internal
915 */ 926 */
916 void slotOnItem( QListViewItem *item ); 927 void slotOnItem( Q3ListViewItem *item );
917 928
918 /** 929 /**
919 * Accessory slot for AutoSelect/ChangeCursorOverItem 930 * Accessory slot for AutoSelect/ChangeCursorOverItem
920 * @internal 931 * @internal
921 */ 932 */
922 void slotOnViewport(); 933 void slotOnViewport();
923 934
924 /** 935 /**
925 * Process AutoSelection. 936 * Process AutoSelection.
926 * @internal 937 * @internal
927 */ 938 */
928 void slotAutoSelect(); 939 void slotAutoSelect();
@@ -930,33 +941,33 @@ protected slots:
930 void slotDragExpand(); 941 void slotDragExpand();
931 942
932 /** 943 /**
933 * Reacts to header changes in full width mode 944 * Reacts to header changes in full width mode
934 * @internal 945 * @internal
935 */ 946 */
936 void slotHeaderChanged(); 947 void slotHeaderChanged();
937 948
938protected: 949protected:
939 /** 950 /**
940 * Handle dropEvent when itemsMovable() is set to true. 951 * Handle dropEvent when itemsMovable() is set to true.
941 */ 952 */
942 virtual void movableDropEvent (QListViewItem* parent, QListViewItem* afterme); 953 virtual void movableDropEvent (Q3ListViewItem* parent, Q3ListViewItem* afterme);
943 954
944 /** 955 /**
945 * Where is the nearest QListViewItem that I'm going to drop? 956 * Where is the nearest QListViewItem that I'm going to drop?
946 * 957 *
947 * FIXME KDE 4.0: Make this method const so it can be called from an 958 * FIXME KDE 4.0: Make this method const so it can be called from an
948 * acceptDrag method without ugly casts 959 * acceptDrag method without ugly casts
949 */ 960 */
950 virtual void findDrop(const QPoint &pos, QListViewItem *&parent, QListViewItem *&after); 961 virtual void findDrop(const QPoint &pos, Q3ListViewItem *&parent, Q3ListViewItem *&after);
951 962
952 /** 963 /**
953 * A special keyPressEvent (for FileManager selection mode). 964 * A special keyPressEvent (for FileManager selection mode).
954 */ 965 */
955 void fileManagerKeyPressEvent (QKeyEvent*); 966 void fileManagerKeyPressEvent (QKeyEvent*);
956 967
957 /** 968 /**
958 * Convert the depth of an item into its indentation in pixels 969 * Convert the depth of an item into its indentation in pixels
959 */ 970 */
960 int depthToPixels( int depth ); 971 int depthToPixels( int depth );
961 972
962private: 973private:
@@ -965,57 +976,57 @@ protected:
965 virtual void virtual_hook( int id, void* data ); 976 virtual void virtual_hook( int id, void* data );
966private: 977private:
967 class KListViewPrivate; 978 class KListViewPrivate;
968 KListViewPrivate *d; 979 KListViewPrivate *d;
969}; 980};
970 981
971/** 982/**
972 * A listview item with support for alternate background colours. It is 983 * A listview item with support for alternate background colours. It is
973 * a drop-in replacement for @ref QListViewItem 984 * a drop-in replacement for @ref QListViewItem
974 * 985 *
975 * @short listview item with alternate background colour support 986 * @short listview item with alternate background colour support
976 */ 987 */
977class KListViewItem : public QListViewItem 988class KListViewItem : public Q3ListViewItem
978{ 989{
979public: 990public:
980 /** 991 /**
981 * constructors. The semantics remain as in @ref QListViewItem. 992 * constructors. The semantics remain as in @ref QListViewItem.
982 * Although they accept a @ref QListViewItem as parent, please 993 * Although they accept a @ref QListViewItem as parent, please
983 * don't mix KListViewItem (or subclasses) with QListViewItem 994 * don't mix KListViewItem (or subclasses) with QListViewItem
984 * (or subclasses). 995 * (or subclasses).
985 */ 996 */
986 KListViewItem(QListView *parent); 997 KListViewItem(Q3ListView *parent);
987 KListViewItem(QListViewItem *parent); 998 KListViewItem(Q3ListViewItem *parent);
988 KListViewItem(QListView *parent, QListViewItem *after); 999 KListViewItem(Q3ListView *parent, Q3ListViewItem *after);
989 KListViewItem(QListViewItem *parent, QListViewItem *after); 1000 KListViewItem(Q3ListViewItem *parent, Q3ListViewItem *after);
990 1001
991 KListViewItem(QListView *parent, 1002 KListViewItem(Q3ListView *parent,
992 QString, QString = QString::null, 1003 QString, QString = QString::null,
993 QString = QString::null, QString = QString::null, 1004 QString = QString::null, QString = QString::null,
994 QString = QString::null, QString = QString::null, 1005 QString = QString::null, QString = QString::null,
995 QString = QString::null, QString = QString::null); 1006 QString = QString::null, QString = QString::null);
996 1007
997 KListViewItem(QListViewItem *parent, 1008 KListViewItem(Q3ListViewItem *parent,
998 QString, QString = QString::null, 1009 QString, QString = QString::null,
999 QString = QString::null, QString = QString::null, 1010 QString = QString::null, QString = QString::null,
1000 QString = QString::null, QString = QString::null, 1011 QString = QString::null, QString = QString::null,
1001 QString = QString::null, QString = QString::null); 1012 QString = QString::null, QString = QString::null);
1002 1013
1003 KListViewItem(QListView *parent, QListViewItem *after, 1014 KListViewItem(Q3ListView *parent, Q3ListViewItem *after,
1004 QString, QString = QString::null, 1015 QString, QString = QString::null,
1005 QString = QString::null, QString = QString::null, 1016 QString = QString::null, QString = QString::null,
1006 QString = QString::null, QString = QString::null, 1017 QString = QString::null, QString = QString::null,
1007 QString = QString::null, QString = QString::null); 1018 QString = QString::null, QString = QString::null);
1008 1019
1009 KListViewItem(QListViewItem *parent, QListViewItem *after, 1020 KListViewItem(Q3ListViewItem *parent, Q3ListViewItem *after,
1010 QString, QString = QString::null, 1021 QString, QString = QString::null,
1011 QString = QString::null, QString = QString::null, 1022 QString = QString::null, QString = QString::null,
1012 QString = QString::null, QString = QString::null, 1023 QString = QString::null, QString = QString::null,
1013 QString = QString::null, QString = QString::null); 1024 QString = QString::null, QString = QString::null);
1014 1025
1015 virtual ~KListViewItem(); 1026 virtual ~KListViewItem();
1016 1027
1017 /** 1028 /**
1018 * retuns true if this item is to be drawn with the alternate background 1029 * retuns true if this item is to be drawn with the alternate background
1019 */ 1030 */
1020 bool isAlternate(); 1031 bool isAlternate();
1021 /** 1032 /**