┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2007-08-06 16:09:06 +0000
committerPeter Penz <[email protected]>2007-08-06 16:09:06 +0000
commite3b4cb83153ab959a5c8620ecc14be5a69511b1c (patch)
tree707b3625c6d8076e89dd719ce21f7068b391299e
parent0111d9b0a02098065a32b34c9b04fde72addb626 (diff)
* toggle selection when using CTRL modifier
* assure that the selection model of the column is synchronized when triggering "Select All" or "Invert Selection" svn path=/trunk/KDE/kdebase/apps/; revision=697029
-rw-r--r--src/dolphincolumnview.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/dolphincolumnview.cpp b/src/dolphincolumnview.cpp
index ee7fb52aa..99a5fea7e 100644
--- a/src/dolphincolumnview.cpp
+++ b/src/dolphincolumnview.cpp
@@ -239,8 +239,7 @@ void ColumnWidget::mousePressEvent(QMouseEvent* event)
bool swallowMousePressEvent = false;
const QModelIndex index = indexAt(event->pos());
if (index.isValid()) {
- // A click on an item has been done. Only request an activation
- // if the item is not a directory.
+ // a click on an item has been done
const QAbstractProxyModel* proxyModel = static_cast<const QAbstractProxyModel*>(m_view->model());
const KDirModel* dirModel = static_cast<const KDirModel*>(proxyModel->sourceModel());
const QModelIndex dirIndex = proxyModel->mapToSource(index);
@@ -251,7 +250,7 @@ void ColumnWidget::mousePressEvent(QMouseEvent* event)
const Qt::KeyboardModifiers modifier = QApplication::keyboardModifiers();
if (modifier & Qt::ControlModifier) {
m_view->requestActivation(this);
- selModel->select(index, QItemSelectionModel::Select);
+ selModel->select(index, QItemSelectionModel::Toggle);
swallowMousePressEvent = true;
} else if (item->isDir()) {
m_childUrl = item->url();
@@ -635,13 +634,27 @@ void DolphinColumnView::selectActiveColumn(QItemSelectionModel::SelectionFlags f
// possible to speedup the implementation by using QItemSelection, but all adempts
// have failed yet...
+ // assure that the selection model of the active column is set properly, otherwise
+ // no visual update of the selections is done
+ const KUrl& activeUrl = m_controller->url();
+ foreach (QObject* object, viewport()->children()) {
+ if (object->inherits("QListView")) {
+ ColumnWidget* widget = static_cast<ColumnWidget*>(object);
+ if (widget->url() == activeUrl) {
+ widget->obtainSelectionModel();
+ } else {
+ widget->releaseSelectionModel();
+ }
+ }
+ }
+
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());
+ const KFileItemList list = dirLister->itemsForDir(activeUrl);
foreach (KFileItem* item, list) {
const QModelIndex index = dirModel->indexForUrl(item->url());
selModel->select(proxyModel->mapFromSource(index), flags);