]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinmainwindow.cpp
Allow compiling Dolphin with KF5
[dolphin.git] / src / dolphinmainwindow.cpp
index 3654ed6c969bfb76f41993babc3f9f9182edcc9e..1fd9903442b7cbef1ba28574fad08912f55ceea7 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/dolphinsettingsdialog.h"
 #include "statusbar/dolphinstatusbar.h"
 #include "views/dolphinviewactionhandler.h"
 #include "views/dolphinremoteencoding.h"
 #include "views/draganddrophelper.h"
 #include "views/viewproperties.h"
+#include "views/dolphinnewfilemenuobserver.h"
 
 #ifndef Q_OS_WIN
 #include "panels/terminal/terminalpanel.h"
 #endif
 
 #include "dolphin_generalsettings.h"
-#include "dolphin_searchsettings.h"
 
 #include <KAcceleratorManager>
 #include <KAction>
 #include <kdeversion.h>
 #include <kdualaction.h>
 #include <KFileDialog>
-#include <KFilePlacesModel>
 #include <KGlobal>
+#include <KDialog>
+#include <KJobWidgets>
+#include <KMimeType>
 #include <KLineEdit>
 #include <KToolBar>
 #include <KIcon>
 #include <KIconLoader>
 #include <KIO/NetAccess>
+#include <KIO/JobUiDelegate>
 #include <KInputDialog>
 #include <KLocale>
 #include <KProtocolManager>
 #include <KUrlComboBox>
 #include <KToolInvocation>
 
-#include "views/dolphinplacesmodel.h"
-
 #include <QDesktopWidget>
 #include <QDBusMessage>
 #include <QKeyEvent>
 #include <QClipboard>
 #include <QToolButton>
 #include <QSplitter>
