]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Sometimes, the penultimate item in the bounds would get deselected when it shouldn...
authorSimon Paul St James <kdedevel@etotheipiplusone.com>
Mon, 27 Oct 2008 21:49:16 +0000 (21:49 +0000)
committerSimon Paul St James <kdedevel@etotheipiplusone.com>
Mon, 27 Oct 2008 21:49:16 +0000 (21:49 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=876724

src/dolphindetailsview.cpp

index a40e6236d8f9320b21e606c5f3e80f59e89dc511..efdead0c7722ce27aa955229d03ddd4c5aa21620 100644 (file)
@@ -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;
        }