┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphindetailsview.cpp
diff options
context:
space:
mode:
authorSimon Paul St James <[email protected]>2008-10-27 20:55:54 +0000
committerSimon Paul St James <[email protected]>2008-10-27 20:55:54 +0000
commitad647bd0a050a54a2db4c15e363d2f0143f6d34e (patch)
tree8caf4c5795099819fedb80d33c5803e75fc0e604 /src/dolphindetailsview.cpp
parent75480d07cd820c75ca418b990d3059f154bbdf6e (diff)
Restore behaviour (I don't have an old version to check against, though!) - if CTRL is pressed when initiating elastic band, respect the item selection at that time while dragging the band.
CCMAIL : [email protected] svn path=/trunk/KDE/kdebase/apps/; revision=876690
Diffstat (limited to 'src/dolphindetailsview.cpp')
-rw-r--r--src/dolphindetailsview.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/dolphindetailsview.cpp b/src/dolphindetailsview.cpp
index 8aff93bfa..a40e6236d 100644
--- a/src/dolphindetailsview.cpp
+++ b/src/dolphindetailsview.cpp
@@ -245,6 +245,7 @@ void DolphinDetailsView::mousePressEvent(QMouseEvent* event)
const QPoint scrollPos(horizontalScrollBar()->value(), verticalScrollBar()->value());
m_band.origin = event->pos() + pos + scrollPos;
m_band.destination = m_band.origin;
+ m_band.originalSelection = selectionModel()->selection();
}
}
}
@@ -655,7 +656,7 @@ void DolphinDetailsView::updateElasticBandSelection()
selRect = nameColumnRect.intersect(selRect).normalized();
if (selRect.isNull()) {
- clearSelection();
+ selectionModel()->select(m_band.originalSelection, QItemSelectionModel::ClearAndSelect);
m_band.ignoreOldInfo = true;
return;
}
@@ -718,7 +719,7 @@ void DolphinDetailsView::updateElasticBandSelection()
startIndex = model()->index(startIndex.row(), KDirModel::Name);
}
if (!startIndex.isValid()) {
- clearSelection();
+ selectionModel()->select(m_band.originalSelection, QItemSelectionModel::ClearAndSelect);
m_band.ignoreOldInfo = true;
return;
}
@@ -764,8 +765,10 @@ void DolphinDetailsView::updateElasticBandSelection()
}
bool currentlySelected = selectionModel()->isSelected(currIndex);
+ bool originallySelected = m_band.originalSelection.contains(currIndex);
bool intersectsSelectedRect = currIndexRect.intersects(selRect);
- bool needToToggleItem = (currentlySelected && !intersectsSelectedRect) || (!currentlySelected && intersectsSelectedRect);
+ bool shouldBeSelected = (intersectsSelectedRect && !originallySelected) || (!intersectsSelectedRect && originallySelected);
+ bool needToToggleItem = (currentlySelected && !shouldBeSelected) || (!currentlySelected && shouldBeSelected);
if (needToToggleItem && !formingToggleIndexRange) {
toggleIndexRangeBegin = currIndex;
formingToggleIndexRange = true;