]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/views/dolphinview.cpp
Fix "general settings" issues
[dolphin.git] / src / views / dolphinview.cpp
index 0edcb2894462923fa868d7fce06da47afe84a31e..83d80012cbca8c36b8da3dfa489a5894c218f45c 100644 (file)
@@ -137,9 +137,6 @@ DolphinView::DolphinView(const KUrl& url, QWidget* parent) :
 
     KItemListController* controller = m_container->controller();
     controller->setSelectionBehavior(KItemListController::MultiSelection);
-    if (GeneralSettings::autoExpandFolders()) {
-        controller->setAutoActivationDelay(750);
-    }
     connect(controller, SIGNAL(itemActivated(int)), this, SLOT(slotItemActivated(int)));
     connect(controller, SIGNAL(itemsActivated(QSet<int>)), this, SLOT(slotItemsActivated(QSet<int>)));
     connect(controller, SIGNAL(itemMiddleClicked(int)), this, SLOT(slotItemMiddleClicked(int)));
@@ -311,11 +308,8 @@ KFileItemList DolphinView::selectedItems() const
     const KItemListSelectionManager* selectionManager = m_container->controller()->selectionManager();
     const QSet<int> selectedIndexes = selectionManager->selectedItems();
 
-    QList<int> sortedIndexes = selectedIndexes.toList();
-    qSort(sortedIndexes);
-
     KFileItemList selectedItems;
-    QListIterator<int> it(sortedIndexes);
+    QSetIterator<int> it(selectedIndexes);
     while (it.hasNext()) {
         const int index = it.next();
         selectedItems.append(model->fileItem(index));
@@ -815,7 +809,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 +824,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);
     }