]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinmainwindow.cpp
Merge remote-tracking branch 'origin/master' into frameworks
[dolphin.git] / src / dolphinmainwindow.cpp
index 3f527d9a5c2b178a535738f6bbb90d63cb6f8106..049c440882122248baf3abaaf93a29a005847e3d 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 <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
@@ -102,18 +96,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
@@ -138,38 +120,30 @@ 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(), &DolphinNewFileMenuObserver::errorMessage,
+            this, &DolphinMainWindow::showErrorMessage);
+
     KIO::FileUndoManager* undoManager = KIO::FileUndoManager::self();
     undoManager->setUiInterface(new UndoUiInterface());
 
-    connect(undoManager, SIGNAL(undoAvailable(bool)),
-            this, SLOT(slotUndoAvailable(bool)));
-    connect(undoManager, SIGNAL(undoTextChanged(QString)),
-            this, SLOT(slotUndoTextChanged(QString)));
-    connect(undoManager, SIGNAL(jobRecordingStarted(CommandType)),
-            this, SLOT(clearStatusBar()));
-    connect(undoManager, SIGNAL(jobRecordingFinished(CommandType)),
-            this, SLOT(showCommand(CommandType)));
+    connect(undoManager, static_cast<void(KIO::FileUndoManager::*)(bool)>(&KIO::FileUndoManager::undoAvailable),
+            this, &DolphinMainWindow::slotUndoAvailable);
+    connect(undoManager, &KIO::FileUndoManager::undoTextChanged,
+            this, &DolphinMainWindow::slotUndoTextChanged);
+    connect(undoManager, &KIO::FileUndoManager::jobRecordingStarted,
+            this, &DolphinMainWindow::clearStatusBar);
+    connect(undoManager, &KIO::FileUndoManager::jobRecordingFinished,
+            this, &DolphinMainWindow::showCommand);
 
     GeneralSettings* generalSettings = GeneralSettings::self();
     const bool firstRun = (generalSettings->version() < 200);
@@ -187,8 +161,8 @@ DolphinMainWindow::DolphinMainWindow() :
     const KUrl homeUrl(generalSettings->homeUrl());
     setUrlAsCaption(homeUrl);
     m_actionHandler = new DolphinViewActionHandler(actionCollection(), this);
-    connect(m_actionHandler, SIGNAL(actionBeingHandled()), SLOT(clearStatusBar()));
-    connect(m_actionHandler, SIGNAL(createDirectory()), SLOT(createDirectory()));
+    connect(m_actionHandler, &DolphinViewActionHandler::actionBeingHandled, this, &DolphinMainWindow::clearStatusBar);
+    connect(m_actionHandler, &DolphinViewActionHandler::createDirectory, this, &DolphinMainWindow::createDirectory);
 
     viewTab.primaryView = createViewContainer(homeUrl, viewTab.splitter);
 
@@ -199,28 +173,28 @@ DolphinMainWindow::DolphinMainWindow() :
     m_actionHandler->setCurrentView(view);
 
     m_remoteEncoding = new DolphinRemoteEncoding(this, m_actionHandler);
-    connect(this, SIGNAL(urlChanged(KUrl)),
-            m_remoteEncoding, SLOT(slotAboutToOpenUrl()));
+    connect(this, &DolphinMainWindow::urlChanged,
+            m_remoteEncoding, &DolphinRemoteEncoding::slotAboutToOpenUrl);
 
     m_tabBar = new KTabBar(this);
     m_tabBar->setMovable(true);
     m_tabBar->setTabsClosable(true);
-    connect(m_tabBar, SIGNAL(currentChanged(int)),
-            this, SLOT(setActiveTab(int)));
-    connect(m_tabBar, SIGNAL(tabCloseRequested(int)),
-            this, SLOT(closeTab(int)));
-    connect(m_tabBar, SIGNAL(contextMenu(int,QPoint)),
-            this, SLOT(openTabContextMenu(int,QPoint)));
-    connect(m_tabBar, SIGNAL(newTabRequest()),
-            this, SLOT(openNewTab()));
-    connect(m_tabBar, SIGNAL(testCanDecode(const QDragMoveEvent*,bool&)),
-            this, SLOT(slotTestCanDecode(const QDragMoveEvent*,bool&)));
-    connect(m_tabBar, SIGNAL(mouseMiddleClick(int)),
-            this, SLOT(closeTab(int)));
-    connect(m_tabBar, SIGNAL(tabMoved(int,int)),
-            this, SLOT(slotTabMoved(int,int)));
-    connect(m_tabBar, SIGNAL(receivedDropEvent(int,QDropEvent*)),
-            this, SLOT(tabDropEvent(int,QDropEvent*)));
+    connect(m_tabBar, &KTabBar::currentChanged,
+            this, &DolphinMainWindow::setActiveTab);
+    connect(m_tabBar, &KTabBar::tabCloseRequested,
+            this, static_cast<void(DolphinMainWindow::*)(int)>(&DolphinMainWindow::closeTab));
+    connect(m_tabBar, &KTabBar::contextMenu,
+            this, &DolphinMainWindow::openTabContextMenu);
+    connect(m_tabBar, &KTabBar::newTabRequest,
+            this, static_cast<void(DolphinMainWindow::*)()>(&DolphinMainWindow::openNewTab));
+    connect(m_tabBar, &KTabBar::testCanDecode,
+            this, &DolphinMainWindow::slotTestCanDecode);
+    connect(m_tabBar, &KTabBar::mouseMiddleClick,
+            this, static_cast<void(DolphinMainWindow::*)(int)>(&DolphinMainWindow::closeTab));
+    connect(m_tabBar, &KTabBar::tabMoved,
+            this, &DolphinMainWindow::slotTabMoved);
+    connect(m_tabBar, &KTabBar::receivedDropEvent,
+            this, &DolphinMainWindow::tabDropEvent);
 
     m_tabBar->blockSignals(true);  // signals get unblocked after at least 2 tabs are open
 
