From 41f8286a568f01bc2723eb74e763556b4c397546 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Tue, 25 Sep 2007 13:53:08 +0000 Subject: assure that "Select All" and "Invert Selection" only operate on the active column of the column-view instead of selecting the whole hierarchy of the model svn path=/trunk/KDE/kdebase/apps/; revision=716885 --- src/dolphincolumnview.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/dolphincolumnview.cpp') diff --git a/src/dolphincolumnview.cpp b/src/dolphincolumnview.cpp index 979ff7649..6df71cc1e 100644 --- a/src/dolphincolumnview.cpp +++ b/src/dolphincolumnview.cpp @@ -503,6 +503,23 @@ void DolphinColumnView::reload() dirLister->openUrl(rootUrl, false, true); } +void DolphinColumnView::invertSelection() +{ + // TODO: this approach of inverting the selection is quite slow. It should + // be possible to speedup the implementation by using QItemSelection, but + // all adempts have failed yet... + + ColumnWidget* column = activeColumn(); + QItemSelectionModel* selModel = column->selectionModel(); + + KDirLister* dirLister = m_dolphinModel->dirLister(); + const KFileItemList list = dirLister->itemsForDir(column->url()); + foreach (KFileItem* item, list) { + const QModelIndex index = m_dolphinModel->indexForUrl(item->url()); + selModel->select(m_proxyModel->mapFromSource(index), QItemSelectionModel::Toggle); + } +} + void DolphinColumnView::showColumn(const KUrl& url) { const KUrl& rootUrl = m_columns[0]->url(); @@ -621,6 +638,11 @@ void DolphinColumnView::showColumn(const KUrl& url) expandToActiveUrl(); } +void DolphinColumnView::selectAll() +{ + activeColumn()->selectAll(); +} + bool DolphinColumnView::isIndexHidden(const QModelIndex& index) const { Q_UNUSED(index); -- cgit v1.3