]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinmainwindow.cpp
when the column view is used, then 'Split view' should take the root URL of the colum...
[dolphin.git] / src / dolphinmainwindow.cpp
index 5623ba161d06ad6b355e07c68ee38f31fa0a0010..5b7fde6ce24caa77e8a60e25728458d787763416 100644 (file)
 #include <kstandardaction.h>
 #include <kurl.h>
 
-#include <QCloseEvent>
-#include <QClipboard>
-#include <QSplitter>
-#include <QDockWidget>
+#include <QtGui/QKeyEvent>
+#include <QtGui/QClipboard>
+#include <QtGui/QSplitter>
+#include <QtGui/QDockWidget>
 
 DolphinMainWindow::DolphinMainWindow(int id) :
     KXmlGuiWindow(0),
@@ -206,38 +206,19 @@ void DolphinMainWindow::rename(const KUrl& oldUrl, const KUrl& newUrl)
 
 void DolphinMainWindow::refreshViews()
 {
-    const bool split = DolphinSettings::instance().generalSettings()->splitView();
-    const bool isPrimaryViewActive = (m_activeView == m_view[PrimaryIdx]);
-    KUrl url;
-    for (int i = PrimaryIdx; i <= SecondaryIdx; ++i) {
-        if (m_view[i] != 0) {
-            url = m_view[i]->url();
-
-            // delete view instance...
-            m_view[i]->close();
-            m_view[i]->deleteLater();
-            m_view[i] = 0;
-        }
+    Q_ASSERT(m_view[PrimaryIdx] != 0);
 
-        if (split || (i == PrimaryIdx)) {
-            // ... and recreate it
-            ViewProperties props(url);
-            m_view[i] = new DolphinView(this,
-                                        m_splitter,
-                                        url,
-                                        props.viewMode(),
-                                        props.showHiddenFiles());
-            connectViewSignals(i);
-            m_view[i]->reload();
-            m_view[i]->show();
-        }
-    }
+    // remember the current active view, as because of
+    // the refreshing the active view might change to
+    // the secondary view
+    DolphinView* activeView = m_activeView;
 
-    m_activeView = isPrimaryViewActive ? m_view[PrimaryIdx] : m_view[SecondaryIdx];
-    Q_ASSERT(m_activeView != 0);
+    m_view[PrimaryIdx]->refresh();
+    if (m_view[SecondaryIdx] != 0) {
+        m_view[SecondaryIdx]->refresh();
+    }
 
-    updateViewActions();
-    emit activeViewChanged();
+    setActiveView(activeView);
 }
 
 void DolphinMainWindow::changeUrl(const KUrl& url)
@@ -755,7 +736,7 @@ 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);
@@ -769,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.
@@ -779,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();
 }
 
@@ -882,7 +862,7 @@ void DolphinMainWindow::goHome()
 
 void DolphinMainWindow::findFile()
 {
-    KRun::run("kfind", m_activeView->url());
+    KRun::run("kfind", m_activeView->url(), this);
 }
 
 void DolphinMainWindow::compareFiles()
@@ -936,7 +916,7 @@ void DolphinMainWindow::compareFiles()
     command.append("\" \"");
     command.append(urlB.pathOrUrl());
     command.append('\"');
-    KRun::runCommand(command, "Kompare", "kompare");
+    KRun::runCommand(command, "Kompare", "kompare", this);
 
 }
 
@@ -1153,7 +1133,7 @@ void DolphinMainWindow::setupActions()
     connect(sortDescending, SIGNAL(triggered()), this, SLOT(toggleSortOrder()));
 
     KToggleAction* sortCategorized = actionCollection()->add<KToggleAction>("categorized");
-    sortCategorized->setText(i18n("Categorized"));
+    sortCategorized->setText(i18n("Show in Groups"));
     connect(sortCategorized, SIGNAL(triggered()), this, SLOT(toggleSortCategorization()));
 
     KToggleAction* clearInfo = actionCollection()->add<KToggleAction>("clear_info");