]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinmainwindow.cpp
create modal dialogs on stack as David suggested
[dolphin.git] / src / dolphinmainwindow.cpp
index ffe1c4e8e646a8888d48bcf241dd0c216a484e2e..59fc84af33dc4e3043a1a84906538037187ef82d 100644 (file)
  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
  ***************************************************************************/
 
-#include <config-kmetadata.h>
 #include "dolphinmainwindow.h"
 
+#include <config-kmetadata.h>
+
 #include "dolphinapplication.h"
 #include "dolphinnewmenu.h"
 #include "dolphinsettings.h"
@@ -207,11 +208,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)
@@ -346,6 +354,11 @@ void DolphinMainWindow::slotSelectionChanged(const KFileItemList& selection)
     emit selectionChanged(selection);
 }
 
+void DolphinMainWindow::slotRequestItemInfo(const KUrl& url)
+{
+    emit requestItemInfo(url);
+}
+
 void DolphinMainWindow::slotHistoryChanged()
 {
     updateHistory();
@@ -445,7 +458,8 @@ void DolphinMainWindow::deleteItems()
 void DolphinMainWindow::properties()
 {
     const KFileItemList list = m_activeView->selectedItems();
-    new KPropertiesDialog(list, this);
+    KPropertiesDialog dialog(list, this);
+    dialog.exec();
 }
 
 void DolphinMainWindow::quit()
@@ -729,11 +743,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 +757,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 +766,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();
 }
 
@@ -1241,6 +1254,8 @@ void DolphinMainWindow::setupDockWidgets()
             infoWidget, SLOT(setUrl(KUrl)));
     connect(this, SIGNAL(selectionChanged(KFileItemList)),
             infoWidget, SLOT(setSelection(KFileItemList)));
+    connect(this, SIGNAL(requestItemInfo(KUrl)),
+            infoWidget, SLOT(requestDelayedItemInfo(KUrl)));
 
     // setup "Tree View"
     QDockWidget* treeViewDock = new QDockWidget(i18n("Folders"));
@@ -1455,6 +1470,8 @@ void DolphinMainWindow::connectViewSignals(int viewIndex)
             this, SLOT(slotAdditionalInfoChanged(KFileItemDelegate::AdditionalInformation)));
     connect(view, SIGNAL(selectionChanged(KFileItemList)),
             this, SLOT(slotSelectionChanged(KFileItemList)));
+    connect(view, SIGNAL(requestItemInfo(KUrl)),
+            this, SLOT(slotRequestItemInfo(KUrl)));
     connect(view, SIGNAL(showFilterBarChanged(bool)),
             this, SLOT(updateFilterBarAction(bool)));
     connect(view, SIGNAL(urlChanged(KUrl)),