]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinmainwindow.cpp
Port to new KStandardAction slot syntax
[dolphin.git] / src / dolphinmainwindow.cpp
index db9c34c6ac5f21ccc01761c1b6955e909672eedf..ff834700bf0bab311ed1f6c24b1f2cda1123c43f 100644 (file)
@@ -29,6 +29,7 @@
 #include "dolphintabwidget.h"
 #include "dolphinviewcontainer.h"
 #include "dolphintabpage.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/folders/folderspanel.h"
 #include "panels/places/placespanel.h"
 #include "panels/information/informationpanel.h"
 #include <KActionMenu>
 #include <KAuthorized>
 #include <KConfig>
 #include <KActionMenu>
 #include <KAuthorized>
 #include <KConfig>
-#include <kconfigwidgets_version.h>
 #include <kdualaction.h>
 #include <kdualaction.h>
+#include <KHelpMenu>
 #include <KJobWidgets>
 #include <QLineEdit>
 #include <KToolBar>
 #include <KIO/JobUiDelegate>
 #include <KLocalizedString>
 #include <KProtocolManager>
 #include <KJobWidgets>
 #include <QLineEdit>
 #include <KToolBar>
 #include <KIO/JobUiDelegate>
 #include <KLocalizedString>
 #include <KProtocolManager>
+#include <KProtocolInfo>
 #include <QMenu>
 #include <KMessageBox>
 #include <KFileItemListProperties>
 #include <QMenu>
 #include <KMessageBox>
 #include <KFileItemListProperties>
@@ -98,6 +100,8 @@ DolphinMainWindow::DolphinMainWindow() :
     m_updateToolBarTimer(0),
     m_lastHandleUrlStatJob(0)
 {
     m_updateToolBarTimer(0),
     m_lastHandleUrlStatJob(0)
 {
+    Q_INIT_RESOURCE(dolphin);
+
     setObjectName(QStringLiteral("Dolphin#"));
 
     connect(&DolphinNewFileMenuObserver::instance(), &DolphinNewFileMenuObserver::errorMessage,
     setObjectName(QStringLiteral("Dolphin#"));
 
     connect(&DolphinNewFileMenuObserver::instance(), &DolphinNewFileMenuObserver::errorMessage,
@@ -124,6 +128,7 @@ DolphinMainWindow::DolphinMainWindow() :
     setAcceptDrops(true);
 
     m_tabWidget = new DolphinTabWidget(this);
     setAcceptDrops(true);
 
     m_tabWidget = new DolphinTabWidget(this);
+    m_tabWidget->setObjectName("tabWidget");
     connect(m_tabWidget, &DolphinTabWidget::activeViewChanged,
             this, &DolphinMainWindow::activeViewChanged);
     connect(m_tabWidget, &DolphinTabWidget::tabCountChanged,
     connect(m_tabWidget, &DolphinTabWidget::activeViewChanged,
             this, &DolphinMainWindow::activeViewChanged);
     connect(m_tabWidget, &DolphinTabWidget::tabCountChanged,
@@ -166,6 +171,11 @@ DolphinMainWindow::DolphinMainWindow() :
     if (!showMenu) {
         createControlButton();
     }
     if (!showMenu) {
         createControlButton();
     }
+
+    // enable middle-click on back/forward/up to open in a new tab
+    auto *middleClickEventFilter = new MiddleClickActionEventFilter(this);
+    connect(middleClickEventFilter, &MiddleClickActionEventFilter::actionMiddleClicked, this, &DolphinMainWindow::slotToolBarActionMiddleClicked);
+    toolBar()->installEventFilter(middleClickEventFilter);
 }
 
 DolphinMainWindow::~DolphinMainWindow()
 }
 
 DolphinMainWindow::~DolphinMainWindow()
@@ -290,7 +300,7 @@ void DolphinMainWindow::updateFilterBarAction(bool show)
 
 void DolphinMainWindow::openNewMainWindow()
 {
 
 void DolphinMainWindow::openNewMainWindow()
 {
-    KRun::run(QStringLiteral("dolphin %u"), QList<QUrl>(), this);
+    Dolphin::openNewWindow({m_activeViewContainer->url()}, this);
 }
 
 void DolphinMainWindow::openNewActivatedTab()
 }
 
 void DolphinMainWindow::openNewActivatedTab()
@@ -306,16 +316,21 @@ void DolphinMainWindow::openNewTab(const QUrl& url)
 void DolphinMainWindow::openInNewTab()
 {
     const KFileItemList& list = m_activeViewContainer->view()->selectedItems();
 void DolphinMainWindow::openInNewTab()
 {
     const KFileItemList& list = m_activeViewContainer->view()->selectedItems();
-    if (list.isEmpty()) {
-        openNewTab(m_activeViewContainer->url());
-    } else {
-        foreach (const KFileItem& item, list) {
-            const QUrl& url = DolphinView::openItemAsFolderUrl(item);
-            if (!url.isEmpty()) {
-                openNewTab(url);
-            }
+    bool tabCreated = false;
+
+    foreach (const KFileItem& item, list) {
+        const QUrl& url = DolphinView::openItemAsFolderUrl(item);
+        if (!url.isEmpty()) {
+            openNewTab(url);
+            tabCreated = true;
         }
     }
         }
     }
+
+    // if no new tab has been created from the selection
+    // open the current directory in a new tab
+    if (!tabCreated) {
+        openNewTab(m_activeViewContainer->url());
+    }
 }
 
 void DolphinMainWindow::openInNewWindow()
 }
 
 void DolphinMainWindow::openInNewWindow()
@@ -331,7 +346,7 @@ void DolphinMainWindow::openInNewWindow()
     }
 
     if (!newWindowUrl.isEmpty()) {
     }
 
     if (!newWindowUrl.isEmpty()) {
-        KRun::run(QStringLiteral("dolphin %u"), {newWindowUrl}, this);
+        Dolphin::openNewWindow({newWindowUrl}, this);
     }
 }
 
     }
 }
 
