]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinview.cpp
further root URL handling cleanups
[dolphin.git] / src / dolphinview.cpp
index 69d7706d335535b87c9ae0cde413dd19a0a0530c..91a41b531b664e53c74878c774da1441bf60cdc6 100644 (file)
@@ -71,8 +71,7 @@ DolphinView::DolphinView(QWidget* parent,
     m_fileItemDelegate(0),
     m_dolphinModel(dolphinModel),
     m_dirLister(dirLister),
-    m_proxyModel(proxyModel),
-    m_rootUrl(url)
+    m_proxyModel(proxyModel)
 {
     setFocusPolicy(Qt::StrongFocus);
     m_topLayout = new QVBoxLayout(this);
@@ -122,11 +121,6 @@ const KUrl& DolphinView::url() const
     return m_controller->url();
 }
 
-void DolphinView::setRootUrl(const KUrl& url)
-{
-    m_rootUrl = url;
-}
-
 KUrl DolphinView::rootUrl() const
 {
     return isColumnViewActive() ? m_dirLister->url() : url();
@@ -414,39 +408,37 @@ void DolphinView::refresh()
     updateViewportColor();
 }
 
-void DolphinView::setUrl(const KUrl& url)
+void DolphinView::updateView(const KUrl& url, const KUrl& rootUrl)
 {
     if (m_controller->url() == url) {
         return;
     }
 
-    const KUrl oldRootUrl = rootUrl();
+    const bool restoreColumnView = !isColumnViewActive()
+                                    && !rootUrl.isEmpty()
+                                    && !rootUrl.equals(url, KUrl::CompareWithoutTrailingSlash)
+                                    && rootUrl.isParentOf(url);
+
     m_controller->setUrl(url); // emits urlChanged, which we forward
 
-    bool useUrlProperties = true;
-    const bool restoreColumnView = !isColumnViewActive()
-                                   && m_rootUrl.isParentOf(url)
-                                   && (m_rootUrl != url);
     if (restoreColumnView) {
-        applyViewProperties(m_rootUrl);
-        if (itemView() == m_columnView) {
-            startDirLister(m_rootUrl);
-            m_columnView->showColumn(url);
-            useUrlProperties = false;
-        }
-    }
-
-    if (useUrlProperties) {
+        applyViewProperties(rootUrl);
+        Q_ASSERT(itemView() == m_columnView);
+        startDirLister(rootUrl);
+        m_columnView->showColumn(url);
+    } else {
         applyViewProperties(url);
         startDirLister(url);
     }
 
     itemView()->setFocus();
 
-    const KUrl newRootUrl = rootUrl();
-    if (newRootUrl != oldRootUrl) {
-        emit rootUrlChanged(newRootUrl);
-    }
+    emit startedPathLoading(url);
+}
+
+void DolphinView::setUrl(const KUrl& url)
+{
+    updateView(url, KUrl());
 }
 
 void DolphinView::mouseReleaseEvent(QMouseEvent* event)