@@ -239,13 +213,14 @@ DolphinMainWindow::DolphinMainWindow() :
     stateChanged("new_file");
 
     QClipboard* clipboard = QApplication::clipboard();
-    connect(clipboard, SIGNAL(dataChanged()),
-            this, SLOT(updatePasteAction()));
+    connect(clipboard, &QClipboard::dataChanged,
+            this, &DolphinMainWindow::updatePasteAction);
 
     if (generalSettings->splitView()) {
         toggleSplitView();
     }
     updateEditActions();
+    updatePasteAction();
     updateViewActions();
     updateGoActions();
 
@@ -262,7 +237,7 @@ DolphinMainWindow::DolphinMainWindow() :
     QAction* showMenuBarAction = actionCollection()->action(KStandardAction::name(KStandardAction::ShowMenubar));
     showMenuBarAction->setChecked(showMenu);  // workaround for bug #171080
     if (!showMenu) {
-        createToolBarMenuButton();
+        createControlButton();
     }
 }
 
@@ -287,12 +262,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;
@@ -343,29 +318,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:
@@ -391,18 +360,26 @@ void DolphinMainWindow::changeUrl(const KUrl& url)
     if (view) {
         view->setUrl(url);
         updateEditActions();
+        updatePasteAction();
         updateViewActions();
         updateGoActions();
         setUrlAsCaption(url);
         if (m_viewTab.count() > 1) {
             m_tabBar->setTabText(m_tabIndex, squeezedText(tabName(m_activeViewContainer->url())));
         }
-        const QString iconName = KMimeType::iconNameForUrl(url);
-        m_tabBar->setTabIcon(m_tabIndex, KIcon(iconName));
+        const QString iconName = KIO::iconNameForUrl(url);
+        m_tabBar->setTabIcon(m_tabIndex, QIcon::fromTheme(iconName));
         emit urlChanged(url);
     }
 }
 
+void DolphinMainWindow::slotTerminalDirectoryChanged(const KUrl& url)
+{
+    m_activeViewContainer->setAutoGrabFocus(false);
+    changeUrl(url);
+    m_activeViewContainer->setAutoGrabFocus(true);
+}
+
 void DolphinMainWindow::slotEditableStateChanged(bool editable)
 {
     KToggleAction* editableLocationAction =
@@ -461,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()
@@ -491,12 +468,12 @@ void DolphinMainWindow::openNewTab(const KUrl& url)
         // Only one view is open currently and hence no tab is shown at
         // all. Before creating a tab for 'url', provide a tab for the current URL.
         const KUrl currentUrl = m_activeViewContainer->url();
-        m_tabBar->addTab(KIcon(KMimeType::iconNameForUrl(currentUrl)),
+        m_tabBar->addTab(QIcon::fromTheme(KIO::iconNameForUrl(currentUrl)),
                          squeezedText(tabName(currentUrl)));
         m_tabBar->blockSignals(false);
     }
 
-    m_tabBar->addTab(KIcon(KMimeType::iconNameForUrl(url)),
+    m_tabBar->addTab(QIcon::fromTheme(KIO::iconNameForUrl(url)),
                      squeezedText(tabName(url)));
 
     ViewTab viewTab;
@@ -509,13 +486,15 @@ void DolphinMainWindow::openNewTab(const KUrl& url)
     m_viewTab.append(viewTab);
 
     actionCollection()->action("close_tab")->setEnabled(true);
+    actionCollection()->action("activate_prev_tab")->setEnabled(true);
+    actionCollection()->action("activate_next_tab")->setEnabled(true);
 
-    // provide a split view, if the startup settings are set this way
+    // Provide a split view, if the startup settings are set this way
     if (GeneralSettings::splitView()) {
         const int newTabIndex = m_viewTab.count() - 1;
         createSecondaryView(newTabIndex);
-        viewTab.secondaryView->setActive(true);
-        viewTab.isPrimaryViewActive = false;
+        m_viewTab[newTabIndex].secondaryView->setActive(true);
+        m_viewTab[newTabIndex].isPrimaryViewActive = false;
     }
 
     if (focusWidget) {
@@ -525,6 +504,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) {
@@ -546,11 +531,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);
+            }
+        }
     }
 }
 
@@ -561,12 +551,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);
     }
 }
 
@@ -609,18 +600,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"), QIcon::fromTheme("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(),
@@ -638,7 +630,7 @@ void DolphinMainWindow::closeEvent(QCloseEvent* event)
                 break;
             case KDialog::No:
                 // Close only the current tab
-              closeTab();
+                closeTab();
             default:
                 event->ignore();
                 return;
@@ -648,14 +640,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);
 }
 
@@ -701,6 +685,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);
@@ -712,7 +703,7 @@ void DolphinMainWindow::readProperties(const KConfigGroup& group)
 
         // openNewTab() needs to be called only tabCount - 1 times
         if (i != tabCount - 1) {
-             openNewTab();
+            openNewTab();
         }
     }
 
@@ -741,10 +732,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)
@@ -819,23 +807,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));
@@ -1024,53 +995,34 @@ void DolphinMainWindow::goUp(Qt::MouseButtons buttons)
     }
 }
 
-void DolphinMainWindow::compareFiles()
+void DolphinMainWindow::goHome(Qt::MouseButtons buttons)
 {
-    // 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;
-
-    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;
+    // The default case (left button pressed) is handled in goHome().
+    if (buttons == Qt::MidButton) {
+        openNewTab(GeneralSettings::self()->homeUrl());
     }
+}
 
