┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphincolumnview.cpp
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2007-08-06 06:56:36 +0000
committerPeter Penz <[email protected]>2007-08-06 06:56:36 +0000
commit0111d9b0a02098065a32b34c9b04fde72addb626 (patch)
tree3b1a90884fcb505d1a9250ba28cf5918a3d2cf74 /src/dolphincolumnview.cpp
parent1fbb2359d3370596f2c400f98a4b0af74740848e (diff)
Fixed 'Select All' and 'Invert Selection' for the column view (only the items of the currently active column will be selected, not the whole tree). The current implementation is quite slow, but this will be fixed later.
svn path=/trunk/KDE/kdebase/apps/; revision=696893
Diffstat (limited to 'src/dolphincolumnview.cpp')
-rw-r--r--src/dolphincolumnview.cpp32
1 files changed, 31 insertions, 1 deletions
diff --git a/src/dolphincolumnview.cpp b/src/dolphincolumnview.cpp
index f4a5ef19a..ee7fb52aa 100644
--- a/src/dolphincolumnview.cpp
+++ b/src/dolphincolumnview.cpp
@@ -173,6 +173,7 @@ void ColumnWidget::obtainSelectionModel()
if (selectionModel() != m_view->selectionModel()) {
selectionModel()->deleteLater();
setSelectionModel(m_view->selectionModel());
+ clearSelection();
}
}
@@ -428,6 +429,16 @@ DolphinColumnView::~DolphinColumnView()
{
}
+void DolphinColumnView::invertSelection()
+{
+ selectActiveColumn(QItemSelectionModel::Toggle);
+}
+
+void DolphinColumnView::selectAll()
+{
+ selectActiveColumn(QItemSelectionModel::Select);
+}
+
QAbstractItemView* DolphinColumnView::createColumn(const QModelIndex& index)
{
// let the column widget be aware about its URL...
@@ -598,7 +609,7 @@ void DolphinColumnView::requestActivation(QWidget* column)
const bool isActive = (widget == column);
widget->setActive(isActive);
if (isActive) {
- m_controller->setUrl(widget->url());
+ m_controller->setUrl(widget->url());
}
}
}
@@ -618,4 +629,23 @@ void DolphinColumnView::requestSelectionModel(QAbstractItemView* view)
}
}
+void DolphinColumnView::selectActiveColumn(QItemSelectionModel::SelectionFlags flags)
+{
+ // TODO: this approach of selecting the active column is very slow. It should be
+ // possible to speedup the implementation by using QItemSelection, but all adempts
+ // have failed yet...
+
+ QItemSelectionModel* selModel = selectionModel();
+
+ const QAbstractProxyModel* proxyModel = static_cast<const QAbstractProxyModel*>(model());
+ const KDirModel* dirModel = static_cast<const KDirModel*>(proxyModel->sourceModel());
+ KDirLister* dirLister = dirModel->dirLister();
+
+ const KFileItemList list = dirLister->itemsForDir(m_controller->url());
+ foreach (KFileItem* item, list) {
+ const QModelIndex index = dirModel->indexForUrl(item->url());
+ selModel->select(proxyModel->mapFromSource(index), flags);
+ }
+}
+
#include "dolphincolumnview.moc"