]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/views/dolphinview.cpp
Don't trigger assert when switching to details-view
[dolphin.git] / src / views / dolphinview.cpp
index 16163c8e91301aadfcf34a336820938944b2d5b1..54787d28fda0808c529f2332c86b06f0536d4690 100644 (file)
@@ -830,10 +830,13 @@ void DolphinView::slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* even
 {
     KUrl destUrl;
     KFileItem destItem = fileItemModel()->fileItem(index);
-    if (destItem.isNull()) {
+    if (destItem.isNull() || (!destItem.isDir() && !destItem.isDesktopFile())) {
+        // Use the URL of the view as drop target if the item is no directory
+        // or desktop-file
         destItem = fileItemModel()->rootItem();
         destUrl = url();
     } else {
+        // The item represents a directory or desktop-file
         destUrl = destItem.url();
     }
 
@@ -1165,19 +1168,6 @@ void DolphinView::applyViewProperties()
 
     const Mode mode = props.viewMode();
     if (m_mode != mode) {
-        // Prevent an animated transition of the position and size of the items when switching
-        // the view-mode by temporary clearing the model and updating it again after the view mode
-        // has been modified.
-        const bool restoreModel = (model->count() > 0);
-        if (restoreModel) {
-            const int currentItemIndex = m_container->controller()->selectionManager()->currentItem();
-            if (currentItemIndex >= 0) {
-                m_currentItemUrl = model->fileItem(currentItemIndex).url();
-            }
-            m_selectedUrls = selectedItems().urlList();
-            model->clear();
-        }
-
         const Mode previousMode = m_mode;
         m_mode = mode;
 
@@ -1198,10 +1188,6 @@ void DolphinView::applyViewProperties()
         if (m_container->zoomLevel() != oldZoomLevel) {
             emit zoomLevelChanged(m_container->zoomLevel(), oldZoomLevel);
         }
-
-        if (restoreModel) {
-            loadDirectory(url());
-        }
     }
 
     const bool hiddenFilesShown = props.hiddenFilesShown();