]> cloud.milkyroute.net Git - dolphin.git/commitdiff
when the column view is used, then 'Split view' should take the root URL of the colum...
authorPeter Penz <peter.penz19@gmail.com>
Thu, 17 May 2007 13:29:13 +0000 (13:29 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Thu, 17 May 2007 13:29:13 +0000 (13:29 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=665630

src/dolphinmainwindow.cpp
src/dolphinview.cpp
src/dolphinview.h

index ffe1c4e8e646a8888d48bcf241dd0c216a484e2e..5b7fde6ce24caa77e8a60e25728458d787763416 100644 (file)
@@ -207,11 +207,18 @@ void DolphinMainWindow::rename(const KUrl& oldUrl, const KUrl& newUrl)
 void DolphinMainWindow::refreshViews()
 {
     Q_ASSERT(m_view[PrimaryIdx] != 0);
-    m_view[PrimaryIdx]->refresh();
 
+    // remember the current active view, as because of
+    // the refreshing the active view might change to
+    // the secondary view
+    DolphinView* activeView = m_activeView;
+
+    m_view[PrimaryIdx]->refresh();
     if (m_view[SecondaryIdx] != 0) {
         m_view[SecondaryIdx]->refresh();
     }
+
+    setActiveView(activeView);
 }
 
 void DolphinMainWindow::changeUrl(const KUrl& url)
@@ -729,11 +736,11 @@ void DolphinMainWindow::toggleSplitView()
         // create a secondary view
         m_view[SecondaryIdx] = new DolphinView(this,
                                                0,
-                                               m_view[PrimaryIdx]->url(),
+                                               m_view[PrimaryIdx]->rootUrl(),
                                                m_view[PrimaryIdx]->mode(),
                                                m_view[PrimaryIdx]->showHiddenFiles());
         connectViewSignals(SecondaryIdx);
-        m_splitter->insertWidget(0, m_view[SecondaryIdx]);
+        m_splitter->addWidget(m_view[SecondaryIdx]);
         m_splitter->setSizes(QList<int>() << newWidth << newWidth);
         m_view[SecondaryIdx]->reload();
         m_view[SecondaryIdx]->show();
@@ -743,7 +750,6 @@ void DolphinMainWindow::toggleSplitView()
             m_view[SecondaryIdx]->close();
             m_view[SecondaryIdx]->deleteLater();
             m_view[SecondaryIdx] = 0;
-            setActiveView(m_view[PrimaryIdx]);
         } else {
             // The secondary view is active, hence from the users point of view
             // the content of the secondary view should be moved to the primary view.
@@ -753,9 +759,9 @@ void DolphinMainWindow::toggleSplitView()
             delete m_view[PrimaryIdx];
             m_view[PrimaryIdx] = m_view[SecondaryIdx];
             m_view[SecondaryIdx] = 0;
-            setActiveView(m_view[PrimaryIdx]);
         }
     }
+    setActiveView(m_view[PrimaryIdx]);
     emit activeViewChanged();
 }
 
index 652274d63b6a979daf5cf26791c722ef8c4b00a6..d33ed3eba5b7856486ff9c73c5725c913e3cce76 100644 (file)
@@ -197,6 +197,11 @@ const KUrl& DolphinView::url() const
     return m_urlNavigator->url();
 }
 
+KUrl DolphinView::rootUrl() const
+{
+    return isColumnViewActive() ? m_dirLister->url() : url();
+}
+
 bool DolphinView::isActive() const
 {
     return m_mainWindow->activeView() == this;
index 96b4879619b8f4b0b061df08113aae4f1316088b..0ac116fabc8bb0eec515393c4e914d3f0fe42b8c 100644 (file)
@@ -120,15 +120,31 @@ public:
     virtual ~DolphinView();
 
     /**
-     * Sets the current active URL.
-     * The signals KUrlNavigator::urlChanged() and KUrlNavigator::historyChanged()
+     * Sets the current active URL, where all actions are applied. The
+     * URL navigator is synchronized with this URL. The signals
+     * KUrlNavigator::urlChanged() and KUrlNavigator::historyChanged()
      * are emitted.
+     * @see DolphinView::urlNavigator()
      */
     void setUrl(const KUrl& url);
 
-    /** Returns the current active URL. */
+    /**
+     * Returns the current active URL, where all actions are applied.
+     * The URL navigator is synchronized with this URL.
+     */
     const KUrl& url() const;
 
+    /**
+     * Returns the root URL of the view, which is defined as the first
+     * visible path of DolphinView::url(). Usually the root URL is
+     * equal to DolphinView::url(), but in the case of the column view
+     * when 2 columns are shown, the root URL might be:
+     * /home/peter/Documents
+     * and DolphinView::url() might return
+     * /home/peter/Documents/Music/
+     */
+    KUrl rootUrl() const;
+
     /**
      * Returns true if the view is active and hence all actions are
      * applied to this view.