]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphindetailsview.cpp
Improve performance
[dolphin.git] / src / dolphindetailsview.cpp
index d9052776774a8f759dcba247ebc13371161a7cce..886f3f9a66637a69b338e58793e08c5d91039302 100644 (file)
@@ -207,10 +207,13 @@ void DolphinDetailsView::mouseMoveEvent(QMouseEvent* event)
             // case QTreeView does no selection at all, which is not the wanted behavior
             // in Dolphin -> select all items within the elastic band rectangle
             clearSelection();
-            if (mousePos.x() < header()->sectionSize(DolphinModel::Name)) {
-                setSelection(QRect(m_elasticBandOrigin, m_elasticBandDestination),
-                             QItemSelectionModel::Select);
-            }
+
+            const int nameColumnWidth = header()->sectionSize(DolphinModel::Name);
+            QRect selRect = QRect(m_elasticBandOrigin, m_elasticBandDestination).normalized();
+            const QRect nameColumnsRect(0, 0, nameColumnWidth, viewport()->height());
+            selRect = nameColumnsRect.intersected(selRect);
+
+            setSelection(selRect, QItemSelectionModel::Select);
         }
 
         QTreeView::mouseMoveEvent(event);
@@ -275,6 +278,11 @@ void DolphinDetailsView::dragMoveEvent(QDragMoveEvent* event)
         }
         setDirtyRegion(m_dropRect);
     }
+
+    if (event->mimeData()->hasUrls()) {
+        // accept url drops, independently from the destination item
+        event->acceptProposedAction();
+    }
 }
 
 void DolphinDetailsView::dropEvent(QDropEvent* event)
@@ -317,7 +325,7 @@ void DolphinDetailsView::paintEvent(QPaintEvent* event)
     // TODO: remove this code when the issue #160611 is solved in Qt 4.4
     if (m_dragging) {
         const QBrush& brush = viewOptions().palette.brush(QPalette::Normal, QPalette::Highlight);
-        DragAndDropHelper::drawHoverIndication(viewport(), m_dropRect, brush);
+        DragAndDropHelper::drawHoverIndication(this, m_dropRect, brush);
     }
 }
 
@@ -399,11 +407,12 @@ void DolphinDetailsView::slotEntered(const QModelIndex& index)
 
 void DolphinDetailsView::updateElasticBand()
 {
-    Q_ASSERT(m_showElasticBand);
-    QRect dirtyRegion(elasticBandRect());
-    m_elasticBandDestination = viewport()->mapFromGlobal(QCursor::pos());
-    dirtyRegion = dirtyRegion.united(elasticBandRect());
-    setDirtyRegion(dirtyRegion);
+    if (m_showElasticBand) {
+        QRect dirtyRegion(elasticBandRect());
+        m_elasticBandDestination = viewport()->mapFromGlobal(QCursor::pos());
+        dirtyRegion = dirtyRegion.united(elasticBandRect());
+        setDirtyRegion(dirtyRegion);
+    }
 }
 
 QRect DolphinDetailsView::elasticBandRect() const