+ };
+
+ // Links do not work within the Menubar so texts without links are provided there.
+
+ // i18n: If the external link isn't available in your language you should
+ // probably state the external link language at least in brackets to not
+ // frustrate the user. If there are multiple languages that the user might
+ // know with a reasonable chance you might want to have 2 external links.
+ // The same is in my opinion true for every external link you translate.
+ const QString whatsThisHelpContents = xi18nc("@info:whatsthis handbook",
+ "<para>This opens the Handbook for this application. It provides "
+ "explanations for every part of <emphasis>Dolphin</emphasis>.</para>");
+ setStandardActionWhatsThis(KStandardAction::HelpContents, whatsThisHelpContents
+ + xi18nc("@info:whatsthis second half of handbook hb text without link",
+ "<para>If you want more elaborate introductions to the "
+ "different features of <emphasis>Dolphin</emphasis> "
+ "go to the KDE UserBase Wiki.</para>"));
+ setHelpActionWhatsThis(KHelpMenu::menuHelpContents, whatsThisHelpContents
+ + xi18nc("@info:whatsthis second half of handbook text with link",
+ "<para>If you want more elaborate introductions to the "
+ "different features of <emphasis>Dolphin</emphasis> "
+ "<link url='https://userbase.kde.org/Dolphin/File_Management'>click here</link>. "
+ "It will open the dedicated page in the KDE UserBase Wiki.</para>"));
+
+ const QString whatsThisWhatsThis = xi18nc("@info:whatsthis whatsthis button",
+ "<para>This is the button that invokes the help feature you are "
+ "using right now! Click it, then click any component of this "
+ "application to ask \"What's this?\" about it. The mouse cursor "
+ "will change appearance if no help is available for a spot.</para>");
+ setStandardActionWhatsThis(KStandardAction::WhatsThis, whatsThisWhatsThis
+ + xi18nc("@info:whatsthis second half of whatsthis button text without link",
+ "<para>There are two other ways to get help for this application: The "
+ "<interface>Dolphin Handbook</interface> in the <interface>Help"
+ "</interface> menu and the <emphasis>KDE UserBase Wiki</emphasis> "
+ "article about <emphasis>File Management</emphasis> online."
+ "</para><para>The \"What's this?\" help is "
+ "missing in most other windows so don't get too used to this.</para>"));
+ setHelpActionWhatsThis(KHelpMenu::menuWhatsThis, whatsThisWhatsThis
+ + xi18nc("@info:whatsthis second half of whatsthis button text with link",
+ "<para>There are two other ways to get help: "
+ "The <link url='help:/dolphin/index.html'>Dolphin Handbook</link> and "
+ "the <link url='https://userbase.kde.org/Dolphin/File_Management'>KDE "
+ "UserBase Wiki</link>.</para><para>The \"What's this?\" help is "
+ "missing in most other windows so don't get too used to this.</para>"));
+
+ const QString whatsThisReportBug = xi18nc("@info:whatsthis","<para>This opens a "
+ "window that will guide you through reporting errors or flaws "
+ "in this application or in other KDE software.</para>");
+ setStandardActionWhatsThis(KStandardAction::ReportBug, whatsThisReportBug);
+ setHelpActionWhatsThis(KHelpMenu::menuReportBug, whatsThisReportBug
+ + xi18nc("@info:whatsthis second half of reportbug text with link",
+ "<para>High-quality bug reports are much appreciated. To learn "
+ "how to make your bug report as effective as possible "
+ "<link url='https://community.kde.org/Get_Involved/Bug_Reporting'>"
+ "click here</link>.</para>"));
+
+ const QString whatsThisDonate = xi18nc("@info:whatsthis","<para>This opens a "
+ "<emphasis>web page</emphasis> where you can donate to "
+ "support the continued work on this application and many "
+ "other projects by the <emphasis>KDE</emphasis> community.</para>"
+ "<para>Donating is the easiest and fastest way to efficiently "
+ "support KDE and its projects. KDE projects are available for "
+ "free therefore your donation is needed to cover things that "
+ "require money like servers, contributor meetings, etc.</para>"
+ "<para><emphasis>KDE e.V.</emphasis> is the non-profit "
+ "organization behind the KDE community.</para>");
+ setStandardActionWhatsThis(KStandardAction::Donate, whatsThisDonate);
+ setHelpActionWhatsThis(KHelpMenu::menuDonate, whatsThisDonate);
+
+ const QString whatsThisSwitchLanguage = xi18nc("@info:whatsthis",
+ "With this you can change the language this application uses."
+ "<nl/>You can even set secondary languages which will be used "
+ "if texts are not available in your preferred language.");
+ setStandardActionWhatsThis(KStandardAction::SwitchApplicationLanguage,
+ whatsThisSwitchLanguage);
+ setHelpActionWhatsThis(KHelpMenu::menuSwitchLanguage, whatsThisSwitchLanguage);
+
+ const QString whatsThisAboutApp = xi18nc("@info:whatsthis","This opens a "
+ "window that informs you about the version, license, "
+ "used libraries and maintainers of this application.");
+ setStandardActionWhatsThis(KStandardAction::AboutApp, whatsThisAboutApp);
+ setHelpActionWhatsThis(KHelpMenu::menuAboutApp, whatsThisAboutApp);
+
+ const QString whatsThisAboutKDE = xi18nc("@info:whatsthis","This opens a "
+ "window with information about <emphasis>KDE</emphasis>. "
+ "The KDE community are the people behind this free software."
+ "<nl/>If you like using this application but don't know "
+ "about KDE or want to see a cute dragon have a look!");
+ setStandardActionWhatsThis(KStandardAction::AboutKDE, whatsThisAboutKDE);
+ setHelpActionWhatsThis(KHelpMenu::menuAboutKDE, whatsThisAboutKDE);
+}
+
+bool DolphinMainWindow::addHamburgerMenuToToolbar()
+{
+ QDomDocument domDocument = KXMLGUIClient::domDocument();
+ if (domDocument.isNull()) {
+ return false;
+ }
+ QDomNode toolbar = domDocument.elementsByTagName(QStringLiteral("ToolBar")).at(0);
+ if (toolbar.isNull()) {
+ return false;
+ }
+
+ QDomElement hamburgerMenuElement = domDocument.createElement(QStringLiteral("Action"));
+ hamburgerMenuElement.setAttribute(QStringLiteral("name"), QStringLiteral("hamburger_menu"));
+ toolbar.appendChild(hamburgerMenuElement);
+
+ KXMLGUIFactory::saveConfigFile(domDocument, xmlFile());
+ reloadXML();
+ createGUI();
+ return true;
+ // Make sure to also remove the <KXMLGUIFactory> and <QDomDocument> include
+ // whenever this method is removed (maybe in the year ~2026).
+}
+
+bool DolphinMainWindow::event(QEvent *event)
+{
+ if (event->type() == QEvent::WhatsThisClicked) {
+ event->accept();
+ QWhatsThisClickedEvent* whatsThisEvent = dynamic_cast<QWhatsThisClickedEvent*>(event);
+ QDesktopServices::openUrl(QUrl(whatsThisEvent->href()));
+ return true;
+ }
+ return KXmlGuiWindow::event(event);
+}
+
+bool DolphinMainWindow::eventFilter(QObject* obj, QEvent* event)
+{
+ Q_UNUSED(obj)
+ if (event->type() == QEvent::WhatsThisClicked) {
+ event->accept();
+ QWhatsThisClickedEvent* whatsThisEvent = dynamic_cast<QWhatsThisClickedEvent*>(event);
+ QDesktopServices::openUrl(QUrl(whatsThisEvent->href()));
+ return true;
+ }
+ return false;
+}
+
+// Set a sane initial window size
+QSize DolphinMainWindow::sizeHint() const
+{
+ return KXmlGuiWindow::sizeHint().expandedTo(QSize(760, 550));
+}
+
+void DolphinMainWindow::saveNewToolbarConfig()
+{
+ KXmlGuiWindow::saveNewToolbarConfig(); // Applies the new config. This has to be called first
+ // because the rest of this method decides things
+ // based on the new config.
+ auto navigators = static_cast<DolphinNavigatorsWidgetAction *>
+ (actionCollection()->action(QStringLiteral("url_navigators")));
+ if (!toolBar()->actions().contains(navigators)) {
+ m_tabWidget->currentTabPage()->insertNavigatorsWidget(navigators);
+ }
+ updateAllowedToolbarAreas();
+ (static_cast<KHamburgerMenu *>(actionCollection()->action(KStandardAction::name(
+ KStandardAction::HamburgerMenu))))->hideActionsOf(toolBar());
+}
+
+void DolphinMainWindow::focusTerminalPanel()
+{
+ if (m_terminalPanel->isVisible()) {
+ if (m_terminalPanel->terminalHasFocus()) {
+ m_activeViewContainer->view()->setFocus(Qt::FocusReason::ShortcutFocusReason);
+ actionCollection()->action(QStringLiteral("focus_terminal_panel"))->setText(i18nc("@action:inmenu Tools", "Focus Terminal Panel"));
+ } else {
+ m_terminalPanel->setFocus(Qt::FocusReason::ShortcutFocusReason);
+ actionCollection()->action(QStringLiteral("focus_terminal_panel"))->setText(i18nc("@action:inmenu Tools", "Defocus Terminal Panel"));
+ }
+ } else {
+ actionCollection()->action(QStringLiteral("show_terminal_panel"))->trigger();
+ actionCollection()->action(QStringLiteral("focus_terminal_panel"))->setText(i18nc("@action:inmenu Tools", "Defocus Terminal Panel"));