+#include <QTimer>
+#include <QPushButton>
 
 namespace {
     // Used for GeneralSettings::version() to determine whether
@@ -103,18 +98,6 @@ namespace {
     const int CurrentDolphinVersion = 200;
 };
 
-/*
- * 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);
-};
-
 /*
  * Remembers the tab configuration if a tab has been closed.
  * Each closed tab can be restored by the menu
@@ -139,27 +122,19 @@ 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)
 {
-    DolphinPlacesModel::setModel(new KFilePlacesModel(this));
-    connect(DolphinPlacesModel::instance(), SIGNAL(errorMessage(QString)),
-            this, SLOT(showErrorMessage(QString)));
-
-    // Workaround for a X11-issue in combination with KModifierInfo
-    // (see DolphinContextMenu::initializeModifierKeyInfo() for
-    // more information):
-    DolphinContextMenu::initializeModifierKeyInfo();
-
     setObjectName("Dolphin#");
 
     m_viewTab.append(ViewTab());
     ViewTab& viewTab = m_viewTab[m_tabIndex];
     viewTab.wasActive = true; // The first opened tab is automatically active
 
+    connect(&DolphinNewFileMenuObserver::instance(), SIGNAL(errorMessage(QString)),
+            this, SLOT(showErrorMessage(QString)));
+
     KIO::FileUndoManager* undoManager = KIO::FileUndoManager::self();
     undoManager->setUiInterface(new UndoUiInterface());
 
@@ -263,7 +238,7 @@ DolphinMainWindow::DolphinMainWindow() :
     QAction* showMenuBarAction = actionCollection()->action(KStandardAction::name(KStandardAction::ShowMenubar));
     showMenuBarAction->setChecked(showMenu);  // workaround for bug #171080
     if (!showMenu) {
-        createToolBarMenuButton();
+        createControlButton();
     }
 }
 
@@ -288,12 +263,12 @@ void DolphinMainWindow::openDirectories(const QList<KUrl>& dirs)
 
     // Open each directory inside a new tab. If the "split view" option has been enabled,
     // always show two directories within one tab.
-    QList<KUrl>::const_iterator it = dirs.begin();
-    while (it != dirs.end()) {
+    QList<KUrl>::const_iterator it = dirs.constBegin();
+    while (it != dirs.constEnd()) {
         openNewTab(*it);
         ++it;
 
-        if (hasSplitView && (it != dirs.end())) {
+        if (hasSplitView && (it != dirs.constEnd())) {
             const int tabIndex = m_viewTab.count() - 1;
             m_viewTab[tabIndex].secondaryView->setUrl(*it);
             ++it;
@@ -344,29 +319,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:
@@ -404,6 +373,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 =
@@ -462,7 +438,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()
@@ -526,6 +502,12 @@ 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() >= 2) {
@@ -547,11 +529,16 @@ void DolphinMainWindow::activatePrevTab()
 
 void DolphinMainWindow::openInNewTab()
 {
-    const KFileItemList list = m_activeViewContainer->view()->selectedItems();
+    const KFileItemList& list = m_activeViewContainer->view()->selectedItems();
     if (list.isEmpty()) {
         openNewTab(m_activeViewContainer->url());
-    } else if ((list.count() == 1) && list[0].isDir()) {
-        openNewTab(list[0].url());
+    } else {
+        foreach (const KFileItem& item, list) {
+            const KUrl& url = DolphinView::openItemAsFolderUrl(item);
+            if (!url.isEmpty()) {
+                openNewTab(url);
+            }
+        }
     }
 }
 
@@ -562,12 +549,13 @@ void DolphinMainWindow::openInNewWindow()
     const KFileItemList list = m_activeViewContainer->view()->selectedItems();
     if (list.isEmpty()) {
         newWindowUrl = m_activeViewContainer->url();
-    } else if ((list.count() == 1) && list[0].isDir()) {
-        newWindowUrl = list[0].url();
+    } else if (list.count() == 1) {
+        const KFileItem& item = list.first();
+        newWindowUrl = DolphinView::openItemAsFolderUrl(item);
     }
 
     if (!newWindowUrl.isEmpty()) {
-        KRun::run("dolphin", KUrl::List() << newWindowUrl, this);
+        KRun::run("dolphin %u", QList<QUrl>() << newWindowUrl, this);
     }
 }
 
@@ -610,18 +598,19 @@ void DolphinMainWindow::closeEvent(QCloseEvent* event)
         // KDialog::Yes    -> Quit
         // KDialog::No     -> Close only the current tab
         // KDialog::Cancel -> do nothing
-        KDialog *dialog = new KDialog(this, Qt::Dialog);
-        dialog->setCaption(i18nc("@title:window", "Confirmation"));
-        dialog->setButtons(KDialog::Yes | KDialog::No | KDialog::Cancel);
+        QDialog *dialog = new QDialog(this, Qt::Dialog);
+        dialog->setWindowTitle(i18nc("@title:window", "Confirmation"));
         dialog->setModal(true);
-        dialog->setButtonGuiItem(KDialog::Yes, KStandardGuiItem::quit());
-        dialog->setButtonGuiItem(KDialog::No, KGuiItem(i18n("C&lose Current Tab"), KIcon("tab-close")));
-        dialog->setButtonGuiItem(KDialog::Cancel, KStandardGuiItem::cancel());
-        dialog->setDefaultButton(KDialog::Yes);
+        QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Yes | QDialogButtonBox::No | QDialogButtonBox::Cancel);
+        KGuiItem::assign(buttons->button(QDialogButtonBox::Yes), KStandardGuiItem::quit());
+        KGuiItem::assign(buttons->button(QDialogButtonBox::No), KGuiItem(i18n("C&lose Current Tab"), KIcon("tab-close")));
+        KGuiItem::assign(buttons->button(QDialogButtonBox::Cancel), KStandardGuiItem::cancel());
+        buttons->button(QDialogButtonBox::Yes)->setDefault(true);
 
         bool doNotAskAgainCheckboxResult = false;
 
         const int result = KMessageBox::createKMessageBox(dialog,
+            buttons,
             QMessageBox::Warning,
             i18n("You have multiple tabs open in this window, are you sure you want to quit?"),
             QStringList(),
@@ -639,7 +628,7 @@ void DolphinMainWindow::closeEvent(QCloseEvent* event)
                 break;
             case KDialog::No:
                 // Close only the current tab
-              closeTab();
+                closeTab();
             default:
                 event->ignore();
                 return;
@@ -649,14 +638,6 @@ void DolphinMainWindow::closeEvent(QCloseEvent* event)
     GeneralSettings::setVersion(CurrentDolphinVersion);
     GeneralSettings::self()->writeConfig();
 
-    if (m_searchDockIsTemporaryVisible) {
-        QDockWidget* searchDock = findChild<QDockWidget*>("searchDock");
-        if (searchDock) {
-            searchDock->hide();
-        }
-        m_searchDockIsTemporaryVisible = false;
-    }
-
     KXmlGuiWindow::closeEvent(event);
 }
 
@@ -702,6 +683,13 @@ void DolphinMainWindow::readProperties(const KConfigGroup& group)
                 Q_ASSERT(cont);
             }
 
+            // The right view must be activated before the URL is set. Changing
+            // the URL in the right view will emit the right URL navigator's
+            // urlChanged(KUrl) signal, which is connected to the changeUrl(KUrl)
+            // slot. That slot will change the URL in the left view if it is still
+            // active. See https://bugs.kde.org/show_bug.cgi?id=330047.
+            setActiveViewContainer(cont);
+
             cont->setUrl(secondaryUrl);
             const bool editable = group.readEntry(tabProperty("Secondary Editable", i), false);
             cont->urlNavigator()->setUrlEditable(editable);
@@ -713,7 +701,7 @@ void DolphinMainWindow::readProperties(const KConfigGroup& group)
 
         // openNewTab() needs to be called only tabCount - 1 times
         if (i != tabCount - 1) {
-             openNewTab();
+            openNewTab();
         }
     }
 
@@ -742,10 +730,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)
@@ -820,23 +805,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));
@@ -1035,50 +1003,23 @@ void DolphinMainWindow::goHome(Qt::MouseButtons buttons)
 
 void DolphinMainWindow::compareFiles()
 {
-    // The method is only invoked if exactly 2 files have
-    // been selected. The selected files may be:
-    // - both in the primary view
-    // - both in the secondary view
-    // - one in the primary view and the other in the secondary
-    //   view
-    Q_ASSERT(m_viewTab[m_tabIndex].primaryView);
-
-    KUrl urlA;
-    KUrl urlB;
+    const DolphinViewContainer* primaryViewContainer = m_viewTab[m_tabIndex].primaryView;
+    Q_ASSERT(primaryViewContainer);
+    KFileItemList items = primaryViewContainer->view()->selectedItems();
 
-    KFileItemList items = m_viewTab[m_tabIndex].primaryView->view()->selectedItems();
-
-    switch (items.count()) {
-    case 0: {
-        Q_ASSERT(m_viewTab[m_tabIndex].secondaryView);
-        items = m_viewTab[m_tabIndex].secondaryView->view()->selectedItems();
-        Q_ASSERT(items.count() == 2);
-        urlA = items[0].url();
-        urlB = items[1].url();
-        break;
-    }
-
-    case 1: {
-        urlA = items[0].url();
-        Q_ASSERT(m_viewTab[m_tabIndex].secondaryView);
-        items = m_viewTab[m_tabIndex].secondaryView->view()->selectedItems();
-        Q_ASSERT(items.count() == 1);
-        urlB = items[0].url();
-        break;
+    const DolphinViewContainer* secondaryViewContainer = m_viewTab[m_tabIndex].secondaryView;
+    if (secondaryViewContainer) {
+        items.append(secondaryViewContainer->view()->selectedItems());
     }
 
-    case 2: {
-        urlA = items[0].url();
-        urlB = items[1].url();
-        break;
+    if (items.count() != 2) {
+        // The action is disabled in this case, but it could have been triggered
+        // via D-Bus, see https://bugs.kde.org/show_bug.cgi?id=325517
+        return;
     }
 
-    default: {
-        // may not happen: compareFiles may only get invoked if 2
-        // files are selected
-        Q_ASSERT(false);
-    }
-    }
+    KUrl urlA = items.at(0).url();
+    KUrl urlB = items.at(1).url();
 
     QString command("kompare -c \"");
     command.append(urlA.pathOrUrl());
@@ -1093,9 +1034,9 @@ void DolphinMainWindow::toggleShowMenuBar()
     const bool visible = menuBar()->isVisible();
     menuBar()->setVisible(!visible);
     if (visible) {
-        createToolBarMenuButton();
+        createControlButton();
     } else {
-        deleteToolBarMenuButton();
+        deleteControlButton();
     }
 }
 
@@ -1118,7 +1059,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);
@@ -1278,16 +1222,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());
@@ -1303,11 +1237,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()) {
+            KJobWidgets::setWindow(m_lastHandleUrlStatJob, 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
     }
 }
 
@@ -1319,7 +1256,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
     }
 }
 
@@ -1330,7 +1267,11 @@ void DolphinMainWindow::tabDropEvent(int tab, QDropEvent* event)
         const ViewTab& viewTab = m_viewTab[tab];
         const DolphinView* view = viewTab.isPrimaryViewActive ? viewTab.primaryView->view()
                                                               : viewTab.secondaryView->view();
-        DragAndDropHelper::dropUrls(view->rootItem(), event);
+        QString error;
+        DragAndDropHelper::dropUrls(view->rootItem(), view->url(), event, error);
+        if (!error.isEmpty()) {
+            activeViewContainer()->showMessage(error, DolphinViewContainer::Error);
+        }
     }
 }
 
@@ -1339,52 +1280,6 @@ 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 QPoint& pos,
                                         const KFileItem& item,
                                         const KUrl& url,
@@ -1396,12 +1291,13 @@ void DolphinMainWindow::openContextMenu(const QPoint& pos,
 
     switch (command) {
     case DolphinContextMenu::OpenParentFolderInNewWindow: {
-        KRun::run("dolphin", KUrl::List() << item.url().upUrl(), this);
+
+        KRun::run("dolphin %u", QList<QUrl>() << KIO::upUrl(item.url()), this);
         break;
     }
 
     case DolphinContextMenu::OpenParentFolderInNewTab:
-        openNewTab(item.url().upUrl());
+        openNewTab(KIO::upUrl(item.url()));
         break;
 
     case DolphinContextMenu::None:
@@ -1412,7 +1308,7 @@ void DolphinMainWindow::openContextMenu(const QPoint& pos,
     delete contextMenu.data();
 }
 
-void DolphinMainWindow::updateToolBarMenu()
+void DolphinMainWindow::updateControlMenu()
 {
     KMenu* menu = qobject_cast<KMenu*>(sender());
     Q_ASSERT(menu);
@@ -1511,26 +1407,31 @@ 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();
+    activeViewContainer()->showMessage(error, DolphinViewContainer::Error);
 }
 
-void DolphinMainWindow::slotToolBarIconSizeChanged(const QSize& iconSize)
+void DolphinMainWindow::slotPlaceActivated(const KUrl& url)
 {
-    if (m_openToolBarMenuButton) {
-        m_openToolBarMenuButton->setIconSize(iconSize);
+    DolphinViewContainer* view = activeViewContainer();
+
+    if (view->url() == url) {
+        // We can end up here if the user clicked a device in the Places Panel
+        // which had been unmounted earlier, see https://bugs.kde.org/show_bug.cgi?id=161385.
+        reloadView();
+    } else {
+        changeUrl(url);
     }
 }
 
@@ -1585,26 +1486,27 @@ DolphinViewContainer* DolphinMainWindow::createViewContainer(const KUrl& url, QW
 void DolphinMainWindow::setupActions()
 {
     // setup 'File' menu
-    m_newFileMenu = new DolphinNewFileMenu(this);
-    KMenu* menu = m_newFileMenu->menu();
+    m_newFileMenu = new DolphinNewFileMenu(actionCollection(), this);
+    QMenu* menu = m_newFileMenu->menu();
     menu->setTitle(i18nc("@title:menu Create new folder, file, link, etc.", "Create New"));
     menu->setIcon(KIcon("document-new"));
+    m_newFileMenu->setDelayed(false);
     connect(menu, SIGNAL(aboutToShow()),
             this, SLOT(updateNewMenu()));
 
-    KAction* newWindow = actionCollection()->addAction("new_window");
+    QAction* newWindow = actionCollection()->addAction("new_window");
     newWindow->setIcon(KIcon("window-new"));
     newWindow->setText(i18nc("@action:inmenu File", "New &Window"));
     newWindow->setShortcut(Qt::CTRL | Qt::Key_N);
     connect(newWindow, SIGNAL(triggered()), this, SLOT(openNewMainWindow()));
 
-    KAction* newTab = actionCollection()->addAction("new_tab");
+    QAction* newTab = actionCollection()->addAction("new_tab");
     newTab->setIcon(KIcon("tab-new"));
     newTab->setText(i18nc("@action:inmenu File", "New Tab"));
-    newTab->setShortcut(KShortcut(Qt::CTRL | Qt::Key_T, Qt::CTRL | Qt::SHIFT | Qt::Key_N));
+    newTab->setShortcuts(QList<QKeySequence>() << QKeySequence(Qt::CTRL | Qt::Key_T) << QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_N));
     connect(newTab, SIGNAL(triggered()), this, SLOT(openNewTab()));
 
-    KAction* closeTab = actionCollection()->addAction("close_tab");
+    QAction* closeTab = actionCollection()->addAction("close_tab");
     closeTab->setIcon(KIcon("tab-close"));
     closeTab->setText(i18nc("@action:inmenu File", "Close Tab"));
     closeTab->setShortcut(Qt::CTRL | Qt::Key_W);
@@ -1620,12 +1522,12 @@ void DolphinMainWindow::setupActions()
 
     // need to remove shift+del from cut action, else the shortcut for deletejob
     // doesn't work
-    KAction* cut = KStandardAction::cut(this, SLOT(cut()), actionCollection());
-    KShortcut cutShortcut = cut->shortcut();
-    cutShortcut.remove(Qt::SHIFT | Qt::Key_Delete, KShortcut::KeepEmpty);
-    cut->setShortcut(cutShortcut);
+    QAction* cut = KStandardAction::cut(this, SLOT(cut()), actionCollection());
+    auto cutShortcuts = cut->shortcuts();
+    cutShortcuts.removeAll(QKeySequence(Qt::SHIFT | Qt::Key_Delete));
+    cut->setShortcuts(cutShortcuts);
     KStandardAction::copy(this, SLOT(copy()), actionCollection());
-    KAction* paste = KStandardAction::paste(this, SLOT(paste()), actionCollection());
+    QAction* paste = KStandardAction::paste(this, SLOT(paste()), actionCollection());
     // The text of the paste-action is modified dynamically by Dolphin
     // (e. g. to "Paste One Folder"). To prevent that the size of the toolbar changes
     // due to the long text, the text "Paste" is used:
@@ -1633,12 +1535,12 @@ void DolphinMainWindow::setupActions()
 
     KStandardAction::find(this, SLOT(find()), actionCollection());
 
-    KAction* selectAll = actionCollection()->addAction("select_all");
+    QAction* selectAll = actionCollection()->addAction("select_all");
     selectAll->setText(i18nc("@action:inmenu Edit", "Select All"));
     selectAll->setShortcut(Qt::CTRL | Qt::Key_A);
     connect(selectAll, SIGNAL(triggered()), this, SLOT(selectAll()));
 
-    KAction* invertSelection = actionCollection()->addAction("invert_selection");
+    QAction* invertSelection = actionCollection()->addAction("invert_selection");
     invertSelection->setText(i18nc("@action:inmenu Edit", "Invert Selection"));
     invertSelection->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_A);
     connect(invertSelection, SIGNAL(triggered()), this, SLOT(invertSelection()));
@@ -1646,18 +1548,18 @@ void DolphinMainWindow::setupActions()
     // setup 'View' menu
     // (note that most of it is set up in DolphinViewActionHandler)
 
-    KAction* split = actionCollection()->addAction("split_view");
+    QAction* split = actionCollection()->addAction("split_view");
     split->setShortcut(Qt::Key_F3);
     updateSplitAction();
     connect(split, SIGNAL(triggered()), this, SLOT(toggleSplitView()));
 
-    KAction* reload = actionCollection()->addAction("reload");
+    QAction* reload = actionCollection()->addAction("reload");
     reload->setText(i18nc("@action:inmenu View", "Reload"));
     reload->setShortcut(Qt::Key_F5);
     reload->setIcon(KIcon("view-refresh"));
     connect(reload, SIGNAL(triggered()), this, SLOT(reloadView()));
 
-    KAction* stop = actionCollection()->addAction("stop");
+    QAction* stop = actionCollection()->addAction("stop");
     stop->setText(i18nc("@action:inmenu View", "Stop"));
     stop->setToolTip(i18nc("@info", "Stop loading"));
     stop->setIcon(KIcon("process-stop"));
@@ -1665,23 +1567,24 @@ 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");
+    QAction* 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
-    KAction* backAction = KStandardAction::back(this, SLOT(goBack()), actionCollection());
+    QAction* backAction = KStandardAction::back(this, SLOT(goBack()), actionCollection());
     connect(backAction, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), this, SLOT(goBack(Qt::MouseButtons)));
-    KShortcut backShortcut = backAction->shortcut();
-    backShortcut.setAlternate(Qt::Key_Backspace);
-    backAction->setShortcut(backShortcut);
+    auto backShortcuts = backAction->shortcuts();
+    backShortcuts.append(QKeySequence(Qt::Key_Backspace));
+    backAction->setShortcuts(backShortcuts);
 
     m_recentTabsMenu = new KActionMenu(i18n("Recently Closed Tabs"), this);
     m_recentTabsMenu->setIcon(KIcon("edit-undo"));
+    m_recentTabsMenu->setDelayed(false);
     actionCollection()->addAction("closed_tabs", m_recentTabsMenu);
     connect(m_recentTabsMenu->menu(), SIGNAL(triggered(QAction*)),
             this, SLOT(restoreClosedTab(QAction*)));
@@ -1693,29 +1596,29 @@ void DolphinMainWindow::setupActions()
     m_recentTabsMenu->addSeparator();
     m_recentTabsMenu->setEnabled(false);
 
-    KAction* forwardAction = KStandardAction::forward(this, SLOT(goForward()), actionCollection());
+    QAction* forwardAction = KStandardAction::forward(this, SLOT(goForward()), actionCollection());
     connect(forwardAction, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), this, SLOT(goForward(Qt::MouseButtons)));
 
-    KAction* upAction = KStandardAction::up(this, SLOT(goUp()), actionCollection());
+    QAction* upAction = KStandardAction::up(this, SLOT(goUp()), actionCollection());
     connect(upAction, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), this, SLOT(goUp(Qt::MouseButtons)));
 
-    KAction* homeAction = KStandardAction::home(this, SLOT(goHome()), actionCollection());
+    QAction* 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");
+    QAction* showFilterBar = actionCollection()->addAction("show_filter_bar");
     showFilterBar->setText(i18nc("@action:inmenu Tools", "Show Filter Bar"));
     showFilterBar->setIcon(KIcon("view-filter"));
     showFilterBar->setShortcut(Qt::CTRL | Qt::Key_I);
     connect(showFilterBar, SIGNAL(triggered()), this, SLOT(showFilterBar()));
 
-    KAction* compareFiles = actionCollection()->addAction("compare_files");
+    QAction* compareFiles = actionCollection()->addAction("compare_files");
     compareFiles->setText(i18nc("@action:inmenu Tools", "Compare Files"));
     compareFiles->setIcon(KIcon("kompare"));
     compareFiles->setEnabled(false);
     connect(compareFiles, SIGNAL(triggered()), this, SLOT(compareFiles()));
 
-    KAction* openTerminal = actionCollection()->addAction("open_terminal");
+    QAction* openTerminal = actionCollection()->addAction("open_terminal");
     openTerminal->setText(i18nc("@action:inmenu Tools", "Open Terminal"));
     openTerminal->setIcon(KIcon("utilities-terminal"));
     openTerminal->setShortcut(Qt::SHIFT | Qt::Key_F4);
@@ -1729,30 +1632,35 @@ void DolphinMainWindow::setupActions()
 
     // not in menu actions
     QList<QKeySequence> nextTabKeys;
-    nextTabKeys.append(KStandardShortcut::tabNext().primary());
+    nextTabKeys.append(KStandardShortcut::tabNext().first()); //TODO: is this correct
     nextTabKeys.append(QKeySequence(Qt::CTRL | Qt::Key_Tab));
 
     QList<QKeySequence> prevTabKeys;
-    prevTabKeys.append(KStandardShortcut::tabPrev().primary());
+    prevTabKeys.append(KStandardShortcut::tabPrev().first()); //TODO: is this correct
     prevTabKeys.append(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_Tab));
 
-    KAction* activateNextTab = actionCollection()->addAction("activate_next_tab");
+    QAction* activateNextTab = actionCollection()->addAction("activate_next_tab");
     activateNextTab->setText(i18nc("@action:inmenu", "Activate Next Tab"));
     connect(activateNextTab, SIGNAL(triggered()), SLOT(activateNextTab()));
     activateNextTab->setShortcuts(QApplication::isRightToLeft() ? prevTabKeys : nextTabKeys);
 
-    KAction* activatePrevTab = actionCollection()->addAction("activate_prev_tab");
+    QAction* activatePrevTab = actionCollection()->addAction("activate_prev_tab");
     activatePrevTab->setText(i18nc("@action:inmenu", "Activate Previous Tab"));
     connect(activatePrevTab, SIGNAL(triggered()), SLOT(activatePrevTab()));
     activatePrevTab->setShortcuts(QApplication::isRightToLeft() ? nextTabKeys : prevTabKeys);
 
     // for context menu
-    KAction* openInNewTab = actionCollection()->addAction("open_in_new_tab");
+    QAction* openInNewTab = actionCollection()->addAction("open_in_new_tab");
     openInNewTab->setText(i18nc("@action:inmenu", "Open in New Tab"));
     openInNewTab->setIcon(KIcon("tab-new"));
     connect(openInNewTab, SIGNAL(triggered()), this, SLOT(openInNewTab()));
 
-    KAction* openInNewWindow = actionCollection()->addAction("open_in_new_window");
+    QAction* openInNewTabs = actionCollection()->addAction("open_in_new_tabs");
+    openInNewTabs->setText(i18nc("@action:inmenu", "Open in New Tabs"));
+    openInNewTabs->setIcon(KIcon("tab-new"));
+    connect(openInNewTabs, SIGNAL(triggered()), this, SLOT(openInNewTab()));
+
+    QAction* openInNewWindow = actionCollection()->addAction("open_in_new_window");
     openInNewWindow->setText(i18nc("@action:inmenu", "Open in New Window"));
     openInNewWindow->setIcon(KIcon("window-new"));
     connect(openInNewWindow, SIGNAL(triggered()), this, SLOT(openInNewWindow()));
@@ -1806,8 +1714,12 @@ void DolphinMainWindow::setupDockWidgets()
     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
@@ -1820,6 +1732,7 @@ 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()));
 
@@ -1831,32 +1744,11 @@ void DolphinMainWindow::setupDockWidgets()
             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();
-    createPanelAction(KIcon("system-search"), Qt::Key_F12, searchAction, "show_search_panel");
-    addDockWidget(Qt::RightDockWidgetArea, searchDock);
-    connect(this, SIGNAL(urlChanged(KUrl)),
-            searchPanel, SLOT(setUrl(KUrl)));
-#endif
-
     if (GeneralSettings::version() < 200) {
         infoDock->hide();
         foldersDock->hide();
 #ifndef Q_OS_WIN
         terminalDock->hide();
-#endif
-#ifdef HAVE_NEPOMUK
-        searchDock->hide();
 #endif
     }
 
@@ -1867,26 +1759,25 @@ 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(DolphinPlacesModel::instance());
-    placesPanel->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+    placesPanel->setCustomContextMenuActions(QList<QAction*>() << lockLayoutAction);
     placesDock->setWidget(placesPanel);
 
     QAction* placesAction = placesDock->toggleViewAction();
     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(slotPlaceActivated(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);
@@ -1898,9 +1789,6 @@ void DolphinMainWindow::setupDockWidgets()
     panelsMenu->addAction(ac->action("show_folders_panel"));
 #ifndef Q_OS_WIN
     panelsMenu->addAction(ac->action("show_terminal_panel"));
-#endif
-#ifdef HAVE_NEPOMUK
-    panelsMenu->addAction(ac->action("show_search_panel"));
 #endif
     panelsMenu->addSeparator();
     panelsMenu->addAction(lockLayoutAction);
@@ -1954,48 +1842,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);
+    Q_ASSERT(!m_controlButton);
 
-    m_toolBarSpacer = new QWidget(this);
-    m_toolBarSpacer->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
+    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());
 
-    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"));
+    KMenu* controlMenu = new KMenu(m_controlButton);
+    connect(controlMenu, SIGNAL(aboutToShow()), this, SLOT(updateControlMenu()));
 
-    KMenu* toolBarMenu = new ToolBarMenu(m_openToolBarMenuButton);
-    connect(toolBarMenu, SIGNAL(aboutToShow()), this, SLOT(updateToolBarMenu()));
+    m_controlButton->setMenu(controlMenu);
 
-    m_openToolBarMenuButton->setMenu(toolBarMenu);
-
-    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;
@@ -2019,7 +1902,7 @@ bool DolphinMainWindow::addActionToMenu(QAction* action, KMenu* menu)
 
 void DolphinMainWindow::rememberClosedTab(int index)
 {
-    KMenu* tabsMenu = m_recentTabsMenu->menu();
+    QMenu* tabsMenu = m_recentTabsMenu->menu();
 
     const QString primaryPath = m_viewTab[index].primaryView->url().path();
     const QString iconName = KMimeType::iconNameForUrl(primaryPath);
@@ -2066,9 +1949,9 @@ 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();
         }
     }
 
@@ -2085,11 +1968,13 @@ void DolphinMainWindow::refreshViews()
             toggleSplitView();
         }
     }
+
+    emit settingsChanged();
 }
 
 void DolphinMainWindow::clearStatusBar()
 {
-    m_activeViewContainer->statusBar()->clear();
+    m_activeViewContainer->statusBar()->resetToDefaultText();
 }
 
 void DolphinMainWindow::connectViewSignals(DolphinViewContainer* container)
@@ -2098,12 +1983,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)),
@@ -2116,10 +1995,14 @@ void DolphinMainWindow::connectViewSignals(DolphinViewContainer* container)
             this, SLOT(openNewTab(KUrl)));
     connect(view, SIGNAL(requestContextMenu(QPoint,KFileItem,KUrl,QList<QAction*>)),
             this, SLOT(openContextMenu(QPoint,KFileItem,KUrl,QList<QAction*>)));
-    connect(view, SIGNAL(startedPathLoading(KUrl)),
+    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)),
@@ -2191,7 +2074,13 @@ void DolphinMainWindow::createSecondaryView(int tabIndex)
     const int newWidth = (viewTab.primaryView->width() - splitter->handleWidth()) / 2;
 
     const DolphinView* view = viewTab.primaryView->view();
-    viewTab.secondaryView = createViewContainer(view->url(), 0);
+    // 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);
 
@@ -2233,7 +2122,7 @@ void DolphinMainWindow::createPanelAction(const KIcon& icon,
                                           QAction* dockAction,
                                           const QString& actionName)
 {
-    KAction* panelAction = actionCollection()->addAction(actionName);
+    QAction* panelAction = actionCollection()->addAction(actionName);
     panelAction->setCheckable(true);
     panelAction->setChecked(dockAction->isChecked());
     panelAction->setText(dockAction->text());
@@ -2257,54 +2146,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"