summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kdeui/klistview.cpp9
-rw-r--r--microkde/kdeui/klistview.h1
2 files changed, 10 insertions, 0 deletions
diff --git a/microkde/kdeui/klistview.cpp b/microkde/kdeui/klistview.cpp
index 25327aa..f7d2187 100644
--- a/microkde/kdeui/klistview.cpp
+++ b/microkde/kdeui/klistview.cpp
@@ -447,65 +447,74 @@ KListView::KListView( QWidget *parent, const char *name ,bool emulateRightMouse
447 { 447 {
448 connect (this, SIGNAL (rightButtonPressed (QListViewItem*, const QPoint&, int)), 448 connect (this, SIGNAL (rightButtonPressed (QListViewItem*, const QPoint&, int)),
449 this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); 449 this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int)));
450 } 450 }
451 else 451 else
452 { 452 {
453 connect (this, SIGNAL (rightButtonClicked (QListViewItem*, const QPoint&, int)), 453 connect (this, SIGNAL (rightButtonClicked (QListViewItem*, const QPoint&, int)),
454 this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); 454 this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int)));
455 } 455 }
456 456
457 connect (this, SIGNAL (menuShortCutPressed (KListView*, QListViewItem*)), 457 connect (this, SIGNAL (menuShortCutPressed (KListView*, QListViewItem*)),
458 this, SLOT (emitContextMenu (KListView*, QListViewItem*))); 458 this, SLOT (emitContextMenu (KListView*, QListViewItem*)));
459 459
460 460
461 //qDebug("KListView::KListView make alternate color configurable"); 461 //qDebug("KListView::KListView make alternate color configurable");
462 d->alternateBackground = KGlobalSettings::alternateBackgroundColor(); 462 d->alternateBackground = KGlobalSettings::alternateBackgroundColor();
463} 463}
464 464
465 465
466 466
467KListView::~KListView() 467KListView::~KListView()
468{ 468{
469 delete d; 469 delete d;
470} 470}
471 471
472bool KListView::isExecuteArea( const QPoint& point ) 472bool KListView::isExecuteArea( const QPoint& point )
473{ 473{
474 if ( itemAt( point ) ) 474 if ( itemAt( point ) )
475 return isExecuteArea( point.x() ); 475 return isExecuteArea( point.x() );
476 476
477 return false; 477 return false;
478} 478}
479QSize KListView::sizeHint() const
480{
481 //qDebug("KListView::QSize sizeHint() ");
482#ifdef DESKTOP_VERSION
483 QListView::sizeHint();
484#else
485 return QSize ( 40, 40 );
486#endif
479 487
488}
480bool KListView::isExecuteArea( int x ) 489bool KListView::isExecuteArea( int x )
481{ 490{
482 if( allColumnsShowFocus() ) 491 if( allColumnsShowFocus() )
483 return true; 492 return true;
484 else { 493 else {
485 int offset = 0; 494 int offset = 0;
486 int width = columnWidth( 0 ); 495 int width = columnWidth( 0 );
487 int pos = header()->mapToIndex( 0 ); 496 int pos = header()->mapToIndex( 0 );
488 497
489 for ( int index = 0; index < pos; index++ ) 498 for ( int index = 0; index < pos; index++ )
490 offset += columnWidth( header()->mapToSection( index ) ); 499 offset += columnWidth( header()->mapToSection( index ) );
491 500
492 x += contentsX(); // in case of a horizontal scrollbar 501 x += contentsX(); // in case of a horizontal scrollbar
493 return ( x > offset && x < ( offset + width ) ); 502 return ( x > offset && x < ( offset + width ) );
494 } 503 }
495} 504}
496 505
497void KListView::slotOnItem( QListViewItem *item ) 506void KListView::slotOnItem( QListViewItem *item )
498{ 507{
499 QPoint vp = viewport()->mapFromGlobal( QCursor::pos() ); 508 QPoint vp = viewport()->mapFromGlobal( QCursor::pos() );
500 if ( item && isExecuteArea( vp.x() ) && (d->autoSelectDelay > -1) && d->bUseSingle ) { 509 if ( item && isExecuteArea( vp.x() ) && (d->autoSelectDelay > -1) && d->bUseSingle ) {
501 d->autoSelect.start( d->autoSelectDelay, true ); 510 d->autoSelect.start( d->autoSelectDelay, true );
502 d->pCurrentItem = item; 511 d->pCurrentItem = item;
503 } 512 }
504} 513}
505 514
506void KListView::slotOnViewport() 515void KListView::slotOnViewport()
507{ 516{
508 if ( d->bChangeCursorOverItem ) 517 if ( d->bChangeCursorOverItem )
509 viewport()->unsetCursor(); 518 viewport()->unsetCursor();
510 519
511 d->autoSelect.stop(); 520 d->autoSelect.stop();
diff --git a/microkde/kdeui/klistview.h b/microkde/kdeui/klistview.h
index 0058416..9f0d9fd 100644
--- a/microkde/kdeui/klistview.h
+++ b/microkde/kdeui/klistview.h
@@ -101,64 +101,65 @@ public:
101 * before will be deselected first. 101 * before will be deselected first.
102 * 102 *
103 * Additionally the current item is always selected automatically when 103 * Additionally the current item is always selected automatically when
104 * navigating using the keyboard, except other items were selected explicitely. 104 * navigating using the keyboard, except other items were selected explicitely.
105 * 105 *
106 * This way e.g. SHIFT+up/PgUp then SHIFT+down/PgDn leaves no item selected 106 * This way e.g. SHIFT+up/PgUp then SHIFT+down/PgDn leaves no item selected
107 */ 107 */
108 enum SelectionModeExt { 108 enum SelectionModeExt {
109 Single = QListView::Single, 109 Single = QListView::Single,
110 Multi = QListView::Multi, 110 Multi = QListView::Multi,
111 Extended = QListView::Extended, 111 Extended = QListView::Extended,
112 NoSelection = QListView::NoSelection, 112 NoSelection = QListView::NoSelection,
113 FileManager 113 FileManager
114 }; 114 };
115 void repaintContents( bool erase = true ) 115 void repaintContents( bool erase = true )
116 { 116 {
117 QScrollView::repaintContents( contentsX(), contentsY(), 117 QScrollView::repaintContents( contentsX(), contentsY(),
118 visibleWidth(), visibleHeight(), erase ); 118 visibleWidth(), visibleHeight(), erase );
119 }; 119 };
120 /** 120 /**
121 * Constructor. 121 * Constructor.
122 * 122 *
123 * The parameters @p parent and @p name are handled by 123 * The parameters @p parent and @p name are handled by
124 * @ref QListView, as usual. 124 * @ref QListView, as usual.
125 */ 125 */
126 KListView (QWidget *parent = 0, const char *name = 0, bool emulateRightMouse = true ); 126 KListView (QWidget *parent = 0, const char *name = 0, bool emulateRightMouse = true );
127 127
128 /** 128 /**
129 * Destructor. 129 * Destructor.
130 */ 130 */
131 virtual ~KListView(); 131 virtual ~KListView();
132 132
133 virtual QSize sizeHint() const;
133 /** 134 /**
134 * Reimplemented for internal reasons. 135 * Reimplemented for internal reasons.
135 * Further reimplementations should call this function or else 136 * Further reimplementations should call this function or else
136 * some features may not work correctly. 137 * some features may not work correctly.
137 * 138 *
138 * The API is unaffected. 139 * The API is unaffected.
139 */ 140 */
140 virtual void setAcceptDrops (bool); 141 virtual void setAcceptDrops (bool);
141 142
142 /** 143 /**
143 * This function determines whether the given coordinates are within the 144 * This function determines whether the given coordinates are within the
144 * execute area. The execute area is the part of a @ref QListViewItem where mouse 145 * execute area. The execute area is the part of a @ref QListViewItem where mouse
145 * clicks or double clicks respectively generate a @ref #executed() signal. 146 * clicks or double clicks respectively generate a @ref #executed() signal.
146 * Depending on @ref QListView::allColumnsShowFocus() this is either the 147 * Depending on @ref QListView::allColumnsShowFocus() this is either the
147 * whole item or only the first column. 148 * whole item or only the first column.
148 * @return true if point is inside execute area of an item, false in all 149 * @return true if point is inside execute area of an item, false in all
149 * other cases including the case that it is over the viewport. 150 * other cases including the case that it is over the viewport.
150 */ 151 */
151 virtual bool isExecuteArea( const QPoint& point ); 152 virtual bool isExecuteArea( const QPoint& point );
152 153
153 /** 154 /**
154 * Same thing, but from an x coordinate only. This only checks if x is in 155 * Same thing, but from an x coordinate only. This only checks if x is in
155 * the first column (if all columns don't show focus), without testing if 156 * the first column (if all columns don't show focus), without testing if
156 * the y coordinate is over an item or not. 157 * the y coordinate is over an item or not.
157 */ 158 */
158 bool isExecuteArea( int x ); 159 bool isExecuteArea( int x );
159 160
160 /** 161 /**
161 * @return a list containing the currently selected items. 162 * @return a list containing the currently selected items.
162 */ 163 */
163 QPtrList<QListViewItem> selectedItems() const; // ### BIC: KDE 4: use an implicitly shared class! (QValueList?) 164 QPtrList<QListViewItem> selectedItems() const; // ### BIC: KDE 4: use an implicitly shared class! (QValueList?)
164 165