]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinmainwindow.cpp
Merge remote-tracking branch 'origin/KDE/4.9'
[dolphin.git] / src / dolphinmainwindow.cpp
index 73f18bdaa1be4f4e5ae57b7de39cc6104def3fb0..11e03d0f11f95d02774175935debf8e256c479d8 100644 (file)
 
 #include "dolphinmainwindow.h"
 
-#include <config-nepomuk.h>
-
 #include "dolphinapplication.h"
 #include "dolphindockwidget.h"
 #include "dolphincontextmenu.h"
 #include "dolphinnewfilemenu.h"
 #include "dolphinviewcontainer.h"
-#ifdef HAVE_NEPOMUK
-    #include "panels/search/searchpanel.h"
-    #include <Nepomuk/ResourceManager>
-#endif
 #include "panels/folders/folderspanel.h"
 #include "panels/places/placespanel.h"
 #include "panels/information/informationpanel.h"
-#include "search/dolphinsearchbox.h"
-#include "search/dolphinsearchinformation.h"
-#include "settings/dolphinsettings.h"
 #include "settings/dolphinsettingsdialog.h"
 #include "statusbar/dolphinstatusbar.h"
 #include "views/dolphinviewactionhandler.h"
 #include "views/dolphinremoteencoding.h"
+#include "views/draganddrophelper.h"
 #include "views/viewproperties.h"
 
 #ifndef Q_OS_WIN
@@ -49,8 +41,6 @@
 #endif
 
 #include "dolphin_generalsettings.h"
-#include "dolphin_iconsmodesettings.h"
-#include "dolphin_searchsettings.h"
 
 #include <KAcceleratorManager>
 #include <KAction>
 #include <kdeversion.h>
 #include <kdualaction.h>
 #include <KFileDialog>
-#include <KFilePlacesModel>
 #include <KGlobal>
 #include <KLineEdit>
 #include <KToolBar>
 #include <KIcon>
 #include <KIconLoader>
 #include <KIO/NetAccess>
+#include <KIO/JobUiDelegate>
 #include <KInputDialog>
 #include <KLocale>
 #include <KProtocolManager>
 #include <QToolButton>
 #include <QSplitter>
 
