From a124b15cfec8da4c16b9c8588bb69a00772a0566 Mon Sep 17 00:00:00 2001 From: Simon Paul St James Date: Mon, 27 Oct 2008 21:49:16 +0000 Subject: [PATCH] Sometimes, the penultimate item in the bounds would get deselected when it shouldn't - this is because lastIndex is always included in the toggle range, even if it needn't be toggled. Fixed now - hopefully, there are no more "elastic band selection" bugs, now :) svn path=/trunk/KDE/kdebase/apps/; revision=876724 --- src/dolphindetailsview.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/dolphindetailsview.cpp b/src/dolphindetailsview.cpp index a40e6236d..efdead0c7 100644 --- a/src/dolphindetailsview.cpp +++ b/src/dolphindetailsview.cpp @@ -742,7 +742,7 @@ void DolphinDetailsView::updateElasticBandSelection() do { QRect currIndexRect = visualRect(currIndex); - const QString name = m_controller->itemForIndex(currIndex).name(); + const QString name = m_controller->itemForIndex(currIndex).name(); currIndexRect.setWidth(DolphinFileItemDelegate::nameColumnWidth(name, viewOptions())); // Update some optimisation info as we go. @@ -783,10 +783,20 @@ void DolphinDetailsView::updateElasticBandSelection() allItemsInBoundDone || currIndex.parent() != toggleIndexRangeBegin.parent()); if (commitToggleIndexRange) { - itemsToToggle.select(toggleIndexRangeBegin, lastIndex ); - // Immediately start a new range with currIndex? - if (needToToggleItem) { - toggleIndexRangeBegin = currIndex; + if (!allItemsInBoundDone) { + itemsToToggle.select(toggleIndexRangeBegin, lastIndex); + // Need to start a new range immediately with currIndex? + if (needToToggleItem) + toggleIndexRangeBegin = currIndex; + } + else { + // Final item in the bounds. Is it also the beginning of a range? + if (toggleIndexRangeBegin == currIndex) { + itemsToToggle.select(currIndex, currIndex); + } + else { + itemsToToggle.select(toggleIndexRangeBegin, lastIndex); + } } formingToggleIndexRange = needToToggleItem; } -- 2.47.3