-    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;
-    }
+void DolphinMainWindow::compareFiles()
+{
+    const DolphinViewContainer* primaryViewContainer = m_viewTab[m_tabIndex].primaryView;
+    Q_ASSERT(primaryViewContainer);
+    KFileItemList items = primaryViewContainer->view()->selectedItems();
 
-    case 2: {
-        urlA = items[0].url();
-        urlB = items[1].url();
-        break;
+    const DolphinViewContainer* secondaryViewContainer = m_viewTab[m_tabIndex].secondaryView;
+    if (secondaryViewContainer) {
+        items.append(secondaryViewContainer->view()->selectedItems());
     }
 
-    default: {
-        // may not happen: compareFiles may only get invoked if 2
-        // files are selected
-        Q_ASSERT(false);
-    }
+    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;
     }
 
+    KUrl urlA = items.at(0).url();
+    KUrl urlB = items.at(1).url();
+
     QString command("kompare -c \"");
     command.append(urlA.pathOrUrl());
     command.append("\" \"");
@@ -1084,9 +1036,9 @@ void DolphinMainWindow::toggleShowMenuBar()
     const bool visible = menuBar()->isVisible();
     menuBar()->setVisible(!visible);
     if (visible) {
-        createToolBarMenuButton();
+        createControlButton();
     } else {
-        deleteToolBarMenuButton();
+        deleteControlButton();
     }
 }
 
@@ -1109,9 +1061,12 @@ 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()));
+        connect(settingsDialog, &DolphinSettingsDialog::settingsChanged, this, &DolphinMainWindow::refreshViews);
         settingsDialog->setAttribute(Qt::WA_DeleteOnClose);
         settingsDialog->show();
         m_settingsDialog = settingsDialog;
@@ -1208,6 +1163,8 @@ void DolphinMainWindow::closeTab(int index)
     if (m_viewTab.count() == 1) {
         m_tabBar->removeTab(0);
         actionCollection()->action("close_tab")->setEnabled(false);
+        actionCollection()->action("activate_prev_tab")->setEnabled(false);
+        actionCollection()->action("activate_next_tab")->setEnabled(false);
     } else {
         m_tabBar->blockSignals(false);
     }
@@ -1217,14 +1174,14 @@ void DolphinMainWindow::openTabContextMenu(int index, const QPoint& pos)
 {
     KMenu menu(this);
 
-    QAction* newTabAction = menu.addAction(KIcon("tab-new"), i18nc("@action:inmenu", "New Tab"));
+    QAction* newTabAction = menu.addAction(QIcon::fromTheme("tab-new"), i18nc("@action:inmenu", "New Tab"));
     newTabAction->setShortcut(actionCollection()->action("new_tab")->shortcut());
 
-    QAction* detachTabAction = menu.addAction(KIcon("tab-detach"), i18nc("@action:inmenu", "Detach Tab"));
+    QAction* detachTabAction = menu.addAction(QIcon::fromTheme("tab-detach"), i18nc("@action:inmenu", "Detach Tab"));
 
-    QAction* closeOtherTabsAction = menu.addAction(KIcon("tab-close-other"), i18nc("@action:inmenu", "Close Other Tabs"));
+    QAction* closeOtherTabsAction = menu.addAction(QIcon::fromTheme("tab-close-other"), i18nc("@action:inmenu", "Close Other Tabs"));
 
-    QAction* closeTabAction = menu.addAction(KIcon("tab-close"), i18nc("@action:inmenu", "Close Tab"));
+    QAction* closeTabAction = menu.addAction(QIcon::fromTheme("tab-close"), i18nc("@action:inmenu", "Close Tab"));
     closeTabAction->setShortcut(actionCollection()->action("close_tab")->shortcut());
     QAction* selectedAction = menu.exec(pos);
     if (selectedAction == newTabAction) {
@@ -1269,16 +1226,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());
@@ -1294,11 +1241,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);
-        connect(m_lastHandleUrlStatJob, SIGNAL(result(KJob*)),
-                this, SLOT(slotHandleUrlStatFinished(KJob*)));
+        if (m_lastHandleUrlStatJob->ui()) {
+            KJobWidgets::setWindow(m_lastHandleUrlStatJob, this);
+        }
+        connect(m_lastHandleUrlStatJob, &KIO::Job::result,
+                this, &DolphinMainWindow::slotHandleUrlStatFinished);
 
     } else {
-        new KRun(url, this);
+        new KRun(url, this); // Automatically deletes itself after being finished
     }
 }
 
@@ -1310,7 +1260,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
     }
 }
 
@@ -1319,9 +1269,13 @@ 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();
+        QString error;
+        DragAndDropHelper::dropUrls(view->rootItem(), view->url(), event, error);
+        if (!error.isEmpty()) {
+            activeViewContainer()->showMessage(error, DolphinViewContainer::Error);
+        }
     }
 }
 
@@ -1330,52 +1284,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,
@@ -1387,12 +1295,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:
@@ -1403,7 +1312,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);
@@ -1459,7 +1368,7 @@ void DolphinMainWindow::updateToolBarMenu()
 
     // Add "Go" menu
     KMenu* goMenu = new KMenu(i18nc("@action:inmenu", "Go"), menu);
-    connect(menu, SIGNAL(aboutToHide()), goMenu, SLOT(deleteLater()));
+    connect(menu, &KMenu::aboutToHide, goMenu, &KMenu::deleteLater);
     goMenu->addAction(ac->action(KStandardAction::name(KStandardAction::Back)));
     goMenu->addAction(ac->action(KStandardAction::name(KStandardAction::Forward)));
     goMenu->addAction(ac->action(KStandardAction::name(KStandardAction::Up)));
