X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/ecce6e87f8540aa690a2098d89e22b4ab85e325f..e4170c1910ad91fd31bc64edfab17ddc814411d5:/src/dolphindetailsview.cpp diff --git a/src/dolphindetailsview.cpp b/src/dolphindetailsview.cpp index d90527767..886f3f9a6 100644 --- a/src/dolphindetailsview.cpp +++ b/src/dolphindetailsview.cpp @@ -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