+ QAction *activateLastTab = actionCollection()->addAction(QStringLiteral("activate_last_tab"));
+ activateLastTab->setIconText(i18nc("@action:inmenu", "Last Tab"));
+ activateLastTab->setText(i18nc("@action:inmenu", "Go to Last Tab"));
+ activateLastTab->setEnabled(false);
+ connect(activateLastTab, &QAction::triggered, m_tabWidget, &DolphinTabWidget::activateLastTab);
+ actionCollection()->setDefaultShortcut(activateLastTab, Qt::ALT | Qt::Key_0);
+
+ QAction *activateNextTab = actionCollection()->addAction(QStringLiteral("activate_next_tab"));
+ activateNextTab->setIconText(i18nc("@action:inmenu", "Next Tab"));
+ activateNextTab->setText(i18nc("@action:inmenu", "Go to Next Tab"));
+ activateNextTab->setEnabled(false);
+ connect(activateNextTab, &QAction::triggered, m_tabWidget, &DolphinTabWidget::activateNextTab);
+ actionCollection()->setDefaultShortcuts(activateNextTab, nextTabKeys);
+
+ QAction *activatePrevTab = actionCollection()->addAction(QStringLiteral("activate_prev_tab"));
+ activatePrevTab->setIconText(i18nc("@action:inmenu", "Previous Tab"));
+ activatePrevTab->setText(i18nc("@action:inmenu", "Go to Previous Tab"));
+ activatePrevTab->setEnabled(false);
+ connect(activatePrevTab, &QAction::triggered, m_tabWidget, &DolphinTabWidget::activatePrevTab);
+ 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")));
+ connect(openInNewTab, &QAction::triggered, this, &DolphinMainWindow::openInNewTab);
+
+ QAction *openInNewTabs = actionCollection()->addAction(QStringLiteral("open_in_new_tabs"));
+ openInNewTabs->setText(i18nc("@action:inmenu", "Open in New Tabs"));
+ openInNewTabs->setIcon(QIcon::fromTheme(QStringLiteral("tab-new")));
+ connect(openInNewTabs, &QAction::triggered, this, &DolphinMainWindow::openInNewTab);
+
+ QAction *openInNewWindow = actionCollection()->addAction(QStringLiteral("open_in_new_window"));
+ openInNewWindow->setText(i18nc("@action:inmenu", "Open in New Window"));
+ openInNewWindow->setIcon(QIcon::fromTheme(QStringLiteral("window-new")));
+ connect(openInNewWindow, &QAction::triggered, this, &DolphinMainWindow::openInNewWindow);
+
+ QAction *openInSplitViewAction = actionCollection()->addAction(QStringLiteral("open_in_split_view"));
+ openInSplitViewAction->setText(i18nc("@action:inmenu", "Open in Split View"));
+ openInSplitViewAction->setIcon(QIcon::fromTheme(QStringLiteral("view-split-left-right")));
+ connect(openInSplitViewAction, &QAction::triggered, this, [this]() {
+ openInSplitView(QUrl());
+ });
+
+ m_recentFiles = new KRecentFilesAction(this);
+}
+
+void DolphinMainWindow::setupDockWidgets()
+{
+ const bool lock = GeneralSettings::lockPanels();
+
+ DolphinPlacesModelSingleton::instance().placesModel()->setPanelsLocked(lock);
+
+ KDualAction *lockLayoutAction = actionCollection()->add<KDualAction>(QStringLiteral("lock_panels"));
+ lockLayoutAction->setActiveText(i18nc("@action:inmenu Panels", "Unlock Panels"));
+ lockLayoutAction->setActiveIcon(QIcon::fromTheme(QStringLiteral("object-unlocked")));
+ lockLayoutAction->setInactiveText(i18nc("@action:inmenu Panels", "Lock Panels"));
+ lockLayoutAction->setInactiveIcon(QIcon::fromTheme(QStringLiteral("object-locked")));
+ lockLayoutAction->setWhatsThis(xi18nc("@info:whatsthis",
+ "This "
+ "switches between having panels <emphasis>locked</emphasis> or "
+ "<emphasis>unlocked</emphasis>.<nl/>Unlocked panels can be "
+ "dragged to the other side of the window and have a close "
+ "button.<nl/>Locked panels are embedded more cleanly."));
+ lockLayoutAction->setActive(lock);
+ connect(lockLayoutAction, &KDualAction::triggered, this, &DolphinMainWindow::togglePanelLockState);
+
+ // Setup "Information"
+ DolphinDockWidget *infoDock = new DolphinDockWidget(i18nc("@title:window", "Information"));
+ infoDock->setLocked(lock);
+ infoDock->setObjectName(QStringLiteral("infoDock"));
+ infoDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
+
+#if HAVE_BALOO
+ InformationPanel *infoPanel = new InformationPanel(infoDock);
+ infoPanel->setCustomContextMenuActions({lockLayoutAction});
+ connect(infoPanel, &InformationPanel::urlActivated, this, &DolphinMainWindow::handleUrl);
+ infoDock->setWidget(infoPanel);
+
+ createPanelAction(QIcon::fromTheme(QStringLiteral("documentinfo")), Qt::Key_F11, infoDock, QStringLiteral("show_information_panel"));
+
+ addDockWidget(Qt::RightDockWidgetArea, infoDock);
+ connect(this, &DolphinMainWindow::urlChanged, infoPanel, &InformationPanel::setUrl);
+ connect(this, &DolphinMainWindow::selectionChanged, infoPanel, &InformationPanel::setSelection);
+ connect(this, &DolphinMainWindow::requestItemInfo, infoPanel, &InformationPanel::requestDelayedItemInfo);
+ connect(this, &DolphinMainWindow::fileItemsChanged, infoPanel, &InformationPanel::slotFilesItemChanged);
+ connect(this, &DolphinMainWindow::settingsChanged, infoPanel, &InformationPanel::readSettings);
+#endif
+
+ // i18n: This is the last paragraph for the "What's This"-texts of all four panels.
+ const QString panelWhatsThis = xi18nc("@info:whatsthis",
+ "<para>To show or "
+ "hide panels like this go to <interface>Menu|Panels</interface> "
+ "or <interface>View|Panels</interface>.</para>");
+#if HAVE_BALOO
+ actionCollection()
+ ->action(QStringLiteral("show_information_panel"))
+ ->setWhatsThis(xi18nc("@info:whatsthis",
+ "<para> This toggles the "
+ "<emphasis>information</emphasis> panel at the right side of the "
+ "window.</para><para>The panel provides in-depth information "
+ "about the items your mouse is hovering over or about the selected "
+ "items. Otherwise it informs you about the currently viewed folder.<nl/>"
+ "For single items a preview of their contents is provided.</para>"));
+#endif
+ infoDock->setWhatsThis(xi18nc("@info:whatsthis",
+ "<para>This panel "
+ "provides in-depth information about the items your mouse is "
+ "hovering over or about the selected items. Otherwise it informs "
+ "you about the currently viewed folder.<nl/>For single items a "
+ "preview of their contents is provided.</para><para>You can configure "
+ "which and how details are given here by right-clicking.</para>")
+ + panelWhatsThis);
+
+ // Setup "Folders"
+ DolphinDockWidget *foldersDock = new DolphinDockWidget(i18nc("@title:window", "Folders"));
+ foldersDock->setLocked(lock);
+ foldersDock->setObjectName(QStringLiteral("foldersDock"));
+ foldersDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
+ FoldersPanel *foldersPanel = new FoldersPanel(foldersDock);
+ foldersPanel->setCustomContextMenuActions({lockLayoutAction});
+ foldersDock->setWidget(foldersPanel);
+
+ createPanelAction(QIcon::fromTheme(QStringLiteral("folder")), Qt::Key_F7, foldersDock, QStringLiteral("show_folders_panel"));
+
+ addDockWidget(Qt::LeftDockWidgetArea, foldersDock);
+ connect(this, &DolphinMainWindow::urlChanged, foldersPanel, &FoldersPanel::setUrl);
+ connect(foldersPanel, &FoldersPanel::folderActivated, this, &DolphinMainWindow::changeUrl);
+ connect(foldersPanel, &FoldersPanel::folderInNewTab, this, &DolphinMainWindow::openNewTab);
+ connect(foldersPanel, &FoldersPanel::folderInNewActiveTab, this, &DolphinMainWindow::openNewTabAndActivate);
+ connect(foldersPanel, &FoldersPanel::errorMessage, this, &DolphinMainWindow::showErrorMessage);
+
+ actionCollection()
+ ->action(QStringLiteral("show_folders_panel"))
+ ->setWhatsThis(xi18nc("@info:whatsthis",
+ "This toggles the "
+ "<emphasis>folders</emphasis> panel at the left side of the window."
+ "<nl/><nl/>It shows the folders of the <emphasis>file system"
+ "</emphasis> in a <emphasis>tree view</emphasis>."));
+ foldersDock->setWhatsThis(xi18nc("@info:whatsthis",
+ "<para>This panel "
+ "shows the folders of the <emphasis>file system</emphasis> in a "
+ "<emphasis>tree view</emphasis>.</para><para>Click a folder to go "
+ "there. Click the arrow to the left of a folder to see its subfolders. "
+ "This allows quick switching between any folders.</para>")
+ + panelWhatsThis);
+
+ // Setup "Terminal"
+#if 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->setContentsMargins(0, 0, 0, 0);
+ m_terminalPanel = new TerminalPanel(terminalDock);
+ m_terminalPanel->setCustomContextMenuActions({lockLayoutAction});
+ terminalDock->setWidget(m_terminalPanel);
+
+ connect(m_terminalPanel, &TerminalPanel::hideTerminalPanel, terminalDock, &DolphinDockWidget::hide);
+ connect(m_terminalPanel, &TerminalPanel::changeUrl, this, &DolphinMainWindow::slotTerminalDirectoryChanged);
+ connect(terminalDock, &DolphinDockWidget::visibilityChanged, m_terminalPanel, &TerminalPanel::dockVisibilityChanged);
+ connect(terminalDock, &DolphinDockWidget::visibilityChanged, this, &DolphinMainWindow::slotTerminalPanelVisibilityChanged);
+
+ createPanelAction(QIcon::fromTheme(QStringLiteral("dialog-scripts")), Qt::Key_F4, terminalDock, QStringLiteral("show_terminal_panel"));
+
+ addDockWidget(Qt::BottomDockWidgetArea, terminalDock);
+ connect(this, &DolphinMainWindow::urlChanged, m_terminalPanel, &TerminalPanel::setUrl);
+
+ if (GeneralSettings::version() < 200) {
+ terminalDock->hide();