@@ -1469,7 +1378,7 @@ void DolphinMainWindow::updateToolBarMenu()
 
     // Add "Tool" menu
     KMenu* toolsMenu = new KMenu(i18nc("@action:inmenu", "Tools"), menu);
-    connect(menu, SIGNAL(aboutToHide()), toolsMenu, SLOT(deleteLater()));
+    connect(menu, &KMenu::aboutToHide, toolsMenu, &KMenu::deleteLater);
     toolsMenu->addAction(ac->action("show_filter_bar"));
     toolsMenu->addAction(ac->action("compare_files"));
     toolsMenu->addAction(ac->action("open_terminal"));
@@ -1483,7 +1392,7 @@ void DolphinMainWindow::updateToolBarMenu()
 
     // Add "Help" menu
     KMenu* helpMenu = new KMenu(i18nc("@action:inmenu", "Help"), menu);
-    connect(menu, SIGNAL(aboutToHide()), helpMenu, SLOT(deleteLater()));
+    connect(menu, &KMenu::aboutToHide, helpMenu, &KMenu::deleteLater);
     helpMenu->addAction(ac->action(KStandardAction::name(KStandardAction::HelpContents)));
     helpMenu->addAction(ac->action(KStandardAction::name(KStandardAction::WhatsThis)));
     helpMenu->addSeparator();
@@ -1502,26 +1411,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);
     }
 }
 
@@ -1540,14 +1454,15 @@ void DolphinMainWindow::setActiveViewContainer(DolphinViewContainer* viewContain
     // Activating the view container might trigger a recursive setActiveViewContainer() call
     // inside DolphinMainWindow::toggleActiveView() when having a split view. Temporary
     // disconnect the activated() signal in this case:
-    disconnect(m_activeViewContainer->view(), SIGNAL(activated()), this, SLOT(toggleActiveView()));
+    disconnect(m_activeViewContainer->view(), &DolphinView::activated, this, &DolphinMainWindow::toggleActiveView);
     m_activeViewContainer->setActive(true);
-    connect(m_activeViewContainer->view(), SIGNAL(activated()), this, SLOT(toggleActiveView()));
+    connect(m_activeViewContainer->view(), &DolphinView::activated, this, &DolphinMainWindow::toggleActiveView);
 
     m_actionHandler->setCurrentView(viewContainer->view());
 
     updateHistory();
     updateEditActions();
+    updatePasteAction();
     updateViewActions();
     updateGoActions();
 
@@ -1555,7 +1470,7 @@ void DolphinMainWindow::setActiveViewContainer(DolphinViewContainer* viewContain
     setUrlAsCaption(url);
     if (m_viewTab.count() > 1) {
         m_tabBar->setTabText(m_tabIndex, tabName(url));
-        m_tabBar->setTabIcon(m_tabIndex, KIcon(KMimeType::iconNameForUrl(url)));
+        m_tabBar->setTabIcon(m_tabIndex, QIcon::fromTheme(KIO::iconNameForUrl(url)));
     }
 
     emit urlChanged(url);
@@ -1576,31 +1491,32 @@ 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"));
-    connect(menu, SIGNAL(aboutToShow()),
-            this, SLOT(updateNewMenu()));
+    menu->setIcon(QIcon::fromTheme("document-new"));
+    m_newFileMenu->setDelayed(false);
+    connect(menu, &QMenu::aboutToShow,
+            this, &DolphinMainWindow::updateNewMenu);
 
-    KAction* newWindow = actionCollection()->addAction("new_window");
-    newWindow->setIcon(KIcon("window-new"));
+    QAction* newWindow = actionCollection()->addAction("new_window");
+    newWindow->setIcon(QIcon::fromTheme("window-new"));
     newWindow->setText(i18nc("@action:inmenu File", "New &Window"));
     newWindow->setShortcut(Qt::CTRL | Qt::Key_N);
-    connect(newWindow, SIGNAL(triggered()), this, SLOT(openNewMainWindow()));
+    connect(newWindow, &QAction::triggered, this, &DolphinMainWindow::openNewMainWindow);
 
-    KAction* newTab = actionCollection()->addAction("new_tab");
-    newTab->setIcon(KIcon("tab-new"));
+    QAction* newTab = actionCollection()->addAction("new_tab");
+    newTab->setIcon(QIcon::fromTheme("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));
-    connect(newTab, SIGNAL(triggered()), this, SLOT(openNewTab()));
+    newTab->setShortcuts(QList<QKeySequence>() << QKeySequence(Qt::CTRL | Qt::Key_T) << QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_N));
+    connect(newTab, &QAction::triggered, this, static_cast<void(DolphinMainWindow::*)()>(&DolphinMainWindow::openNewTab));
 
-    KAction* closeTab = actionCollection()->addAction("close_tab");
-    closeTab->setIcon(KIcon("tab-close"));
+    QAction* closeTab = actionCollection()->addAction("close_tab");
+    closeTab->setIcon(QIcon::fromTheme("tab-close"));
     closeTab->setText(i18nc("@action:inmenu File", "Close Tab"));
     closeTab->setShortcut(Qt::CTRL | Qt::Key_W);
     closeTab->setEnabled(false);
-    connect(closeTab, SIGNAL(triggered()), this, SLOT(closeTab()));
+    connect(closeTab, &QAction::triggered, this, static_cast<void(DolphinMainWindow::*)()>(&DolphinMainWindow::closeTab));
 
     KStandardAction::quit(this, SLOT(quit()), actionCollection());
 
@@ -1611,12 +1527,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:
@@ -1624,128 +1540,139 @@ 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()));
+    connect(selectAll, &QAction::triggered, this, &DolphinMainWindow::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()));
+    connect(invertSelection, &QAction::triggered, this, &DolphinMainWindow::invertSelection);
 
     // 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()));
