]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinmainwindow.cpp
Use placeholder for search action
[dolphin.git] / src / dolphinmainwindow.cpp
index de43bab4c2ca86f148a480d0d1cd58c87e5f497c..2775d428525b23713e65b398ad0dd432e828a616 100644 (file)
 
 #include "dolphinmainwindow.h"
 
+#include "config-terminal.h"
 #include "global.h"
 #include "dolphindockwidget.h"
 #include "dolphincontextmenu.h"
 #include "dolphinnewfilemenu.h"
 #include "dolphinrecenttabsmenu.h"
-#include "dolphintabwidget.h"
 #include "dolphinviewcontainer.h"
 #include "dolphintabpage.h"
 #include "middleclickactioneventfilter.h"
 #include "panels/folders/folderspanel.h"
 #include "panels/places/placespanel.h"
 #include "panels/information/informationpanel.h"
+#include "panels/terminal/terminalpanel.h"
 #include "settings/dolphinsettingsdialog.h"
 #include "statusbar/dolphinstatusbar.h"
 #include "views/dolphinviewactionhandler.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 <KActionCollection>
 #include <KActionMenu>
 #include <KAuthorized>
 #include <KConfig>
-#include <kdualaction.h>
+#include <KDualAction>
+#include <KFileItemListProperties>
 #include <KHelpMenu>
-#include <KJobWidgets>
-#include <QLineEdit>
-#include <KToolBar>
 #include <KIO/JobUiDelegate>
+#include <KIO/OpenFileManagerWindowJob>
+#include <KJobWidgets>
 #include <KLocalizedString>
-#include <KProtocolManager>
-#include <KProtocolInfo>
-#include <QMenu>
 #include <KMessageBox>
-#include <KFilePlacesModel>
-#include <KFileItemListProperties>
+#include <KProtocolInfo>
+#include <KProtocolManager>
 #include <KRun>
 #include <KShell>
 #include <KStandardAction>
 #include <KToggleAction>
-#include <KUrlNavigator>
+#include <KToolBar>
 #include <KToolInvocation>
 #include <KUrlComboBox>
+#include <KUrlNavigator>
 
 #include <QApplication>
-#include <QMenuBar>
 #include <QClipboard>
-#include <QToolButton>
-#include <QTimer>
-#include <QStandardPaths>
-#include <QPushButton>
 #include <QCloseEvent>
-#include <QShowEvent>
 #include <QDialog>
+#include <QFileInfo>
+#include <QLineEdit>
+#include <QMenu>
+#include <QMenuBar>
+#include <QPushButton>
+#include <QShowEvent>
+#include <QStandardPaths>
+#include <QTimer>
+#include <QToolButton>
 
 namespace {
     // Used for GeneralSettings::version() to determine whether
@@ -100,14 +97,12 @@ DolphinMainWindow::DolphinMainWindow() :
     m_controlButton(nullptr),
     m_updateToolBarTimer(nullptr),
     m_lastHandleUrlStatJob(nullptr),
-#ifndef Q_OS_WIN
     m_terminalPanel(nullptr),
-#endif
     m_placesPanel(nullptr),
     m_tearDownFromPlacesRequested(false)
 {
     Q_INIT_RESOURCE(dolphin);
-
+    setComponentName(QStringLiteral("dolphin"), QGuiApplication::applicationDisplayName());
     setObjectName(QStringLiteral("Dolphin#"));
 
     connect(&DolphinNewFileMenuObserver::instance(), &DolphinNewFileMenuObserver::errorMessage,
@@ -140,14 +135,14 @@ DolphinMainWindow::DolphinMainWindow() :
     connect(m_tabWidget, &DolphinTabWidget::tabCountChanged,
             this, &DolphinMainWindow::tabCountChanged);
     connect(m_tabWidget, &DolphinTabWidget::currentUrlChanged,
-            this, &DolphinMainWindow::setUrlAsCaption);
+            this, &DolphinMainWindow::updateWindowTitle);
     setCentralWidget(m_tabWidget);
 
     setupActions();
 
     m_actionHandler = new DolphinViewActionHandler(actionCollection(), this);
     connect(m_actionHandler, &DolphinViewActionHandler::actionBeingHandled, this, &DolphinMainWindow::clearStatusBar);
-    connect(m_actionHandler, &DolphinViewActionHandler::createDirectory, this, &DolphinMainWindow::createDirectory);
+    connect(m_actionHandler, &DolphinViewActionHandler::createDirectoryTriggered, this, &DolphinMainWindow::createDirectory);
 
     m_remoteEncoding = new DolphinRemoteEncoding(this, m_actionHandler);
     connect(this, &DolphinMainWindow::urlChanged,
@@ -290,13 +285,13 @@ void DolphinMainWindow::updateHistory()
     const KUrlNavigator* urlNavigator = m_activeViewContainer->urlNavigator();
     const int index = urlNavigator->historyIndex();
 
-    QAction* backAction = actionCollection()->action(QStringLiteral("go_back"));
+    QAction* backAction = actionCollection()->action(KStandardAction::name(KStandardAction::Back));
     if (backAction) {
         backAction->setToolTip(i18nc("@info", "Go back"));
         backAction->setEnabled(index < urlNavigator->historySize() - 1);
     }
 
-    QAction* forwardAction = actionCollection()->action(QStringLiteral("go_forward"));
+    QAction* forwardAction = actionCollection()->action(KStandardAction::name(KStandardAction::Forward));
     if (forwardAction) {
         forwardAction->setToolTip(i18nc("@info", "Go forward"));
         forwardAction->setEnabled(index > 0);
@@ -319,9 +314,19 @@ void DolphinMainWindow::openNewActivatedTab()
     m_tabWidget->openNewActivatedTab();
 }
 
-void DolphinMainWindow::openNewTab(const QUrl& url)
+void DolphinMainWindow::openNewTab(const QUrl& url, DolphinTabWidget::TabPlacement tabPlacement)
+{
+    m_tabWidget->openNewTab(url, QUrl(), tabPlacement);
+}
+
+void DolphinMainWindow::openNewTabAfterCurrentTab(const QUrl& url)
 {
-    m_tabWidget->openNewTab(url);
+    m_tabWidget->openNewTab(url, QUrl(), DolphinTabWidget::AfterCurrentTab);
+}
+
+void DolphinMainWindow::openNewTabAfterLastTab(const QUrl& url)
+{
+    m_tabWidget->openNewTab(url, QUrl(), DolphinTabWidget::AfterLastTab);
 }
 
 void DolphinMainWindow::openInNewTab()
@@ -332,7 +337,7 @@ void DolphinMainWindow::openInNewTab()
     foreach (const KFileItem& item, list) {
         const QUrl& url = DolphinView::openItemAsFolderUrl(item);
         if (!url.isEmpty()) {
-            openNewTab(url);
+            openNewTabAfterCurrentTab(url);
             tabCreated = true;
         }
     }
@@ -340,7 +345,7 @@ void DolphinMainWindow::openInNewTab()
     // if no new tab has been created from the selection
     // open the current directory in a new tab
     if (!tabCreated) {
-        openNewTab(m_activeViewContainer->url());
+        openNewTabAfterCurrentTab(m_activeViewContainer->url());
     }
 }
 
@@ -361,6 +366,22 @@ void DolphinMainWindow::openInNewWindow()
     }
 }
 