@@ -492,6 +507,19 @@ void DolphinMainWindow::slotDirectoryLoadingCompleted()
     updatePasteAction();
 }
 
     updatePasteAction();
 }
 
+void DolphinMainWindow::slotToolBarActionMiddleClicked(QAction *action)
+{
+    if (action == actionCollection()->action(QStringLiteral("go_back"))) {
+        goBackInNewTab();
+    } else if (action == actionCollection()->action(QStringLiteral("go_forward"))) {
+        goForwardInNewTab();
+    } else if (action == actionCollection()->action(QStringLiteral("go_up"))) {
+        goUpInNewTab();
+    } else if (action == actionCollection()->action(QStringLiteral("go_home"))) {
+        goHomeInNewTab();
+    }
+}
+
 void DolphinMainWindow::selectAll()
 {
     clearStatusBar();
 void DolphinMainWindow::selectAll()
 {
     clearStatusBar();
@@ -527,13 +555,14 @@ void DolphinMainWindow::toggleSplitView()
 void DolphinMainWindow::toggleSplitStash()
 {
     DolphinTabPage* tabPage = m_tabWidget->currentTabPage();
 void DolphinMainWindow::toggleSplitStash()
 {
     DolphinTabPage* tabPage = m_tabWidget->currentTabPage();
-    tabPage->setSplitViewEnabled(!tabPage->splitViewEnabled(), true);
+    tabPage->setSplitViewEnabled(false);
+    tabPage->setSplitViewEnabled(true, QUrl("stash:/"));
 }
 
 void DolphinMainWindow::reloadView()
 {
     clearStatusBar();
 }
 
 void DolphinMainWindow::reloadView()
 {
     clearStatusBar();
-    m_activeViewContainer->view()->reload();
+    m_activeViewContainer->reload();
 }
 
 void DolphinMainWindow::stopLoading()
 }
 
 void DolphinMainWindow::stopLoading()
@@ -616,40 +645,29 @@ void DolphinMainWindow::goHome()
     m_activeViewContainer->urlNavigator()->goHome();
 }
 
     m_activeViewContainer->urlNavigator()->goHome();
 }
 
-void DolphinMainWindow::goBack(Qt::MouseButtons buttons)
+void DolphinMainWindow::goBackInNewTab()
 {
 {
-    // The default case (left button pressed) is handled in goBack().
-    if (buttons == Qt::MiddleButton) {
-        KUrlNavigator* urlNavigator = activeViewContainer()->urlNavigator();
-        const int index = urlNavigator->historyIndex() + 1;
-        openNewTab(urlNavigator->locationUrl(index));
-    }
+    KUrlNavigator* urlNavigator = activeViewContainer()->urlNavigator();
+    const int index = urlNavigator->historyIndex() + 1;
+    openNewTab(urlNavigator->locationUrl(index));
 }
 
 }
 
