]> cloud.milkyroute.net Git - dolphin.git/commitdiff
* Fix triggering an assertion when the elastic band is already hidden.
authorPeter Penz <peter.penz19@gmail.com>
Sat, 2 Jun 2007 15:03:03 +0000 (15:03 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Sat, 2 Jun 2007 15:03:03 +0000 (15:03 +0000)
* Assure that the selection gets cleared if a click on the viewport is done.

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

src/dolphindetailsview.cpp

index 998d3c87085800062acaa4a3780c6503ee1f732b..961fb15a3c3f1e6c6a8999c1545a23f38535a929 100644 (file)
@@ -30,6 +30,7 @@
 #include <kdirmodel.h>
 #include <kfileitemdelegate.h>
 
+#include <QApplication>
 #include <QHeaderView>
 #include <QRubberBand>
 #include <QPainter>
@@ -154,6 +155,13 @@ void DolphinDetailsView::contextMenuEvent(QContextMenuEvent* event)
 
 void DolphinDetailsView::mousePressEvent(QMouseEvent* event)
 {
+    if (!indexAt(event->pos()).isValid()) {
+        const Qt::KeyboardModifiers modifier = QApplication::keyboardModifiers();
+        if (!(modifier & Qt::ShiftModifier) && !(modifier & Qt::ControlModifier)) {
+            clearSelection();
+        }
+    }
+
     QTreeView::mousePressEvent(event);
 
     if (event->button() == Qt::LeftButton) {
@@ -178,8 +186,10 @@ void DolphinDetailsView::mouseMoveEvent(QMouseEvent* event)
 void DolphinDetailsView::mouseReleaseEvent(QMouseEvent* event)
 {
     QTreeView::mouseReleaseEvent(event);
-    updateElasticBand();
-    m_showElasticBand = false;
+    if (m_showElasticBand) {
+        updateElasticBand();
+        m_showElasticBand = false;
+    }
     m_controller->triggerActivation();
 }
 
@@ -188,8 +198,11 @@ void DolphinDetailsView::dragEnterEvent(QDragEnterEvent* event)
     if (event->mimeData()->hasUrls()) {
         event->acceptProposedAction();
     }
-    updateElasticBand();
-    m_showElasticBand = false;
+
+    if (m_showElasticBand) {
+        updateElasticBand();
+        m_showElasticBand = false;
+    }
 }
 
 void DolphinDetailsView::dropEvent(QDropEvent* event)