-/*
- * Menu shown when pressing the configure-button in the toolbar.
- */
-class ToolBarMenu : public KMenu
-{
-public:
-    ToolBarMenu(QWidget* parent);
-    virtual ~ToolBarMenu();
-protected:
-    virtual void showEvent(QShowEvent* event);
+namespace {
+    // Used for GeneralSettings::version() to determine whether
+    // an updated version of Dolphin is running.
+    const int CurrentDolphinVersion = 200;
 };
 
 /*
@@ -132,11 +116,9 @@ DolphinMainWindow::DolphinMainWindow() :
     m_actionHandler(0),
     m_remoteEncoding(0),
     m_settingsDialog(),
-    m_toolBarSpacer(0),
-    m_openToolBarMenuButton(0),
+    m_controlButton(0),
     m_updateToolBarTimer(0),
-    m_lastHandleUrlStatJob(0),
-    m_searchDockIsTemporaryVisible(false)
+    m_lastHandleUrlStatJob(0)
 {
     // Workaround for a X11-issue in combination with KModifierInfo
     // (see DolphinContextMenu::initializeModifierKeyInfo() for
@@ -146,6 +128,8 @@ DolphinMainWindow::DolphinMainWindow() :
     setObjectName("Dolphin#");
 
     m_viewTab.append(ViewTab());
+    ViewTab& viewTab = m_viewTab[m_tabIndex];
+    viewTab.wasActive = true; // The first opened tab is automatically active
 
     KIO::FileUndoManager* undoManager = KIO::FileUndoManager::self();
     undoManager->setUiInterface(new UndoUiInterface());
@@ -158,23 +142,17 @@ DolphinMainWindow::DolphinMainWindow() :
             this, SLOT(clearStatusBar()));
     connect(undoManager, SIGNAL(jobRecordingFinished(CommandType)),
             this, SLOT(showCommand(CommandType)));
-    connect(DolphinSettings::instance().placesModel(), SIGNAL(errorMessage(QString)),
-            this, SLOT(showErrorMessage(QString)));
-    //connect(&DragAndDropHelper::instance(), SIGNAL(errorMessage(QString)),
-    //        this, SLOT(showErrorMessage(QString)));
-
-    const DolphinSettings& settings = DolphinSettings::instance();
 
-    GeneralSettings* generalSettings = settings.generalSettings();
-    const bool firstRun = generalSettings->firstRun();
+    GeneralSettings* generalSettings = GeneralSettings::self();
+    const bool firstRun = (generalSettings->version() < 200);
     if (firstRun) {
         generalSettings->setViewPropsTimestamp(QDateTime::currentDateTime());
     }
 
     setAcceptDrops(true);
 
-    m_viewTab[m_tabIndex].splitter = new QSplitter(this);
-    m_viewTab[m_tabIndex].splitter->setChildrenCollapsible(false);
+    viewTab.splitter = new QSplitter(this);
+    viewTab.splitter->setChildrenCollapsible(false);
 
     setupActions();
 
@@ -184,9 +162,9 @@ DolphinMainWindow::DolphinMainWindow() :
     connect(m_actionHandler, SIGNAL(actionBeingHandled()), SLOT(clearStatusBar()));
     connect(m_actionHandler, SIGNAL(createDirectory()), SLOT(createDirectory()));
 
-    m_viewTab[m_tabIndex].primaryView = createViewContainer(homeUrl, m_viewTab[m_tabIndex].splitter);
+    viewTab.primaryView = createViewContainer(homeUrl, viewTab.splitter);
 
-    m_activeViewContainer = m_viewTab[m_tabIndex].primaryView;
+    m_activeViewContainer = viewTab.primaryView;
     connectViewSignals(m_activeViewContainer);
     DolphinView* view = m_activeViewContainer->view();
     m_activeViewContainer->show();
@@ -223,7 +201,7 @@ DolphinMainWindow::DolphinMainWindow() :
     m_centralWidgetLayout->setSpacing(0);
     m_centralWidgetLayout->setMargin(0);
     m_centralWidgetLayout->addWidget(m_tabBar);
-    m_centralWidgetLayout->addWidget(m_viewTab[m_tabIndex].splitter, 1);
+    m_centralWidgetLayout->addWidget(viewTab.splitter, 1);
 
     setCentralWidget(centralWidget);
     setupDockWidgets();
@@ -256,7 +234,7 @@ DolphinMainWindow::DolphinMainWindow() :
     QAction* showMenuBarAction = actionCollection()->action(KStandardAction::name(KStandardAction::ShowMenubar));
     showMenuBarAction->setChecked(showMenu);  // workaround for bug #171080
     if (!showMenu) {
-        createToolBarMenuButton();
+        createControlButton();
     }
 }
 
@@ -277,8 +255,7 @@ void DolphinMainWindow::openDirectories(const QList<KUrl>& dirs)
 
     const int oldOpenTabsCount = m_viewTab.count();
 
-    const GeneralSettings* generalSettings = DolphinSettings::instance().generalSettings();
-    const bool hasSplitView = generalSettings->splitView();
+    const bool hasSplitView = GeneralSettings::splitView();
 
     // Open each directory inside a new tab. If the "split view" option has been enabled,
     // always show two directories within one tab.
@@ -325,8 +302,10 @@ void DolphinMainWindow::openFiles(const QList<KUrl>& files)
     const int tabCount = m_viewTab.count();
     for (int i = 0; i < tabCount; ++i) {
         m_viewTab[i].primaryView->view()->markUrlsAsSelected(files);
+        m_viewTab[i].primaryView->view()->markUrlAsCurrent(files.at(0));
         if (m_viewTab[i].secondaryView) {
             m_viewTab[i].secondaryView->view()->markUrlsAsSelected(files);
+            m_viewTab[i].secondaryView->view()->markUrlAsCurrent(files.at(0));
         }
     }
 }
@@ -336,29 +315,23 @@ void DolphinMainWindow::showCommand(CommandType command)
     DolphinStatusBar* statusBar = m_activeViewContainer->statusBar();
     switch (command) {
     case KIO::FileUndoManager::Copy:
-        statusBar->setMessage(i18nc("@info:status", "Successfully copied."),
-                              DolphinStatusBar::OperationCompleted);
+        statusBar->setText(i18nc("@info:status", "Successfully copied."));
         break;
     case KIO::FileUndoManager::Move:
-        statusBar->setMessage(i18nc("@info:status", "Successfully moved."),
-                              DolphinStatusBar::OperationCompleted);
+        statusBar->setText(i18nc("@info:status", "Successfully moved."));
         break;
     case KIO::FileUndoManager::Link:
-        statusBar->setMessage(i18nc("@info:status", "Successfully linked."),
-                              DolphinStatusBar::OperationCompleted);
+        statusBar->setText(i18nc("@info:status", "Successfully linked."));
         break;
     case KIO::FileUndoManager::Trash:
-        statusBar->setMessage(i18nc("@info:status", "Successfully moved to trash."),
-                              DolphinStatusBar::OperationCompleted);
+        statusBar->setText(i18nc("@info:status", "Successfully moved to trash."));
         break;
     case KIO::FileUndoManager::Rename:
-        statusBar->setMessage(i18nc("@info:status", "Successfully renamed."),
-                              DolphinStatusBar::OperationCompleted);
+        statusBar->setText(i18nc("@info:status", "Successfully renamed."));
         break;
 
     case KIO::FileUndoManager::Mkdir:
-        statusBar->setMessage(i18nc("@info:status", "Created folder."),
-                              DolphinStatusBar::OperationCompleted);
+        statusBar->setText(i18nc("@info:status", "Created folder."));
         break;
 
     default:
@@ -396,6 +369,13 @@ void DolphinMainWindow::changeUrl(const KUrl& url)
     }
 }
 
+void DolphinMainWindow::slotTerminalDirectoryChanged(const KUrl& url)
+{
+    m_activeViewContainer->setAutoGrabFocus(false);
+    changeUrl(url);
+    m_activeViewContainer->setAutoGrabFocus(true);
+}
+
 void DolphinMainWindow::slotEditableStateChanged(bool editable)
 {
     KToggleAction* editableLocationAction =
@@ -434,14 +414,14 @@ void DolphinMainWindow::updateHistory()
     const int index = urlNavigator->historyIndex();
 
     QAction* backAction = actionCollection()->action("go_back");
-    backAction->setToolTip(i18nc("@info", "Go back"));
     if (backAction) {
+        backAction->setToolTip(i18nc("@info", "Go back"));
         backAction->setEnabled(index < urlNavigator->historySize() - 1);
     }
 
     QAction* forwardAction = actionCollection()->action("go_forward");
-    forwardAction->setToolTip(i18nc("@info", "Go forward"));
     if (forwardAction) {
+        forwardAction->setToolTip(i18nc("@info", "Go forward"));
         forwardAction->setEnabled(index > 0);
     }
 }
@@ -454,7 +434,7 @@ void DolphinMainWindow::updateFilterBarAction(bool show)
 
 void DolphinMainWindow::openNewMainWindow()
 {
-    KRun::run("dolphin", KUrl::List(), this);
+    KRun::run("dolphin %u", KUrl::List(), this);
 }
 
 void DolphinMainWindow::openNewTab()
@@ -503,13 +483,12 @@ void DolphinMainWindow::openNewTab(const KUrl& url)
 
     actionCollection()->action("close_tab")->setEnabled(true);
 
-    // provide a split view, if the startup settings are set this way
-    const GeneralSettings* generalSettings = DolphinSettings::instance().generalSettings();
-    if (generalSettings->splitView()) {
-        const int tabIndex = m_viewTab.count() - 1;
-        createSecondaryView(tabIndex);
-        m_viewTab[tabIndex].secondaryView->setActive(true);
-        m_viewTab[tabIndex].isPrimaryViewActive = false;
+    // Provide a split view, if the startup settings are set this way
+    if (GeneralSettings::splitView()) {
+        const int newTabIndex = m_viewTab.count() - 1;
+        createSecondaryView(newTabIndex);
+        m_viewTab[newTabIndex].secondaryView->setActive(true);
+        m_viewTab[newTabIndex].isPrimaryViewActive = false;
     }
 
     if (focusWidget) {
@@ -519,27 +498,29 @@ void DolphinMainWindow::openNewTab(const KUrl& url)
     }
 }
 
+void DolphinMainWindow::openNewActivatedTab(const KUrl& url)
+{
+    openNewTab(url);
+    m_tabBar->setCurrentIndex(m_viewTab.count() - 1);
+}
+
 void DolphinMainWindow::activateNextTab()
 {
-    if ((m_viewTab.count() == 1) || (m_tabBar->count() < 2)) {
-        return;
+    if (m_viewTab.count() >= 2) {
+        const int tabIndex = (m_tabBar->currentIndex() + 1) % m_tabBar->count();
+        m_tabBar->setCurrentIndex(tabIndex);
     }
-
-    const int tabIndex = (m_tabBar->currentIndex() + 1) % m_tabBar->count();
-    m_tabBar->setCurrentIndex(tabIndex);
 }
 
 void DolphinMainWindow::activatePrevTab()
 {
-    if ((m_viewTab.count() == 1) || (m_tabBar->count() < 2)) {
-        return;
-    }
-
-    int tabIndex = m_tabBar->currentIndex() - 1;
-    if (tabIndex == -1) {
-        tabIndex = m_tabBar->count() - 1;
+    if (m_viewTab.count() >= 2) {
+        int tabIndex = m_tabBar->currentIndex() - 1;
+        if (tabIndex == -1) {
+            tabIndex = m_tabBar->count() - 1;
+        }
+        m_tabBar->setCurrentIndex(tabIndex);
     }
-    m_tabBar->setCurrentIndex(tabIndex);
 }
 
 void DolphinMainWindow::openInNewTab()
@@ -564,7 +545,7 @@ void DolphinMainWindow::openInNewWindow()
     }
 
     if (!newWindowUrl.isEmpty()) {
-        KRun::run("dolphin", KUrl::List() << newWindowUrl, this);
+        KRun::run("dolphin %u", KUrl::List() << newWindowUrl, this);
     }
 }
 
@@ -593,9 +574,6 @@ void DolphinMainWindow::showEvent(QShowEvent* event)
 
 void DolphinMainWindow::closeEvent(QCloseEvent* event)
 {
-    DolphinSettings& settings = DolphinSettings::instance();
-    GeneralSettings* generalSettings = settings.generalSettings();
-
     // Find out if Dolphin is closed directly by the user or
     // by the session manager because the session is closed
     bool closedByUser = true;
@@ -604,7 +582,7 @@ void DolphinMainWindow::closeEvent(QCloseEvent* event)
         closedByUser = false;
     }
 
-    if ((m_viewTab.count() > 1) && generalSettings->confirmClosingMultipleTabs() && closedByUser) {
+    if (m_viewTab.count() > 1 && GeneralSettings::confirmClosingMultipleTabs() && closedByUser) {
         // Ask the user if he really wants to quit and close all tabs.
         // Open a confirmation dialog with 3 buttons:
         // KDialog::Yes    -> Quit
@@ -630,7 +608,7 @@ void DolphinMainWindow::closeEvent(QCloseEvent* event)
             KMessageBox::Notify);
 
         if (doNotAskAgainCheckboxResult) {
-            generalSettings->setConfirmClosingMultipleTabs(false);
+            GeneralSettings::setConfirmClosingMultipleTabs(false);
         }
 
         switch (result) {
@@ -639,24 +617,15 @@ void DolphinMainWindow::closeEvent(QCloseEvent* event)
                 break;
             case KDialog::No:
                 // Close only the current tab
-              closeTab();
+                closeTab();
             default:
                 event->ignore();
                 return;
         }
     }
 
-    generalSettings->setFirstRun(false);
-
-    settings.save();
-
-    if (m_searchDockIsTemporaryVisible) {
-        QDockWidget* searchDock = findChild<QDockWidget*>("searchDock");
-        if (searchDock) {
-            searchDock->hide();
-        }
-        m_searchDockIsTemporaryVisible = false;
-    }
+    GeneralSettings::setVersion(CurrentDolphinVersion);
+    GeneralSettings::self()->writeConfig();
 
     KXmlGuiWindow::closeEvent(event);
 }
@@ -714,7 +683,7 @@ void DolphinMainWindow::readProperties(const KConfigGroup& group)
 
         // openNewTab() needs to be called only tabCount - 1 times
         if (i != tabCount - 1) {
-             openNewTab();
+            openNewTab();
         }
     }
 
@@ -743,10 +712,7 @@ void DolphinMainWindow::quit()
 
 void DolphinMainWindow::showErrorMessage(const QString& message)
 {
-    if (!message.isEmpty()) {
-        DolphinStatusBar* statusBar = m_activeViewContainer->statusBar();
-        statusBar->setMessage(message, DolphinStatusBar::Error);
-    }
+    m_activeViewContainer->showMessage(message, DolphinViewContainer::Error);
 }
 
 void DolphinMainWindow::slotUndoAvailable(bool available)
@@ -821,23 +787,6 @@ void DolphinMainWindow::find()
     m_activeViewContainer->setSearchModeEnabled(true);
 }
 
-void DolphinMainWindow::slotSearchLocationChanged()
-{
-#ifdef HAVE_NEPOMUK
-    QDockWidget* searchDock = findChild<QDockWidget*>("searchDock");
-    if (!searchDock) {
-        return;
-    }
-
-    SearchPanel* searchPanel = qobject_cast<SearchPanel*>(searchDock->widget());
-    if (searchPanel) {
-        searchPanel->setSearchLocation(SearchSettings::location() == QLatin1String("FromHere")
-                                       ? SearchPanel::FromCurrentDir
-                                       : SearchPanel::Everywhere);
-    }
-#endif
-}
-
 void DolphinMainWindow::updatePasteAction()
 {
     QAction* pasteAction = actionCollection()->action(KStandardAction::name(KStandardAction::Paste));
@@ -947,9 +896,7 @@ void DolphinMainWindow::replaceLocation()
 
 void DolphinMainWindow::togglePanelLockState()
 {
-    GeneralSettings* generalSettings = DolphinSettings::instance().generalSettings();
-
-    const bool newLockState = !generalSettings->lockPanels();
+    const bool newLockState = !GeneralSettings::lockPanels();
     foreach (QObject* child, children()) {
         DolphinDockWidget* dock = qobject_cast<DolphinDockWidget*>(child);
         if (dock) {
@@ -957,7 +904,7 @@ void DolphinMainWindow::togglePanelLockState()
         }
     }
 
-    generalSettings->setLockPanels(newLockState);
+    GeneralSettings::setLockPanels(newLockState);
 }
 
 void DolphinMainWindow::slotPlacesPanelVisibilityChanged(bool visible)
@@ -1028,6 +975,14 @@ void DolphinMainWindow::goUp(Qt::MouseButtons buttons)
     }
 }
 
+void DolphinMainWindow::goHome(Qt::MouseButtons buttons)
+{
+    // The default case (left button pressed) is handled in goHome().
+    if (buttons == Qt::MidButton) {
+        openNewTab(GeneralSettings::self()->homeUrl());
+    }
+}
+
 void DolphinMainWindow::compareFiles()
 {
     // The method is only invoked if exactly 2 files have
@@ -1088,9 +1043,9 @@ void DolphinMainWindow::toggleShowMenuBar()
     const bool visible = menuBar()->isVisible();
     menuBar()->setVisible(!visible);
     if (visible) {
-        createToolBarMenuButton();
+        createControlButton();
     } else {
-        deleteToolBarMenuButton();
+        deleteControlButton();
     }
 }
 
@@ -1113,7 +1068,10 @@ void DolphinMainWindow::openTerminal()
 void DolphinMainWindow::editSettings()
 {
     if (!m_settingsDialog) {
-        const KUrl url = activeViewContainer()->url();
+        DolphinViewContainer* container = activeViewContainer();
+        container->view()->writeSettings();
+
+        const KUrl url = container->url();
         DolphinSettingsDialog* settingsDialog = new DolphinSettingsDialog(url, this);
         connect(settingsDialog, SIGNAL(settingsChanged()), this, SLOT(refreshViews()));
         settingsDialog->setAttribute(Qt::WA_DeleteOnClose);
@@ -1154,6 +1112,18 @@ void DolphinMainWindow::setActiveTab(int index)
     }
     viewTab.splitter->show();
 
+    if (!viewTab.wasActive) {
+        viewTab.wasActive = true;
+
+        // If the tab has not been activated yet the size of the KItemListView is
+        // undefined and results in an unwanted animation. To prevent this a
+        // reloading of the directory gets triggered.
+        viewTab.primaryView->view()->reload();
+        if (viewTab.secondaryView) {
+            viewTab.secondaryView->view()->reload();
+        }
+    }
+
     setActiveViewContainer(viewTab.isPrimaryViewActive ? viewTab.primaryView :
                                                          viewTab.secondaryView);
 }
@@ -1261,16 +1231,6 @@ void DolphinMainWindow::slotTabMoved(int from, int to)
     m_tabIndex = m_tabBar->currentIndex();
 }
 
-void DolphinMainWindow::handlePlacesClick(const KUrl& url, Qt::MouseButtons buttons)
-{
-    if (buttons & Qt::MidButton) {
-        openNewTab(url);
-        m_tabBar->setCurrentIndex(m_viewTab.count() - 1);
-    } else {
-        changeUrl(url);
-    }
-}
-
 void DolphinMainWindow::slotTestCanDecode(const QDragMoveEvent* event, bool& canDecode)
 {
     canDecode = KUrl::List::canDecode(event->mimeData());
@@ -1286,11 +1246,14 @@ void DolphinMainWindow::handleUrl(const KUrl& url)
     } else if (KProtocolManager::supportsListing(url)) {
         // stat the URL to see if it is a dir or not
         m_lastHandleUrlStatJob = KIO::stat(url, KIO::HideProgressInfo);
+        if (m_lastHandleUrlStatJob->ui()) {
+            m_lastHandleUrlStatJob->ui()->setWindow(this);
+        }
         connect(m_lastHandleUrlStatJob, SIGNAL(result(KJob*)),
                 this, SLOT(slotHandleUrlStatFinished(KJob*)));
 
     } else {
-        new KRun(url, this);
+        new KRun(url, this); // Automatically deletes itself after being finished
     }
 }
 
@@ -1302,7 +1265,7 @@ void DolphinMainWindow::slotHandleUrlStatFinished(KJob* job)
     if (entry.isDir()) {
         activeViewContainer()->setUrl(url);
     } else {
-        new KRun(url, this);
+        new KRun(url, this);  // Automatically deletes itself after being finished
     }
 }
 
@@ -1311,9 +1274,12 @@ void DolphinMainWindow::tabDropEvent(int tab, QDropEvent* event)
     const KUrl::List urls = KUrl::List::fromMimeData(event->mimeData());
     if (!urls.isEmpty() && tab != -1) {
         const ViewTab& viewTab = m_viewTab[tab];
-        const KUrl destPath = viewTab.isPrimaryViewActive ? viewTab.primaryView->url() : viewTab.secondaryView->url();
-        Q_UNUSED(destPath);
-        //DragAndDropHelper::instance().dropUrls(KFileItem(), destPath, event, m_tabBar);
+        const DolphinView* view = viewTab.isPrimaryViewActive ? viewTab.primaryView->view()
+                                                              : viewTab.secondaryView->view();
+        const QString error = DragAndDropHelper::dropUrls(view->rootItem(), view->url(), event);
+        if (!error.isEmpty()) {
+            activeViewContainer()->showMessage(error, DolphinViewContainer::Error);
+        }
     }
 }
 
@@ -1322,63 +1288,18 @@ void DolphinMainWindow::slotWriteStateChanged(bool isFolderWritable)
     newFileMenu()->setEnabled(isFolderWritable);
 }
 
-void DolphinMainWindow::slotSearchModeChanged(bool enabled)
-{
-#ifdef HAVE_NEPOMUK
-    const DolphinSearchInformation& searchInfo = DolphinSearchInformation::instance();
-    if (!searchInfo.isIndexingEnabled()) {
-        return;
-    }
-
-    QDockWidget* searchDock = findChild<QDockWidget*>("searchDock");
-    if (!searchDock) {
-        return;
-    }
-
-    if (enabled) {
-        if (!searchDock->isVisible()) {
-            m_searchDockIsTemporaryVisible = true;
-        }
-        searchDock->show();
-    } else {
-        if (searchDock->isVisible() && m_searchDockIsTemporaryVisible) {
-            searchDock->hide();
-        }
-        m_searchDockIsTemporaryVisible = false;
-    }
-
-    SearchPanel* searchPanel = qobject_cast<SearchPanel*>(searchDock->widget());
-    if (!searchPanel) {
-        return;
-    }
-
-    if (enabled) {
-        SearchPanel::SearchLocation searchLocation = SearchPanel::Everywhere;
-        const KUrl url = m_activeViewContainer->url();
-        const bool isSearchUrl = (url.protocol() == QLatin1String("nepomuksearch"));
-        if ((SearchSettings::location() == QLatin1String("FromHere") && !isSearchUrl)) {
-            searchLocation = SearchPanel::FromCurrentDir;
-        }
-        searchPanel->setSearchLocation(searchLocation);
-    } else {
-        searchPanel->setSearchLocation(SearchPanel::Everywhere);
-    }
-#else
-    Q_UNUSED(enabled);
-#endif
-}
-
-void DolphinMainWindow::openContextMenu(const KFileItem& item,
+void DolphinMainWindow::openContextMenu(const QPoint& pos,
+                                        const KFileItem& item,
                                         const KUrl& url,
                                         const QList<QAction*>& customActions)
 {
-    QPointer<DolphinContextMenu> contextMenu = new DolphinContextMenu(this, item, url);
-    contextMenu->setCustomActions(customActions);
-    const DolphinContextMenu::Command command = contextMenu->open();
+    QWeakPointer<DolphinContextMenu> contextMenu = new DolphinContextMenu(this, pos, item, url);
+    contextMenu.data()->setCustomActions(customActions);
+    const DolphinContextMenu::Command command = contextMenu.data()->open();
 
     switch (command) {
     case DolphinContextMenu::OpenParentFolderInNewWindow: {
-        KRun::run("dolphin", KUrl::List() << item.url().upUrl(), this);
+        KRun::run("dolphin %u", KUrl::List() << item.url().upUrl(), this);
         break;
     }
 
@@ -1391,10 +1312,10 @@ void DolphinMainWindow::openContextMenu(const KFileItem& item,
         break;
     }
 
-    delete contextMenu;
+    delete contextMenu.data();
 }
 
-void DolphinMainWindow::updateToolBarMenu()
+void DolphinMainWindow::updateControlMenu()
 {
     KMenu* menu = qobject_cast<KMenu*>(sender());
     Q_ASSERT(menu);
@@ -1403,8 +1324,6 @@ void DolphinMainWindow::updateToolBarMenu()
     // by connecting to the aboutToHide() signal from the parent-menu.
     menu->clear();
 
-    const GeneralSettings* generalSettings = DolphinSettings::instance().generalSettings();
-
     KActionCollection* ac = actionCollection();
 
     // Add "Edit" actions
@@ -1418,7 +1337,7 @@ void DolphinMainWindow::updateToolBarMenu()
     }
 
     // Add "View" actions
-    if (!generalSettings->showZoomSlider()) {
+    if (!GeneralSettings::showZoomSlider()) {
         addActionToMenu(ac->action(KStandardAction::name(KStandardAction::ZoomIn)), menu);
         addActionToMenu(ac->action(KStandardAction::name(KStandardAction::ZoomOut)), menu);
         menu->addSeparator();
@@ -1479,8 +1398,11 @@ void DolphinMainWindow::updateToolBarMenu()
     connect(menu, SIGNAL(aboutToHide()), helpMenu, SLOT(deleteLater()));
     helpMenu->addAction(ac->action(KStandardAction::name(KStandardAction::HelpContents)));
     helpMenu->addAction(ac->action(KStandardAction::name(KStandardAction::WhatsThis)));
+    helpMenu->addSeparator();
     helpMenu->addAction(ac->action(KStandardAction::name(KStandardAction::ReportBug)));
+    helpMenu->addSeparator();
     helpMenu->addAction(ac->action(KStandardAction::name(KStandardAction::SwitchApplicationLanguage)));
+    helpMenu->addSeparator();
     helpMenu->addAction(ac->action(KStandardAction::name(KStandardAction::AboutApp)));
     helpMenu->addAction(ac->action(KStandardAction::name(KStandardAction::AboutKDE)));
     menu->addMenu(helpMenu);
@@ -1492,27 +1414,19 @@ void DolphinMainWindow::updateToolBarMenu()
 void DolphinMainWindow::updateToolBar()
 {
     if (!menuBar()->isVisible()) {
-        createToolBarMenuButton();
+        createControlButton();
     }
 }
 
-void DolphinMainWindow::slotToolBarSpacerDeleted()
+void DolphinMainWindow::slotControlButtonDeleted()
 {
-    m_toolBarSpacer = 0;
+    m_controlButton = 0;
     m_updateToolBarTimer->start();
 }
 
-void DolphinMainWindow::slotToolBarMenuButtonDeleted()
+void DolphinMainWindow::slotPanelErrorMessage(const QString& error)
 {
-    m_openToolBarMenuButton = 0;
-    m_updateToolBarTimer->start();
-}
-
-void DolphinMainWindow::slotToolBarIconSizeChanged(const QSize& iconSize)
-{
-    if (m_openToolBarMenuButton) {
-        m_openToolBarMenuButton->setIconSize(iconSize);
-    }
+    activeViewContainer()->showMessage(error, DolphinViewContainer::Error);
 }
 
 void DolphinMainWindow::setActiveViewContainer(DolphinViewContainer* viewContainer)
@@ -1646,12 +1560,12 @@ void DolphinMainWindow::setupActions()
 
     KToggleAction* editableLocation = actionCollection()->add<KToggleAction>("editable_location");
     editableLocation->setText(i18nc("@action:inmenu Navigation Bar", "Editable Location"));
-    editableLocation->setShortcut(Qt::CTRL | Qt::Key_L);
+    editableLocation->setShortcut(Qt::Key_F6);
     connect(editableLocation, SIGNAL(triggered()), this, SLOT(toggleEditLocation()));
 
     KAction* replaceLocation = actionCollection()->addAction("replace_location");
     replaceLocation->setText(i18nc("@action:inmenu Navigation Bar", "Replace Location"));
-    replaceLocation->setShortcut(Qt::Key_F6);
+    replaceLocation->setShortcut(Qt::CTRL | Qt::Key_L);
     connect(replaceLocation, SIGNAL(triggered()), this, SLOT(replaceLocation()));
 
     // setup 'Go' menu
@@ -1680,7 +1594,8 @@ void DolphinMainWindow::setupActions()
     KAction* upAction = KStandardAction::up(this, SLOT(goUp()), actionCollection());
     connect(upAction, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), this, SLOT(goUp(Qt::MouseButtons)));
 
-    KStandardAction::home(this, SLOT(goHome()), actionCollection());
+    KAction* homeAction = KStandardAction::home(this, SLOT(goHome()), actionCollection());
+    connect(homeAction, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), this, SLOT(goHome(Qt::MouseButtons)));
 
     // setup 'Tools' menu
     KAction* showFilterBar = actionCollection()->addAction("show_filter_bar");
@@ -1702,7 +1617,9 @@ void DolphinMainWindow::setupActions()
     connect(openTerminal, SIGNAL(triggered()), this, SLOT(openTerminal()));
 
     // setup 'Settings' menu
-    KStandardAction::showMenubar(this, SLOT(toggleShowMenuBar()), actionCollection());
+    KToggleAction* showMenuBar = KStandardAction::showMenubar(0, 0, actionCollection());
+    connect(showMenuBar, SIGNAL(triggered(bool)),                   // Fixes #286822
+            this, SLOT(toggleShowMenuBar()), Qt::QueuedConnection);
     KStandardAction::preferences(this, SLOT(editSettings()), actionCollection());
 
     // not in menu actions
@@ -1738,7 +1655,7 @@ void DolphinMainWindow::setupActions()
 
 void DolphinMainWindow::setupDockWidgets()
 {
-    const bool lock = DolphinSettings::instance().generalSettings()->lockPanels();
+    const bool lock = GeneralSettings::lockPanels();
 
     KDualAction* lockLayoutAction = actionCollection()->add<KDualAction>("lock_panels");
     lockLayoutAction->setActiveText(i18nc("@action:inmenu Panels", "Unlock Panels"));
@@ -1759,9 +1676,7 @@ void DolphinMainWindow::setupDockWidgets()
     infoDock->setWidget(infoPanel);
 
     QAction* infoAction = infoDock->toggleViewAction();
-    infoAction->setIcon(KIcon("dialog-information"));
-    infoAction->setShortcut(Qt::Key_F11);
-    addActionCloneToCollection(infoAction, "show_information_panel");
+    createPanelAction(KIcon("dialog-information"), Qt::Key_F11, infoAction, "show_information_panel");
 
     addDockWidget(Qt::RightDockWidgetArea, infoDock);
     connect(this, SIGNAL(urlChanged(KUrl)),
@@ -1781,15 +1696,17 @@ void DolphinMainWindow::setupDockWidgets()
     foldersDock->setWidget(foldersPanel);
 
     QAction* foldersAction = foldersDock->toggleViewAction();
-    foldersAction->setShortcut(Qt::Key_F7);
-    foldersAction->setIcon(KIcon("folder"));
-    addActionCloneToCollection(foldersAction, "show_folders_panel");
+    createPanelAction(KIcon("folder"), Qt::Key_F7, foldersAction, "show_folders_panel");
 
     addDockWidget(Qt::LeftDockWidgetArea, foldersDock);
     connect(this, SIGNAL(urlChanged(KUrl)),
             foldersPanel, SLOT(setUrl(KUrl)));
-    connect(foldersPanel, SIGNAL(changeUrl(KUrl,Qt::MouseButtons)),
-            this, SLOT(handlePlacesClick(KUrl,Qt::MouseButtons)));
+    connect(foldersPanel, SIGNAL(folderActivated(KUrl)),
+            this, SLOT(changeUrl(KUrl)));
+    connect(foldersPanel, SIGNAL(folderMiddleClicked(KUrl)),
+            this, SLOT(openNewTab(KUrl)));
+    connect(foldersPanel, SIGNAL(errorMessage(QString)),
+            this, SLOT(slotPanelErrorMessage(QString)));
 
     // Setup "Terminal"
 #ifndef Q_OS_WIN
@@ -1802,48 +1719,23 @@ void DolphinMainWindow::setupDockWidgets()
     terminalDock->setWidget(terminalPanel);
 
     connect(terminalPanel, SIGNAL(hideTerminalPanel()), terminalDock, SLOT(hide()));
+    connect(terminalPanel, SIGNAL(changeUrl(KUrl)), this, SLOT(slotTerminalDirectoryChanged(KUrl)));
     connect(terminalDock, SIGNAL(visibilityChanged(bool)),
             terminalPanel, SLOT(dockVisibilityChanged()));
 
     QAction* terminalAction = terminalDock->toggleViewAction();
-    terminalAction->setShortcut(Qt::Key_F4);
-    terminalAction->setIcon(KIcon("utilities-terminal"));
-    addActionCloneToCollection(terminalAction, "show_terminal_panel");
+    createPanelAction(KIcon("utilities-terminal"), Qt::Key_F4, terminalAction, "show_terminal_panel");
 
     addDockWidget(Qt::BottomDockWidgetArea, terminalDock);
     connect(this, SIGNAL(urlChanged(KUrl)),
             terminalPanel, SLOT(setUrl(KUrl)));
 #endif
 
-    // Setup "Search"
-#ifdef HAVE_NEPOMUK
-    DolphinDockWidget* searchDock = new DolphinDockWidget(i18nc("@title:window", "Search"));
-    searchDock->setLocked(lock);
-    searchDock->setObjectName("searchDock");
-    searchDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
-    Panel* searchPanel = new SearchPanel(searchDock);
-    searchPanel->setCustomContextMenuActions(QList<QAction*>() << lockLayoutAction);
-    connect(searchPanel, SIGNAL(urlActivated(KUrl)), this, SLOT(handleUrl(KUrl)));
-    searchDock->setWidget(searchPanel);
-
-    QAction* searchAction = searchDock->toggleViewAction();
-    searchAction->setShortcut(Qt::Key_F12);
-    searchAction->setIcon(KIcon("system-search"));
-    addActionCloneToCollection(searchAction, "show_search_panel");
-    addDockWidget(Qt::RightDockWidgetArea, searchDock);
-    connect(this, SIGNAL(urlChanged(KUrl)),
-            searchPanel, SLOT(setUrl(KUrl)));
-#endif
-
-    const bool firstRun = DolphinSettings::instance().generalSettings()->firstRun();
-    if (firstRun) {
+    if (GeneralSettings::version() < 200) {
         infoDock->hide();
         foldersDock->hide();
 #ifndef Q_OS_WIN
         terminalDock->hide();
-#endif
-#ifdef HAVE_NEPOMUK
-        searchDock->hide();
 #endif
     }
 
@@ -1854,41 +1746,36 @@ void DolphinMainWindow::setupDockWidgets()
     placesDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
 
     PlacesPanel* placesPanel = new PlacesPanel(placesDock);
-    QAction* separator = new QAction(placesPanel);
-    separator->setSeparator(true);
-    QList<QAction*> placesActions;
-    placesActions.append(separator);
-    placesActions.append(lockLayoutAction);
-    placesPanel->addActions(placesActions);
-    placesPanel->setModel(DolphinSettings::instance().placesModel());
-    placesPanel->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+    placesPanel->setCustomContextMenuActions(QList<QAction*>() << lockLayoutAction);
     placesDock->setWidget(placesPanel);
 
     QAction* placesAction = placesDock->toggleViewAction();
-    placesAction->setShortcut(Qt::Key_F9);
-    placesAction->setIcon(KIcon("bookmarks"));
-    addActionCloneToCollection(placesAction, "show_places_panel");
+    createPanelAction(KIcon("bookmarks"), Qt::Key_F9, placesAction, "show_places_panel");
 
     addDockWidget(Qt::LeftDockWidgetArea, placesDock);
-    connect(placesPanel, SIGNAL(urlChanged(KUrl,Qt::MouseButtons)),
-            this, SLOT(handlePlacesClick(KUrl,Qt::MouseButtons)));
+    connect(placesPanel, SIGNAL(placeActivated(KUrl)),
+            this, SLOT(changeUrl(KUrl)));
+    connect(placesPanel, SIGNAL(placeMiddleClicked(KUrl)),
+            this, SLOT(openNewTab(KUrl)));
+    connect(placesPanel, SIGNAL(errorMessage(QString)),
+            this, SLOT(slotPanelErrorMessage(QString)));
     connect(this, SIGNAL(urlChanged(KUrl)),
             placesPanel, SLOT(setUrl(KUrl)));
     connect(placesDock, SIGNAL(visibilityChanged(bool)),
             this, SLOT(slotPlacesPanelVisibilityChanged(bool)));
+    connect(this, SIGNAL(settingsChanged()),
+           placesPanel, SLOT(readSettings()));
 
     // Add actions into the "Panels" menu
     KActionMenu* panelsMenu = new KActionMenu(i18nc("@action:inmenu View", "Panels"), this);
     actionCollection()->addAction("panels", panelsMenu);
     panelsMenu->setDelayed(false);
-    panelsMenu->addAction(placesAction);
-    panelsMenu->addAction(infoAction);
-    panelsMenu->addAction(foldersAction);
+    const KActionCollection* ac = actionCollection();
+    panelsMenu->addAction(ac->action("show_places_panel"));
+    panelsMenu->addAction(ac->action("show_information_panel"));
+    panelsMenu->addAction(ac->action("show_folders_panel"));
 #ifndef Q_OS_WIN
-    panelsMenu->addAction(terminalAction);
-#endif
-#ifdef HAVE_NEPOMUK
-    panelsMenu->addAction(searchAction);
+    panelsMenu->addAction(ac->action("show_terminal_panel"));
 #endif
     panelsMenu->addSeparator();
     panelsMenu->addAction(lockLayoutAction);
@@ -1942,48 +1829,43 @@ void DolphinMainWindow::updateGoActions()
     goUpAction->setEnabled(currentUrl.upUrl() != currentUrl);
 }
 
-void DolphinMainWindow::createToolBarMenuButton()
+void DolphinMainWindow::createControlButton()
 {
-    if (m_toolBarSpacer && m_openToolBarMenuButton) {
+    if (m_controlButton) {
         return;
     }
-    Q_ASSERT(!m_toolBarSpacer);
-    Q_ASSERT(!m_openToolBarMenuButton);
-
-    m_toolBarSpacer = new QWidget(this);
-    m_toolBarSpacer->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
+    Q_ASSERT(!m_controlButton);
 
-    m_openToolBarMenuButton = new QToolButton(this);
-    m_openToolBarMenuButton->setIcon(KIcon("configure"));
-    m_openToolBarMenuButton->setPopupMode(QToolButton::InstantPopup);
-    m_openToolBarMenuButton->setToolTip(i18nc("@info:tooltip", "Configure and control Dolphin"));
+    m_controlButton = new QToolButton(this);
+    m_controlButton->setIcon(KIcon("applications-system"));
+    m_controlButton->setText(i18nc("@action", "Control"));
+    m_controlButton->setPopupMode(QToolButton::InstantPopup);
+    m_controlButton->setToolButtonStyle(toolBar()->toolButtonStyle());
 
-    KMenu* toolBarMenu = new ToolBarMenu(m_openToolBarMenuButton);
-    connect(toolBarMenu, SIGNAL(aboutToShow()), this, SLOT(updateToolBarMenu()));
+    KMenu* controlMenu = new KMenu(m_controlButton);
+    connect(controlMenu, SIGNAL(aboutToShow()), this, SLOT(updateControlMenu()));
 
-    m_openToolBarMenuButton->setMenu(toolBarMenu);
+    m_controlButton->setMenu(controlMenu);
 
-    toolBar()->addWidget(m_toolBarSpacer);
-    toolBar()->addWidget(m_openToolBarMenuButton);
-    connect(toolBar(), SIGNAL(iconSizeChanged(QSize)), this, SLOT(slotToolBarIconSizeChanged(QSize)));
+    toolBar()->addWidget(m_controlButton);
+    connect(toolBar(), SIGNAL(iconSizeChanged(QSize)),
+            m_controlButton, SLOT(setIconSize(QSize)));
+    connect(toolBar(), SIGNAL(toolButtonStyleChanged(Qt::ToolButtonStyle)),
+            m_controlButton, SLOT(setToolButtonStyle(Qt::ToolButtonStyle)));
 
     // The added widgets are owned by the toolbar and may get deleted when e.g. the toolbar
     // gets edited. In this case we must add them again. The adding is done asynchronously by
     // m_updateToolBarTimer.
-    connect(m_toolBarSpacer, SIGNAL(destroyed()), this, SLOT(slotToolBarSpacerDeleted()));
-    connect(m_openToolBarMenuButton, SIGNAL(destroyed()), this, SLOT(slotToolBarMenuButtonDeleted()));
+    connect(m_controlButton, SIGNAL(destroyed()), this, SLOT(slotControlButtonDeleted()));
     m_updateToolBarTimer = new QTimer(this);
     m_updateToolBarTimer->setInterval(500);
     connect(m_updateToolBarTimer, SIGNAL(timeout()), this, SLOT(updateToolBar()));
 }
 
-void DolphinMainWindow::deleteToolBarMenuButton()
+void DolphinMainWindow::deleteControlButton()
 {
-    delete m_toolBarSpacer;
-    m_toolBarSpacer = 0;
-
-    delete m_openToolBarMenuButton;
-    m_openToolBarMenuButton = 0;
+    delete m_controlButton;
+    m_controlButton = 0;
 
     delete m_updateToolBarTimer;
     m_updateToolBarTimer = 0;
@@ -2054,19 +1936,18 @@ void DolphinMainWindow::refreshViews()
 
     const int tabCount = m_viewTab.count();
     for (int i = 0; i < tabCount; ++i) {
-        m_viewTab[i].primaryView->refresh();
+        m_viewTab[i].primaryView->readSettings();
         if (m_viewTab[i].secondaryView) {
-            m_viewTab[i].secondaryView->refresh();
+            m_viewTab[i].secondaryView->readSettings();
         }
     }
 
     setActiveViewContainer(activeViewContainer);
 
-    const GeneralSettings* generalSettings = DolphinSettings::instance().generalSettings();
-    if (generalSettings->modifiedStartupSettings()) {
+    if (GeneralSettings::modifiedStartupSettings()) {
         // The startup settings have been changed by the user (see bug #254947).
         // Synchronize the split-view setting with the active view:
-        const bool splitView = generalSettings->splitView();
+        const bool splitView = GeneralSettings::splitView();
         const ViewTab& activeTab = m_viewTab[m_tabIndex];
         const bool toggle =    ( splitView && !activeTab.secondaryView)
                             || (!splitView &&  activeTab.secondaryView);
@@ -2074,11 +1955,13 @@ void DolphinMainWindow::refreshViews()
             toggleSplitView();
         }
     }
+
+    emit settingsChanged();
 }
 
 void DolphinMainWindow::clearStatusBar()
 {
-    m_activeViewContainer->statusBar()->clear();
+    m_activeViewContainer->statusBar()->resetToDefaultText();
 }
 
 void DolphinMainWindow::connectViewSignals(DolphinViewContainer* container)
@@ -2087,12 +1970,6 @@ void DolphinMainWindow::connectViewSignals(DolphinViewContainer* container)
             this, SLOT(updateFilterBarAction(bool)));
     connect(container, SIGNAL(writeStateChanged(bool)),
             this, SLOT(slotWriteStateChanged(bool)));
-    connect(container, SIGNAL(searchModeChanged(bool)),
-            this, SLOT(slotSearchModeChanged(bool)));
-
-    const DolphinSearchBox* searchBox = container->searchBox();
-    connect(searchBox, SIGNAL(searchLocationChanged(SearchLocation)),
-            this, SLOT(slotSearchLocationChanged()));
 
     DolphinView* view = container->view();
     connect(view, SIGNAL(selectionChanged(KFileItemList)),
@@ -2103,12 +1980,16 @@ void DolphinMainWindow::connectViewSignals(DolphinViewContainer* container)
             this, SLOT(toggleActiveView()));
     connect(view, SIGNAL(tabRequested(KUrl)),
             this, SLOT(openNewTab(KUrl)));
-    connect(view, SIGNAL(requestContextMenu(KFileItem,KUrl,QList<QAction*>)),
-            this, SLOT(openContextMenu(KFileItem,KUrl,QList<QAction*>)));
-    connect(view, SIGNAL(startedPathLoading(KUrl)),
+    connect(view, SIGNAL(requestContextMenu(QPoint,KFileItem,KUrl,QList<QAction*>)),
+            this, SLOT(openContextMenu(QPoint,KFileItem,KUrl,QList<QAction*>)));
+    connect(view, SIGNAL(directoryLoadingStarted()),
             this, SLOT(enableStopAction()));
-    connect(view, SIGNAL(finishedPathLoading(KUrl)),
+    connect(view, SIGNAL(directoryLoadingCompleted()),
             this, SLOT(disableStopAction()));
+    connect(view, SIGNAL(goBackRequested()),
+            this, SLOT(goBack()));
+    connect(view, SIGNAL(goForwardRequested()),
+            this, SLOT(goForward()));
 
     const KUrlNavigator* navigator = container->urlNavigator();
     connect(navigator, SIGNAL(urlChanged(KUrl)),
@@ -2174,16 +2055,26 @@ bool DolphinMainWindow::isKompareInstalled() const
 
 void DolphinMainWindow::createSecondaryView(int tabIndex)
 {
-    QSplitter* splitter = m_viewTab[tabIndex].splitter;
-    const int newWidth = (m_viewTab[tabIndex].primaryView->width() - splitter->handleWidth()) / 2;
+    ViewTab& viewTab = m_viewTab[tabIndex];
+
+    QSplitter* splitter = viewTab.splitter;
+    const int newWidth = (viewTab.primaryView->width() - splitter->handleWidth()) / 2;
 
-    const DolphinView* view = m_viewTab[tabIndex].primaryView->view();
-    m_viewTab[tabIndex].secondaryView = createViewContainer(view->url(), 0);
-    splitter->addWidget(m_viewTab[tabIndex].secondaryView);
+    const DolphinView* view = viewTab.primaryView->view();
+    // The final parent of the new view container will be set by adding it
+    // to the splitter. However, we must make sure that the DolphinMainWindow
+    // is a parent of the view container already when it is constructed
+    // because this enables the container's KFileItemModel to assign its
+    // dir lister to the right main window. The dir lister can then cache
+    // authentication data.
+    viewTab.secondaryView = createViewContainer(view->url(), this);
+    splitter->addWidget(viewTab.secondaryView);
     splitter->setSizes(QList<int>() << newWidth << newWidth);
-    connectViewSignals(m_viewTab[tabIndex].secondaryView);
-    m_viewTab[tabIndex].secondaryView->setActive(false);
-    m_viewTab[tabIndex].secondaryView->show();
+
+    connectViewSignals(viewTab.secondaryView);
+    viewTab.secondaryView->setActive(false);
+    viewTab.secondaryView->resize(newWidth, viewTab.primaryView->height());
+    viewTab.secondaryView->show();
 }
 
 QString DolphinMainWindow::tabProperty(const QString& property, int tabIndex) const
@@ -2213,12 +2104,20 @@ QString DolphinMainWindow::squeezedText(const QString& text) const
     return fm.elidedText(text, Qt::ElideMiddle, fm.maxWidth() * 10);
 }
 
-void DolphinMainWindow::addActionCloneToCollection(QAction* action, const QString& actionName)
+void DolphinMainWindow::createPanelAction(const KIcon& icon,
+                                          const QKeySequence& shortcut,
+                                          QAction* dockAction,
+                                          const QString& actionName)
 {
-    KAction* actionClone = actionCollection()->addAction(actionName);
-    actionClone->setText(action->text());
-    actionClone->setIcon(action->icon());
-    connect(actionClone, SIGNAL(triggered()), action, SLOT(trigger()));
+    KAction* panelAction = actionCollection()->addAction(actionName);
+    panelAction->setCheckable(true);
+    panelAction->setChecked(dockAction->isChecked());
+    panelAction->setText(dockAction->text());
+    panelAction->setIcon(icon);
+    panelAction->setShortcut(shortcut);
+
+    connect(panelAction, SIGNAL(triggered()), dockAction, SLOT(trigger()));
+    connect(dockAction, SIGNAL(toggled(bool)), panelAction, SLOT(setChecked(bool)));
 }
 
 DolphinMainWindow::UndoUiInterface::UndoUiInterface() :
@@ -2234,54 +2133,11 @@ void DolphinMainWindow::UndoUiInterface::jobError(KIO::Job* job)
 {
     DolphinMainWindow* mainWin= qobject_cast<DolphinMainWindow *>(parentWidget());
     if (mainWin) {
-        DolphinStatusBar* statusBar = mainWin->activeViewContainer()->statusBar();
-        statusBar->setMessage(job->errorString(), DolphinStatusBar::Error);
+        DolphinViewContainer* container = mainWin->activeViewContainer();
+        container->showMessage(job->errorString(), DolphinViewContainer::Error);
     } else {
         KIO::FileUndoManager::UiInterface::jobError(job);
     }
 }
 
-ToolBarMenu::ToolBarMenu(QWidget* parent) :
-    KMenu(parent)
-{
-}
-
-ToolBarMenu::~ToolBarMenu()
-{
-}
-
-void ToolBarMenu::showEvent(QShowEvent* event)
-{
-    KMenu::showEvent(event);
-
-    // Adjust the position of the menu to be shown within the
-    // Dolphin window to reduce the cases that sub-menus might overlap
-    // the right screen border.
-    QPoint pos;
-    QWidget* button = parentWidget();
-    if (layoutDirection() == Qt::RightToLeft) {
-        pos = button->mapToGlobal(QPoint(0, button->height()));
-    } else {
-        pos = button->mapToGlobal(QPoint(button->width(), button->height()));
-        pos.rx() -= width();
-    }
-
-    // Assure that the menu is not shown outside the screen boundaries and
-    // that it does not overlap with the parent button.
-    const QRect screen = QApplication::desktop()->screenGeometry(QCursor::pos());
-    if (pos.x() < screen.x()) {
-        pos.rx() = screen.x();
-    } else if (pos.x() + width() > screen.x() + screen.width()) {
-        pos.rx() = screen.x() + screen.width() - width();
-    }
-
-    if (pos.y() < screen.y()) {
-        pos.ry() = screen.y();
-    } else if (pos.y() + height() > screen.y() + screen.height()) {
-        pos.ry() = button->mapToGlobal(QPoint(0, 0)).y() - height();
-    }
-
-    move(pos);
-}
-
 #include "dolphinmainwindow.moc"