+    connect(split, &QAction::triggered, this, &DolphinMainWindow::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()));
+    reload->setIcon(QIcon::fromTheme("view-refresh"));
+    connect(reload, &QAction::triggered, this, &DolphinMainWindow::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"));
-    connect(stop, SIGNAL(triggered()), this, SLOT(stopLoading()));
+    stop->setIcon(QIcon::fromTheme("process-stop"));
+    connect(stop, &QAction::triggered, this, &DolphinMainWindow::stopLoading);
 
     KToggleAction* editableLocation = actionCollection()->add<KToggleAction>("editable_location");
     editableLocation->setText(i18nc("@action:inmenu Navigation Bar", "Editable Location"));
-    editableLocation->setShortcut(Qt::CTRL | Qt::Key_L);
-    connect(editableLocation, SIGNAL(triggered()), this, SLOT(toggleEditLocation()));
+    editableLocation->setShortcut(Qt::Key_F6);
+    connect(editableLocation, &KToggleAction::triggered, this, &DolphinMainWindow::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);
-    connect(replaceLocation, SIGNAL(triggered()), this, SLOT(replaceLocation()));
+    replaceLocation->setShortcut(Qt::CTRL | Qt::Key_L);
+    connect(replaceLocation, &QAction::triggered, this, &DolphinMainWindow::replaceLocation);
 
     // setup 'Go' menu
-    KAction* 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);
+    QAction* backAction = KStandardAction::back(this, SLOT(goBack()), actionCollection());
+    connect(backAction, &QAction::triggered, this, static_cast<void(DolphinMainWindow::*)()>(&DolphinMainWindow::goBack));
+    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->setIcon(QIcon::fromTheme("edit-undo"));
+    m_recentTabsMenu->setDelayed(false);
     actionCollection()->addAction("closed_tabs", m_recentTabsMenu);
-    connect(m_recentTabsMenu->menu(), SIGNAL(triggered(QAction*)),
-            this, SLOT(restoreClosedTab(QAction*)));
+    connect(m_recentTabsMenu->menu(), &QMenu::triggered,
+            this, &DolphinMainWindow::restoreClosedTab);
 
     QAction* action = new QAction(i18n("Empty Recently Closed Tabs"), m_recentTabsMenu);
-    action->setIcon(KIcon("edit-clear-list"));
+    action->setIcon(QIcon::fromTheme("edit-clear-list"));
     action->setData(QVariant::fromValue(true));
     m_recentTabsMenu->addAction(action);
     m_recentTabsMenu->addSeparator();
     m_recentTabsMenu->setEnabled(false);
 
-    KAction* forwardAction = KStandardAction::forward(this, SLOT(goForward()), actionCollection());
-    connect(forwardAction, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), this, SLOT(goForward(Qt::MouseButtons)));
+    QAction* forwardAction = KStandardAction::forward(this, SLOT(goForward()), actionCollection());
+    connect(forwardAction, &QAction::triggered, this, static_cast<void(DolphinMainWindow::*)()>(&DolphinMainWindow::goForward));
 
-    KAction* upAction = KStandardAction::up(this, SLOT(goUp()), actionCollection());
-    connect(upAction, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), this, SLOT(goUp(Qt::MouseButtons)));
+    QAction* upAction = KStandardAction::up(this, SLOT(goUp()), actionCollection());
+    connect(upAction, &QAction::triggered, this, static_cast<void(DolphinMainWindow::*)()>(&DolphinMainWindow::goUp));
 
-    KStandardAction::home(this, SLOT(goHome()), actionCollection());
+    QAction* homeAction = KStandardAction::home(this, SLOT(goHome()), actionCollection());
+    connect(homeAction, &QAction::triggered, this, static_cast<void(DolphinMainWindow::*)()>(&DolphinMainWindow::goHome));
 
     // 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->setIcon(QIcon::fromTheme("view-filter"));
     showFilterBar->setShortcut(Qt::CTRL | Qt::Key_I);
-    connect(showFilterBar, SIGNAL(triggered()), this, SLOT(showFilterBar()));
+    connect(showFilterBar, &QAction::triggered, this, &DolphinMainWindow::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->setIcon(QIcon::fromTheme("kompare"));
     compareFiles->setEnabled(false);
-    connect(compareFiles, SIGNAL(triggered()), this, SLOT(compareFiles()));
+    connect(compareFiles, &QAction::triggered, this, &DolphinMainWindow::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->setIcon(QIcon::fromTheme("utilities-terminal"));
     openTerminal->setShortcut(Qt::SHIFT | Qt::Key_F4);
-    connect(openTerminal, SIGNAL(triggered()), this, SLOT(openTerminal()));
+    connect(openTerminal, &QAction::triggered, this, &DolphinMainWindow::openTerminal);
 
     // setup 'Settings' menu
     KToggleAction* showMenuBar = KStandardAction::showMenubar(0, 0, actionCollection());
-    connect(showMenuBar, SIGNAL(triggered(bool)),                   // Fixes #286822
-            this, SLOT(toggleShowMenuBar()), Qt::QueuedConnection);
+    connect(showMenuBar, &KToggleAction::triggered,                   // Fixes #286822
+            this, &DolphinMainWindow::toggleShowMenuBar, Qt::QueuedConnection);
     KStandardAction::preferences(this, SLOT(editSettings()), actionCollection());
 
     // 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->setIconText(i18nc("@action:inmenu", "Next Tab"));
     activateNextTab->setText(i18nc("@action:inmenu", "Activate Next Tab"));
-    connect(activateNextTab, SIGNAL(triggered()), SLOT(activateNextTab()));
+    activateNextTab->setEnabled(false);
+    connect(activateNextTab, &QAction::triggered, this, &DolphinMainWindow::activateNextTab);
     activateNextTab->setShortcuts(QApplication::isRightToLeft() ? prevTabKeys : nextTabKeys);
 
-    KAction* activatePrevTab = actionCollection()->addAction("activate_prev_tab");
+    QAction* activatePrevTab = actionCollection()->addAction("activate_prev_tab");
+    activatePrevTab->setIconText(i18nc("@action:inmenu", "Previous Tab"));
     activatePrevTab->setText(i18nc("@action:inmenu", "Activate Previous Tab"));
-    connect(activatePrevTab, SIGNAL(triggered()), SLOT(activatePrevTab()));
+    activatePrevTab->setEnabled(false);
+    connect(activatePrevTab, &QAction::triggered, this, &DolphinMainWindow::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()));
+    openInNewTab->setIcon(QIcon::fromTheme("tab-new"));
+    connect(openInNewTab, &QAction::triggered, this, &DolphinMainWindow::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(QIcon::fromTheme("tab-new"));
+    connect(openInNewTabs, &QAction::triggered, this, &DolphinMainWindow::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()));
+    openInNewWindow->setIcon(QIcon::fromTheme("window-new"));
+    connect(openInNewWindow, &QAction::triggered, this, &DolphinMainWindow::openInNewWindow);
 }
 
 void DolphinMainWindow::setupDockWidgets()
