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
);
221 DolphinMainWindow::~DolphinMainWindow()
223 // This fixes a crash on Wayland when closing the mainwindow while another dialog is open.
224 disconnect(QGuiApplication::clipboard(), &QClipboard::dataChanged
, this, &DolphinMainWindow::updatePasteAction
);
227 QVector
<DolphinViewContainer
*> DolphinMainWindow::viewContainers() const
229 QVector
<DolphinViewContainer
*> viewContainers
;
231 for (int i
= 0; i
< m_tabWidget
->count(); ++i
) {
232 DolphinTabPage
*tabPage
= m_tabWidget
->tabPageAt(i
);
234 viewContainers
<< tabPage
->primaryViewContainer();
235 if (tabPage
->splitViewEnabled()) {
236 viewContainers
<< tabPage
->secondaryViewContainer();
239 return viewContainers
;
242 void DolphinMainWindow::setViewsWithInvalidPathsToHome()
244 const QVector
<DolphinViewContainer
*> theViewContainers
= viewContainers();
245 for (DolphinViewContainer
*viewContainer
: theViewContainers
) {
247 // Only consider local dirs, not remote locations and abstract protocols
248 if (viewContainer
->url().isLocalFile()) {
249 if (!QFileInfo::exists(viewContainer
->url().toLocalFile())) {
250 viewContainer
->setUrl(QUrl::fromLocalFile(QDir::homePath()));
256 void DolphinMainWindow::openDirectories(const QList
<QUrl
>& dirs
, bool splitView
)
258 m_tabWidget
->openDirectories(dirs
, splitView
);
261 void DolphinMainWindow::openDirectories(const QStringList
& dirs
, bool splitView
)
263 openDirectories(QUrl::fromStringList(dirs
), splitView
);
266 void DolphinMainWindow::openFiles(const QList
<QUrl
>& files
, bool splitView
)
268 m_tabWidget
->openFiles(files
, splitView
);
271 bool DolphinMainWindow::isFoldersPanelEnabled() const
273 return actionCollection()->action(QStringLiteral("show_folders_panel"))->isChecked();
276 bool DolphinMainWindow::isInformationPanelEnabled() const
279 return actionCollection()->action(QStringLiteral("show_information_panel"))->isChecked();
285 void DolphinMainWindow::openFiles(const QStringList
& files
, bool splitView
)
287 openFiles(QUrl::fromStringList(files
), splitView
);
290 void DolphinMainWindow::activateWindow()
292 window()->setAttribute(Qt::WA_NativeWindow
, true);
293 KStartupInfo::setNewStartupId(window()->windowHandle(), KStartupInfo::startupId());
294 KWindowSystem::activateWindow(window()->effectiveWinId());
297 void DolphinMainWindow::showCommand(CommandType command
)
299 DolphinStatusBar
* statusBar
= m_activeViewContainer
->statusBar();
301 case KIO::FileUndoManager::Copy
:
302 statusBar
->setText(i18nc("@info:status", "Successfully copied."));
304 case KIO::FileUndoManager::Move
:
305 statusBar
->setText(i18nc("@info:status", "Successfully moved."));
307 case KIO::FileUndoManager::Link
:
308 statusBar
->setText(i18nc("@info:status", "Successfully linked."));
310 case KIO::FileUndoManager::Trash
:
311 statusBar
->setText(i18nc("@info:status", "Successfully moved to trash."));
313 case KIO::FileUndoManager::Rename
:
314 statusBar
->setText(i18nc("@info:status", "Successfully renamed."));
317 case KIO::FileUndoManager::Mkdir
:
318 statusBar
->setText(i18nc("@info:status", "Created folder."));
326 void DolphinMainWindow::pasteIntoFolder()
328 m_activeViewContainer
->view()->pasteIntoFolder();
331 void DolphinMainWindow::changeUrl(const QUrl
&url
)
333 if (!KProtocolManager::supportsListing(url
)) {
334 // The URL navigator only checks for validity, not
335 // if the URL can be listed. An error message is
336 // shown due to DolphinViewContainer::restoreView().
340 m_activeViewContainer
->setUrl(url
);
341 updateFileAndEditActions();
346 Q_EMIT
urlChanged(url
);
349 void DolphinMainWindow::slotTerminalDirectoryChanged(const QUrl
& url
)
351 if (m_tearDownFromPlacesRequested
&& url
== QUrl::fromLocalFile(QDir::homePath())) {
352 m_placesPanel
->proceedWithTearDown();
353 m_tearDownFromPlacesRequested
= false;
356 m_activeViewContainer
->setAutoGrabFocus(false);
358 m_activeViewContainer
->setAutoGrabFocus(true);
361 void DolphinMainWindow::slotEditableStateChanged(bool editable
)
363 KToggleAction
* editableLocationAction
=
364 static_cast<KToggleAction
*>(actionCollection()->action(QStringLiteral("editable_location")));
365 editableLocationAction
->setChecked(editable
);
368 void DolphinMainWindow::slotSelectionChanged(const KFileItemList
& selection
)
370 updateFileAndEditActions();
372 const int selectedUrlsCount
= m_tabWidget
->currentTabPage()->selectedItemsCount();
374 QAction
* compareFilesAction
= actionCollection()->action(QStringLiteral("compare_files"));
375 if (selectedUrlsCount
== 2) {
376 compareFilesAction
->setEnabled(isKompareInstalled());
378 compareFilesAction
->setEnabled(false);
381 Q_EMIT
selectionChanged(selection
);
384 void DolphinMainWindow::updateHistory()
386 const KUrlNavigator
*urlNavigator
= m_activeViewContainer
->urlNavigatorInternalWithHistory();
387 const int index
= urlNavigator
->historyIndex();
389 QAction
* backAction
= actionCollection()->action(KStandardAction::name(KStandardAction::Back
));
391 backAction
->setToolTip(i18nc("@info", "Go back"));
392 backAction
->setWhatsThis(i18nc("@info:whatsthis go back", "Return to the previously viewed folder."));
393 backAction
->setEnabled(index
< urlNavigator
->historySize() - 1);
396 QAction
* forwardAction
= actionCollection()->action(KStandardAction::name(KStandardAction::Forward
));
398 forwardAction
->setToolTip(i18nc("@info", "Go forward"));
399 forwardAction
->setWhatsThis(xi18nc("@info:whatsthis go forward",
400 "This undoes a <interface>Go|Back</interface> action."));
401 forwardAction
->setEnabled(index
> 0);
405 void DolphinMainWindow::updateFilterBarAction(bool show
)
407 QAction
* toggleFilterBarAction
= actionCollection()->action(QStringLiteral("toggle_filter"));
408 toggleFilterBarAction
->setChecked(show
);
411 void DolphinMainWindow::openNewMainWindow()
413 Dolphin::openNewWindow({m_activeViewContainer
->url()}, this);
416 void DolphinMainWindow::openNewActivatedTab()
418 // keep browsers compatibility, new tab is always after last one
419 auto openNewTabAfterLastTabConfigured
= GeneralSettings::openNewTabAfterLastTab();
420 GeneralSettings::setOpenNewTabAfterLastTab(true);
421 m_tabWidget
->openNewActivatedTab();
422 GeneralSettings::setOpenNewTabAfterLastTab(openNewTabAfterLastTabConfigured
);
425 void DolphinMainWindow::addToPlaces()
430 // If nothing is selected, act on the current dir
431 if (m_activeViewContainer
->view()->selectedItems().isEmpty()) {
432 url
= m_activeViewContainer
->url();
433 name
= m_activeViewContainer
->placesText();
435 const auto dirToAdd
= m_activeViewContainer
->view()->selectedItems().first();
436 url
= dirToAdd
.url();
437 name
= dirToAdd
.name();
440 PlacesItemModel model
;
442 if (m_activeViewContainer
->isSearchModeEnabled()) {
443 icon
= QStringLiteral("folder-saved-search-symbolic");
445 icon
= KIO::iconNameForUrl(url
);
447 model
.createPlacesItem(name
, url
, icon
);
451 void DolphinMainWindow::openNewTab(const QUrl
& url
)
453 m_tabWidget
->openNewTab(url
, QUrl());
456 void DolphinMainWindow::openInNewTab()
458 const KFileItemList
& list
= m_activeViewContainer
->view()->selectedItems();
459 bool tabCreated
= false;
461 for (const KFileItem
& item
: list
) {
462 const QUrl
& url
= DolphinView::openItemAsFolderUrl(item
);
463 if (!url
.isEmpty()) {
469 // if no new tab has been created from the selection
470 // open the current directory in a new tab
472 openNewTab(m_activeViewContainer
->url());
476 void DolphinMainWindow::openInNewWindow()
480 const KFileItemList list
= m_activeViewContainer
->view()->selectedItems();
481 if (list
.isEmpty()) {
482 newWindowUrl
= m_activeViewContainer
->url();
483 } else if (list
.count() == 1) {
484 const KFileItem
& item
= list
.first();
485 newWindowUrl
= DolphinView::openItemAsFolderUrl(item
);
488 if (!newWindowUrl
.isEmpty()) {
489 Dolphin::openNewWindow({newWindowUrl
}, this);
493 void DolphinMainWindow::showTarget()
495 const auto link
= m_activeViewContainer
->view()->selectedItems().at(0);
496 const auto linkLocationDir
= QFileInfo(link
.localPath()).absoluteDir();
497 auto linkDestination
= link
.linkDest();
498 if (QFileInfo(linkDestination
).isRelative()) {
499 linkDestination
= linkLocationDir
.filePath(linkDestination
);
501 if (QFileInfo::exists(linkDestination
)) {
502 KIO::highlightInFileManager({QUrl::fromLocalFile(linkDestination
).adjusted(QUrl::StripTrailingSlash
)});
504 m_activeViewContainer
->showMessage(xi18nc("@info", "Could not access <filename>%1</filename>.", linkDestination
),
505 DolphinViewContainer::Warning
);
509 void DolphinMainWindow::showEvent(QShowEvent
* event
)
511 KXmlGuiWindow::showEvent(event
);
513 if (!event
->spontaneous()) {
514 m_activeViewContainer
->view()->setFocus();
518 void DolphinMainWindow::closeEvent(QCloseEvent
* event
)
520 // Find out if Dolphin is closed directly by the user or
521 // by the session manager because the session is closed
522 bool closedByUser
= true;
523 if (qApp
->isSavingSession()) {
524 closedByUser
= false;
527 if (m_tabWidget
->count() > 1
528 && GeneralSettings::confirmClosingMultipleTabs()
529 && !GeneralSettings::rememberOpenedTabs()
531 // Ask the user if he really wants to quit and close all tabs.
532 // Open a confirmation dialog with 3 buttons:
533 // QDialogButtonBox::Yes -> Quit
534 // QDialogButtonBox::No -> Close only the current tab
535 // QDialogButtonBox::Cancel -> do nothing
536 QDialog
*dialog
= new QDialog(this, Qt::Dialog
);
537 dialog
->setWindowTitle(i18nc("@title:window", "Confirmation"));
538 dialog
->setModal(true);
539 QDialogButtonBox
* buttons
= new QDialogButtonBox(QDialogButtonBox::Yes
| QDialogButtonBox::No
| QDialogButtonBox::Cancel
);
540 KGuiItem::assign(buttons
->button(QDialogButtonBox::Yes
), KGuiItem(i18nc("@action:button 'Quit Dolphin' button", "&Quit %1", QGuiApplication::applicationDisplayName()), QIcon::fromTheme(QStringLiteral("application-exit"))));
541 KGuiItem::assign(buttons
->button(QDialogButtonBox::No
), KGuiItem(i18n("C&lose Current Tab"), QIcon::fromTheme(QStringLiteral("tab-close"))));
542 KGuiItem::assign(buttons
->button(QDialogButtonBox::Cancel
), KStandardGuiItem::cancel());
543 buttons
->button(QDialogButtonBox::Yes
)->setDefault(true);
545 bool doNotAskAgainCheckboxResult
= false;
547 const auto result
= KMessageBox::createKMessageBox(dialog
,
549 QMessageBox::Warning
,
550 i18n("You have multiple tabs open in this window, are you sure you want to quit?"),
552 i18n("Do not ask again"),
553 &doNotAskAgainCheckboxResult
,
554 KMessageBox::Notify
);
556 if (doNotAskAgainCheckboxResult
) {
557 GeneralSettings::setConfirmClosingMultipleTabs(false);
561 case QDialogButtonBox::Yes
:
564 case QDialogButtonBox::No
:
565 // Close only the current tab
566 m_tabWidget
->closeTab();
574 if (m_terminalPanel
&& m_terminalPanel
->hasProgramRunning() && GeneralSettings::confirmClosingTerminalRunningProgram() && closedByUser
) {
575 // Ask if the user really wants to quit Dolphin with a program that is still running in the Terminal panel
576 // Open a confirmation dialog with 3 buttons:
577 // QDialogButtonBox::Yes -> Quit
578 // QDialogButtonBox::No -> Show Terminal Panel
579 // QDialogButtonBox::Cancel -> do nothing
580 QDialog
*dialog
= new QDialog(this, Qt::Dialog
);
581 dialog
->setWindowTitle(i18nc("@title:window", "Confirmation"));
582 dialog
->setModal(true);
583 auto standardButtons
= QDialogButtonBox::Yes
| QDialogButtonBox::Cancel
;
584 if (!m_terminalPanel
->isVisible()) {
585 standardButtons
|= QDialogButtonBox::No
;
587 QDialogButtonBox
*buttons
= new QDialogButtonBox(standardButtons
);
588 KGuiItem::assign(buttons
->button(QDialogButtonBox::Yes
), KStandardGuiItem::quit());
589 if (!m_terminalPanel
->isVisible()) {
591 buttons
->button(QDialogButtonBox::No
),
592 KGuiItem(i18n("Show &Terminal Panel"), QIcon::fromTheme(QStringLiteral("dialog-scripts"))));
594 KGuiItem::assign(buttons
->button(QDialogButtonBox::Cancel
), KStandardGuiItem::cancel());
596 bool doNotAskAgainCheckboxResult
= false;
598 const auto result
= KMessageBox::createKMessageBox(
601 QMessageBox::Warning
,
602 i18n("The program '%1' is still running in the Terminal panel. Are you sure you want to quit?", m_terminalPanel
->runningProgramName()),
604 i18n("Do not ask again"),
605 &doNotAskAgainCheckboxResult
,
606 KMessageBox::Dangerous
);
608 if (doNotAskAgainCheckboxResult
) {
609 GeneralSettings::setConfirmClosingTerminalRunningProgram(false);
613 case QDialogButtonBox::Yes
:
616 case QDialogButtonBox::No
:
617 actionCollection()->action("show_terminal_panel")->trigger();
618 // Do not quit, ignore quit event
626 if (GeneralSettings::rememberOpenedTabs()) {
627 KConfigGui::setSessionConfig(QStringLiteral("dolphin"), QStringLiteral("dolphin"));
628 KConfig
*config
= KConfigGui::sessionConfig();
629 saveGlobalProperties(config
);
630 savePropertiesInternal(config
, 1);
634 GeneralSettings::setVersion(CurrentDolphinVersion
);
635 GeneralSettings::self()->save();
637 KXmlGuiWindow::closeEvent(event
);
640 void DolphinMainWindow::saveProperties(KConfigGroup
& group
)
642 m_tabWidget
->saveProperties(group
);
645 void DolphinMainWindow::readProperties(const KConfigGroup
& group
)
647 m_tabWidget
->readProperties(group
);
650 void DolphinMainWindow::updateNewMenu()
652 m_newFileMenu
->setViewShowsHiddenFiles(activeViewContainer()->view()->hiddenFilesShown());
653 m_newFileMenu
->checkUpToDate();
654 m_newFileMenu
->setPopupFiles(QList
<QUrl
>() << activeViewContainer()->url());
657 void DolphinMainWindow::createDirectory()
659 m_newFileMenu
->setViewShowsHiddenFiles(activeViewContainer()->view()->hiddenFilesShown());
660 m_newFileMenu
->setPopupFiles(QList
<QUrl
>() << activeViewContainer()->url());
661 m_newFileMenu
->createDirectory();
664 void DolphinMainWindow::quit()
669 void DolphinMainWindow::showErrorMessage(const QString
& message
)
671 m_activeViewContainer
->showMessage(message
, DolphinViewContainer::Error
);
674 void DolphinMainWindow::slotUndoAvailable(bool available
)
676 QAction
* undoAction
= actionCollection()->action(KStandardAction::name(KStandardAction::Undo
));
678 undoAction
->setEnabled(available
);
682 void DolphinMainWindow::slotUndoTextChanged(const QString
& text
)
684 QAction
* undoAction
= actionCollection()->action(KStandardAction::name(KStandardAction::Undo
));
686 undoAction
->setText(text
);
690 void DolphinMainWindow::undo()
693 KIO::FileUndoManager::self()->uiInterface()->setParentWidget(this);
694 KIO::FileUndoManager::self()->undo();
697 void DolphinMainWindow::cut()
699 m_activeViewContainer
->view()->cutSelectedItemsToClipboard();
702 void DolphinMainWindow::copy()
704 m_activeViewContainer
->view()->copySelectedItemsToClipboard();
707 void DolphinMainWindow::paste()
709 m_activeViewContainer
->view()->paste();
712 void DolphinMainWindow::find()
714 m_activeViewContainer
->setSearchModeEnabled(true);
717 void DolphinMainWindow::updateSearchAction()
719 QAction
* toggleSearchAction
= actionCollection()->action(QStringLiteral("toggle_search"));
720 toggleSearchAction
->setChecked(m_activeViewContainer
->isSearchModeEnabled());
723 void DolphinMainWindow::updatePasteAction()
725 QAction
* pasteAction
= actionCollection()->action(KStandardAction::name(KStandardAction::Paste
));
726 QPair
<bool, QString
> pasteInfo
= m_activeViewContainer
->view()->pasteInfo();
727 pasteAction
->setEnabled(pasteInfo
.first
);
728 pasteAction
->setText(pasteInfo
.second
);
731 void DolphinMainWindow::slotDirectoryLoadingCompleted()
736 void DolphinMainWindow::slotToolBarActionMiddleClicked(QAction
*action
)
738 if (action
== actionCollection()->action(KStandardAction::name(KStandardAction::Back
))) {
740 } else if (action
== actionCollection()->action(KStandardAction::name(KStandardAction::Forward
))) {
742 } else if (action
== actionCollection()->action(QStringLiteral("go_up"))) {
744 } else if (action
== actionCollection()->action(QStringLiteral("go_home"))) {
749 void DolphinMainWindow::slotAboutToShowBackPopupMenu()
751 const KUrlNavigator
*urlNavigator
= m_activeViewContainer
->urlNavigatorInternalWithHistory();
753 m_backAction
->menu()->clear();
754 for (int i
= urlNavigator
->historyIndex() + 1; i
< urlNavigator
->historySize() && entries
< MaxNumberOfNavigationentries
; ++i
, ++entries
) {
755 QAction
* action
= new QAction(urlNavigator
->locationUrl(i
).toString(QUrl::PreferLocalFile
), m_backAction
->menu());
757 m_backAction
->menu()->addAction(action
);
761 void DolphinMainWindow::slotGoBack(QAction
* action
)
763 int gotoIndex
= action
->data().value
<int>();
764 const KUrlNavigator
*urlNavigator
= m_activeViewContainer
->urlNavigatorInternalWithHistory();
765 for (int i
= gotoIndex
- urlNavigator
->historyIndex(); i
> 0; --i
) {
770 void DolphinMainWindow::slotBackForwardActionMiddleClicked(QAction
* action
)
773 const KUrlNavigator
*urlNavigator
= activeViewContainer()->urlNavigatorInternalWithHistory();
774 openNewTab(urlNavigator
->locationUrl(action
->data().value
<int>()));
778 void DolphinMainWindow::slotAboutToShowForwardPopupMenu()
780 const KUrlNavigator
*urlNavigator
= m_activeViewContainer
->urlNavigatorInternalWithHistory();
782 m_forwardAction
->menu()->clear();
783 for (int i
= urlNavigator
->historyIndex() - 1; i
>= 0 && entries
< MaxNumberOfNavigationentries
; --i
, ++entries
) {
784 QAction
* action
= new QAction(urlNavigator
->locationUrl(i
).toString(QUrl::PreferLocalFile
), m_forwardAction
->menu());
786 m_forwardAction
->menu()->addAction(action
);
790 void DolphinMainWindow::slotGoForward(QAction
* action
)
792 int gotoIndex
= action
->data().value
<int>();
793 const KUrlNavigator
*urlNavigator
= m_activeViewContainer
->urlNavigatorInternalWithHistory();
794 for (int i
= urlNavigator
->historyIndex() - gotoIndex
; i
> 0; --i
) {
799 void DolphinMainWindow::selectAll()
803 // if the URL navigator is editable and focused, select the whole
804 // URL instead of all items of the view
806 KUrlNavigator
* urlNavigator
= m_activeViewContainer
->urlNavigator();
807 QLineEdit
* lineEdit
= urlNavigator
->editor()->lineEdit();
808 const bool selectUrl
= urlNavigator
->isUrlEditable() &&
809 lineEdit
->hasFocus();
811 lineEdit
->selectAll();
813 m_activeViewContainer
->view()->selectAll();
817 void DolphinMainWindow::invertSelection()
820 m_activeViewContainer
->view()->invertSelection();
823 void DolphinMainWindow::toggleSplitView()
825 DolphinTabPage
* tabPage
= m_tabWidget
->currentTabPage();
826 tabPage
->setSplitViewEnabled(!tabPage
->splitViewEnabled(), WithAnimation
);
831 void DolphinMainWindow::toggleSplitStash()
833 DolphinTabPage
* tabPage
= m_tabWidget
->currentTabPage();
834 tabPage
->setSplitViewEnabled(false, WithAnimation
);
835 tabPage
->setSplitViewEnabled(true, WithAnimation
, QUrl("stash:/"));
838 void DolphinMainWindow::reloadView()
841 m_activeViewContainer
->reload();
842 m_activeViewContainer
->statusBar()->updateSpaceInfo();
845 void DolphinMainWindow::stopLoading()
847 m_activeViewContainer
->view()->stopLoading();
850 void DolphinMainWindow::enableStopAction()
852 actionCollection()->action(QStringLiteral("stop"))->setEnabled(true);
855 void DolphinMainWindow::disableStopAction()
857 actionCollection()->action(QStringLiteral("stop"))->setEnabled(false);
860 void DolphinMainWindow::showFilterBar()
862 m_activeViewContainer
->setFilterBarVisible(true);
865 void DolphinMainWindow::toggleFilterBar()
867 const bool checked
= !m_activeViewContainer
->isFilterBarVisible();
868 m_activeViewContainer
->setFilterBarVisible(checked
);
870 QAction
* toggleFilterBarAction
= actionCollection()->action(QStringLiteral("toggle_filter"));
871 toggleFilterBarAction
->setChecked(checked
);
874 void DolphinMainWindow::toggleEditLocation()
878 QAction
* action
= actionCollection()->action(QStringLiteral("editable_location"));
879 KUrlNavigator
* urlNavigator
= m_activeViewContainer
->urlNavigator();
880 urlNavigator
->setUrlEditable(action
->isChecked());
883 void DolphinMainWindow::replaceLocation()
885 KUrlNavigator
* navigator
= m_activeViewContainer
->urlNavigator();
886 QLineEdit
* lineEdit
= navigator
->editor()->lineEdit();
888 // If the text field currently has focus and everything is selected,
889 // pressing the keyboard shortcut returns the whole thing to breadcrumb mode
890 if (navigator
->isUrlEditable()
891 && lineEdit
->hasFocus()
892 && lineEdit
->selectedText() == lineEdit
->text() ) {
893 navigator
->setUrlEditable(false);
895 navigator
->setUrlEditable(true);
896 navigator
->setFocus();
897 lineEdit
->selectAll();
901 void DolphinMainWindow::togglePanelLockState()
903 const bool newLockState
= !GeneralSettings::lockPanels();
904 const auto childrenObjects
= children();
905 for (QObject
* child
: childrenObjects
) {
906 DolphinDockWidget
* dock
= qobject_cast
<DolphinDockWidget
*>(child
);
908 dock
->setLocked(newLockState
);
912 GeneralSettings::setLockPanels(newLockState
);
915 void DolphinMainWindow::slotTerminalPanelVisibilityChanged()
917 if (m_terminalPanel
->isHiddenInVisibleWindow() && m_activeViewContainer
) {
918 m_activeViewContainer
->view()->setFocus();
922 void DolphinMainWindow::goBack()
924 DolphinUrlNavigator
*urlNavigator
= m_activeViewContainer
->urlNavigatorInternalWithHistory();
925 urlNavigator
->goBack();
927 if (urlNavigator
->locationState().isEmpty()) {
928 // An empty location state indicates a redirection URL,
929 // which must be skipped too
930 urlNavigator
->goBack();
934 void DolphinMainWindow::goForward()
936 m_activeViewContainer
->urlNavigatorInternalWithHistory()->goForward();
939 void DolphinMainWindow::goUp()
941 m_activeViewContainer
->urlNavigatorInternalWithHistory()->goUp();
944 void DolphinMainWindow::goHome()
946 m_activeViewContainer
->urlNavigatorInternalWithHistory()->goHome();
949 void DolphinMainWindow::goBackInNewTab()
951 const KUrlNavigator
* urlNavigator
= activeViewContainer()->urlNavigatorInternalWithHistory();
952 const int index
= urlNavigator
->historyIndex() + 1;
953 openNewTab(urlNavigator
->locationUrl(index
));
956 void DolphinMainWindow::goForwardInNewTab()
958 const KUrlNavigator
* urlNavigator
= activeViewContainer()->urlNavigatorInternalWithHistory();
959 const int index
= urlNavigator
->historyIndex() - 1;
960 openNewTab(urlNavigator
->locationUrl(index
));
963 void DolphinMainWindow::goUpInNewTab()
965 const QUrl currentUrl
= activeViewContainer()->urlNavigator()->locationUrl();
966 openNewTab(KIO::upUrl(currentUrl
));
969 void DolphinMainWindow::goHomeInNewTab()
971 openNewTab(Dolphin::homeUrl());
974 void DolphinMainWindow::compareFiles()
976 const KFileItemList items
= m_tabWidget
->currentTabPage()->selectedItems();
977 if (items
.count() != 2) {
978 // The action is disabled in this case, but it could have been triggered
979 // via D-Bus, see https://bugs.kde.org/show_bug.cgi?id=325517
983 QUrl urlA
= items
.at(0).url();
984 QUrl urlB
= items
.at(1).url();
986 QString
command(QStringLiteral("kompare -c \""));
987 command
.append(urlA
.toDisplayString(QUrl::PreferLocalFile
));
988 command
.append("\" \"");
989 command
.append(urlB
.toDisplayString(QUrl::PreferLocalFile
));
990 command
.append('\"');
992 KIO::CommandLauncherJob
*job
= new KIO::CommandLauncherJob(command
, this);
993 job
->setDesktopName(QStringLiteral("org.kde.kompare"));
997 void DolphinMainWindow::toggleShowMenuBar()
999 const bool visible
= menuBar()->isVisible();
1000 menuBar()->setVisible(!visible
);
1003 QPointer
<QAction
> DolphinMainWindow::preferredSearchTool()
1005 m_searchTools
.clear();
1006 KMoreToolsMenuFactory("dolphin/search-tools").fillMenuFromGroupingNames(
1007 &m_searchTools
, { "files-find" }, m_activeViewContainer
->url()
1009 QList
<QAction
*> actions
= m_searchTools
.actions();
1010 if (actions
.isEmpty()) {
1013 QAction
* action
= actions
.first();
1014 if (action
->isSeparator()) {
1020 void DolphinMainWindow::updateOpenPreferredSearchToolAction()
1022 QAction
* openPreferredSearchTool
= actionCollection()->action(QStringLiteral("open_preferred_search_tool"));
1023 if (!openPreferredSearchTool
) {
1026 QPointer
<QAction
> tool
= preferredSearchTool();
1028 openPreferredSearchTool
->setVisible(true);
1029 openPreferredSearchTool
->setText(i18nc("@action:inmenu Tools", "Open %1", tool
->text()));
1030 openPreferredSearchTool
->setIcon(tool
->icon());
1032 openPreferredSearchTool
->setVisible(false);
1033 // still visible in Shortcuts configuration window
1034 openPreferredSearchTool
->setText(i18nc("@action:inmenu Tools", "Open Preferred Search Tool"));
1035 openPreferredSearchTool
->setIcon(QIcon::fromTheme(QStringLiteral("search")));
1039 void DolphinMainWindow::openPreferredSearchTool()
1041 QPointer
<QAction
> tool
= preferredSearchTool();
1047 void DolphinMainWindow::openTerminal()
1049 const QUrl url
= m_activeViewContainer
->url();
1051 if (url
.isLocalFile()) {
1052 KToolInvocation::invokeTerminal(QString(), {}, url
.toLocalFile());
1056 // Not a local file, with protocol Class ":local", try stat'ing
1057 if (KProtocolInfo::protocolClass(url
.scheme()) == QLatin1String(":local")) {
1058 KIO::StatJob
*job
= KIO::mostLocalUrl(url
);
1059 KJobWidgets::setWindow(job
, this);
1060 connect(job
, &KJob::result
, this, [job
]() {
1062 if (!job
->error()) {
1063 statUrl
= job
->mostLocalUrl();
1066 KToolInvocation::invokeTerminal(QString(), {}, statUrl
.isLocalFile() ? statUrl
.toLocalFile() : QDir::homePath());
1072 // Nothing worked, just use $HOME
1073 KToolInvocation::invokeTerminal(QString(), {}, QDir::homePath());
1076 void DolphinMainWindow::editSettings()
1078 if (!m_settingsDialog
) {
1079 DolphinViewContainer
* container
= activeViewContainer();
1080 container
->view()->writeSettings();
1082 const QUrl url
= container
->url();
1083 DolphinSettingsDialog
* settingsDialog
= new DolphinSettingsDialog(url
, this, actionCollection());
1084 connect(settingsDialog
, &DolphinSettingsDialog::settingsChanged
, this, &DolphinMainWindow::refreshViews
);
1085 connect(settingsDialog
, &DolphinSettingsDialog::settingsChanged
,
1086 &DolphinUrlNavigatorsController::slotReadSettings
);
1087 settingsDialog
->setAttribute(Qt::WA_DeleteOnClose
);
1088 settingsDialog
->show();
1089 m_settingsDialog
= settingsDialog
;
1091 m_settingsDialog
.data()->raise();
1095 void DolphinMainWindow::handleUrl(const QUrl
& url
)
1097 delete m_lastHandleUrlOpenJob
;
1098 m_lastHandleUrlOpenJob
= nullptr;
1100 if (url
.isLocalFile() && QFileInfo(url
.toLocalFile()).isDir()) {
1101 activeViewContainer()->setUrl(url
);
1103 m_lastHandleUrlOpenJob
= new KIO::OpenUrlJob(url
);
1104 m_lastHandleUrlOpenJob
->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled
, this));
1105 m_lastHandleUrlOpenJob
->setShowOpenOrExecuteDialog(true);
1107 connect(m_lastHandleUrlOpenJob
, &KIO::OpenUrlJob::mimeTypeFound
, this,
1108 [this, url
](const QString
&mimetype
) {
1109 if (mimetype
== QLatin1String("inode/directory")) {
1110 // If it's a dir, we'll take it from here
1111 m_lastHandleUrlOpenJob
->kill();
1112 m_lastHandleUrlOpenJob
= nullptr;
1113 activeViewContainer()->setUrl(url
);
1117 connect(m_lastHandleUrlOpenJob
, &KIO::OpenUrlJob::result
, this, [this]() {
1118 m_lastHandleUrlOpenJob
= nullptr;
1121 m_lastHandleUrlOpenJob
->start();
1125 void DolphinMainWindow::slotWriteStateChanged(bool isFolderWritable
)
1127 // trash:/ is writable but we don't want to create new items in it.
1128 // TODO: remove the trash check once https://phabricator.kde.org/T8234 is implemented
1129 newFileMenu()->setEnabled(isFolderWritable
&& m_activeViewContainer
->url().scheme() != QLatin1String("trash"));
1132 void DolphinMainWindow::openContextMenu(const QPoint
& pos
,
1133 const KFileItem
& item
,
1135 const QList
<QAction
*>& customActions
)
1137 QPointer
<DolphinContextMenu
> contextMenu
= new DolphinContextMenu(this, pos
, item
, url
, &m_fileItemActions
);
1138 contextMenu
.data()->setCustomActions(customActions
);
1139 const DolphinContextMenu::Command command
= contextMenu
.data()->open();
1142 case DolphinContextMenu::OpenParentFolder
:
1143 changeUrl(KIO::upUrl(item
.url()));
1144 m_activeViewContainer
->view()->markUrlsAsSelected({item
.url()});
1145 m_activeViewContainer
->view()->markUrlAsCurrent(item
.url());
1148 case DolphinContextMenu::OpenParentFolderInNewWindow
:
1149 Dolphin::openNewWindow({item
.url()}, this, Dolphin::OpenNewWindowFlag::Select
);
1152 case DolphinContextMenu::OpenParentFolderInNewTab
:
1153 openNewTab(KIO::upUrl(item
.url()));
1156 case DolphinContextMenu::None
:
1161 // Delete the menu, unless it has been deleted in its own nested event loop already.
1163 contextMenu
->deleteLater();
1167 void DolphinMainWindow::updateHamburgerMenu()
1169 KActionCollection
* ac
= actionCollection();
1170 auto hamburgerMenu
= static_cast<KHamburgerMenu
*>(
1171 ac
->action(KStandardAction::name(KStandardAction::HamburgerMenu
)));
1172 auto menu
= hamburgerMenu
->menu();
1174 menu
= new QMenu(this);
1175 hamburgerMenu
->setMenu(menu
);
1176 hamburgerMenu
->hideActionsOf(ac
->action(QStringLiteral("basic_actions"))->menu());
1177 hamburgerMenu
->hideActionsOf(ac
->action(QStringLiteral("zoom"))->menu());
1181 const QList
<QAction
*> toolbarActions
= toolBar()->actions();
1183 if (!toolBar()->isVisible()) {
1184 // If neither the menu bar nor the toolbar are visible, these actions should be available.
1185 menu
->addAction(ac
->action(KStandardAction::name(KStandardAction::ShowMenubar
)));
1186 menu
->addAction(toolBarMenuAction());
1187 menu
->addSeparator();
1190 // This group of actions (until the next separator) contains all the most basic actions
1191 // necessary to use Dolphin effectively.
1192 menu
->addAction(ac
->action(QStringLiteral("go_back")));
1193 menu
->addAction(ac
->action(QStringLiteral("go_forward")));
1195 menu
->addMenu(m_newFileMenu
->menu());
1196 menu
->addAction(ac
->action(QStringLiteral("basic_actions")));
1197 menu
->addAction(ac
->action(KStandardAction::name(KStandardAction::Undo
)));
1198 if (!toolBar()->isVisible()
1199 || (!toolbarActions
.contains(ac
->action(QStringLiteral("toggle_search")))
1200 && !toolbarActions
.contains(ac
->action(QStringLiteral("open_preferred_search_tool"))))
1202 menu
->addAction(ac
->action(KStandardAction::name(KStandardAction::Find
)));
1203 // This way a search action will only be added if none of the three available
1204 // search actions is present on the toolbar.
1206 if (!toolBar()->isVisible()
1207 || !toolbarActions
.contains(ac
->action(QStringLiteral("toggle_filter")))
1209 menu
->addAction(ac
->action(QStringLiteral("show_filter_bar")));
1210 // This way a filter action will only be added if none of the two available
1211 // filter actions is present on the toolbar.
1213 menu
->addSeparator();
1215 // The second group of actions (up until the next separator) contains actions for opening
1216 // additional views to interact with the file system.
1217 menu
->addAction(ac
->action(QStringLiteral("file_new")));
1218 menu
->addAction(ac
->action(QStringLiteral("new_tab")));
1219 if (ac
->action(QStringLiteral("undo_close_tab"))->isEnabled()) {
1220 menu
->addAction(ac
->action(QStringLiteral("closed_tabs")));
1222 menu
->addAction(ac
->action(QStringLiteral("open_terminal")));
1223 menu
->addSeparator();
1225 // The third group contains actions to change what one sees in the view
1226 // and to change the more general UI.
1227 if (!toolBar()->isVisible()
1228 || (!toolbarActions
.contains(ac
->action(QStringLiteral("icons")))
1229 && !toolbarActions
.contains(ac
->action(QStringLiteral("compact")))
1230 && !toolbarActions
.contains(ac
->action(QStringLiteral("details")))
1231 && !toolbarActions
.contains(ac
->action(QStringLiteral("view_mode"))))
1233 menu
->addAction(ac
->action(QStringLiteral("view_mode")));
1235 menu
->addAction(ac
->action(QStringLiteral("show_hidden_files")));
1236 menu
->addAction(ac
->action(QStringLiteral("sort")));
1237 menu
->addAction(ac
->action(QStringLiteral("additional_info")));
1238 if (!GeneralSettings::showStatusBar() || !GeneralSettings::showZoomSlider()) {
1239 menu
->addAction(ac
->action(QStringLiteral("zoom")));
1241 menu
->addAction(ac
->action(QStringLiteral("panels")));
1243 // The "Configure" menu is not added to the actionCollection() because there is hardly
1244 // a good reason for users to put it on their toolbar.
1245 auto configureMenu
= menu
->addMenu(QIcon::fromTheme(QStringLiteral("configure")),
1246 i18nc("@action:inmenu menu for configure actions", "Configure"));
1247 configureMenu
->addAction(ac
->action(KStandardAction::name(KStandardAction::SwitchApplicationLanguage
)));
1248 configureMenu
->addAction(ac
->action(KStandardAction::name(KStandardAction::KeyBindings
)));
1249 configureMenu
->addAction(ac
->action(KStandardAction::name(KStandardAction::ConfigureToolbars
)));
1250 configureMenu
->addAction(ac
->action(KStandardAction::name(KStandardAction::Preferences
)));
1251 hamburgerMenu
->hideActionsOf(configureMenu
);
1254 void DolphinMainWindow::slotPlaceActivated(const QUrl
& url
)
1256 DolphinViewContainer
* view
= activeViewContainer();
1258 if (view
->url() == url
) {
1259 // We can end up here if the user clicked a device in the Places Panel
1260 // which had been unmounted earlier, see https://bugs.kde.org/show_bug.cgi?id=161385.
1263 view
->disableUrlNavigatorSelectionRequests();
1265 view
->enableUrlNavigatorSelectionRequests();
1269 void DolphinMainWindow::closedTabsCountChanged(unsigned int count
)
1271 actionCollection()->action(QStringLiteral("undo_close_tab"))->setEnabled(count
> 0);
1274 void DolphinMainWindow::activeViewChanged(DolphinViewContainer
* viewContainer
)
1276 DolphinViewContainer
* oldViewContainer
= m_activeViewContainer
;
1277 Q_ASSERT(viewContainer
);
1279 m_activeViewContainer
= viewContainer
;
1281 if (oldViewContainer
) {
1282 const QAction
* toggleSearchAction
= actionCollection()->action(QStringLiteral("toggle_search"));
1283 toggleSearchAction
->disconnect(oldViewContainer
);
1285 // Disconnect all signals between the old view container (container,
1286 // view and url navigator) and main window.
1287 oldViewContainer
->disconnect(this);
1288 oldViewContainer
->view()->disconnect(this);
1289 oldViewContainer
->urlNavigatorInternalWithHistory()->disconnect(this);
1290 auto navigators
= static_cast<DolphinNavigatorsWidgetAction
*>
1291 (actionCollection()->action(QStringLiteral("url_navigators")));
1292 navigators
->primaryUrlNavigator()->disconnect(this);
1293 if (auto secondaryUrlNavigator
= navigators
->secondaryUrlNavigator()) {
1294 secondaryUrlNavigator
->disconnect(this);
1297 // except the requestItemInfo so that on hover the information panel can still be updated
1298 connect(oldViewContainer
->view(), &DolphinView::requestItemInfo
,
1299 this, &DolphinMainWindow::requestItemInfo
);
1302 connectViewSignals(viewContainer
);
1304 m_actionHandler
->setCurrentView(viewContainer
->view());
1307 updateFileAndEditActions();
1308 updatePasteAction();
1309 updateViewActions();
1311 updateSearchAction();
1313 const QUrl url
= viewContainer
->url();
1314 Q_EMIT
urlChanged(url
);
1317 void DolphinMainWindow::tabCountChanged(int count
)
1319 const bool enableTabActions
= (count
> 1);
1320 for (int i
= 0; i
< MaxActivateTabShortcuts
; ++i
) {
1321 actionCollection()->action(QStringLiteral("activate_tab_%1").arg(i
))->setEnabled(enableTabActions
);
1323 actionCollection()->action(QStringLiteral("activate_last_tab"))->setEnabled(enableTabActions
);
1324 actionCollection()->action(QStringLiteral("activate_next_tab"))->setEnabled(enableTabActions
);
1325 actionCollection()->action(QStringLiteral("activate_prev_tab"))->setEnabled(enableTabActions
);
1328 void DolphinMainWindow::updateWindowTitle()
1330 const QString newTitle
= m_activeViewContainer
->captionWindowTitle();
1331 if (windowTitle() != newTitle
) {
1332 setWindowTitle(newTitle
);
1336 void DolphinMainWindow::slotStorageTearDownFromPlacesRequested(const QString
& mountPath
)
1338 connect(m_placesPanel
, &PlacesPanel::storageTearDownSuccessful
, this, [this, mountPath
]() {
1339 setViewsToHomeIfMountPathOpen(mountPath
);
1342 if (m_terminalPanel
&& m_terminalPanel
->currentWorkingDirectory().startsWith(mountPath
)) {
1343 m_tearDownFromPlacesRequested
= true;
1344 m_terminalPanel
->goHome();
1345 // m_placesPanel->proceedWithTearDown() will be called in slotTerminalDirectoryChanged
1347 m_placesPanel
->proceedWithTearDown();
1351 void DolphinMainWindow::slotStorageTearDownExternallyRequested(const QString
& mountPath
)
1353 connect(m_placesPanel
, &PlacesPanel::storageTearDownSuccessful
, this, [this, mountPath
]() {
1354 setViewsToHomeIfMountPathOpen(mountPath
);
1357 if (m_terminalPanel
&& m_terminalPanel
->currentWorkingDirectory().startsWith(mountPath
)) {
1358 m_tearDownFromPlacesRequested
= false;
1359 m_terminalPanel
->goHome();
1363 void DolphinMainWindow::setViewsToHomeIfMountPathOpen(const QString
& mountPath
)
1365 const QVector
<DolphinViewContainer
*> theViewContainers
= viewContainers();
1366 for (DolphinViewContainer
*viewContainer
: theViewContainers
) {
1367 if (viewContainer
&& viewContainer
->url().toLocalFile().startsWith(mountPath
)) {
1368 viewContainer
->setUrl(QUrl::fromLocalFile(QDir::homePath()));
1371 disconnect(m_placesPanel
, &PlacesPanel::storageTearDownSuccessful
, nullptr, nullptr);
1374 void DolphinMainWindow::setupActions()
1376 KStandardAction::hamburgerMenu(nullptr, nullptr, actionCollection());
1378 // setup 'File' menu
1379 m_newFileMenu
= new DolphinNewFileMenu(actionCollection(), this);
1380 QMenu
* menu
= m_newFileMenu
->menu();
1381 menu
->setTitle(i18nc("@title:menu Create new folder, file, link, etc.", "Create New"));
1382 menu
->setIcon(QIcon::fromTheme(QStringLiteral("list-add")));
1383 m_newFileMenu
->setPopupMode(QToolButton::InstantPopup
);
1384 connect(menu
, &QMenu::aboutToShow
,
1385 this, &DolphinMainWindow::updateNewMenu
);
1387 QAction
* newWindow
= KStandardAction::openNew(this, &DolphinMainWindow::openNewMainWindow
, actionCollection());
1388 newWindow
->setText(i18nc("@action:inmenu File", "New &Window"));
1389 newWindow
->setToolTip(i18nc("@info", "Open a new Dolphin window"));
1390 newWindow
->setWhatsThis(xi18nc("@info:whatsthis", "This opens a new "
1391 "window just like this one with the current location and view."
1392 "<nl/>You can drag and drop items between windows."));
1393 newWindow
->setIcon(QIcon::fromTheme(QStringLiteral("window-new")));
1395 QAction
* newTab
= actionCollection()->addAction(QStringLiteral("new_tab"));
1396 newTab
->setIcon(QIcon::fromTheme(QStringLiteral("tab-new")));
1397 newTab
->setText(i18nc("@action:inmenu File", "New Tab"));
1398 newTab
->setWhatsThis(xi18nc("@info:whatsthis", "This opens a new "
1399 "<emphasis>Tab</emphasis> with the current location and view.<nl/>"
1400 "A tab is an additional view within this window. "
1401 "You can drag and drop items between tabs."));
1402 actionCollection()->setDefaultShortcuts(newTab
, {Qt::CTRL
| Qt::Key_T
, Qt::CTRL
| Qt::SHIFT
| Qt::Key_N
});
1403 connect(newTab
, &QAction::triggered
, this, &DolphinMainWindow::openNewActivatedTab
);
1405 QAction
* addToPlaces
= actionCollection()->addAction(QStringLiteral("add_to_places"));
1406 addToPlaces
->setIcon(QIcon::fromTheme(QStringLiteral("bookmark-new")));
1407 addToPlaces
->setText(i18nc("@action:inmenu Add current folder to places", "Add to Places"));
1408 addToPlaces
->setWhatsThis(xi18nc("@info:whatsthis", "This adds the selected folder "
1409 "to the Places panel."));
1410 connect(addToPlaces
, &QAction::triggered
, this, &DolphinMainWindow::addToPlaces
);
1412 QAction
* closeTab
= KStandardAction::close(m_tabWidget
, QOverload
<>::of(&DolphinTabWidget::closeTab
), actionCollection());
1413 closeTab
->setText(i18nc("@action:inmenu File", "Close Tab"));
1414 closeTab
->setWhatsThis(i18nc("@info:whatsthis", "This closes the "
1415 "currently viewed tab. If no more tabs are left this window "
1416 "will close instead."));
1418 QAction
* quitAction
= KStandardAction::quit(this, &DolphinMainWindow::quit
, actionCollection());
1419 quitAction
->setWhatsThis(i18nc("@info:whatsthis quit", "This closes this window."));
1421 // setup 'Edit' menu
1422 KStandardAction::undo(this,
1423 &DolphinMainWindow::undo
,
1424 actionCollection());
1426 // i18n: This will be the last paragraph for the whatsthis for all three:
1427 // Cut, Copy and Paste
1428 const QString cutCopyPastePara
= xi18nc("@info:whatsthis", "<para><emphasis>Cut, "
1429 "Copy</emphasis> and <emphasis>Paste</emphasis> work between many "
1430 "applications and are among the most used commands. That's why their "
1431 "<emphasis>keyboard shortcuts</emphasis> are prominently placed right "
1432 "next to each other on the keyboard: <shortcut>Ctrl+X</shortcut>, "
1433 "<shortcut>Ctrl+C</shortcut> and <shortcut>Ctrl+V</shortcut>.</para>");
1434 QAction
* cutAction
= KStandardAction::cut(this, &DolphinMainWindow::cut
, actionCollection());
1435 cutAction
->setWhatsThis(xi18nc("@info:whatsthis cut", "This copies the items "
1436 "in your current selection to the <emphasis>clipboard</emphasis>.<nl/>"
1437 "Use the <emphasis>Paste</emphasis> action afterwards to copy them from "
1438 "the clipboard to a new location. The items will be removed from their "
1439 "initial location.") + cutCopyPastePara
);
1440 QAction
* copyAction
= KStandardAction::copy(this, &DolphinMainWindow::copy
, actionCollection());
1441 copyAction
->setWhatsThis(xi18nc("@info:whatsthis copy", "This copies the "
1442 "items in your current selection to the <emphasis>clipboard</emphasis>."
1443 "<nl/>Use the <emphasis>Paste</emphasis> action afterwards to copy them "
1444 "from the clipboard to a new location.") + cutCopyPastePara
);
1445 QAction
* paste
= KStandardAction::paste(this, &DolphinMainWindow::paste
, actionCollection());
1446 // The text of the paste-action is modified dynamically by Dolphin
1447 // (e. g. to "Paste One Folder"). To prevent that the size of the toolbar changes
1448 // due to the long text, the text "Paste" is used:
1449 paste
->setIconText(i18nc("@action:inmenu Edit", "Paste"));
1450 paste
->setWhatsThis(xi18nc("@info:whatsthis paste", "This copies the items from "
1451 "your <emphasis>clipboard</emphasis> to the currently viewed folder.<nl/>"
1452 "If the items were added to the clipboard by the <emphasis>Cut</emphasis> "
1453 "action they are removed from their old location.") + cutCopyPastePara
);
1455 QAction
* copyToOtherViewAction
= actionCollection()->addAction(QStringLiteral("copy_to_inactive_split_view"));
1456 copyToOtherViewAction
->setText(i18nc("@action:inmenu", "Copy to Inactive Split View"));
1457 copyToOtherViewAction
->setWhatsThis(xi18nc("@info:whatsthis Copy", "This copies the selected items from "
1458 "the <emphasis>active</emphasis> view to the inactive split view."));
1459 copyToOtherViewAction
->setIcon(QIcon::fromTheme(QStringLiteral("edit-copy")));
1460 copyToOtherViewAction
->setIconText(i18nc("@action:inmenu Edit", "Copy to Inactive Split View"));
1461 actionCollection()->setDefaultShortcut(copyToOtherViewAction
, Qt::SHIFT
| Qt::Key_F5
);
1462 connect(copyToOtherViewAction
, &QAction::triggered
, m_tabWidget
, &DolphinTabWidget::copyToInactiveSplitView
);
1464 QAction
* moveToOtherViewAction
= actionCollection()->addAction(QStringLiteral("move_to_inactive_split_view"));
1465 moveToOtherViewAction
->setText(i18nc("@action:inmenu", "Move to Inactive Split View"));
1466 moveToOtherViewAction
->setWhatsThis(xi18nc("@info:whatsthis Move", "This moves the selected items from "
1467 "the <emphasis>active</emphasis> view to the inactive split view."));
1468 moveToOtherViewAction
->setIcon(QIcon::fromTheme(QStringLiteral("edit-cut")));
1469 moveToOtherViewAction
->setIconText(i18nc("@action:inmenu Edit", "Move to Inactive Split View"));
1470 actionCollection()->setDefaultShortcut(moveToOtherViewAction
, Qt::SHIFT
| Qt::Key_F6
);
1471 connect(moveToOtherViewAction
, &QAction::triggered
, m_tabWidget
, &DolphinTabWidget::moveToInactiveSplitView
);
1473 QAction
* showFilterBar
= actionCollection()->addAction(QStringLiteral("show_filter_bar"));
1474 showFilterBar
->setText(i18nc("@action:inmenu Tools", "Filter..."));
1475 showFilterBar
->setToolTip(i18nc("@info:tooltip", "Toggle Filter Bar"));
1476 showFilterBar
->setWhatsThis(xi18nc("@info:whatsthis", "This opens the "
1477 "<emphasis>Filter Bar</emphasis> at the bottom of the window.<nl/> "
1478 "There you can enter a text to filter the files and folders currently displayed. "
1479 "Only those that contain the text in their name will be kept in view."));
1480 showFilterBar
->setIcon(QIcon::fromTheme(QStringLiteral("view-filter")));
1481 actionCollection()->setDefaultShortcuts(showFilterBar
, {Qt::CTRL
| Qt::Key_I
, Qt::Key_Slash
});
1482 connect(showFilterBar
, &QAction::triggered
, this, &DolphinMainWindow::showFilterBar
);
1484 // toggle_filter acts as a copy of the main showFilterBar to be used mainly
1485 // in the toolbar, with no default shortcut attached, to avoid messing with
1486 // existing workflows (filter bar always open and Ctrl-I to focus)
1487 QAction
*toggleFilter
= actionCollection()->addAction(QStringLiteral("toggle_filter"));
1488 toggleFilter
->setText(i18nc("@action:inmenu", "Toggle Filter Bar"));
1489 toggleFilter
->setIconText(i18nc("@action:intoolbar", "Filter"));
1490 toggleFilter
->setIcon(showFilterBar
->icon());
1491 toggleFilter
->setToolTip(showFilterBar
->toolTip());
1492 toggleFilter
->setWhatsThis(showFilterBar
->whatsThis());
1493 toggleFilter
->setCheckable(true);
1494 connect(toggleFilter
, &QAction::triggered
, this, &DolphinMainWindow::toggleFilterBar
);
1496 QAction
*searchAction
= KStandardAction::find(this, &DolphinMainWindow::find
, actionCollection());
1497 searchAction
->setText(i18n("Search..."));
1498 searchAction
->setToolTip(i18nc("@info:tooltip", "Search for files and folders"));
1499 searchAction
->setWhatsThis(xi18nc("@info:whatsthis find", "<para>This helps you "
1500 "find files and folders by opening a <emphasis>find bar</emphasis>. "
1501 "There you can enter search terms and specify settings to find the "
1502 "objects you are looking for.</para><para>Use this help again on "
1503 "the find bar so we can have a look at it while the settings are "
1504 "explained.</para>"));
1506 // toggle_search acts as a copy of the main searchAction to be used mainly
1507 // in the toolbar, with no default shortcut attached, to avoid messing with
1508 // existing workflows (search bar always open and Ctrl-F to focus)
1509 QAction
*toggleSearchAction
= actionCollection()->addAction(QStringLiteral("toggle_search"));
1510 toggleSearchAction
->setText(i18nc("@action:inmenu", "Toggle Search Bar"));
1511 toggleSearchAction
->setIconText(i18nc("@action:intoolbar", "Search"));
1512 toggleSearchAction
->setIcon(searchAction
->icon());
1513 toggleSearchAction
->setToolTip(searchAction
->toolTip());
1514 toggleSearchAction
->setWhatsThis(searchAction
->whatsThis());
1515 toggleSearchAction
->setCheckable(true);
1517 QAction
* selectAllAction
= KStandardAction::selectAll(this, &DolphinMainWindow::selectAll
, actionCollection());
1518 selectAllAction
->setWhatsThis(xi18nc("@info:whatsthis", "This selects all "
1519 "files and folders in the current location."));
1521 QAction
* invertSelection
= actionCollection()->addAction(QStringLiteral("invert_selection"));
1522 invertSelection
->setText(i18nc("@action:inmenu Edit", "Invert Selection"));
1523 invertSelection
->setWhatsThis(xi18nc("@info:whatsthis invert", "This selects all "
1524 "objects that you have currently <emphasis>not</emphasis> selected instead."));
1525 invertSelection
->setIcon(QIcon::fromTheme(QStringLiteral("edit-select-invert")));
1526 actionCollection()->setDefaultShortcut(invertSelection
, Qt::CTRL
| Qt::SHIFT
| Qt::Key_A
);
1527 connect(invertSelection
, &QAction::triggered
, this, &DolphinMainWindow::invertSelection
);
1529 // setup 'View' menu
1530 // (note that most of it is set up in DolphinViewActionHandler)
1532 QAction
* split
= actionCollection()->addAction(QStringLiteral("split_view"));
1533 split
->setWhatsThis(xi18nc("@info:whatsthis find", "<para>This splits "
1534 "the folder view below into two autonomous views.</para><para>This "
1535 "way you can see two locations at once and move items between them "
1536 "quickly.</para>Click this again afterwards to recombine the views."));
1537 actionCollection()->setDefaultShortcut(split
, Qt::Key_F3
);
1538 connect(split
, &QAction::triggered
, this, &DolphinMainWindow::toggleSplitView
);
1540 QAction
* stashSplit
= actionCollection()->addAction(QStringLiteral("split_stash"));
1541 actionCollection()->setDefaultShortcut(stashSplit
, Qt::CTRL
| Qt::Key_S
);
1542 stashSplit
->setText(i18nc("@action:intoolbar Stash", "Stash"));
1543 stashSplit
->setToolTip(i18nc("@info", "Opens the stash virtual directory in a split window"));
1544 stashSplit
->setIcon(QIcon::fromTheme(QStringLiteral("folder-stash")));
1545 stashSplit
->setCheckable(false);
1546 stashSplit
->setVisible(QDBusConnection::sessionBus().interface()->isServiceRegistered(QStringLiteral("org.kde.kio.StashNotifier")));
1547 connect(stashSplit
, &QAction::triggered
, this, &DolphinMainWindow::toggleSplitStash
);
1549 KStandardAction::redisplay(this, &DolphinMainWindow::reloadView
, actionCollection());
1551 QAction
* stop
= actionCollection()->addAction(QStringLiteral("stop"));
1552 stop
->setText(i18nc("@action:inmenu View", "Stop"));
1553 stop
->setToolTip(i18nc("@info", "Stop loading"));
1554 stop
->setWhatsThis(i18nc("@info", "This stops the loading of the contents of the current folder."));
1555 stop
->setIcon(QIcon::fromTheme(QStringLiteral("process-stop")));
1556 connect(stop
, &QAction::triggered
, this, &DolphinMainWindow::stopLoading
);
1558 KToggleAction
* editableLocation
= actionCollection()->add
<KToggleAction
>(QStringLiteral("editable_location"));
1559 editableLocation
->setText(i18nc("@action:inmenu Navigation Bar", "Editable Location"));
1560 editableLocation
->setWhatsThis(xi18nc("@info:whatsthis",
1561 "This toggles the <emphasis>Location Bar</emphasis> to be "
1562 "editable so you can directly enter a location you want to go to.<nl/>"
1563 "You can also switch to editing by clicking to the right of the "
1564 "location and switch back by confirming the edited location."));
1565 actionCollection()->setDefaultShortcut(editableLocation
, Qt::Key_F6
);
1566 connect(editableLocation
, &KToggleAction::triggered
, this, &DolphinMainWindow::toggleEditLocation
);
1568 QAction
* replaceLocation
= actionCollection()->addAction(QStringLiteral("replace_location"));
1569 replaceLocation
->setText(i18nc("@action:inmenu Navigation Bar", "Replace Location"));
1570 // i18n: "enter" is used both in the meaning of "writing" and "going to" a new location here.
1571 // Both meanings are useful but not necessary to understand the use of "Replace Location".
1572 // So you might want to be more verbose in your language to convey the meaning but it's up to you.
1573 replaceLocation
->setWhatsThis(xi18nc("@info:whatsthis",
1574 "This switches to editing the location and selects it "
1575 "so you can quickly enter a different location."));
1576 actionCollection()->setDefaultShortcut(replaceLocation
, Qt::CTRL
| Qt::Key_L
);
1577 connect(replaceLocation
, &QAction::triggered
, this, &DolphinMainWindow::replaceLocation
);
1581 QScopedPointer
<QAction
> backAction(KStandardAction::back(nullptr, nullptr, nullptr));
1582 m_backAction
= new KToolBarPopupAction(backAction
->icon(), backAction
->text(), actionCollection());
1583 m_backAction
->setObjectName(backAction
->objectName());
1584 m_backAction
->setShortcuts(backAction
->shortcuts());
1586 m_backAction
->setPopupMode(QToolButton::DelayedPopup
);
1587 connect(m_backAction
, &QAction::triggered
, this, &DolphinMainWindow::goBack
);
1588 connect(m_backAction
->menu(), &QMenu::aboutToShow
, this, &DolphinMainWindow::slotAboutToShowBackPopupMenu
);
1589 connect(m_backAction
->menu(), &QMenu::triggered
, this, &DolphinMainWindow::slotGoBack
);
1590 actionCollection()->addAction(m_backAction
->objectName(), m_backAction
);
1592 auto backShortcuts
= m_backAction
->shortcuts();
1593 backShortcuts
.append(QKeySequence(Qt::Key_Backspace
));
1594 actionCollection()->setDefaultShortcuts(m_backAction
, backShortcuts
);
1596 DolphinRecentTabsMenu
* recentTabsMenu
= new DolphinRecentTabsMenu(this);
1597 actionCollection()->addAction(QStringLiteral("closed_tabs"), recentTabsMenu
);
1598 connect(m_tabWidget
, &DolphinTabWidget::rememberClosedTab
,
1599 recentTabsMenu
, &DolphinRecentTabsMenu::rememberClosedTab
);
1600 connect(recentTabsMenu
, &DolphinRecentTabsMenu::restoreClosedTab
,
1601 m_tabWidget
, &DolphinTabWidget::restoreClosedTab
);
1602 connect(recentTabsMenu
, &DolphinRecentTabsMenu::closedTabsCountChanged
,
1603 this, &DolphinMainWindow::closedTabsCountChanged
);
1605 QAction
* undoCloseTab
= actionCollection()->addAction(QStringLiteral("undo_close_tab"));
1606 undoCloseTab
->setText(i18nc("@action:inmenu File", "Undo close tab"));
1607 undoCloseTab
->setWhatsThis(i18nc("@info:whatsthis undo close tab",
1608 "This returns you to the previously closed tab."));
1609 actionCollection()->setDefaultShortcut(undoCloseTab
, Qt::CTRL
| Qt::SHIFT
| Qt::Key_T
);
1610 undoCloseTab
->setIcon(QIcon::fromTheme(QStringLiteral("edit-undo")));
1611 undoCloseTab
->setEnabled(false);
1612 connect(undoCloseTab
, &QAction::triggered
, recentTabsMenu
, &DolphinRecentTabsMenu::undoCloseTab
);
1614 auto undoAction
= actionCollection()->action(KStandardAction::name(KStandardAction::Undo
));
1615 undoAction
->setWhatsThis(xi18nc("@info:whatsthis", "This undoes "
1616 "the last change you made to files or folders.<nl/>"
1617 "Such changes include <interface>creating, renaming</interface> "
1618 "and <interface>moving</interface> them to a different location "
1619 "or to the <filename>Trash</filename>. <nl/>Changes that can't "
1620 "be undone will ask for your confirmation."));
1621 undoAction
->setEnabled(false); // undo should be disabled by default
1624 QScopedPointer
<QAction
> forwardAction(KStandardAction::forward(nullptr, nullptr, nullptr));
1625 m_forwardAction
= new KToolBarPopupAction(forwardAction
->icon(), forwardAction
->text(), actionCollection());
1626 m_forwardAction
->setObjectName(forwardAction
->objectName());
1627 m_forwardAction
->setShortcuts(forwardAction
->shortcuts());
1629 m_forwardAction
->setPopupMode(QToolButton::DelayedPopup
);
1630 connect(m_forwardAction
, &QAction::triggered
, this, &DolphinMainWindow::goForward
);
1631 connect(m_forwardAction
->menu(), &QMenu::aboutToShow
, this, &DolphinMainWindow::slotAboutToShowForwardPopupMenu
);
1632 connect(m_forwardAction
->menu(), &QMenu::triggered
, this, &DolphinMainWindow::slotGoForward
);
1633 actionCollection()->addAction(m_forwardAction
->objectName(), m_forwardAction
);
1634 actionCollection()->setDefaultShortcuts(m_forwardAction
, m_forwardAction
->shortcuts());
1636 // enable middle-click to open in a new tab
1637 auto *middleClickEventFilter
= new MiddleClickActionEventFilter(this);
1638 connect(middleClickEventFilter
, &MiddleClickActionEventFilter::actionMiddleClicked
, this, &DolphinMainWindow::slotBackForwardActionMiddleClicked
);
1639 m_backAction
->menu()->installEventFilter(middleClickEventFilter
);
1640 m_forwardAction
->menu()->installEventFilter(middleClickEventFilter
);
1641 KStandardAction::up(this, &DolphinMainWindow::goUp
, actionCollection());
1642 QAction
* homeAction
= KStandardAction::home(this, &DolphinMainWindow::goHome
, actionCollection());
1643 homeAction
->setWhatsThis(xi18nc("@info:whatsthis", "Go to your "
1644 "<filename>Home</filename> folder.<nl/>Every user account "
1645 "has their own <filename>Home</filename> that contains their data "
1646 "including folders that contain personal application data."));
1648 // setup 'Tools' menu
1649 QAction
* compareFiles
= actionCollection()->addAction(QStringLiteral("compare_files"));
1650 compareFiles
->setText(i18nc("@action:inmenu Tools", "Compare Files"));
1651 compareFiles
->setIcon(QIcon::fromTheme(QStringLiteral("kompare")));
1652 compareFiles
->setEnabled(false);
1653 connect(compareFiles
, &QAction::triggered
, this, &DolphinMainWindow::compareFiles
);
1655 QAction
* openPreferredSearchTool
= actionCollection()->addAction(QStringLiteral("open_preferred_search_tool"));
1656 openPreferredSearchTool
->setText(i18nc("@action:inmenu Tools", "Open Preferred Search Tool"));
1657 openPreferredSearchTool
->setWhatsThis(xi18nc("@info:whatsthis",
1658 "<para>This opens a preferred search tool for the viewed location.</para>"
1659 "<para>Use <emphasis>More Search Tools</emphasis> menu to configure it.</para>"));
1660 openPreferredSearchTool
->setIcon(QIcon::fromTheme(QStringLiteral("search")));
1661 actionCollection()->setDefaultShortcut(openPreferredSearchTool
, Qt::CTRL
| Qt::SHIFT
| Qt::Key_F
);
1662 connect(openPreferredSearchTool
, &QAction::triggered
, this, &DolphinMainWindow::openPreferredSearchTool
);
1664 if (KAuthorized::authorize(QStringLiteral("shell_access"))) {
1665 QAction
* openTerminal
= actionCollection()->addAction(QStringLiteral("open_terminal"));
1666 openTerminal
->setText(i18nc("@action:inmenu Tools", "Open Terminal"));
1667 openTerminal
->setWhatsThis(xi18nc("@info:whatsthis",
1668 "<para>This opens a <emphasis>terminal</emphasis> application for the viewed location.</para>"
1669 "<para>To learn more about terminals use the help in the terminal application.</para>"));
1670 openTerminal
->setIcon(QIcon::fromTheme(QStringLiteral("utilities-terminal")));
1671 actionCollection()->setDefaultShortcut(openTerminal
, Qt::SHIFT
| Qt::Key_F4
);
1672 connect(openTerminal
, &QAction::triggered
, this, &DolphinMainWindow::openTerminal
);
1674 #ifdef HAVE_TERMINAL
1675 QAction
* focusTerminalPanel
= actionCollection()->addAction(QStringLiteral("focus_terminal_panel"));
1676 focusTerminalPanel
->setText(i18nc("@action:inmenu Tools", "Focus Terminal Panel"));
1677 focusTerminalPanel
->setIcon(QIcon::fromTheme(QStringLiteral("swap-panels")));
1678 actionCollection()->setDefaultShortcut(focusTerminalPanel
, Qt::CTRL
| Qt::SHIFT
| Qt::Key_F4
);
1679 connect(focusTerminalPanel
, &QAction::triggered
, this, &DolphinMainWindow::focusTerminalPanel
);
1683 // setup 'Bookmarks' menu
1684 KActionMenu
*bookmarkMenu
= new KActionMenu(i18nc("@title:menu", "&Bookmarks"), this);
1685 bookmarkMenu
->setIcon(QIcon::fromTheme(QStringLiteral("bookmarks")));
1686 // Make the toolbar button version work properly on click
1687 bookmarkMenu
->setPopupMode(QToolButton::InstantPopup
);
1688 m_bookmarkHandler
= new DolphinBookmarkHandler(this, actionCollection(), bookmarkMenu
->menu(), this);
1689 actionCollection()->addAction(QStringLiteral("bookmarks"), bookmarkMenu
);
1691 // setup 'Settings' menu
1692 KToggleAction
* showMenuBar
= KStandardAction::showMenubar(nullptr, nullptr, actionCollection());
1693 showMenuBar
->setWhatsThis(xi18nc("@info:whatsthis",
1694 "This switches between having a <emphasis>Menubar</emphasis> "
1695 "and having a <interface>Control</interface> button. Both "
1696 "contain mostly the same commands and configuration options."));
1697 connect(showMenuBar
, &KToggleAction::triggered
, // Fixes #286822
1698 this, &DolphinMainWindow::toggleShowMenuBar
, Qt::QueuedConnection
);
1699 KStandardAction::preferences(this, &DolphinMainWindow::editSettings
, actionCollection());
1701 // setup 'Help' menu for the m_controlButton. The other one is set up in the base class.
1702 m_helpMenu
= new KHelpMenu(nullptr);
1703 m_helpMenu
->menu()->installEventFilter(this);
1704 // remove duplicate shortcuts
1705 m_helpMenu
->action(KHelpMenu::menuHelpContents
)->setShortcut(QKeySequence());
1706 m_helpMenu
->action(KHelpMenu::menuWhatsThis
)->setShortcut(QKeySequence());
1708 // not in menu actions
1709 QList
<QKeySequence
> nextTabKeys
= KStandardShortcut::tabNext();
1710 nextTabKeys
.append(QKeySequence(Qt::CTRL
| Qt::Key_Tab
));
1712 QList
<QKeySequence
> prevTabKeys
= KStandardShortcut::tabPrev();
1713 prevTabKeys
.append(QKeySequence(Qt::CTRL
| Qt::SHIFT
| Qt::Key_Tab
));
1715 for (int i
= 0; i
< MaxActivateTabShortcuts
; ++i
) {
1716 QAction
* activateTab
= actionCollection()->addAction(QStringLiteral("activate_tab_%1").arg(i
));
1717 activateTab
->setText(i18nc("@action:inmenu", "Activate Tab %1", i
+ 1));
1718 activateTab
->setEnabled(false);
1719 connect(activateTab
, &QAction::triggered
, this, [this, i
]() { m_tabWidget
->activateTab(i
); });
1721 // only add default shortcuts for the first 9 tabs regardless of MaxActivateTabShortcuts
1723 actionCollection()->setDefaultShortcut(activateTab
, QStringLiteral("Alt+%1").arg(i
+ 1));
1727 QAction
* activateLastTab
= actionCollection()->addAction(QStringLiteral("activate_last_tab"));
1728 activateLastTab
->setText(i18nc("@action:inmenu", "Activate Last Tab"));
1729 activateLastTab
->setEnabled(false);
1730 connect(activateLastTab
, &QAction::triggered
, m_tabWidget
, &DolphinTabWidget::activateLastTab
);
1731 actionCollection()->setDefaultShortcut(activateLastTab
, Qt::ALT
| Qt::Key_0
);
1733 QAction
* activateNextTab
= actionCollection()->addAction(QStringLiteral("activate_next_tab"));
1734 activateNextTab
->setIconText(i18nc("@action:inmenu", "Next Tab"));
1735 activateNextTab
->setText(i18nc("@action:inmenu", "Activate Next Tab"));
1736 activateNextTab
->setEnabled(false);
1737 connect(activateNextTab
, &QAction::triggered
, m_tabWidget
, &DolphinTabWidget::activateNextTab
);
1738 actionCollection()->setDefaultShortcuts(activateNextTab
, nextTabKeys
);
1740 QAction
* activatePrevTab
= actionCollection()->addAction(QStringLiteral("activate_prev_tab"));
1741 activatePrevTab
->setIconText(i18nc("@action:inmenu", "Previous Tab"));
1742 activatePrevTab
->setText(i18nc("@action:inmenu", "Activate Previous Tab"));
1743 activatePrevTab
->setEnabled(false);
1744 connect(activatePrevTab
, &QAction::triggered
, m_tabWidget
, &DolphinTabWidget::activatePrevTab
);
1745 actionCollection()->setDefaultShortcuts(activatePrevTab
, prevTabKeys
);
1748 QAction
* showTarget
= actionCollection()->addAction(QStringLiteral("show_target"));
1749 showTarget
->setText(i18nc("@action:inmenu", "Show Target"));
1750 showTarget
->setIcon(QIcon::fromTheme(QStringLiteral("document-open-folder")));
1751 showTarget
->setEnabled(false);
1752 connect(showTarget
, &QAction::triggered
, this, &DolphinMainWindow::showTarget
);
1754 QAction
* openInNewTab
= actionCollection()->addAction(QStringLiteral("open_in_new_tab"));
1755 openInNewTab
->setText(i18nc("@action:inmenu", "Open in New Tab"));
1756 openInNewTab
->setIcon(QIcon::fromTheme(QStringLiteral("tab-new")));
1757 connect(openInNewTab
, &QAction::triggered
, this, &DolphinMainWindow::openInNewTab
);
1759 QAction
* openInNewTabs
= actionCollection()->addAction(QStringLiteral("open_in_new_tabs"));
1760 openInNewTabs
->setText(i18nc("@action:inmenu", "Open in New Tabs"));
1761 openInNewTabs
->setIcon(QIcon::fromTheme(QStringLiteral("tab-new")));
1762 connect(openInNewTabs
, &QAction::triggered
, this, &DolphinMainWindow::openInNewTab
);
1764 QAction
* openInNewWindow
= actionCollection()->addAction(QStringLiteral("open_in_new_window"));
1765 openInNewWindow
->setText(i18nc("@action:inmenu", "Open in New Window"));
1766 openInNewWindow
->setIcon(QIcon::fromTheme(QStringLiteral("window-new")));
1767 connect(openInNewWindow
, &QAction::triggered
, this, &DolphinMainWindow::openInNewWindow
);
1770 void DolphinMainWindow::setupDockWidgets()
1772 const bool lock
= GeneralSettings::lockPanels();
1774 KDualAction
* lockLayoutAction
= actionCollection()->add
<KDualAction
>(QStringLiteral("lock_panels"));
1775 lockLayoutAction
->setActiveText(i18nc("@action:inmenu Panels", "Unlock Panels"));
1776 lockLayoutAction
->setActiveIcon(QIcon::fromTheme(QStringLiteral("object-unlocked")));
1777 lockLayoutAction
->setInactiveText(i18nc("@action:inmenu Panels", "Lock Panels"));
1778 lockLayoutAction
->setInactiveIcon(QIcon::fromTheme(QStringLiteral("object-locked")));
1779 lockLayoutAction
->setWhatsThis(xi18nc("@info:whatsthis", "This "
1780 "switches between having panels <emphasis>locked</emphasis> or "
1781 "<emphasis>unlocked</emphasis>.<nl/>Unlocked panels can be "
1782 "dragged to the other side of the window and have a close "
1783 "button.<nl/>Locked panels are embedded more cleanly."));
1784 lockLayoutAction
->setActive(lock
);
1785 connect(lockLayoutAction
, &KDualAction::triggered
, this, &DolphinMainWindow::togglePanelLockState
);
1787 // Setup "Information"
1788 DolphinDockWidget
* infoDock
= new DolphinDockWidget(i18nc("@title:window", "Information"));
1789 infoDock
->setLocked(lock
);
1790 infoDock
->setObjectName(QStringLiteral("infoDock"));
1791 infoDock
->setAllowedAreas(Qt::LeftDockWidgetArea
| Qt::RightDockWidgetArea
);
1794 InformationPanel
* infoPanel
= new InformationPanel(infoDock
);
1795 infoPanel
->setCustomContextMenuActions({lockLayoutAction
});
1796 connect(infoPanel
, &InformationPanel::urlActivated
, this, &DolphinMainWindow::handleUrl
);
1797 infoDock
->setWidget(infoPanel
);
1799 QAction
* infoAction
= infoDock
->toggleViewAction();
1800 createPanelAction(QIcon::fromTheme(QStringLiteral("dialog-information")), Qt::Key_F11
, infoAction
, QStringLiteral("show_information_panel"));
1802 addDockWidget(Qt::RightDockWidgetArea
, infoDock
);
1803 connect(this, &DolphinMainWindow::urlChanged
,
1804 infoPanel
, &InformationPanel::setUrl
);
1805 connect(this, &DolphinMainWindow::selectionChanged
,
1806 infoPanel
, &InformationPanel::setSelection
);
1807 connect(this, &DolphinMainWindow::requestItemInfo
,
1808 infoPanel
, &InformationPanel::requestDelayedItemInfo
);
1809 connect(this, &DolphinMainWindow::fileItemsChanged
,
1810 infoPanel
, &InformationPanel::slotFilesItemChanged
);
1813 // i18n: This is the last paragraph for the "What's This"-texts of all four panels.
1814 const QString panelWhatsThis
= xi18nc("@info:whatsthis", "<para>To show or "
1815 "hide panels like this go to <interface>Control|Panels</interface> "
1816 "or <interface>View|Panels</interface>.</para>");
1818 actionCollection()->action(QStringLiteral("show_information_panel"))
1819 ->setWhatsThis(xi18nc("@info:whatsthis", "<para> This toggles the "
1820 "<emphasis>information</emphasis> panel at the right side of the "
1821 "window.</para><para>The panel provides in-depth information "
1822 "about the items your mouse is hovering over or about the selected "
1823 "items. Otherwise it informs you about the currently viewed folder.<nl/>"
1824 "For single items a preview of their contents is provided.</para>"));
1826 infoDock
->setWhatsThis(xi18nc("@info:whatsthis", "<para>This panel "
1827 "provides in-depth information about the items your mouse is "
1828 "hovering over or about the selected items. Otherwise it informs "
1829 "you about the currently viewed folder.<nl/>For single items a "
1830 "preview of their contents is provided.</para><para>You can configure "
1831 "which and how details are given here by right-clicking.</para>") + panelWhatsThis
);
1834 DolphinDockWidget
* foldersDock
= new DolphinDockWidget(i18nc("@title:window", "Folders"));
1835 foldersDock
->setLocked(lock
);
1836 foldersDock
->setObjectName(QStringLiteral("foldersDock"));
1837 foldersDock
->setAllowedAreas(Qt::LeftDockWidgetArea
| Qt::RightDockWidgetArea
);
1838 FoldersPanel
* foldersPanel
= new FoldersPanel(foldersDock
);
1839 foldersPanel
->setCustomContextMenuActions({lockLayoutAction
});
1840 foldersDock
->setWidget(foldersPanel
);
1842 QAction
* foldersAction
= foldersDock
->toggleViewAction();
1843 createPanelAction(QIcon::fromTheme(QStringLiteral("folder")), Qt::Key_F7
, foldersAction
, QStringLiteral("show_folders_panel"));
1845 addDockWidget(Qt::LeftDockWidgetArea
, foldersDock
);
1846 connect(this, &DolphinMainWindow::urlChanged
,
1847 foldersPanel
, &FoldersPanel::setUrl
);
1848 connect(foldersPanel
, &FoldersPanel::folderActivated
,
1849 this, &DolphinMainWindow::changeUrl
);
1850 connect(foldersPanel
, &FoldersPanel::folderMiddleClicked
,
1851 this, &DolphinMainWindow::openNewTab
);
1852 connect(foldersPanel
, &FoldersPanel::errorMessage
,
1853 this, &DolphinMainWindow::showErrorMessage
);
1855 actionCollection()->action(QStringLiteral("show_folders_panel"))
1856 ->setWhatsThis(xi18nc("@info:whatsthis", "This toggles the "
1857 "<emphasis>folders</emphasis> panel at the left side of the window."
1858 "<nl/><nl/>It shows the folders of the <emphasis>file system"
1859 "</emphasis> in a <emphasis>tree view</emphasis>."));
1860 foldersDock
->setWhatsThis(xi18nc("@info:whatsthis", "<para>This panel "
1861 "shows the folders of the <emphasis>file system</emphasis> in a "
1862 "<emphasis>tree view</emphasis>.</para><para>Click a folder to go "
1863 "there. Click the arrow to the left of a folder to see its subfolders. "
1864 "This allows quick switching between any folders.</para>") + panelWhatsThis
);
1867 #ifdef HAVE_TERMINAL
1868 if (KAuthorized::authorize(QStringLiteral("shell_access"))) {
1869 DolphinDockWidget
* terminalDock
= new DolphinDockWidget(i18nc("@title:window Shell terminal", "Terminal"));
1870 terminalDock
->setLocked(lock
);
1871 terminalDock
->setObjectName(QStringLiteral("terminalDock"));
1872 m_terminalPanel
= new TerminalPanel(terminalDock
);
1873 m_terminalPanel
->setCustomContextMenuActions({lockLayoutAction
});
1874 terminalDock
->setWidget(m_terminalPanel
);
1876 connect(m_terminalPanel
, &TerminalPanel::hideTerminalPanel
, terminalDock
, &DolphinDockWidget::hide
);
1877 connect(m_terminalPanel
, &TerminalPanel::changeUrl
, this, &DolphinMainWindow::slotTerminalDirectoryChanged
);
1878 connect(terminalDock
, &DolphinDockWidget::visibilityChanged
,
1879 m_terminalPanel
, &TerminalPanel::dockVisibilityChanged
);
1880 connect(terminalDock
, &DolphinDockWidget::visibilityChanged
,
1881 this, &DolphinMainWindow::slotTerminalPanelVisibilityChanged
);
1883 QAction
* terminalAction
= terminalDock
->toggleViewAction();
1884 createPanelAction(QIcon::fromTheme(QStringLiteral("dialog-scripts")), Qt::Key_F4
, terminalAction
, QStringLiteral("show_terminal_panel"));
1886 addDockWidget(Qt::BottomDockWidgetArea
, terminalDock
);
1887 connect(this, &DolphinMainWindow::urlChanged
,
1888 m_terminalPanel
, &TerminalPanel::setUrl
);
1890 if (GeneralSettings::version() < 200) {
1891 terminalDock
->hide();
1894 actionCollection()->action(QStringLiteral("show_terminal_panel"))
1895 ->setWhatsThis(xi18nc("@info:whatsthis", "<para>This toggles the "
1896 "<emphasis>terminal</emphasis> panel at the bottom of the window."
1897 "<nl/>The location in the terminal will always match the folder "
1898 "view so you can navigate using either.</para><para>The terminal "
1899 "panel is not needed for basic computer usage but can be useful "
1900 "for advanced tasks. To learn more about terminals use the help "
1901 "in a standalone terminal application like Konsole.</para>"));
1902 terminalDock
->setWhatsThis(xi18nc("@info:whatsthis", "<para>This is "
1903 "the <emphasis>terminal</emphasis> panel. It behaves like a "
1904 "normal terminal but will match the location of the folder view "
1905 "so you can navigate using either.</para><para>The terminal panel "
1906 "is not needed for basic computer usage but can be useful for "
1907 "advanced tasks. To learn more about terminals use the help in a "
1908 "standalone terminal application like Konsole.</para>") + panelWhatsThis
);
1912 if (GeneralSettings::version() < 200) {
1914 foldersDock
->hide();
1918 DolphinDockWidget
* placesDock
= new DolphinDockWidget(i18nc("@title:window", "Places"));
1919 placesDock
->setLocked(lock
);
1920 placesDock
->setObjectName(QStringLiteral("placesDock"));
1921 placesDock
->setAllowedAreas(Qt::LeftDockWidgetArea
| Qt::RightDockWidgetArea
);
1923 m_placesPanel
= new PlacesPanel(placesDock
);
1924 m_placesPanel
->setCustomContextMenuActions({lockLayoutAction
});
1925 placesDock
->setWidget(m_placesPanel
);
1927 QAction
*placesAction
= placesDock
->toggleViewAction();
1928 createPanelAction(QIcon::fromTheme(QStringLiteral("compass")), Qt::Key_F9
, placesAction
, QStringLiteral("show_places_panel"));
1930 addDockWidget(Qt::LeftDockWidgetArea
, placesDock
);
1931 connect(m_placesPanel
, &PlacesPanel::placeActivated
,
1932 this, &DolphinMainWindow::slotPlaceActivated
);
1933 connect(m_placesPanel
, &PlacesPanel::placeMiddleClicked
,
1934 this, &DolphinMainWindow::openNewTab
);
1935 connect(m_placesPanel
, &PlacesPanel::errorMessage
,
1936 this, &DolphinMainWindow::showErrorMessage
);
1937 connect(this, &DolphinMainWindow::urlChanged
,
1938 m_placesPanel
, &PlacesPanel::setUrl
);
1939 connect(placesDock
, &DolphinDockWidget::visibilityChanged
,
1940 &DolphinUrlNavigatorsController::slotPlacesPanelVisibilityChanged
);
1941 connect(this, &DolphinMainWindow::settingsChanged
,
1942 m_placesPanel
, &PlacesPanel::readSettings
);
1943 connect(m_placesPanel
, &PlacesPanel::storageTearDownRequested
,
1944 this, &DolphinMainWindow::slotStorageTearDownFromPlacesRequested
);
1945 connect(m_placesPanel
, &PlacesPanel::storageTearDownExternallyRequested
,
1946 this, &DolphinMainWindow::slotStorageTearDownExternallyRequested
);
1947 DolphinUrlNavigatorsController::slotPlacesPanelVisibilityChanged(m_placesPanel
->isVisible());
1949 auto actionShowAllPlaces
= new QAction(QIcon::fromTheme(QStringLiteral("view-hidden")), i18nc("@item:inmenu", "Show Hidden Places"), this);
1950 actionShowAllPlaces
->setCheckable(true);
1951 actionShowAllPlaces
->setDisabled(true);
1952 actionShowAllPlaces
->setWhatsThis(i18nc("@info:whatsthis", "This displays "
1953 "all places in the places panel that have been hidden. They will "
1954 "appear semi-transparent unless you uncheck their hide property."));
1956 connect(actionShowAllPlaces
, &QAction::triggered
, this, [actionShowAllPlaces
, this](bool checked
){
1957 actionShowAllPlaces
->setIcon(QIcon::fromTheme(checked
? QStringLiteral("view-visible") : QStringLiteral("view-hidden")));
1958 m_placesPanel
->showHiddenEntries(checked
);
1961 connect(m_placesPanel
, &PlacesPanel::showHiddenEntriesChanged
, this, [actionShowAllPlaces
] (bool checked
){
1962 actionShowAllPlaces
->setChecked(checked
);
1963 actionShowAllPlaces
->setIcon(QIcon::fromTheme(checked
? QStringLiteral("view-visible") : QStringLiteral("view-hidden")));
1966 actionCollection()->action(QStringLiteral("show_places_panel"))
1967 ->setWhatsThis(xi18nc("@info:whatsthis", "<para>This toggles the "
1968 "<emphasis>places</emphasis> panel at the left side of the window."
1969 "</para><para>It allows you to go to locations you have "
1970 "bookmarked and to access disk or media attached to the computer "
1971 "or to the network. It also contains sections to find recently "
1972 "saved files or files of a certain type.</para>"));
1973 placesDock
->setWhatsThis(xi18nc("@info:whatsthis", "<para>This is the "
1974 "<emphasis>Places</emphasis> panel. It allows you to go to locations "
1975 "you have bookmarked and to access disk or media attached to the "
1976 "computer or to the network. It also contains sections to find "
1977 "recently saved files or files of a certain type.</para><para>"
1978 "Click on an entry to go there. Click with the right mouse button "
1979 "instead to open any entry in a new tab or new window.</para>"
1980 "<para>New entries can be added by dragging folders onto this panel. "
1981 "Right-click any section or entry to hide it. Right-click an empty "
1982 "space on this panel and select <interface>Show Hidden Places"
1983 "</interface> to display it again.</para>") + panelWhatsThis
);
1985 // Add actions into the "Panels" menu
1986 KActionMenu
* panelsMenu
= new KActionMenu(i18nc("@action:inmenu View", "Show Panels"), this);
1987 actionCollection()->addAction(QStringLiteral("panels"), panelsMenu
);
1988 panelsMenu
->setIcon(QIcon::fromTheme(QStringLiteral("view-sidetree")));
1989 panelsMenu
->setPopupMode(QToolButton::InstantPopup
);
1990 const KActionCollection
* ac
= actionCollection();
1991 panelsMenu
->addAction(ac
->action(QStringLiteral("show_places_panel")));
1993 panelsMenu
->addAction(ac
->action(QStringLiteral("show_information_panel")));
1995 panelsMenu
->addAction(ac
->action(QStringLiteral("show_folders_panel")));
1996 panelsMenu
->addAction(ac
->action(QStringLiteral("show_terminal_panel")));
1997 panelsMenu
->addSeparator();
1998 panelsMenu
->addAction(actionShowAllPlaces
);
1999 panelsMenu
->addAction(lockLayoutAction
);
2001 connect(panelsMenu
->menu(), &QMenu::aboutToShow
, this, [actionShowAllPlaces
, this]{
2002 actionShowAllPlaces
->setEnabled(m_placesPanel
->hiddenListCount());
2007 void DolphinMainWindow::updateFileAndEditActions()
2009 const KFileItemList list
= m_activeViewContainer
->view()->selectedItems();
2010 const KActionCollection
* col
= actionCollection();
2011 KFileItemListProperties
capabilitiesSource(list
);
2013 QAction
* addToPlacesAction
= col
->action(QStringLiteral("add_to_places"));
2014 QAction
* copyToOtherViewAction
= col
->action(QStringLiteral("copy_to_inactive_split_view"));
2015 QAction
* moveToOtherViewAction
= col
->action(QStringLiteral("move_to_inactive_split_view"));
2016 QAction
* copyLocation
= col
->action(QString("copy_location"));
2018 if (list
.isEmpty()) {
2019 stateChanged(QStringLiteral("has_no_selection"));
2021 addToPlacesAction
->setEnabled(true);
2022 copyToOtherViewAction
->setEnabled(false);
2023 moveToOtherViewAction
->setEnabled(false);
2024 copyLocation
->setEnabled(false);
2026 stateChanged(QStringLiteral("has_selection"));
2028 QAction
* renameAction
= col
->action(KStandardAction::name(KStandardAction::RenameFile
));
2029 QAction
* moveToTrashAction
= col
->action(KStandardAction::name(KStandardAction::MoveToTrash
));
2030 QAction
* deleteAction
= col
->action(KStandardAction::name(KStandardAction::DeleteFile
));
2031 QAction
* cutAction
= col
->action(KStandardAction::name(KStandardAction::Cut
));
2032 QAction
* deleteWithTrashShortcut
= col
->action(QStringLiteral("delete_shortcut")); // see DolphinViewActionHandler
2033 QAction
* showTarget
= col
->action(QStringLiteral("show_target"));
2034 QAction
* duplicateAction
= col
->action(QStringLiteral("duplicate")); // see DolphinViewActionHandler
2036 if (list
.length() == 1 && list
.first().isDir()) {
2037 addToPlacesAction
->setEnabled(true);
2039 addToPlacesAction
->setEnabled(false);
2042 if (m_tabWidget
->currentTabPage()->splitViewEnabled()) {
2043 DolphinTabPage
* tabPage
= m_tabWidget
->currentTabPage();
2044 KFileItem capabilitiesDestination
;
2046 if (tabPage
->primaryViewActive()) {
2047 capabilitiesDestination
= tabPage
->secondaryViewContainer()->url();
2049 capabilitiesDestination
= tabPage
->primaryViewContainer()->url();
2052 copyToOtherViewAction
->setEnabled(capabilitiesDestination
.isWritable());
2053 moveToOtherViewAction
->setEnabled(capabilitiesSource
.supportsMoving() && capabilitiesDestination
.isWritable());
2055 copyToOtherViewAction
->setEnabled(false);
2056 moveToOtherViewAction
->setEnabled(false);
2059 const bool enableMoveToTrash
= capabilitiesSource
.isLocal() && capabilitiesSource
.supportsMoving();
2061 renameAction
->setEnabled(capabilitiesSource
.supportsMoving());
2062 moveToTrashAction
->setEnabled(enableMoveToTrash
);
2063 deleteAction
->setEnabled(capabilitiesSource
.supportsDeleting());
2064 deleteWithTrashShortcut
->setEnabled(capabilitiesSource
.supportsDeleting() && !enableMoveToTrash
);
2065 cutAction
->setEnabled(capabilitiesSource
.supportsMoving());
2066 copyLocation
->setEnabled(list
.length() == 1);
2067 showTarget
->setEnabled(list
.length() == 1 && list
.at(0).isLink());
2068 duplicateAction
->setEnabled(capabilitiesSource
.supportsWriting());
2072 void DolphinMainWindow::updateViewActions()
2074 m_actionHandler
->updateViewActions();
2076 QAction
* toggleFilterBarAction
= actionCollection()->action(QStringLiteral("toggle_filter"));
2077 toggleFilterBarAction
->setChecked(m_activeViewContainer
->isFilterBarVisible());
2079 updateSplitAction();
2082 void DolphinMainWindow::updateGoActions()
2084 QAction
* goUpAction
= actionCollection()->action(KStandardAction::name(KStandardAction::Up
));
2085 const QUrl currentUrl
= m_activeViewContainer
->url();
2086 // I think this is one of the best places to firstly be confronted
2087 // with a file system and its hierarchy. Talking about the root
2088 // directory might seem too much here but it is the question that
2089 // naturally arises in this context.
2090 goUpAction
->setWhatsThis(xi18nc("@info:whatsthis", "<para>Go to "
2091 "the folder that contains the currently viewed one.</para>"
2092 "<para>All files and folders are organized in a hierarchical "
2093 "<emphasis>file system</emphasis>. At the top of this hierarchy is "
2094 "a directory that contains all data connected to this computer"
2095 "—the <emphasis>root directory</emphasis>.</para>"));
2096 goUpAction
->setEnabled(KIO::upUrl(currentUrl
) != currentUrl
);
2099 void DolphinMainWindow::refreshViews()
2101 m_tabWidget
->refreshViews();
2103 if (GeneralSettings::modifiedStartupSettings()) {
2104 // The startup settings have been changed by the user (see bug #254947).
2105 // Synchronize the split-view setting with the active view:
2106 const bool splitView
= GeneralSettings::splitView();
2107 m_tabWidget
->currentTabPage()->setSplitViewEnabled(splitView
, WithAnimation
);
2108 updateSplitAction();
2109 updateWindowTitle();
2112 Q_EMIT
settingsChanged();
2115 void DolphinMainWindow::clearStatusBar()
2117 m_activeViewContainer
->statusBar()->resetToDefaultText();
2120 void DolphinMainWindow::connectViewSignals(DolphinViewContainer
* container
)
2122 connect(container
, &DolphinViewContainer::showFilterBarChanged
,
2123 this, &DolphinMainWindow::updateFilterBarAction
);
2124 connect(container
, &DolphinViewContainer::writeStateChanged
,
2125 this, &DolphinMainWindow::slotWriteStateChanged
);
2126 connect(container
, &DolphinViewContainer::searchModeEnabledChanged
,
2127 this, &DolphinMainWindow::updateSearchAction
);
2129 const QAction
* toggleSearchAction
= actionCollection()->action(QStringLiteral("toggle_search"));
2130 connect(toggleSearchAction
, &QAction::triggered
, container
, &DolphinViewContainer::setSearchModeEnabled
);
2132 const DolphinView
* view
= container
->view();
2133 connect(view
, &DolphinView::selectionChanged
,
2134 this, &DolphinMainWindow::slotSelectionChanged
);
2135 connect(view
, &DolphinView::requestItemInfo
,
2136 this, &DolphinMainWindow::requestItemInfo
);
2137 connect(view
, &DolphinView::fileItemsChanged
,
2138 this, &DolphinMainWindow::fileItemsChanged
);
2139 connect(view
, &DolphinView::tabRequested
,
2140 this, &DolphinMainWindow::openNewTab
);
2141 connect(view
, &DolphinView::requestContextMenu
,
2142 this, &DolphinMainWindow::openContextMenu
);
2143 connect(view
, &DolphinView::directoryLoadingStarted
,
2144 this, &DolphinMainWindow::enableStopAction
);
2145 connect(view
, &DolphinView::directoryLoadingCompleted
,
2146 this, &DolphinMainWindow::disableStopAction
);
2147 connect(view
, &DolphinView::directoryLoadingCompleted
,
2148 this, &DolphinMainWindow::slotDirectoryLoadingCompleted
);
2149 connect(view
, &DolphinView::goBackRequested
,
2150 this, &DolphinMainWindow::goBack
);
2151 connect(view
, &DolphinView::goForwardRequested
,
2152 this, &DolphinMainWindow::goForward
);
2153 connect(view
, &DolphinView::urlActivated
,
2154 this, &DolphinMainWindow::handleUrl
);
2155 connect(view
, &DolphinView::goUpRequested
,
2156 this, &DolphinMainWindow::goUp
);
2158 connect(container
->urlNavigatorInternalWithHistory(), &KUrlNavigator::urlChanged
,
2159 this, &DolphinMainWindow::changeUrl
);
2160 connect(container
->urlNavigatorInternalWithHistory(), &KUrlNavigator::historyChanged
,
2161 this, &DolphinMainWindow::updateHistory
);
2163 auto navigators
= static_cast<DolphinNavigatorsWidgetAction
*>
2164 (actionCollection()->action(QStringLiteral("url_navigators")));
2165 const KUrlNavigator
*navigator
= m_tabWidget
->currentTabPage()->primaryViewActive() ?
2166 navigators
->primaryUrlNavigator() :
2167 navigators
->secondaryUrlNavigator();
2169 QAction
*editableLocactionAction
= actionCollection()->action(QStringLiteral("editable_location"));
2170 editableLocactionAction
->setChecked(navigator
->isUrlEditable());
2171 connect(navigator
, &KUrlNavigator::editableStateChanged
,
2172 this, &DolphinMainWindow::slotEditableStateChanged
);
2173 connect(navigator
, &KUrlNavigator::tabRequested
,
2174 this, &DolphinMainWindow::openNewTab
);
2178 void DolphinMainWindow::updateSplitAction()
2180 QAction
* splitAction
= actionCollection()->action(QStringLiteral("split_view"));
2181 const DolphinTabPage
* tabPage
= m_tabWidget
->currentTabPage();
2182 if (tabPage
->splitViewEnabled()) {
2183 if (GeneralSettings::closeActiveSplitView() ? tabPage
->primaryViewActive() : !tabPage
->primaryViewActive()) {
2184 splitAction
->setText(i18nc("@action:intoolbar Close left view", "Close"));
2185 splitAction
->setToolTip(i18nc("@info", "Close left view"));
2186 splitAction
->setIcon(QIcon::fromTheme(QStringLiteral("view-left-close")));
2188 splitAction
->setText(i18nc("@action:intoolbar Close right view", "Close"));
2189 splitAction
->setToolTip(i18nc("@info", "Close right view"));
2190 splitAction
->setIcon(QIcon::fromTheme(QStringLiteral("view-right-close")));
2193 splitAction
->setText(i18nc("@action:intoolbar Split view", "Split"));
2194 splitAction
->setToolTip(i18nc("@info", "Split view"));
2195 splitAction
->setIcon(QIcon::fromTheme(QStringLiteral("view-right-new")));
2199 void DolphinMainWindow::updateAllowedToolbarAreas()
2201 auto navigators
= static_cast<DolphinNavigatorsWidgetAction
*>
2202 (actionCollection()->action(QStringLiteral("url_navigators")));
2203 if (toolBar()->actions().contains(navigators
)) {
2204 toolBar()->setAllowedAreas(Qt::TopToolBarArea
| Qt::BottomToolBarArea
);
2205 if (toolBarArea(toolBar()) == Qt::LeftToolBarArea
||
2206 toolBarArea(toolBar()) == Qt::RightToolBarArea
) {
2207 addToolBar(Qt::TopToolBarArea
, toolBar());
2210 toolBar()->setAllowedAreas(Qt::AllToolBarAreas
);
2214 bool DolphinMainWindow::isKompareInstalled() const
2216 static bool initialized
= false;
2217 static bool installed
= false;
2219 // TODO: maybe replace this approach later by using a menu
2220 // plugin like kdiff3plugin.cpp
2221 installed
= !QStandardPaths::findExecutable(QStringLiteral("kompare")).isEmpty();
2227 void DolphinMainWindow::createPanelAction(const QIcon
& icon
,
2228 const QKeySequence
& shortcut
,
2229 QAction
* dockAction
,
2230 const QString
& actionName
)
2232 QAction
* panelAction
= actionCollection()->addAction(actionName
);
2233 panelAction
->setCheckable(true);
2234 panelAction
->setChecked(dockAction
->isChecked());
2235 panelAction
->setText(dockAction
->text());
2236 panelAction
->setIcon(icon
);
2237 actionCollection()->setDefaultShortcut(panelAction
, shortcut
);
2239 connect(panelAction
, &QAction::triggered
, dockAction
, &QAction::trigger
);
2240 connect(dockAction
, &QAction::toggled
, panelAction
, &QAction::setChecked
);
2243 void DolphinMainWindow::setupWhatsThis()
2246 menuBar()->setWhatsThis(xi18nc("@info:whatsthis", "<para>This is the "
2247 "<emphasis>Menubar</emphasis>. It provides access to commands and "
2248 "configuration options. Left-click on any of the menus on this "
2249 "bar to see its contents.</para><para>The Menubar can be hidden "
2250 "by unchecking <interface>Settings|Show Menubar</interface>. Then "
2251 "most of its contents become available through a <interface>Control"
2252 "</interface> button on the <emphasis>Toolbar</emphasis>.</para>"));
2253 toolBar()->setWhatsThis(xi18nc("@info:whatsthis", "<para>This is the "
2254 "<emphasis>Toolbar</emphasis>. It allows quick access to "
2255 "frequently used actions.</para><para>It is highly customizable. "
2256 "All items you see in the <interface>Control</interface> menu or "
2257 "in the <interface>Menubar</interface> can be placed on the "
2258 "Toolbar. Just right-click on it and select <interface>Configure "
2259 "Toolbars…</interface> or find this action in the <interface>"
2260 "Control</interface> or <interface>Settings</interface> menu."
2261 "</para><para>The location of the bar and the style of its "
2262 "buttons can also be changed in the right-click menu. Right-click "
2263 "a button if you want to show or hide its text.</para>"));
2264 m_tabWidget
->setWhatsThis(xi18nc("@info:whatsthis main view",
2265 "<para>Here you can see the <emphasis>folders</emphasis> and "
2266 "<emphasis>files</emphasis> that are at the location described in "
2267 "the <interface>Location Bar</interface> above. This area is the "
2268 "central part of this application where you navigate to the files "
2269 "you want to use.</para><para>For an elaborate and general "
2270 "introduction to this application <link "
2271 "url='https://userbase.kde.org/Dolphin/File_Management#Introduction_to_Dolphin'>"
2272 "click here</link>. This will open an introductory article from "
2273 "the <emphasis>KDE UserBase Wiki</emphasis>.</para><para>For brief "
2274 "explanations of all the features of this <emphasis>view</emphasis> "
2275 "<link url='help:/dolphin/dolphin-view.html'>click here</link> "
2276 "instead. This will open a page from the <emphasis>Handbook"
2277 "</emphasis> that covers the basics.</para>"));
2280 actionCollection()->action(KStandardAction::name(KStandardAction::KeyBindings
))
2281 ->setWhatsThis(xi18nc("@info:whatsthis","<para>This opens a window "
2282 "that lists the <emphasis>keyboard shortcuts</emphasis>.<nl/>"
2283 "There you can set up key combinations to trigger an action when "
2284 "they are pressed simultaneously. All commands in this application can "
2285 "be triggered this way.</para>"));
2286 actionCollection()->action(KStandardAction::name(KStandardAction::ConfigureToolbars
))
2287 ->setWhatsThis(xi18nc("@info:whatsthis","<para>This opens a window in which "
2288 "you can change which buttons appear on the <emphasis>Toolbar</emphasis>.</para>"
2289 "<para>All items you see in the <interface>Control</interface> menu "
2290 "or in the <interface>Menubar</interface> can also be placed on the Toolbar.</para>"));
2291 actionCollection()->action(KStandardAction::name(KStandardAction::Preferences
))
2292 ->setWhatsThis(xi18nc("@info:whatsthis","This opens a window where you can "
2293 "change a multitude of settings for this application. For an explanation "
2294 "of the various settings go to the chapter <emphasis>Configuring Dolphin"
2295 "</emphasis> in <interface>Help|Dolphin Handbook</interface>."));
2298 // The whatsthis has to be set for the m_helpMenu and for the
2299 // StandardAction separately because both are used in different locations.
2300 // m_helpMenu is only used for createControlButton() button.
2302 // Links do not work within the Menubar so texts without links are provided there.
2304 // i18n: If the external link isn't available in your language you should
2305 // probably state the external link language at least in brackets to not
2306 // frustrate the user. If there are multiple languages that the user might
2307 // know with a reasonable chance you might want to have 2 external links.
2308 // The same is in my opinion true for every external link you translate.
2309 const QString whatsThisHelpContents
= xi18nc("@info:whatsthis handbook",
2310 "<para>This opens the Handbook for this application. It provides "
2311 "explanations for every part of <emphasis>Dolphin</emphasis>.</para>");
2312 actionCollection()->action(KStandardAction::name(KStandardAction::HelpContents
))
2313 ->setWhatsThis(whatsThisHelpContents
2314 + xi18nc("@info:whatsthis second half of handbook hb text without link",
2315 "<para>If you want more elaborate introductions to the "
2316 "different features of <emphasis>Dolphin</emphasis> "
2317 "go to the KDE UserBase Wiki.</para>"));
2318 m_helpMenu
->action(KHelpMenu::menuHelpContents
)->setWhatsThis(whatsThisHelpContents
2319 + xi18nc("@info:whatsthis second half of handbook text with link",
2320 "<para>If you want more elaborate introductions to the "
2321 "different features of <emphasis>Dolphin</emphasis> "
2322 "<link url='https://userbase.kde.org/Dolphin/File_Management'>click here</link>. "
2323 "It will open the dedicated page in the KDE UserBase Wiki.</para>"));
2325 const QString whatsThisWhatsThis
= xi18nc("@info:whatsthis whatsthis button",
2326 "<para>This is the button that invokes the help feature you are "
2327 "using right now! Click it, then click any component of this "
2328 "application to ask \"What's this?\" about it. The mouse cursor "
2329 "will change appearance if no help is available for a spot.</para>");
2330 actionCollection()->action(KStandardAction::name(KStandardAction::WhatsThis
))
2331 ->setWhatsThis(whatsThisWhatsThis
2332 + xi18nc("@info:whatsthis second half of whatsthis button text without link",
2333 "<para>There are two other ways to get help for this application: The "
2334 "<interface>Dolphin Handbook</interface> in the <interface>Help"
2335 "</interface> menu and the <emphasis>KDE UserBase Wiki</emphasis> "
2336 "article about <emphasis>File Management</emphasis> online."
2337 "</para><para>The \"What's this?\" help is "
2338 "missing in most other windows so don't get too used to this.</para>"));
2339 m_helpMenu
->action(KHelpMenu::menuWhatsThis
)->setWhatsThis(whatsThisWhatsThis
2340 + xi18nc("@info:whatsthis second half of whatsthis button text with link",
2341 "<para>There are two other ways to get help: "
2342 "The <link url='help:/dolphin/index.html'>Dolphin Handbook</link> and "
2343 "the <link url='https://userbase.kde.org/Dolphin/File_Management'>KDE "
2344 "UserBase Wiki</link>.</para><para>The \"What's this?\" help is "
2345 "missing in most other windows so don't get too used to this.</para>"));
2347 const QString whatsThisReportBug
= xi18nc("@info:whatsthis","<para>This opens a "
2348 "window that will guide you through reporting errors or flaws "
2349 "in this application or in other KDE software.</para>");
2350 actionCollection()->action(KStandardAction::name(KStandardAction::ReportBug
))
2351 ->setWhatsThis(whatsThisReportBug
);
2352 m_helpMenu
->action(KHelpMenu::menuReportBug
)->setWhatsThis(whatsThisReportBug
2353 + xi18nc("@info:whatsthis second half of reportbug text with link",
2354 "<para>High-quality bug reports are much appreciated. To learn "
2355 "how to make your bug report as effective as possible "
2356 "<link url='https://community.kde.org/Get_Involved/Bug_Reporting'>"
2357 "click here</link>.</para>"));
2359 const QString whatsThisDonate
= xi18nc("@info:whatsthis","<para>This opens a "
2360 "<emphasis>web page</emphasis> where you can donate to "
2361 "support the continued work on this application and many "
2362 "other projects by the <emphasis>KDE</emphasis> community.</para>"
2363 "<para>Donating is the easiest and fastest way to efficiently "
2364 "support KDE and its projects. KDE projects are available for "
2365 "free therefore your donation is needed to cover things that "
2366 "require money like servers, contributor meetings, etc.</para>"
2367 "<para><emphasis>KDE e.V.</emphasis> is the non-profit "
2368 "organization behind the KDE community.</para>");
2369 actionCollection()->action(KStandardAction::name(KStandardAction::Donate
))
2370 ->setWhatsThis(whatsThisDonate
);
2371 m_helpMenu
->action(KHelpMenu::menuDonate
)->setWhatsThis(whatsThisDonate
);
2373 const QString whatsThisSwitchLanguage
= xi18nc("@info:whatsthis",
2374 "With this you can change the language this application uses."
2375 "<nl/>You can even set secondary languages which will be used "
2376 "if texts are not available in your preferred language.");
2377 actionCollection()->action(KStandardAction::name(KStandardAction::SwitchApplicationLanguage
))
2378 ->setWhatsThis(whatsThisSwitchLanguage
);
2379 m_helpMenu
->action(KHelpMenu::menuSwitchLanguage
)->setWhatsThis(whatsThisSwitchLanguage
);
2381 const QString whatsThisAboutApp
= xi18nc("@info:whatsthis","This opens a "
2382 "window that informs you about the version, license, "
2383 "used libraries and maintainers of this application.");
2384 actionCollection()->action(KStandardAction::name(KStandardAction::AboutApp
))
2385 ->setWhatsThis(whatsThisAboutApp
);
2386 m_helpMenu
->action(KHelpMenu::menuAboutApp
)->setWhatsThis(whatsThisAboutApp
);
2388 const QString whatsThisAboutKDE
= xi18nc("@info:whatsthis","This opens a "
2389 "window with information about <emphasis>KDE</emphasis>. "
2390 "The KDE community are the people behind this free software."
2391 "<nl/>If you like using this application but don't know "
2392 "about KDE or want to see a cute dragon have a look!");
2393 actionCollection()->action(KStandardAction::name(KStandardAction::AboutKDE
))
2394 ->setWhatsThis(whatsThisAboutKDE
);
2395 m_helpMenu
->action(KHelpMenu::menuAboutKDE
)->setWhatsThis(whatsThisAboutKDE
);
2398 bool DolphinMainWindow::addHamburgerMenuToToolbar()
2400 QDomDocument domDocument
= KXMLGUIClient::domDocument();
2401 if (domDocument
.isNull()) {
2404 QDomNode toolbar
= domDocument
.elementsByTagName(QStringLiteral("ToolBar")).at(0);
2405 if (toolbar
.isNull()) {
2409 QDomElement hamburgerMenuElement
= domDocument
.createElement(QStringLiteral("Action"));
2410 hamburgerMenuElement
.setAttribute(QStringLiteral("name"), QStringLiteral("hamburger_menu"));
2411 toolbar
.appendChild(hamburgerMenuElement
);
2413 KXMLGUIFactory::saveConfigFile(domDocument
, xmlFile());
2417 // Make sure to also remove the <KXMLGUIFactory> and <QDomDocument> include
2418 // whenever this method is removed (maybe in the year ~2026).
2421 bool DolphinMainWindow::event(QEvent
*event
)
2423 if (event
->type() == QEvent::WhatsThisClicked
) {
2425 QWhatsThisClickedEvent
* whatsThisEvent
= dynamic_cast<QWhatsThisClickedEvent
*>(event
);
2426 QDesktopServices::openUrl(QUrl(whatsThisEvent
->href()));
2429 return KXmlGuiWindow::event(event
);
2432 bool DolphinMainWindow::eventFilter(QObject
* obj
, QEvent
* event
)
2435 if (event
->type() == QEvent::WhatsThisClicked
) {
2437 QWhatsThisClickedEvent
* whatsThisEvent
= dynamic_cast<QWhatsThisClickedEvent
*>(event
);
2438 QDesktopServices::openUrl(QUrl(whatsThisEvent
->href()));
2444 // Set a sane initial window size
2445 QSize
DolphinMainWindow::sizeHint() const
2447 return KXmlGuiWindow::sizeHint().expandedTo(QSize(760, 550));
2450 void DolphinMainWindow::saveNewToolbarConfig()
2452 KXmlGuiWindow::saveNewToolbarConfig(); // Applies the new config. This has to be called first
2453 // because the rest of this method decides things
2454 // based on the new config.
2455 auto navigators
= static_cast<DolphinNavigatorsWidgetAction
*>
2456 (actionCollection()->action(QStringLiteral("url_navigators")));
2457 if (!toolBar()->actions().contains(navigators
)) {
2458 m_tabWidget
->currentTabPage()->insertNavigatorsWidget(navigators
);
2460 updateAllowedToolbarAreas();
2461 (static_cast<KHamburgerMenu
*>(actionCollection()->action(KStandardAction::name(
2462 KStandardAction::HamburgerMenu
))))->hideActionsOf(toolBar());
2465 void DolphinMainWindow::focusTerminalPanel()
2467 if (m_terminalPanel
->isVisible()) {
2468 if (m_terminalPanel
->terminalHasFocus()) {
2469 m_activeViewContainer
->view()->setFocus(Qt::FocusReason::ShortcutFocusReason
);
2470 actionCollection()->action(QStringLiteral("focus_terminal_panel"))->setText(i18nc("@action:inmenu Tools", "Focus Terminal Panel"));
2472 m_terminalPanel
->setFocus(Qt::FocusReason::ShortcutFocusReason
);
2473 actionCollection()->action(QStringLiteral("focus_terminal_panel"))->setText(i18nc("@action:inmenu Tools", "Defocus Terminal Panel"));
2476 actionCollection()->action(QStringLiteral("show_terminal_panel"))->trigger();
2477 actionCollection()->action(QStringLiteral("focus_terminal_panel"))->setText(i18nc("@action:inmenu Tools", "Defocus Terminal Panel"));
2481 DolphinMainWindow::UndoUiInterface::UndoUiInterface() :
2482 KIO::FileUndoManager::UiInterface()
2486 DolphinMainWindow::UndoUiInterface::~UndoUiInterface()
2490 void DolphinMainWindow::UndoUiInterface::jobError(KIO::Job
* job
)
2492 DolphinMainWindow
* mainWin
= qobject_cast
<DolphinMainWindow
*>(parentWidget());
2494 DolphinViewContainer
* container
= mainWin
->activeViewContainer();
2495 container
->showMessage(job
->errorString(), DolphinViewContainer::Error
);
2497 KIO::FileUndoManager::UiInterface::jobError(job
);
2501 bool DolphinMainWindow::isUrlOpen(const QString
& url
)
2503 return m_tabWidget
->isUrlOpen(QUrl::fromUserInput((url
)));