X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/023ab306c78f305866932e6e9cbb8e96acb69493..c8d8556950005dfd96ebdb41d2f43ad90356367c:/src/views/dolphinview.cpp diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index 0edcb2894..a31bf566d 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -311,11 +311,8 @@ KFileItemList DolphinView::selectedItems() const const KItemListSelectionManager* selectionManager = m_container->controller()->selectionManager(); const QSet selectedIndexes = selectionManager->selectedItems(); - QList sortedIndexes = selectedIndexes.toList(); - qSort(sortedIndexes); - KFileItemList selectedItems; - QListIterator it(sortedIndexes); + QSetIterator it(selectedIndexes); while (it.hasNext()) { const int index = it.next(); selectedItems.append(model->fileItem(index)); @@ -815,7 +812,14 @@ void DolphinView::slotItemUnhovered(int index) void DolphinView::slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* event) { - const KFileItem destItem = fileItemModel()->fileItem(index); + KFileItem destItem = fileItemModel()->fileItem(index); + if (destItem.isNull()) { + destItem = fileItemModel()->rootItem(); + if (destItem.isNull()) { + kWarning() << "No destination item available for drop operation."; + return; + } + } QDropEvent dropEvent(event->pos().toPoint(), event->possibleActions(), @@ -823,7 +827,7 @@ void DolphinView::slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* even event->buttons(), event->modifiers()); - const QString error = DragAndDropHelper::dropUrls(destItem, url(), &dropEvent); + const QString error = DragAndDropHelper::dropUrls(destItem, &dropEvent); if (!error.isEmpty()) { emit errorMessage(error); }