+void DolphinMainWindow::showTarget()
+{
+    const auto link = m_activeViewContainer->view()->selectedItems().at(0);
+    const auto linkLocationDir = QFileInfo(link.localPath()).absoluteDir();
+    auto linkDestination = link.linkDest();
+    if (QFileInfo(linkDestination).isRelative()) {
+        linkDestination = linkLocationDir.filePath(linkDestination);
+    }
+    if (QFileInfo::exists(linkDestination)) {
+        KIO::highlightInFileManager({QUrl::fromLocalFile(linkDestination).adjusted(QUrl::StripTrailingSlash)});
+    } else {
+        m_activeViewContainer->showMessage(xi18nc("@info", "Could not access <filename>%1</filename>.", linkDestination),
+                                           DolphinViewContainer::Warning);
+    }
+}
+
 void DolphinMainWindow::showEvent(QShowEvent* event)
 {
     KXmlGuiWindow::showEvent(event);
@@ -389,14 +410,14 @@ void DolphinMainWindow::closeEvent(QCloseEvent* event)
         dialog->setWindowTitle(i18nc("@title:window", "Confirmation"));
         dialog->setModal(true);
         QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Yes | QDialogButtonBox::No | QDialogButtonBox::Cancel);
-        KGuiItem::assign(buttons->button(QDialogButtonBox::Yes), KStandardGuiItem::quit());
+        KGuiItem::assign(buttons->button(QDialogButtonBox::Yes), KGuiItem(i18nc("@action:button 'Quit Dolphin' button", "&Quit %1", QGuiApplication::applicationDisplayName()), QIcon::fromTheme(QStringLiteral("application-exit"))));
         KGuiItem::assign(buttons->button(QDialogButtonBox::No), KGuiItem(i18n("C&lose Current Tab"), QIcon::fromTheme(QStringLiteral("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,
+        const auto result = KMessageBox::createKMessageBox(dialog,
             buttons,
             QMessageBox::Warning,
             i18n("You have multiple tabs open in this window, are you sure you want to quit?"),
@@ -416,6 +437,59 @@ void DolphinMainWindow::closeEvent(QCloseEvent* event)
             case QDialogButtonBox::No:
                 // Close only the current tab
                 m_tabWidget->closeTab();
+                Q_FALLTHROUGH();
+            default:
+                event->ignore();
+                return;
+        }
+    }
+
+    if (m_terminalPanel->hasProgramRunning() && GeneralSettings::confirmClosingTerminalRunningProgram() && closedByUser) {
+        // Ask if the user really wants to quit Dolphin with a program that is still running in the Terminal panel
+        // Open a confirmation dialog with 3 buttons:
+        // QDialogButtonBox::Yes    -> Quit
+        // QDialogButtonBox::No     -> Show Terminal Panel
+        // QDialogButtonBox::Cancel -> do nothing
+        QDialog *dialog = new QDialog(this, Qt::Dialog);
+        dialog->setWindowTitle(i18nc("@title:window", "Confirmation"));
+        dialog->setModal(true);
+        auto standardButtons = QDialogButtonBox::Yes | QDialogButtonBox::Cancel;
+        if (!m_terminalPanel->isVisible()) {
+            standardButtons |= QDialogButtonBox::No;
+        }
+        QDialogButtonBox *buttons = new QDialogButtonBox(standardButtons);
+        KGuiItem::assign(buttons->button(QDialogButtonBox::Yes), KStandardGuiItem::quit());
+        if (!m_terminalPanel->isVisible()) {
+            KGuiItem::assign(
+                    buttons->button(QDialogButtonBox::No),
+                    KGuiItem(i18n("Show &Terminal Panel"), QIcon::fromTheme(QStringLiteral("utilities-terminal"))));
+        }
+        KGuiItem::assign(buttons->button(QDialogButtonBox::Cancel), KStandardGuiItem::cancel());
+
+        bool doNotAskAgainCheckboxResult = false;
+
+        const auto result = KMessageBox::createKMessageBox(
+                dialog,
+                buttons,
+                QMessageBox::Warning,
+                i18n("The program '%1' is still running in the Terminal panel. Are you sure you want to quit?", m_terminalPanel->runningProgramName()),
+                QStringList(),
+                i18n("Do not ask again"),
+                &doNotAskAgainCheckboxResult,
+                KMessageBox::Dangerous);
+
+        if (doNotAskAgainCheckboxResult) {
+            GeneralSettings::setConfirmClosingTerminalRunningProgram(false);
+        }
+
+        switch (result) {
+            case QDialogButtonBox::Yes:
+                // Quit
+                break;
+            case QDialogButtonBox::No:
+                actionCollection()->action("show_terminal_panel")->trigger();
+                // Do not quit, ignore quit event
+                Q_FALLTHROUGH();
             default:
                 event->ignore();
                 return;
@@ -520,9 +594,9 @@ void DolphinMainWindow::slotDirectoryLoadingCompleted()
 
 void DolphinMainWindow::slotToolBarActionMiddleClicked(QAction *action)
 {
-    if (action == actionCollection()->action(QStringLiteral("go_back"))) {
+    if (action == actionCollection()->action(KStandardAction::name(KStandardAction::Back))) {
         goBackInNewTab();
-    } else if (action == actionCollection()->action(QStringLiteral("go_forward"))) {
+    } else if (action == actionCollection()->action(KStandardAction::name(KStandardAction::Forward))) {
         goForwardInNewTab();
     } else if (action == actionCollection()->action(QStringLiteral("go_up"))) {
         goUpInNewTab();
@@ -539,7 +613,7 @@ void DolphinMainWindow::selectAll()
     // URL instead of all items of the view
 
     KUrlNavigator* urlNavigator = m_activeViewContainer->urlNavigator();
-    QLineEdit* lineEdit = urlNavigator->editor()->lineEdit(); // krazy:exclude=qclasses
+    QLineEdit* lineEdit = urlNavigator->editor()->lineEdit();
     const bool selectUrl = urlNavigator->isUrlEditable() &&
                            lineEdit->hasFocus();
     if (selectUrl) {
@@ -574,6 +648,7 @@ void DolphinMainWindow::reloadView()
 {
     clearStatusBar();
     m_activeViewContainer->reload();
+    m_activeViewContainer->statusBar()->updateSpaceInfo();
 }
 
 void DolphinMainWindow::stopLoading()
@@ -608,12 +683,19 @@ void DolphinMainWindow::toggleEditLocation()
 void DolphinMainWindow::replaceLocation()
 {
     KUrlNavigator* navigator = m_activeViewContainer->urlNavigator();
-    navigator->setUrlEditable(true);
-    navigator->setFocus();
-
-    // select the whole text of the combo box editor
-    QLineEdit* lineEdit = navigator->editor()->lineEdit();  // krazy:exclude=qclasses
-    lineEdit->selectAll();
+    QLineEdit* lineEdit = navigator->editor()->lineEdit();
+
+    // If the text field currently has focus and everything is selected,
+    // pressing the keyboard shortcut returns the whole thing to breadcrumb mode
+    if (navigator->isUrlEditable()
+        && lineEdit->hasFocus()
+        && lineEdit->selectedText() == lineEdit->text() ) {
+        navigator->setUrlEditable(false);
+    } else {
+        navigator->setUrlEditable(true);
+        navigator->setFocus();
+        lineEdit->selectAll();
+    }
 }
 
 void DolphinMainWindow::togglePanelLockState()
@@ -629,6 +711,13 @@ void DolphinMainWindow::togglePanelLockState()
     GeneralSettings::setLockPanels(newLockState);
 }
 
+void DolphinMainWindow::slotTerminalPanelVisibilityChanged()
+{
+    if (m_terminalPanel->isHiddenInVisibleWindow()) {
+        m_activeViewContainer->view()->setFocus();
+    }
+}
+
 void DolphinMainWindow::goBack()
 {
     KUrlNavigator* urlNavigator = m_activeViewContainer->urlNavigator();
@@ -660,25 +749,25 @@ void DolphinMainWindow::goBackInNewTab()
 {
     KUrlNavigator* urlNavigator = activeViewContainer()->urlNavigator();
     const int index = urlNavigator->historyIndex() + 1;
-    openNewTab(urlNavigator->locationUrl(index));
+    openNewTabAfterCurrentTab(urlNavigator->locationUrl(index));
 }
 
 void DolphinMainWindow::goForwardInNewTab()
 {
     KUrlNavigator* urlNavigator = activeViewContainer()->urlNavigator();
     const int index = urlNavigator->historyIndex() - 1;
-    openNewTab(urlNavigator->locationUrl(index));
+    openNewTabAfterCurrentTab(urlNavigator->locationUrl(index));
 }
 
 void DolphinMainWindow::goUpInNewTab()
 {
     const QUrl currentUrl = activeViewContainer()->urlNavigator()->locationUrl();
-    openNewTab(KIO::upUrl(currentUrl));
+    openNewTabAfterCurrentTab(KIO::upUrl(currentUrl));
 }
 
 void DolphinMainWindow::goHomeInNewTab()
 {
-    openNewTab(Dolphin::homeUrl());
+    openNewTabAfterCurrentTab(Dolphin::homeUrl());
 }
 
 void DolphinMainWindow::compareFiles()
@@ -783,7 +872,9 @@ void DolphinMainWindow::slotHandleUrlStatFinished(KJob* job)
 
 void DolphinMainWindow::slotWriteStateChanged(bool isFolderWritable)
 {
-    newFileMenu()->setEnabled(isFolderWritable);
+    // trash:/ is writable but we don't want to create new items in it.
+    // TODO: remove the trash check once https://phabricator.kde.org/T8234 is implemented
+    newFileMenu()->setEnabled(isFolderWritable && m_activeViewContainer->url().scheme() != QLatin1String("trash"));
 }
 
 void DolphinMainWindow::openContextMenu(const QPoint& pos,
@@ -798,14 +889,16 @@ void DolphinMainWindow::openContextMenu(const QPoint& pos,
     switch (command) {
     case DolphinContextMenu::OpenParentFolder:
         changeUrl(KIO::upUrl(item.url()));
+        m_activeViewContainer->view()->markUrlsAsSelected({item.url()});
+        m_activeViewContainer->view()->markUrlAsCurrent(item.url());
         break;
 
     case DolphinContextMenu::OpenParentFolderInNewWindow:
-        Dolphin::openNewWindow({KIO::upUrl(item.url())}, this);
+        Dolphin::openNewWindow({item.url()}, this, Dolphin::OpenNewWindowFlag::Select);
         break;
 
     case DolphinContextMenu::OpenParentFolderInNewTab:
-        openNewTab(KIO::upUrl(item.url()));
+        openNewTabAfterLastTab(KIO::upUrl(item.url()));
         break;
 
     case DolphinContextMenu::None:
@@ -830,10 +923,19 @@ void DolphinMainWindow::updateControlMenu()
 
     KActionCollection* ac = actionCollection();
 
+    // Add "Create New" menu
+    menu->addMenu(m_newFileMenu->menu());
+
+    menu->addSeparator();
+
+    // Overwrite Find action to Search action
+    QAction *searchAction = ac->action(KStandardAction::name(KStandardAction::Find));
+    searchAction->setText(i18n("Search..."));
+
     // Add "Edit" actions
     bool added = addActionToMenu(ac->action(KStandardAction::name(KStandardAction::Undo)), menu) |
-                 addActionToMenu(ac->action(KStandardAction::name(KStandardAction::Find)), menu) |
-                 addActionToMenu(ac->action(QStringLiteral("select_all")), menu) |
+                 addActionToMenu(searchAction, menu) |
+                 addActionToMenu(ac->action(KStandardAction::name(KStandardAction::SelectAll)), menu) |
                  addActionToMenu(ac->action(QStringLiteral("invert_selection")), menu);
 
     if (added) {
@@ -847,8 +949,8 @@ void DolphinMainWindow::updateControlMenu()
         menu->addSeparator();
     }
 
-    added = addActionToMenu(ac->action(QStringLiteral("view_mode")), menu) |
-            addActionToMenu(ac->action(QStringLiteral("sort")), menu) |
+    added = addActionToMenu(ac->action(QStringLiteral("sort")), menu) |
+            addActionToMenu(ac->action(QStringLiteral("view_mode")), menu) |
             addActionToMenu(ac->action(QStringLiteral("additional_info")), menu) |
             addActionToMenu(ac->action(QStringLiteral("show_preview")), menu) |
             addActionToMenu(ac->action(QStringLiteral("show_in_groups")), menu) |
@@ -859,7 +961,7 @@ void DolphinMainWindow::updateControlMenu()
     }
 
     added = addActionToMenu(ac->action(QStringLiteral("split_view")), menu) |
-            addActionToMenu(ac->action(QStringLiteral("reload")), menu) |
+            addActionToMenu(ac->action(KStandardAction::name(KStandardAction::Redisplay)), menu) |
             addActionToMenu(ac->action(QStringLiteral("view_properties")), menu);
     if (added) {
         menu->addSeparator();
@@ -947,6 +1049,10 @@ void DolphinMainWindow::activeViewChanged(DolphinViewContainer* viewContainer)
         oldViewContainer->disconnect(this);
         oldViewContainer->view()->disconnect(this);
         oldViewContainer->urlNavigator()->disconnect(this);
+
+        // except the requestItemInfo so that on hover the information panel can still be updated
+        connect(oldViewContainer->view(), &DolphinView::requestItemInfo,
+                this, &DolphinMainWindow::requestItemInfo);
     }
 
     connectViewSignals(viewContainer);
@@ -966,47 +1072,20 @@ void DolphinMainWindow::activeViewChanged(DolphinViewContainer* viewContainer)
 void DolphinMainWindow::tabCountChanged(int count)
 {
     const bool enableTabActions = (count > 1);
-    actionCollection()->action(QStringLiteral("close_tab"))->setEnabled(enableTabActions);
     actionCollection()->action(QStringLiteral("activate_next_tab"))->setEnabled(enableTabActions);
     actionCollection()->action(QStringLiteral("activate_prev_tab"))->setEnabled(enableTabActions);
 }
 
-void DolphinMainWindow::setUrlAsCaption(const QUrl& url)
+void DolphinMainWindow::updateWindowTitle()
 {
-    static KFilePlacesModel s_placesModel;
-
-    QString schemePrefix;
-    if (!url.isLocalFile()) {
-        schemePrefix.append(url.scheme() + " - ");
-        if (!url.host().isEmpty()) {
-            schemePrefix.append(url.host() + " - ");
-        }
-    }
-
-    if (GeneralSettings::showFullPathInTitlebar()) {
-        const QString path = url.adjusted(QUrl::StripTrailingSlash).path();
-        setWindowTitle(schemePrefix + path);
-        return;
+    const QString newTitle = m_activeViewContainer->caption();
+    if (windowTitle() != newTitle) {
+        setWindowTitle(newTitle);
     }
-
-    const auto& matchedPlaces = s_placesModel.match(s_placesModel.index(0,0), KFilePlacesModel::UrlRole, url, 1, Qt::MatchExactly);
-
-    if (!matchedPlaces.isEmpty()) {
-        setWindowTitle(s_placesModel.text(matchedPlaces.first()));
-        return;
-    }
-
-    QString fileName = url.adjusted(QUrl::StripTrailingSlash).fileName();
-    if (fileName.isEmpty()) {
-        fileName = '/';
-    }
-
-    setWindowTitle(schemePrefix + fileName);
 }
 
 void DolphinMainWindow::slotStorageTearDownFromPlacesRequested(const QString& mountPath)
 {
-#ifndef Q_OS_WIN
     if (m_terminalPanel->currentWorkingDirectory().startsWith(mountPath)) {
         m_tearDownFromPlacesRequested = true;
         m_terminalPanel->goHome();
@@ -1014,17 +1093,14 @@ void DolphinMainWindow::slotStorageTearDownFromPlacesRequested(const QString& mo
     } else {
         m_placesPanel->proceedWithTearDown();
     }
-#endif
 }
 
 void DolphinMainWindow::slotStorageTearDownExternallyRequested(const QString& mountPath)
 {
-#ifndef Q_OS_WIN
     if (m_terminalPanel->currentWorkingDirectory().startsWith(mountPath)) {
         m_tearDownFromPlacesRequested = false;
         m_terminalPanel->goHome();
     }
-#endif
 }
 
 void DolphinMainWindow::setupActions()
@@ -1038,24 +1114,19 @@ void DolphinMainWindow::setupActions()
     connect(menu, &QMenu::aboutToShow,
             this, &DolphinMainWindow::updateNewMenu);
 
-    QAction* newWindow = actionCollection()->addAction(QStringLiteral("new_window"));
-    newWindow->setIcon(QIcon::fromTheme(QStringLiteral("window-new")));
+    QAction* newWindow = KStandardAction::openNew(this, &DolphinMainWindow::openNewMainWindow, actionCollection());
     newWindow->setText(i18nc("@action:inmenu File", "New &Window"));
-    actionCollection()->setDefaultShortcut(newWindow, Qt::CTRL | Qt::Key_N);
-    connect(newWindow, &QAction::triggered, this, &DolphinMainWindow::openNewMainWindow);
+    newWindow->setIcon(QIcon::fromTheme(QStringLiteral("window-new")));
 
     QAction* newTab = actionCollection()->addAction(QStringLiteral("new_tab"));
     newTab->setIcon(QIcon::fromTheme(QStringLiteral("tab-new")));
     newTab->setText(i18nc("@action:inmenu File", "New Tab"));
-    actionCollection()->setDefaultShortcuts(newTab, {Qt::CTRL | Qt::Key_T, Qt::CTRL | Qt::SHIFT | Qt::Key_N});
+    actionCollection()->setDefaultShortcuts(newTab, {Qt::CTRL + Qt::Key_T, Qt::CTRL + Qt::SHIFT + Qt::Key_N});
     connect(newTab, &QAction::triggered, this, static_cast<void(DolphinMainWindow::*)()>(&DolphinMainWindow::openNewActivatedTab));
 
-    QAction* closeTab = actionCollection()->addAction(QStringLiteral("close_tab"));
-    closeTab->setIcon(QIcon::fromTheme(QStringLiteral("tab-close")));
+    QAction* closeTab = KStandardAction::close(
+            m_tabWidget, static_cast<void(DolphinTabWidget::*)()>(&DolphinTabWidget::closeTab), actionCollection());
     closeTab->setText(i18nc("@action:inmenu File", "Close Tab"));
-    actionCollection()->setDefaultShortcut(closeTab, Qt::CTRL | Qt::Key_W);
-    closeTab->setEnabled(false);
-    connect(closeTab, &QAction::triggered, m_tabWidget, static_cast<void(DolphinTabWidget::*)()>(&DolphinTabWidget::closeTab));
 
     KStandardAction::quit(this, &DolphinMainWindow::quit, actionCollection());
 
@@ -1073,16 +1144,15 @@ void DolphinMainWindow::setupActions()
     // due to the long text, the text "Paste" is used:
     paste->setIconText(i18nc("@action:inmenu Edit", "Paste"));
 
-    KStandardAction::find(this, &DolphinMainWindow::find, actionCollection());
+    QAction *searchAction = KStandardAction::find(this, &DolphinMainWindow::find, actionCollection());
+    searchAction->setText(i18n("Search..."));
 
-    QAction* selectAll = actionCollection()->addAction(QStringLiteral("select_all"));
-    selectAll->setText(i18nc("@action:inmenu Edit", "Select All"));
-    actionCollection()->setDefaultShortcut(selectAll, Qt::CTRL | Qt::Key_A);
-    connect(selectAll, &QAction::triggered, this, &DolphinMainWindow::selectAll);
+    KStandardAction::selectAll(this, &DolphinMainWindow::selectAll, actionCollection());
 
     QAction* invertSelection = actionCollection()->addAction(QStringLiteral("invert_selection"));
     invertSelection->setText(i18nc("@action:inmenu Edit", "Invert Selection"));
-    actionCollection()->setDefaultShortcut(invertSelection, Qt::CTRL | Qt::SHIFT | Qt::Key_A);
+    invertSelection->setIcon(QIcon::fromTheme(QStringLiteral("edit-select-invert")));
+    actionCollection()->setDefaultShortcut(invertSelection, Qt::CTRL + Qt::SHIFT + Qt::Key_A);
     connect(invertSelection, &QAction::triggered, this, &DolphinMainWindow::invertSelection);
 
     // setup 'View' menu
@@ -1093,7 +1163,7 @@ void DolphinMainWindow::setupActions()
     connect(split, &QAction::triggered, this, &DolphinMainWindow::toggleSplitView);
 
     QAction* stashSplit = actionCollection()->addAction(QStringLiteral("split_stash"));
-    actionCollection()->setDefaultShortcut(stashSplit, Qt::CTRL | Qt::Key_S);
+    actionCollection()->setDefaultShortcut(stashSplit, Qt::CTRL + Qt::Key_S);
     stashSplit->setText(i18nc("@action:intoolbar Stash", "Stash"));
     stashSplit->setToolTip(i18nc("@info", "Opens the stash virtual directory in a split window"));
     stashSplit->setIcon(QIcon::fromTheme(QStringLiteral("folder-stash")));
@@ -1101,11 +1171,7 @@ void DolphinMainWindow::setupActions()
     stashSplit->setVisible(KProtocolInfo::isKnownProtocol("stash"));
     connect(stashSplit, &QAction::triggered, this, &DolphinMainWindow::toggleSplitStash);
 
-    QAction* reload = actionCollection()->addAction(QStringLiteral("reload"));
-    reload->setText(i18nc("@action:inmenu View", "Reload"));
-    actionCollection()->setDefaultShortcut(reload, Qt::Key_F5);
-    reload->setIcon(QIcon::fromTheme(QStringLiteral("view-refresh")));
-    connect(reload, &QAction::triggered, this, &DolphinMainWindow::reloadView);
+    KStandardAction::redisplay(this, &DolphinMainWindow::reloadView, actionCollection());
 
     QAction* stop = actionCollection()->addAction(QStringLiteral("stop"));
     stop->setText(i18nc("@action:inmenu View", "Stop"));
@@ -1120,7 +1186,7 @@ void DolphinMainWindow::setupActions()
 
     QAction* replaceLocation = actionCollection()->addAction(QStringLiteral("replace_location"));
     replaceLocation->setText(i18nc("@action:inmenu Navigation Bar", "Replace Location"));
-    actionCollection()->setDefaultShortcut(replaceLocation, Qt::CTRL | Qt::Key_L);
+    actionCollection()->setDefaultShortcut(replaceLocation, Qt::CTRL + Qt::Key_L);
     connect(replaceLocation, &QAction::triggered, this, &DolphinMainWindow::replaceLocation);
 
     // setup 'Go' menu
@@ -1140,7 +1206,7 @@ void DolphinMainWindow::setupActions()
 
     QAction* undoCloseTab = actionCollection()->addAction(QStringLiteral("undo_close_tab"));
     undoCloseTab->setText(i18nc("@action:inmenu File", "Undo close tab"));
-    actionCollection()->setDefaultShortcut(undoCloseTab, Qt::CTRL | Qt::SHIFT | Qt::Key_T);
+    actionCollection()->setDefaultShortcut(undoCloseTab, Qt::CTRL + Qt::SHIFT + Qt::Key_T);
     undoCloseTab->setIcon(QIcon::fromTheme(QStringLiteral("edit-undo")));
     undoCloseTab->setEnabled(false);
     connect(undoCloseTab, &QAction::triggered, recentTabsMenu, &DolphinRecentTabsMenu::undoCloseTab);
@@ -1156,7 +1222,7 @@ void DolphinMainWindow::setupActions()
     QAction* showFilterBar = actionCollection()->addAction(QStringLiteral("show_filter_bar"));
     showFilterBar->setText(i18nc("@action:inmenu Tools", "Show Filter Bar"));
     showFilterBar->setIcon(QIcon::fromTheme(QStringLiteral("view-filter")));
-    actionCollection()->setDefaultShortcut(showFilterBar, Qt::CTRL | Qt::Key_I);
+    actionCollection()->setDefaultShortcuts(showFilterBar, {Qt::CTRL + Qt::Key_I, Qt::Key_Slash});
     connect(showFilterBar, &QAction::triggered, this, &DolphinMainWindow::showFilterBar);
 
     QAction* compareFiles = actionCollection()->addAction(QStringLiteral("compare_files"));
@@ -1165,26 +1231,28 @@ void DolphinMainWindow::setupActions()
     compareFiles->setEnabled(false);
     connect(compareFiles, &QAction::triggered, this, &DolphinMainWindow::compareFiles);
 
+#ifdef HAVE_TERMINAL
     if (KAuthorized::authorize(QStringLiteral("shell_access"))) {
         QAction* openTerminal = actionCollection()->addAction(QStringLiteral("open_terminal"));
         openTerminal->setText(i18nc("@action:inmenu Tools", "Open Terminal"));
         openTerminal->setIcon(QIcon::fromTheme(QStringLiteral("utilities-terminal")));
-        actionCollection()->setDefaultShortcut(openTerminal, Qt::SHIFT | Qt::Key_F4);
+        actionCollection()->setDefaultShortcut(openTerminal, Qt::SHIFT + Qt::Key_F4);
         connect(openTerminal, &QAction::triggered, this, &DolphinMainWindow::openTerminal);
     }
+#endif
 
     // setup 'Settings' menu
     KToggleAction* showMenuBar = KStandardAction::showMenubar(nullptr, nullptr, actionCollection());
     connect(showMenuBar, &KToggleAction::triggered,                   // Fixes #286822
             this, &DolphinMainWindow::toggleShowMenuBar, Qt::QueuedConnection);
-    KStandardAction::preferences(this, SLOT(editSettings()), actionCollection());
+    KStandardAction::preferences(this, &DolphinMainWindow::editSettings, actionCollection());
 
     // not in menu actions
     QList<QKeySequence> nextTabKeys = KStandardShortcut::tabNext();
-    nextTabKeys.append(QKeySequence(Qt::CTRL | Qt::Key_Tab));
+    nextTabKeys.append(QKeySequence(Qt::CTRL + Qt::Key_Tab));
 
     QList<QKeySequence> prevTabKeys = KStandardShortcut::tabPrev();
-    prevTabKeys.append(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_Tab));
+    prevTabKeys.append(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Tab));
 
     QAction* activateNextTab = actionCollection()->addAction(QStringLiteral("activate_next_tab"));
     activateNextTab->setIconText(i18nc("@action:inmenu", "Next Tab"));
@@ -1201,6 +1269,12 @@ void DolphinMainWindow::setupActions()
     actionCollection()->setDefaultShortcuts(activatePrevTab, prevTabKeys);
 
     // for context menu
+    QAction* showTarget = actionCollection()->addAction(QStringLiteral("show_target"));
+    showTarget->setText(i18nc("@action:inmenu", "Show Target"));
+    showTarget->setIcon(QIcon::fromTheme(QStringLiteral("document-open-folder")));
+    showTarget->setEnabled(false);
+    connect(showTarget, &QAction::triggered, this, &DolphinMainWindow::showTarget);
+
     QAction* openInNewTab = actionCollection()->addAction(QStringLiteral("open_in_new_tab"));
     openInNewTab->setText(i18nc("@action:inmenu", "Open in New Tab"));
     openInNewTab->setIcon(QIcon::fromTheme(QStringLiteral("tab-new")));
@@ -1234,6 +1308,8 @@ void DolphinMainWindow::setupDockWidgets()
     infoDock->setLocked(lock);
     infoDock->setObjectName(QStringLiteral("infoDock"));
     infoDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
+
+#ifdef HAVE_BALOO
     InformationPanel* infoPanel = new InformationPanel(infoDock);
     infoPanel->setCustomContextMenuActions({lockLayoutAction});
     connect(infoPanel, &InformationPanel::urlActivated, this, &DolphinMainWindow::handleUrl);
@@ -1249,6 +1325,7 @@ void DolphinMainWindow::setupDockWidgets()
             infoPanel, &InformationPanel::setSelection);
     connect(this, &DolphinMainWindow::requestItemInfo,
             infoPanel, &InformationPanel::requestDelayedItemInfo);
+#endif
 
     // Setup "Folders"
     DolphinDockWidget* foldersDock = new DolphinDockWidget(i18nc("@title:window", "Folders"));
@@ -1268,17 +1345,16 @@ void DolphinMainWindow::setupDockWidgets()
     connect(foldersPanel, &FoldersPanel::folderActivated,
             this, &DolphinMainWindow::changeUrl);
     connect(foldersPanel, &FoldersPanel::folderMiddleClicked,
-            this, &DolphinMainWindow::openNewTab);
+            this, &DolphinMainWindow::openNewTabAfterCurrentTab);
     connect(foldersPanel, &FoldersPanel::errorMessage,
             this, &DolphinMainWindow::showErrorMessage);
 
     // Setup "Terminal"
-#ifndef Q_OS_WIN
+#ifdef HAVE_TERMINAL
     if (KAuthorized::authorize(QStringLiteral("shell_access"))) {
         DolphinDockWidget* terminalDock = new DolphinDockWidget(i18nc("@title:window Shell terminal", "Terminal"));
         terminalDock->setLocked(lock);
         terminalDock->setObjectName(QStringLiteral("terminalDock"));
-        terminalDock->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea);
         m_terminalPanel = new TerminalPanel(terminalDock);
         m_terminalPanel->setCustomContextMenuActions({lockLayoutAction});
         terminalDock->setWidget(m_terminalPanel);
@@ -1287,6 +1363,8 @@ void DolphinMainWindow::setupDockWidgets()
         connect(m_terminalPanel, &TerminalPanel::changeUrl, this, &DolphinMainWindow::slotTerminalDirectoryChanged);
         connect(terminalDock, &DolphinDockWidget::visibilityChanged,
                 m_terminalPanel, &TerminalPanel::dockVisibilityChanged);
+        connect(terminalDock, &DolphinDockWidget::visibilityChanged,
+                this, &DolphinMainWindow::slotTerminalPanelVisibilityChanged);
 
         QAction* terminalAction = terminalDock->toggleViewAction();
         createPanelAction(QIcon::fromTheme(QStringLiteral("utilities-terminal")), Qt::Key_F4, terminalAction, QStringLiteral("show_terminal_panel"));
@@ -1323,7 +1401,7 @@ void DolphinMainWindow::setupDockWidgets()
     connect(m_placesPanel, &PlacesPanel::placeActivated,
             this, &DolphinMainWindow::slotPlaceActivated);
     connect(m_placesPanel, &PlacesPanel::placeMiddleClicked,
-            this, &DolphinMainWindow::openNewTab);
+            this, &DolphinMainWindow::openNewTabAfterCurrentTab);
     connect(m_placesPanel, &PlacesPanel::errorMessage,
             this, &DolphinMainWindow::showErrorMessage);
     connect(this, &DolphinMainWindow::urlChanged,
@@ -1338,19 +1416,38 @@ void DolphinMainWindow::setupDockWidgets()
             this, &DolphinMainWindow::slotStorageTearDownExternallyRequested);
     m_tabWidget->slotPlacesPanelVisibilityChanged(m_placesPanel->isVisible());
 
+    auto actionShowAllPlaces = new QAction(QIcon::fromTheme(QStringLiteral("hint")), i18nc("@item:inmenu", "Show Hidden Places"), this);
+    actionShowAllPlaces->setCheckable(true);
+    actionShowAllPlaces->setDisabled(true);
+
+    connect(actionShowAllPlaces, &QAction::triggered, this, [actionShowAllPlaces, this](bool checked){
+        actionShowAllPlaces->setIcon(QIcon::fromTheme(checked ? QStringLiteral("visibility") : QStringLiteral("hint")));
+        m_placesPanel->showHiddenEntries(checked);
+    });
+
+    connect(m_placesPanel, &PlacesPanel::showHiddenEntriesChanged, this, [actionShowAllPlaces] (bool checked){
+        actionShowAllPlaces->setChecked(checked);
+        actionShowAllPlaces->setIcon(QIcon::fromTheme(checked ? QStringLiteral("visibility") : QStringLiteral("hint")));
+   });
+
     // Add actions into the "Panels" menu
     KActionMenu* panelsMenu = new KActionMenu(i18nc("@action:inmenu View", "Panels"), this);
     actionCollection()->addAction(QStringLiteral("panels"), panelsMenu);
     panelsMenu->setDelayed(false);
     const KActionCollection* ac = actionCollection();
     panelsMenu->addAction(ac->action(QStringLiteral("show_places_panel")));
+#ifdef HAVE_BALOO
     panelsMenu->addAction(ac->action(QStringLiteral("show_information_panel")));
+#endif
     panelsMenu->addAction(ac->action(QStringLiteral("show_folders_panel")));
-#ifndef Q_OS_WIN
     panelsMenu->addAction(ac->action(QStringLiteral("show_terminal_panel")));
-#endif
     panelsMenu->addSeparator();
+    panelsMenu->addAction(actionShowAllPlaces);
     panelsMenu->addAction(lockLayoutAction);
+
+    connect(panelsMenu->menu(), &QMenu::aboutToShow, this, [actionShowAllPlaces, this]{
+        actionShowAllPlaces->setEnabled(m_placesPanel->hiddenListCount());
+    });
 }
 
 void DolphinMainWindow::updateEditActions()
@@ -1362,11 +1459,12 @@ void DolphinMainWindow::updateEditActions()
         stateChanged(QStringLiteral("has_selection"));
 
         KActionCollection* col = actionCollection();
-        QAction* renameAction      = col->action(KStandardAction::name(KStandardAction::RenameFile));
-        QAction* moveToTrashAction = col->action(KStandardAction::name(KStandardAction::MoveToTrash));
-        QAction* deleteAction      = col->action(KStandardAction::name(KStandardAction::DeleteFile));
-        QAction* cutAction         = col->action(KStandardAction::name(KStandardAction::Cut));
+        QAction* renameAction            = col->action(KStandardAction::name(KStandardAction::RenameFile));
+        QAction* moveToTrashAction       = col->action(KStandardAction::name(KStandardAction::MoveToTrash));
+        QAction* deleteAction            = col->action(KStandardAction::name(KStandardAction::DeleteFile));
+        QAction* cutAction               = col->action(KStandardAction::name(KStandardAction::Cut));
         QAction* deleteWithTrashShortcut = col->action(QStringLiteral("delete_shortcut")); // see DolphinViewActionHandler
+        QAction* showTarget              = col->action(QStringLiteral("show_target"));
 
         KFileItemListProperties capabilities(list);
         const bool enableMoveToTrash = capabilities.isLocal() && capabilities.supportsMoving();
@@ -1376,6 +1474,7 @@ void DolphinMainWindow::updateEditActions()
         deleteAction->setEnabled(capabilities.supportsDeleting());
         deleteWithTrashShortcut->setEnabled(capabilities.supportsDeleting() && !enableMoveToTrash);
         cutAction->setEnabled(capabilities.supportsMoving());
+        showTarget->setEnabled(list.length() == 1 && list.at(0).isLink());
     }
 }
 
@@ -1468,7 +1567,7 @@ void DolphinMainWindow::refreshViews()
         const bool splitView = GeneralSettings::splitView();
         m_tabWidget->currentTabPage()->setSplitViewEnabled(splitView);
         updateSplitAction();
-        setUrlAsCaption(activeViewContainer()->url());
+        updateWindowTitle();
     }
 
     emit settingsChanged();
@@ -1516,7 +1615,7 @@ void DolphinMainWindow::connectViewSignals(DolphinViewContainer* container)
     connect(navigator, &KUrlNavigator::editableStateChanged,
             this, &DolphinMainWindow::slotEditableStateChanged);
     connect(navigator, &KUrlNavigator::tabRequested,
-            this, &DolphinMainWindow::openNewTab);
+            this, &DolphinMainWindow::openNewTabAfterLastTab);
 }
 
 void DolphinMainWindow::updateSplitAction()
@@ -1524,7 +1623,7 @@ void DolphinMainWindow::updateSplitAction()
     QAction* splitAction = actionCollection()->action(QStringLiteral("split_view"));
     const DolphinTabPage* tabPage = m_tabWidget->currentTabPage();
     if (tabPage->splitViewEnabled()) {
-        if (tabPage->primaryViewActive()) {
+        if (GeneralSettings::closeActiveSplitView() ? tabPage->primaryViewActive() : !tabPage->primaryViewActive()) {
             splitAction->setText(i18nc("@action:intoolbar Close left view", "Close"));
             splitAction->setToolTip(i18nc("@info", "Close left view"));
             splitAction->setIcon(QIcon::fromTheme(QStringLiteral("view-left-close")));