@@ -1754,32 +1681,32 @@ void DolphinMainWindow::setupDockWidgets()
 
     KDualAction* lockLayoutAction = actionCollection()->add<KDualAction>("lock_panels");
     lockLayoutAction->setActiveText(i18nc("@action:inmenu Panels", "Unlock Panels"));
-    lockLayoutAction->setActiveIcon(KIcon("object-unlocked"));
+    lockLayoutAction->setActiveIcon(QIcon::fromTheme("object-unlocked"));
     lockLayoutAction->setInactiveText(i18nc("@action:inmenu Panels", "Lock Panels"));
-    lockLayoutAction->setInactiveIcon(KIcon("object-locked"));
+    lockLayoutAction->setInactiveIcon(QIcon::fromTheme("object-locked"));
     lockLayoutAction->setActive(lock);
-    connect(lockLayoutAction, SIGNAL(triggered()), this, SLOT(togglePanelLockState()));
+    connect(lockLayoutAction, &KDualAction::triggered, this, &DolphinMainWindow::togglePanelLockState);
 
     // Setup "Information"
     DolphinDockWidget* infoDock = new DolphinDockWidget(i18nc("@title:window", "Information"));
     infoDock->setLocked(lock);
     infoDock->setObjectName("infoDock");
     infoDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
-    Panel* infoPanel = new InformationPanel(infoDock);
+    InformationPanel* infoPanel = new InformationPanel(infoDock);
     infoPanel->setCustomContextMenuActions(QList<QAction*>() << lockLayoutAction);
-    connect(infoPanel, SIGNAL(urlActivated(KUrl)), this, SLOT(handleUrl(KUrl)));
+    connect(infoPanel, &InformationPanel::urlActivated, this, &DolphinMainWindow::handleUrl);
     infoDock->setWidget(infoPanel);
 
     QAction* infoAction = infoDock->toggleViewAction();
-    createPanelAction(KIcon("dialog-information"), Qt::Key_F11, infoAction, "show_information_panel");
+    createPanelAction(QIcon::fromTheme("dialog-information"), Qt::Key_F11, infoAction, "show_information_panel");
 
     addDockWidget(Qt::RightDockWidgetArea, infoDock);
-    connect(this, SIGNAL(urlChanged(KUrl)),
-            infoPanel, SLOT(setUrl(KUrl)));
-    connect(this, SIGNAL(selectionChanged(KFileItemList)),
-            infoPanel, SLOT(setSelection(KFileItemList)));
-    connect(this, SIGNAL(requestItemInfo(KFileItem)),
-            infoPanel, SLOT(requestDelayedItemInfo(KFileItem)));
+    connect(this, &DolphinMainWindow::urlChanged,
+            infoPanel, &InformationPanel::setUrl);
+    connect(this, &DolphinMainWindow::selectionChanged,
+            infoPanel, &InformationPanel::setSelection);
+    connect(this, &DolphinMainWindow::requestItemInfo,
+            infoPanel, &InformationPanel::requestDelayedItemInfo);
 
     // Setup "Folders"
     DolphinDockWidget* foldersDock = new DolphinDockWidget(i18nc("@title:window", "Folders"));
@@ -1791,13 +1718,17 @@ void DolphinMainWindow::setupDockWidgets()
     foldersDock->setWidget(foldersPanel);
 
     QAction* foldersAction = foldersDock->toggleViewAction();
-    createPanelAction(KIcon("folder"), Qt::Key_F7, foldersAction, "show_folders_panel");
+    createPanelAction(QIcon::fromTheme("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(this, &DolphinMainWindow::urlChanged,
+            foldersPanel, &FoldersPanel::setUrl);
+    connect(foldersPanel, &FoldersPanel::folderActivated,
+            this, &DolphinMainWindow::changeUrl);
+    connect(foldersPanel, &FoldersPanel::folderMiddleClicked,
+            this, static_cast<void(DolphinMainWindow::*)(const KUrl&)>(&DolphinMainWindow::openNewTab));
+    connect(foldersPanel, &FoldersPanel::errorMessage,
+            this, &DolphinMainWindow::slotPanelErrorMessage);
 
     // Setup "Terminal"
 #ifndef Q_OS_WIN
@@ -1805,38 +1736,21 @@ void DolphinMainWindow::setupDockWidgets()
     terminalDock->setLocked(lock);
     terminalDock->setObjectName("terminalDock");
     terminalDock->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea);
