From 06b514847fffb79985e4bcde9f8dcc685c5d9ac5 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Tue, 31 Jan 2012 14:05:59 -0600 Subject: Fix konq filter in list view mode Select all now only selects shown (filtered) items --- tdeui/klistview.cpp | 46 ++++++++++++++++++++++++++++++++++++++++++++++ tdeui/klistview.h | 8 ++++++++ 2 files changed, 54 insertions(+) diff --git a/tdeui/klistview.cpp b/tdeui/klistview.cpp index e1c5811ca..b52fe6876 100644 --- a/tdeui/klistview.cpp +++ b/tdeui/klistview.cpp @@ -2356,6 +2356,52 @@ void KListViewItem::paintCell(TQPainter *p, const TQColorGroup &cg, int column, TQListViewItem::paintCell(p, _cg, column, width, alignment); } +/*! + If \a select is TRUE, all the items get selected; otherwise all + the items get unselected. This only works in the selection modes \c + Multi and \c Extended. In \c Single and \c NoSelection mode the + selection of the current item is just set to \a select. +*/ + +void KListView::selectAll( bool select ) +{ + if ( selectionMode() == Multi || selectionMode() == Extended ) { + bool b = signalsBlocked(); + blockSignals( TRUE ); + bool anything = FALSE; + TQListViewItemIterator it( this ); + while ( it.current() ) { + TQListViewItem *i = it.current(); + if ( select == TRUE ) { + if ( (bool)i->isVisible() == TRUE ) { + i->setSelected( TRUE ); + anything = TRUE; + } + if ( (bool)i->isVisible() == FALSE ) { + i->setSelected( FALSE ); + anything = TRUE; + } + } + else { + if ( (bool)i->isSelected() != select ) { + i->setSelected( select ); + anything = TRUE; + } + } + ++it; + } + blockSignals( b ); + if ( anything ) { + emit selectionChanged(); +// d->useDoubleBuffer = TRUE; + triggerUpdate(); + } + } else if ( currentItem() ) { + TQListViewItem * i = currentItem(); + setSelected( i, select ); + } +} + void KListView::virtual_hook( int, void* ) { /*BASE::virtual_hook( id, data );*/ } diff --git a/tdeui/klistview.h b/tdeui/klistview.h index ed101927f..c8bb837cd 100644 --- a/tdeui/klistview.h +++ b/tdeui/klistview.h @@ -660,6 +660,14 @@ public slots: */ bool tabOrderedRenaming() const; + /** + * Override TQListView selectAll() so that filtered + * items are not selected + * + * @since 14.0 + */ + virtual void selectAll( bool select ); + protected: /** * Determine whether a drop on position @p p would count as -- cgit v1.2.1