]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Fix issue that wrong directory is shown
authorPeter Penz <peter.penz19@gmail.com>
Mon, 28 Feb 2011 21:04:00 +0000 (22:04 +0100)
committerPeter Penz <peter.penz19@gmail.com>
Mon, 28 Feb 2011 21:07:06 +0000 (22:07 +0100)
Commit 680009b522b2c9eda03201ac02dc18994b5a8bd0 resulted in a regression when switching from a view in the column-mode to a view in the icon- or details-mode: The wrong content has been shown. This patch reverts commit 680009b522b2c9eda03201ac02dc18994b5a8bd0 and solves the performance-issue in combination with previews by triggering the preview-generation in a queued way.

src/views/dolphinview.cpp
src/views/viewextensionsfactory.cpp

index db917ee5a3e8b16774d4081bf9cc26017d5637bf..4ab16e0528a7eb3e4a8ae98c3cc25437c673ad61 100644 (file)
@@ -434,12 +434,8 @@ void DolphinView::refresh()
     m_active = true;
 
     createView();
-    reload();
-
-    // For performance reasons applying the view properties should be done after updating
-    // the directory-lister URL with reload(). Otherwise in combination with enabled
-    // previews the creation of already obsolete directory items gets triggered.
     applyViewProperties();
+    reload();
 
     setActive(oldActivationState);
     updateZoomLevel(oldZoomLevel);
@@ -548,6 +544,7 @@ void DolphinView::setUrl(const KUrl& url)
 
     m_viewModeController->setUrl(url); // emits urlChanged, which we forward
     m_viewAccessor.prepareUrlChange(url);
+    applyViewProperties();
 
     // When changing the URL there is no need to keep the version
     // data of the previous URL.
@@ -557,11 +554,6 @@ void DolphinView::setUrl(const KUrl& url)
     connectViewAccessor();
     loadDirectory(url);
 
-    // For performance reasons applying the view properties should be done after updating
-    // the directory-lister URL with loadDirectory(). Otherwise in combination with enabled
-    // previews the creation of already obsolete directory items gets triggered.
-    applyViewProperties();
-
     if (hadSelection || hasSelection()) {
         emitSelectionChangedSignal();
     }
index 1a395dea9b770eecbc4a8dba69905a9752c514fa..a52871ff447afe1d62c2a1cdc10eed9a51bc82dc 100644 (file)
@@ -73,8 +73,14 @@ ViewExtensionsFactory::ViewExtensionsFactory(QAbstractItemView* view,
             this, SLOT(slotZoomLevelChanged()));
     connect(viewModeController, SIGNAL(cancelPreviews()),
             this, SLOT(cancelPreviews()));
+
+    // slotPreviewChanged() is connected as Qt::QueuedConnection to prevent performance
+    // issues when the directory lister changes its URL after the preview-changes have
+    // been applied. Usecase: Switch from directory A having no previews to
+    // directory B with previews (see sequence in DolphinView::setUrl()).
     connect(dolphinViewController->view(), SIGNAL(showPreviewChanged()),
-            this, SLOT(slotShowPreviewChanged()));
+            this, SLOT(slotShowPreviewChanged()),
+            Qt::QueuedConnection);
 
     // initialize selection manager
     m_selectionManager = new SelectionManager(view);