-    Panel* terminalPanel = new TerminalPanel(terminalDock);
+    TerminalPanel* terminalPanel = new TerminalPanel(terminalDock);
     terminalPanel->setCustomContextMenuActions(QList<QAction*>() << lockLayoutAction);
     terminalDock->setWidget(terminalPanel);
 
-    connect(terminalPanel, SIGNAL(hideTerminalPanel()), terminalDock, SLOT(hide()));
-    connect(terminalDock, SIGNAL(visibilityChanged(bool)),
-            terminalPanel, SLOT(dockVisibilityChanged()));
+    connect(terminalPanel, &TerminalPanel::hideTerminalPanel, terminalDock, &DolphinDockWidget::hide);
+    connect(terminalPanel, &TerminalPanel::changeUrl, this, &DolphinMainWindow::slotTerminalDirectoryChanged);
+    connect(terminalDock, &DolphinDockWidget::visibilityChanged,
+            terminalPanel, &TerminalPanel::dockVisibilityChanged);
 
     QAction* terminalAction = terminalDock->toggleViewAction();
-    createPanelAction(KIcon("utilities-terminal"), Qt::Key_F4, terminalAction, "show_terminal_panel");
+    createPanelAction(QIcon::fromTheme("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();
-    createPanelAction(KIcon("system-search"), Qt::Key_F12, searchAction, "show_search_panel");
-    addDockWidget(Qt::RightDockWidgetArea, searchDock);
-    connect(this, SIGNAL(urlChanged(KUrl)),
-            searchPanel, SLOT(setUrl(KUrl)));
+    connect(this, &DolphinMainWindow::urlChanged,
+            terminalPanel, &TerminalPanel::setUrl);
 #endif
 
     if (GeneralSettings::version() < 200) {
@@ -1844,9 +1758,6 @@ void DolphinMainWindow::setupDockWidgets()
         foldersDock->hide();
 #ifndef Q_OS_WIN
         terminalDock->hide();
-#endif
-#ifdef HAVE_NEPOMUK
-        searchDock->hide();
 #endif
     }
 
@@ -1857,26 +1768,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");
+    createPanelAction(QIcon::fromTheme("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(this, SIGNAL(urlChanged(KUrl)),
-            placesPanel, SLOT(setUrl(KUrl)));
-    connect(placesDock, SIGNAL(visibilityChanged(bool)),
-            this, SLOT(slotPlacesPanelVisibilityChanged(bool)));
+    connect(placesPanel, &PlacesPanel::placeActivated,
+            this, &DolphinMainWindow::slotPlaceActivated);
+    connect(placesPanel, &PlacesPanel::placeMiddleClicked,
+            this, static_cast<void(DolphinMainWindow::*)(const KUrl&)>(&DolphinMainWindow::openNewTab));
+    connect(placesPanel, &PlacesPanel::errorMessage,
+            this, &DolphinMainWindow::slotPanelErrorMessage);
+    connect(this, &DolphinMainWindow::urlChanged,
+            placesPanel, &PlacesPanel::setUrl);
+    connect(placesDock, &DolphinDockWidget::visibilityChanged,
+            this, &DolphinMainWindow::slotPlacesPanelVisibilityChanged);
+    connect(this, &DolphinMainWindow::settingsChanged,
+           placesPanel, &PlacesPanel::readSettings);
 
     // Add actions into the "Panels" menu
     KActionMenu* panelsMenu = new KActionMenu(i18nc("@action:inmenu View", "Panels"), this);
@@ -1888,9 +1798,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);
@@ -1920,7 +1827,6 @@ void DolphinMainWindow::updateEditActions()
         deleteWithTrashShortcut->setEnabled(capabilities.supportsDeleting() && !enableMoveToTrash);
         cutAction->setEnabled(capabilities.supportsMoving());
     }
-    updatePasteAction();
 }
 
 void DolphinMainWindow::updateViewActions()
@@ -1944,48 +1850,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(QIcon::fromTheme("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, &KMenu::aboutToShow, this, &DolphinMainWindow::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(), &KToolBar::iconSizeChanged,
+            m_controlButton, &QToolButton::setIconSize);
+    connect(toolBar(), &KToolBar::toolButtonStyleChanged,
+            m_controlButton, &QToolButton::setToolButtonStyle);
 
     // 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, &QToolButton::destroyed, this, &DolphinMainWindow::slotControlButtonDeleted);
     m_updateToolBarTimer = new QTimer(this);
     m_updateToolBarTimer->setInterval(500);
-    connect(m_updateToolBarTimer, SIGNAL(timeout()), this, SLOT(updateToolBar()));
+    connect(m_updateToolBarTimer, &QTimer::timeout, this, &DolphinMainWindow::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;
@@ -2009,10 +1910,10 @@ 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);
+    const QString iconName = KIO::iconNameForUrl(primaryPath);
 
     QAction* action = new QAction(squeezedText(primaryPath), tabsMenu);
 
@@ -2027,7 +1928,7 @@ void DolphinMainWindow::rememberClosedTab(int index)
     }
 
     action->setData(QVariant::fromValue(closedTab));
-    action->setIcon(KIcon(iconName));
+    action->setIcon(QIcon::fromTheme(iconName));
 
     // add the closed tab menu entry after the separator and
     // "Empty Recently Closed Tabs" entry
@@ -2056,9 +1957,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();
         }
     }
 
@@ -2075,51 +1976,51 @@ void DolphinMainWindow::refreshViews()
             toggleSplitView();
         }
     }