-void DolphinMainWindow::goForward(Qt::MouseButtons buttons)
+void DolphinMainWindow::goForwardInNewTab()
 {
 {
-    // The default case (left button pressed) is handled in goForward().
-    if (buttons == Qt::MiddleButton) {
-        KUrlNavigator* urlNavigator = activeViewContainer()->urlNavigator();
-        const int index = urlNavigator->historyIndex() - 1;
-        openNewTab(urlNavigator->locationUrl(index));
-    }
+    KUrlNavigator* urlNavigator = activeViewContainer()->urlNavigator();
+    const int index = urlNavigator->historyIndex() - 1;
+    openNewTab(urlNavigator->locationUrl(index));
 }
 
 }
 
-void DolphinMainWindow::goUp(Qt::MouseButtons buttons)
+void DolphinMainWindow::goUpInNewTab()
 {
 {
-    // The default case (left button pressed) is handled in goUp().
-    if (buttons == Qt::MiddleButton) {
-        openNewTab(KIO::upUrl(activeViewContainer()->url()));
-    }
+    const QUrl currentUrl = activeViewContainer()->urlNavigator()->locationUrl();
+    openNewTab(KIO::upUrl(currentUrl));
 }
 
 }
 
-void DolphinMainWindow::goHome(Qt::MouseButtons buttons)
+void DolphinMainWindow::goHomeInNewTab()
 {
 {
-    // The default case (left button pressed) is handled in goHome().
-    if (buttons == Qt::MiddleButton) {
-        openNewTab(Dolphin::homeUrl());
-    }
+    openNewTab(Dolphin::homeUrl());
 }
 
 void DolphinMainWindow::compareFiles()
 }
 
 void DolphinMainWindow::compareFiles()
@@ -729,7 +747,7 @@ void DolphinMainWindow::handleUrl(const QUrl& 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);
     } else if (KProtocolManager::supportsListing(url)) {
         // stat the URL to see if it is a dir or not
         m_lastHandleUrlStatJob = KIO::stat(url, KIO::HideProgressInfo);
-        if (m_lastHandleUrlStatJob->ui()) {
+        if (m_lastHandleUrlStatJob->uiDelegate()) {
             KJobWidgets::setWindow(m_lastHandleUrlStatJob, this);
         }
         connect(m_lastHandleUrlStatJob, &KIO::Job::result,
             KJobWidgets::setWindow(m_lastHandleUrlStatJob, this);
         }
         connect(m_lastHandleUrlStatJob, &KIO::Job::result,
@@ -771,11 +789,9 @@ void DolphinMainWindow::openContextMenu(const QPoint& pos,
         changeUrl(KIO::upUrl(item.url()));
         break;
 
         changeUrl(KIO::upUrl(item.url()));
         break;
 
-    case DolphinContextMenu::OpenParentFolderInNewWindow: {
-
-        KRun::run(QStringLiteral("dolphin %u"), {KIO::upUrl(item.url())}, this);
+    case DolphinContextMenu::OpenParentFolderInNewWindow:
+        Dolphin::openNewWindow({KIO::upUrl(item.url())}, this);
         break;
         break;
-    }
 
     case DolphinContextMenu::OpenParentFolderInNewTab:
         openNewTab(KIO::upUrl(item.url()));
 
     case DolphinContextMenu::OpenParentFolderInNewTab:
         openNewTab(KIO::upUrl(item.url()));
@@ -869,21 +885,8 @@ void DolphinMainWindow::updateControlMenu()
     addActionToMenu(ac->action(KStandardAction::name(KStandardAction::Preferences)), menu);
 
     // Add "Help" menu
     addActionToMenu(ac->action(KStandardAction::name(KStandardAction::Preferences)), menu);
 
     // Add "Help" menu
-    QMenu* helpMenu = new QMenu(i18nc("@action:inmenu", "Help"), menu);
-    helpMenu->addAction(ac->action(KStandardAction::name(KStandardAction::HelpContents)));
-    helpMenu->addAction(ac->action(KStandardAction::name(KStandardAction::WhatsThis)));
-    helpMenu->addSeparator();
-    helpMenu->addAction(ac->action(KStandardAction::name(KStandardAction::ReportBug)));
-    helpMenu->addSeparator();
-#if KCONFIGWIDGETS_VERSION >= QT_VERSION_CHECK(5, 26, 0)
-    helpMenu->addAction(ac->action(KStandardAction::name(KStandardAction::Donate)));
-    helpMenu->addSeparator();
-#endif
-    helpMenu->addAction(ac->action(KStandardAction::name(KStandardAction::SwitchApplicationLanguage)));
-    helpMenu->addSeparator();
-    helpMenu->addAction(ac->action(KStandardAction::name(KStandardAction::AboutApp)));
-    helpMenu->addAction(ac->action(KStandardAction::name(KStandardAction::AboutKDE)));
-    menu->addMenu(helpMenu);
+    auto helpMenu = new KHelpMenu(menu);
+    menu->addMenu(helpMenu->menu());
 
     menu->addSeparator();
     addActionToMenu(ac->action(KStandardAction::name(KStandardAction::ShowMenubar)), menu);
 
     menu->addSeparator();
     addActionToMenu(ac->action(KStandardAction::name(KStandardAction::ShowMenubar)), menu);
@@ -967,13 +970,17 @@ void DolphinMainWindow::setUrlAsCaption(const QUrl& url)
         }
     }
 
         }
     }
 
