2 * SPDX-FileCopyrightText: 2006 Peter Penz <peter.penz19@gmail.com>
3 * SPDX-FileCopyrightText: 2006 Stefan Monov <logixoul@gmail.com>
4 * SPDX-FileCopyrightText: 2006 Cvetoslav Ludmiloff <ludmiloff@gmail.com>
6 * SPDX-License-Identifier: GPL-2.0-or-later
9 #include "dolphinmainwindow.h"
11 #include "dolphinmainwindowadaptor.h"
12 #include "config-terminal.h"
14 #include "dolphinbookmarkhandler.h"
15 #include "dolphindockwidget.h"
16 #include "dolphincontextmenu.h"
17 #include "dolphinnavigatorswidgetaction.h"
18 #include "dolphinnewfilemenu.h"
19 #include "dolphinrecenttabsmenu.h"
20 #include "dolphinurlnavigatorscontroller.h"
21 #include "dolphinviewcontainer.h"
22 #include "dolphintabpage.h"
23 #include "middleclickactioneventfilter.h"
24 #include "panels/folders/folderspanel.h"
25 #include "panels/places/placesitemmodel.h"
26 #include "panels/places/placespanel.h"
27 #include "panels/terminal/terminalpanel.h"
28 #include "settings/dolphinsettingsdialog.h"
29 #include "statusbar/dolphinstatusbar.h"
30 #include "views/dolphinviewactionhandler.h"
31 #include "views/dolphinremoteencoding.h"
32 #include "views/draganddrophelper.h"
33 #include "views/viewproperties.h"
34 #include "views/dolphinnewfilemenuobserver.h"
35 #include "dolphin_generalsettings.h"
37 #include <KActionCollection>
38 #include <KActionMenu>
39 #include <KAuthorized>
42 #include <KDualAction>
43 #include <KFileItemListProperties>
45 #include <KIO/CommandLauncherJob>
46 #include <KIO/JobUiDelegate>
47 #include <KIO/OpenFileManagerWindowJob>
48 #include <KIO/OpenUrlJob>
49 #include <KJobWidgets>
50 #include <KLocalizedString>
51 #include <KMessageBox>
52 #include <KNS3/KMoreToolsMenuFactory>
53 #include <KProtocolInfo>
54 #include <KProtocolManager>
56 #include <KStandardAction>
57 #include <KStartupInfo>
59 #include <KToggleAction>
61 #include <KToolBarPopupAction>
62 #include <KToolInvocation>
63 #include <KUrlComboBox>
64 #include <KUrlNavigator>
65 #include <KWindowSystem>
66 #include <KXMLGUIFactory>
68 #include <kio_version.h>
70 #include <QApplication>
72 #include <QCloseEvent>
73 #include <QDesktopServices>
75 #include <QDomDocument>
79 #include <QPushButton>
81 #include <QStandardPaths>
83 #include <QToolButton>
84 #include <QWhatsThisClickedEvent>
87 // Used for GeneralSettings::version() to determine whether
88 // an updated version of Dolphin is running.
89 const int CurrentDolphinVersion
= 201;
90 // The maximum number of entries in the back/forward popup menu
91 const int MaxNumberOfNavigationentries
= 12;
92 // The maximum number of "Activate Tab" shortcuts
93 const int MaxActivateTabShortcuts
= 9;
96 DolphinMainWindow::DolphinMainWindow() :
97 KXmlGuiWindow(nullptr),
98 m_newFileMenu(nullptr),
100 m_tabWidget(nullptr),
101 m_activeViewContainer(nullptr),
102 m_actionHandler(nullptr),
103 m_remoteEncoding(nullptr),
105 m_bookmarkHandler(nullptr),
106 m_controlButton(nullptr),
107 m_updateToolBarTimer(nullptr),
108 m_lastHandleUrlOpenJob(nullptr),
109 m_terminalPanel(nullptr),
110 m_placesPanel(nullptr),
111 m_tearDownFromPlacesRequested(false),
112 m_backAction(nullptr),
113 m_forwardAction(nullptr)
115 Q_INIT_RESOURCE(dolphin
);
117 new MainWindowAdaptor(this);
120 setWindowFlags(Qt::WindowContextHelpButtonHint
);
122 setComponentName(QStringLiteral("dolphin"), QGuiApplication::applicationDisplayName());
123 setObjectName(QStringLiteral("Dolphin#"));
125 connect(&DolphinNewFileMenuObserver::instance(), &DolphinNewFileMenuObserver::errorMessage
,
126 this, &DolphinMainWindow::showErrorMessage
);
128 KIO::FileUndoManager
* undoManager
= KIO::FileUndoManager::self();
129 undoManager
->setUiInterface(new UndoUiInterface());
131 connect(undoManager
, QOverload
<bool>::of(&KIO::FileUndoManager::undoAvailable
),
132 this, &DolphinMainWindow::slotUndoAvailable
);
133 connect(undoManager
, &KIO::FileUndoManager::undoTextChanged
,
134 this, &DolphinMainWindow::slotUndoTextChanged
);
135 connect(undoManager
, &KIO::FileUndoManager::jobRecordingStarted
,
136 this, &DolphinMainWindow::clearStatusBar
);
137 connect(undoManager
, &KIO::FileUndoManager::jobRecordingFinished
,
138 this, &DolphinMainWindow::showCommand
);
140 const bool firstRun
= (GeneralSettings::version() < 200);
142 GeneralSettings::setViewPropsTimestamp(QDateTime::currentDateTime());
145 setAcceptDrops(true);
147 auto *navigatorsWidgetAction
= new DolphinNavigatorsWidgetAction(this);
148 actionCollection()->addAction(QStringLiteral("url_navigators"), navigatorsWidgetAction
);
149 m_tabWidget
= new DolphinTabWidget(navigatorsWidgetAction
, this);
150 m_tabWidget
->setObjectName("tabWidget");
151 connect(m_tabWidget
, &DolphinTabWidget::activeViewChanged
,
152 this, &DolphinMainWindow::activeViewChanged
);
153 connect(m_tabWidget
, &DolphinTabWidget::tabCountChanged
,
154 this, &DolphinMainWindow::tabCountChanged
);
155 connect(m_tabWidget
, &DolphinTabWidget::currentUrlChanged
,
156 this, &DolphinMainWindow::updateWindowTitle
);
157 setCentralWidget(m_tabWidget
);
161 m_actionHandler
= new DolphinViewActionHandler(actionCollection(), this);
162 connect(m_actionHandler
, &DolphinViewActionHandler::actionBeingHandled
, this, &DolphinMainWindow::clearStatusBar
);
163 connect(m_actionHandler
, &DolphinViewActionHandler::createDirectoryTriggered
, this, &DolphinMainWindow::createDirectory
);
165 m_remoteEncoding
= new DolphinRemoteEncoding(this, m_actionHandler
);
166 connect(this, &DolphinMainWindow::urlChanged
,
167 m_remoteEncoding
, &DolphinRemoteEncoding::slotAboutToOpenUrl
);
171 setupGUI(Keys
| Save
| Create
| ToolBar
);
172 stateChanged(QStringLiteral("new_file"));
174 QClipboard
* clipboard
= QApplication::clipboard();
175 connect(clipboard
, &QClipboard::dataChanged
,
176 this, &DolphinMainWindow::updatePasteAction
);
178 QAction
* toggleFilterBarAction
= actionCollection()->action(QStringLiteral("toggle_filter"));
179 toggleFilterBarAction
->setChecked(GeneralSettings::filterBar());
182 menuBar()->setVisible(false);
185 const bool showMenu
= !menuBar()->isHidden();
186 QAction
* showMenuBarAction
= actionCollection()->action(KStandardAction::name(KStandardAction::ShowMenubar
));
187 showMenuBarAction
->setChecked(showMenu
); // workaround for bug #171080
189 auto hamburgerMenu
= static_cast<KHamburgerMenu
*>(actionCollection()->action(
190 KStandardAction::name(KStandardAction::HamburgerMenu
)));
191 hamburgerMenu
->setMenuBar(menuBar());
192 hamburgerMenu
->setShowMenuBarAction(showMenuBarAction
);
193 connect(hamburgerMenu
, &KHamburgerMenu::aboutToShowMenu
,
194 this, &DolphinMainWindow::updateHamburgerMenu
);
195 hamburgerMenu
->hideActionsOf(toolBar());
196 if (GeneralSettings::version() < 201 && !toolBar()->actions().contains(hamburgerMenu
)) {
197 addHamburgerMenuToToolbar();
200 updateAllowedToolbarAreas();
202 // enable middle-click on back/forward/up to open in a new tab
203 auto *middleClickEventFilter
= new MiddleClickActionEventFilter(this);
204 connect(middleClickEventFilter
, &MiddleClickActionEventFilter::actionMiddleClicked
, this, &DolphinMainWindow::slotToolBarActionMiddleClicked
);
205 toolBar()->installEventFilter(middleClickEventFilter
);
209 connect(KSycoca::self(), QOverload
<>::of(&KSycoca::databaseChanged
), this, &DolphinMainWindow::updateOpenPreferredSearchToolAction
);
211 QTimer::singleShot(0, this, &DolphinMainWindow::updateOpenPreferredSearchToolAction
);
213 m_fileItemActions
.setParentWidget(this);
214 #if KIO_VERSION >= QT_VERSION_CHECK(5, 82, 0)
215 connect(&m_fileItemActions
, &KFileItemActions::error
, this, [this](const QString
&errorMessage
) {
216 showErrorMessage(errorMessage
);
220 connect(GeneralSettings::self(), &GeneralSettings::splitViewChanged
,
221 this, &DolphinMainWindow::slotSplitViewChanged
);
224 DolphinMainWindow::~DolphinMainWindow()
226 // This fixes a crash on Wayland when closing the mainwindow while another dialog is open.
227 disconnect(QGuiApplication::clipboard(), &QClipboard::dataChanged
, this, &DolphinMainWindow::updatePasteAction
);
230 QVector
<DolphinViewContainer
*> DolphinMainWindow::viewContainers() const
232 QVector
<DolphinViewContainer
*> viewContainers
;
234 for (int i
= 0; i
< m_tabWidget
->count(); ++i
) {
235 DolphinTabPage
*tabPage
= m_tabWidget
->tabPageAt(i
);
237 viewContainers
<< tabPage
->primaryViewContainer();
238 if (tabPage
->splitViewEnabled()) {
239 viewContainers
<< tabPage
->secondaryViewContainer();
242 return viewContainers
;
245 void DolphinMainWindow::openDirectories(const QList
<QUrl
>& dirs
, bool splitView
)
247 m_tabWidget
->openDirectories(dirs
, splitView
);
250 void DolphinMainWindow::openDirectories(const QStringList
& dirs
, bool splitView
)
252 openDirectories(QUrl::fromStringList(dirs
), splitView
);
255 void DolphinMainWindow::openFiles(const QList
<QUrl
>& files
, bool splitView
)
257 m_tabWidget
->openFiles(files
, splitView
);
260 bool DolphinMainWindow::isFoldersPanelEnabled() const
262 return actionCollection()->action(QStringLiteral("show_folders_panel"))->isChecked();
265 bool DolphinMainWindow::isInformationPanelEnabled() const
268 return actionCollection()->action(QStringLiteral("show_information_panel"))->isChecked();
274 void DolphinMainWindow::openFiles(const QStringList
& files
, bool splitView
)
276 openFiles(QUrl::fromStringList(files
), splitView
);
279 void DolphinMainWindow::activateWindow()
281 window()->setAttribute(Qt::WA_NativeWindow
, true);
282 KStartupInfo::setNewStartupId(window()->windowHandle(), KStartupInfo::startupId());
283 KWindowSystem::activateWindow(window()->effectiveWinId());
286 void DolphinMainWindow::showCommand(CommandType command
)
288 DolphinStatusBar
* statusBar
= m_activeViewContainer
->statusBar();
290 case KIO::FileUndoManager::Copy
:
291 statusBar
->setText(i18nc("@info:status", "Successfully copied."));
293 case KIO::FileUndoManager::Move
:
294 statusBar
->setText(i18nc("@info:status", "Successfully moved."));
296 case KIO::FileUndoManager::Link
:
297 statusBar
->setText(i18nc("@info:status", "Successfully linked."));
299 case KIO::FileUndoManager::Trash
:
300 statusBar
->setText(i18nc("@info:status", "Successfully moved to trash."));
302 case KIO::FileUndoManager::Rename
:
303 statusBar
->setText(i18nc("@info:status", "Successfully renamed."));
306 case KIO::FileUndoManager::Mkdir
:
307 statusBar
->setText(i18nc("@info:status", "Created folder."));
315 void DolphinMainWindow::pasteIntoFolder()
317 m_activeViewContainer
->view()->pasteIntoFolder();
320 void DolphinMainWindow::changeUrl(const QUrl
&url
)
322 if (!KProtocolManager::supportsListing(url
)) {
323 // The URL navigator only checks for validity, not
324 // if the URL can be listed. An error message is
325 // shown due to DolphinViewContainer::restoreView().
329 m_activeViewContainer
->setUrl(url
);
330 updateFileAndEditActions();
335 Q_EMIT
urlChanged(url
);
338 void DolphinMainWindow::slotTerminalDirectoryChanged(const QUrl
& url
)
340 if (m_tearDownFromPlacesRequested
&& url
== QUrl::fromLocalFile(QDir::homePath())) {
341 m_placesPanel
->proceedWithTearDown();
342 m_tearDownFromPlacesRequested
= false;
345 m_activeViewContainer
->setAutoGrabFocus(false);
347 m_activeViewContainer
->setAutoGrabFocus(true);
350 void DolphinMainWindow::slotEditableStateChanged(bool editable
)
352 KToggleAction
* editableLocationAction
=
353 static_cast<KToggleAction
*>(actionCollection()->action(QStringLiteral("editable_location")));
354 editableLocationAction
->setChecked(editable
);
357 void DolphinMainWindow::slotSelectionChanged(const KFileItemList
& selection
)
359 updateFileAndEditActions();
361 const int selectedUrlsCount
= m_tabWidget
->currentTabPage()->selectedItemsCount();
363 QAction
* compareFilesAction
= actionCollection()->action(QStringLiteral("compare_files"));
364 if (selectedUrlsCount
== 2) {
365 compareFilesAction
->setEnabled(isKompareInstalled());
367 compareFilesAction
->setEnabled(false);
370 Q_EMIT
selectionChanged(selection
);
373 void DolphinMainWindow::updateHistory()
375 const KUrlNavigator
*urlNavigator
= m_activeViewContainer
->urlNavigatorInternalWithHistory();
376 const int index
= urlNavigator
->historyIndex();
378 QAction
* backAction
= actionCollection()->action(KStandardAction::name(KStandardAction::Back
));
380 backAction
->setToolTip(i18nc("@info", "Go back"));
381 backAction
->setWhatsThis(i18nc("@info:whatsthis go back", "Return to the previously viewed folder."));
382 backAction
->setEnabled(index
< urlNavigator
->historySize() - 1);
385 QAction
* forwardAction
= actionCollection()->action(KStandardAction::name(KStandardAction::Forward
));
387 forwardAction
->setToolTip(i18nc("@info", "Go forward"));
388 forwardAction
->setWhatsThis(xi18nc("@info:whatsthis go forward",
389 "This undoes a <interface>Go|Back</interface> action."));
390 forwardAction
->setEnabled(index
> 0);
394 void DolphinMainWindow::updateFilterBarAction(bool show
)
396 QAction
* toggleFilterBarAction
= actionCollection()->action(QStringLiteral("toggle_filter"));
397 toggleFilterBarAction
->setChecked(show
);
400 void DolphinMainWindow::openNewMainWindow()
402 Dolphin::openNewWindow({m_activeViewContainer
->url()}, this);
405 void DolphinMainWindow::openNewActivatedTab()
407 // keep browsers compatibility, new tab is always after last one
408 auto openNewTabAfterLastTabConfigured
= GeneralSettings::openNewTabAfterLastTab();
409 GeneralSettings::setOpenNewTabAfterLastTab(true);
410 m_tabWidget
->openNewActivatedTab();
411 GeneralSettings::setOpenNewTabAfterLastTab(openNewTabAfterLastTabConfigured
);
414 void DolphinMainWindow::addToPlaces()
419 // If nothing is selected, act on the current dir
420 if (m_activeViewContainer
->view()->selectedItems().isEmpty()) {
421 url
= m_activeViewContainer
->url();
422 name
= m_activeViewContainer
->placesText();
424 const auto dirToAdd
= m_activeViewContainer
->view()->selectedItems().first();
425 url
= dirToAdd
.url();
426 name
= dirToAdd
.name();
429 PlacesItemModel model
;
431 if (m_activeViewContainer
->isSearchModeEnabled()) {
432 icon
= QStringLiteral("folder-saved-search-symbolic");
434 icon
= KIO::iconNameForUrl(url
);
436 model
.createPlacesItem(name
, url
, icon
);
440 void DolphinMainWindow::openNewTab(const QUrl
& url
)
442 m_tabWidget
->openNewTab(url
, QUrl());
445 void DolphinMainWindow::slotSplitViewChanged()
447 m_tabWidget
->currentTabPage()->setSplitViewEnabled(GeneralSettings::splitView(), WithAnimation
);
451 void DolphinMainWindow::openInNewTab()
453 const KFileItemList
& list
= m_activeViewContainer
->view()->selectedItems();
454 bool tabCreated
= false;
456 for (const KFileItem
& item
: list
) {
457 const QUrl
& url
= DolphinView::openItemAsFolderUrl(item
);
458 if (!url
.isEmpty()) {
464 // if no new tab has been created from the selection
465 // open the current directory in a new tab
467 openNewTab(m_activeViewContainer
->url());
471 void DolphinMainWindow::openInNewWindow()
475 const KFileItemList list
= m_activeViewContainer
->view()->selectedItems();
476 if (list
.isEmpty()) {
477 newWindowUrl
= m_activeViewContainer
->url();
478 } else if (list
.count() == 1) {
479 const KFileItem
& item
= list
.first();
480 newWindowUrl
= DolphinView::openItemAsFolderUrl(item
);
483 if (!newWindowUrl
.isEmpty()) {
484 Dolphin::openNewWindow({newWindowUrl
}, this);
488 void DolphinMainWindow::showTarget()
490 const auto link
= m_activeViewContainer
->view()->selectedItems().at(0);
491 const auto linkLocationDir
= QFileInfo(link
.localPath()).absoluteDir();
492 auto linkDestination
= link
.linkDest();
493 if (QFileInfo(linkDestination
).isRelative()) {
494 linkDestination
= linkLocationDir
.filePath(linkDestination
);
496 if (QFileInfo::exists(linkDestination
)) {
497 KIO::highlightInFileManager({QUrl::fromLocalFile(linkDestination
).adjusted(QUrl::StripTrailingSlash
)});
499 m_activeViewContainer
->showMessage(xi18nc("@info", "Could not access <filename>%1</filename>.", linkDestination
),
500 DolphinViewContainer::Warning
);
504 void DolphinMainWindow::showEvent(QShowEvent
* event
)
506 KXmlGuiWindow::showEvent(event
);
508 if (!event
->spontaneous()) {
509 m_activeViewContainer
->view()->setFocus();
513 void DolphinMainWindow::closeEvent(QCloseEvent
* event
)
515 // Find out if Dolphin is closed directly by the user or
516 // by the session manager because the session is closed
517 bool closedByUser
= true;
518 if (qApp
->isSavingSession()) {
519 closedByUser
= false;
522 if (m_tabWidget
->count() > 1
523 && GeneralSettings::confirmClosingMultipleTabs()
524 && !GeneralSettings::rememberOpenedTabs()
526 // Ask the user if he really wants to quit and close all tabs.
527 // Open a confirmation dialog with 3 buttons:
528 // QDialogButtonBox::Yes -> Quit
529 // QDialogButtonBox::No -> Close only the current tab
530 // QDialogButtonBox::Cancel -> do nothing
531 QDialog
*dialog
= new QDialog(this, Qt::Dialog
);
532 dialog
->setWindowTitle(i18nc("@title:window", "Confirmation"));
533 dialog
->setModal(true);
534 QDialogButtonBox
* buttons
= new QDialogButtonBox(QDialogButtonBox::Yes
| QDialogButtonBox::No
| QDialogButtonBox::Cancel
);
535 KGuiItem::assign(buttons
->button(QDialogButtonBox::Yes
), KGuiItem(i18nc("@action:button 'Quit Dolphin' button", "&Quit %1", QGuiApplication::applicationDisplayName()), QIcon::fromTheme(QStringLiteral("application-exit"))));
536 KGuiItem::assign(buttons
->button(QDialogButtonBox::No
), KGuiItem(i18n("C&lose Current Tab"), QIcon::fromTheme(QStringLiteral("tab-close"))));
537 KGuiItem::assign(buttons
->button(QDialogButtonBox::Cancel
), KStandardGuiItem::cancel());
538 buttons
->button(QDialogButtonBox::Yes
)->setDefault(true);
540 bool doNotAskAgainCheckboxResult
= false;
542 const auto result
= KMessageBox::createKMessageBox(dialog
,
544 QMessageBox::Warning
,
545 i18n("You have multiple tabs open in this window, are you sure you want to quit?"),
547 i18n("Do not ask again"),
548 &doNotAskAgainCheckboxResult
,
549 KMessageBox::Notify
);
551 if (doNotAskAgainCheckboxResult
) {
552 GeneralSettings::setConfirmClosingMultipleTabs(false);
556 case QDialogButtonBox::Yes
:
559 case QDialogButtonBox::No
:
560 // Close only the current tab
561 m_tabWidget
->closeTab();
569 if (m_terminalPanel
&& m_terminalPanel
->hasProgramRunning() && GeneralSettings::confirmClosingTerminalRunningProgram() && closedByUser
) {
570 // Ask if the user really wants to quit Dolphin with a program that is still running in the Terminal panel
571 // Open a confirmation dialog with 3 buttons:
572 // QDialogButtonBox::Yes -> Quit
573 // QDialogButtonBox::No -> Show Terminal Panel
574 // QDialogButtonBox::Cancel -> do nothing
575 QDialog
*dialog
= new QDialog(this, Qt::Dialog
);
576 dialog
->setWindowTitle(i18nc("@title:window", "Confirmation"));
577 dialog
->setModal(true);
578 auto standardButtons
= QDialogButtonBox::Yes
| QDialogButtonBox::Cancel
;
579 if (!m_terminalPanel
->isVisible()) {
580 standardButtons
|= QDialogButtonBox::No
;
582 QDialogButtonBox
*buttons
= new QDialogButtonBox(standardButtons
);
583 KGuiItem::assign(buttons
->button(QDialogButtonBox::Yes
), KStandardGuiItem::quit());
584 if (!m_terminalPanel
->isVisible()) {
586 buttons
->button(QDialogButtonBox::No
),
587 KGuiItem(i18n("Show &Terminal Panel"), QIcon::fromTheme(QStringLiteral("dialog-scripts"))));
589 KGuiItem::assign(buttons
->button(QDialogButtonBox::Cancel
), KStandardGuiItem::cancel());
591 bool doNotAskAgainCheckboxResult
= false;
593 const auto result
= KMessageBox::createKMessageBox(
596 QMessageBox::Warning
,
597 i18n("The program '%1' is still running in the Terminal panel. Are you sure you want to quit?", m_terminalPanel
->runningProgramName()),
599 i18n("Do not ask again"),
600 &doNotAskAgainCheckboxResult
,
601 KMessageBox::Dangerous
);
603 if (doNotAskAgainCheckboxResult
) {
604 GeneralSettings::setConfirmClosingTerminalRunningProgram(false);
608 case QDialogButtonBox::Yes
:
611 case QDialogButtonBox::No
:
612 actionCollection()->action("show_terminal_panel")->trigger();
613 // Do not quit, ignore quit event
621 if (GeneralSettings::rememberOpenedTabs()) {
622 KConfigGui::setSessionConfig(QStringLiteral("dolphin"), QStringLiteral("dolphin"));
623 KConfig
*config
= KConfigGui::sessionConfig();
624 saveGlobalProperties(config
);
625 savePropertiesInternal(config
, 1);
629 GeneralSettings::setVersion(CurrentDolphinVersion
);
630 GeneralSettings::self()->save();
632 KXmlGuiWindow::closeEvent(event
);
635 void DolphinMainWindow::saveProperties(KConfigGroup
& group
)
637 m_tabWidget
->saveProperties(group
);
640 void DolphinMainWindow::readProperties(const KConfigGroup
& group
)
642 m_tabWidget
->readProperties(group
);
645 void DolphinMainWindow::updateNewMenu()
647 m_newFileMenu
->setViewShowsHiddenFiles(activeViewContainer()->view()->hiddenFilesShown());
648 m_newFileMenu
->checkUpToDate();
649 m_newFileMenu
->setPopupFiles(QList
<QUrl
>() << activeViewContainer()->url());
652 void DolphinMainWindow::createDirectory()
654 m_newFileMenu
->setViewShowsHiddenFiles(activeViewContainer()->view()->hiddenFilesShown());
655 m_newFileMenu
->setPopupFiles(QList
<QUrl
>() << activeViewContainer()->url());
656 m_newFileMenu
->createDirectory();
659 void DolphinMainWindow::quit()
664 void DolphinMainWindow::showErrorMessage(const QString
& message
)
666 m_activeViewContainer
->showMessage(message
, DolphinViewContainer::Error
);
669 void DolphinMainWindow::slotUndoAvailable(bool available
)
671 QAction
* undoAction
= actionCollection()->action(KStandardAction::name(KStandardAction::Undo
));
673 undoAction
->setEnabled(available
);
677 void DolphinMainWindow::slotUndoTextChanged(const QString
& text
)
679 QAction
* undoAction
= actionCollection()->action(KStandardAction::name(KStandardAction::Undo
));
681 undoAction
->setText(text
);
685 void DolphinMainWindow::undo()
688 KIO::FileUndoManager::self()->uiInterface()->setParentWidget(this);
689 KIO::FileUndoManager::self()->undo();
692 void DolphinMainWindow::cut()
694 m_activeViewContainer
->view()->cutSelectedItemsToClipboard();
697 void DolphinMainWindow::copy()
699 m_activeViewContainer
->view()->copySelectedItemsToClipboard();
702 void DolphinMainWindow::paste()
704 m_activeViewContainer
->view()->paste();
707 void DolphinMainWindow::find()
709 m_activeViewContainer
->setSearchModeEnabled(true);
712 void DolphinMainWindow::updateSearchAction()
714 QAction
* toggleSearchAction
= actionCollection()->action(QStringLiteral("toggle_search"));
715 toggleSearchAction
->setChecked(m_activeViewContainer
->isSearchModeEnabled());
718 void DolphinMainWindow::updatePasteAction()
720 QAction
* pasteAction
= actionCollection()->action(KStandardAction::name(KStandardAction::Paste
));
721 QPair
<bool, QString
> pasteInfo
= m_activeViewContainer
->view()->pasteInfo();
722 pasteAction
->setEnabled(pasteInfo
.first
);
723 pasteAction
->setText(pasteInfo
.second
);
726 void DolphinMainWindow::slotDirectoryLoadingCompleted()
731 void DolphinMainWindow::slotToolBarActionMiddleClicked(QAction
*action
)
733 if (action
== actionCollection()->action(KStandardAction::name(KStandardAction::Back
))) {
735 } else if (action
== actionCollection()->action(KStandardAction::name(KStandardAction::Forward
))) {
737 } else if (action
== actionCollection()->action(QStringLiteral("go_up"))) {
739 } else if (action
== actionCollection()->action(QStringLiteral("go_home"))) {
744 void DolphinMainWindow::slotAboutToShowBackPopupMenu()
746 const KUrlNavigator
*urlNavigator
= m_activeViewContainer
->urlNavigatorInternalWithHistory();
748 m_backAction
->menu()->clear();
749 for (int i
= urlNavigator
->historyIndex() + 1; i
< urlNavigator
->historySize() && entries
< MaxNumberOfNavigationentries
; ++i
, ++entries
) {
750 QAction
* action
= new QAction(urlNavigator
->locationUrl(i
).toString(QUrl::PreferLocalFile
), m_backAction
->menu());
752 m_backAction
->menu()->addAction(action
);
756 void DolphinMainWindow::slotGoBack(QAction
* action
)
758 int gotoIndex
= action
->data().value
<int>();
759 const KUrlNavigator
*urlNavigator
= m_activeViewContainer
->urlNavigatorInternalWithHistory();
760 for (int i
= gotoIndex
- urlNavigator
->historyIndex(); i
> 0; --i
) {
765 void DolphinMainWindow::slotBackForwardActionMiddleClicked(QAction
* action
)
768 const KUrlNavigator
*urlNavigator
= activeViewContainer()->urlNavigatorInternalWithHistory();
769 openNewTab(urlNavigator
->locationUrl(action
->data().value
<int>()));
773 void DolphinMainWindow::slotAboutToShowForwardPopupMenu()
775 const KUrlNavigator
*urlNavigator
= m_activeViewContainer
->urlNavigatorInternalWithHistory();
777 m_forwardAction
->menu()->clear();
778 for (int i
= urlNavigator
->historyIndex() - 1; i
>= 0 && entries
< MaxNumberOfNavigationentries
; --i
, ++entries
) {
779 QAction
* action
= new QAction(urlNavigator
->locationUrl(i
).toString(QUrl::PreferLocalFile
), m_forwardAction
->menu());
781 m_forwardAction
->menu()->addAction(action
);
785 void DolphinMainWindow::slotGoForward(QAction
* action
)
787 int gotoIndex
= action
->data().value
<int>();
788 const KUrlNavigator
*urlNavigator
= m_activeViewContainer
->urlNavigatorInternalWithHistory();
789 for (int i
= urlNavigator
->historyIndex() - gotoIndex
; i
> 0; --i
) {
794 void DolphinMainWindow::selectAll()
798 // if the URL navigator is editable and focused, select the whole
799 // URL instead of all items of the view
801 KUrlNavigator
* urlNavigator
= m_activeViewContainer
->urlNavigator();
802 QLineEdit
* lineEdit
= urlNavigator
->editor()->lineEdit();
803 const bool selectUrl
= urlNavigator
->isUrlEditable() &&
804 lineEdit
->hasFocus();
806 lineEdit
->selectAll();
808 m_activeViewContainer
->view()->selectAll();
812 void DolphinMainWindow::invertSelection()
815 m_activeViewContainer
->view()->invertSelection();
818 void DolphinMainWindow::toggleSplitView()
820 DolphinTabPage
* tabPage
= m_tabWidget
->currentTabPage();
821 tabPage
->setSplitViewEnabled(!tabPage
->splitViewEnabled(), WithAnimation
);
826 void DolphinMainWindow::toggleSplitStash()
828 DolphinTabPage
* tabPage
= m_tabWidget
->currentTabPage();
829 tabPage
->setSplitViewEnabled(false, WithAnimation
);
830 tabPage
->setSplitViewEnabled(true, WithAnimation
, QUrl("stash:/"));
833 void DolphinMainWindow::reloadView()
836 m_activeViewContainer
->reload();
837 m_activeViewContainer
->statusBar()->updateSpaceInfo();
840 void DolphinMainWindow::stopLoading()
842 m_activeViewContainer
->view()->stopLoading();
845 void DolphinMainWindow::enableStopAction()
847 actionCollection()->action(QStringLiteral("stop"))->setEnabled(true);
850 void DolphinMainWindow::disableStopAction()
852 actionCollection()->action(QStringLiteral("stop"))->setEnabled(false);
855 void DolphinMainWindow::showFilterBar()
857 m_activeViewContainer
->setFilterBarVisible(true);
860 void DolphinMainWindow::toggleFilterBar()
862 const bool checked
= !m_activeViewContainer
->isFilterBarVisible();
863 m_activeViewContainer
->setFilterBarVisible(checked
);
865 QAction
* toggleFilterBarAction
= actionCollection()->action(QStringLiteral("toggle_filter"));
866 toggleFilterBarAction
->setChecked(checked
);
869 void DolphinMainWindow::toggleEditLocation()
873 QAction
* action
= actionCollection()->action(QStringLiteral("editable_location"));
874 KUrlNavigator
* urlNavigator
= m_activeViewContainer
->urlNavigator();
875 urlNavigator
->setUrlEditable(action
->isChecked());
878 void DolphinMainWindow::replaceLocation()
880 KUrlNavigator
* navigator
= m_activeViewContainer
->urlNavigator();
881 QLineEdit
* lineEdit
= navigator
->editor()->lineEdit();
883 // If the text field currently has focus and everything is selected,
884 // pressing the keyboard shortcut returns the whole thing to breadcrumb mode
885 if (navigator
->isUrlEditable()
886 && lineEdit
->hasFocus()
887 && lineEdit
->selectedText() == lineEdit
->text() ) {
888 navigator
->setUrlEditable(false);
890 navigator
->setUrlEditable(true);
891 navigator
->setFocus();
892 lineEdit
->selectAll();
896 void DolphinMainWindow::togglePanelLockState()
898 const bool newLockState
= !GeneralSettings::lockPanels();
899 const auto childrenObjects
= children();
900 for (QObject
* child
: childrenObjects
) {
901 DolphinDockWidget
* dock
= qobject_cast
<DolphinDockWidget
*>(child
);
903 dock
->setLocked(newLockState
);
907 GeneralSettings::setLockPanels(newLockState
);
910 void DolphinMainWindow::slotTerminalPanelVisibilityChanged()
912 if (m_terminalPanel
->isHiddenInVisibleWindow() && m_activeViewContainer
) {
913 m_activeViewContainer
->view()->setFocus();
917 void DolphinMainWindow::goBack()
919 DolphinUrlNavigator
*urlNavigator
= m_activeViewContainer
->urlNavigatorInternalWithHistory();
920 urlNavigator
->goBack();
922 if (urlNavigator
->locationState().isEmpty()) {
923 // An empty location state indicates a redirection URL,
924 // which must be skipped too
925 urlNavigator
->goBack();
929 void DolphinMainWindow::goForward()
931 m_activeViewContainer
->urlNavigatorInternalWithHistory()->goForward();
934 void DolphinMainWindow::goUp()
936 m_activeViewContainer
->urlNavigatorInternalWithHistory()->goUp();
939 void DolphinMainWindow::goHome()
941 m_activeViewContainer
->urlNavigatorInternalWithHistory()->goHome();
944 void DolphinMainWindow::goBackInNewTab()
946 const KUrlNavigator
* urlNavigator
= activeViewContainer()->urlNavigatorInternalWithHistory();
947 const int index
= urlNavigator
->historyIndex() + 1;
948 openNewTab(urlNavigator
->locationUrl(index
));
951 void DolphinMainWindow::goForwardInNewTab()
953 const KUrlNavigator
* urlNavigator
= activeViewContainer()->urlNavigatorInternalWithHistory();
954 const int index
= urlNavigator
->historyIndex() - 1;
955 openNewTab(urlNavigator
->locationUrl(index
));
958 void DolphinMainWindow::goUpInNewTab()
960 const QUrl currentUrl
= activeViewContainer()->urlNavigator()->locationUrl();
961 openNewTab(KIO::upUrl(currentUrl
));
964 void DolphinMainWindow::goHomeInNewTab()
966 openNewTab(Dolphin::homeUrl());
969 void DolphinMainWindow::compareFiles()
971 const KFileItemList items
= m_tabWidget
->currentTabPage()->selectedItems();
972 if (items
.count() != 2) {
973 // The action is disabled in this case, but it could have been triggered
974 // via D-Bus, see https://bugs.kde.org/show_bug.cgi?id=325517
978 QUrl urlA
= items
.at(0).url();
979 QUrl urlB
= items
.at(1).url();
981 QString
command(QStringLiteral("kompare -c \""));
982 command
.append(urlA
.toDisplayString(QUrl::PreferLocalFile
));
983 command
.append("\" \"");
984 command
.append(urlB
.toDisplayString(QUrl::PreferLocalFile
));
985 command
.append('\"');
987 KIO::CommandLauncherJob
*job
= new KIO::CommandLauncherJob(command
, this);
988 job
->setDesktopName(QStringLiteral("org.kde.kompare"));
992 void DolphinMainWindow::toggleShowMenuBar()
994 const bool visible
= menuBar()->isVisible();
995 menuBar()->setVisible(!visible
);
998 QPointer
<QAction
> DolphinMainWindow::preferredSearchTool()
1000 m_searchTools
.clear();
1001 KMoreToolsMenuFactory("dolphin/search-tools").fillMenuFromGroupingNames(
1002 &m_searchTools
, { "files-find" }, m_activeViewContainer
->url()
1004 QList
<QAction
*> actions
= m_searchTools
.actions();
1005 if (actions
.isEmpty()) {
1008 QAction
* action
= actions
.first();
1009 if (action
->isSeparator()) {
1015 void DolphinMainWindow::updateOpenPreferredSearchToolAction()
1017 QAction
* openPreferredSearchTool
= actionCollection()->action(QStringLiteral("open_preferred_search_tool"));
1018 if (!openPreferredSearchTool
) {
1021 QPointer
<QAction
> tool
= preferredSearchTool();
1023 openPreferredSearchTool
->setVisible(true);
1024 openPreferredSearchTool
->setText(i18nc("@action:inmenu Tools", "Open %1", tool
->text()));
1025 // Only override with the app icon if it is the default, i.e. the user hasn't configured one manually
1026 // https://bugs.kde.org/show_bug.cgi?id=442815
1027 if (openPreferredSearchTool
->icon().name() == QLatin1String("search")) {
1028 openPreferredSearchTool
->setIcon(tool
->icon());
1031 openPreferredSearchTool
->setVisible(false);
1032 // still visible in Shortcuts configuration window
1033 openPreferredSearchTool
->setText(i18nc("@action:inmenu Tools", "Open Preferred Search Tool"));
1034 openPreferredSearchTool
->setIcon(QIcon::fromTheme(QStringLiteral("search")));
1038 void DolphinMainWindow::openPreferredSearchTool()
1040 QPointer
<QAction
> tool
= preferredSearchTool();
1046 void DolphinMainWindow::openTerminal()
1048 const QUrl url
= m_activeViewContainer
->url();
1050 if (url
.isLocalFile()) {
1051 KToolInvocation::invokeTerminal(QString(), {}, url
.toLocalFile());
1055 // Not a local file, with protocol Class ":local", try stat'ing
1056 if (KProtocolInfo::protocolClass(url
.scheme()) == QLatin1String(":local")) {
1057 KIO::StatJob
*job
= KIO::mostLocalUrl(url
);
1058 KJobWidgets::setWindow(job
, this);
1059 connect(job
, &KJob::result
, this, [job
]() {
1061 if (!job
->error()) {
1062 statUrl
= job
->mostLocalUrl();
1065 KToolInvocation::invokeTerminal(QString(), {}, statUrl
.isLocalFile() ? statUrl
.toLocalFile() : QDir::homePath());
1071 // Nothing worked, just use $HOME
1072 KToolInvocation::invokeTerminal(QString(), {}, QDir::homePath());
1075 void DolphinMainWindow::editSettings()
1077 if (!m_settingsDialog
) {
1078 DolphinViewContainer
* container
= activeViewContainer();
1079 container
->view()->writeSettings();
1081 const QUrl url
= container
->url();
1082 DolphinSettingsDialog
* settingsDialog
= new DolphinSettingsDialog(url
, this, actionCollection());
1083 connect(settingsDialog
, &DolphinSettingsDialog::settingsChanged
, this, &DolphinMainWindow::refreshViews
);
1084 connect(settingsDialog
, &DolphinSettingsDialog::settingsChanged
,
1085 &DolphinUrlNavigatorsController::slotReadSettings
);
1086 settingsDialog
->setAttribute(Qt::WA_DeleteOnClose
);
1087 settingsDialog
->show();
1088 m_settingsDialog
= settingsDialog
;
1090 m_settingsDialog
.data()->raise();
1094 void DolphinMainWindow::handleUrl(const QUrl
& url
)
1096 delete m_lastHandleUrlOpenJob
;
1097 m_lastHandleUrlOpenJob
= nullptr;
1099 if (url
.isLocalFile() && QFileInfo(url
.toLocalFile()).isDir()) {
1100 activeViewContainer()->setUrl(url
);
1102 m_lastHandleUrlOpenJob
= new KIO::OpenUrlJob(url
);
1103 m_lastHandleUrlOpenJob
->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled
, this));
1104 m_lastHandleUrlOpenJob
->setShowOpenOrExecuteDialog(true);
1106 connect(m_lastHandleUrlOpenJob
, &KIO::OpenUrlJob::mimeTypeFound
, this,
1107 [this, url
](const QString
&mimetype
) {
1108 if (mimetype
== QLatin1String("inode/directory")) {
1109 // If it's a dir, we'll take it from here
1110 m_lastHandleUrlOpenJob
->kill();
1111 m_lastHandleUrlOpenJob
= nullptr;
1112 activeViewContainer()->setUrl(url
);
1116 connect(m_lastHandleUrlOpenJob
, &KIO::OpenUrlJob::result
, this, [this]() {
1117 m_lastHandleUrlOpenJob
= nullptr;
1120 m_lastHandleUrlOpenJob
->start();
1124 void DolphinMainWindow::slotWriteStateChanged(bool isFolderWritable
)
1126 // trash:/ is writable but we don't want to create new items in it.
1127 // TODO: remove the trash check once https://phabricator.kde.org/T8234 is implemented
1128 newFileMenu()->setEnabled(isFolderWritable
&& m_activeViewContainer
->url().scheme() != QLatin1String("trash"));
1131 void DolphinMainWindow::openContextMenu(const QPoint
& pos
,
1132 const KFileItem
& item
,
1134 const QList
<QAction
*>& customActions
)
1136 QPointer
<DolphinContextMenu
> contextMenu
= new DolphinContextMenu(this, pos
, item
, url
, &m_fileItemActions
);
1137 contextMenu
.data()->setCustomActions(customActions
);
1138 const DolphinContextMenu::Command command
= contextMenu
.data()->open();
1141 case DolphinContextMenu::OpenParentFolder
:
1142 changeUrl(KIO::upUrl(item
.url()));
1143 m_activeViewContainer
->view()->markUrlsAsSelected({item
.url()});
1144 m_activeViewContainer
->view()->markUrlAsCurrent(item
.url());
1147 case DolphinContextMenu::OpenParentFolderInNewWindow
:
1148 Dolphin::openNewWindow({item
.url()}, this, Dolphin::OpenNewWindowFlag::Select
);
1151 case DolphinContextMenu::OpenParentFolderInNewTab
:
1152 openNewTab(KIO::upUrl(item
.url()));
1155 case DolphinContextMenu::None
:
1160 // Delete the menu, unless it has been deleted in its own nested event loop already.
1162 contextMenu
->deleteLater();
1166 void DolphinMainWindow::updateHamburgerMenu()
1168 KActionCollection
* ac
= actionCollection();
1169 auto hamburgerMenu
= static_cast<KHamburgerMenu
*>(
1170 ac
->action(KStandardAction::name(KStandardAction::HamburgerMenu
)));
1171 auto menu
= hamburgerMenu
->menu();
1173 menu
= new QMenu(this);
1174 hamburgerMenu
->setMenu(menu
);
1175 hamburgerMenu
->hideActionsOf(ac
->action(QStringLiteral("basic_actions"))->menu());
1176 hamburgerMenu
->hideActionsOf(ac
->action(QStringLiteral("zoom"))->menu());
1180 const QList
<QAction
*> toolbarActions
= toolBar()->actions();
1182 if (!toolBar()->isVisible()) {
1183 // If neither the menu bar nor the toolbar are visible, these actions should be available.
1184 menu
->addAction(ac
->action(KStandardAction::name(KStandardAction::ShowMenubar
)));
1185 menu
->addAction(toolBarMenuAction());
1186 menu
->addSeparator();
1189 // This group of actions (until the next separator) contains all the most basic actions
1190 // necessary to use Dolphin effectively.
1191 menu
->addAction(ac
->action(QStringLiteral("go_back")));
1192 menu
->addAction(ac
->action(QStringLiteral("go_forward")));
1194 menu
->addMenu(m_newFileMenu
->menu());
1195 menu
->addAction(ac
->action(QStringLiteral("basic_actions")));
1196 menu
->addAction(ac
->action(KStandardAction::name(KStandardAction::Undo
)));
1197 if (!toolBar()->isVisible()
1198 || (!toolbarActions
.contains(ac
->action(QStringLiteral("toggle_search")))
1199 && !toolbarActions
.contains(ac
->action(QStringLiteral("open_preferred_search_tool"))))
1201 menu
->addAction(ac
->action(KStandardAction::name(KStandardAction::Find
)));
1202 // This way a search action will only be added if none of the three available
1203 // search actions is present on the toolbar.
1205 if (!toolBar()->isVisible()
1206 || !toolbarActions
.contains(ac
->action(QStringLiteral("toggle_filter")))
1208 menu
->addAction(ac
->action(QStringLiteral("show_filter_bar")));
1209 // This way a filter action will only be added if none of the two available
1210 // filter actions is present on the toolbar.
1212 menu
->addSeparator();
1214 // The second group of actions (up until the next separator) contains actions for opening
1215 // additional views to interact with the file system.
1216 menu
->addAction(ac
->action(QStringLiteral("file_new")));
1217 menu
->addAction(ac
->action(QStringLiteral("new_tab")));
1218 if (ac
->action(QStringLiteral("undo_close_tab"))->isEnabled()) {
1219 menu
->addAction(ac
->action(QStringLiteral("closed_tabs")));
1221 menu
->addAction(ac
->action(QStringLiteral("open_terminal")));
1222 menu
->addSeparator();
1224 // The third group contains actions to change what one sees in the view
1225 // and to change the more general UI.
1226 if (!toolBar()->isVisible()
1227 || (!toolbarActions
.contains(ac
->action(QStringLiteral("icons")))
1228 && !toolbarActions
.contains(ac
->action(QStringLiteral("compact")))
1229 && !toolbarActions
.contains(ac
->action(QStringLiteral("details")))
1230 && !toolbarActions
.contains(ac
->action(QStringLiteral("view_mode"))))
1232 menu
->addAction(ac
->action(QStringLiteral("view_mode")));
1234 menu
->addAction(ac
->action(QStringLiteral("show_hidden_files")));
1235 menu
->addAction(ac
->action(QStringLiteral("sort")));
1236 menu
->addAction(ac
->action(QStringLiteral("additional_info")));
1237 if (!GeneralSettings::showStatusBar() || !GeneralSettings::showZoomSlider()) {
1238 menu
->addAction(ac
->action(QStringLiteral("zoom")));
1240 menu
->addAction(ac
->action(QStringLiteral("panels")));
1242 // The "Configure" menu is not added to the actionCollection() because there is hardly
1243 // a good reason for users to put it on their toolbar.
1244 auto configureMenu
= menu
->addMenu(QIcon::fromTheme(QStringLiteral("configure")),
1245 i18nc("@action:inmenu menu for configure actions", "Configure"));
1246 configureMenu
->addAction(ac
->action(KStandardAction::name(KStandardAction::SwitchApplicationLanguage
)));
1247 configureMenu
->addAction(ac
->action(KStandardAction::name(KStandardAction::KeyBindings
)));
1248 configureMenu
->addAction(ac
->action(KStandardAction::name(KStandardAction::ConfigureToolbars
)));
1249 configureMenu
->addAction(ac
->action(KStandardAction::name(KStandardAction::Preferences
)));
1250 hamburgerMenu
->hideActionsOf(configureMenu
);
1253 void DolphinMainWindow::slotPlaceActivated(const QUrl
& url
)
1255 DolphinViewContainer
* view
= activeViewContainer();
1257 if (view
->url() == url
) {
1258 // We can end up here if the user clicked a device in the Places Panel
1259 // which had been unmounted earlier, see https://bugs.kde.org/show_bug.cgi?id=161385.
1262 view
->disableUrlNavigatorSelectionRequests();
1264 view
->enableUrlNavigatorSelectionRequests();
1268 void DolphinMainWindow::closedTabsCountChanged(unsigned int count
)
1270 actionCollection()->action(QStringLiteral("undo_close_tab"))->setEnabled(count
> 0);
1273 void DolphinMainWindow::activeViewChanged(DolphinViewContainer
* viewContainer
)
1275 DolphinViewContainer
* oldViewContainer
= m_activeViewContainer
;
1276 Q_ASSERT(viewContainer
);
1278 m_activeViewContainer
= viewContainer
;
1280 if (oldViewContainer
) {
1281 const QAction
* toggleSearchAction
= actionCollection()->action(QStringLiteral("toggle_search"));
1282 toggleSearchAction
->disconnect(oldViewContainer
);
1284 // Disconnect all signals between the old view container (container,
1285 // view and url navigator) and main window.
1286 oldViewContainer
->disconnect(this);
1287 oldViewContainer
->view()->disconnect(this);
1288 oldViewContainer
->urlNavigatorInternalWithHistory()->disconnect(this);
1289 auto navigators
= static_cast<DolphinNavigatorsWidgetAction
*>
1290 (actionCollection()->action(QStringLiteral("url_navigators")));
1291 navigators
->primaryUrlNavigator()->disconnect(this);
1292 if (auto secondaryUrlNavigator
= navigators
->secondaryUrlNavigator()) {
1293 secondaryUrlNavigator
->disconnect(this);
1296 // except the requestItemInfo so that on hover the information panel can still be updated
1297 connect(oldViewContainer
->view(), &DolphinView::requestItemInfo
,
1298 this, &DolphinMainWindow::requestItemInfo
);
1301 connectViewSignals(viewContainer
);
1303 m_actionHandler
->setCurrentView(viewContainer
->view());
1306 updateFileAndEditActions();
1307 updatePasteAction();
1308 updateViewActions();
1310 updateSearchAction();
1312 const QUrl url
= viewContainer
->url();
1313 Q_EMIT
urlChanged(url
);
1316 void DolphinMainWindow::tabCountChanged(int count
)
1318 const bool enableTabActions
= (count
> 1);
1319 for (int i
= 0; i
< MaxActivateTabShortcuts
; ++i
) {
1320 actionCollection()->action(QStringLiteral("activate_tab_%1").arg(i
))->setEnabled(enableTabActions
);
1322 actionCollection()->action(QStringLiteral("activate_last_tab"))->setEnabled(enableTabActions
);
1323 actionCollection()->action(QStringLiteral("activate_next_tab"))->setEnabled(enableTabActions
);
1324 actionCollection()->action(QStringLiteral("activate_prev_tab"))->setEnabled(enableTabActions
);
1327 void DolphinMainWindow::updateWindowTitle()
1329 const QString newTitle
= m_activeViewContainer
->captionWindowTitle();
1330 if (windowTitle() != newTitle
) {
1331 setWindowTitle(newTitle
);
1335 void DolphinMainWindow::slotStorageTearDownFromPlacesRequested(const QString
& mountPath
)
1337 connect(m_placesPanel
, &PlacesPanel::storageTearDownSuccessful
, this, [this, mountPath
]() {
1338 setViewsToHomeIfMountPathOpen(mountPath
);
1341 if (m_terminalPanel
&& m_terminalPanel
->currentWorkingDirectory().startsWith(mountPath
)) {
1342 m_tearDownFromPlacesRequested
= true;
1343 m_terminalPanel
->goHome();
1344 // m_placesPanel->proceedWithTearDown() will be called in slotTerminalDirectoryChanged
1346 m_placesPanel
->proceedWithTearDown();
1350 void DolphinMainWindow::slotStorageTearDownExternallyRequested(const QString
& mountPath
)
1352 connect(m_placesPanel
, &PlacesPanel::storageTearDownSuccessful
, this, [this, mountPath
]() {
1353 setViewsToHomeIfMountPathOpen(mountPath
);
1356 if (m_terminalPanel
&& m_terminalPanel
->currentWorkingDirectory().startsWith(mountPath
)) {
1357 m_tearDownFromPlacesRequested
= false;
1358 m_terminalPanel
->goHome();
1362 void DolphinMainWindow::setViewsToHomeIfMountPathOpen(const QString
& mountPath
)
1364 const QVector
<DolphinViewContainer
*> theViewContainers
= viewContainers();
1365 for (DolphinViewContainer
*viewContainer
: theViewContainers
) {
1366 if (viewContainer
&& viewContainer
->url().toLocalFile().startsWith(mountPath
)) {
1367 viewContainer
->setUrl(QUrl::fromLocalFile(QDir::homePath()));
1370 disconnect(m_placesPanel
, &PlacesPanel::storageTearDownSuccessful
, nullptr, nullptr);
1373 void DolphinMainWindow::setupActions()
1375 KStandardAction::hamburgerMenu(nullptr, nullptr, actionCollection());
1377 // setup 'File' menu
1378 m_newFileMenu
= new DolphinNewFileMenu(actionCollection(), this);
1379 QMenu
* menu
= m_newFileMenu
->menu();
1380 menu
->setTitle(i18nc("@title:menu Create new folder, file, link, etc.", "Create New"));
1381 menu
->setIcon(QIcon::fromTheme(QStringLiteral("list-add")));
1382 m_newFileMenu
->setPopupMode(QToolButton::InstantPopup
);
1383 connect(menu
, &QMenu::aboutToShow
,
1384 this, &DolphinMainWindow::updateNewMenu
);
1386 QAction
* newWindow
= KStandardAction::openNew(this, &DolphinMainWindow::openNewMainWindow
, actionCollection());
1387 newWindow
->setText(i18nc("@action:inmenu File", "New &Window"));
1388 newWindow
->setToolTip(i18nc("@info", "Open a new Dolphin window"));
1389 newWindow
->setWhatsThis(xi18nc("@info:whatsthis", "This opens a new "
1390 "window just like this one with the current location and view."
1391 "<nl/>You can drag and drop items between windows."));
1392 newWindow
->setIcon(QIcon::fromTheme(QStringLiteral("window-new")));
1394 QAction
* newTab
= actionCollection()->addAction(QStringLiteral("new_tab"));
1395 newTab
->setIcon(QIcon::fromTheme(QStringLiteral("tab-new")));
1396 newTab
->setText(i18nc("@action:inmenu File", "New Tab"));
1397 newTab
->setWhatsThis(xi18nc("@info:whatsthis", "This opens a new "
1398 "<emphasis>Tab</emphasis> with the current location and view.<nl/>"
1399 "A tab is an additional view within this window. "
1400 "You can drag and drop items between tabs."));
1401 actionCollection()->setDefaultShortcuts(newTab
, {Qt::CTRL
| Qt::Key_T
, Qt::CTRL
| Qt::SHIFT
| Qt::Key_N
});
1402 connect(newTab
, &QAction::triggered
, this, &DolphinMainWindow::openNewActivatedTab
);
1404 QAction
* addToPlaces
= actionCollection()->addAction(QStringLiteral("add_to_places"));
1405 addToPlaces
->setIcon(QIcon::fromTheme(QStringLiteral("bookmark-new")));
1406 addToPlaces
->setText(i18nc("@action:inmenu Add current folder to places", "Add to Places"));
1407 addToPlaces
->setWhatsThis(xi18nc("@info:whatsthis", "This adds the selected folder "
1408 "to the Places panel."));
1409 connect(addToPlaces
, &QAction::triggered
, this, &DolphinMainWindow::addToPlaces
);
1411 QAction
* closeTab
= KStandardAction::close(m_tabWidget
, QOverload
<>::of(&DolphinTabWidget::closeTab
), actionCollection());
1412 closeTab
->setText(i18nc("@action:inmenu File", "Close Tab"));
1413 closeTab
->setWhatsThis(i18nc("@info:whatsthis", "This closes the "
1414 "currently viewed tab. If no more tabs are left this window "
1415 "will close instead."));
1417 QAction
* quitAction
= KStandardAction::quit(this, &DolphinMainWindow::quit
, actionCollection());
1418 quitAction
->setWhatsThis(i18nc("@info:whatsthis quit", "This closes this window."));
1420 // setup 'Edit' menu
1421 KStandardAction::undo(this,
1422 &DolphinMainWindow::undo
,
1423 actionCollection());
1425 // i18n: This will be the last paragraph for the whatsthis for all three:
1426 // Cut, Copy and Paste
1427 const QString cutCopyPastePara
= xi18nc("@info:whatsthis", "<para><emphasis>Cut, "
1428 "Copy</emphasis> and <emphasis>Paste</emphasis> work between many "
1429 "applications and are among the most used commands. That's why their "
1430 "<emphasis>keyboard shortcuts</emphasis> are prominently placed right "
1431 "next to each other on the keyboard: <shortcut>Ctrl+X</shortcut>, "
1432 "<shortcut>Ctrl+C</shortcut> and <shortcut>Ctrl+V</shortcut>.</para>");
1433 QAction
* cutAction
= KStandardAction::cut(this, &DolphinMainWindow::cut
, actionCollection());
1434 cutAction
->setWhatsThis(xi18nc("@info:whatsthis cut", "This copies the items "
1435 "in your current selection to the <emphasis>clipboard</emphasis>.<nl/>"
1436 "Use the <emphasis>Paste</emphasis> action afterwards to copy them from "
1437 "the clipboard to a new location. The items will be removed from their "
1438 "initial location.") + cutCopyPastePara
);
1439 QAction
* copyAction
= KStandardAction::copy(this, &DolphinMainWindow::copy
, actionCollection());
1440 copyAction
->setWhatsThis(xi18nc("@info:whatsthis copy", "This copies the "
1441 "items in your current selection to the <emphasis>clipboard</emphasis>."
1442 "<nl/>Use the <emphasis>Paste</emphasis> action afterwards to copy them "
1443 "from the clipboard to a new location.") + cutCopyPastePara
);
1444 QAction
* paste
= KStandardAction::paste(this, &DolphinMainWindow::paste
, actionCollection());
1445 // The text of the paste-action is modified dynamically by Dolphin
1446 // (e. g. to "Paste One Folder"). To prevent that the size of the toolbar changes
1447 // due to the long text, the text "Paste" is used:
1448 paste
->setIconText(i18nc("@action:inmenu Edit", "Paste"));
1449 paste
->setWhatsThis(xi18nc("@info:whatsthis paste", "This copies the items from "
1450 "your <emphasis>clipboard</emphasis> to the currently viewed folder.<nl/>"
1451 "If the items were added to the clipboard by the <emphasis>Cut</emphasis> "
1452 "action they are removed from their old location.") + cutCopyPastePara
);
1454 QAction
* copyToOtherViewAction
= actionCollection()->addAction(QStringLiteral("copy_to_inactive_split_view"));
1455 copyToOtherViewAction
->setText(i18nc("@action:inmenu", "Copy to Inactive Split View"));
1456 copyToOtherViewAction
->setWhatsThis(xi18nc("@info:whatsthis Copy", "This copies the selected items from "
1457 "the <emphasis>active</emphasis> view to the inactive split view."));
1458 copyToOtherViewAction
->setIcon(QIcon::fromTheme(QStringLiteral("edit-copy")));
1459 copyToOtherViewAction
->setIconText(i18nc("@action:inmenu Edit", "Copy to Inactive Split View"));
1460 actionCollection()->setDefaultShortcut(copyToOtherViewAction
, Qt::SHIFT
| Qt::Key_F5
);
1461 connect(copyToOtherViewAction
, &QAction::triggered
, m_tabWidget
, &DolphinTabWidget::copyToInactiveSplitView
);
1463 QAction
* moveToOtherViewAction
= actionCollection()->addAction(QStringLiteral("move_to_inactive_split_view"));
1464 moveToOtherViewAction
->setText(i18nc("@action:inmenu", "Move to Inactive Split View"));
1465 moveToOtherViewAction
->setWhatsThis(xi18nc("@info:whatsthis Move", "This moves the selected items from "
1466 "the <emphasis>active</emphasis> view to the inactive split view."));
1467 moveToOtherViewAction
->setIcon(QIcon::fromTheme(QStringLiteral("edit-cut")));
1468 moveToOtherViewAction
->setIconText(i18nc("@action:inmenu Edit", "Move to Inactive Split View"));
1469 actionCollection()->setDefaultShortcut(moveToOtherViewAction
, Qt::SHIFT
| Qt::Key_F6
);
1470 connect(moveToOtherViewAction
, &QAction::triggered
, m_tabWidget
, &DolphinTabWidget::moveToInactiveSplitView
);
1472 QAction
* showFilterBar
= actionCollection()->addAction(QStringLiteral("show_filter_bar"));
1473 showFilterBar
->setText(i18nc("@action:inmenu Tools", "Filter..."));
1474 showFilterBar
->setToolTip(i18nc("@info:tooltip", "Toggle Filter Bar"));
1475 showFilterBar
->setWhatsThis(xi18nc("@info:whatsthis", "This opens the "
1476 "<emphasis>Filter Bar</emphasis> at the bottom of the window.<nl/> "
1477 "There you can enter a text to filter the files and folders currently displayed. "
1478 "Only those that contain the text in their name will be kept in view."));
1479 showFilterBar
->setIcon(QIcon::fromTheme(QStringLiteral("view-filter")));
1480 actionCollection()->setDefaultShortcuts(showFilterBar
, {Qt::CTRL
| Qt::Key_I
, Qt::Key_Slash
});
1481 connect(showFilterBar
, &QAction::triggered
, this, &DolphinMainWindow::showFilterBar
);
1483 // toggle_filter acts as a copy of the main showFilterBar to be used mainly
1484 // in the toolbar, with no default shortcut attached, to avoid messing with
1485 // existing workflows (filter bar always open and Ctrl-I to focus)
1486 QAction
*toggleFilter
= actionCollection()->addAction(QStringLiteral("toggle_filter"));
1487 toggleFilter
->setText(i18nc("@action:inmenu", "Toggle Filter Bar"));
1488 toggleFilter
->setIconText(i18nc("@action:intoolbar", "Filter"));
1489 toggleFilter
->setIcon(showFilterBar
->icon());
1490 toggleFilter
->setToolTip(showFilterBar
->toolTip());
1491 toggleFilter
->setWhatsThis(showFilterBar
->whatsThis());
1492 toggleFilter
->setCheckable(true);
1493 connect(toggleFilter
, &QAction::triggered
, this, &DolphinMainWindow::toggleFilterBar
);
1495 QAction
*searchAction
= KStandardAction::find(this, &DolphinMainWindow::find
, actionCollection());
1496 searchAction
->setText(i18n("Search..."));
1497 searchAction
->setToolTip(i18nc("@info:tooltip", "Search for files and folders"));
1498 searchAction
->setWhatsThis(xi18nc("@info:whatsthis find", "<para>This helps you "
1499 "find files and folders by opening a <emphasis>find bar</emphasis>. "
1500 "There you can enter search terms and specify settings to find the "
1501 "objects you are looking for.</para><para>Use this help again on "
1502 "the find bar so we can have a look at it while the settings are "
1503 "explained.</para>"));
1505 // toggle_search acts as a copy of the main searchAction to be used mainly
1506 // in the toolbar, with no default shortcut attached, to avoid messing with
1507 // existing workflows (search bar always open and Ctrl-F to focus)
1508 QAction
*toggleSearchAction
= actionCollection()->addAction(QStringLiteral("toggle_search"));
1509 toggleSearchAction
->setText(i18nc("@action:inmenu", "Toggle Search Bar"));
1510 toggleSearchAction
->setIconText(i18nc("@action:intoolbar", "Search"));
1511 toggleSearchAction
->setIcon(searchAction
->icon());
1512 toggleSearchAction
->setToolTip(searchAction
->toolTip());
1513 toggleSearchAction
->setWhatsThis(searchAction
->whatsThis());
1514 toggleSearchAction
->setCheckable(true);
1516 QAction
* selectAllAction
= KStandardAction::selectAll(this, &DolphinMainWindow::selectAll
, actionCollection());
1517 selectAllAction
->setWhatsThis(xi18nc("@info:whatsthis", "This selects all "
1518 "files and folders in the current location."));
1520 QAction
* invertSelection
= actionCollection()->addAction(QStringLiteral("invert_selection"));
1521 invertSelection
->setText(i18nc("@action:inmenu Edit", "Invert Selection"));
1522 invertSelection
->setWhatsThis(xi18nc("@info:whatsthis invert", "This selects all "
1523 "objects that you have currently <emphasis>not</emphasis> selected instead."));
1524 invertSelection
->setIcon(QIcon::fromTheme(QStringLiteral("edit-select-invert")));
1525 actionCollection()->setDefaultShortcut(invertSelection
, Qt::CTRL
| Qt::SHIFT
| Qt::Key_A
);
1526 connect(invertSelection
, &QAction::triggered
, this, &DolphinMainWindow::invertSelection
);
1528 // setup 'View' menu
1529 // (note that most of it is set up in DolphinViewActionHandler)
1531 QAction
* split
= actionCollection()->addAction(QStringLiteral("split_view"));
1532 split
->setWhatsThis(xi18nc("@info:whatsthis find", "<para>This splits "
1533 "the folder view below into two autonomous views.</para><para>This "
1534 "way you can see two locations at once and move items between them "
1535 "quickly.</para>Click this again afterwards to recombine the views."));
1536 actionCollection()->setDefaultShortcut(split
, Qt::Key_F3
);
1537 connect(split
, &QAction::triggered
, this, &DolphinMainWindow::toggleSplitView
);
1539 QAction
* stashSplit
= actionCollection()->addAction(QStringLiteral("split_stash"));
1540 actionCollection()->setDefaultShortcut(stashSplit
, Qt::CTRL
| Qt::Key_S
);
1541 stashSplit
->setText(i18nc("@action:intoolbar Stash", "Stash"));
1542 stashSplit
->setToolTip(i18nc("@info", "Opens the stash virtual directory in a split window"));
1543 stashSplit
->setIcon(QIcon::fromTheme(QStringLiteral("folder-stash")));
1544 stashSplit
->setCheckable(false);
1545 stashSplit
->setVisible(QDBusConnection::sessionBus().interface()->isServiceRegistered(QStringLiteral("org.kde.kio.StashNotifier")));
1546 connect(stashSplit
, &QAction::triggered
, this, &DolphinMainWindow::toggleSplitStash
);
1548 KStandardAction::redisplay(this, &DolphinMainWindow::reloadView
, actionCollection());
1550 QAction
* stop
= actionCollection()->addAction(QStringLiteral("stop"));
1551 stop
->setText(i18nc("@action:inmenu View", "Stop"));
1552 stop
->setToolTip(i18nc("@info", "Stop loading"));
1553 stop
->setWhatsThis(i18nc("@info", "This stops the loading of the contents of the current folder."));
1554 stop
->setIcon(QIcon::fromTheme(QStringLiteral("process-stop")));
1555 connect(stop
, &QAction::triggered
, this, &DolphinMainWindow::stopLoading
);
1557 KToggleAction
* editableLocation
= actionCollection()->add
<KToggleAction
>(QStringLiteral("editable_location"));
1558 editableLocation
->setText(i18nc("@action:inmenu Navigation Bar", "Editable Location"));
1559 editableLocation
->setWhatsThis(xi18nc("@info:whatsthis",
1560 "This toggles the <emphasis>Location Bar</emphasis> to be "
1561 "editable so you can directly enter a location you want to go to.<nl/>"
1562 "You can also switch to editing by clicking to the right of the "
1563 "location and switch back by confirming the edited location."));
1564 actionCollection()->setDefaultShortcut(editableLocation
, Qt::Key_F6
);
1565 connect(editableLocation
, &KToggleAction::triggered
, this, &DolphinMainWindow::toggleEditLocation
);
1567 QAction
* replaceLocation
= actionCollection()->addAction(QStringLiteral("replace_location"));
1568 replaceLocation
->setText(i18nc("@action:inmenu Navigation Bar", "Replace Location"));
1569 // i18n: "enter" is used both in the meaning of "writing" and "going to" a new location here.
1570 // Both meanings are useful but not necessary to understand the use of "Replace Location".
1571 // So you might want to be more verbose in your language to convey the meaning but it's up to you.
1572 replaceLocation
->setWhatsThis(xi18nc("@info:whatsthis",
1573 "This switches to editing the location and selects it "
1574 "so you can quickly enter a different location."));
1575 actionCollection()->setDefaultShortcut(replaceLocation
, Qt::CTRL
| Qt::Key_L
);
1576 connect(replaceLocation
, &QAction::triggered
, this, &DolphinMainWindow::replaceLocation
);
1580 QScopedPointer
<QAction
> backAction(KStandardAction::back(nullptr, nullptr, nullptr));
1581 m_backAction
= new KToolBarPopupAction(backAction
->icon(), backAction
->text(), actionCollection());
1582 m_backAction
->setObjectName(backAction
->objectName());
1583 m_backAction
->setShortcuts(backAction
->shortcuts());
1585 m_backAction
->setPopupMode(QToolButton::DelayedPopup
);
1586 connect(m_backAction
, &QAction::triggered
, this, &DolphinMainWindow::goBack
);
1587 connect(m_backAction
->menu(), &QMenu::aboutToShow
, this, &DolphinMainWindow::slotAboutToShowBackPopupMenu
);
1588 connect(m_backAction
->menu(), &QMenu::triggered
, this, &DolphinMainWindow::slotGoBack
);
1589 actionCollection()->addAction(m_backAction
->objectName(), m_backAction
);
1591 auto backShortcuts
= m_backAction
->shortcuts();
1592 backShortcuts
.append(QKeySequence(Qt::Key_Backspace
));
1593 actionCollection()->setDefaultShortcuts(m_backAction
, backShortcuts
);
1595 DolphinRecentTabsMenu
* recentTabsMenu
= new DolphinRecentTabsMenu(this);
1596 actionCollection()->addAction(QStringLiteral("closed_tabs"), recentTabsMenu
);
1597 connect(m_tabWidget
, &DolphinTabWidget::rememberClosedTab
,
1598 recentTabsMenu
, &DolphinRecentTabsMenu::rememberClosedTab
);
1599 connect(recentTabsMenu
, &DolphinRecentTabsMenu::restoreClosedTab
,
1600 m_tabWidget
, &DolphinTabWidget::restoreClosedTab
);
1601 connect(recentTabsMenu
, &DolphinRecentTabsMenu::closedTabsCountChanged
,
1602 this, &DolphinMainWindow::closedTabsCountChanged
);
1604 QAction
* undoCloseTab
= actionCollection()->addAction(QStringLiteral("undo_close_tab"));
1605 undoCloseTab
->setText(i18nc("@action:inmenu File", "Undo close tab"));
1606 undoCloseTab
->setWhatsThis(i18nc("@info:whatsthis undo close tab",
1607 "This returns you to the previously closed tab."));
1608 actionCollection()->setDefaultShortcut(undoCloseTab
, Qt::CTRL
| Qt::SHIFT
| Qt::Key_T
);
1609 undoCloseTab
->setIcon(QIcon::fromTheme(QStringLiteral("edit-undo")));
1610 undoCloseTab
->setEnabled(false);
1611 connect(undoCloseTab
, &QAction::triggered
, recentTabsMenu
, &DolphinRecentTabsMenu::undoCloseTab
);
1613 auto undoAction
= actionCollection()->action(KStandardAction::name(KStandardAction::Undo
));
1614 undoAction
->setWhatsThis(xi18nc("@info:whatsthis", "This undoes "
1615 "the last change you made to files or folders.<nl/>"
1616 "Such changes include <interface>creating, renaming</interface> "
1617 "and <interface>moving</interface> them to a different location "
1618 "or to the <filename>Trash</filename>. <nl/>Changes that can't "
1619 "be undone will ask for your confirmation."));
1620 undoAction
->setEnabled(false); // undo should be disabled by default
1623 QScopedPointer
<QAction
> forwardAction(KStandardAction::forward(nullptr, nullptr, nullptr));
1624 m_forwardAction
= new KToolBarPopupAction(forwardAction
->icon(), forwardAction
->text(), actionCollection());
1625 m_forwardAction
->setObjectName(forwardAction
->objectName());
1626 m_forwardAction
->setShortcuts(forwardAction
->shortcuts());
1628 m_forwardAction
->setPopupMode(QToolButton::DelayedPopup
);
1629 connect(m_forwardAction
, &QAction::triggered
, this, &DolphinMainWindow::goForward
);
1630 connect(m_forwardAction
->menu(), &QMenu::aboutToShow
, this, &DolphinMainWindow::slotAboutToShowForwardPopupMenu
);
1631 connect(m_forwardAction
->menu(), &QMenu::triggered
, this, &DolphinMainWindow::slotGoForward
);
1632 actionCollection()->addAction(m_forwardAction
->objectName(), m_forwardAction
);
1633 actionCollection()->setDefaultShortcuts(m_forwardAction
, m_forwardAction
->shortcuts());
1635 // enable middle-click to open in a new tab
1636 auto *middleClickEventFilter
= new MiddleClickActionEventFilter(this);
1637 connect(middleClickEventFilter
, &MiddleClickActionEventFilter::actionMiddleClicked
, this, &DolphinMainWindow::slotBackForwardActionMiddleClicked
);
1638 m_backAction
->menu()->installEventFilter(middleClickEventFilter
);
1639 m_forwardAction
->menu()->installEventFilter(middleClickEventFilter
);
1640 KStandardAction::up(this, &DolphinMainWindow::goUp
, actionCollection());
1641 QAction
* homeAction
= KStandardAction::home(this, &DolphinMainWindow::goHome
, actionCollection());
1642 homeAction
->setWhatsThis(xi18nc("@info:whatsthis", "Go to your "
1643 "<filename>Home</filename> folder.<nl/>Every user account "
1644 "has their own <filename>Home</filename> that contains their data "
1645 "including folders that contain personal application data."));
1647 // setup 'Tools' menu
1648 QAction
* compareFiles
= actionCollection()->addAction(QStringLiteral("compare_files"));
1649 compareFiles
->setText(i18nc("@action:inmenu Tools", "Compare Files"));
1650 compareFiles
->setIcon(QIcon::fromTheme(QStringLiteral("kompare")));
1651 compareFiles
->setEnabled(false);
1652 connect(compareFiles
, &QAction::triggered
, this, &DolphinMainWindow::compareFiles
);
1654 QAction
* openPreferredSearchTool
= actionCollection()->addAction(QStringLiteral("open_preferred_search_tool"));
1655 openPreferredSearchTool
->setText(i18nc("@action:inmenu Tools", "Open Preferred Search Tool"));
1656 openPreferredSearchTool
->setWhatsThis(xi18nc("@info:whatsthis",
1657 "<para>This opens a preferred search tool for the viewed location.</para>"
1658 "<para>Use <emphasis>More Search Tools</emphasis> menu to configure it.</para>"));
1659 openPreferredSearchTool
->setIcon(QIcon::fromTheme(QStringLiteral("search")));
1660 actionCollection()->setDefaultShortcut(openPreferredSearchTool
, Qt::CTRL
| Qt::SHIFT
| Qt::Key_F
);
1661 connect(openPreferredSearchTool
, &QAction::triggered
, this, &DolphinMainWindow::openPreferredSearchTool
);
1663 if (KAuthorized::authorize(QStringLiteral("shell_access"))) {
1664 QAction
* openTerminal
= actionCollection()->addAction(QStringLiteral("open_terminal"));
1665 openTerminal
->setText(i18nc("@action:inmenu Tools", "Open Terminal"));
1666 openTerminal
->setWhatsThis(xi18nc("@info:whatsthis",
1667 "<para>This opens a <emphasis>terminal</emphasis> application for the viewed location.</para>"
1668 "<para>To learn more about terminals use the help in the terminal application.</para>"));
1669 openTerminal
->setIcon(QIcon::fromTheme(QStringLiteral("utilities-terminal")));
1670 actionCollection()->setDefaultShortcut(openTerminal
, Qt::SHIFT
| Qt::Key_F4
);
1671 connect(openTerminal
, &QAction::triggered
, this, &DolphinMainWindow::openTerminal
);
1673 #ifdef HAVE_TERMINAL
1674 QAction
* focusTerminalPanel
= actionCollection()->addAction(QStringLiteral("focus_terminal_panel"));
1675 focusTerminalPanel
->setText(i18nc("@action:inmenu Tools", "Focus Terminal Panel"));
1676 focusTerminalPanel
->setIcon(QIcon::fromTheme(QStringLiteral("swap-panels")));
1677 actionCollection()->setDefaultShortcut(focusTerminalPanel
, Qt::CTRL
| Qt::SHIFT
| Qt::Key_F4
);
1678 connect(focusTerminalPanel
, &QAction::triggered
, this, &DolphinMainWindow::focusTerminalPanel
);
1682 // setup 'Bookmarks' menu
1683 KActionMenu
*bookmarkMenu
= new KActionMenu(i18nc("@title:menu", "&Bookmarks"), this);
1684 bookmarkMenu
->setIcon(QIcon::fromTheme(QStringLiteral("bookmarks")));
1685 // Make the toolbar button version work properly on click
1686 bookmarkMenu
->setPopupMode(QToolButton::InstantPopup
);
1687 m_bookmarkHandler
= new DolphinBookmarkHandler(this, actionCollection(), bookmarkMenu
->menu(), this);
1688 actionCollection()->addAction(QStringLiteral("bookmarks"), bookmarkMenu
);
1690 // setup 'Settings' menu
1691 KToggleAction
* showMenuBar
= KStandardAction::showMenubar(nullptr, nullptr, actionCollection());
1692 showMenuBar
->setWhatsThis(xi18nc("@info:whatsthis",
1693 "This switches between having a <emphasis>Menubar</emphasis> "
1694 "and having a <interface>Control</interface> button. Both "
1695 "contain mostly the same commands and configuration options."));
1696 connect(showMenuBar
, &KToggleAction::triggered
, // Fixes #286822
1697 this, &DolphinMainWindow::toggleShowMenuBar
, Qt::QueuedConnection
);
1698 KStandardAction::preferences(this, &DolphinMainWindow::editSettings
, actionCollection());
1700 // setup 'Help' menu for the m_controlButton. The other one is set up in the base class.
1701 m_helpMenu
= new KHelpMenu(nullptr);
1702 m_helpMenu
->menu()->installEventFilter(this);
1703 // remove duplicate shortcuts
1704 auto removeHelpActionShortcut
= [this](KHelpMenu::MenuId menuId
) {
1705 if (auto *action
= m_helpMenu
->action(menuId
)) {
1706 action
->setShortcut(QKeySequence());
1709 removeHelpActionShortcut(KHelpMenu::menuHelpContents
);
1710 removeHelpActionShortcut(KHelpMenu::menuWhatsThis
);
1712 // not in menu actions
1713 QList
<QKeySequence
> nextTabKeys
= KStandardShortcut::tabNext();
1714 nextTabKeys
.append(QKeySequence(Qt::CTRL
| Qt::Key_Tab
));
1716 QList
<QKeySequence
> prevTabKeys
= KStandardShortcut::tabPrev();
1717 prevTabKeys
.append(QKeySequence(Qt::CTRL
| Qt::SHIFT
| Qt::Key_Tab
));
1719 for (int i
= 0; i
< MaxActivateTabShortcuts
; ++i
) {
1720 QAction
* activateTab
= actionCollection()->addAction(QStringLiteral("activate_tab_%1").arg(i
));
1721 activateTab
->setText(i18nc("@action:inmenu", "Activate Tab %1", i
+ 1));
1722 activateTab
->setEnabled(false);
1723 connect(activateTab
, &QAction::triggered
, this, [this, i
]() { m_tabWidget
->activateTab(i
); });
1725 // only add default shortcuts for the first 9 tabs regardless of MaxActivateTabShortcuts
1727 actionCollection()->setDefaultShortcut(activateTab
, QStringLiteral("Alt+%1").arg(i
+ 1));
1731 QAction
* activateLastTab
= actionCollection()->addAction(QStringLiteral("activate_last_tab"));
1732 activateLastTab
->setText(i18nc("@action:inmenu", "Activate Last Tab"));
1733 activateLastTab
->setEnabled(false);
1734 connect(activateLastTab
, &QAction::triggered
, m_tabWidget
, &DolphinTabWidget::activateLastTab
);
1735 actionCollection()->setDefaultShortcut(activateLastTab
, Qt::ALT
| Qt::Key_0
);
1737 QAction
* activateNextTab
= actionCollection()->addAction(QStringLiteral("activate_next_tab"));
1738 activateNextTab
->setIconText(i18nc("@action:inmenu", "Next Tab"));
1739 activateNextTab
->setText(i18nc("@action:inmenu", "Activate Next Tab"));
1740 activateNextTab
->setEnabled(false);
1741 connect(activateNextTab
, &QAction::triggered
, m_tabWidget
, &DolphinTabWidget::activateNextTab
);
1742 actionCollection()->setDefaultShortcuts(activateNextTab
, nextTabKeys
);
1744 QAction
* activatePrevTab
= actionCollection()->addAction(QStringLiteral("activate_prev_tab"));
1745 activatePrevTab
->setIconText(i18nc("@action:inmenu", "Previous Tab"));
1746 activatePrevTab
->setText(i18nc("@action:inmenu", "Activate Previous Tab"));
1747 activatePrevTab
->setEnabled(false);
1748 connect(activatePrevTab
, &QAction::triggered
, m_tabWidget
, &DolphinTabWidget::activatePrevTab
);
1749 actionCollection()->setDefaultShortcuts(activatePrevTab
, prevTabKeys
);
1752 QAction
* showTarget
= actionCollection()->addAction(QStringLiteral("show_target"));
1753 showTarget
->setText(i18nc("@action:inmenu", "Show Target"));
1754 showTarget
->setIcon(QIcon::fromTheme(QStringLiteral("document-open-folder")));
1755 showTarget
->setEnabled(false);
1756 connect(showTarget
, &QAction::triggered
, this, &DolphinMainWindow::showTarget
);
1758 QAction
* openInNewTab
= actionCollection()->addAction(QStringLiteral("open_in_new_tab"));
1759 openInNewTab
->setText(i18nc("@action:inmenu", "Open in New Tab"));
1760 openInNewTab
->setIcon(QIcon::fromTheme(QStringLiteral("tab-new")));
1761 connect(openInNewTab
, &QAction::triggered
, this, &DolphinMainWindow::openInNewTab
);
1763 QAction
* openInNewTabs
= actionCollection()->addAction(QStringLiteral("open_in_new_tabs"));
1764 openInNewTabs
->setText(i18nc("@action:inmenu", "Open in New Tabs"));
1765 openInNewTabs
->setIcon(QIcon::fromTheme(QStringLiteral("tab-new")));
1766 connect(openInNewTabs
, &QAction::triggered
, this, &DolphinMainWindow::openInNewTab
);
1768 QAction
* openInNewWindow
= actionCollection()->addAction(QStringLiteral("open_in_new_window"));
1769 openInNewWindow
->setText(i18nc("@action:inmenu", "Open in New Window"));
1770 openInNewWindow
->setIcon(QIcon::fromTheme(QStringLiteral("window-new")));
1771 connect(openInNewWindow
, &QAction::triggered
, this, &DolphinMainWindow::openInNewWindow
);
1774 void DolphinMainWindow::setupDockWidgets()
1776 const bool lock
= GeneralSettings::lockPanels();
1778 KDualAction
* lockLayoutAction
= actionCollection()->add
<KDualAction
>(QStringLiteral("lock_panels"));
1779 lockLayoutAction
->setActiveText(i18nc("@action:inmenu Panels", "Unlock Panels"));
1780 lockLayoutAction
->setActiveIcon(QIcon::fromTheme(QStringLiteral("object-unlocked")));
1781 lockLayoutAction
->setInactiveText(i18nc("@action:inmenu Panels", "Lock Panels"));
1782 lockLayoutAction
->setInactiveIcon(QIcon::fromTheme(QStringLiteral("object-locked")));
1783 lockLayoutAction
->setWhatsThis(xi18nc("@info:whatsthis", "This "
1784 "switches between having panels <emphasis>locked</emphasis> or "
1785 "<emphasis>unlocked</emphasis>.<nl/>Unlocked panels can be "
1786 "dragged to the other side of the window and have a close "
1787 "button.<nl/>Locked panels are embedded more cleanly."));
1788 lockLayoutAction
->setActive(lock
);
1789 connect(lockLayoutAction
, &KDualAction::triggered
, this, &DolphinMainWindow::togglePanelLockState
);
1791 // Setup "Information"
1792 DolphinDockWidget
* infoDock
= new DolphinDockWidget(i18nc("@title:window", "Information"));
1793 infoDock
->setLocked(lock
);
1794 infoDock
->setObjectName(QStringLiteral("infoDock"));
1795 infoDock
->setAllowedAreas(Qt::LeftDockWidgetArea
| Qt::RightDockWidgetArea
);
1798 InformationPanel
* infoPanel
= new InformationPanel(infoDock
);
1799 infoPanel
->setCustomContextMenuActions({lockLayoutAction
});
1800 connect(infoPanel
, &InformationPanel::urlActivated
, this, &DolphinMainWindow::handleUrl
);
1801 infoDock
->setWidget(infoPanel
);
1803 QAction
* infoAction
= infoDock
->toggleViewAction();
1804 createPanelAction(QIcon::fromTheme(QStringLiteral("dialog-information")), Qt::Key_F11
, infoAction
, QStringLiteral("show_information_panel"));
1806 addDockWidget(Qt::RightDockWidgetArea
, infoDock
);
1807 connect(this, &DolphinMainWindow::urlChanged
,
1808 infoPanel
, &InformationPanel::setUrl
);
1809 connect(this, &DolphinMainWindow::selectionChanged
,
1810 infoPanel
, &InformationPanel::setSelection
);
1811 connect(this, &DolphinMainWindow::requestItemInfo
,
1812 infoPanel
, &InformationPanel::requestDelayedItemInfo
);
1813 connect(this, &DolphinMainWindow::fileItemsChanged
,
1814 infoPanel
, &InformationPanel::slotFilesItemChanged
);
1817 // i18n: This is the last paragraph for the "What's This"-texts of all four panels.
1818 const QString panelWhatsThis
= xi18nc("@info:whatsthis", "<para>To show or "
1819 "hide panels like this go to <interface>Control|Panels</interface> "
1820 "or <interface>View|Panels</interface>.</para>");
1822 actionCollection()->action(QStringLiteral("show_information_panel"))
1823 ->setWhatsThis(xi18nc("@info:whatsthis", "<para> This toggles the "
1824 "<emphasis>information</emphasis> panel at the right side of the "
1825 "window.</para><para>The panel provides in-depth information "
1826 "about the items your mouse is hovering over or about the selected "
1827 "items. Otherwise it informs you about the currently viewed folder.<nl/>"
1828 "For single items a preview of their contents is provided.</para>"));
1830 infoDock
->setWhatsThis(xi18nc("@info:whatsthis", "<para>This panel "
1831 "provides in-depth information about the items your mouse is "
1832 "hovering over or about the selected items. Otherwise it informs "
1833 "you about the currently viewed folder.<nl/>For single items a "
1834 "preview of their contents is provided.</para><para>You can configure "
1835 "which and how details are given here by right-clicking.</para>") + panelWhatsThis
);
1838 DolphinDockWidget
* foldersDock
= new DolphinDockWidget(i18nc("@title:window", "Folders"));
1839 foldersDock
->setLocked(lock
);
1840 foldersDock
->setObjectName(QStringLiteral("foldersDock"));
1841 foldersDock
->setAllowedAreas(Qt::LeftDockWidgetArea
| Qt::RightDockWidgetArea
);
1842 FoldersPanel
* foldersPanel
= new FoldersPanel(foldersDock
);
1843 foldersPanel
->setCustomContextMenuActions({lockLayoutAction
});
1844 foldersDock
->setWidget(foldersPanel
);
1846 QAction
* foldersAction
= foldersDock
->toggleViewAction();
1847 createPanelAction(QIcon::fromTheme(QStringLiteral("folder")), Qt::Key_F7
, foldersAction
, QStringLiteral("show_folders_panel"));
1849 addDockWidget(Qt::LeftDockWidgetArea
, foldersDock
);
1850 connect(this, &DolphinMainWindow::urlChanged
,
1851 foldersPanel
, &FoldersPanel::setUrl
);
1852 connect(foldersPanel
, &FoldersPanel::folderActivated
,
1853 this, &DolphinMainWindow::changeUrl
);
1854 connect(foldersPanel
, &FoldersPanel::folderMiddleClicked
,
1855 this, &DolphinMainWindow::openNewTab
);
1856 connect(foldersPanel
, &FoldersPanel::errorMessage
,
1857 this, &DolphinMainWindow::showErrorMessage
);
1859 actionCollection()->action(QStringLiteral("show_folders_panel"))
1860 ->setWhatsThis(xi18nc("@info:whatsthis", "This toggles the "
1861 "<emphasis>folders</emphasis> panel at the left side of the window."
1862 "<nl/><nl/>It shows the folders of the <emphasis>file system"
1863 "</emphasis> in a <emphasis>tree view</emphasis>."));
1864 foldersDock
->setWhatsThis(xi18nc("@info:whatsthis", "<para>This panel "
1865 "shows the folders of the <emphasis>file system</emphasis> in a "
1866 "<emphasis>tree view</emphasis>.</para><para>Click a folder to go "
1867 "there. Click the arrow to the left of a folder to see its subfolders. "
1868 "This allows quick switching between any folders.</para>") + panelWhatsThis
);
1871 #ifdef HAVE_TERMINAL
1872 if (KAuthorized::authorize(QStringLiteral("shell_access"))) {
1873 DolphinDockWidget
* terminalDock
= new DolphinDockWidget(i18nc("@title:window Shell terminal", "Terminal"));
1874 terminalDock
->setLocked(lock
);
1875 terminalDock
->setObjectName(QStringLiteral("terminalDock"));
1876 m_terminalPanel
= new TerminalPanel(terminalDock
);
1877 m_terminalPanel
->setCustomContextMenuActions({lockLayoutAction
});
1878 terminalDock
->setWidget(m_terminalPanel
);
1880 connect(m_terminalPanel
, &TerminalPanel::hideTerminalPanel
, terminalDock
, &DolphinDockWidget::hide
);
1881 connect(m_terminalPanel
, &TerminalPanel::changeUrl
, this, &DolphinMainWindow::slotTerminalDirectoryChanged
);
1882 connect(terminalDock
, &DolphinDockWidget::visibilityChanged
,
1883 m_terminalPanel
, &TerminalPanel::dockVisibilityChanged
);
1884 connect(terminalDock
, &DolphinDockWidget::visibilityChanged
,
1885 this, &DolphinMainWindow::slotTerminalPanelVisibilityChanged
);
1887 QAction
* terminalAction
= terminalDock
->toggleViewAction();
1888 createPanelAction(QIcon::fromTheme(QStringLiteral("dialog-scripts")), Qt::Key_F4
, terminalAction
, QStringLiteral("show_terminal_panel"));
1890 addDockWidget(Qt::BottomDockWidgetArea
, terminalDock
);
1891 connect(this, &DolphinMainWindow::urlChanged
,
1892 m_terminalPanel
, &TerminalPanel::setUrl
);
1894 if (GeneralSettings::version() < 200) {
1895 terminalDock
->hide();
1898 actionCollection()->action(QStringLiteral("show_terminal_panel"))
1899 ->setWhatsThis(xi18nc("@info:whatsthis", "<para>This toggles the "
1900 "<emphasis>terminal</emphasis> panel at the bottom of the window."
1901 "<nl/>The location in the terminal will always match the folder "
1902 "view so you can navigate using either.</para><para>The terminal "
1903 "panel is not needed for basic computer usage but can be useful "
1904 "for advanced tasks. To learn more about terminals use the help "
1905 "in a standalone terminal application like Konsole.</para>"));
1906 terminalDock
->setWhatsThis(xi18nc("@info:whatsthis", "<para>This is "
1907 "the <emphasis>terminal</emphasis> panel. It behaves like a "
1908 "normal terminal but will match the location of the folder view "
1909 "so you can navigate using either.</para><para>The terminal panel "
1910 "is not needed for basic computer usage but can be useful for "
1911 "advanced tasks. To learn more about terminals use the help in a "
1912 "standalone terminal application like Konsole.</para>") + panelWhatsThis
);
1916 if (GeneralSettings::version() < 200) {
1918 foldersDock
->hide();
1922 DolphinDockWidget
* placesDock
= new DolphinDockWidget(i18nc("@title:window", "Places"));
1923 placesDock
->setLocked(lock
);
1924 placesDock
->setObjectName(QStringLiteral("placesDock"));
1925 placesDock
->setAllowedAreas(Qt::LeftDockWidgetArea
| Qt::RightDockWidgetArea
);
1927 m_placesPanel
= new PlacesPanel(placesDock
);
1928 m_placesPanel
->setCustomContextMenuActions({lockLayoutAction
});
1929 placesDock
->setWidget(m_placesPanel
);
1931 QAction
*placesAction
= placesDock
->toggleViewAction();
1932 createPanelAction(QIcon::fromTheme(QStringLiteral("compass")), Qt::Key_F9
, placesAction
, QStringLiteral("show_places_panel"));
1934 addDockWidget(Qt::LeftDockWidgetArea
, placesDock
);
1935 connect(m_placesPanel
, &PlacesPanel::placeActivated
,
1936 this, &DolphinMainWindow::slotPlaceActivated
);
1937 connect(m_placesPanel
, &PlacesPanel::placeMiddleClicked
,
1938 this, &DolphinMainWindow::openNewTab
);
1939 connect(m_placesPanel
, &PlacesPanel::errorMessage
,
1940 this, &DolphinMainWindow::showErrorMessage
);
1941 connect(this, &DolphinMainWindow::urlChanged
,
1942 m_placesPanel
, &PlacesPanel::setUrl
);
1943 connect(placesDock
, &DolphinDockWidget::visibilityChanged
,
1944 &DolphinUrlNavigatorsController::slotPlacesPanelVisibilityChanged
);
1945 connect(this, &DolphinMainWindow::settingsChanged
,
1946 m_placesPanel
, &PlacesPanel::readSettings
);
1947 connect(m_placesPanel
, &PlacesPanel::storageTearDownRequested
,
1948 this, &DolphinMainWindow::slotStorageTearDownFromPlacesRequested
);
1949 connect(m_placesPanel
, &PlacesPanel::storageTearDownExternallyRequested
,
1950 this, &DolphinMainWindow::slotStorageTearDownExternallyRequested
);
1951 DolphinUrlNavigatorsController::slotPlacesPanelVisibilityChanged(m_placesPanel
->isVisible());
1953 auto actionShowAllPlaces
= new QAction(QIcon::fromTheme(QStringLiteral("view-hidden")), i18nc("@item:inmenu", "Show Hidden Places"), this);
1954 actionShowAllPlaces
->setCheckable(true);
1955 actionShowAllPlaces
->setDisabled(true);
1956 actionShowAllPlaces
->setWhatsThis(i18nc("@info:whatsthis", "This displays "
1957 "all places in the places panel that have been hidden. They will "
1958 "appear semi-transparent unless you uncheck their hide property."));
1960 connect(actionShowAllPlaces
, &QAction::triggered
, this, [actionShowAllPlaces
, this](bool checked
){
1961 actionShowAllPlaces
->setIcon(QIcon::fromTheme(checked
? QStringLiteral("view-visible") : QStringLiteral("view-hidden")));
1962 m_placesPanel
->showHiddenEntries(checked
);
1965 connect(m_placesPanel
, &PlacesPanel::showHiddenEntriesChanged
, this, [actionShowAllPlaces
] (bool checked
){
1966 actionShowAllPlaces
->setChecked(checked
);
1967 actionShowAllPlaces
->setIcon(QIcon::fromTheme(checked
? QStringLiteral("view-visible") : QStringLiteral("view-hidden")));
1970 actionCollection()->action(QStringLiteral("show_places_panel"))
1971 ->setWhatsThis(xi18nc("@info:whatsthis", "<para>This toggles the "
1972 "<emphasis>places</emphasis> panel at the left side of the window."
1973 "</para><para>It allows you to go to locations you have "
1974 "bookmarked and to access disk or media attached to the computer "
1975 "or to the network. It also contains sections to find recently "
1976 "saved files or files of a certain type.</para>"));
1977 placesDock
->setWhatsThis(xi18nc("@info:whatsthis", "<para>This is the "
1978 "<emphasis>Places</emphasis> panel. It allows you to go to locations "
1979 "you have bookmarked and to access disk or media attached to the "
1980 "computer or to the network. It also contains sections to find "
1981 "recently saved files or files of a certain type.</para><para>"
1982 "Click on an entry to go there. Click with the right mouse button "
1983 "instead to open any entry in a new tab or new window.</para>"
1984 "<para>New entries can be added by dragging folders onto this panel. "
1985 "Right-click any section or entry to hide it. Right-click an empty "
1986 "space on this panel and select <interface>Show Hidden Places"
1987 "</interface> to display it again.</para>") + panelWhatsThis
);
1989 // Add actions into the "Panels" menu
1990 KActionMenu
* panelsMenu
= new KActionMenu(i18nc("@action:inmenu View", "Show Panels"), this);
1991 actionCollection()->addAction(QStringLiteral("panels"), panelsMenu
);
1992 panelsMenu
->setIcon(QIcon::fromTheme(QStringLiteral("view-sidetree")));
1993 panelsMenu
->setPopupMode(QToolButton::InstantPopup
);
1994 const KActionCollection
* ac
= actionCollection();
1995 panelsMenu
->addAction(ac
->action(QStringLiteral("show_places_panel")));
1997 panelsMenu
->addAction(ac
->action(QStringLiteral("show_information_panel")));
1999 panelsMenu
->addAction(ac
->action(QStringLiteral("show_folders_panel")));
2000 panelsMenu
->addAction(ac
->action(QStringLiteral("show_terminal_panel")));
2001 panelsMenu
->addSeparator();
2002 panelsMenu
->addAction(actionShowAllPlaces
);
2003 panelsMenu
->addAction(lockLayoutAction
);
2005 connect(panelsMenu
->menu(), &QMenu::aboutToShow
, this, [actionShowAllPlaces
, this]{
2006 actionShowAllPlaces
->setEnabled(m_placesPanel
->hiddenListCount());
2011 void DolphinMainWindow::updateFileAndEditActions()
2013 const KFileItemList list
= m_activeViewContainer
->view()->selectedItems();
2014 const KActionCollection
* col
= actionCollection();
2015 KFileItemListProperties
capabilitiesSource(list
);
2017 QAction
* addToPlacesAction
= col
->action(QStringLiteral("add_to_places"));
2018 QAction
* copyToOtherViewAction
= col
->action(QStringLiteral("copy_to_inactive_split_view"));
2019 QAction
* moveToOtherViewAction
= col
->action(QStringLiteral("move_to_inactive_split_view"));
2020 QAction
* copyLocation
= col
->action(QString("copy_location"));
2022 if (list
.isEmpty()) {
2023 stateChanged(QStringLiteral("has_no_selection"));
2025 addToPlacesAction
->setEnabled(true);
2026 copyToOtherViewAction
->setEnabled(false);
2027 moveToOtherViewAction
->setEnabled(false);
2028 copyLocation
->setEnabled(false);
2030 stateChanged(QStringLiteral("has_selection"));
2032 QAction
* renameAction
= col
->action(KStandardAction::name(KStandardAction::RenameFile
));
2033 QAction
* moveToTrashAction
= col
->action(KStandardAction::name(KStandardAction::MoveToTrash
));
2034 QAction
* deleteAction
= col
->action(KStandardAction::name(KStandardAction::DeleteFile
));
2035 QAction
* cutAction
= col
->action(KStandardAction::name(KStandardAction::Cut
));
2036 QAction
* deleteWithTrashShortcut
= col
->action(QStringLiteral("delete_shortcut")); // see DolphinViewActionHandler
2037 QAction
* showTarget
= col
->action(QStringLiteral("show_target"));
2038 QAction
* duplicateAction
= col
->action(QStringLiteral("duplicate")); // see DolphinViewActionHandler
2040 if (list
.length() == 1 && list
.first().isDir()) {
2041 addToPlacesAction
->setEnabled(true);
2043 addToPlacesAction
->setEnabled(false);
2046 if (m_tabWidget
->currentTabPage()->splitViewEnabled()) {
2047 DolphinTabPage
* tabPage
= m_tabWidget
->currentTabPage();
2048 KFileItem capabilitiesDestination
;
2050 if (tabPage
->primaryViewActive()) {
2051 capabilitiesDestination
= tabPage
->secondaryViewContainer()->url();
2053 capabilitiesDestination
= tabPage
->primaryViewContainer()->url();
2056 copyToOtherViewAction
->setEnabled(capabilitiesDestination
.isWritable());
2057 moveToOtherViewAction
->setEnabled(capabilitiesSource
.supportsMoving() && capabilitiesDestination
.isWritable());
2059 copyToOtherViewAction
->setEnabled(false);
2060 moveToOtherViewAction
->setEnabled(false);
2063 const bool enableMoveToTrash
= capabilitiesSource
.isLocal() && capabilitiesSource
.supportsMoving();
2065 renameAction
->setEnabled(capabilitiesSource
.supportsMoving());
2066 moveToTrashAction
->setEnabled(enableMoveToTrash
);
2067 deleteAction
->setEnabled(capabilitiesSource
.supportsDeleting());
2068 deleteWithTrashShortcut
->setEnabled(capabilitiesSource
.supportsDeleting() && !enableMoveToTrash
);
2069 cutAction
->setEnabled(capabilitiesSource
.supportsMoving());
2070 copyLocation
->setEnabled(list
.length() == 1);
2071 showTarget
->setEnabled(list
.length() == 1 && list
.at(0).isLink());
2072 duplicateAction
->setEnabled(capabilitiesSource
.supportsWriting());
2076 void DolphinMainWindow::updateViewActions()
2078 m_actionHandler
->updateViewActions();
2080 QAction
* toggleFilterBarAction
= actionCollection()->action(QStringLiteral("toggle_filter"));
2081 toggleFilterBarAction
->setChecked(m_activeViewContainer
->isFilterBarVisible());
2083 updateSplitAction();
2086 void DolphinMainWindow::updateGoActions()
2088 QAction
* goUpAction
= actionCollection()->action(KStandardAction::name(KStandardAction::Up
));
2089 const QUrl currentUrl
= m_activeViewContainer
->url();
2090 // I think this is one of the best places to firstly be confronted
2091 // with a file system and its hierarchy. Talking about the root
2092 // directory might seem too much here but it is the question that
2093 // naturally arises in this context.
2094 goUpAction
->setWhatsThis(xi18nc("@info:whatsthis", "<para>Go to "
2095 "the folder that contains the currently viewed one.</para>"
2096 "<para>All files and folders are organized in a hierarchical "
2097 "<emphasis>file system</emphasis>. At the top of this hierarchy is "
2098 "a directory that contains all data connected to this computer"
2099 "—the <emphasis>root directory</emphasis>.</para>"));
2100 goUpAction
->setEnabled(KIO::upUrl(currentUrl
) != currentUrl
);
2103 void DolphinMainWindow::refreshViews()
2105 m_tabWidget
->refreshViews();
2107 if (GeneralSettings::modifiedStartupSettings()) {
2108 updateWindowTitle();
2111 Q_EMIT
settingsChanged();
2114 void DolphinMainWindow::clearStatusBar()
2116 m_activeViewContainer
->statusBar()->resetToDefaultText();
2119 void DolphinMainWindow::connectViewSignals(DolphinViewContainer
* container
)
2121 connect(container
, &DolphinViewContainer::showFilterBarChanged
,
2122 this, &DolphinMainWindow::updateFilterBarAction
);
2123 connect(container
, &DolphinViewContainer::writeStateChanged
,
2124 this, &DolphinMainWindow::slotWriteStateChanged
);
2125 connect(container
, &DolphinViewContainer::searchModeEnabledChanged
,
2126 this, &DolphinMainWindow::updateSearchAction
);
2128 const QAction
* toggleSearchAction
= actionCollection()->action(QStringLiteral("toggle_search"));
2129 connect(toggleSearchAction
, &QAction::triggered
, container
, &DolphinViewContainer::setSearchModeEnabled
);
2131 const DolphinView
* view
= container
->view();
2132 connect(view
, &DolphinView::selectionChanged
,
2133 this, &DolphinMainWindow::slotSelectionChanged
);
2134 connect(view
, &DolphinView::requestItemInfo
,
2135 this, &DolphinMainWindow::requestItemInfo
);
2136 connect(view
, &DolphinView::fileItemsChanged
,
2137 this, &DolphinMainWindow::fileItemsChanged
);
2138 connect(view
, &DolphinView::tabRequested
,
2139 this, &DolphinMainWindow::openNewTab
);
2140 connect(view
, &DolphinView::requestContextMenu
,
2141 this, &DolphinMainWindow::openContextMenu
);
2142 connect(view
, &DolphinView::directoryLoadingStarted
,
2143 this, &DolphinMainWindow::enableStopAction
);
2144 connect(view
, &DolphinView::directoryLoadingCompleted
,
2145 this, &DolphinMainWindow::disableStopAction
);
2146 connect(view
, &DolphinView::directoryLoadingCompleted
,
2147 this, &DolphinMainWindow::slotDirectoryLoadingCompleted
);
2148 connect(view
, &DolphinView::goBackRequested
,
2149 this, &DolphinMainWindow::goBack
);
2150 connect(view
, &DolphinView::goForwardRequested
,
2151 this, &DolphinMainWindow::goForward
);
2152 connect(view
, &DolphinView::urlActivated
,
2153 this, &DolphinMainWindow::handleUrl
);
2154 connect(view
, &DolphinView::goUpRequested
,
2155 this, &DolphinMainWindow::goUp
);
2157 connect(container
->urlNavigatorInternalWithHistory(), &KUrlNavigator::urlChanged
,
2158 this, &DolphinMainWindow::changeUrl
);
2159 connect(container
->urlNavigatorInternalWithHistory(), &KUrlNavigator::historyChanged
,
2160 this, &DolphinMainWindow::updateHistory
);
2162 auto navigators
= static_cast<DolphinNavigatorsWidgetAction
*>
2163 (actionCollection()->action(QStringLiteral("url_navigators")));
2164 const KUrlNavigator
*navigator
= m_tabWidget
->currentTabPage()->primaryViewActive() ?
2165 navigators
->primaryUrlNavigator() :
2166 navigators
->secondaryUrlNavigator();
2168 QAction
*editableLocactionAction
= actionCollection()->action(QStringLiteral("editable_location"));
2169 editableLocactionAction
->setChecked(navigator
->isUrlEditable());
2170 connect(navigator
, &KUrlNavigator::editableStateChanged
,
2171 this, &DolphinMainWindow::slotEditableStateChanged
);
2172 connect(navigator
, &KUrlNavigator::tabRequested
,
2173 this, &DolphinMainWindow::openNewTab
);
2177 void DolphinMainWindow::updateSplitAction()
2179 QAction
* splitAction
= actionCollection()->action(QStringLiteral("split_view"));
2180 const DolphinTabPage
* tabPage
= m_tabWidget
->currentTabPage();
2181 if (tabPage
->splitViewEnabled()) {
2182 if (GeneralSettings::closeActiveSplitView() ? tabPage
->primaryViewActive() : !tabPage
->primaryViewActive()) {
2183 splitAction
->setText(i18nc("@action:intoolbar Close left view", "Close"));
2184 splitAction
->setToolTip(i18nc("@info", "Close left view"));
2185 splitAction
->setIcon(QIcon::fromTheme(QStringLiteral("view-left-close")));
2187 splitAction
->setText(i18nc("@action:intoolbar Close right view", "Close"));
2188 splitAction
->setToolTip(i18nc("@info", "Close right view"));
2189 splitAction
->setIcon(QIcon::fromTheme(QStringLiteral("view-right-close")));
2192 splitAction
->setText(i18nc("@action:intoolbar Split view", "Split"));
2193 splitAction
->setToolTip(i18nc("@info", "Split view"));
2194 splitAction
->setIcon(QIcon::fromTheme(QStringLiteral("view-right-new")));
2198 void DolphinMainWindow::updateAllowedToolbarAreas()
2200 auto navigators
= static_cast<DolphinNavigatorsWidgetAction
*>
2201 (actionCollection()->action(QStringLiteral("url_navigators")));
2202 if (toolBar()->actions().contains(navigators
)) {
2203 toolBar()->setAllowedAreas(Qt::TopToolBarArea
| Qt::BottomToolBarArea
);
2204 if (toolBarArea(toolBar()) == Qt::LeftToolBarArea
||
2205 toolBarArea(toolBar()) == Qt::RightToolBarArea
) {
2206 addToolBar(Qt::TopToolBarArea
, toolBar());
2209 toolBar()->setAllowedAreas(Qt::AllToolBarAreas
);
2213 bool DolphinMainWindow::isKompareInstalled() const
2215 static bool initialized
= false;
2216 static bool installed
= false;
2218 // TODO: maybe replace this approach later by using a menu
2219 // plugin like kdiff3plugin.cpp
2220 installed
= !QStandardPaths::findExecutable(QStringLiteral("kompare")).isEmpty();
2226 void DolphinMainWindow::createPanelAction(const QIcon
& icon
,
2227 const QKeySequence
& shortcut
,
2228 QAction
* dockAction
,
2229 const QString
& actionName
)
2231 QAction
* panelAction
= actionCollection()->addAction(actionName
);
2232 panelAction
->setCheckable(true);
2233 panelAction
->setChecked(dockAction
->isChecked());
2234 panelAction
->setText(dockAction
->text());
2235 panelAction
->setIcon(icon
);
2236 actionCollection()->setDefaultShortcut(panelAction
, shortcut
);
2238 connect(panelAction
, &QAction::triggered
, dockAction
, &QAction::trigger
);
2239 connect(dockAction
, &QAction::toggled
, panelAction
, &QAction::setChecked
);
2242 void DolphinMainWindow::setupWhatsThis()
2245 menuBar()->setWhatsThis(xi18nc("@info:whatsthis", "<para>This is the "
2246 "<emphasis>Menubar</emphasis>. It provides access to commands and "
2247 "configuration options. Left-click on any of the menus on this "
2248 "bar to see its contents.</para><para>The Menubar can be hidden "
2249 "by unchecking <interface>Settings|Show Menubar</interface>. Then "
2250 "most of its contents become available through a <interface>Control"
2251 "</interface> button on the <emphasis>Toolbar</emphasis>.</para>"));
2252 toolBar()->setWhatsThis(xi18nc("@info:whatsthis", "<para>This is the "
2253 "<emphasis>Toolbar</emphasis>. It allows quick access to "
2254 "frequently used actions.</para><para>It is highly customizable. "
2255 "All items you see in the <interface>Control</interface> menu or "
2256 "in the <interface>Menubar</interface> can be placed on the "
2257 "Toolbar. Just right-click on it and select <interface>Configure "
2258 "Toolbars…</interface> or find this action in the <interface>"
2259 "Control</interface> or <interface>Settings</interface> menu."
2260 "</para><para>The location of the bar and the style of its "
2261 "buttons can also be changed in the right-click menu. Right-click "
2262 "a button if you want to show or hide its text.</para>"));
2263 m_tabWidget
->setWhatsThis(xi18nc("@info:whatsthis main view",
2264 "<para>Here you can see the <emphasis>folders</emphasis> and "
2265 "<emphasis>files</emphasis> that are at the location described in "
2266 "the <interface>Location Bar</interface> above. This area is the "
2267 "central part of this application where you navigate to the files "
2268 "you want to use.</para><para>For an elaborate and general "
2269 "introduction to this application <link "
2270 "url='https://userbase.kde.org/Dolphin/File_Management#Introduction_to_Dolphin'>"
2271 "click here</link>. This will open an introductory article from "
2272 "the <emphasis>KDE UserBase Wiki</emphasis>.</para><para>For brief "
2273 "explanations of all the features of this <emphasis>view</emphasis> "
2274 "<link url='help:/dolphin/dolphin-view.html'>click here</link> "
2275 "instead. This will open a page from the <emphasis>Handbook"
2276 "</emphasis> that covers the basics.</para>"));
2279 actionCollection()->action(KStandardAction::name(KStandardAction::KeyBindings
))
2280 ->setWhatsThis(xi18nc("@info:whatsthis","<para>This opens a window "
2281 "that lists the <emphasis>keyboard shortcuts</emphasis>.<nl/>"
2282 "There you can set up key combinations to trigger an action when "
2283 "they are pressed simultaneously. All commands in this application can "
2284 "be triggered this way.</para>"));
2285 actionCollection()->action(KStandardAction::name(KStandardAction::ConfigureToolbars
))
2286 ->setWhatsThis(xi18nc("@info:whatsthis","<para>This opens a window in which "
2287 "you can change which buttons appear on the <emphasis>Toolbar</emphasis>.</para>"
2288 "<para>All items you see in the <interface>Control</interface> menu "
2289 "or in the <interface>Menubar</interface> can also be placed on the Toolbar.</para>"));
2290 actionCollection()->action(KStandardAction::name(KStandardAction::Preferences
))
2291 ->setWhatsThis(xi18nc("@info:whatsthis","This opens a window where you can "
2292 "change a multitude of settings for this application. For an explanation "
2293 "of the various settings go to the chapter <emphasis>Configuring Dolphin"
2294 "</emphasis> in <interface>Help|Dolphin Handbook</interface>."));
2297 // The whatsthis has to be set for the m_helpMenu and for the
2298 // StandardAction separately because both are used in different locations.
2299 // m_helpMenu is only used for createControlButton() button.
2301 auto setStandardActionWhatsThis
= [this](KStandardAction::StandardAction actionId
,
2302 const QString
&whatsThis
) {
2303 if (auto *action
= actionCollection()->action(KStandardAction::name(actionId
))) {
2304 action
->setWhatsThis(whatsThis
);
2307 auto setHelpActionWhatsThis
= [this](KHelpMenu::MenuId menuId
, const QString
&whatsThis
) {
2308 if (auto *action
= m_helpMenu
->action(menuId
)) {
2309 action
->setWhatsThis(whatsThis
);
2313 // Links do not work within the Menubar so texts without links are provided there.
2315 // i18n: If the external link isn't available in your language you should
2316 // probably state the external link language at least in brackets to not
2317 // frustrate the user. If there are multiple languages that the user might
2318 // know with a reasonable chance you might want to have 2 external links.
2319 // The same is in my opinion true for every external link you translate.
2320 const QString whatsThisHelpContents
= xi18nc("@info:whatsthis handbook",
2321 "<para>This opens the Handbook for this application. It provides "
2322 "explanations for every part of <emphasis>Dolphin</emphasis>.</para>");
2323 setStandardActionWhatsThis(KStandardAction::HelpContents
, whatsThisHelpContents
2324 + xi18nc("@info:whatsthis second half of handbook hb text without link",
2325 "<para>If you want more elaborate introductions to the "
2326 "different features of <emphasis>Dolphin</emphasis> "
2327 "go to the KDE UserBase Wiki.</para>"));
2328 setHelpActionWhatsThis(KHelpMenu::menuHelpContents
, whatsThisHelpContents
2329 + xi18nc("@info:whatsthis second half of handbook text with link",
2330 "<para>If you want more elaborate introductions to the "
2331 "different features of <emphasis>Dolphin</emphasis> "
2332 "<link url='https://userbase.kde.org/Dolphin/File_Management'>click here</link>. "
2333 "It will open the dedicated page in the KDE UserBase Wiki.</para>"));
2335 const QString whatsThisWhatsThis
= xi18nc("@info:whatsthis whatsthis button",
2336 "<para>This is the button that invokes the help feature you are "
2337 "using right now! Click it, then click any component of this "
2338 "application to ask \"What's this?\" about it. The mouse cursor "
2339 "will change appearance if no help is available for a spot.</para>");
2340 setStandardActionWhatsThis(KStandardAction::WhatsThis
, whatsThisWhatsThis
2341 + xi18nc("@info:whatsthis second half of whatsthis button text without link",
2342 "<para>There are two other ways to get help for this application: The "
2343 "<interface>Dolphin Handbook</interface> in the <interface>Help"
2344 "</interface> menu and the <emphasis>KDE UserBase Wiki</emphasis> "
2345 "article about <emphasis>File Management</emphasis> online."
2346 "</para><para>The \"What's this?\" help is "
2347 "missing in most other windows so don't get too used to this.</para>"));
2348 setHelpActionWhatsThis(KHelpMenu::menuWhatsThis
, whatsThisWhatsThis
2349 + xi18nc("@info:whatsthis second half of whatsthis button text with link",
2350 "<para>There are two other ways to get help: "
2351 "The <link url='help:/dolphin/index.html'>Dolphin Handbook</link> and "
2352 "the <link url='https://userbase.kde.org/Dolphin/File_Management'>KDE "
2353 "UserBase Wiki</link>.</para><para>The \"What's this?\" help is "
2354 "missing in most other windows so don't get too used to this.</para>"));
2356 const QString whatsThisReportBug
= xi18nc("@info:whatsthis","<para>This opens a "
2357 "window that will guide you through reporting errors or flaws "
2358 "in this application or in other KDE software.</para>");
2359 setStandardActionWhatsThis(KStandardAction::ReportBug
, whatsThisReportBug
);
2360 setHelpActionWhatsThis(KHelpMenu::menuReportBug
, whatsThisReportBug
2361 + xi18nc("@info:whatsthis second half of reportbug text with link",
2362 "<para>High-quality bug reports are much appreciated. To learn "
2363 "how to make your bug report as effective as possible "
2364 "<link url='https://community.kde.org/Get_Involved/Bug_Reporting'>"
2365 "click here</link>.</para>"));
2367 const QString whatsThisDonate
= xi18nc("@info:whatsthis","<para>This opens a "
2368 "<emphasis>web page</emphasis> where you can donate to "
2369 "support the continued work on this application and many "
2370 "other projects by the <emphasis>KDE</emphasis> community.</para>"
2371 "<para>Donating is the easiest and fastest way to efficiently "
2372 "support KDE and its projects. KDE projects are available for "
2373 "free therefore your donation is needed to cover things that "
2374 "require money like servers, contributor meetings, etc.</para>"
2375 "<para><emphasis>KDE e.V.</emphasis> is the non-profit "
2376 "organization behind the KDE community.</para>");
2377 setStandardActionWhatsThis(KStandardAction::Donate
, whatsThisDonate
);
2378 setHelpActionWhatsThis(KHelpMenu::menuDonate
, whatsThisDonate
);
2380 const QString whatsThisSwitchLanguage
= xi18nc("@info:whatsthis",
2381 "With this you can change the language this application uses."
2382 "<nl/>You can even set secondary languages which will be used "
2383 "if texts are not available in your preferred language.");
2384 setStandardActionWhatsThis(KStandardAction::SwitchApplicationLanguage
,
2385 whatsThisSwitchLanguage
);
2386 setHelpActionWhatsThis(KHelpMenu::menuSwitchLanguage
, whatsThisSwitchLanguage
);
2388 const QString whatsThisAboutApp
= xi18nc("@info:whatsthis","This opens a "
2389 "window that informs you about the version, license, "
2390 "used libraries and maintainers of this application.");
2391 setStandardActionWhatsThis(KStandardAction::AboutApp
, whatsThisAboutApp
);
2392 setHelpActionWhatsThis(KHelpMenu::menuAboutApp
, whatsThisAboutApp
);
2394 const QString whatsThisAboutKDE
= xi18nc("@info:whatsthis","This opens a "
2395 "window with information about <emphasis>KDE</emphasis>. "
2396 "The KDE community are the people behind this free software."
2397 "<nl/>If you like using this application but don't know "
2398 "about KDE or want to see a cute dragon have a look!");
2399 setStandardActionWhatsThis(KStandardAction::AboutKDE
, whatsThisAboutKDE
);
2400 setHelpActionWhatsThis(KHelpMenu::menuAboutKDE
, whatsThisAboutKDE
);
2403 bool DolphinMainWindow::addHamburgerMenuToToolbar()
2405 QDomDocument domDocument
= KXMLGUIClient::domDocument();
2406 if (domDocument
.isNull()) {
2409 QDomNode toolbar
= domDocument
.elementsByTagName(QStringLiteral("ToolBar")).at(0);
2410 if (toolbar
.isNull()) {
2414 QDomElement hamburgerMenuElement
= domDocument
.createElement(QStringLiteral("Action"));
2415 hamburgerMenuElement
.setAttribute(QStringLiteral("name"), QStringLiteral("hamburger_menu"));
2416 toolbar
.appendChild(hamburgerMenuElement
);
2418 KXMLGUIFactory::saveConfigFile(domDocument
, xmlFile());
2422 // Make sure to also remove the <KXMLGUIFactory> and <QDomDocument> include
2423 // whenever this method is removed (maybe in the year ~2026).
2426 bool DolphinMainWindow::event(QEvent
*event
)
2428 if (event
->type() == QEvent::WhatsThisClicked
) {
2430 QWhatsThisClickedEvent
* whatsThisEvent
= dynamic_cast<QWhatsThisClickedEvent
*>(event
);
2431 QDesktopServices::openUrl(QUrl(whatsThisEvent
->href()));
2434 return KXmlGuiWindow::event(event
);
2437 bool DolphinMainWindow::eventFilter(QObject
* obj
, QEvent
* event
)
2440 if (event
->type() == QEvent::WhatsThisClicked
) {
2442 QWhatsThisClickedEvent
* whatsThisEvent
= dynamic_cast<QWhatsThisClickedEvent
*>(event
);
2443 QDesktopServices::openUrl(QUrl(whatsThisEvent
->href()));
2449 // Set a sane initial window size
2450 QSize
DolphinMainWindow::sizeHint() const
2452 return KXmlGuiWindow::sizeHint().expandedTo(QSize(760, 550));
2455 void DolphinMainWindow::saveNewToolbarConfig()
2457 KXmlGuiWindow::saveNewToolbarConfig(); // Applies the new config. This has to be called first
2458 // because the rest of this method decides things
2459 // based on the new config.
2460 auto navigators
= static_cast<DolphinNavigatorsWidgetAction
*>
2461 (actionCollection()->action(QStringLiteral("url_navigators")));
2462 if (!toolBar()->actions().contains(navigators
)) {
2463 m_tabWidget
->currentTabPage()->insertNavigatorsWidget(navigators
);
2465 updateAllowedToolbarAreas();
2466 (static_cast<KHamburgerMenu
*>(actionCollection()->action(KStandardAction::name(
2467 KStandardAction::HamburgerMenu
))))->hideActionsOf(toolBar());
2470 void DolphinMainWindow::focusTerminalPanel()
2472 if (m_terminalPanel
->isVisible()) {
2473 if (m_terminalPanel
->terminalHasFocus()) {
2474 m_activeViewContainer
->view()->setFocus(Qt::FocusReason::ShortcutFocusReason
);
2475 actionCollection()->action(QStringLiteral("focus_terminal_panel"))->setText(i18nc("@action:inmenu Tools", "Focus Terminal Panel"));
2477 m_terminalPanel
->setFocus(Qt::FocusReason::ShortcutFocusReason
);
2478 actionCollection()->action(QStringLiteral("focus_terminal_panel"))->setText(i18nc("@action:inmenu Tools", "Defocus Terminal Panel"));
2481 actionCollection()->action(QStringLiteral("show_terminal_panel"))->trigger();
2482 actionCollection()->action(QStringLiteral("focus_terminal_panel"))->setText(i18nc("@action:inmenu Tools", "Defocus Terminal Panel"));
2486 DolphinMainWindow::UndoUiInterface::UndoUiInterface() :
2487 KIO::FileUndoManager::UiInterface()
2491 DolphinMainWindow::UndoUiInterface::~UndoUiInterface()
2495 void DolphinMainWindow::UndoUiInterface::jobError(KIO::Job
* job
)
2497 DolphinMainWindow
* mainWin
= qobject_cast
<DolphinMainWindow
*>(parentWidget());
2499 DolphinViewContainer
* container
= mainWin
->activeViewContainer();
2500 container
->showMessage(job
->errorString(), DolphinViewContainer::Error
);
2502 KIO::FileUndoManager::UiInterface::jobError(job
);
2506 bool DolphinMainWindow::isUrlOpen(const QString
& url
)
2508 return m_tabWidget
->isUrlOpen(QUrl::fromUserInput((url
)));