+
+    emit settingsChanged();
 }
 
 void DolphinMainWindow::clearStatusBar()
 {
-    m_activeViewContainer->statusBar()->clear();
+    m_activeViewContainer->statusBar()->resetToDefaultText();
 }
 
 void DolphinMainWindow::connectViewSignals(DolphinViewContainer* container)
 {
-    connect(container, SIGNAL(showFilterBarChanged(bool)),
-            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()));
+    connect(container, &DolphinViewContainer::showFilterBarChanged,
+            this, &DolphinMainWindow::updateFilterBarAction);
+    connect(container, &DolphinViewContainer::writeStateChanged,
+            this, &DolphinMainWindow::slotWriteStateChanged);
 
     DolphinView* view = container->view();
-    connect(view, SIGNAL(selectionChanged(KFileItemList)),
-            this, SLOT(slotSelectionChanged(KFileItemList)));
-    connect(view, SIGNAL(requestItemInfo(KFileItem)),
-            this, SLOT(slotRequestItemInfo(KFileItem)));
-    connect(view, SIGNAL(activated()),
-            this, SLOT(toggleActiveView()));
-    connect(view, SIGNAL(tabRequested(KUrl)),
-            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)),
-            this, SLOT(enableStopAction()));
-    connect(view, SIGNAL(finishedPathLoading(KUrl)),
-            this, SLOT(disableStopAction()));
+    connect(view, &DolphinView::selectionChanged,
+            this, &DolphinMainWindow::slotSelectionChanged);
+    connect(view, &DolphinView::requestItemInfo,
+            this, &DolphinMainWindow::slotRequestItemInfo);
+    connect(view, &DolphinView::activated,
+            this, &DolphinMainWindow::toggleActiveView);
+    connect(view, &DolphinView::tabRequested,
+            this, static_cast<void(DolphinMainWindow::*)(const KUrl&)>(&DolphinMainWindow::openNewTab));
+    connect(view, &DolphinView::requestContextMenu,
+            this, &DolphinMainWindow::openContextMenu);
+    connect(view, &DolphinView::directoryLoadingStarted,
+            this, &DolphinMainWindow::enableStopAction);
+    connect(view, &DolphinView::directoryLoadingCompleted,
+            this, &DolphinMainWindow::disableStopAction);
+    connect(view, &DolphinView::goBackRequested,
+            this, static_cast<void(DolphinMainWindow::*)()>(&DolphinMainWindow::goBack));
+    connect(view, &DolphinView::goForwardRequested,
+            this, static_cast<void(DolphinMainWindow::*)()>(&DolphinMainWindow::goForward));
 
     const KUrlNavigator* navigator = container->urlNavigator();
-    connect(navigator, SIGNAL(urlChanged(KUrl)),
-            this, SLOT(changeUrl(KUrl)));
-    connect(navigator, SIGNAL(historyChanged()),
-            this, SLOT(updateHistory()));
-    connect(navigator, SIGNAL(editableStateChanged(bool)),
-            this, SLOT(slotEditableStateChanged(bool)));
-    connect(navigator, SIGNAL(tabRequested(KUrl)),
-            this, SLOT(openNewTab(KUrl)));
+    connect(navigator, &KUrlNavigator::urlChanged,
+            this, &DolphinMainWindow::changeUrl);
+    connect(navigator, &KUrlNavigator::historyChanged,
+            this, &DolphinMainWindow::updateHistory);
+    connect(navigator, &KUrlNavigator::editableStateChanged,
+            this, &DolphinMainWindow::slotEditableStateChanged);
+    connect(navigator, &KUrlNavigator::tabRequested,
+            this, static_cast<void(DolphinMainWindow::*)(const KUrl&)>(&DolphinMainWindow::openNewTab));
 }
 
 void DolphinMainWindow::updateSplitAction()
@@ -2129,16 +2030,16 @@ void DolphinMainWindow::updateSplitAction()
         if (m_activeViewContainer == m_viewTab[m_tabIndex].secondaryView) {
             splitAction->setText(i18nc("@action:intoolbar Close right view", "Close"));
             splitAction->setToolTip(i18nc("@info", "Close right view"));
-            splitAction->setIcon(KIcon("view-right-close"));
+            splitAction->setIcon(QIcon::fromTheme("view-right-close"));
         } else {
             splitAction->setText(i18nc("@action:intoolbar Close left view", "Close"));
             splitAction->setToolTip(i18nc("@info", "Close left view"));
-            splitAction->setIcon(KIcon("view-left-close"));
+            splitAction->setIcon(QIcon::fromTheme("view-left-close"));
         }
     } else {
         splitAction->setText(i18nc("@action:intoolbar Split view", "Split"));
         splitAction->setToolTip(i18nc("@info", "Split view"));
-        splitAction->setIcon(KIcon("view-right-new"));
+        splitAction->setIcon(QIcon::fromTheme("view-right-new"));
     }
 }
 
@@ -2181,7 +2082,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);
 
@@ -2218,20 +2125,20 @@ QString DolphinMainWindow::squeezedText(const QString& text) const
     return fm.elidedText(text, Qt::ElideMiddle, fm.maxWidth() * 10);
 }
 
-void DolphinMainWindow::createPanelAction(const KIcon& icon,
+void DolphinMainWindow::createPanelAction(const QIcon& icon,
                                           const QKeySequence& shortcut,
                                           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());
     panelAction->setIcon(icon);
     panelAction->setShortcut(shortcut);
 
-    connect(panelAction, SIGNAL(triggered()), dockAction, SLOT(trigger()));
-    connect(dockAction, SIGNAL(toggled(bool)), panelAction, SLOT(setChecked(bool)));
+    connect(panelAction, &QAction::triggered, dockAction, &QAction::trigger);
+    connect(dockAction, &QAction::toggled, panelAction, &QAction::setChecked);
 }
 
 DolphinMainWindow::UndoUiInterface::UndoUiInterface() :
@@ -2247,54 +2154,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"