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 <KTerminalLauncherJob>
60 #include <KToggleAction>
62 #include <KToolBarPopupAction>
63 #include <KUrlComboBox>
64 #include <KUrlNavigator>
65 #include <KWindowSystem>
66 #include <KXMLGUIFactory>
67 #include <kxmlgui_version.h>
69 #include <kio_version.h>
71 #include <QApplication>
73 #include <QCloseEvent>
74 #include <QDesktopServices>
76 #include <QDomDocument>
80 #include <QPushButton>
82 #include <QStandardPaths>
84 #include <QToolButton>
85 #include <QWhatsThisClickedEvent>
88 // Used for GeneralSettings::version() to determine whether
89 // an updated version of Dolphin is running.
90 const int CurrentDolphinVersion
= 201;
91 // The maximum number of entries in the back/forward popup menu
92 const int MaxNumberOfNavigationentries
= 12;
93 // The maximum number of "Activate Tab" shortcuts
94 const int MaxActivateTabShortcuts
= 9;
97 DolphinMainWindow::DolphinMainWindow() :
98 KXmlGuiWindow(nullptr),
99 m_newFileMenu(nullptr),
101 m_tabWidget(nullptr),
102 m_activeViewContainer(nullptr),
103 m_actionHandler(nullptr),
104 m_remoteEncoding(nullptr),
106 m_bookmarkHandler(nullptr),
107 m_controlButton(nullptr),
108 m_updateToolBarTimer(nullptr),
109 m_lastHandleUrlOpenJob(nullptr),
110 m_terminalPanel(nullptr),
111 m_placesPanel(nullptr),
112 m_tearDownFromPlacesRequested(false),
113 m_backAction(nullptr),
114 m_forwardAction(nullptr)
116 Q_INIT_RESOURCE(dolphin
);
118 new MainWindowAdaptor(this);
121 setWindowFlags(Qt::WindowContextHelpButtonHint
);
123 setComponentName(QStringLiteral("dolphin"), QGuiApplication::applicationDisplayName());
124 setObjectName(QStringLiteral("Dolphin#"));
126 #if KXMLGUI_VERSION >= QT_VERSION_CHECK(5, 88, 0)
127 setStateConfigGroup("State");
130 connect(&DolphinNewFileMenuObserver::instance(), &DolphinNewFileMenuObserver::errorMessage
,
131 this, &DolphinMainWindow::showErrorMessage
);
133 KIO::FileUndoManager
* undoManager
= KIO::FileUndoManager::self();
134 undoManager
->setUiInterface(new UndoUiInterface());
136 connect(undoManager
, &KIO::FileUndoManager::undoAvailable
,
137 this, &DolphinMainWindow::slotUndoAvailable
);
138 connect(undoManager
, &KIO::FileUndoManager::undoTextChanged
,
139 this, &DolphinMainWindow::slotUndoTextChanged
);
140 connect(undoManager
, &KIO::FileUndoManager::jobRecordingStarted
,
141 this, &DolphinMainWindow::clearStatusBar
);
142 connect(undoManager
, &KIO::FileUndoManager::jobRecordingFinished
,
143 this, &DolphinMainWindow::showCommand
);
145 const bool firstRun
= (GeneralSettings::version() < 200);
147 GeneralSettings::setViewPropsTimestamp(QDateTime::currentDateTime());
150 setAcceptDrops(true);
152 auto *navigatorsWidgetAction
= new DolphinNavigatorsWidgetAction(this);
153 actionCollection()->addAction(QStringLiteral("url_navigators"), navigatorsWidgetAction
);
154 m_tabWidget
= new DolphinTabWidget(navigatorsWidgetAction
, this);
155 m_tabWidget
->setObjectName("tabWidget");
156 connect(m_tabWidget
, &DolphinTabWidget::activeViewChanged
,
157 this, &DolphinMainWindow::activeViewChanged
);
158 connect(m_tabWidget
, &DolphinTabWidget::tabCountChanged
,
159 this, &DolphinMainWindow::tabCountChanged
);
160 connect(m_tabWidget
, &DolphinTabWidget::currentUrlChanged
,
161 this, &DolphinMainWindow::updateWindowTitle
);
162 setCentralWidget(m_tabWidget
);
166 m_actionHandler
= new DolphinViewActionHandler(actionCollection(), this);
167 connect(m_actionHandler
, &DolphinViewActionHandler::actionBeingHandled
, this, &DolphinMainWindow::clearStatusBar
);
168 connect(m_actionHandler
, &DolphinViewActionHandler::createDirectoryTriggered
, this, &DolphinMainWindow::createDirectory
);
170 m_remoteEncoding
= new DolphinRemoteEncoding(this, m_actionHandler
);
171 connect(this, &DolphinMainWindow::urlChanged
,
172 m_remoteEncoding
, &DolphinRemoteEncoding::slotAboutToOpenUrl
);
176 setupGUI(Keys
| Save
| Create
| ToolBar
);
177 stateChanged(QStringLiteral("new_file"));
179 QClipboard
* clipboard
= QApplication::clipboard();
180 connect(clipboard
, &QClipboard::dataChanged
,
181 this, &DolphinMainWindow::updatePasteAction
);
183 QAction
* toggleFilterBarAction
= actionCollection()->action(QStringLiteral("toggle_filter"));
184 toggleFilterBarAction
->setChecked(GeneralSettings::filterBar());
187 menuBar()->setVisible(false);
190 const bool showMenu
= !menuBar()->isHidden();
191 QAction
* showMenuBarAction
= actionCollection()->action(KStandardAction::name(KStandardAction::ShowMenubar
));
192 showMenuBarAction
->setChecked(showMenu
); // workaround for bug #171080
194 auto hamburgerMenu
= static_cast<KHamburgerMenu
*>(actionCollection()->action(
195 KStandardAction::name(KStandardAction::HamburgerMenu
)));
196 hamburgerMenu
->setMenuBar(menuBar());
197 hamburgerMenu
->setShowMenuBarAction(showMenuBarAction
);
198 connect(hamburgerMenu
, &KHamburgerMenu::aboutToShowMenu
,
199 this, &DolphinMainWindow::updateHamburgerMenu
);
200 hamburgerMenu
->hideActionsOf(toolBar());
201 if (GeneralSettings::version() < 201 && !toolBar()->actions().contains(hamburgerMenu
)) {
202 addHamburgerMenuToToolbar();
205 updateAllowedToolbarAreas();
207 // enable middle-click on back/forward/up to open in a new tab
208 auto *middleClickEventFilter
= new MiddleClickActionEventFilter(this);
209 connect(middleClickEventFilter
, &MiddleClickActionEventFilter::actionMiddleClicked
, this, &DolphinMainWindow::slotToolBarActionMiddleClicked
);
210 toolBar()->installEventFilter(middleClickEventFilter
);
214 connect(KSycoca::self(), &KSycoca::databaseChanged
, this, &DolphinMainWindow::updateOpenPreferredSearchToolAction
);
216 QTimer::singleShot(0, this, &DolphinMainWindow::updateOpenPreferredSearchToolAction
);
218 m_fileItemActions
.setParentWidget(this);
219 connect(&m_fileItemActions
, &KFileItemActions::error
, this, [this](const QString
&errorMessage
) {
220 showErrorMessage(errorMessage
);
223 connect(GeneralSettings::self(), &GeneralSettings::splitViewChanged
,
224 this, &DolphinMainWindow::slotSplitViewChanged
);
227 DolphinMainWindow::~DolphinMainWindow()
229 // This fixes a crash on Wayland when closing the mainwindow while another dialog is open.
230 disconnect(QGuiApplication::clipboard(), &QClipboard::dataChanged
, this, &DolphinMainWindow::updatePasteAction
);
233 QVector
<DolphinViewContainer
*> DolphinMainWindow::viewContainers() const
235 QVector
<DolphinViewContainer
*> viewContainers
;
237 for (int i
= 0; i
< m_tabWidget
->count(); ++i
) {
238 DolphinTabPage
*tabPage
= m_tabWidget
->tabPageAt(i
);
240 viewContainers
<< tabPage
->primaryViewContainer();
241 if (tabPage
->splitViewEnabled()) {
242 viewContainers
<< tabPage
->secondaryViewContainer();
245 return viewContainers
;
248 void DolphinMainWindow::openDirectories(const QList
<QUrl
>& dirs
, bool splitView
)
250 m_tabWidget
->openDirectories(dirs
, splitView
);
253 void DolphinMainWindow::openDirectories(const QStringList
& dirs
, bool splitView
)
255 openDirectories(QUrl::fromStringList(dirs
), splitView
);
258 void DolphinMainWindow::openFiles(const QList
<QUrl
>& files
, bool splitView
)
260 m_tabWidget
->openFiles(files
, splitView
);
263 bool DolphinMainWindow::isFoldersPanelEnabled() const
265 return actionCollection()->action(QStringLiteral("show_folders_panel"))->isChecked();
268 bool DolphinMainWindow::isInformationPanelEnabled() const
271 return actionCollection()->action(QStringLiteral("show_information_panel"))->isChecked();
277 void DolphinMainWindow::openFiles(const QStringList
& files
, bool splitView
)
279 openFiles(QUrl::fromStringList(files
), splitView
);
282 void DolphinMainWindow::activateWindow()
284 window()->setAttribute(Qt::WA_NativeWindow
, true);
285 KStartupInfo::setNewStartupId(window()->windowHandle(), KStartupInfo::startupId());
286 KWindowSystem::activateWindow(window()->effectiveWinId());
289 void DolphinMainWindow::showCommand(CommandType command
)
291 DolphinStatusBar
* statusBar
= m_activeViewContainer
->statusBar();
293 case KIO::FileUndoManager::Copy
:
294 statusBar
->setText(i18nc("@info:status", "Successfully copied."));
296 case KIO::FileUndoManager::Move
:
297 statusBar
->setText(i18nc("@info:status", "Successfully moved."));
299 case KIO::FileUndoManager::Link
:
300 statusBar
->setText(i18nc("@info:status", "Successfully linked."));
302 case KIO::FileUndoManager::Trash
:
303 statusBar
->setText(i18nc("@info:status", "Successfully moved to trash."));
305 case KIO::FileUndoManager::Rename
:
306 statusBar
->setText(i18nc("@info:status", "Successfully renamed."));
309 case KIO::FileUndoManager::Mkdir
:
310 statusBar
->setText(i18nc("@info:status", "Created folder."));
318 void DolphinMainWindow::pasteIntoFolder()
320 m_activeViewContainer
->view()->pasteIntoFolder();
323 void DolphinMainWindow::changeUrl(const QUrl
&url
)
325 if (!KProtocolManager::supportsListing(url
)) {
326 // The URL navigator only checks for validity, not
327 // if the URL can be listed. An error message is
328 // shown due to DolphinViewContainer::restoreView().
332 m_activeViewContainer
->setUrl(url
);
333 updateFileAndEditActions();
338 Q_EMIT
urlChanged(url
);
341 void DolphinMainWindow::slotTerminalDirectoryChanged(const QUrl
& url
)
343 if (m_tearDownFromPlacesRequested
&& url
== QUrl::fromLocalFile(QDir::homePath())) {
344 m_placesPanel
->proceedWithTearDown();
345 m_tearDownFromPlacesRequested
= false;
348 m_activeViewContainer
->setAutoGrabFocus(false);
350 m_activeViewContainer
->setAutoGrabFocus(true);
353 void DolphinMainWindow::slotEditableStateChanged(bool editable
)
355 KToggleAction
* editableLocationAction
=
356 static_cast<KToggleAction
*>(actionCollection()->action(QStringLiteral("editable_location")));
357 editableLocationAction
->setChecked(editable
);
360 void DolphinMainWindow::slotSelectionChanged(const KFileItemList
& selection
)
362 updateFileAndEditActions();
364 const int selectedUrlsCount
= m_tabWidget
->currentTabPage()->selectedItemsCount();
366 QAction
* compareFilesAction
= actionCollection()->action(QStringLiteral("compare_files"));
367 if (selectedUrlsCount
== 2) {
368 compareFilesAction
->setEnabled(isKompareInstalled());
370 compareFilesAction
->setEnabled(false);
373 Q_EMIT
selectionChanged(selection
);
376 void DolphinMainWindow::updateHistory()
378 const KUrlNavigator
*urlNavigator
= m_activeViewContainer
->urlNavigatorInternalWithHistory();
379 const int index
= urlNavigator
->historyIndex();
381 QAction
* backAction
= actionCollection()->action(KStandardAction::name(KStandardAction::Back
));
383 backAction
->setToolTip(i18nc("@info", "Go back"));
384 backAction
->setWhatsThis(i18nc("@info:whatsthis go back", "Return to the previously viewed folder."));
385 backAction
->setEnabled(index
< urlNavigator
->historySize() - 1);
388 QAction
* forwardAction
= actionCollection()->action(KStandardAction::name(KStandardAction::Forward
));
390 forwardAction
->setToolTip(i18nc("@info", "Go forward"));
391 forwardAction
->setWhatsThis(xi18nc("@info:whatsthis go forward",
392 "This undoes a <interface>Go|Back</interface> action."));
393 forwardAction
->setEnabled(index
> 0);
397 void DolphinMainWindow::updateFilterBarAction(bool show
)
399 QAction
* toggleFilterBarAction
= actionCollection()->action(QStringLiteral("toggle_filter"));
400 toggleFilterBarAction
->setChecked(show
);
403 void DolphinMainWindow::openNewMainWindow()
405 Dolphin::openNewWindow({m_activeViewContainer
->url()}, this);
408 void DolphinMainWindow::openNewActivatedTab()
410 // keep browsers compatibility, new tab is always after last one
411 auto openNewTabAfterLastTabConfigured
= GeneralSettings::openNewTabAfterLastTab();
412 GeneralSettings::setOpenNewTabAfterLastTab(true);
413 m_tabWidget
->openNewActivatedTab();
414 GeneralSettings::setOpenNewTabAfterLastTab(openNewTabAfterLastTabConfigured
);
417 void DolphinMainWindow::addToPlaces()
422 // If nothing is selected, act on the current dir
423 if (m_activeViewContainer
->view()->selectedItems().isEmpty()) {
424 url
= m_activeViewContainer
->url();
425 name
= m_activeViewContainer
->placesText();
427 const auto dirToAdd
= m_activeViewContainer
->view()->selectedItems().first();
428 url
= dirToAdd
.url();
429 name
= dirToAdd
.name();
432 PlacesItemModel model
;
434 if (m_activeViewContainer
->isSearchModeEnabled()) {
435 icon
= QStringLiteral("folder-saved-search-symbolic");
437 icon
= KIO::iconNameForUrl(url
);
439 model
.createPlacesItem(name
, url
, icon
);
443 void DolphinMainWindow::openNewTab(const QUrl
& url
)
445 m_tabWidget
->openNewTab(url
, QUrl());
448 void DolphinMainWindow::slotSplitViewChanged()
450 m_tabWidget
->currentTabPage()->setSplitViewEnabled(GeneralSettings::splitView(), WithAnimation
);
454 void DolphinMainWindow::openInNewTab()
456 const KFileItemList
& list
= m_activeViewContainer
->view()->selectedItems();
457 bool tabCreated
= false;
459 for (const KFileItem
& item
: list
) {
460 const QUrl
& url
= DolphinView::openItemAsFolderUrl(item
);
461 if (!url
.isEmpty()) {
467 // if no new tab has been created from the selection
468 // open the current directory in a new tab
470 openNewTab(m_activeViewContainer
->url());
474 void DolphinMainWindow::openInNewWindow()
478 const KFileItemList list
= m_activeViewContainer
->view()->selectedItems();
479 if (list
.isEmpty()) {
480 newWindowUrl
= m_activeViewContainer
->url();
481 } else if (list
.count() == 1) {
482 const KFileItem
& item
= list
.first();
483 newWindowUrl
= DolphinView::openItemAsFolderUrl(item
);
486 if (!newWindowUrl
.isEmpty()) {
487 Dolphin::openNewWindow({newWindowUrl
}, this);
491 void DolphinMainWindow::showTarget()
493 const auto link
= m_activeViewContainer
->view()->selectedItems().at(0);
494 const auto linkLocationDir
= QFileInfo(link
.localPath()).absoluteDir();
495 auto linkDestination
= link
.linkDest();
496 if (QFileInfo(linkDestination
).isRelative()) {
497 linkDestination
= linkLocationDir
.filePath(linkDestination
);
499 if (QFileInfo::exists(linkDestination
)) {
500 KIO::highlightInFileManager({QUrl::fromLocalFile(linkDestination
).adjusted(QUrl::StripTrailingSlash
)});
502 m_activeViewContainer
->showMessage(xi18nc("@info", "Could not access <filename>%1</filename>.", linkDestination
),
503 DolphinViewContainer::Warning
);
507 void DolphinMainWindow::showEvent(QShowEvent
* event
)
509 KXmlGuiWindow::showEvent(event
);
511 if (!event
->spontaneous()) {
512 m_activeViewContainer
->view()->setFocus();
516 void DolphinMainWindow::closeEvent(QCloseEvent
* event
)
518 // Find out if Dolphin is closed directly by the user or
519 // by the session manager because the session is closed
520 bool closedByUser
= true;
521 if (qApp
->isSavingSession()) {
522 closedByUser
= false;
525 if (m_tabWidget
->count() > 1
526 && GeneralSettings::confirmClosingMultipleTabs()
527 && !GeneralSettings::rememberOpenedTabs()
529 // Ask the user if he really wants to quit and close all tabs.
530 // Open a confirmation dialog with 3 buttons:
531 // QDialogButtonBox::Yes -> Quit
532 // QDialogButtonBox::No -> Close only the current tab
533 // QDialogButtonBox::Cancel -> do nothing
534 QDialog
*dialog
= new QDialog(this, Qt::Dialog
);
535 dialog
->setWindowTitle(i18nc("@title:window", "Confirmation"));
536 dialog
->setModal(true);
537 QDialogButtonBox
* buttons
= new QDialogButtonBox(QDialogButtonBox::Yes
| QDialogButtonBox::No
| QDialogButtonBox::Cancel
);
538 KGuiItem::assign(buttons
->button(QDialogButtonBox::Yes
), KGuiItem(i18nc("@action:button 'Quit Dolphin' button", "&Quit %1", QGuiApplication::applicationDisplayName()), QIcon::fromTheme(QStringLiteral("application-exit"))));
539 KGuiItem::assign(buttons
->button(QDialogButtonBox::No
), KGuiItem(i18n("C&lose Current Tab"), QIcon::fromTheme(QStringLiteral("tab-close"))));
540 KGuiItem::assign(buttons
->button(QDialogButtonBox::Cancel
), KStandardGuiItem::cancel());
541 buttons
->button(QDialogButtonBox::Yes
)->setDefault(true);
543 bool doNotAskAgainCheckboxResult
= false;
545 const auto result
= KMessageBox::createKMessageBox(dialog
,
547 QMessageBox::Warning
,
548 i18n("You have multiple tabs open in this window, are you sure you want to quit?"),
550 i18n("Do not ask again"),
551 &doNotAskAgainCheckboxResult
,
552 KMessageBox::Notify
);
554 if (doNotAskAgainCheckboxResult
) {
555 GeneralSettings::setConfirmClosingMultipleTabs(false);
559 case QDialogButtonBox::Yes
:
562 case QDialogButtonBox::No
:
563 // Close only the current tab
564 m_tabWidget
->closeTab();
572 if (m_terminalPanel
&& m_terminalPanel
->hasProgramRunning() && GeneralSettings::confirmClosingTerminalRunningProgram() && closedByUser
) {
573 // Ask if the user really wants to quit Dolphin with a program that is still running in the Terminal panel
574 // Open a confirmation dialog with 3 buttons:
575 // QDialogButtonBox::Yes -> Quit
576 // QDialogButtonBox::No -> Show Terminal Panel
577 // QDialogButtonBox::Cancel -> do nothing
578 QDialog
*dialog
= new QDialog(this, Qt::Dialog
);
579 dialog
->setWindowTitle(i18nc("@title:window", "Confirmation"));
580 dialog
->setModal(true);
581 auto standardButtons
= QDialogButtonBox::Yes
| QDialogButtonBox::Cancel
;
582 if (!m_terminalPanel
->isVisible()) {
583 standardButtons
|= QDialogButtonBox::No
;
585 QDialogButtonBox
*buttons
= new QDialogButtonBox(standardButtons
);
586 KGuiItem::assign(buttons
->button(QDialogButtonBox::Yes
), KStandardGuiItem::quit());
587 if (!m_terminalPanel
->isVisible()) {
589 buttons
->button(QDialogButtonBox::No
),
590 KGuiItem(i18n("Show &Terminal Panel"), QIcon::fromTheme(QStringLiteral("dialog-scripts"))));
592 KGuiItem::assign(buttons
->button(QDialogButtonBox::Cancel
), KStandardGuiItem::cancel());
594 bool doNotAskAgainCheckboxResult
= false;
596 const auto result
= KMessageBox::createKMessageBox(
599 QMessageBox::Warning
,
600 i18n("The program '%1' is still running in the Terminal panel. Are you sure you want to quit?", m_terminalPanel
->runningProgramName()),
602 i18n("Do not ask again"),
603 &doNotAskAgainCheckboxResult
,
604 KMessageBox::Dangerous
);
606 if (doNotAskAgainCheckboxResult
) {
607 GeneralSettings::setConfirmClosingTerminalRunningProgram(false);
611 case QDialogButtonBox::Yes
:
614 case QDialogButtonBox::No
:
615 actionCollection()->action("show_terminal_panel")->trigger();
616 // Do not quit, ignore quit event
624 if (GeneralSettings::rememberOpenedTabs()) {
625 KConfigGui::setSessionConfig(QStringLiteral("dolphin"), QStringLiteral("dolphin"));
626 KConfig
*config
= KConfigGui::sessionConfig();
627 saveGlobalProperties(config
);
628 savePropertiesInternal(config
, 1);
632 GeneralSettings::setVersion(CurrentDolphinVersion
);
633 GeneralSettings::self()->save();
635 KXmlGuiWindow::closeEvent(event
);
638 void DolphinMainWindow::saveProperties(KConfigGroup
& group
)
640 m_tabWidget
->saveProperties(group
);
643 void DolphinMainWindow::readProperties(const KConfigGroup
& group
)
645 m_tabWidget
->readProperties(group
);
648 void DolphinMainWindow::updateNewMenu()
650 m_newFileMenu
->checkUpToDate();
651 m_newFileMenu
->setPopupFiles(QList
<QUrl
>() << activeViewContainer()->url());
654 void DolphinMainWindow::createDirectory()
656 m_newFileMenu
->setPopupFiles(QList
<QUrl
>() << activeViewContainer()->url());
657 m_newFileMenu
->createDirectory();
660 void DolphinMainWindow::quit()
665 void DolphinMainWindow::showErrorMessage(const QString
& message
)
667 m_activeViewContainer
->showMessage(message
, DolphinViewContainer::Error
);
670 void DolphinMainWindow::slotUndoAvailable(bool available
)
672 QAction
* undoAction
= actionCollection()->action(KStandardAction::name(KStandardAction::Undo
));
674 undoAction
->setEnabled(available
);
678 void DolphinMainWindow::slotUndoTextChanged(const QString
& text
)
680 QAction
* undoAction
= actionCollection()->action(KStandardAction::name(KStandardAction::Undo
));
682 undoAction
->setText(text
);
686 void DolphinMainWindow::undo()
689 KIO::FileUndoManager::self()->uiInterface()->setParentWidget(this);
690 KIO::FileUndoManager::self()->undo();
693 void DolphinMainWindow::cut()
695 m_activeViewContainer
->view()->cutSelectedItemsToClipboard();
698 void DolphinMainWindow::copy()
700 m_activeViewContainer
->view()->copySelectedItemsToClipboard();
703 void DolphinMainWindow::paste()
705 m_activeViewContainer
->view()->paste();
708 void DolphinMainWindow::find()
710 m_activeViewContainer
->setSearchModeEnabled(true);
713 void DolphinMainWindow::updateSearchAction()
715 QAction
* toggleSearchAction
= actionCollection()->action(QStringLiteral("toggle_search"));
716 toggleSearchAction
->setChecked(m_activeViewContainer
->isSearchModeEnabled());
719 void DolphinMainWindow::updatePasteAction()
721 QAction
* pasteAction
= actionCollection()->action(KStandardAction::name(KStandardAction::Paste
));
722 QPair
<bool, QString
> pasteInfo
= m_activeViewContainer
->view()->pasteInfo();
723 pasteAction
->setEnabled(pasteInfo
.first
);
724 pasteAction
->setText(pasteInfo
.second
);
727 void DolphinMainWindow::slotDirectoryLoadingCompleted()
732 void DolphinMainWindow::slotToolBarActionMiddleClicked(QAction
*action
)
734 if (action
== actionCollection()->action(KStandardAction::name(KStandardAction::Back
))) {
736 } else if (action
== actionCollection()->action(KStandardAction::name(KStandardAction::Forward
))) {
738 } else if (action
== actionCollection()->action(QStringLiteral("go_up"))) {
740 } else if (action
== actionCollection()->action(QStringLiteral("go_home"))) {
745 void DolphinMainWindow::slotAboutToShowBackPopupMenu()
747 const KUrlNavigator
*urlNavigator
= m_activeViewContainer
->urlNavigatorInternalWithHistory();
749 m_backAction
->menu()->clear();
750 for (int i
= urlNavigator
->historyIndex() + 1; i
< urlNavigator
->historySize() && entries
< MaxNumberOfNavigationentries
; ++i
, ++entries
) {
751 QAction
* action
= new QAction(urlNavigator
->locationUrl(i
).toString(QUrl::PreferLocalFile
), m_backAction
->menu());
753 m_backAction
->menu()->addAction(action
);
757 void DolphinMainWindow::slotGoBack(QAction
* action
)
759 int gotoIndex
= action
->data().value
<int>();
760 const KUrlNavigator
*urlNavigator
= m_activeViewContainer
->urlNavigatorInternalWithHistory();
761 for (int i
= gotoIndex
- urlNavigator
->historyIndex(); i
> 0; --i
) {
766 void DolphinMainWindow::slotBackForwardActionMiddleClicked(QAction
* action
)
769 const KUrlNavigator
*urlNavigator
= activeViewContainer()->urlNavigatorInternalWithHistory();
770 openNewTab(urlNavigator
->locationUrl(action
->data().value
<int>()));
774 void DolphinMainWindow::slotAboutToShowForwardPopupMenu()
776 const KUrlNavigator
*urlNavigator
= m_activeViewContainer
->urlNavigatorInternalWithHistory();
778 m_forwardAction
->menu()->clear();
779 for (int i
= urlNavigator
->historyIndex() - 1; i
>= 0 && entries
< MaxNumberOfNavigationentries
; --i
, ++entries
) {
780 QAction
* action
= new QAction(urlNavigator
->locationUrl(i
).toString(QUrl::PreferLocalFile
), m_forwardAction
->menu());
782 m_forwardAction
->menu()->addAction(action
);
786 void DolphinMainWindow::slotGoForward(QAction
* action
)
788 int gotoIndex
= action
->data().value
<int>();
789 const KUrlNavigator
*urlNavigator
= m_activeViewContainer
->urlNavigatorInternalWithHistory();
790 for (int i
= urlNavigator
->historyIndex() - gotoIndex
; i
> 0; --i
) {
795 void DolphinMainWindow::selectAll()
799 // if the URL navigator is editable and focused, select the whole
800 // URL instead of all items of the view
802 KUrlNavigator
* urlNavigator
= m_activeViewContainer
->urlNavigator();
803 QLineEdit
* lineEdit
= urlNavigator
->editor()->lineEdit();
804 const bool selectUrl
= urlNavigator
->isUrlEditable() &&
805 lineEdit
->hasFocus();
807 lineEdit
->selectAll();
809 m_activeViewContainer
->view()->selectAll();
813 void DolphinMainWindow::invertSelection()
816 m_activeViewContainer
->view()->invertSelection();
819 void DolphinMainWindow::toggleSplitView()
821 DolphinTabPage
* tabPage
= m_tabWidget
->currentTabPage();
822 tabPage
->setSplitViewEnabled(!tabPage
->splitViewEnabled(), WithAnimation
);
827 void DolphinMainWindow::toggleSplitStash()
829 DolphinTabPage
* tabPage
= m_tabWidget
->currentTabPage();
830 tabPage
->setSplitViewEnabled(false, WithAnimation
);
831 tabPage
->setSplitViewEnabled(true, WithAnimation
, QUrl("stash:/"));
834 void DolphinMainWindow::reloadView()
837 m_activeViewContainer
->reload();
838 m_activeViewContainer
->statusBar()->updateSpaceInfo();
841 void DolphinMainWindow::stopLoading()
843 m_activeViewContainer
->view()->stopLoading();
846 void DolphinMainWindow::enableStopAction()
848 actionCollection()->action(QStringLiteral("stop"))->setEnabled(true);
851 void DolphinMainWindow::disableStopAction()
853 actionCollection()->action(QStringLiteral("stop"))->setEnabled(false);
856 void DolphinMainWindow::showFilterBar()
858 m_activeViewContainer
->setFilterBarVisible(true);
861 void DolphinMainWindow::toggleFilterBar()
863 const bool checked
= !m_activeViewContainer
->isFilterBarVisible();
864 m_activeViewContainer
->setFilterBarVisible(checked
);
866 QAction
* toggleFilterBarAction
= actionCollection()->action(QStringLiteral("toggle_filter"));
867 toggleFilterBarAction
->setChecked(checked
);
870 void DolphinMainWindow::toggleEditLocation()
874 QAction
* action
= actionCollection()->action(QStringLiteral("editable_location"));
875 KUrlNavigator
* urlNavigator
= m_activeViewContainer
->urlNavigator();
876 urlNavigator
->setUrlEditable(action
->isChecked());
879 void DolphinMainWindow::replaceLocation()
881 KUrlNavigator
* navigator
= m_activeViewContainer
->urlNavigator();
882 QLineEdit
* lineEdit
= navigator
->editor()->lineEdit();
884 // If the text field currently has focus and everything is selected,
885 // pressing the keyboard shortcut returns the whole thing to breadcrumb mode
886 if (navigator
->isUrlEditable()
887 && lineEdit
->hasFocus()
888 && lineEdit
->selectedText() == lineEdit
->text() ) {
889 navigator
->setUrlEditable(false);
891 navigator
->setUrlEditable(true);
892 navigator
->setFocus();
893 lineEdit
->selectAll();
897 void DolphinMainWindow::togglePanelLockState()
899 const bool newLockState
= !GeneralSettings::lockPanels();
900 const auto childrenObjects
= children();
901 for (QObject
* child
: childrenObjects
) {
902 DolphinDockWidget
* dock
= qobject_cast
<DolphinDockWidget
*>(child
);
904 dock
->setLocked(newLockState
);
908 GeneralSettings::setLockPanels(newLockState
);
911 void DolphinMainWindow::slotTerminalPanelVisibilityChanged()
913 if (m_terminalPanel
->isHiddenInVisibleWindow() && m_activeViewContainer
) {
914 m_activeViewContainer
->view()->setFocus();
918 void DolphinMainWindow::goBack()
920 DolphinUrlNavigator
*urlNavigator
= m_activeViewContainer
->urlNavigatorInternalWithHistory();
921 urlNavigator
->goBack();
923 if (urlNavigator
->locationState().isEmpty()) {
924 // An empty location state indicates a redirection URL,
925 // which must be skipped too
926 urlNavigator
->goBack();
930 void DolphinMainWindow::goForward()
932 m_activeViewContainer
->urlNavigatorInternalWithHistory()->goForward();
935 void DolphinMainWindow::goUp()
937 m_activeViewContainer
->urlNavigatorInternalWithHistory()->goUp();
940 void DolphinMainWindow::goHome()
942 m_activeViewContainer
->urlNavigatorInternalWithHistory()->goHome();
945 void DolphinMainWindow::goBackInNewTab()
947 const KUrlNavigator
* urlNavigator
= activeViewContainer()->urlNavigatorInternalWithHistory();
948 const int index
= urlNavigator
->historyIndex() + 1;
949 openNewTab(urlNavigator
->locationUrl(index
));
952 void DolphinMainWindow::goForwardInNewTab()
954 const KUrlNavigator
* urlNavigator
= activeViewContainer()->urlNavigatorInternalWithHistory();
955 const int index
= urlNavigator
->historyIndex() - 1;
956 openNewTab(urlNavigator
->locationUrl(index
));
959 void DolphinMainWindow::goUpInNewTab()
961 const QUrl currentUrl
= activeViewContainer()->urlNavigator()->locationUrl();
962 openNewTab(KIO::upUrl(currentUrl
));
965 void DolphinMainWindow::goHomeInNewTab()
967 openNewTab(Dolphin::homeUrl());
970 void DolphinMainWindow::compareFiles()
972 const KFileItemList items
= m_tabWidget
->currentTabPage()->selectedItems();
973 if (items
.count() != 2) {
974 // The action is disabled in this case, but it could have been triggered
975 // via D-Bus, see https://bugs.kde.org/show_bug.cgi?id=325517
979 QUrl urlA
= items
.at(0).url();
980 QUrl urlB
= items
.at(1).url();
982 QString
command(QStringLiteral("kompare -c \""));
983 command
.append(urlA
.toDisplayString(QUrl::PreferLocalFile
));
984 command
.append("\" \"");
985 command
.append(urlB
.toDisplayString(QUrl::PreferLocalFile
));
986 command
.append('\"');
988 KIO::CommandLauncherJob
*job
= new KIO::CommandLauncherJob(command
, this);
989 job
->setDesktopName(QStringLiteral("org.kde.kompare"));
993 void DolphinMainWindow::toggleShowMenuBar()
995 const bool visible
= menuBar()->isVisible();
996 menuBar()->setVisible(!visible
);
999 QPointer
<QAction
> DolphinMainWindow::preferredSearchTool()
1001 m_searchTools
.clear();
1002 KMoreToolsMenuFactory("dolphin/search-tools").fillMenuFromGroupingNames(
1003 &m_searchTools
, { "files-find" }, m_activeViewContainer
->url()
1005 QList
<QAction
*> actions
= m_searchTools
.actions();
1006 if (actions
.isEmpty()) {
1009 QAction
* action
= actions
.first();
1010 if (action
->isSeparator()) {
1016 void DolphinMainWindow::updateOpenPreferredSearchToolAction()
1018 QAction
* openPreferredSearchTool
= actionCollection()->action(QStringLiteral("open_preferred_search_tool"));
1019 if (!openPreferredSearchTool
) {
1022 QPointer
<QAction
> tool
= preferredSearchTool();
1024 openPreferredSearchTool
->setVisible(true);
1025 openPreferredSearchTool
->setText(i18nc("@action:inmenu Tools", "Open %1", tool
->text()));
1026 // Only override with the app icon if it is the default, i.e. the user hasn't configured one manually
1027 // https://bugs.kde.org/show_bug.cgi?id=442815
1028 if (openPreferredSearchTool
->icon().name() == QLatin1String("search")) {
1029 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 auto job
= new KTerminalLauncherJob(QString());
1053 job
->setWorkingDirectory(url
.toLocalFile());
1058 // Not a local file, with protocol Class ":local", try stat'ing
1059 if (KProtocolInfo::protocolClass(url
.scheme()) == QLatin1String(":local")) {
1060 KIO::StatJob
*job
= KIO::mostLocalUrl(url
);
1061 KJobWidgets::setWindow(job
, this);
1062 connect(job
, &KJob::result
, this, [job
]() {
1064 if (!job
->error()) {
1065 statUrl
= job
->mostLocalUrl();
1068 auto job
= new KTerminalLauncherJob(QString());
1069 job
->setWorkingDirectory(statUrl
.isLocalFile() ? statUrl
.toLocalFile() : QDir::homePath());
1076 // Nothing worked, just use $HOME
1077 auto job
= new KTerminalLauncherJob(QString());
1078 job
->setWorkingDirectory(QDir::homePath());
1082 void DolphinMainWindow::editSettings()
1084 if (!m_settingsDialog
) {
1085 DolphinViewContainer
* container
= activeViewContainer();
1086 container
->view()->writeSettings();
1088 const QUrl url
= container
->url();
1089 DolphinSettingsDialog
* settingsDialog
= new DolphinSettingsDialog(url
, this, actionCollection());
1090 connect(settingsDialog
, &DolphinSettingsDialog::settingsChanged
, this, &DolphinMainWindow::refreshViews
);
1091 connect(settingsDialog
, &DolphinSettingsDialog::settingsChanged
,
1092 &DolphinUrlNavigatorsController::slotReadSettings
);
1093 settingsDialog
->setAttribute(Qt::WA_DeleteOnClose
);
1094 settingsDialog
->show();
1095 m_settingsDialog
= settingsDialog
;
1097 m_settingsDialog
.data()->raise();
1101 void DolphinMainWindow::handleUrl(const QUrl
& url
)
1103 delete m_lastHandleUrlOpenJob
;
1104 m_lastHandleUrlOpenJob
= nullptr;
1106 if (url
.isLocalFile() && QFileInfo(url
.toLocalFile()).isDir()) {
1107 activeViewContainer()->setUrl(url
);
1109 m_lastHandleUrlOpenJob
= new KIO::OpenUrlJob(url
);
1110 m_lastHandleUrlOpenJob
->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled
, this));
1111 m_lastHandleUrlOpenJob
->setShowOpenOrExecuteDialog(true);
1113 connect(m_lastHandleUrlOpenJob
, &KIO::OpenUrlJob::mimeTypeFound
, this,
1114 [this, url
](const QString
&mimetype
) {
1115 if (mimetype
== QLatin1String("inode/directory")) {
1116 // If it's a dir, we'll take it from here
1117 m_lastHandleUrlOpenJob
->kill();
1118 m_lastHandleUrlOpenJob
= nullptr;
1119 activeViewContainer()->setUrl(url
);
1123 connect(m_lastHandleUrlOpenJob
, &KIO::OpenUrlJob::result
, this, [this]() {
1124 m_lastHandleUrlOpenJob
= nullptr;
1127 m_lastHandleUrlOpenJob
->start();
1131 void DolphinMainWindow::slotWriteStateChanged(bool isFolderWritable
)
1133 // trash:/ is writable but we don't want to create new items in it.
1134 // TODO: remove the trash check once https://phabricator.kde.org/T8234 is implemented
1135 newFileMenu()->setEnabled(isFolderWritable
&& m_activeViewContainer
->url().scheme() != QLatin1String("trash"));
1138 void DolphinMainWindow::openContextMenu(const QPoint
& pos
,
1139 const KFileItem
& item
,
1141 const QList
<QAction
*>& customActions
)
1143 QPointer
<DolphinContextMenu
> contextMenu
= new DolphinContextMenu(this, pos
, item
, url
, &m_fileItemActions
);
1144 contextMenu
.data()->setCustomActions(customActions
);
1145 const DolphinContextMenu::Command command
= contextMenu
.data()->open();
1148 case DolphinContextMenu::OpenParentFolder
:
1149 changeUrl(KIO::upUrl(item
.url()));
1150 m_activeViewContainer
->view()->markUrlsAsSelected({item
.url()});
1151 m_activeViewContainer
->view()->markUrlAsCurrent(item
.url());
1154 case DolphinContextMenu::OpenParentFolderInNewWindow
:
1155 Dolphin::openNewWindow({item
.url()}, this, Dolphin::OpenNewWindowFlag::Select
);
1158 case DolphinContextMenu::OpenParentFolderInNewTab
:
1159 openNewTab(KIO::upUrl(item
.url()));
1162 case DolphinContextMenu::None
:
1167 // Delete the menu, unless it has been deleted in its own nested event loop already.
1169 contextMenu
->deleteLater();
1173 void DolphinMainWindow::updateHamburgerMenu()
1175 KActionCollection
* ac
= actionCollection();
1176 auto hamburgerMenu
= static_cast<KHamburgerMenu
*>(
1177 ac
->action(KStandardAction::name(KStandardAction::HamburgerMenu
)));
1178 auto menu
= hamburgerMenu
->menu();
1180 menu
= new QMenu(this);
1181 hamburgerMenu
->setMenu(menu
);
1182 hamburgerMenu
->hideActionsOf(ac
->action(QStringLiteral("basic_actions"))->menu());
1183 hamburgerMenu
->hideActionsOf(ac
->action(QStringLiteral("zoom"))->menu());
1187 const QList
<QAction
*> toolbarActions
= toolBar()->actions();
1189 if (!toolBar()->isVisible()) {
1190 // If neither the menu bar nor the toolbar are visible, these actions should be available.
1191 menu
->addAction(ac
->action(KStandardAction::name(KStandardAction::ShowMenubar
)));
1192 menu
->addAction(toolBarMenuAction());
1193 menu
->addSeparator();
1196 // This group of actions (until the next separator) contains all the most basic actions
1197 // necessary to use Dolphin effectively.
1198 menu
->addAction(ac
->action(QStringLiteral("go_back")));
1199 menu
->addAction(ac
->action(QStringLiteral("go_forward")));
1201 menu
->addMenu(m_newFileMenu
->menu());
1202 menu
->addAction(ac
->action(QStringLiteral("basic_actions")));
1203 menu
->addAction(ac
->action(KStandardAction::name(KStandardAction::Undo
)));
1204 if (!toolBar()->isVisible()
1205 || (!toolbarActions
.contains(ac
->action(QStringLiteral("toggle_search")))
1206 && !toolbarActions
.contains(ac
->action(QStringLiteral("open_preferred_search_tool"))))
1208 menu
->addAction(ac
->action(KStandardAction::name(KStandardAction::Find
)));
1209 // This way a search action will only be added if none of the three available
1210 // search actions is present on the toolbar.
1212 if (!toolBar()->isVisible()
1213 || !toolbarActions
.contains(ac
->action(QStringLiteral("toggle_filter")))
1215 menu
->addAction(ac
->action(QStringLiteral("show_filter_bar")));
1216 // This way a filter action will only be added if none of the two available
1217 // filter actions is present on the toolbar.
1219 menu
->addSeparator();
1221 // The second group of actions (up until the next separator) contains actions for opening
1222 // additional views to interact with the file system.
1223 menu
->addAction(ac
->action(QStringLiteral("file_new")));
1224 menu
->addAction(ac
->action(QStringLiteral("new_tab")));
1225 if (ac
->action(QStringLiteral("undo_close_tab"))->isEnabled()) {
1226 menu
->addAction(ac
->action(QStringLiteral("closed_tabs")));
1228 menu
->addAction(ac
->action(QStringLiteral("open_terminal")));
1229 menu
->addSeparator();
1231 // The third group contains actions to change what one sees in the view
1232 // and to change the more general UI.
1233 if (!toolBar()->isVisible()
1234 || (!toolbarActions
.contains(ac
->action(QStringLiteral("icons")))
1235 && !toolbarActions
.contains(ac
->action(QStringLiteral("compact")))
1236 && !toolbarActions
.contains(ac
->action(QStringLiteral("details")))
1237 && !toolbarActions
.contains(ac
->action(QStringLiteral("view_mode"))))
1239 menu
->addAction(ac
->action(QStringLiteral("view_mode")));
1241 menu
->addAction(ac
->action(QStringLiteral("show_hidden_files")));
1242 menu
->addAction(ac
->action(QStringLiteral("sort")));
1243 menu
->addAction(ac
->action(QStringLiteral("additional_info")));
1244 if (!GeneralSettings::showStatusBar() || !GeneralSettings::showZoomSlider()) {
1245 menu
->addAction(ac
->action(QStringLiteral("zoom")));
1247 menu
->addAction(ac
->action(QStringLiteral("panels")));
1249 // The "Configure" menu is not added to the actionCollection() because there is hardly
1250 // a good reason for users to put it on their toolbar.
1251 auto configureMenu
= menu
->addMenu(QIcon::fromTheme(QStringLiteral("configure")),
1252 i18nc("@action:inmenu menu for configure actions", "Configure"));
1253 configureMenu
->addAction(ac
->action(KStandardAction::name(KStandardAction::SwitchApplicationLanguage
)));
1254 configureMenu
->addAction(ac
->action(KStandardAction::name(KStandardAction::KeyBindings
)));
1255 configureMenu
->addAction(ac
->action(KStandardAction::name(KStandardAction::ConfigureToolbars
)));
1256 configureMenu
->addAction(ac
->action(KStandardAction::name(KStandardAction::Preferences
)));
1257 hamburgerMenu
->hideActionsOf(configureMenu
);
1260 void DolphinMainWindow::slotPlaceActivated(const QUrl
& url
)
1262 DolphinViewContainer
* view
= activeViewContainer();
1264 if (view
->url() == url
) {
1265 // We can end up here if the user clicked a device in the Places Panel
1266 // which had been unmounted earlier, see https://bugs.kde.org/show_bug.cgi?id=161385.
1269 view
->disableUrlNavigatorSelectionRequests();
1271 view
->enableUrlNavigatorSelectionRequests();
1275 void DolphinMainWindow::closedTabsCountChanged(unsigned int count
)
1277 actionCollection()->action(QStringLiteral("undo_close_tab"))->setEnabled(count
> 0);
1280 void DolphinMainWindow::activeViewChanged(DolphinViewContainer
* viewContainer
)
1282 DolphinViewContainer
* oldViewContainer
= m_activeViewContainer
;
1283 Q_ASSERT(viewContainer
);
1285 m_activeViewContainer
= viewContainer
;
1287 if (oldViewContainer
) {
1288 const QAction
* toggleSearchAction
= actionCollection()->action(QStringLiteral("toggle_search"));
1289 toggleSearchAction
->disconnect(oldViewContainer
);
1291 // Disconnect all signals between the old view container (container,
1292 // view and url navigator) and main window.
1293 oldViewContainer
->disconnect(this);
1294 oldViewContainer
->view()->disconnect(this);
1295 oldViewContainer
->urlNavigatorInternalWithHistory()->disconnect(this);
1296 auto navigators
= static_cast<DolphinNavigatorsWidgetAction
*>
1297 (actionCollection()->action(QStringLiteral("url_navigators")));
1298 navigators
->primaryUrlNavigator()->disconnect(this);
1299 if (auto secondaryUrlNavigator
= navigators
->secondaryUrlNavigator()) {
1300 secondaryUrlNavigator
->disconnect(this);
1303 // except the requestItemInfo so that on hover the information panel can still be updated
1304 connect(oldViewContainer
->view(), &DolphinView::requestItemInfo
,
1305 this, &DolphinMainWindow::requestItemInfo
);
1308 connectViewSignals(viewContainer
);
1310 m_actionHandler
->setCurrentView(viewContainer
->view());
1313 updateFileAndEditActions();
1314 updatePasteAction();
1315 updateViewActions();
1317 updateSearchAction();
1319 const QUrl url
= viewContainer
->url();
1320 Q_EMIT
urlChanged(url
);
1323 void DolphinMainWindow::tabCountChanged(int count
)
1325 const bool enableTabActions
= (count
> 1);
1326 for (int i
= 0; i
< MaxActivateTabShortcuts
; ++i
) {
1327 actionCollection()->action(QStringLiteral("activate_tab_%1").arg(i
))->setEnabled(enableTabActions
);
1329 actionCollection()->action(QStringLiteral("activate_last_tab"))->setEnabled(enableTabActions
);
1330 actionCollection()->action(QStringLiteral("activate_next_tab"))->setEnabled(enableTabActions
);
1331 actionCollection()->action(QStringLiteral("activate_prev_tab"))->setEnabled(enableTabActions
);
1334 void DolphinMainWindow::updateWindowTitle()
1336 const QString newTitle
= m_activeViewContainer
->captionWindowTitle();
1337 if (windowTitle() != newTitle
) {
1338 setWindowTitle(newTitle
);
1342 void DolphinMainWindow::slotStorageTearDownFromPlacesRequested(const QString
& mountPath
)
1344 connect(m_placesPanel
, &PlacesPanel::storageTearDownSuccessful
, this, [this, mountPath
]() {
1345 setViewsToHomeIfMountPathOpen(mountPath
);
1348 if (m_terminalPanel
&& m_terminalPanel
->currentWorkingDirectory().startsWith(mountPath
)) {
1349 m_tearDownFromPlacesRequested
= true;
1350 m_terminalPanel
->goHome();
1351 // m_placesPanel->proceedWithTearDown() will be called in slotTerminalDirectoryChanged
1353 m_placesPanel
->proceedWithTearDown();
1357 void DolphinMainWindow::slotStorageTearDownExternallyRequested(const QString
& mountPath
)
1359 connect(m_placesPanel
, &PlacesPanel::storageTearDownSuccessful
, this, [this, mountPath
]() {
1360 setViewsToHomeIfMountPathOpen(mountPath
);
1363 if (m_terminalPanel
&& m_terminalPanel
->currentWorkingDirectory().startsWith(mountPath
)) {
1364 m_tearDownFromPlacesRequested
= false;
1365 m_terminalPanel
->goHome();
1369 void DolphinMainWindow::setViewsToHomeIfMountPathOpen(const QString
& mountPath
)
1371 const QVector
<DolphinViewContainer
*> theViewContainers
= viewContainers();
1372 for (DolphinViewContainer
*viewContainer
: theViewContainers
) {
1373 if (viewContainer
&& viewContainer
->url().toLocalFile().startsWith(mountPath
)) {
1374 viewContainer
->setUrl(QUrl::fromLocalFile(QDir::homePath()));
1377 disconnect(m_placesPanel
, &PlacesPanel::storageTearDownSuccessful
, nullptr, nullptr);
1380 void DolphinMainWindow::setupActions()
1382 KStandardAction::hamburgerMenu(nullptr, nullptr, actionCollection());
1384 // setup 'File' menu
1385 m_newFileMenu
= new DolphinNewFileMenu(actionCollection(), this);
1386 QMenu
* menu
= m_newFileMenu
->menu();
1387 menu
->setTitle(i18nc("@title:menu Create new folder, file, link, etc.", "Create New"));
1388 menu
->setIcon(QIcon::fromTheme(QStringLiteral("list-add")));
1389 m_newFileMenu
->setPopupMode(QToolButton::InstantPopup
);
1390 connect(menu
, &QMenu::aboutToShow
,
1391 this, &DolphinMainWindow::updateNewMenu
);
1393 QAction
* newWindow
= KStandardAction::openNew(this, &DolphinMainWindow::openNewMainWindow
, actionCollection());
1394 newWindow
->setText(i18nc("@action:inmenu File", "New &Window"));
1395 newWindow
->setToolTip(i18nc("@info", "Open a new Dolphin window"));
1396 newWindow
->setWhatsThis(xi18nc("@info:whatsthis", "This opens a new "
1397 "window just like this one with the current location and view."
1398 "<nl/>You can drag and drop items between windows."));
1399 newWindow
->setIcon(QIcon::fromTheme(QStringLiteral("window-new")));
1401 QAction
* newTab
= actionCollection()->addAction(QStringLiteral("new_tab"));
1402 newTab
->setIcon(QIcon::fromTheme(QStringLiteral("tab-new")));
1403 newTab
->setText(i18nc("@action:inmenu File", "New Tab"));
1404 newTab
->setWhatsThis(xi18nc("@info:whatsthis", "This opens a new "
1405 "<emphasis>Tab</emphasis> with the current location and view.<nl/>"
1406 "A tab is an additional view within this window. "
1407 "You can drag and drop items between tabs."));
1408 actionCollection()->setDefaultShortcuts(newTab
, {Qt::CTRL
| Qt::Key_T
, Qt::CTRL
| Qt::SHIFT
| Qt::Key_N
});
1409 connect(newTab
, &QAction::triggered
, this, &DolphinMainWindow::openNewActivatedTab
);
1411 QAction
* addToPlaces
= actionCollection()->addAction(QStringLiteral("add_to_places"));
1412 addToPlaces
->setIcon(QIcon::fromTheme(QStringLiteral("bookmark-new")));
1413 addToPlaces
->setText(i18nc("@action:inmenu Add current folder to places", "Add to Places"));
1414 addToPlaces
->setWhatsThis(xi18nc("@info:whatsthis", "This adds the selected folder "
1415 "to the Places panel."));
1416 connect(addToPlaces
, &QAction::triggered
, this, &DolphinMainWindow::addToPlaces
);
1418 QAction
* closeTab
= KStandardAction::close(m_tabWidget
, QOverload
<>::of(&DolphinTabWidget::closeTab
), actionCollection());
1419 closeTab
->setText(i18nc("@action:inmenu File", "Close Tab"));
1420 closeTab
->setWhatsThis(i18nc("@info:whatsthis", "This closes the "
1421 "currently viewed tab. If no more tabs are left this window "
1422 "will close instead."));
1424 QAction
* quitAction
= KStandardAction::quit(this, &DolphinMainWindow::quit
, actionCollection());
1425 quitAction
->setWhatsThis(i18nc("@info:whatsthis quit", "This closes this window."));
1427 // setup 'Edit' menu
1428 KStandardAction::undo(this,
1429 &DolphinMainWindow::undo
,
1430 actionCollection());
1432 // i18n: This will be the last paragraph for the whatsthis for all three:
1433 // Cut, Copy and Paste
1434 const QString cutCopyPastePara
= xi18nc("@info:whatsthis", "<para><emphasis>Cut, "
1435 "Copy</emphasis> and <emphasis>Paste</emphasis> work between many "
1436 "applications and are among the most used commands. That's why their "
1437 "<emphasis>keyboard shortcuts</emphasis> are prominently placed right "
1438 "next to each other on the keyboard: <shortcut>Ctrl+X</shortcut>, "
1439 "<shortcut>Ctrl+C</shortcut> and <shortcut>Ctrl+V</shortcut>.</para>");
1440 QAction
* cutAction
= KStandardAction::cut(this, &DolphinMainWindow::cut
, actionCollection());
1441 cutAction
->setWhatsThis(xi18nc("@info:whatsthis cut", "This copies the items "
1442 "in your current selection to the <emphasis>clipboard</emphasis>.<nl/>"
1443 "Use the <emphasis>Paste</emphasis> action afterwards to copy them from "
1444 "the clipboard to a new location. The items will be removed from their "
1445 "initial location.") + cutCopyPastePara
);
1446 QAction
* copyAction
= KStandardAction::copy(this, &DolphinMainWindow::copy
, actionCollection());
1447 copyAction
->setWhatsThis(xi18nc("@info:whatsthis copy", "This copies the "
1448 "items in your current selection to the <emphasis>clipboard</emphasis>."
1449 "<nl/>Use the <emphasis>Paste</emphasis> action afterwards to copy them "
1450 "from the clipboard to a new location.") + cutCopyPastePara
);
1451 QAction
* paste
= KStandardAction::paste(this, &DolphinMainWindow::paste
, actionCollection());
1452 // The text of the paste-action is modified dynamically by Dolphin
1453 // (e. g. to "Paste One Folder"). To prevent that the size of the toolbar changes
1454 // due to the long text, the text "Paste" is used:
1455 paste
->setIconText(i18nc("@action:inmenu Edit", "Paste"));
1456 paste
->setWhatsThis(xi18nc("@info:whatsthis paste", "This copies the items from "
1457 "your <emphasis>clipboard</emphasis> to the currently viewed folder.<nl/>"
1458 "If the items were added to the clipboard by the <emphasis>Cut</emphasis> "
1459 "action they are removed from their old location.") + cutCopyPastePara
);
1461 QAction
* copyToOtherViewAction
= actionCollection()->addAction(QStringLiteral("copy_to_inactive_split_view"));
1462 copyToOtherViewAction
->setText(i18nc("@action:inmenu", "Copy to Inactive Split View"));
1463 copyToOtherViewAction
->setWhatsThis(xi18nc("@info:whatsthis Copy", "This copies the selected items from "
1464 "the <emphasis>active</emphasis> view to the inactive split view."));
1465 copyToOtherViewAction
->setIcon(QIcon::fromTheme(QStringLiteral("edit-copy")));
1466 copyToOtherViewAction
->setIconText(i18nc("@action:inmenu Edit", "Copy to Inactive Split View"));
1467 actionCollection()->setDefaultShortcut(copyToOtherViewAction
, Qt::SHIFT
| Qt::Key_F5
);
1468 connect(copyToOtherViewAction
, &QAction::triggered
, m_tabWidget
, &DolphinTabWidget::copyToInactiveSplitView
);
1470 QAction
* moveToOtherViewAction
= actionCollection()->addAction(QStringLiteral("move_to_inactive_split_view"));
1471 moveToOtherViewAction
->setText(i18nc("@action:inmenu", "Move to Inactive Split View"));
1472 moveToOtherViewAction
->setWhatsThis(xi18nc("@info:whatsthis Move", "This moves the selected items from "
1473 "the <emphasis>active</emphasis> view to the inactive split view."));
1474 moveToOtherViewAction
->setIcon(QIcon::fromTheme(QStringLiteral("edit-cut")));
1475 moveToOtherViewAction
->setIconText(i18nc("@action:inmenu Edit", "Move to Inactive Split View"));
1476 actionCollection()->setDefaultShortcut(moveToOtherViewAction
, Qt::SHIFT
| Qt::Key_F6
);
1477 connect(moveToOtherViewAction
, &QAction::triggered
, m_tabWidget
, &DolphinTabWidget::moveToInactiveSplitView
);
1479 QAction
* showFilterBar
= actionCollection()->addAction(QStringLiteral("show_filter_bar"));
1480 showFilterBar
->setText(i18nc("@action:inmenu Tools", "Filter..."));
1481 showFilterBar
->setToolTip(i18nc("@info:tooltip", "Show Filter Bar"));
1482 showFilterBar
->setWhatsThis(xi18nc("@info:whatsthis", "This opens the "
1483 "<emphasis>Filter Bar</emphasis> at the bottom of the window.<nl/> "
1484 "There you can enter a text to filter the files and folders currently displayed. "
1485 "Only those that contain the text in their name will be kept in view."));
1486 showFilterBar
->setIcon(QIcon::fromTheme(QStringLiteral("view-filter")));
1487 actionCollection()->setDefaultShortcuts(showFilterBar
, {Qt::CTRL
| Qt::Key_I
, Qt::Key_Slash
});
1488 connect(showFilterBar
, &QAction::triggered
, this, &DolphinMainWindow::showFilterBar
);
1490 // toggle_filter acts as a copy of the main showFilterBar to be used mainly
1491 // in the toolbar, with no default shortcut attached, to avoid messing with
1492 // existing workflows (filter bar always open and Ctrl-I to focus)
1493 QAction
*toggleFilter
= actionCollection()->addAction(QStringLiteral("toggle_filter"));
1494 toggleFilter
->setText(i18nc("@action:inmenu", "Toggle Filter Bar"));
1495 toggleFilter
->setIconText(i18nc("@action:intoolbar", "Filter"));
1496 toggleFilter
->setIcon(showFilterBar
->icon());
1497 toggleFilter
->setToolTip(showFilterBar
->toolTip());
1498 toggleFilter
->setWhatsThis(showFilterBar
->whatsThis());
1499 toggleFilter
->setCheckable(true);
1500 connect(toggleFilter
, &QAction::triggered
, this, &DolphinMainWindow::toggleFilterBar
);
1502 QAction
*searchAction
= KStandardAction::find(this, &DolphinMainWindow::find
, actionCollection());
1503 searchAction
->setText(i18n("Search..."));
1504 searchAction
->setToolTip(i18nc("@info:tooltip", "Search for files and folders"));
1505 searchAction
->setWhatsThis(xi18nc("@info:whatsthis find", "<para>This helps you "
1506 "find files and folders by opening a <emphasis>find bar</emphasis>. "
1507 "There you can enter search terms and specify settings to find the "
1508 "objects you are looking for.</para><para>Use this help again on "
1509 "the find bar so we can have a look at it while the settings are "
1510 "explained.</para>"));
1512 // toggle_search acts as a copy of the main searchAction to be used mainly
1513 // in the toolbar, with no default shortcut attached, to avoid messing with
1514 // existing workflows (search bar always open and Ctrl-F to focus)
1515 QAction
*toggleSearchAction
= actionCollection()->addAction(QStringLiteral("toggle_search"));
1516 toggleSearchAction
->setText(i18nc("@action:inmenu", "Toggle Search Bar"));
1517 toggleSearchAction
->setIconText(i18nc("@action:intoolbar", "Search"));
1518 toggleSearchAction
->setIcon(searchAction
->icon());
1519 toggleSearchAction
->setToolTip(searchAction
->toolTip());
1520 toggleSearchAction
->setWhatsThis(searchAction
->whatsThis());
1521 toggleSearchAction
->setCheckable(true);
1523 QAction
* selectAllAction
= KStandardAction::selectAll(this, &DolphinMainWindow::selectAll
, actionCollection());
1524 selectAllAction
->setWhatsThis(xi18nc("@info:whatsthis", "This selects all "
1525 "files and folders in the current location."));
1527 QAction
* invertSelection
= actionCollection()->addAction(QStringLiteral("invert_selection"));
1528 invertSelection
->setText(i18nc("@action:inmenu Edit", "Invert Selection"));
1529 invertSelection
->setWhatsThis(xi18nc("@info:whatsthis invert", "This selects all "
1530 "objects that you have currently <emphasis>not</emphasis> selected instead."));
1531 invertSelection
->setIcon(QIcon::fromTheme(QStringLiteral("edit-select-invert")));
1532 actionCollection()->setDefaultShortcut(invertSelection
, Qt::CTRL
| Qt::SHIFT
| Qt::Key_A
);
1533 connect(invertSelection
, &QAction::triggered
, this, &DolphinMainWindow::invertSelection
);
1535 // setup 'View' menu
1536 // (note that most of it is set up in DolphinViewActionHandler)
1538 QAction
* split
= actionCollection()->addAction(QStringLiteral("split_view"));
1539 split
->setWhatsThis(xi18nc("@info:whatsthis find", "<para>This splits "
1540 "the folder view below into two autonomous views.</para><para>This "
1541 "way you can see two locations at once and move items between them "
1542 "quickly.</para>Click this again afterwards to recombine the views."));
1543 actionCollection()->setDefaultShortcut(split
, Qt::Key_F3
);
1544 connect(split
, &QAction::triggered
, this, &DolphinMainWindow::toggleSplitView
);
1546 QAction
* stashSplit
= actionCollection()->addAction(QStringLiteral("split_stash"));
1547 actionCollection()->setDefaultShortcut(stashSplit
, Qt::CTRL
| Qt::Key_S
);
1548 stashSplit
->setText(i18nc("@action:intoolbar Stash", "Stash"));
1549 stashSplit
->setToolTip(i18nc("@info", "Opens the stash virtual directory in a split window"));
1550 stashSplit
->setIcon(QIcon::fromTheme(QStringLiteral("folder-stash")));
1551 stashSplit
->setCheckable(false);
1552 QDBusConnectionInterface
*sessionInterface
= QDBusConnection::sessionBus().interface();
1553 stashSplit
->setVisible(sessionInterface
&& sessionInterface
->isServiceRegistered(QStringLiteral("org.kde.kio.StashNotifier")));
1554 connect(stashSplit
, &QAction::triggered
, this, &DolphinMainWindow::toggleSplitStash
);
1556 KStandardAction::redisplay(this, &DolphinMainWindow::reloadView
, actionCollection());
1558 QAction
* stop
= actionCollection()->addAction(QStringLiteral("stop"));
1559 stop
->setText(i18nc("@action:inmenu View", "Stop"));
1560 stop
->setToolTip(i18nc("@info", "Stop loading"));
1561 stop
->setWhatsThis(i18nc("@info", "This stops the loading of the contents of the current folder."));
1562 stop
->setIcon(QIcon::fromTheme(QStringLiteral("process-stop")));
1563 connect(stop
, &QAction::triggered
, this, &DolphinMainWindow::stopLoading
);
1565 KToggleAction
* editableLocation
= actionCollection()->add
<KToggleAction
>(QStringLiteral("editable_location"));
1566 editableLocation
->setText(i18nc("@action:inmenu Navigation Bar", "Editable Location"));
1567 editableLocation
->setWhatsThis(xi18nc("@info:whatsthis",
1568 "This toggles the <emphasis>Location Bar</emphasis> to be "
1569 "editable so you can directly enter a location you want to go to.<nl/>"
1570 "You can also switch to editing by clicking to the right of the "
1571 "location and switch back by confirming the edited location."));
1572 actionCollection()->setDefaultShortcut(editableLocation
, Qt::Key_F6
);
1573 connect(editableLocation
, &KToggleAction::triggered
, this, &DolphinMainWindow::toggleEditLocation
);
1575 QAction
* replaceLocation
= actionCollection()->addAction(QStringLiteral("replace_location"));
1576 replaceLocation
->setText(i18nc("@action:inmenu Navigation Bar", "Replace Location"));
1577 // i18n: "enter" is used both in the meaning of "writing" and "going to" a new location here.
1578 // Both meanings are useful but not necessary to understand the use of "Replace Location".
1579 // So you might want to be more verbose in your language to convey the meaning but it's up to you.
1580 replaceLocation
->setWhatsThis(xi18nc("@info:whatsthis",
1581 "This switches to editing the location and selects it "
1582 "so you can quickly enter a different location."));
1583 actionCollection()->setDefaultShortcut(replaceLocation
, Qt::CTRL
| Qt::Key_L
);
1584 connect(replaceLocation
, &QAction::triggered
, this, &DolphinMainWindow::replaceLocation
);
1588 QScopedPointer
<QAction
> backAction(KStandardAction::back(nullptr, nullptr, nullptr));
1589 m_backAction
= new KToolBarPopupAction(backAction
->icon(), backAction
->text(), actionCollection());
1590 m_backAction
->setObjectName(backAction
->objectName());
1591 m_backAction
->setShortcuts(backAction
->shortcuts());
1593 m_backAction
->setPopupMode(QToolButton::DelayedPopup
);
1594 connect(m_backAction
, &QAction::triggered
, this, &DolphinMainWindow::goBack
);
1595 connect(m_backAction
->menu(), &QMenu::aboutToShow
, this, &DolphinMainWindow::slotAboutToShowBackPopupMenu
);
1596 connect(m_backAction
->menu(), &QMenu::triggered
, this, &DolphinMainWindow::slotGoBack
);
1597 actionCollection()->addAction(m_backAction
->objectName(), m_backAction
);
1599 auto backShortcuts
= m_backAction
->shortcuts();
1600 backShortcuts
.append(QKeySequence(Qt::Key_Backspace
));
1601 actionCollection()->setDefaultShortcuts(m_backAction
, backShortcuts
);
1603 DolphinRecentTabsMenu
* recentTabsMenu
= new DolphinRecentTabsMenu(this);
1604 actionCollection()->addAction(QStringLiteral("closed_tabs"), recentTabsMenu
);
1605 connect(m_tabWidget
, &DolphinTabWidget::rememberClosedTab
,
1606 recentTabsMenu
, &DolphinRecentTabsMenu::rememberClosedTab
);
1607 connect(recentTabsMenu
, &DolphinRecentTabsMenu::restoreClosedTab
,
1608 m_tabWidget
, &DolphinTabWidget::restoreClosedTab
);
1609 connect(recentTabsMenu
, &DolphinRecentTabsMenu::closedTabsCountChanged
,
1610 this, &DolphinMainWindow::closedTabsCountChanged
);
1612 QAction
* undoCloseTab
= actionCollection()->addAction(QStringLiteral("undo_close_tab"));
1613 undoCloseTab
->setText(i18nc("@action:inmenu File", "Undo close tab"));
1614 undoCloseTab
->setWhatsThis(i18nc("@info:whatsthis undo close tab",
1615 "This returns you to the previously closed tab."));
1616 actionCollection()->setDefaultShortcut(undoCloseTab
, Qt::CTRL
| Qt::SHIFT
| Qt::Key_T
);
1617 undoCloseTab
->setIcon(QIcon::fromTheme(QStringLiteral("edit-undo")));
1618 undoCloseTab
->setEnabled(false);
1619 connect(undoCloseTab
, &QAction::triggered
, recentTabsMenu
, &DolphinRecentTabsMenu::undoCloseTab
);
1621 auto undoAction
= actionCollection()->action(KStandardAction::name(KStandardAction::Undo
));
1622 undoAction
->setWhatsThis(xi18nc("@info:whatsthis", "This undoes "
1623 "the last change you made to files or folders.<nl/>"
1624 "Such changes include <interface>creating, renaming</interface> "
1625 "and <interface>moving</interface> them to a different location "
1626 "or to the <filename>Trash</filename>. <nl/>Changes that can't "
1627 "be undone will ask for your confirmation."));
1628 undoAction
->setEnabled(false); // undo should be disabled by default
1631 QScopedPointer
<QAction
> forwardAction(KStandardAction::forward(nullptr, nullptr, nullptr));
1632 m_forwardAction
= new KToolBarPopupAction(forwardAction
->icon(), forwardAction
->text(), actionCollection());
1633 m_forwardAction
->setObjectName(forwardAction
->objectName());
1634 m_forwardAction
->setShortcuts(forwardAction
->shortcuts());
1636 m_forwardAction
->setPopupMode(QToolButton::DelayedPopup
);
1637 connect(m_forwardAction
, &QAction::triggered
, this, &DolphinMainWindow::goForward
);
1638 connect(m_forwardAction
->menu(), &QMenu::aboutToShow
, this, &DolphinMainWindow::slotAboutToShowForwardPopupMenu
);
1639 connect(m_forwardAction
->menu(), &QMenu::triggered
, this, &DolphinMainWindow::slotGoForward
);
1640 actionCollection()->addAction(m_forwardAction
->objectName(), m_forwardAction
);
1641 actionCollection()->setDefaultShortcuts(m_forwardAction
, m_forwardAction
->shortcuts());
1643 // enable middle-click to open in a new tab
1644 auto *middleClickEventFilter
= new MiddleClickActionEventFilter(this);
1645 connect(middleClickEventFilter
, &MiddleClickActionEventFilter::actionMiddleClicked
, this, &DolphinMainWindow::slotBackForwardActionMiddleClicked
);
1646 m_backAction
->menu()->installEventFilter(middleClickEventFilter
);
1647 m_forwardAction
->menu()->installEventFilter(middleClickEventFilter
);
1648 KStandardAction::up(this, &DolphinMainWindow::goUp
, actionCollection());
1649 QAction
* homeAction
= KStandardAction::home(this, &DolphinMainWindow::goHome
, actionCollection());
1650 homeAction
->setWhatsThis(xi18nc("@info:whatsthis", "Go to your "
1651 "<filename>Home</filename> folder.<nl/>Every user account "
1652 "has their own <filename>Home</filename> that contains their data "
1653 "including folders that contain personal application data."));
1655 // setup 'Tools' menu
1656 QAction
* compareFiles
= actionCollection()->addAction(QStringLiteral("compare_files"));
1657 compareFiles
->setText(i18nc("@action:inmenu Tools", "Compare Files"));
1658 compareFiles
->setIcon(QIcon::fromTheme(QStringLiteral("kompare")));
1659 compareFiles
->setEnabled(false);
1660 connect(compareFiles
, &QAction::triggered
, this, &DolphinMainWindow::compareFiles
);
1662 QAction
* openPreferredSearchTool
= actionCollection()->addAction(QStringLiteral("open_preferred_search_tool"));
1663 openPreferredSearchTool
->setText(i18nc("@action:inmenu Tools", "Open Preferred Search Tool"));
1664 openPreferredSearchTool
->setWhatsThis(xi18nc("@info:whatsthis",
1665 "<para>This opens a preferred search tool for the viewed location.</para>"
1666 "<para>Use <emphasis>More Search Tools</emphasis> menu to configure it.</para>"));
1667 openPreferredSearchTool
->setIcon(QIcon::fromTheme(QStringLiteral("search")));
1668 actionCollection()->setDefaultShortcut(openPreferredSearchTool
, Qt::CTRL
| Qt::SHIFT
| Qt::Key_F
);
1669 connect(openPreferredSearchTool
, &QAction::triggered
, this, &DolphinMainWindow::openPreferredSearchTool
);
1671 if (KAuthorized::authorize(QStringLiteral("shell_access"))) {
1672 QAction
* openTerminal
= actionCollection()->addAction(QStringLiteral("open_terminal"));
1673 openTerminal
->setText(i18nc("@action:inmenu Tools", "Open Terminal"));
1674 openTerminal
->setWhatsThis(xi18nc("@info:whatsthis",
1675 "<para>This opens a <emphasis>terminal</emphasis> application for the viewed location.</para>"
1676 "<para>To learn more about terminals use the help in the terminal application.</para>"));
1677 openTerminal
->setIcon(QIcon::fromTheme(QStringLiteral("utilities-terminal")));
1678 actionCollection()->setDefaultShortcut(openTerminal
, Qt::SHIFT
| Qt::Key_F4
);
1679 connect(openTerminal
, &QAction::triggered
, this, &DolphinMainWindow::openTerminal
);
1681 #ifdef HAVE_TERMINAL
1682 QAction
* focusTerminalPanel
= actionCollection()->addAction(QStringLiteral("focus_terminal_panel"));
1683 focusTerminalPanel
->setText(i18nc("@action:inmenu Tools", "Focus Terminal Panel"));
1684 focusTerminalPanel
->setIcon(QIcon::fromTheme(QStringLiteral("swap-panels")));
1685 actionCollection()->setDefaultShortcut(focusTerminalPanel
, Qt::CTRL
| Qt::SHIFT
| Qt::Key_F4
);
1686 connect(focusTerminalPanel
, &QAction::triggered
, this, &DolphinMainWindow::focusTerminalPanel
);
1690 // setup 'Bookmarks' menu
1691 KActionMenu
*bookmarkMenu
= new KActionMenu(i18nc("@title:menu", "&Bookmarks"), this);
1692 bookmarkMenu
->setIcon(QIcon::fromTheme(QStringLiteral("bookmarks")));
1693 // Make the toolbar button version work properly on click
1694 bookmarkMenu
->setPopupMode(QToolButton::InstantPopup
);
1695 m_bookmarkHandler
= new DolphinBookmarkHandler(this, actionCollection(), bookmarkMenu
->menu(), this);
1696 actionCollection()->addAction(QStringLiteral("bookmarks"), bookmarkMenu
);
1698 // setup 'Settings' menu
1699 KToggleAction
* showMenuBar
= KStandardAction::showMenubar(nullptr, nullptr, actionCollection());
1700 showMenuBar
->setWhatsThis(xi18nc("@info:whatsthis",
1701 "This switches between having a <emphasis>Menubar</emphasis> "
1702 "and having a <interface>Control</interface> button. Both "
1703 "contain mostly the same commands and configuration options."));
1704 connect(showMenuBar
, &KToggleAction::triggered
, // Fixes #286822
1705 this, &DolphinMainWindow::toggleShowMenuBar
, Qt::QueuedConnection
);
1706 KStandardAction::preferences(this, &DolphinMainWindow::editSettings
, actionCollection());
1708 // setup 'Help' menu for the m_controlButton. The other one is set up in the base class.
1709 m_helpMenu
= new KHelpMenu(nullptr);
1710 m_helpMenu
->menu()->installEventFilter(this);
1711 // remove duplicate shortcuts
1712 auto removeHelpActionShortcut
= [this](KHelpMenu::MenuId menuId
) {
1713 if (auto *action
= m_helpMenu
->action(menuId
)) {
1714 action
->setShortcut(QKeySequence());
1717 removeHelpActionShortcut(KHelpMenu::menuHelpContents
);
1718 removeHelpActionShortcut(KHelpMenu::menuWhatsThis
);
1720 // not in menu actions
1721 QList
<QKeySequence
> nextTabKeys
= KStandardShortcut::tabNext();
1722 nextTabKeys
.append(QKeySequence(Qt::CTRL
| Qt::Key_Tab
));
1724 QList
<QKeySequence
> prevTabKeys
= KStandardShortcut::tabPrev();
1725 prevTabKeys
.append(QKeySequence(Qt::CTRL
| Qt::SHIFT
| Qt::Key_Tab
));
1727 for (int i
= 0; i
< MaxActivateTabShortcuts
; ++i
) {
1728 QAction
* activateTab
= actionCollection()->addAction(QStringLiteral("activate_tab_%1").arg(i
));
1729 activateTab
->setText(i18nc("@action:inmenu", "Activate Tab %1", i
+ 1));
1730 activateTab
->setEnabled(false);
1731 connect(activateTab
, &QAction::triggered
, this, [this, i
]() { m_tabWidget
->activateTab(i
); });
1733 // only add default shortcuts for the first 9 tabs regardless of MaxActivateTabShortcuts
1735 actionCollection()->setDefaultShortcut(activateTab
, QStringLiteral("Alt+%1").arg(i
+ 1));
1739 QAction
* activateLastTab
= actionCollection()->addAction(QStringLiteral("activate_last_tab"));
1740 activateLastTab
->setText(i18nc("@action:inmenu", "Activate Last Tab"));
1741 activateLastTab
->setEnabled(false);
1742 connect(activateLastTab
, &QAction::triggered
, m_tabWidget
, &DolphinTabWidget::activateLastTab
);
1743 actionCollection()->setDefaultShortcut(activateLastTab
, Qt::ALT
| Qt::Key_0
);
1745 QAction
* activateNextTab
= actionCollection()->addAction(QStringLiteral("activate_next_tab"));
1746 activateNextTab
->setIconText(i18nc("@action:inmenu", "Next Tab"));
1747 activateNextTab
->setText(i18nc("@action:inmenu", "Activate Next Tab"));
1748 activateNextTab
->setEnabled(false);
1749 connect(activateNextTab
, &QAction::triggered
, m_tabWidget
, &DolphinTabWidget::activateNextTab
);
1750 actionCollection()->setDefaultShortcuts(activateNextTab
, nextTabKeys
);
1752 QAction
* activatePrevTab
= actionCollection()->addAction(QStringLiteral("activate_prev_tab"));
1753 activatePrevTab
->setIconText(i18nc("@action:inmenu", "Previous Tab"));
1754 activatePrevTab
->setText(i18nc("@action:inmenu", "Activate Previous Tab"));
1755 activatePrevTab
->setEnabled(false);
1756 connect(activatePrevTab
, &QAction::triggered
, m_tabWidget
, &DolphinTabWidget::activatePrevTab
);
1757 actionCollection()->setDefaultShortcuts(activatePrevTab
, prevTabKeys
);
1760 QAction
* showTarget
= actionCollection()->addAction(QStringLiteral("show_target"));
1761 showTarget
->setText(i18nc("@action:inmenu", "Show Target"));
1762 showTarget
->setIcon(QIcon::fromTheme(QStringLiteral("document-open-folder")));
1763 showTarget
->setEnabled(false);
1764 connect(showTarget
, &QAction::triggered
, this, &DolphinMainWindow::showTarget
);
1766 QAction
* openInNewTab
= actionCollection()->addAction(QStringLiteral("open_in_new_tab"));
1767 openInNewTab
->setText(i18nc("@action:inmenu", "Open in New Tab"));
1768 openInNewTab
->setIcon(QIcon::fromTheme(QStringLiteral("tab-new")));
1769 connect(openInNewTab
, &QAction::triggered
, this, &DolphinMainWindow::openInNewTab
);
1771 QAction
* openInNewTabs
= actionCollection()->addAction(QStringLiteral("open_in_new_tabs"));
1772 openInNewTabs
->setText(i18nc("@action:inmenu", "Open in New Tabs"));
1773 openInNewTabs
->setIcon(QIcon::fromTheme(QStringLiteral("tab-new")));
1774 connect(openInNewTabs
, &QAction::triggered
, this, &DolphinMainWindow::openInNewTab
);
1776 QAction
* openInNewWindow
= actionCollection()->addAction(QStringLiteral("open_in_new_window"));
1777 openInNewWindow
->setText(i18nc("@action:inmenu", "Open in New Window"));
1778 openInNewWindow
->setIcon(QIcon::fromTheme(QStringLiteral("window-new")));
1779 connect(openInNewWindow
, &QAction::triggered
, this, &DolphinMainWindow::openInNewWindow
);
1782 void DolphinMainWindow::setupDockWidgets()
1784 const bool lock
= GeneralSettings::lockPanels();
1786 KDualAction
* lockLayoutAction
= actionCollection()->add
<KDualAction
>(QStringLiteral("lock_panels"));
1787 lockLayoutAction
->setActiveText(i18nc("@action:inmenu Panels", "Unlock Panels"));
1788 lockLayoutAction
->setActiveIcon(QIcon::fromTheme(QStringLiteral("object-unlocked")));
1789 lockLayoutAction
->setInactiveText(i18nc("@action:inmenu Panels", "Lock Panels"));
1790 lockLayoutAction
->setInactiveIcon(QIcon::fromTheme(QStringLiteral("object-locked")));
1791 lockLayoutAction
->setWhatsThis(xi18nc("@info:whatsthis", "This "
1792 "switches between having panels <emphasis>locked</emphasis> or "
1793 "<emphasis>unlocked</emphasis>.<nl/>Unlocked panels can be "
1794 "dragged to the other side of the window and have a close "
1795 "button.<nl/>Locked panels are embedded more cleanly."));
1796 lockLayoutAction
->setActive(lock
);
1797 connect(lockLayoutAction
, &KDualAction::triggered
, this, &DolphinMainWindow::togglePanelLockState
);
1799 // Setup "Information"
1800 DolphinDockWidget
* infoDock
= new DolphinDockWidget(i18nc("@title:window", "Information"));
1801 infoDock
->setLocked(lock
);
1802 infoDock
->setObjectName(QStringLiteral("infoDock"));
1803 infoDock
->setAllowedAreas(Qt::LeftDockWidgetArea
| Qt::RightDockWidgetArea
);
1806 InformationPanel
* infoPanel
= new InformationPanel(infoDock
);
1807 infoPanel
->setCustomContextMenuActions({lockLayoutAction
});
1808 connect(infoPanel
, &InformationPanel::urlActivated
, this, &DolphinMainWindow::handleUrl
);
1809 infoDock
->setWidget(infoPanel
);
1811 QAction
* infoAction
= infoDock
->toggleViewAction();
1812 createPanelAction(QIcon::fromTheme(QStringLiteral("dialog-information")), Qt::Key_F11
, infoAction
, QStringLiteral("show_information_panel"));
1814 addDockWidget(Qt::RightDockWidgetArea
, infoDock
);
1815 connect(this, &DolphinMainWindow::urlChanged
,
1816 infoPanel
, &InformationPanel::setUrl
);
1817 connect(this, &DolphinMainWindow::selectionChanged
,
1818 infoPanel
, &InformationPanel::setSelection
);
1819 connect(this, &DolphinMainWindow::requestItemInfo
,
1820 infoPanel
, &InformationPanel::requestDelayedItemInfo
);
1821 connect(this, &DolphinMainWindow::fileItemsChanged
,
1822 infoPanel
, &InformationPanel::slotFilesItemChanged
);
1825 // i18n: This is the last paragraph for the "What's This"-texts of all four panels.
1826 const QString panelWhatsThis
= xi18nc("@info:whatsthis", "<para>To show or "
1827 "hide panels like this go to <interface>Control|Panels</interface> "
1828 "or <interface>View|Panels</interface>.</para>");
1830 actionCollection()->action(QStringLiteral("show_information_panel"))
1831 ->setWhatsThis(xi18nc("@info:whatsthis", "<para> This toggles the "
1832 "<emphasis>information</emphasis> panel at the right side of the "
1833 "window.</para><para>The panel provides in-depth information "
1834 "about the items your mouse is hovering over or about the selected "
1835 "items. Otherwise it informs you about the currently viewed folder.<nl/>"
1836 "For single items a preview of their contents is provided.</para>"));
1838 infoDock
->setWhatsThis(xi18nc("@info:whatsthis", "<para>This panel "
1839 "provides in-depth information about the items your mouse is "
1840 "hovering over or about the selected items. Otherwise it informs "
1841 "you about the currently viewed folder.<nl/>For single items a "
1842 "preview of their contents is provided.</para><para>You can configure "
1843 "which and how details are given here by right-clicking.</para>") + panelWhatsThis
);
1846 DolphinDockWidget
* foldersDock
= new DolphinDockWidget(i18nc("@title:window", "Folders"));
1847 foldersDock
->setLocked(lock
);
1848 foldersDock
->setObjectName(QStringLiteral("foldersDock"));
1849 foldersDock
->setAllowedAreas(Qt::LeftDockWidgetArea
| Qt::RightDockWidgetArea
);
1850 FoldersPanel
* foldersPanel
= new FoldersPanel(foldersDock
);
1851 foldersPanel
->setCustomContextMenuActions({lockLayoutAction
});
1852 foldersDock
->setWidget(foldersPanel
);
1854 QAction
* foldersAction
= foldersDock
->toggleViewAction();
1855 createPanelAction(QIcon::fromTheme(QStringLiteral("folder")), Qt::Key_F7
, foldersAction
, QStringLiteral("show_folders_panel"));
1857 addDockWidget(Qt::LeftDockWidgetArea
, foldersDock
);
1858 connect(this, &DolphinMainWindow::urlChanged
,
1859 foldersPanel
, &FoldersPanel::setUrl
);
1860 connect(foldersPanel
, &FoldersPanel::folderActivated
,
1861 this, &DolphinMainWindow::changeUrl
);
1862 connect(foldersPanel
, &FoldersPanel::folderMiddleClicked
,
1863 this, &DolphinMainWindow::openNewTab
);
1864 connect(foldersPanel
, &FoldersPanel::errorMessage
,
1865 this, &DolphinMainWindow::showErrorMessage
);
1867 actionCollection()->action(QStringLiteral("show_folders_panel"))
1868 ->setWhatsThis(xi18nc("@info:whatsthis", "This toggles the "
1869 "<emphasis>folders</emphasis> panel at the left side of the window."
1870 "<nl/><nl/>It shows the folders of the <emphasis>file system"
1871 "</emphasis> in a <emphasis>tree view</emphasis>."));
1872 foldersDock
->setWhatsThis(xi18nc("@info:whatsthis", "<para>This panel "
1873 "shows the folders of the <emphasis>file system</emphasis> in a "
1874 "<emphasis>tree view</emphasis>.</para><para>Click a folder to go "
1875 "there. Click the arrow to the left of a folder to see its subfolders. "
1876 "This allows quick switching between any folders.</para>") + panelWhatsThis
);
1879 #ifdef HAVE_TERMINAL
1880 if (KAuthorized::authorize(QStringLiteral("shell_access"))) {
1881 DolphinDockWidget
* terminalDock
= new DolphinDockWidget(i18nc("@title:window Shell terminal", "Terminal"));
1882 terminalDock
->setLocked(lock
);
1883 terminalDock
->setObjectName(QStringLiteral("terminalDock"));
1884 m_terminalPanel
= new TerminalPanel(terminalDock
);
1885 m_terminalPanel
->setCustomContextMenuActions({lockLayoutAction
});
1886 terminalDock
->setWidget(m_terminalPanel
);
1888 connect(m_terminalPanel
, &TerminalPanel::hideTerminalPanel
, terminalDock
, &DolphinDockWidget::hide
);
1889 connect(m_terminalPanel
, &TerminalPanel::changeUrl
, this, &DolphinMainWindow::slotTerminalDirectoryChanged
);
1890 connect(terminalDock
, &DolphinDockWidget::visibilityChanged
,
1891 m_terminalPanel
, &TerminalPanel::dockVisibilityChanged
);
1892 connect(terminalDock
, &DolphinDockWidget::visibilityChanged
,
1893 this, &DolphinMainWindow::slotTerminalPanelVisibilityChanged
);
1895 QAction
* terminalAction
= terminalDock
->toggleViewAction();
1896 createPanelAction(QIcon::fromTheme(QStringLiteral("dialog-scripts")), Qt::Key_F4
, terminalAction
, QStringLiteral("show_terminal_panel"));
1898 addDockWidget(Qt::BottomDockWidgetArea
, terminalDock
);
1899 connect(this, &DolphinMainWindow::urlChanged
,
1900 m_terminalPanel
, &TerminalPanel::setUrl
);
1902 if (GeneralSettings::version() < 200) {
1903 terminalDock
->hide();
1906 actionCollection()->action(QStringLiteral("show_terminal_panel"))
1907 ->setWhatsThis(xi18nc("@info:whatsthis", "<para>This toggles the "
1908 "<emphasis>terminal</emphasis> panel at the bottom of the window."
1909 "<nl/>The location in the terminal will always match the folder "
1910 "view so you can navigate using either.</para><para>The terminal "
1911 "panel is not needed for basic computer usage but can be useful "
1912 "for advanced tasks. To learn more about terminals use the help "
1913 "in a standalone terminal application like Konsole.</para>"));
1914 terminalDock
->setWhatsThis(xi18nc("@info:whatsthis", "<para>This is "
1915 "the <emphasis>terminal</emphasis> panel. It behaves like a "
1916 "normal terminal but will match the location of the folder view "
1917 "so you can navigate using either.</para><para>The terminal panel "
1918 "is not needed for basic computer usage but can be useful for "
1919 "advanced tasks. To learn more about terminals use the help in a "
1920 "standalone terminal application like Konsole.</para>") + panelWhatsThis
);
1924 if (GeneralSettings::version() < 200) {
1926 foldersDock
->hide();
1930 DolphinDockWidget
* placesDock
= new DolphinDockWidget(i18nc("@title:window", "Places"));
1931 placesDock
->setLocked(lock
);
1932 placesDock
->setObjectName(QStringLiteral("placesDock"));
1933 placesDock
->setAllowedAreas(Qt::LeftDockWidgetArea
| Qt::RightDockWidgetArea
);
1935 m_placesPanel
= new PlacesPanel(placesDock
);
1936 m_placesPanel
->setCustomContextMenuActions({lockLayoutAction
});
1937 placesDock
->setWidget(m_placesPanel
);
1939 QAction
*placesAction
= placesDock
->toggleViewAction();
1940 createPanelAction(QIcon::fromTheme(QStringLiteral("compass")), Qt::Key_F9
, placesAction
, QStringLiteral("show_places_panel"));
1942 addDockWidget(Qt::LeftDockWidgetArea
, placesDock
);
1943 connect(m_placesPanel
, &PlacesPanel::placeActivated
,
1944 this, &DolphinMainWindow::slotPlaceActivated
);
1945 connect(m_placesPanel
, &PlacesPanel::placeMiddleClicked
,
1946 this, &DolphinMainWindow::openNewTab
);
1947 connect(m_placesPanel
, &PlacesPanel::errorMessage
,
1948 this, &DolphinMainWindow::showErrorMessage
);
1949 connect(this, &DolphinMainWindow::urlChanged
,
1950 m_placesPanel
, &PlacesPanel::setUrl
);
1951 connect(placesDock
, &DolphinDockWidget::visibilityChanged
,
1952 &DolphinUrlNavigatorsController::slotPlacesPanelVisibilityChanged
);
1953 connect(this, &DolphinMainWindow::settingsChanged
,
1954 m_placesPanel
, &PlacesPanel::readSettings
);
1955 connect(m_placesPanel
, &PlacesPanel::storageTearDownRequested
,
1956 this, &DolphinMainWindow::slotStorageTearDownFromPlacesRequested
);
1957 connect(m_placesPanel
, &PlacesPanel::storageTearDownExternallyRequested
,
1958 this, &DolphinMainWindow::slotStorageTearDownExternallyRequested
);
1959 DolphinUrlNavigatorsController::slotPlacesPanelVisibilityChanged(m_placesPanel
->isVisible());
1961 auto actionShowAllPlaces
= new QAction(QIcon::fromTheme(QStringLiteral("view-hidden")), i18nc("@item:inmenu", "Show Hidden Places"), this);
1962 actionShowAllPlaces
->setCheckable(true);
1963 actionShowAllPlaces
->setDisabled(true);
1964 actionShowAllPlaces
->setWhatsThis(i18nc("@info:whatsthis", "This displays "
1965 "all places in the places panel that have been hidden. They will "
1966 "appear semi-transparent unless you uncheck their hide property."));
1968 connect(actionShowAllPlaces
, &QAction::triggered
, this, [actionShowAllPlaces
, this](bool checked
){
1969 actionShowAllPlaces
->setIcon(QIcon::fromTheme(checked
? QStringLiteral("view-visible") : QStringLiteral("view-hidden")));
1970 m_placesPanel
->showHiddenEntries(checked
);
1973 connect(m_placesPanel
, &PlacesPanel::showHiddenEntriesChanged
, this, [actionShowAllPlaces
] (bool checked
){
1974 actionShowAllPlaces
->setChecked(checked
);
1975 actionShowAllPlaces
->setIcon(QIcon::fromTheme(checked
? QStringLiteral("view-visible") : QStringLiteral("view-hidden")));
1978 actionCollection()->action(QStringLiteral("show_places_panel"))
1979 ->setWhatsThis(xi18nc("@info:whatsthis", "<para>This toggles the "
1980 "<emphasis>places</emphasis> panel at the left side of the window."
1981 "</para><para>It allows you to go to locations you have "
1982 "bookmarked and to access disk or media attached to the computer "
1983 "or to the network. It also contains sections to find recently "
1984 "saved files or files of a certain type.</para>"));
1985 placesDock
->setWhatsThis(xi18nc("@info:whatsthis", "<para>This is the "
1986 "<emphasis>Places</emphasis> panel. It allows you to go to locations "
1987 "you have bookmarked and to access disk or media attached to the "
1988 "computer or to the network. It also contains sections to find "
1989 "recently saved files or files of a certain type.</para><para>"
1990 "Click on an entry to go there. Click with the right mouse button "
1991 "instead to open any entry in a new tab or new window.</para>"
1992 "<para>New entries can be added by dragging folders onto this panel. "
1993 "Right-click any section or entry to hide it. Right-click an empty "
1994 "space on this panel and select <interface>Show Hidden Places"
1995 "</interface> to display it again.</para>") + panelWhatsThis
);
1997 // Add actions into the "Panels" menu
1998 KActionMenu
* panelsMenu
= new KActionMenu(i18nc("@action:inmenu View", "Show Panels"), this);
1999 actionCollection()->addAction(QStringLiteral("panels"), panelsMenu
);
2000 panelsMenu
->setIcon(QIcon::fromTheme(QStringLiteral("view-sidetree")));
2001 panelsMenu
->setPopupMode(QToolButton::InstantPopup
);
2002 const KActionCollection
* ac
= actionCollection();
2003 panelsMenu
->addAction(ac
->action(QStringLiteral("show_places_panel")));
2005 panelsMenu
->addAction(ac
->action(QStringLiteral("show_information_panel")));
2007 panelsMenu
->addAction(ac
->action(QStringLiteral("show_folders_panel")));
2008 panelsMenu
->addAction(ac
->action(QStringLiteral("show_terminal_panel")));
2009 panelsMenu
->addSeparator();
2010 panelsMenu
->addAction(actionShowAllPlaces
);
2011 panelsMenu
->addAction(lockLayoutAction
);
2013 connect(panelsMenu
->menu(), &QMenu::aboutToShow
, this, [actionShowAllPlaces
, this]{
2014 actionShowAllPlaces
->setEnabled(m_placesPanel
->hiddenListCount());
2019 void DolphinMainWindow::updateFileAndEditActions()
2021 const KFileItemList list
= m_activeViewContainer
->view()->selectedItems();
2022 const KActionCollection
* col
= actionCollection();
2023 KFileItemListProperties
capabilitiesSource(list
);
2025 QAction
* addToPlacesAction
= col
->action(QStringLiteral("add_to_places"));
2026 QAction
* copyToOtherViewAction
= col
->action(QStringLiteral("copy_to_inactive_split_view"));
2027 QAction
* moveToOtherViewAction
= col
->action(QStringLiteral("move_to_inactive_split_view"));
2028 QAction
* copyLocation
= col
->action(QString("copy_location"));
2030 if (list
.isEmpty()) {
2031 stateChanged(QStringLiteral("has_no_selection"));
2033 addToPlacesAction
->setEnabled(true);
2034 copyToOtherViewAction
->setEnabled(false);
2035 moveToOtherViewAction
->setEnabled(false);
2036 copyLocation
->setEnabled(false);
2038 stateChanged(QStringLiteral("has_selection"));
2040 QAction
* renameAction
= col
->action(KStandardAction::name(KStandardAction::RenameFile
));
2041 QAction
* moveToTrashAction
= col
->action(KStandardAction::name(KStandardAction::MoveToTrash
));
2042 QAction
* deleteAction
= col
->action(KStandardAction::name(KStandardAction::DeleteFile
));
2043 QAction
* cutAction
= col
->action(KStandardAction::name(KStandardAction::Cut
));
2044 QAction
* deleteWithTrashShortcut
= col
->action(QStringLiteral("delete_shortcut")); // see DolphinViewActionHandler
2045 QAction
* showTarget
= col
->action(QStringLiteral("show_target"));
2046 QAction
* duplicateAction
= col
->action(QStringLiteral("duplicate")); // see DolphinViewActionHandler
2048 if (list
.length() == 1 && list
.first().isDir()) {
2049 addToPlacesAction
->setEnabled(true);
2051 addToPlacesAction
->setEnabled(false);
2054 if (m_tabWidget
->currentTabPage()->splitViewEnabled()) {
2055 DolphinTabPage
* tabPage
= m_tabWidget
->currentTabPage();
2056 KFileItem capabilitiesDestination
;
2058 if (tabPage
->primaryViewActive()) {
2059 capabilitiesDestination
= tabPage
->secondaryViewContainer()->url();
2061 capabilitiesDestination
= tabPage
->primaryViewContainer()->url();
2064 copyToOtherViewAction
->setEnabled(capabilitiesDestination
.isWritable());
2065 moveToOtherViewAction
->setEnabled(capabilitiesSource
.supportsMoving() && capabilitiesDestination
.isWritable());
2067 copyToOtherViewAction
->setEnabled(false);
2068 moveToOtherViewAction
->setEnabled(false);
2071 const bool enableMoveToTrash
= capabilitiesSource
.isLocal() && capabilitiesSource
.supportsMoving();
2073 renameAction
->setEnabled(capabilitiesSource
.supportsMoving());
2074 moveToTrashAction
->setEnabled(enableMoveToTrash
);
2075 deleteAction
->setEnabled(capabilitiesSource
.supportsDeleting());
2076 deleteWithTrashShortcut
->setEnabled(capabilitiesSource
.supportsDeleting() && !enableMoveToTrash
);
2077 cutAction
->setEnabled(capabilitiesSource
.supportsMoving());
2078 copyLocation
->setEnabled(list
.length() == 1);
2079 showTarget
->setEnabled(list
.length() == 1 && list
.at(0).isLink());
2080 duplicateAction
->setEnabled(capabilitiesSource
.supportsWriting());
2084 void DolphinMainWindow::updateViewActions()
2086 m_actionHandler
->updateViewActions();
2088 QAction
* toggleFilterBarAction
= actionCollection()->action(QStringLiteral("toggle_filter"));
2089 toggleFilterBarAction
->setChecked(m_activeViewContainer
->isFilterBarVisible());
2091 updateSplitAction();
2094 void DolphinMainWindow::updateGoActions()
2096 QAction
* goUpAction
= actionCollection()->action(KStandardAction::name(KStandardAction::Up
));
2097 const QUrl currentUrl
= m_activeViewContainer
->url();
2098 // I think this is one of the best places to firstly be confronted
2099 // with a file system and its hierarchy. Talking about the root
2100 // directory might seem too much here but it is the question that
2101 // naturally arises in this context.
2102 goUpAction
->setWhatsThis(xi18nc("@info:whatsthis", "<para>Go to "
2103 "the folder that contains the currently viewed one.</para>"
2104 "<para>All files and folders are organized in a hierarchical "
2105 "<emphasis>file system</emphasis>. At the top of this hierarchy is "
2106 "a directory that contains all data connected to this computer"
2107 "—the <emphasis>root directory</emphasis>.</para>"));
2108 goUpAction
->setEnabled(KIO::upUrl(currentUrl
) != currentUrl
);
2111 void DolphinMainWindow::refreshViews()
2113 m_tabWidget
->refreshViews();
2115 if (GeneralSettings::modifiedStartupSettings()) {
2116 updateWindowTitle();
2119 Q_EMIT
settingsChanged();
2122 void DolphinMainWindow::clearStatusBar()
2124 m_activeViewContainer
->statusBar()->resetToDefaultText();
2127 void DolphinMainWindow::connectViewSignals(DolphinViewContainer
* container
)
2129 connect(container
, &DolphinViewContainer::showFilterBarChanged
,
2130 this, &DolphinMainWindow::updateFilterBarAction
);
2131 connect(container
, &DolphinViewContainer::writeStateChanged
,
2132 this, &DolphinMainWindow::slotWriteStateChanged
);
2133 connect(container
, &DolphinViewContainer::searchModeEnabledChanged
,
2134 this, &DolphinMainWindow::updateSearchAction
);
2135 connect(container
, &DolphinViewContainer::captionChanged
,
2136 this, &DolphinMainWindow::updateWindowTitle
);
2138 const QAction
* toggleSearchAction
= actionCollection()->action(QStringLiteral("toggle_search"));
2139 connect(toggleSearchAction
, &QAction::triggered
, container
, &DolphinViewContainer::setSearchModeEnabled
);
2141 const DolphinView
* view
= container
->view();
2142 connect(view
, &DolphinView::selectionChanged
,
2143 this, &DolphinMainWindow::slotSelectionChanged
);
2144 connect(view
, &DolphinView::requestItemInfo
,
2145 this, &DolphinMainWindow::requestItemInfo
);
2146 connect(view
, &DolphinView::fileItemsChanged
,
2147 this, &DolphinMainWindow::fileItemsChanged
);
2148 connect(view
, &DolphinView::tabRequested
,
2149 this, &DolphinMainWindow::openNewTab
);
2150 connect(view
, &DolphinView::requestContextMenu
,
2151 this, &DolphinMainWindow::openContextMenu
);
2152 connect(view
, &DolphinView::directoryLoadingStarted
,
2153 this, &DolphinMainWindow::enableStopAction
);
2154 connect(view
, &DolphinView::directoryLoadingCompleted
,
2155 this, &DolphinMainWindow::disableStopAction
);
2156 connect(view
, &DolphinView::directoryLoadingCompleted
,
2157 this, &DolphinMainWindow::slotDirectoryLoadingCompleted
);
2158 connect(view
, &DolphinView::goBackRequested
,
2159 this, &DolphinMainWindow::goBack
);
2160 connect(view
, &DolphinView::goForwardRequested
,
2161 this, &DolphinMainWindow::goForward
);
2162 connect(view
, &DolphinView::urlActivated
,
2163 this, &DolphinMainWindow::handleUrl
);
2164 connect(view
, &DolphinView::goUpRequested
,
2165 this, &DolphinMainWindow::goUp
);
2167 connect(container
->urlNavigatorInternalWithHistory(), &KUrlNavigator::urlChanged
,
2168 this, &DolphinMainWindow::changeUrl
);
2169 connect(container
->urlNavigatorInternalWithHistory(), &KUrlNavigator::historyChanged
,
2170 this, &DolphinMainWindow::updateHistory
);
2172 auto navigators
= static_cast<DolphinNavigatorsWidgetAction
*>
2173 (actionCollection()->action(QStringLiteral("url_navigators")));
2174 const KUrlNavigator
*navigator
= m_tabWidget
->currentTabPage()->primaryViewActive() ?
2175 navigators
->primaryUrlNavigator() :
2176 navigators
->secondaryUrlNavigator();
2178 QAction
*editableLocactionAction
= actionCollection()->action(QStringLiteral("editable_location"));
2179 editableLocactionAction
->setChecked(navigator
->isUrlEditable());
2180 connect(navigator
, &KUrlNavigator::editableStateChanged
,
2181 this, &DolphinMainWindow::slotEditableStateChanged
);
2182 connect(navigator
, &KUrlNavigator::tabRequested
,
2183 this, &DolphinMainWindow::openNewTab
);
2187 void DolphinMainWindow::updateSplitAction()
2189 QAction
* splitAction
= actionCollection()->action(QStringLiteral("split_view"));
2190 const DolphinTabPage
* tabPage
= m_tabWidget
->currentTabPage();
2191 if (tabPage
->splitViewEnabled()) {
2192 if (GeneralSettings::closeActiveSplitView() ? tabPage
->primaryViewActive() : !tabPage
->primaryViewActive()) {
2193 splitAction
->setText(i18nc("@action:intoolbar Close left view", "Close"));
2194 splitAction
->setToolTip(i18nc("@info", "Close left view"));
2195 splitAction
->setIcon(QIcon::fromTheme(QStringLiteral("view-left-close")));
2197 splitAction
->setText(i18nc("@action:intoolbar Close right view", "Close"));
2198 splitAction
->setToolTip(i18nc("@info", "Close right view"));
2199 splitAction
->setIcon(QIcon::fromTheme(QStringLiteral("view-right-close")));
2202 splitAction
->setText(i18nc("@action:intoolbar Split view", "Split"));
2203 splitAction
->setToolTip(i18nc("@info", "Split view"));
2204 splitAction
->setIcon(QIcon::fromTheme(QStringLiteral("view-right-new")));
2208 void DolphinMainWindow::updateAllowedToolbarAreas()
2210 auto navigators
= static_cast<DolphinNavigatorsWidgetAction
*>
2211 (actionCollection()->action(QStringLiteral("url_navigators")));
2212 if (toolBar()->actions().contains(navigators
)) {
2213 toolBar()->setAllowedAreas(Qt::TopToolBarArea
| Qt::BottomToolBarArea
);
2214 if (toolBarArea(toolBar()) == Qt::LeftToolBarArea
||
2215 toolBarArea(toolBar()) == Qt::RightToolBarArea
) {
2216 addToolBar(Qt::TopToolBarArea
, toolBar());
2219 toolBar()->setAllowedAreas(Qt::AllToolBarAreas
);
2223 bool DolphinMainWindow::isKompareInstalled() const
2225 static bool initialized
= false;
2226 static bool installed
= false;
2228 // TODO: maybe replace this approach later by using a menu
2229 // plugin like kdiff3plugin.cpp
2230 installed
= !QStandardPaths::findExecutable(QStringLiteral("kompare")).isEmpty();
2236 void DolphinMainWindow::createPanelAction(const QIcon
& icon
,
2237 const QKeySequence
& shortcut
,
2238 QAction
* dockAction
,
2239 const QString
& actionName
)
2241 QAction
* panelAction
= actionCollection()->addAction(actionName
);
2242 panelAction
->setCheckable(true);
2243 panelAction
->setChecked(dockAction
->isChecked());
2244 panelAction
->setText(dockAction
->text());
2245 panelAction
->setIcon(icon
);
2246 actionCollection()->setDefaultShortcut(panelAction
, shortcut
);
2248 connect(panelAction
, &QAction::triggered
, dockAction
, &QAction::trigger
);
2249 connect(dockAction
, &QAction::toggled
, panelAction
, &QAction::setChecked
);
2252 void DolphinMainWindow::setupWhatsThis()
2255 menuBar()->setWhatsThis(xi18nc("@info:whatsthis", "<para>This is the "
2256 "<emphasis>Menubar</emphasis>. It provides access to commands and "
2257 "configuration options. Left-click on any of the menus on this "
2258 "bar to see its contents.</para><para>The Menubar can be hidden "
2259 "by unchecking <interface>Settings|Show Menubar</interface>. Then "
2260 "most of its contents become available through a <interface>Control"
2261 "</interface> button on the <emphasis>Toolbar</emphasis>.</para>"));
2262 toolBar()->setWhatsThis(xi18nc("@info:whatsthis", "<para>This is the "
2263 "<emphasis>Toolbar</emphasis>. It allows quick access to "
2264 "frequently used actions.</para><para>It is highly customizable. "
2265 "All items you see in the <interface>Control</interface> menu or "
2266 "in the <interface>Menubar</interface> can be placed on the "
2267 "Toolbar. Just right-click on it and select <interface>Configure "
2268 "Toolbars…</interface> or find this action in the <interface>"
2269 "Control</interface> or <interface>Settings</interface> menu."
2270 "</para><para>The location of the bar and the style of its "
2271 "buttons can also be changed in the right-click menu. Right-click "
2272 "a button if you want to show or hide its text.</para>"));
2273 m_tabWidget
->setWhatsThis(xi18nc("@info:whatsthis main view",
2274 "<para>Here you can see the <emphasis>folders</emphasis> and "
2275 "<emphasis>files</emphasis> that are at the location described in "
2276 "the <interface>Location Bar</interface> above. This area is the "
2277 "central part of this application where you navigate to the files "
2278 "you want to use.</para><para>For an elaborate and general "
2279 "introduction to this application <link "
2280 "url='https://userbase.kde.org/Dolphin/File_Management#Introduction_to_Dolphin'>"
2281 "click here</link>. This will open an introductory article from "
2282 "the <emphasis>KDE UserBase Wiki</emphasis>.</para><para>For brief "
2283 "explanations of all the features of this <emphasis>view</emphasis> "
2284 "<link url='help:/dolphin/dolphin-view.html'>click here</link> "
2285 "instead. This will open a page from the <emphasis>Handbook"
2286 "</emphasis> that covers the basics.</para>"));
2289 actionCollection()->action(KStandardAction::name(KStandardAction::KeyBindings
))
2290 ->setWhatsThis(xi18nc("@info:whatsthis","<para>This opens a window "
2291 "that lists the <emphasis>keyboard shortcuts</emphasis>.<nl/>"
2292 "There you can set up key combinations to trigger an action when "
2293 "they are pressed simultaneously. All commands in this application can "
2294 "be triggered this way.</para>"));
2295 actionCollection()->action(KStandardAction::name(KStandardAction::ConfigureToolbars
))
2296 ->setWhatsThis(xi18nc("@info:whatsthis","<para>This opens a window in which "
2297 "you can change which buttons appear on the <emphasis>Toolbar</emphasis>.</para>"
2298 "<para>All items you see in the <interface>Control</interface> menu "
2299 "or in the <interface>Menubar</interface> can also be placed on the Toolbar.</para>"));
2300 actionCollection()->action(KStandardAction::name(KStandardAction::Preferences
))
2301 ->setWhatsThis(xi18nc("@info:whatsthis","This opens a window where you can "
2302 "change a multitude of settings for this application. For an explanation "
2303 "of the various settings go to the chapter <emphasis>Configuring Dolphin"
2304 "</emphasis> in <interface>Help|Dolphin Handbook</interface>."));
2307 // The whatsthis has to be set for the m_helpMenu and for the
2308 // StandardAction separately because both are used in different locations.
2309 // m_helpMenu is only used for createControlButton() button.
2311 auto setStandardActionWhatsThis
= [this](KStandardAction::StandardAction actionId
,
2312 const QString
&whatsThis
) {
2313 if (auto *action
= actionCollection()->action(KStandardAction::name(actionId
))) {
2314 action
->setWhatsThis(whatsThis
);
2317 auto setHelpActionWhatsThis
= [this](KHelpMenu::MenuId menuId
, const QString
&whatsThis
) {
2318 if (auto *action
= m_helpMenu
->action(menuId
)) {
2319 action
->setWhatsThis(whatsThis
);
2323 // Links do not work within the Menubar so texts without links are provided there.
2325 // i18n: If the external link isn't available in your language you should
2326 // probably state the external link language at least in brackets to not
2327 // frustrate the user. If there are multiple languages that the user might
2328 // know with a reasonable chance you might want to have 2 external links.
2329 // The same is in my opinion true for every external link you translate.
2330 const QString whatsThisHelpContents
= xi18nc("@info:whatsthis handbook",
2331 "<para>This opens the Handbook for this application. It provides "
2332 "explanations for every part of <emphasis>Dolphin</emphasis>.</para>");
2333 setStandardActionWhatsThis(KStandardAction::HelpContents
, whatsThisHelpContents
2334 + xi18nc("@info:whatsthis second half of handbook hb text without link",
2335 "<para>If you want more elaborate introductions to the "
2336 "different features of <emphasis>Dolphin</emphasis> "
2337 "go to the KDE UserBase Wiki.</para>"));
2338 setHelpActionWhatsThis(KHelpMenu::menuHelpContents
, whatsThisHelpContents
2339 + xi18nc("@info:whatsthis second half of handbook text with link",
2340 "<para>If you want more elaborate introductions to the "
2341 "different features of <emphasis>Dolphin</emphasis> "
2342 "<link url='https://userbase.kde.org/Dolphin/File_Management'>click here</link>. "
2343 "It will open the dedicated page in the KDE UserBase Wiki.</para>"));
2345 const QString whatsThisWhatsThis
= xi18nc("@info:whatsthis whatsthis button",
2346 "<para>This is the button that invokes the help feature you are "
2347 "using right now! Click it, then click any component of this "
2348 "application to ask \"What's this?\" about it. The mouse cursor "
2349 "will change appearance if no help is available for a spot.</para>");
2350 setStandardActionWhatsThis(KStandardAction::WhatsThis
, whatsThisWhatsThis
2351 + xi18nc("@info:whatsthis second half of whatsthis button text without link",
2352 "<para>There are two other ways to get help for this application: The "
2353 "<interface>Dolphin Handbook</interface> in the <interface>Help"
2354 "</interface> menu and the <emphasis>KDE UserBase Wiki</emphasis> "
2355 "article about <emphasis>File Management</emphasis> online."
2356 "</para><para>The \"What's this?\" help is "
2357 "missing in most other windows so don't get too used to this.</para>"));
2358 setHelpActionWhatsThis(KHelpMenu::menuWhatsThis
, whatsThisWhatsThis
2359 + xi18nc("@info:whatsthis second half of whatsthis button text with link",
2360 "<para>There are two other ways to get help: "
2361 "The <link url='help:/dolphin/index.html'>Dolphin Handbook</link> and "
2362 "the <link url='https://userbase.kde.org/Dolphin/File_Management'>KDE "
2363 "UserBase Wiki</link>.</para><para>The \"What's this?\" help is "
2364 "missing in most other windows so don't get too used to this.</para>"));
2366 const QString whatsThisReportBug
= xi18nc("@info:whatsthis","<para>This opens a "
2367 "window that will guide you through reporting errors or flaws "
2368 "in this application or in other KDE software.</para>");
2369 setStandardActionWhatsThis(KStandardAction::ReportBug
, whatsThisReportBug
);
2370 setHelpActionWhatsThis(KHelpMenu::menuReportBug
, whatsThisReportBug
2371 + xi18nc("@info:whatsthis second half of reportbug text with link",
2372 "<para>High-quality bug reports are much appreciated. To learn "
2373 "how to make your bug report as effective as possible "
2374 "<link url='https://community.kde.org/Get_Involved/Bug_Reporting'>"
2375 "click here</link>.</para>"));
2377 const QString whatsThisDonate
= xi18nc("@info:whatsthis","<para>This opens a "
2378 "<emphasis>web page</emphasis> where you can donate to "
2379 "support the continued work on this application and many "
2380 "other projects by the <emphasis>KDE</emphasis> community.</para>"
2381 "<para>Donating is the easiest and fastest way to efficiently "
2382 "support KDE and its projects. KDE projects are available for "
2383 "free therefore your donation is needed to cover things that "
2384 "require money like servers, contributor meetings, etc.</para>"
2385 "<para><emphasis>KDE e.V.</emphasis> is the non-profit "
2386 "organization behind the KDE community.</para>");
2387 setStandardActionWhatsThis(KStandardAction::Donate
, whatsThisDonate
);
2388 setHelpActionWhatsThis(KHelpMenu::menuDonate
, whatsThisDonate
);
2390 const QString whatsThisSwitchLanguage
= xi18nc("@info:whatsthis",
2391 "With this you can change the language this application uses."
2392 "<nl/>You can even set secondary languages which will be used "
2393 "if texts are not available in your preferred language.");
2394 setStandardActionWhatsThis(KStandardAction::SwitchApplicationLanguage
,
2395 whatsThisSwitchLanguage
);
2396 setHelpActionWhatsThis(KHelpMenu::menuSwitchLanguage
, whatsThisSwitchLanguage
);
2398 const QString whatsThisAboutApp
= xi18nc("@info:whatsthis","This opens a "
2399 "window that informs you about the version, license, "
2400 "used libraries and maintainers of this application.");
2401 setStandardActionWhatsThis(KStandardAction::AboutApp
, whatsThisAboutApp
);
2402 setHelpActionWhatsThis(KHelpMenu::menuAboutApp
, whatsThisAboutApp
);
2404 const QString whatsThisAboutKDE
= xi18nc("@info:whatsthis","This opens a "
2405 "window with information about <emphasis>KDE</emphasis>. "
2406 "The KDE community are the people behind this free software."
2407 "<nl/>If you like using this application but don't know "
2408 "about KDE or want to see a cute dragon have a look!");
2409 setStandardActionWhatsThis(KStandardAction::AboutKDE
, whatsThisAboutKDE
);
2410 setHelpActionWhatsThis(KHelpMenu::menuAboutKDE
, whatsThisAboutKDE
);
2413 bool DolphinMainWindow::addHamburgerMenuToToolbar()
2415 QDomDocument domDocument
= KXMLGUIClient::domDocument();
2416 if (domDocument
.isNull()) {
2419 QDomNode toolbar
= domDocument
.elementsByTagName(QStringLiteral("ToolBar")).at(0);
2420 if (toolbar
.isNull()) {
2424 QDomElement hamburgerMenuElement
= domDocument
.createElement(QStringLiteral("Action"));
2425 hamburgerMenuElement
.setAttribute(QStringLiteral("name"), QStringLiteral("hamburger_menu"));
2426 toolbar
.appendChild(hamburgerMenuElement
);
2428 KXMLGUIFactory::saveConfigFile(domDocument
, xmlFile());
2432 // Make sure to also remove the <KXMLGUIFactory> and <QDomDocument> include
2433 // whenever this method is removed (maybe in the year ~2026).
2436 bool DolphinMainWindow::event(QEvent
*event
)
2438 if (event
->type() == QEvent::WhatsThisClicked
) {
2440 QWhatsThisClickedEvent
* whatsThisEvent
= dynamic_cast<QWhatsThisClickedEvent
*>(event
);
2441 QDesktopServices::openUrl(QUrl(whatsThisEvent
->href()));
2444 return KXmlGuiWindow::event(event
);
2447 bool DolphinMainWindow::eventFilter(QObject
* obj
, QEvent
* event
)
2450 if (event
->type() == QEvent::WhatsThisClicked
) {
2452 QWhatsThisClickedEvent
* whatsThisEvent
= dynamic_cast<QWhatsThisClickedEvent
*>(event
);
2453 QDesktopServices::openUrl(QUrl(whatsThisEvent
->href()));
2459 // Set a sane initial window size
2460 QSize
DolphinMainWindow::sizeHint() const
2462 return KXmlGuiWindow::sizeHint().expandedTo(QSize(760, 550));
2465 void DolphinMainWindow::saveNewToolbarConfig()
2467 KXmlGuiWindow::saveNewToolbarConfig(); // Applies the new config. This has to be called first
2468 // because the rest of this method decides things
2469 // based on the new config.
2470 auto navigators
= static_cast<DolphinNavigatorsWidgetAction
*>
2471 (actionCollection()->action(QStringLiteral("url_navigators")));
2472 if (!toolBar()->actions().contains(navigators
)) {
2473 m_tabWidget
->currentTabPage()->insertNavigatorsWidget(navigators
);
2475 updateAllowedToolbarAreas();
2476 (static_cast<KHamburgerMenu
*>(actionCollection()->action(KStandardAction::name(
2477 KStandardAction::HamburgerMenu
))))->hideActionsOf(toolBar());
2480 void DolphinMainWindow::focusTerminalPanel()
2482 if (m_terminalPanel
->isVisible()) {
2483 if (m_terminalPanel
->terminalHasFocus()) {
2484 m_activeViewContainer
->view()->setFocus(Qt::FocusReason::ShortcutFocusReason
);
2485 actionCollection()->action(QStringLiteral("focus_terminal_panel"))->setText(i18nc("@action:inmenu Tools", "Focus Terminal Panel"));
2487 m_terminalPanel
->setFocus(Qt::FocusReason::ShortcutFocusReason
);
2488 actionCollection()->action(QStringLiteral("focus_terminal_panel"))->setText(i18nc("@action:inmenu Tools", "Defocus Terminal Panel"));
2491 actionCollection()->action(QStringLiteral("show_terminal_panel"))->trigger();
2492 actionCollection()->action(QStringLiteral("focus_terminal_panel"))->setText(i18nc("@action:inmenu Tools", "Defocus Terminal Panel"));
2496 DolphinMainWindow::UndoUiInterface::UndoUiInterface() :
2497 KIO::FileUndoManager::UiInterface()
2501 DolphinMainWindow::UndoUiInterface::~UndoUiInterface()
2505 void DolphinMainWindow::UndoUiInterface::jobError(KIO::Job
* job
)
2507 DolphinMainWindow
* mainWin
= qobject_cast
<DolphinMainWindow
*>(parentWidget());
2509 DolphinViewContainer
* container
= mainWin
->activeViewContainer();
2510 container
->showMessage(job
->errorString(), DolphinViewContainer::Error
);
2512 KIO::FileUndoManager::UiInterface::jobError(job
);
2516 bool DolphinMainWindow::isUrlOpen(const QString
& url
)
2518 return m_tabWidget
->isUrlOpen(QUrl::fromUserInput((url
)));