┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2010-12-15 17:10:59 +0000
committerPeter Penz <[email protected]>2010-12-15 17:10:59 +0000
commit221059395c44cda970039538fd8ba97a2cd873e0 (patch)
treecb93456cfbd87f9f21700564244ae4f5657b58d0
parent8061c3fb90c787ae76b4d5e213cc7f84ba92f4a4 (diff)
Fix issue that 2 files get deleted in the details-view instead of 1 when Shift+DEL is pressed for a longer time (and the confirmation dialog has been turned off).
BUG: 259656 FIXED-IN: 4.6.0 svn path=/trunk/KDE/kdebase/apps/; revision=1206734
-rw-r--r--src/views/dolphintreeview.cpp19
-rw-r--r--src/views/dolphintreeview.h4
2 files changed, 10 insertions, 13 deletions
diff --git a/src/views/dolphintreeview.cpp b/src/views/dolphintreeview.cpp
index 31c20cd37..698b99f59 100644
--- a/src/views/dolphintreeview.cpp
+++ b/src/views/dolphintreeview.cpp
@@ -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);
}
}
diff --git a/src/views/dolphintreeview.h b/src/views/dolphintreeview.h
index 4eb00c101..dbbc984a6 100644
--- a/src/views/dolphintreeview.h
+++ b/src/views/dolphintreeview.h
@@ -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.