-    QString fileName = url.adjusted(QUrl::StripTrailingSlash).fileName();
-    if (fileName.isEmpty()) {
-        fileName = '/';
+    if (GeneralSettings::showFullPathInTitlebar()) {
+        const QString path = url.adjusted(QUrl::StripTrailingSlash).path();
+        caption.append(path);
+    } else {
+        QString fileName = url.adjusted(QUrl::StripTrailingSlash).fileName();
+        if (fileName.isEmpty()) {
+            fileName = '/';
+        }
+        caption.append(fileName);
     }
 
     }
 
-    caption.append(fileName);
-
     setWindowTitle(caption);
 }
 
     setWindowTitle(caption);
 }
 
@@ -1007,27 +1014,23 @@ void DolphinMainWindow::setupActions()
     closeTab->setEnabled(false);
     connect(closeTab, &QAction::triggered, m_tabWidget, static_cast<void(DolphinTabWidget::*)()>(&DolphinTabWidget::closeTab));
 
     closeTab->setEnabled(false);
     connect(closeTab, &QAction::triggered, m_tabWidget, static_cast<void(DolphinTabWidget::*)()>(&DolphinTabWidget::closeTab));
 
-    KStandardAction::quit(this, SLOT(quit()), actionCollection());
+    KStandardAction::quit(this, &DolphinMainWindow::quit, actionCollection());
 
     // setup 'Edit' menu
     KStandardAction::undo(this,
 
     // setup 'Edit' menu
     KStandardAction::undo(this,
-                          SLOT(undo()),
+                          &DolphinMainWindow::undo,
                           actionCollection());
 
                           actionCollection());
 
