]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Fix issue that 2 files get deleted in the details-view instead of 1 when Shift+DEL...
authorPeter Penz <peter.penz19@gmail.com>
Wed, 15 Dec 2010 17:10:59 +0000 (17:10 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Wed, 15 Dec 2010 17:10:59 +0000 (17:10 +0000)
BUG: 259656
FIXED-IN: 4.6.0

svn path=/trunk/KDE/kdebase/apps/; revision=1206734

src/views/dolphintreeview.cpp
src/views/dolphintreeview.h

index 31c20cd37e098d6ee6d263147431c402996fc59f..698b99f591dfeade103ac29a31a835c27cc44525 100644 (file)
@@ -31,7 +31,7 @@
 
 DolphinTreeView::DolphinTreeView(QWidget* parent) :
     QTreeView(parent),
-    m_keyPressed(false),
+    m_updateCurrentIndex(false),
     m_expandingTogglePressed(false),
     m_useDefaultIndexAt(true),
     m_ignoreScrollTo(false),
@@ -75,7 +75,7 @@ bool DolphinTreeView::event(QEvent* event)
         // If a key-press triggers an action that e. g. opens a dialog, the
         // widget gets no key-release event. Assure that the pressed state
         // is reset to prevent accidently setting the current index during a selection.
-        m_keyPressed = false;
+        m_updateCurrentIndex = false;
         break;
     default:
         break;
@@ -239,27 +239,24 @@ void DolphinTreeView::paintEvent(QPaintEvent* event)
 
 void DolphinTreeView::keyPressEvent(QKeyEvent* event)
 {
-    // If the Control modifier is pressed, a multiple selection
-    // is done and DolphinDetailsView::currentChanged() may not
-    // not change the selection in a custom way.
-    m_keyPressed = !(event->modifiers() & Qt::ControlModifier);
-
+    // See DolphinTreeView::currentChanged() for more information about m_updateCurrentIndex
+    m_updateCurrentIndex = (event->modifiers() == Qt::NoModifier);
     QTreeView::keyPressEvent(event);
 }
 
 void DolphinTreeView::keyReleaseEvent(QKeyEvent* event)
 {
     QTreeView::keyReleaseEvent(event);
-    m_keyPressed = false;
+    m_updateCurrentIndex = false;
 }
 
 void DolphinTreeView::currentChanged(const QModelIndex& current, const QModelIndex& previous)
 {
     QTreeView::currentChanged(current, previous);
 
-    // Stay consistent with QListView: When changing the current index by key presses,
-    // also change the selection.
-    if (m_keyPressed) {
+    // Stay consistent with QListView: When changing the current index by key presses
+    // without modifiers, also change the selection.
+    if (m_updateCurrentIndex) {
         setCurrentIndex(current);
     }
 }
index 4eb00c1011539f5889b65c3579005300c1f108d6..dbbc984a6fef076d593977b194e4799c2253d3ba 100644 (file)
@@ -43,7 +43,7 @@ public:
     virtual QModelIndex indexAt (const QPoint& point) const;
     virtual QRegion visualRegionForSelection(const QItemSelection& selection) const;
 
-protected:   
+protected:
     /**
      * @return True, if the item with the index \p index accepts a drop. In this
      *         case a visual feedback for the user is given during dragging. Per
@@ -95,7 +95,7 @@ private:
     bool isAboveExpandingToggle(const QPoint& pos) const;
 
 private:
-    bool m_keyPressed;        // true if a key is pressed currently; info used by currentChanged()
+    bool m_updateCurrentIndex;
     bool m_expandingTogglePressed;
     bool m_useDefaultIndexAt; // true, if QTreeView::indexAt() should be used
     bool m_ignoreScrollTo;    // true if calls to scrollTo(...) should do nothing.