From: Simon Paul St James Date: Tue, 28 Oct 2008 19:47:31 +0000 (+0000) Subject: Yet more corner cases in commitToggleIndexRange - include them, and refactor to make... X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/76376eb22dd1f6414b98ceda142349ec0903a483 Yet more corner cases in commitToggleIndexRange - include them, and refactor to make things a bit more logical. svn path=/trunk/KDE/kdebase/apps/; revision=877164 --- diff --git a/src/dolphindetailsview.cpp b/src/dolphindetailsview.cpp index f21f6ed66..6d9038b46 100644 --- a/src/dolphindetailsview.cpp +++ b/src/dolphindetailsview.cpp @@ -786,22 +786,21 @@ void DolphinDetailsView::updateElasticBandSelection() allItemsInBoundDone || currIndex.parent() != toggleIndexRangeBegin.parent()); if (commitToggleIndexRange) { - if (!allItemsInBoundDone) { + formingToggleIndexRange = false; + // If this is the last item in the bounds and it is also the beginning of a range, + // don't toggle lastIndex - it will already have been dealt with. + if (!allItemsInBoundDone || toggleIndexRangeBegin != currIndex) { 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); - } + // Need to start a new range immediately with currIndex? + if (needToToggleItem) { + toggleIndexRangeBegin = currIndex; + formingToggleIndexRange = true; + } + if (allItemsInBoundDone && needToToggleItem) { + // Toggle the very last item in the bounds. + itemsToToggle.select(currIndex, currIndex); } - formingToggleIndexRange = needToToggleItem; } // next item