-    // need to remove shift+del from cut action, else the shortcut for deletejob
-    // doesn't work
-    QAction* cut = KStandardAction::cut(this, SLOT(cut()), actionCollection());
-    auto cutShortcuts = cut->shortcuts();
-    cutShortcuts.removeAll(QKeySequence(Qt::SHIFT | Qt::Key_Delete));
-    actionCollection()->setDefaultShortcuts(cut, cutShortcuts);
-    KStandardAction::copy(this, SLOT(copy()), actionCollection());
-    QAction* paste = KStandardAction::paste(this, SLOT(paste()), actionCollection());
+
+    KStandardAction::cut(this, &DolphinMainWindow::cut, actionCollection());
+    KStandardAction::copy(this, &DolphinMainWindow::copy, actionCollection());
+    QAction* paste = KStandardAction::paste(this, &DolphinMainWindow::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:
     paste->setIconText(i18nc("@action:inmenu Edit", "Paste"));
 
     // 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:
     paste->setIconText(i18nc("@action:inmenu Edit", "Paste"));
 
-    KStandardAction::find(this, SLOT(find()), actionCollection());
+    KStandardAction::find(this, &DolphinMainWindow::find, actionCollection());
 
     QAction* selectAll = actionCollection()->addAction(QStringLiteral("select_all"));
     selectAll->setText(i18nc("@action:inmenu Edit", "Select All"));
 
     QAction* selectAll = actionCollection()->addAction(QStringLiteral("select_all"));
     selectAll->setText(i18nc("@action:inmenu Edit", "Select All"));
@@ -1047,10 +1050,12 @@ void DolphinMainWindow::setupActions()
     connect(split, &QAction::triggered, this, &DolphinMainWindow::toggleSplitView);
 
     QAction* stashSplit = actionCollection()->addAction(QStringLiteral("split_stash"));
     connect(split, &QAction::triggered, this, &DolphinMainWindow::toggleSplitView);
 
     QAction* stashSplit = actionCollection()->addAction(QStringLiteral("split_stash"));
-    actionCollection()->setDefaultShortcut(stashSplit, Qt::Key_F2);
+    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->setText(i18nc("@action:intoolbar Stash", "Stash"));
     stashSplit->setToolTip(i18nc("@info", "Opens the stash virtual directory in a split window"));
-    stashSplit->setCheckable(true);
+    stashSplit->setIcon(QIcon::fromTheme(QStringLiteral("folder-visiting")));
+    stashSplit->setCheckable(false);
+    stashSplit->setVisible(KProtocolInfo::isKnownProtocol("stash"));
     connect(stashSplit, &QAction::triggered, this, &DolphinMainWindow::toggleSplitStash);
 
     QAction* reload = actionCollection()->addAction(QStringLiteral("reload"));
     connect(stashSplit, &QAction::triggered, this, &DolphinMainWindow::toggleSplitStash);
 
     QAction* reload = actionCollection()->addAction(QStringLiteral("reload"));
@@ -1076,7 +1081,7 @@ void DolphinMainWindow::setupActions()
     connect(replaceLocation, &QAction::triggered, this, &DolphinMainWindow::replaceLocation);
 
     // setup 'Go' menu
     connect(replaceLocation, &QAction::triggered, this, &DolphinMainWindow::replaceLocation);
 
     // setup 'Go' menu
-    QAction* backAction = KStandardAction::back(this, SLOT(goBack()), actionCollection());
+    QAction* backAction = KStandardAction::back(this, &DolphinMainWindow::goBack, actionCollection());
     auto backShortcuts = backAction->shortcuts();
     backShortcuts.append(QKeySequence(Qt::Key_Backspace));
     actionCollection()->setDefaultShortcuts(backAction, backShortcuts);
     auto backShortcuts = backAction->shortcuts();
     backShortcuts.append(QKeySequence(Qt::Key_Backspace));
     actionCollection()->setDefaultShortcuts(backAction, backShortcuts);
@@ -1100,9 +1105,9 @@ void DolphinMainWindow::setupActions()
     auto undoAction = actionCollection()->action(KStandardAction::name(KStandardAction::Undo));
     undoAction->setEnabled(false); // undo should be disabled by default
 
     auto undoAction = actionCollection()->action(KStandardAction::name(KStandardAction::Undo));
     undoAction->setEnabled(false); // undo should be disabled by default
 
-    KStandardAction::forward(this, SLOT(goForward()), actionCollection());
-    KStandardAction::up(this, SLOT(goUp()), actionCollection());
-    KStandardAction::home(this, SLOT(goHome()), actionCollection());
+    KStandardAction::forward(this, &DolphinMainWindow::goForward, actionCollection());
+    KStandardAction::up(this, &DolphinMainWindow::goUp, actionCollection());
+    KStandardAction::home(this, &DolphinMainWindow::goHome, actionCollection());
 
     // setup 'Tools' menu
     QAction* showFilterBar = actionCollection()->addAction(QStringLiteral("show_filter_bar"));
 
     // setup 'Tools' menu
     QAction* showFilterBar = actionCollection()->addAction(QStringLiteral("show_filter_bar"));
@@ -1143,14 +1148,14 @@ void DolphinMainWindow::setupActions()
     activateNextTab->setText(i18nc("@action:inmenu", "Activate Next Tab"));
     activateNextTab->setEnabled(false);
     connect(activateNextTab, &QAction::triggered, m_tabWidget, &DolphinTabWidget::activateNextTab);
     activateNextTab->setText(i18nc("@action:inmenu", "Activate Next Tab"));
     activateNextTab->setEnabled(false);
     connect(activateNextTab, &QAction::triggered, m_tabWidget, &DolphinTabWidget::activateNextTab);
-    actionCollection()->setDefaultShortcuts(activateNextTab, QApplication::isRightToLeft() ? prevTabKeys : nextTabKeys);
+    actionCollection()->setDefaultShortcuts(activateNextTab, nextTabKeys);
 
     QAction* activatePrevTab = actionCollection()->addAction(QStringLiteral("activate_prev_tab"));
     activatePrevTab->setIconText(i18nc("@action:inmenu", "Previous Tab"));
     activatePrevTab->setText(i18nc("@action:inmenu", "Activate Previous Tab"));
     activatePrevTab->setEnabled(false);
     connect(activatePrevTab, &QAction::triggered, m_tabWidget, &DolphinTabWidget::activatePrevTab);
 
     QAction* activatePrevTab = actionCollection()->addAction(QStringLiteral("activate_prev_tab"));
     activatePrevTab->setIconText(i18nc("@action:inmenu", "Previous Tab"));
     activatePrevTab->setText(i18nc("@action:inmenu", "Activate Previous Tab"));
     activatePrevTab->setEnabled(false);
     connect(activatePrevTab, &QAction::triggered, m_tabWidget, &DolphinTabWidget::activatePrevTab);
-    actionCollection()->setDefaultShortcuts(activatePrevTab, QApplication::isRightToLeft() ? nextTabKeys : prevTabKeys);
+    actionCollection()->setDefaultShortcuts(activatePrevTab, prevTabKeys);
 
     // for context menu
     QAction* openInNewTab = actionCollection()->addAction(QStringLiteral("open_in_new_tab"));
 
     // for context menu
     QAction* openInNewTab = actionCollection()->addAction(QStringLiteral("open_in_new_tab"));
@@ -1311,9 +1316,9 @@ void DolphinMainWindow::updateEditActions()
         stateChanged(QStringLiteral("has_selection"));
 
         KActionCollection* col = actionCollection();
         stateChanged(QStringLiteral("has_selection"));
 
         KActionCollection* col = actionCollection();
-        QAction* renameAction      = col->action(QStringLiteral("rename"));
-        QAction* moveToTrashAction = col->action(QStringLiteral("move_to_trash"));
-        QAction* deleteAction      = col->action(QStringLiteral("delete"));
+        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* cutAction         = col->action(KStandardAction::name(KStandardAction::Cut));
         QAction* deleteWithTrashShortcut = col->action(QStringLiteral("delete_shortcut")); // see DolphinViewActionHandler
 
@@ -1417,6 +1422,7 @@ void DolphinMainWindow::refreshViews()
         const bool splitView = GeneralSettings::splitView();
         m_tabWidget->currentTabPage()->setSplitViewEnabled(splitView);
         updateSplitAction();
         const bool splitView = GeneralSettings::splitView();
         m_tabWidget->currentTabPage()->setSplitViewEnabled(splitView);
         updateSplitAction();
+        setUrlAsCaption(activeViewContainer()->url());
     }
 
     emit settingsChanged();
     }
 
     emit settingsChanged();
@@ -1453,6 +1459,8 @@ void DolphinMainWindow::connectViewSignals(DolphinViewContainer* container)
             this, static_cast<void(DolphinMainWindow::*)()>(&DolphinMainWindow::goBack));
     connect(view, &DolphinView::goForwardRequested,
             this, static_cast<void(DolphinMainWindow::*)()>(&DolphinMainWindow::goForward));
             this, static_cast<void(DolphinMainWindow::*)()>(&DolphinMainWindow::goBack));
     connect(view, &DolphinView::goForwardRequested,
             this, static_cast<void(DolphinMainWindow::*)()>(&DolphinMainWindow::goForward));
+    connect(view, &DolphinView::urlActivated,
+            this, &DolphinMainWindow::handleUrl);
 
     const KUrlNavigator* navigator = container->urlNavigator();
     connect(navigator, &KUrlNavigator::urlChanged,
 
     const KUrlNavigator* navigator = container->urlNavigator();
     connect(navigator, &KUrlNavigator::urlChanged,
@@ -1534,3 +1542,4 @@ void DolphinMainWindow::UndoUiInterface::jobError(KIO::Job* job)
         KIO::FileUndoManager::UiInterface::jobError(job);
     }
 }
         KIO::FileUndoManager::UiInterface::jobError(job);
     }
 }
+