1 /***************************************************************************
2 * Copyright (C) 2006 by Peter Penz <peter.penz19@gmail.com> *
3 * Copyright (C) 2006 by Stefan Monov <logixoul@gmail.com> *
4 * Copyright (C) 2006 by Cvetoslav Ludmiloff <ludmiloff@gmail.com> *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the *
18 * Free Software Foundation, Inc., *
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
20 ***************************************************************************/
22 #include "dolphinmainwindow.h"
24 #include "config-terminal.h"
26 #include "dolphinbookmarkhandler.h"
27 #include "dolphindockwidget.h"
28 #include "dolphincontextmenu.h"
29 #include "dolphinnewfilemenu.h"
30 #include "dolphinrecenttabsmenu.h"
31 #include "dolphinviewcontainer.h"
32 #include "dolphintabpage.h"
33 #include "middleclickactioneventfilter.h"
34 #include "panels/folders/folderspanel.h"
35 #include "panels/places/placespanel.h"
36 #include "panels/information/informationpanel.h"
37 #include "panels/terminal/terminalpanel.h"
38 #include "settings/dolphinsettingsdialog.h"
39 #include "statusbar/dolphinstatusbar.h"
40 #include "views/dolphinviewactionhandler.h"
41 #include "views/dolphinremoteencoding.h"
42 #include "views/draganddrophelper.h"
43 #include "views/viewproperties.h"
44 #include "views/dolphinnewfilemenuobserver.h"
45 #include "dolphin_generalsettings.h"
47 #include <KActionCollection>
48 #include <KActionMenu>
49 #include <KAuthorized>
51 #include <KDualAction>
52 #include <KFileItemListProperties>
54 #include <KIO/JobUiDelegate>
55 #include <KIO/OpenFileManagerWindowJob>
56 #include <KJobWidgets>
57 #include <KLocalizedString>
58 #include <KMessageBox>
59 #include <KProtocolInfo>
60 #include <KProtocolManager>
63 #include <KStandardAction>
64 #include <KStartupInfo>
65 #include <KToggleAction>
67 #include <KToolInvocation>
68 #include <KUrlComboBox>
69 #include <KUrlNavigator>
70 #include <KWindowSystem>
72 #include <QApplication>
74 #include <QCloseEvent>
75 #include <QDesktopServices>
81 #include <QPushButton>
83 #include <QStandardPaths>
85 #include <QToolButton>
86 #include <QWhatsThisClickedEvent>
89 // Used for GeneralSettings::version() to determine whether
90 // an updated version of Dolphin is running.
91 const int CurrentDolphinVersion
= 200;
94 DolphinMainWindow::DolphinMainWindow() :
95 KXmlGuiWindow(nullptr, Qt::WindowContextHelpButtonHint
),
96 m_newFileMenu(nullptr),
99 m_activeViewContainer(nullptr),
100 m_actionHandler(nullptr),
101 m_remoteEncoding(nullptr),
103 m_bookmarkHandler(nullptr),
104 m_controlButton(nullptr),
105 m_updateToolBarTimer(nullptr),
106 m_lastHandleUrlStatJob(nullptr),
107 m_terminalPanel(nullptr),
108 m_placesPanel(nullptr),
109 m_tearDownFromPlacesRequested(false)
111 Q_INIT_RESOURCE(dolphin
);
112 setComponentName(QStringLiteral("dolphin"), QGuiApplication::applicationDisplayName());
113 setObjectName(QStringLiteral("Dolphin#"));
115 connect(&DolphinNewFileMenuObserver::instance(), &DolphinNewFileMenuObserver::errorMessage
,
116 this, &DolphinMainWindow::showErrorMessage
);
118 KIO::FileUndoManager
* undoManager
= KIO::FileUndoManager::self();
119 undoManager
->setUiInterface(new UndoUiInterface());
121 connect(undoManager
, QOverload
<bool>::of(&KIO::FileUndoManager::undoAvailable
),
122 this, &DolphinMainWindow::slotUndoAvailable
);
123 connect(undoManager
, &KIO::FileUndoManager::undoTextChanged
,
124 this, &DolphinMainWindow::slotUndoTextChanged
);
125 connect(undoManager
, &KIO::FileUndoManager::jobRecordingStarted
,
126 this, &DolphinMainWindow::clearStatusBar
);
127 connect(undoManager
, &KIO::FileUndoManager::jobRecordingFinished
,
128 this, &DolphinMainWindow::showCommand
);
130 GeneralSettings
* generalSettings
= GeneralSettings::self();
131 const bool firstRun
= (generalSettings
->version() < 200);
133 generalSettings
->setViewPropsTimestamp(QDateTime::currentDateTime());
136 setAcceptDrops(true);
138 m_tabWidget
= new DolphinTabWidget(this);
139 m_tabWidget
->setObjectName("tabWidget");
140 connect(m_tabWidget
, &DolphinTabWidget::activeViewChanged
,
141 this, &DolphinMainWindow::activeViewChanged
);
142 connect(m_tabWidget
, &DolphinTabWidget::tabCountChanged
,
143 this, &DolphinMainWindow::tabCountChanged
);
144 connect(m_tabWidget
, &DolphinTabWidget::currentUrlChanged
,
145 this, &DolphinMainWindow::updateWindowTitle
);
146 setCentralWidget(m_tabWidget
);
150 m_actionHandler
= new DolphinViewActionHandler(actionCollection(), this);
151 connect(m_actionHandler
, &DolphinViewActionHandler::actionBeingHandled
, this, &DolphinMainWindow::clearStatusBar
);
152 connect(m_actionHandler
, &DolphinViewActionHandler::createDirectoryTriggered
, this, &DolphinMainWindow::createDirectory
);
154 m_remoteEncoding
= new DolphinRemoteEncoding(this, m_actionHandler
);
155 connect(this, &DolphinMainWindow::urlChanged
,
156 m_remoteEncoding
, &DolphinRemoteEncoding::slotAboutToOpenUrl
);
160 setupGUI(Keys
| Save
| Create
| ToolBar
);
161 stateChanged(QStringLiteral("new_file"));
163 QClipboard
* clipboard
= QApplication::clipboard();
164 connect(clipboard
, &QClipboard::dataChanged
,
165 this, &DolphinMainWindow::updatePasteAction
);
167 QAction
* showFilterBarAction
= actionCollection()->action(QStringLiteral("show_filter_bar"));
168 showFilterBarAction
->setChecked(generalSettings
->filterBar());
171 menuBar()->setVisible(false);
172 // Assure a proper default size if Dolphin runs the first time
176 const bool showMenu
= !menuBar()->isHidden();
177 QAction
* showMenuBarAction
= actionCollection()->action(KStandardAction::name(KStandardAction::ShowMenubar
));
178 showMenuBarAction
->setChecked(showMenu
); // workaround for bug #171080
180 createControlButton();
183 // enable middle-click on back/forward/up to open in a new tab
184 auto *middleClickEventFilter
= new MiddleClickActionEventFilter(this);
185 connect(middleClickEventFilter
, &MiddleClickActionEventFilter::actionMiddleClicked
, this, &DolphinMainWindow::slotToolBarActionMiddleClicked
);
186 toolBar()->installEventFilter(middleClickEventFilter
);
191 DolphinMainWindow::~DolphinMainWindow()
195 QVector
<DolphinViewContainer
*> DolphinMainWindow::viewContainers() const
197 QVector
<DolphinViewContainer
*> viewContainers
;
198 viewContainers
.reserve(m_tabWidget
->count());
199 for (int i
= 0; i
< m_tabWidget
->count(); ++i
) {
200 viewContainers
<< m_tabWidget
->tabPageAt(i
)->activeViewContainer();
202 return viewContainers
;
205 void DolphinMainWindow::openDirectories(const QList
<QUrl
>& dirs
, bool splitView
)
207 m_tabWidget
->openDirectories(dirs
, splitView
);
210 void DolphinMainWindow::openDirectories(const QStringList
& dirs
, bool splitView
)
212 openDirectories(QUrl::fromStringList(dirs
), splitView
);
215 void DolphinMainWindow::openFiles(const QList
<QUrl
>& files
, bool splitView
)
217 m_tabWidget
->openFiles(files
, splitView
);
220 void DolphinMainWindow::openFiles(const QStringList
& files
, bool splitView
)
222 openFiles(QUrl::fromStringList(files
), splitView
);
225 void DolphinMainWindow::activateWindow()
227 KStartupInfo::setNewStartupId(window(), KStartupInfo::startupId());
228 KWindowSystem::activateWindow(window()->effectiveWinId());
231 void DolphinMainWindow::showCommand(CommandType command
)
233 DolphinStatusBar
* statusBar
= m_activeViewContainer
->statusBar();
235 case KIO::FileUndoManager::Copy
:
236 statusBar
->setText(i18nc("@info:status", "Successfully copied."));
238 case KIO::FileUndoManager::Move
:
239 statusBar
->setText(i18nc("@info:status", "Successfully moved."));
241 case KIO::FileUndoManager::Link
:
242 statusBar
->setText(i18nc("@info:status", "Successfully linked."));
244 case KIO::FileUndoManager::Trash
:
245 statusBar
->setText(i18nc("@info:status", "Successfully moved to trash."));
247 case KIO::FileUndoManager::Rename
:
248 statusBar
->setText(i18nc("@info:status", "Successfully renamed."));
251 case KIO::FileUndoManager::Mkdir
:
252 statusBar
->setText(i18nc("@info:status", "Created folder."));
260 void DolphinMainWindow::pasteIntoFolder()
262 m_activeViewContainer
->view()->pasteIntoFolder();
265 void DolphinMainWindow::changeUrl(const QUrl
&url
)
267 if (!KProtocolManager::supportsListing(url
)) {
268 // The URL navigator only checks for validity, not
269 // if the URL can be listed. An error message is
270 // shown due to DolphinViewContainer::restoreView().
274 m_activeViewContainer
->setUrl(url
);
280 emit
urlChanged(url
);
283 void DolphinMainWindow::slotTerminalDirectoryChanged(const QUrl
& url
)
285 if (m_tearDownFromPlacesRequested
&& url
== QUrl::fromLocalFile(QDir::homePath())) {
286 m_placesPanel
->proceedWithTearDown();
287 m_tearDownFromPlacesRequested
= false;
290 m_activeViewContainer
->setAutoGrabFocus(false);
292 m_activeViewContainer
->setAutoGrabFocus(true);
295 void DolphinMainWindow::slotEditableStateChanged(bool editable
)
297 KToggleAction
* editableLocationAction
=
298 static_cast<KToggleAction
*>(actionCollection()->action(QStringLiteral("editable_location")));
299 editableLocationAction
->setChecked(editable
);
302 void DolphinMainWindow::slotSelectionChanged(const KFileItemList
& selection
)
306 const int selectedUrlsCount
= m_tabWidget
->currentTabPage()->selectedItemsCount();
308 QAction
* compareFilesAction
= actionCollection()->action(QStringLiteral("compare_files"));
309 if (selectedUrlsCount
== 2) {
310 compareFilesAction
->setEnabled(isKompareInstalled());
312 compareFilesAction
->setEnabled(false);
315 emit
selectionChanged(selection
);
318 void DolphinMainWindow::updateHistory()
320 const KUrlNavigator
* urlNavigator
= m_activeViewContainer
->urlNavigator();
321 const int index
= urlNavigator
->historyIndex();
323 QAction
* backAction
= actionCollection()->action(KStandardAction::name(KStandardAction::Back
));
325 backAction
->setToolTip(i18nc("@info", "Go back"));
326 backAction
->setWhatsThis(i18nc("@info:whatsthis go back", "Return to the previously viewed folder."));
327 backAction
->setEnabled(index
< urlNavigator
->historySize() - 1);
330 QAction
* forwardAction
= actionCollection()->action(KStandardAction::name(KStandardAction::Forward
));
332 forwardAction
->setToolTip(i18nc("@info", "Go forward"));
333 forwardAction
->setWhatsThis(xi18nc("@info:whatsthis go forward",
334 "This undoes a <interface>Go|Back</interface> action."));
335 forwardAction
->setEnabled(index
> 0);
339 void DolphinMainWindow::updateFilterBarAction(bool show
)
341 QAction
* showFilterBarAction
= actionCollection()->action(QStringLiteral("show_filter_bar"));
342 showFilterBarAction
->setChecked(show
);
345 void DolphinMainWindow::openNewMainWindow()
347 Dolphin::openNewWindow({m_activeViewContainer
->url()}, this);
350 void DolphinMainWindow::openNewActivatedTab()
352 m_tabWidget
->openNewActivatedTab();
355 void DolphinMainWindow::openNewTab(const QUrl
& url
, DolphinTabWidget::TabPlacement tabPlacement
)
357 m_tabWidget
->openNewTab(url
, QUrl(), tabPlacement
);
360 void DolphinMainWindow::openNewTabAfterCurrentTab(const QUrl
& url
)
362 m_tabWidget
->openNewTab(url
, QUrl(), DolphinTabWidget::AfterCurrentTab
);
365 void DolphinMainWindow::openNewTabAfterLastTab(const QUrl
& url
)
367 m_tabWidget
->openNewTab(url
, QUrl(), DolphinTabWidget::AfterLastTab
);
370 void DolphinMainWindow::openInNewTab()
372 const KFileItemList
& list
= m_activeViewContainer
->view()->selectedItems();
373 bool tabCreated
= false;
375 foreach (const KFileItem
& item
, list
) {
376 const QUrl
& url
= DolphinView::openItemAsFolderUrl(item
);
377 if (!url
.isEmpty()) {
378 openNewTabAfterCurrentTab(url
);
383 // if no new tab has been created from the selection
384 // open the current directory in a new tab
386 openNewTabAfterCurrentTab(m_activeViewContainer
->url());
390 void DolphinMainWindow::openInNewWindow()
394 const KFileItemList list
= m_activeViewContainer
->view()->selectedItems();
395 if (list
.isEmpty()) {
396 newWindowUrl
= m_activeViewContainer
->url();
397 } else if (list
.count() == 1) {
398 const KFileItem
& item
= list
.first();
399 newWindowUrl
= DolphinView::openItemAsFolderUrl(item
);
402 if (!newWindowUrl
.isEmpty()) {
403 Dolphin::openNewWindow({newWindowUrl
}, this);
407 void DolphinMainWindow::showTarget()
409 const auto link
= m_activeViewContainer
->view()->selectedItems().at(0);
410 const auto linkLocationDir
= QFileInfo(link
.localPath()).absoluteDir();
411 auto linkDestination
= link
.linkDest();
412 if (QFileInfo(linkDestination
).isRelative()) {
413 linkDestination
= linkLocationDir
.filePath(linkDestination
);
415 if (QFileInfo::exists(linkDestination
)) {
416 KIO::highlightInFileManager({QUrl::fromLocalFile(linkDestination
).adjusted(QUrl::StripTrailingSlash
)});
418 m_activeViewContainer
->showMessage(xi18nc("@info", "Could not access <filename>%1</filename>.", linkDestination
),
419 DolphinViewContainer::Warning
);
423 void DolphinMainWindow::showEvent(QShowEvent
* event
)
425 KXmlGuiWindow::showEvent(event
);
427 if (!event
->spontaneous()) {
428 m_activeViewContainer
->view()->setFocus();
432 void DolphinMainWindow::closeEvent(QCloseEvent
* event
)
434 // Find out if Dolphin is closed directly by the user or
435 // by the session manager because the session is closed
436 bool closedByUser
= true;
437 if (qApp
->isSavingSession()) {
438 closedByUser
= false;
441 if (m_tabWidget
->count() > 1 && GeneralSettings::confirmClosingMultipleTabs() && closedByUser
) {
442 // Ask the user if he really wants to quit and close all tabs.
443 // Open a confirmation dialog with 3 buttons:
444 // QDialogButtonBox::Yes -> Quit
445 // QDialogButtonBox::No -> Close only the current tab
446 // QDialogButtonBox::Cancel -> do nothing
447 QDialog
*dialog
= new QDialog(this, Qt::Dialog
);
448 dialog
->setWindowTitle(i18nc("@title:window", "Confirmation"));
449 dialog
->setModal(true);
450 QDialogButtonBox
* buttons
= new QDialogButtonBox(QDialogButtonBox::Yes
| QDialogButtonBox::No
| QDialogButtonBox::Cancel
);
451 KGuiItem::assign(buttons
->button(QDialogButtonBox::Yes
), KGuiItem(i18nc("@action:button 'Quit Dolphin' button", "&Quit %1", QGuiApplication::applicationDisplayName()), QIcon::fromTheme(QStringLiteral("application-exit"))));
452 KGuiItem::assign(buttons
->button(QDialogButtonBox::No
), KGuiItem(i18n("C&lose Current Tab"), QIcon::fromTheme(QStringLiteral("tab-close"))));
453 KGuiItem::assign(buttons
->button(QDialogButtonBox::Cancel
), KStandardGuiItem::cancel());
454 buttons
->button(QDialogButtonBox::Yes
)->setDefault(true);
456 bool doNotAskAgainCheckboxResult
= false;
458 const auto result
= KMessageBox::createKMessageBox(dialog
,
460 QMessageBox::Warning
,
461 i18n("You have multiple tabs open in this window, are you sure you want to quit?"),
463 i18n("Do not ask again"),
464 &doNotAskAgainCheckboxResult
,
465 KMessageBox::Notify
);
467 if (doNotAskAgainCheckboxResult
) {
468 GeneralSettings::setConfirmClosingMultipleTabs(false);
472 case QDialogButtonBox::Yes
:
475 case QDialogButtonBox::No
:
476 // Close only the current tab
477 m_tabWidget
->closeTab();
485 if (m_terminalPanel
->hasProgramRunning() && GeneralSettings::confirmClosingTerminalRunningProgram() && closedByUser
) {
486 // Ask if the user really wants to quit Dolphin with a program that is still running in the Terminal panel
487 // Open a confirmation dialog with 3 buttons:
488 // QDialogButtonBox::Yes -> Quit
489 // QDialogButtonBox::No -> Show Terminal Panel
490 // QDialogButtonBox::Cancel -> do nothing
491 QDialog
*dialog
= new QDialog(this, Qt::Dialog
);
492 dialog
->setWindowTitle(i18nc("@title:window", "Confirmation"));
493 dialog
->setModal(true);
494 auto standardButtons
= QDialogButtonBox::Yes
| QDialogButtonBox::Cancel
;
495 if (!m_terminalPanel
->isVisible()) {
496 standardButtons
|= QDialogButtonBox::No
;
498 QDialogButtonBox
*buttons
= new QDialogButtonBox(standardButtons
);
499 KGuiItem::assign(buttons
->button(QDialogButtonBox::Yes
), KStandardGuiItem::quit());
500 if (!m_terminalPanel
->isVisible()) {
502 buttons
->button(QDialogButtonBox::No
),
503 KGuiItem(i18n("Show &Terminal Panel"), QIcon::fromTheme(QStringLiteral("utilities-terminal"))));
505 KGuiItem::assign(buttons
->button(QDialogButtonBox::Cancel
), KStandardGuiItem::cancel());
507 bool doNotAskAgainCheckboxResult
= false;
509 const auto result
= KMessageBox::createKMessageBox(
512 QMessageBox::Warning
,
513 i18n("The program '%1' is still running in the Terminal panel. Are you sure you want to quit?", m_terminalPanel
->runningProgramName()),
515 i18n("Do not ask again"),
516 &doNotAskAgainCheckboxResult
,
517 KMessageBox::Dangerous
);
519 if (doNotAskAgainCheckboxResult
) {
520 GeneralSettings::setConfirmClosingTerminalRunningProgram(false);
524 case QDialogButtonBox::Yes
:
527 case QDialogButtonBox::No
:
528 actionCollection()->action("show_terminal_panel")->trigger();
529 // Do not quit, ignore quit event
537 GeneralSettings::setVersion(CurrentDolphinVersion
);
538 GeneralSettings::self()->save();
540 KXmlGuiWindow::closeEvent(event
);
543 void DolphinMainWindow::saveProperties(KConfigGroup
& group
)
545 m_tabWidget
->saveProperties(group
);
548 void DolphinMainWindow::readProperties(const KConfigGroup
& group
)
550 m_tabWidget
->readProperties(group
);
553 void DolphinMainWindow::updateNewMenu()
555 m_newFileMenu
->setViewShowsHiddenFiles(activeViewContainer()->view()->hiddenFilesShown());
556 m_newFileMenu
->checkUpToDate();
557 m_newFileMenu
->setPopupFiles(activeViewContainer()->url());
560 void DolphinMainWindow::createDirectory()
562 m_newFileMenu
->setViewShowsHiddenFiles(activeViewContainer()->view()->hiddenFilesShown());
563 m_newFileMenu
->setPopupFiles(activeViewContainer()->url());
564 m_newFileMenu
->createDirectory();
567 void DolphinMainWindow::quit()
572 void DolphinMainWindow::showErrorMessage(const QString
& message
)
574 m_activeViewContainer
->showMessage(message
, DolphinViewContainer::Error
);
577 void DolphinMainWindow::slotUndoAvailable(bool available
)
579 QAction
* undoAction
= actionCollection()->action(KStandardAction::name(KStandardAction::Undo
));
581 undoAction
->setEnabled(available
);
585 void DolphinMainWindow::slotUndoTextChanged(const QString
& text
)
587 QAction
* undoAction
= actionCollection()->action(KStandardAction::name(KStandardAction::Undo
));
589 undoAction
->setText(text
);
593 void DolphinMainWindow::undo()
596 KIO::FileUndoManager::self()->uiInterface()->setParentWidget(this);
597 KIO::FileUndoManager::self()->undo();
600 void DolphinMainWindow::cut()
602 m_activeViewContainer
->view()->cutSelectedItems();
605 void DolphinMainWindow::copy()
607 m_activeViewContainer
->view()->copySelectedItems();
610 void DolphinMainWindow::paste()
612 m_activeViewContainer
->view()->paste();
615 void DolphinMainWindow::find()
617 m_activeViewContainer
->setSearchModeEnabled(true);
620 void DolphinMainWindow::updatePasteAction()
622 QAction
* pasteAction
= actionCollection()->action(KStandardAction::name(KStandardAction::Paste
));
623 QPair
<bool, QString
> pasteInfo
= m_activeViewContainer
->view()->pasteInfo();
624 pasteAction
->setEnabled(pasteInfo
.first
);
625 pasteAction
->setText(pasteInfo
.second
);
628 void DolphinMainWindow::slotDirectoryLoadingCompleted()
633 void DolphinMainWindow::slotToolBarActionMiddleClicked(QAction
*action
)
635 if (action
== actionCollection()->action(KStandardAction::name(KStandardAction::Back
))) {
637 } else if (action
== actionCollection()->action(KStandardAction::name(KStandardAction::Forward
))) {
639 } else if (action
== actionCollection()->action(QStringLiteral("go_up"))) {
641 } else if (action
== actionCollection()->action(QStringLiteral("go_home"))) {
646 void DolphinMainWindow::selectAll()
650 // if the URL navigator is editable and focused, select the whole
651 // URL instead of all items of the view
653 KUrlNavigator
* urlNavigator
= m_activeViewContainer
->urlNavigator();
654 QLineEdit
* lineEdit
= urlNavigator
->editor()->lineEdit();
655 const bool selectUrl
= urlNavigator
->isUrlEditable() &&
656 lineEdit
->hasFocus();
658 lineEdit
->selectAll();
660 m_activeViewContainer
->view()->selectAll();
664 void DolphinMainWindow::invertSelection()
667 m_activeViewContainer
->view()->invertSelection();
670 void DolphinMainWindow::toggleSplitView()
672 DolphinTabPage
* tabPage
= m_tabWidget
->currentTabPage();
673 tabPage
->setSplitViewEnabled(!tabPage
->splitViewEnabled());
678 void DolphinMainWindow::toggleSplitStash()
680 DolphinTabPage
* tabPage
= m_tabWidget
->currentTabPage();
681 tabPage
->setSplitViewEnabled(false);
682 tabPage
->setSplitViewEnabled(true, QUrl("stash:/"));
685 void DolphinMainWindow::reloadView()
688 m_activeViewContainer
->reload();
689 m_activeViewContainer
->statusBar()->updateSpaceInfo();
692 void DolphinMainWindow::stopLoading()
694 m_activeViewContainer
->view()->stopLoading();
697 void DolphinMainWindow::enableStopAction()
699 actionCollection()->action(QStringLiteral("stop"))->setEnabled(true);
702 void DolphinMainWindow::disableStopAction()
704 actionCollection()->action(QStringLiteral("stop"))->setEnabled(false);
707 void DolphinMainWindow::showFilterBar()
709 m_activeViewContainer
->setFilterBarVisible(true);
712 void DolphinMainWindow::toggleEditLocation()
716 QAction
* action
= actionCollection()->action(QStringLiteral("editable_location"));
717 KUrlNavigator
* urlNavigator
= m_activeViewContainer
->urlNavigator();
718 urlNavigator
->setUrlEditable(action
->isChecked());
721 void DolphinMainWindow::replaceLocation()
723 KUrlNavigator
* navigator
= m_activeViewContainer
->urlNavigator();
724 QLineEdit
* lineEdit
= navigator
->editor()->lineEdit();
726 // If the text field currently has focus and everything is selected,
727 // pressing the keyboard shortcut returns the whole thing to breadcrumb mode
728 if (navigator
->isUrlEditable()
729 && lineEdit
->hasFocus()
730 && lineEdit
->selectedText() == lineEdit
->text() ) {
731 navigator
->setUrlEditable(false);
733 navigator
->setUrlEditable(true);
734 navigator
->setFocus();
735 lineEdit
->selectAll();
739 void DolphinMainWindow::togglePanelLockState()
741 const bool newLockState
= !GeneralSettings::lockPanels();
742 foreach (QObject
* child
, children()) {
743 DolphinDockWidget
* dock
= qobject_cast
<DolphinDockWidget
*>(child
);
745 dock
->setLocked(newLockState
);
749 GeneralSettings::setLockPanels(newLockState
);
752 void DolphinMainWindow::slotTerminalPanelVisibilityChanged()
754 if (m_terminalPanel
->isHiddenInVisibleWindow() && m_activeViewContainer
) {
755 m_activeViewContainer
->view()->setFocus();
759 void DolphinMainWindow::goBack()
761 KUrlNavigator
* urlNavigator
= m_activeViewContainer
->urlNavigator();
762 urlNavigator
->goBack();
764 if (urlNavigator
->locationState().isEmpty()) {
765 // An empty location state indicates a redirection URL,
766 // which must be skipped too
767 urlNavigator
->goBack();
771 void DolphinMainWindow::goForward()
773 m_activeViewContainer
->urlNavigator()->goForward();
776 void DolphinMainWindow::goUp()
778 m_activeViewContainer
->urlNavigator()->goUp();
781 void DolphinMainWindow::goHome()
783 m_activeViewContainer
->urlNavigator()->goHome();
786 void DolphinMainWindow::goBackInNewTab()
788 KUrlNavigator
* urlNavigator
= activeViewContainer()->urlNavigator();
789 const int index
= urlNavigator
->historyIndex() + 1;
790 openNewTabAfterCurrentTab(urlNavigator
->locationUrl(index
));
793 void DolphinMainWindow::goForwardInNewTab()
795 KUrlNavigator
* urlNavigator
= activeViewContainer()->urlNavigator();
796 const int index
= urlNavigator
->historyIndex() - 1;
797 openNewTabAfterCurrentTab(urlNavigator
->locationUrl(index
));
800 void DolphinMainWindow::goUpInNewTab()
802 const QUrl currentUrl
= activeViewContainer()->urlNavigator()->locationUrl();
803 openNewTabAfterCurrentTab(KIO::upUrl(currentUrl
));
806 void DolphinMainWindow::goHomeInNewTab()
808 openNewTabAfterCurrentTab(Dolphin::homeUrl());
811 void DolphinMainWindow::compareFiles()
813 const KFileItemList items
= m_tabWidget
->currentTabPage()->selectedItems();
814 if (items
.count() != 2) {
815 // The action is disabled in this case, but it could have been triggered
816 // via D-Bus, see https://bugs.kde.org/show_bug.cgi?id=325517
820 QUrl urlA
= items
.at(0).url();
821 QUrl urlB
= items
.at(1).url();
823 QString
command(QStringLiteral("kompare -c \""));
824 command
.append(urlA
.toDisplayString(QUrl::PreferLocalFile
));
825 command
.append("\" \"");
826 command
.append(urlB
.toDisplayString(QUrl::PreferLocalFile
));
827 command
.append('\"');
828 KRun::runCommand(command
, QStringLiteral("Kompare"), QStringLiteral("kompare"), this);
831 void DolphinMainWindow::toggleShowMenuBar()
833 const bool visible
= menuBar()->isVisible();
834 menuBar()->setVisible(!visible
);
836 createControlButton();
838 deleteControlButton();
842 void DolphinMainWindow::openTerminal()
844 QString
dir(QDir::homePath());
846 // If the given directory is not local, it can still be the URL of an
847 // ioslave using UDS_LOCAL_PATH which to be converted first.
848 KIO::StatJob
* statJob
= KIO::mostLocalUrl(m_activeViewContainer
->url());
849 KJobWidgets::setWindow(statJob
, this);
851 QUrl url
= statJob
->mostLocalUrl();
853 //If the URL is local after the above conversion, set the directory.
854 if (url
.isLocalFile()) {
855 dir
= url
.toLocalFile();
858 KToolInvocation::invokeTerminal(QString(), dir
);
861 void DolphinMainWindow::editSettings()
863 if (!m_settingsDialog
) {
864 DolphinViewContainer
* container
= activeViewContainer();
865 container
->view()->writeSettings();
867 const QUrl url
= container
->url();
868 DolphinSettingsDialog
* settingsDialog
= new DolphinSettingsDialog(url
, this);
869 connect(settingsDialog
, &DolphinSettingsDialog::settingsChanged
, this, &DolphinMainWindow::refreshViews
);
870 settingsDialog
->setAttribute(Qt::WA_DeleteOnClose
);
871 settingsDialog
->show();
872 m_settingsDialog
= settingsDialog
;
874 m_settingsDialog
.data()->raise();
878 void DolphinMainWindow::handleUrl(const QUrl
& url
)
880 delete m_lastHandleUrlStatJob
;
881 m_lastHandleUrlStatJob
= nullptr;
883 if (url
.isLocalFile() && QFileInfo(url
.toLocalFile()).isDir()) {
884 activeViewContainer()->setUrl(url
);
885 } else if (KProtocolManager::supportsListing(url
)) {
886 // stat the URL to see if it is a dir or not
887 m_lastHandleUrlStatJob
= KIO::stat(url
, KIO::HideProgressInfo
);
888 if (m_lastHandleUrlStatJob
->uiDelegate()) {
889 KJobWidgets::setWindow(m_lastHandleUrlStatJob
, this);
891 connect(m_lastHandleUrlStatJob
, &KIO::Job::result
,
892 this, &DolphinMainWindow::slotHandleUrlStatFinished
);
895 new KRun(url
, this); // Automatically deletes itself after being finished
899 void DolphinMainWindow::slotHandleUrlStatFinished(KJob
* job
)
901 m_lastHandleUrlStatJob
= nullptr;
902 const KIO::UDSEntry entry
= static_cast<KIO::StatJob
*>(job
)->statResult();
903 const QUrl url
= static_cast<KIO::StatJob
*>(job
)->url();
905 activeViewContainer()->setUrl(url
);
907 new KRun(url
, this); // Automatically deletes itself after being finished
911 void DolphinMainWindow::slotWriteStateChanged(bool isFolderWritable
)
913 // trash:/ is writable but we don't want to create new items in it.
914 // TODO: remove the trash check once https://phabricator.kde.org/T8234 is implemented
915 newFileMenu()->setEnabled(isFolderWritable
&& m_activeViewContainer
->url().scheme() != QLatin1String("trash"));
918 void DolphinMainWindow::openContextMenu(const QPoint
& pos
,
919 const KFileItem
& item
,
921 const QList
<QAction
*>& customActions
)
923 QPointer
<DolphinContextMenu
> contextMenu
= new DolphinContextMenu(this, pos
, item
, url
);
924 contextMenu
.data()->setCustomActions(customActions
);
925 const DolphinContextMenu::Command command
= contextMenu
.data()->open();
928 case DolphinContextMenu::OpenParentFolder
:
929 changeUrl(KIO::upUrl(item
.url()));
930 m_activeViewContainer
->view()->markUrlsAsSelected({item
.url()});
931 m_activeViewContainer
->view()->markUrlAsCurrent(item
.url());
934 case DolphinContextMenu::OpenParentFolderInNewWindow
:
935 Dolphin::openNewWindow({item
.url()}, this, Dolphin::OpenNewWindowFlag::Select
);
938 case DolphinContextMenu::OpenParentFolderInNewTab
:
939 openNewTabAfterLastTab(KIO::upUrl(item
.url()));
942 case DolphinContextMenu::None
:
947 // Delete the menu, unless it has been deleted in its own nested event loop already.
949 contextMenu
->deleteLater();
953 void DolphinMainWindow::updateControlMenu()
955 QMenu
* menu
= qobject_cast
<QMenu
*>(sender());
958 // All actions get cleared by QMenu::clear(). This includes the sub-menus
959 // because 'menu' is their parent.
962 KActionCollection
* ac
= actionCollection();
964 // Add "Create New" menu
965 menu
->addMenu(m_newFileMenu
->menu());
967 menu
->addSeparator();
969 // Overwrite Find action to Search action
970 QAction
*searchAction
= ac
->action(KStandardAction::name(KStandardAction::Find
));
971 searchAction
->setText(i18n("Search..."));
973 // Add "Edit" actions
974 bool added
= addActionToMenu(ac
->action(KStandardAction::name(KStandardAction::Undo
)), menu
) |
975 addActionToMenu(searchAction
, menu
) |
976 addActionToMenu(ac
->action(KStandardAction::name(KStandardAction::SelectAll
)), menu
) |
977 addActionToMenu(ac
->action(QStringLiteral("invert_selection")), menu
);
980 menu
->addSeparator();
983 // Add "View" actions
984 if (!GeneralSettings::showZoomSlider()) {
985 addActionToMenu(ac
->action(KStandardAction::name(KStandardAction::ZoomIn
)), menu
);
986 addActionToMenu(ac
->action(KStandardAction::name(KStandardAction::ZoomOut
)), menu
);
987 menu
->addSeparator();
990 added
= addActionToMenu(ac
->action(QStringLiteral("sort")), menu
) |
991 addActionToMenu(ac
->action(QStringLiteral("view_mode")), menu
) |
992 addActionToMenu(ac
->action(QStringLiteral("additional_info")), menu
) |
993 addActionToMenu(ac
->action(QStringLiteral("show_preview")), menu
) |
994 addActionToMenu(ac
->action(QStringLiteral("show_in_groups")), menu
) |
995 addActionToMenu(ac
->action(QStringLiteral("show_hidden_files")), menu
);
998 menu
->addSeparator();
1001 added
= addActionToMenu(ac
->action(QStringLiteral("split_view")), menu
) |
1002 addActionToMenu(ac
->action(KStandardAction::name(KStandardAction::Redisplay
)), menu
) |
1003 addActionToMenu(ac
->action(QStringLiteral("view_properties")), menu
);
1005 menu
->addSeparator();
1008 addActionToMenu(ac
->action(QStringLiteral("panels")), menu
);
1009 QMenu
* locationBarMenu
= new QMenu(i18nc("@action:inmenu", "Location Bar"), menu
);
1010 locationBarMenu
->addAction(ac
->action(QStringLiteral("editable_location")));
1011 locationBarMenu
->addAction(ac
->action(QStringLiteral("replace_location")));
1012 menu
->addMenu(locationBarMenu
);
1014 menu
->addSeparator();
1017 QMenu
* goMenu
= new QMenu(i18nc("@action:inmenu", "Go"), menu
);
1018 goMenu
->addAction(ac
->action(KStandardAction::name(KStandardAction::Back
)));
1019 goMenu
->addAction(ac
->action(KStandardAction::name(KStandardAction::Forward
)));
1020 goMenu
->addAction(ac
->action(KStandardAction::name(KStandardAction::Up
)));
1021 goMenu
->addAction(ac
->action(KStandardAction::name(KStandardAction::Home
)));
1022 goMenu
->addAction(ac
->action(QStringLiteral("closed_tabs")));
1023 KActionMenu
*bookmarkMenu
= new KActionMenu(i18nc("@title:menu", "&Bookmarks"), goMenu
);
1024 m_bookmarkHandler
->fillControlMenu(bookmarkMenu
->menu(), ac
);
1025 goMenu
->addAction(bookmarkMenu
);
1026 menu
->addMenu(goMenu
);
1029 QMenu
* toolsMenu
= new QMenu(i18nc("@action:inmenu", "Tools"), menu
);
1030 toolsMenu
->addAction(ac
->action(QStringLiteral("show_filter_bar")));
1031 toolsMenu
->addAction(ac
->action(QStringLiteral("compare_files")));
1032 toolsMenu
->addAction(ac
->action(QStringLiteral("open_terminal")));
1033 toolsMenu
->addAction(ac
->action(QStringLiteral("change_remote_encoding")));
1034 menu
->addMenu(toolsMenu
);
1036 // Add "Settings" menu entries
1037 addActionToMenu(ac
->action(KStandardAction::name(KStandardAction::KeyBindings
)), menu
);
1038 addActionToMenu(ac
->action(KStandardAction::name(KStandardAction::ConfigureToolbars
)), menu
);
1039 addActionToMenu(ac
->action(KStandardAction::name(KStandardAction::Preferences
)), menu
);
1042 menu
->addMenu(m_helpMenu
->menu());
1044 menu
->addSeparator();
1045 addActionToMenu(ac
->action(KStandardAction::name(KStandardAction::ShowMenubar
)), menu
);
1048 void DolphinMainWindow::updateToolBar()
1050 if (!menuBar()->isVisible()) {
1051 createControlButton();
1055 void DolphinMainWindow::slotControlButtonDeleted()
1057 m_controlButton
= nullptr;
1058 m_updateToolBarTimer
->start();
1061 void DolphinMainWindow::slotPlaceActivated(const QUrl
& url
)
1063 DolphinViewContainer
* view
= activeViewContainer();
1065 if (view
->url() == url
) {
1066 // We can end up here if the user clicked a device in the Places Panel
1067 // which had been unmounted earlier, see https://bugs.kde.org/show_bug.cgi?id=161385.
1074 void DolphinMainWindow::closedTabsCountChanged(unsigned int count
)
1076 actionCollection()->action(QStringLiteral("undo_close_tab"))->setEnabled(count
> 0);
1079 void DolphinMainWindow::activeViewChanged(DolphinViewContainer
* viewContainer
)
1081 DolphinViewContainer
* oldViewContainer
= m_activeViewContainer
;
1082 Q_ASSERT(viewContainer
);
1084 m_activeViewContainer
= viewContainer
;
1086 if (oldViewContainer
) {
1087 // Disconnect all signals between the old view container (container,
1088 // view and url navigator) and main window.
1089 oldViewContainer
->disconnect(this);
1090 oldViewContainer
->view()->disconnect(this);
1091 oldViewContainer
->urlNavigator()->disconnect(this);
1093 // except the requestItemInfo so that on hover the information panel can still be updated
1094 connect(oldViewContainer
->view(), &DolphinView::requestItemInfo
,
1095 this, &DolphinMainWindow::requestItemInfo
);
1098 connectViewSignals(viewContainer
);
1100 m_actionHandler
->setCurrentView(viewContainer
->view());
1103 updateEditActions();
1104 updatePasteAction();
1105 updateViewActions();
1108 const QUrl url
= viewContainer
->url();
1109 emit
urlChanged(url
);
1112 void DolphinMainWindow::tabCountChanged(int count
)
1114 const bool enableTabActions
= (count
> 1);
1115 actionCollection()->action(QStringLiteral("activate_next_tab"))->setEnabled(enableTabActions
);
1116 actionCollection()->action(QStringLiteral("activate_prev_tab"))->setEnabled(enableTabActions
);
1119 void DolphinMainWindow::updateWindowTitle()
1121 const QString newTitle
= m_activeViewContainer
->caption();
1122 if (windowTitle() != newTitle
) {
1123 setWindowTitle(newTitle
);
1127 void DolphinMainWindow::slotStorageTearDownFromPlacesRequested(const QString
& mountPath
)
1129 if (m_terminalPanel
->currentWorkingDirectory().startsWith(mountPath
)) {
1130 m_tearDownFromPlacesRequested
= true;
1131 m_terminalPanel
->goHome();
1132 // m_placesPanel->proceedWithTearDown() will be called in slotTerminalDirectoryChanged
1134 m_placesPanel
->proceedWithTearDown();
1138 void DolphinMainWindow::slotStorageTearDownExternallyRequested(const QString
& mountPath
)
1140 if (m_terminalPanel
->currentWorkingDirectory().startsWith(mountPath
)) {
1141 m_tearDownFromPlacesRequested
= false;
1142 m_terminalPanel
->goHome();
1146 void DolphinMainWindow::setupActions()
1148 // setup 'File' menu
1149 m_newFileMenu
= new DolphinNewFileMenu(actionCollection(), this);
1150 QMenu
* menu
= m_newFileMenu
->menu();
1151 menu
->setTitle(i18nc("@title:menu Create new folder, file, link, etc.", "Create New"));
1152 menu
->setIcon(QIcon::fromTheme(QStringLiteral("document-new")));
1153 m_newFileMenu
->setDelayed(false);
1154 connect(menu
, &QMenu::aboutToShow
,
1155 this, &DolphinMainWindow::updateNewMenu
);
1157 QAction
* newWindow
= KStandardAction::openNew(this, &DolphinMainWindow::openNewMainWindow
, actionCollection());
1158 newWindow
->setText(i18nc("@action:inmenu File", "New &Window"));
1159 newWindow
->setToolTip(i18nc("@info", "Open a new Dolphin window"));
1160 newWindow
->setWhatsThis(xi18nc("@info:whatsthis", "This opens a new "
1161 "window just like this one with the current location and view."
1162 "<nl/>You can drag and drop items between windows."));
1163 newWindow
->setIcon(QIcon::fromTheme(QStringLiteral("window-new")));
1165 QAction
* newTab
= actionCollection()->addAction(QStringLiteral("new_tab"));
1166 newTab
->setIcon(QIcon::fromTheme(QStringLiteral("tab-new")));
1167 newTab
->setText(i18nc("@action:inmenu File", "New Tab"));
1168 newTab
->setWhatsThis(xi18nc("@info:whatsthis", "This opens a new "
1169 "<emphasis>Tab</emphasis> with the current location and view.<nl/>"
1170 "A tab is an additional view within this window. "
1171 "You can drag and drop items between tabs."));
1172 actionCollection()->setDefaultShortcuts(newTab
, {Qt::CTRL
+ Qt::Key_T
, Qt::CTRL
+ Qt::SHIFT
+ Qt::Key_N
});
1173 connect(newTab
, &QAction::triggered
, this, &DolphinMainWindow::openNewActivatedTab
);
1175 QAction
* closeTab
= KStandardAction::close(m_tabWidget
, QOverload
<>::of(&DolphinTabWidget::closeTab
), actionCollection());
1176 closeTab
->setText(i18nc("@action:inmenu File", "Close Tab"));
1177 closeTab
->setWhatsThis(i18nc("@info:whatsthis", "This closes the "
1178 "currently viewed tab. If no more tabs are left this window "
1179 "will close instead."));
1181 QAction
* quitAction
= KStandardAction::quit(this, &DolphinMainWindow::quit
, actionCollection());
1182 quitAction
->setWhatsThis(i18nc("@info:whatsthis quit", "This closes this window."));
1184 // setup 'Edit' menu
1185 KStandardAction::undo(this,
1186 &DolphinMainWindow::undo
,
1187 actionCollection());
1189 // i18n: This will be the last paragraph for the whatsthis for all three:
1190 // Cut, Copy and Paste
1191 const QString cutCopyPastePara
= xi18nc("@info:whatsthis", "<para><emphasis>Cut, "
1192 "Copy</emphasis> and <emphasis>Paste</emphasis> work between many "
1193 "applications and are among the most used commands. That's why their "
1194 "<emphasis>keyboard shortcuts</emphasis> are prominently placed right "
1195 "next to each other on the keyboard: <shortcut>Ctrl+X</shortcut>, "
1196 "<shortcut>Ctrl+C</shortcut> and <shortcut>Ctrl+V</shortcut>.</para>");
1197 QAction
* cutAction
= KStandardAction::cut(this, &DolphinMainWindow::cut
, actionCollection());
1198 cutAction
->setWhatsThis(xi18nc("@info:whatsthis cut", "This copies the items "
1199 "in your current selection to the <emphasis>clipboard</emphasis>.<nl/>"
1200 "Use the <emphasis>Paste</emphasis> action afterwards to copy them from "
1201 "the clipboard to a new location. The items will be removed from their "
1202 "initial location.") + cutCopyPastePara
);
1203 QAction
* copyAction
= KStandardAction::copy(this, &DolphinMainWindow::copy
, actionCollection());
1204 copyAction
->setWhatsThis(xi18nc("@info:whatsthis copy", "This copies the "
1205 "items in your current selection to the <emphasis>clipboard</emphasis>."
1206 "<nl/>Use the <emphasis>Paste</emphasis> action afterwards to copy them "
1207 "from the clipboard to a new location.") + cutCopyPastePara
);
1208 QAction
* paste
= KStandardAction::paste(this, &DolphinMainWindow::paste
, actionCollection());
1209 // The text of the paste-action is modified dynamically by Dolphin
1210 // (e. g. to "Paste One Folder"). To prevent that the size of the toolbar changes
1211 // due to the long text, the text "Paste" is used:
1212 paste
->setIconText(i18nc("@action:inmenu Edit", "Paste"));
1213 paste
->setWhatsThis(xi18nc("@info:whatsthis paste", "This copies the items from "
1214 "your <emphasis>clipboard</emphasis> to the currently viewed folder.<nl/>"
1215 "If the items were added to the clipboard by the <emphasis>Cut</emphasis> "
1216 "action they are removed from their old location.") + cutCopyPastePara
);
1218 QAction
*searchAction
= KStandardAction::find(this, &DolphinMainWindow::find
, actionCollection());
1219 searchAction
->setText(i18n("Search..."));
1220 searchAction
->setToolTip(i18nc("@info:tooltip", "Search for files and folders"));
1221 searchAction
->setWhatsThis(xi18nc("@info:whatsthis find", "<para>This helps you "
1222 "find files and folders by opening a <emphasis>find bar</emphasis>. "
1223 "There you can enter search terms and specify settings to find the "
1224 "objects you are looking for.</para><para>Use this help again on "
1225 "the find bar so we can have a look at it while the settings are "
1226 "explained.</para>"));
1228 QAction
* selectAllAction
= KStandardAction::selectAll(this, &DolphinMainWindow::selectAll
, actionCollection());
1229 selectAllAction
->setWhatsThis(xi18nc("@info:whatsthis", "This selects all "
1230 "files and folders in the current location."));
1232 QAction
* invertSelection
= actionCollection()->addAction(QStringLiteral("invert_selection"));
1233 invertSelection
->setText(i18nc("@action:inmenu Edit", "Invert Selection"));
1234 invertSelection
->setWhatsThis(xi18nc("@info:whatsthis invert", "This selects all "
1235 "objects that you have currently <emphasis>not</emphasis> selected instead."));
1236 invertSelection
->setIcon(QIcon::fromTheme(QStringLiteral("edit-select-invert")));
1237 actionCollection()->setDefaultShortcut(invertSelection
, Qt::CTRL
+ Qt::SHIFT
+ Qt::Key_A
);
1238 connect(invertSelection
, &QAction::triggered
, this, &DolphinMainWindow::invertSelection
);
1240 // setup 'View' menu
1241 // (note that most of it is set up in DolphinViewActionHandler)
1243 QAction
* split
= actionCollection()->addAction(QStringLiteral("split_view"));
1244 split
->setWhatsThis(xi18nc("@info:whatsthis find", "<para>This splits "
1245 "the folder view below into two autonomous views.</para><para>This "
1246 "way you can see two locations at once and move items between them "
1247 "quickly.</para>Click this again afterwards to recombine the views."));
1248 actionCollection()->setDefaultShortcut(split
, Qt::Key_F3
);
1249 connect(split
, &QAction::triggered
, this, &DolphinMainWindow::toggleSplitView
);
1251 QAction
* stashSplit
= actionCollection()->addAction(QStringLiteral("split_stash"));
1252 actionCollection()->setDefaultShortcut(stashSplit
, Qt::CTRL
+ Qt::Key_S
);
1253 stashSplit
->setText(i18nc("@action:intoolbar Stash", "Stash"));
1254 stashSplit
->setToolTip(i18nc("@info", "Opens the stash virtual directory in a split window"));
1255 stashSplit
->setIcon(QIcon::fromTheme(QStringLiteral("folder-stash")));
1256 stashSplit
->setCheckable(false);
1257 stashSplit
->setVisible(KProtocolInfo::isKnownProtocol("stash"));
1258 connect(stashSplit
, &QAction::triggered
, this, &DolphinMainWindow::toggleSplitStash
);
1260 KStandardAction::redisplay(this, &DolphinMainWindow::reloadView
, actionCollection());
1262 QAction
* stop
= actionCollection()->addAction(QStringLiteral("stop"));
1263 stop
->setText(i18nc("@action:inmenu View", "Stop"));
1264 stop
->setToolTip(i18nc("@info", "Stop loading"));
1265 stop
->setWhatsThis(i18nc("@info", "This stops the loading of the contents of the current folder."));
1266 stop
->setIcon(QIcon::fromTheme(QStringLiteral("process-stop")));
1267 connect(stop
, &QAction::triggered
, this, &DolphinMainWindow::stopLoading
);
1269 KToggleAction
* editableLocation
= actionCollection()->add
<KToggleAction
>(QStringLiteral("editable_location"));
1270 editableLocation
->setText(i18nc("@action:inmenu Navigation Bar", "Editable Location"));
1271 editableLocation
->setWhatsThis(xi18nc("@info:whatsthis",
1272 "This toggles the <emphasis>Location Bar</emphasis> to be "
1273 "editable so you can directly enter a location you want to go to.<nl/>"
1274 "You can also switch to editing by clicking to the right of the "
1275 "location and switch back by confirming the edited location."));
1276 actionCollection()->setDefaultShortcut(editableLocation
, Qt::Key_F6
);
1277 connect(editableLocation
, &KToggleAction::triggered
, this, &DolphinMainWindow::toggleEditLocation
);
1279 QAction
* replaceLocation
= actionCollection()->addAction(QStringLiteral("replace_location"));
1280 replaceLocation
->setText(i18nc("@action:inmenu Navigation Bar", "Replace Location"));
1281 // i18n: "enter" is used both in the meaning of "writing" and "going to" a new location here.
1282 // Both meanings are useful but not necessary to understand the use of "Replace Location".
1283 // So you might want to be more verbose in your language to convey the meaning but it's up to you.
1284 replaceLocation
->setWhatsThis(xi18nc("@info:whatsthis",
1285 "This switches to editing the location and selects it "
1286 "so you can quickly enter a different location."));
1287 actionCollection()->setDefaultShortcut(replaceLocation
, Qt::CTRL
+ Qt::Key_L
);
1288 connect(replaceLocation
, &QAction::triggered
, this, &DolphinMainWindow::replaceLocation
);
1291 QAction
* backAction
= KStandardAction::back(this, &DolphinMainWindow::goBack
, actionCollection());
1292 auto backShortcuts
= backAction
->shortcuts();
1293 backShortcuts
.append(QKeySequence(Qt::Key_Backspace
));
1294 actionCollection()->setDefaultShortcuts(backAction
, backShortcuts
);
1296 DolphinRecentTabsMenu
* recentTabsMenu
= new DolphinRecentTabsMenu(this);
1297 actionCollection()->addAction(QStringLiteral("closed_tabs"), recentTabsMenu
);
1298 connect(m_tabWidget
, &DolphinTabWidget::rememberClosedTab
,
1299 recentTabsMenu
, &DolphinRecentTabsMenu::rememberClosedTab
);
1300 connect(recentTabsMenu
, &DolphinRecentTabsMenu::restoreClosedTab
,
1301 m_tabWidget
, &DolphinTabWidget::restoreClosedTab
);
1302 connect(recentTabsMenu
, &DolphinRecentTabsMenu::closedTabsCountChanged
,
1303 this, &DolphinMainWindow::closedTabsCountChanged
);
1305 QAction
* undoCloseTab
= actionCollection()->addAction(QStringLiteral("undo_close_tab"));
1306 undoCloseTab
->setText(i18nc("@action:inmenu File", "Undo close tab"));
1307 undoCloseTab
->setWhatsThis(i18nc("@info:whatsthis undo close tab",
1308 "This returns you to the previously closed tab."));
1309 actionCollection()->setDefaultShortcut(undoCloseTab
, Qt::CTRL
+ Qt::SHIFT
+ Qt::Key_T
);
1310 undoCloseTab
->setIcon(QIcon::fromTheme(QStringLiteral("edit-undo")));
1311 undoCloseTab
->setEnabled(false);
1312 connect(undoCloseTab
, &QAction::triggered
, recentTabsMenu
, &DolphinRecentTabsMenu::undoCloseTab
);
1314 auto undoAction
= actionCollection()->action(KStandardAction::name(KStandardAction::Undo
));
1315 undoAction
->setWhatsThis(xi18nc("@info:whatsthis", "This undoes "
1316 "the last change you made to files or folders.<nl/>"
1317 "Such changes include <interface>creating, renaming</interface> "
1318 "and <interface>moving</interface> them to a different location "
1319 "or to the <filename>Trash</filename>. <nl/>Changes that can't "
1320 "be undone will ask for your confirmation."));
1321 undoAction
->setEnabled(false); // undo should be disabled by default
1323 KStandardAction::forward(this, &DolphinMainWindow::goForward
, actionCollection());
1324 KStandardAction::up(this, &DolphinMainWindow::goUp
, actionCollection());
1325 QAction
* homeAction
= KStandardAction::home(this, &DolphinMainWindow::goHome
, actionCollection());
1326 homeAction
->setWhatsThis(xi18nc("@info:whatsthis", "Go to your "
1327 "<filename>Home</filename> folder.<nl/>Every user account "
1328 "has their own <filename>Home</filename> that contains their data "
1329 "including folders that contain personal application data."));
1331 // setup 'Tools' menu
1332 QAction
* showFilterBar
= actionCollection()->addAction(QStringLiteral("show_filter_bar"));
1333 showFilterBar
->setText(i18nc("@action:inmenu Tools", "Show Filter Bar"));
1334 showFilterBar
->setWhatsThis(xi18nc("@info:whatsthis", "This opens the "
1335 "<emphasis>Filter Bar</emphasis> at the bottom of the window.<nl/> "
1336 "There you can enter a text to filter the files and folders currently displayed. "
1337 "Only those that contain the text in their name will be kept in view."));
1338 showFilterBar
->setIcon(QIcon::fromTheme(QStringLiteral("view-filter")));
1339 actionCollection()->setDefaultShortcuts(showFilterBar
, {Qt::CTRL
+ Qt::Key_I
, Qt::Key_Slash
});
1340 connect(showFilterBar
, &QAction::triggered
, this, &DolphinMainWindow::showFilterBar
);
1342 QAction
* compareFiles
= actionCollection()->addAction(QStringLiteral("compare_files"));
1343 compareFiles
->setText(i18nc("@action:inmenu Tools", "Compare Files"));
1344 compareFiles
->setIcon(QIcon::fromTheme(QStringLiteral("kompare")));
1345 compareFiles
->setEnabled(false);
1346 connect(compareFiles
, &QAction::triggered
, this, &DolphinMainWindow::compareFiles
);
1348 #ifdef HAVE_TERMINAL
1349 if (KAuthorized::authorize(QStringLiteral("shell_access"))) {
1350 QAction
* openTerminal
= actionCollection()->addAction(QStringLiteral("open_terminal"));
1351 openTerminal
->setText(i18nc("@action:inmenu Tools", "Open Terminal"));
1352 openTerminal
->setWhatsThis(xi18nc("@info:whatsthis",
1353 "<para>This opens a <emphasis>terminal</emphasis> application for the viewed location.</para>"
1354 "<para>To learn more about terminals use the help in the terminal application.</para>"));
1355 openTerminal
->setIcon(QIcon::fromTheme(QStringLiteral("utilities-terminal")));
1356 actionCollection()->setDefaultShortcut(openTerminal
, Qt::SHIFT
+ Qt::Key_F4
);
1357 connect(openTerminal
, &QAction::triggered
, this, &DolphinMainWindow::openTerminal
);
1361 // setup 'Bookmarks' menu
1362 KActionMenu
*bookmarkMenu
= new KActionMenu(i18nc("@title:menu", "&Bookmarks"), this);
1363 bookmarkMenu
->setIcon(QIcon::fromTheme(QStringLiteral("bookmarks")));
1364 // Make the toolbar button version work properly on click
1365 bookmarkMenu
->setDelayed(false);
1366 m_bookmarkHandler
= new DolphinBookmarkHandler(this, actionCollection(), bookmarkMenu
->menu(), this);
1367 actionCollection()->addAction(QStringLiteral("bookmarks"), bookmarkMenu
);
1369 // setup 'Settings' menu
1370 KToggleAction
* showMenuBar
= KStandardAction::showMenubar(nullptr, nullptr, actionCollection());
1371 showMenuBar
->setWhatsThis(xi18nc("@info:whatsthis",
1372 "This switches between having a <emphasis>Menubar</emphasis> "
1373 "and having a <interface>Control</interface> button. Both "
1374 "contain mostly the same commands and configuration options."));
1375 connect(showMenuBar
, &KToggleAction::triggered
, // Fixes #286822
1376 this, &DolphinMainWindow::toggleShowMenuBar
, Qt::QueuedConnection
);
1377 KStandardAction::preferences(this, &DolphinMainWindow::editSettings
, actionCollection());
1379 // setup 'Help' menu for the m_controlButton. The other one is set up in the base class.
1380 m_helpMenu
= new KHelpMenu(nullptr);
1381 m_helpMenu
->menu()->installEventFilter(this);
1382 // remove duplicate shortcuts
1383 m_helpMenu
->action(KHelpMenu::menuHelpContents
)->setShortcut(QKeySequence());
1384 m_helpMenu
->action(KHelpMenu::menuWhatsThis
)->setShortcut(QKeySequence());
1386 // not in menu actions
1387 QList
<QKeySequence
> nextTabKeys
= KStandardShortcut::tabNext();
1388 nextTabKeys
.append(QKeySequence(Qt::CTRL
+ Qt::Key_Tab
));
1390 QList
<QKeySequence
> prevTabKeys
= KStandardShortcut::tabPrev();
1391 prevTabKeys
.append(QKeySequence(Qt::CTRL
+ Qt::SHIFT
+ Qt::Key_Tab
));
1393 QAction
* activateNextTab
= actionCollection()->addAction(QStringLiteral("activate_next_tab"));
1394 activateNextTab
->setIconText(i18nc("@action:inmenu", "Next Tab"));
1395 activateNextTab
->setText(i18nc("@action:inmenu", "Activate Next Tab"));
1396 activateNextTab
->setEnabled(false);
1397 connect(activateNextTab
, &QAction::triggered
, m_tabWidget
, &DolphinTabWidget::activateNextTab
);
1398 actionCollection()->setDefaultShortcuts(activateNextTab
, nextTabKeys
);
1400 QAction
* activatePrevTab
= actionCollection()->addAction(QStringLiteral("activate_prev_tab"));
1401 activatePrevTab
->setIconText(i18nc("@action:inmenu", "Previous Tab"));
1402 activatePrevTab
->setText(i18nc("@action:inmenu", "Activate Previous Tab"));
1403 activatePrevTab
->setEnabled(false);
1404 connect(activatePrevTab
, &QAction::triggered
, m_tabWidget
, &DolphinTabWidget::activatePrevTab
);
1405 actionCollection()->setDefaultShortcuts(activatePrevTab
, prevTabKeys
);
1408 QAction
* showTarget
= actionCollection()->addAction(QStringLiteral("show_target"));
1409 showTarget
->setText(i18nc("@action:inmenu", "Show Target"));
1410 showTarget
->setIcon(QIcon::fromTheme(QStringLiteral("document-open-folder")));
1411 showTarget
->setEnabled(false);
1412 connect(showTarget
, &QAction::triggered
, this, &DolphinMainWindow::showTarget
);
1414 QAction
* openInNewTab
= actionCollection()->addAction(QStringLiteral("open_in_new_tab"));
1415 openInNewTab
->setText(i18nc("@action:inmenu", "Open in New Tab"));
1416 openInNewTab
->setIcon(QIcon::fromTheme(QStringLiteral("tab-new")));
1417 connect(openInNewTab
, &QAction::triggered
, this, &DolphinMainWindow::openInNewTab
);
1419 QAction
* openInNewTabs
= actionCollection()->addAction(QStringLiteral("open_in_new_tabs"));
1420 openInNewTabs
->setText(i18nc("@action:inmenu", "Open in New Tabs"));
1421 openInNewTabs
->setIcon(QIcon::fromTheme(QStringLiteral("tab-new")));
1422 connect(openInNewTabs
, &QAction::triggered
, this, &DolphinMainWindow::openInNewTab
);
1424 QAction
* openInNewWindow
= actionCollection()->addAction(QStringLiteral("open_in_new_window"));
1425 openInNewWindow
->setText(i18nc("@action:inmenu", "Open in New Window"));
1426 openInNewWindow
->setIcon(QIcon::fromTheme(QStringLiteral("window-new")));
1427 connect(openInNewWindow
, &QAction::triggered
, this, &DolphinMainWindow::openInNewWindow
);
1430 void DolphinMainWindow::setupDockWidgets()
1432 const bool lock
= GeneralSettings::lockPanels();
1434 KDualAction
* lockLayoutAction
= actionCollection()->add
<KDualAction
>(QStringLiteral("lock_panels"));
1435 lockLayoutAction
->setActiveText(i18nc("@action:inmenu Panels", "Unlock Panels"));
1436 lockLayoutAction
->setActiveIcon(QIcon::fromTheme(QStringLiteral("object-unlocked")));
1437 lockLayoutAction
->setInactiveText(i18nc("@action:inmenu Panels", "Lock Panels"));
1438 lockLayoutAction
->setInactiveIcon(QIcon::fromTheme(QStringLiteral("object-locked")));
1439 lockLayoutAction
->setWhatsThis(xi18nc("@info:whatsthis", "This "
1440 "switches between having panels <emphasis>locked</emphasis> or "
1441 "<emphasis>unlocked</emphasis>.<nl/>Unlocked panels can be "
1442 "dragged to the other side of the window and have a close "
1443 "button.<nl/>Locked panels are embedded more cleanly."));
1444 lockLayoutAction
->setActive(lock
);
1445 connect(lockLayoutAction
, &KDualAction::triggered
, this, &DolphinMainWindow::togglePanelLockState
);
1447 // Setup "Information"
1448 DolphinDockWidget
* infoDock
= new DolphinDockWidget(i18nc("@title:window", "Information"));
1449 infoDock
->setLocked(lock
);
1450 infoDock
->setObjectName(QStringLiteral("infoDock"));
1451 infoDock
->setAllowedAreas(Qt::LeftDockWidgetArea
| Qt::RightDockWidgetArea
);
1454 InformationPanel
* infoPanel
= new InformationPanel(infoDock
);
1455 infoPanel
->setCustomContextMenuActions({lockLayoutAction
});
1456 connect(infoPanel
, &InformationPanel::urlActivated
, this, &DolphinMainWindow::handleUrl
);
1457 infoDock
->setWidget(infoPanel
);
1459 QAction
* infoAction
= infoDock
->toggleViewAction();
1460 createPanelAction(QIcon::fromTheme(QStringLiteral("dialog-information")), Qt::Key_F11
, infoAction
, QStringLiteral("show_information_panel"));
1462 addDockWidget(Qt::RightDockWidgetArea
, infoDock
);
1463 connect(this, &DolphinMainWindow::urlChanged
,
1464 infoPanel
, &InformationPanel::setUrl
);
1465 connect(this, &DolphinMainWindow::selectionChanged
,
1466 infoPanel
, &InformationPanel::setSelection
);
1467 connect(this, &DolphinMainWindow::requestItemInfo
,
1468 infoPanel
, &InformationPanel::requestDelayedItemInfo
);
1471 // i18n: This is the last paragraph for the "What's This"-texts of all four panels.
1472 const QString panelWhatsThis
= xi18nc("@info:whatsthis", "<para>To show or "
1473 "hide panels like this go to <interface>Control|Panels</interface> "
1474 "or <interface>View|Panels</interface>.</para>");
1476 actionCollection()->action(QStringLiteral("show_information_panel"))
1477 ->setWhatsThis(xi18nc("@info:whatsthis", "<para> This toggles the "
1478 "<emphasis>information</emphasis> panel at the right side of the "
1479 "window.</para><para>The panel provides in-depth information "
1480 "about the items your mouse is hovering over or about the selected "
1481 "items. Otherwise it informs you about the currently viewed folder.<nl/>"
1482 "For single items a preview of their contents is provided.</para>"));
1484 infoDock
->setWhatsThis(xi18nc("@info:whatsthis", "<para>This panel "
1485 "provides in-depth information about the items your mouse is "
1486 "hovering over or about the selected items. Otherwise it informs "
1487 "you about the currently viewed folder.<nl/>For single items a "
1488 "preview of their contents is provided.</para><para>You can configure "
1489 "which and how details are given here by right-clicking.</para>") + panelWhatsThis
);
1492 DolphinDockWidget
* foldersDock
= new DolphinDockWidget(i18nc("@title:window", "Folders"));
1493 foldersDock
->setLocked(lock
);
1494 foldersDock
->setObjectName(QStringLiteral("foldersDock"));
1495 foldersDock
->setAllowedAreas(Qt::LeftDockWidgetArea
| Qt::RightDockWidgetArea
);
1496 FoldersPanel
* foldersPanel
= new FoldersPanel(foldersDock
);
1497 foldersPanel
->setCustomContextMenuActions({lockLayoutAction
});
1498 foldersDock
->setWidget(foldersPanel
);
1500 QAction
* foldersAction
= foldersDock
->toggleViewAction();
1501 createPanelAction(QIcon::fromTheme(QStringLiteral("folder")), Qt::Key_F7
, foldersAction
, QStringLiteral("show_folders_panel"));
1503 addDockWidget(Qt::LeftDockWidgetArea
, foldersDock
);
1504 connect(this, &DolphinMainWindow::urlChanged
,
1505 foldersPanel
, &FoldersPanel::setUrl
);
1506 connect(foldersPanel
, &FoldersPanel::folderActivated
,
1507 this, &DolphinMainWindow::changeUrl
);
1508 connect(foldersPanel
, &FoldersPanel::folderMiddleClicked
,
1509 this, &DolphinMainWindow::openNewTabAfterCurrentTab
);
1510 connect(foldersPanel
, &FoldersPanel::errorMessage
,
1511 this, &DolphinMainWindow::showErrorMessage
);
1513 actionCollection()->action(QStringLiteral("show_folders_panel"))
1514 ->setWhatsThis(xi18nc("@info:whatsthis", "This toggles the "
1515 "<emphasis>folders</emphasis> panel at the left side of the window."
1516 "<nl/><nl/>It shows the folders of the <emphasis>file system"
1517 "</emphasis> in a <emphasis>tree view</emphasis>."));
1518 foldersDock
->setWhatsThis(xi18nc("@info:whatsthis", "<para>This panel "
1519 "shows the folders of the <emphasis>file system</emphasis> in a "
1520 "<emphasis>tree view</emphasis>.</para><para>Click a folder to go "
1521 "there. Click the arrow to the left of a folder to see its subfolders. "
1522 "This allows quick switching between any folders.</para>") + panelWhatsThis
);
1525 #ifdef HAVE_TERMINAL
1526 if (KAuthorized::authorize(QStringLiteral("shell_access"))) {
1527 DolphinDockWidget
* terminalDock
= new DolphinDockWidget(i18nc("@title:window Shell terminal", "Terminal"));
1528 terminalDock
->setLocked(lock
);
1529 terminalDock
->setObjectName(QStringLiteral("terminalDock"));
1530 m_terminalPanel
= new TerminalPanel(terminalDock
);
1531 m_terminalPanel
->setCustomContextMenuActions({lockLayoutAction
});
1532 terminalDock
->setWidget(m_terminalPanel
);
1534 connect(m_terminalPanel
, &TerminalPanel::hideTerminalPanel
, terminalDock
, &DolphinDockWidget::hide
);
1535 connect(m_terminalPanel
, &TerminalPanel::changeUrl
, this, &DolphinMainWindow::slotTerminalDirectoryChanged
);
1536 connect(terminalDock
, &DolphinDockWidget::visibilityChanged
,
1537 m_terminalPanel
, &TerminalPanel::dockVisibilityChanged
);
1538 connect(terminalDock
, &DolphinDockWidget::visibilityChanged
,
1539 this, &DolphinMainWindow::slotTerminalPanelVisibilityChanged
);
1541 QAction
* terminalAction
= terminalDock
->toggleViewAction();
1542 createPanelAction(QIcon::fromTheme(QStringLiteral("utilities-terminal")), Qt::Key_F4
, terminalAction
, QStringLiteral("show_terminal_panel"));
1544 addDockWidget(Qt::BottomDockWidgetArea
, terminalDock
);
1545 connect(this, &DolphinMainWindow::urlChanged
,
1546 m_terminalPanel
, &TerminalPanel::setUrl
);
1548 if (GeneralSettings::version() < 200) {
1549 terminalDock
->hide();
1552 actionCollection()->action(QStringLiteral("show_terminal_panel"))
1553 ->setWhatsThis(xi18nc("@info:whatsthis", "<para>This toggles the "
1554 "<emphasis>terminal</emphasis> panel at the bottom of the window."
1555 "<nl/>The location in the terminal will always match the folder "
1556 "view so you can navigate using either.</para><para>The terminal "
1557 "panel is not needed for basic computer usage but can be useful "
1558 "for advanced tasks. To learn more about terminals use the help "
1559 "in a standalone terminal application like Konsole.</para>"));
1560 terminalDock
->setWhatsThis(xi18nc("@info:whatsthis", "<para>This is "
1561 "the <emphasis>terminal</emphasis> panel. It behaves like a "
1562 "normal terminal but will match the location of the folder view "
1563 "so you can navigate using either.</para><para>The terminal panel "
1564 "is not needed for basic computer usage but can be useful for "
1565 "advanced tasks. To learn more about terminals use the help in a "
1566 "standalone terminal application like Konsole.</para>") + panelWhatsThis
);
1570 if (GeneralSettings::version() < 200) {
1572 foldersDock
->hide();
1576 DolphinDockWidget
* placesDock
= new DolphinDockWidget(i18nc("@title:window", "Places"));
1577 placesDock
->setLocked(lock
);
1578 placesDock
->setObjectName(QStringLiteral("placesDock"));
1579 placesDock
->setAllowedAreas(Qt::LeftDockWidgetArea
| Qt::RightDockWidgetArea
);
1581 m_placesPanel
= new PlacesPanel(placesDock
);
1582 m_placesPanel
->setCustomContextMenuActions({lockLayoutAction
});
1583 placesDock
->setWidget(m_placesPanel
);
1585 QAction
*placesAction
= placesDock
->toggleViewAction();
1586 createPanelAction(QIcon::fromTheme(QStringLiteral("bookmarks")), Qt::Key_F9
, placesAction
, QStringLiteral("show_places_panel"));
1588 addDockWidget(Qt::LeftDockWidgetArea
, placesDock
);
1589 connect(m_placesPanel
, &PlacesPanel::placeActivated
,
1590 this, &DolphinMainWindow::slotPlaceActivated
);
1591 connect(m_placesPanel
, &PlacesPanel::placeMiddleClicked
,
1592 this, &DolphinMainWindow::openNewTabAfterCurrentTab
);
1593 connect(m_placesPanel
, &PlacesPanel::errorMessage
,
1594 this, &DolphinMainWindow::showErrorMessage
);
1595 connect(this, &DolphinMainWindow::urlChanged
,
1596 m_placesPanel
, &PlacesPanel::setUrl
);
1597 connect(placesDock
, &DolphinDockWidget::visibilityChanged
,
1598 m_tabWidget
, &DolphinTabWidget::slotPlacesPanelVisibilityChanged
);
1599 connect(this, &DolphinMainWindow::settingsChanged
,
1600 m_placesPanel
, &PlacesPanel::readSettings
);
1601 connect(m_placesPanel
, &PlacesPanel::storageTearDownRequested
,
1602 this, &DolphinMainWindow::slotStorageTearDownFromPlacesRequested
);
1603 connect(m_placesPanel
, &PlacesPanel::storageTearDownExternallyRequested
,
1604 this, &DolphinMainWindow::slotStorageTearDownExternallyRequested
);
1605 m_tabWidget
->slotPlacesPanelVisibilityChanged(m_placesPanel
->isVisible());
1607 auto actionShowAllPlaces
= new QAction(QIcon::fromTheme(QStringLiteral("hint")), i18nc("@item:inmenu", "Show Hidden Places"), this);
1608 actionShowAllPlaces
->setCheckable(true);
1609 actionShowAllPlaces
->setDisabled(true);
1610 actionShowAllPlaces
->setWhatsThis(i18nc("@info:whatsthis", "This displays "
1611 "all places in the places panel that have been hidden. They will "
1612 "appear semi-transparent unless you uncheck their hide property."));
1614 connect(actionShowAllPlaces
, &QAction::triggered
, this, [actionShowAllPlaces
, this](bool checked
){
1615 actionShowAllPlaces
->setIcon(QIcon::fromTheme(checked
? QStringLiteral("visibility") : QStringLiteral("hint")));
1616 m_placesPanel
->showHiddenEntries(checked
);
1619 connect(m_placesPanel
, &PlacesPanel::showHiddenEntriesChanged
, this, [actionShowAllPlaces
] (bool checked
){
1620 actionShowAllPlaces
->setChecked(checked
);
1621 actionShowAllPlaces
->setIcon(QIcon::fromTheme(checked
? QStringLiteral("visibility") : QStringLiteral("hint")));
1624 actionCollection()->action(QStringLiteral("show_places_panel"))
1625 ->setWhatsThis(xi18nc("@info:whatsthis", "<para>This toggles the "
1626 "<emphasis>places</emphasis> panel at the left side of the window."
1627 "</para><para>It allows you to go to locations you have "
1628 "bookmarked and to access disk or media attached to the computer "
1629 "or to the network. It also contains sections to find recently "
1630 "saved files or files of a certain type.</para>"));
1631 placesDock
->setWhatsThis(xi18nc("@info:whatsthis", "<para>This is the "
1632 "<emphasis>Places</emphasis> panel. It allows you to go to locations "
1633 "you have bookmarked and to access disk or media attached to the "
1634 "computer or to the network. It also contains sections to find "
1635 "recently saved files or files of a certain type.</para><para>"
1636 "Click on an entry to go there. Click with the right mouse button "
1637 "instead to open any entry in a new tab or new window.</para>"
1638 "<para>New entries can be added by dragging folders onto this panel. "
1639 "Right-click any section or entry to hide it. Right-click an empty "
1640 "space on this panel and select <interface>Show Hidden Places"
1641 "</interface> to display it again.</para>") + panelWhatsThis
);
1643 // Add actions into the "Panels" menu
1644 KActionMenu
* panelsMenu
= new KActionMenu(i18nc("@action:inmenu View", "Panels"), this);
1645 actionCollection()->addAction(QStringLiteral("panels"), panelsMenu
);
1646 panelsMenu
->setDelayed(false);
1647 const KActionCollection
* ac
= actionCollection();
1648 panelsMenu
->addAction(ac
->action(QStringLiteral("show_places_panel")));
1650 panelsMenu
->addAction(ac
->action(QStringLiteral("show_information_panel")));
1652 panelsMenu
->addAction(ac
->action(QStringLiteral("show_folders_panel")));
1653 panelsMenu
->addAction(ac
->action(QStringLiteral("show_terminal_panel")));
1654 panelsMenu
->addSeparator();
1655 panelsMenu
->addAction(actionShowAllPlaces
);
1656 panelsMenu
->addAction(lockLayoutAction
);
1658 connect(panelsMenu
->menu(), &QMenu::aboutToShow
, this, [actionShowAllPlaces
, this]{
1659 actionShowAllPlaces
->setEnabled(m_placesPanel
->hiddenListCount());
1663 void DolphinMainWindow::updateEditActions()
1665 const KFileItemList list
= m_activeViewContainer
->view()->selectedItems();
1666 if (list
.isEmpty()) {
1667 stateChanged(QStringLiteral("has_no_selection"));
1669 stateChanged(QStringLiteral("has_selection"));
1671 KActionCollection
* col
= actionCollection();
1672 QAction
* renameAction
= col
->action(KStandardAction::name(KStandardAction::RenameFile
));
1673 QAction
* moveToTrashAction
= col
->action(KStandardAction::name(KStandardAction::MoveToTrash
));
1674 QAction
* deleteAction
= col
->action(KStandardAction::name(KStandardAction::DeleteFile
));
1675 QAction
* cutAction
= col
->action(KStandardAction::name(KStandardAction::Cut
));
1676 QAction
* deleteWithTrashShortcut
= col
->action(QStringLiteral("delete_shortcut")); // see DolphinViewActionHandler
1677 QAction
* showTarget
= col
->action(QStringLiteral("show_target"));
1679 KFileItemListProperties
capabilities(list
);
1680 const bool enableMoveToTrash
= capabilities
.isLocal() && capabilities
.supportsMoving();
1682 renameAction
->setEnabled(capabilities
.supportsMoving());
1683 moveToTrashAction
->setEnabled(enableMoveToTrash
);
1684 deleteAction
->setEnabled(capabilities
.supportsDeleting());
1685 deleteWithTrashShortcut
->setEnabled(capabilities
.supportsDeleting() && !enableMoveToTrash
);
1686 cutAction
->setEnabled(capabilities
.supportsMoving());
1687 showTarget
->setEnabled(list
.length() == 1 && list
.at(0).isLink());
1691 void DolphinMainWindow::updateViewActions()
1693 m_actionHandler
->updateViewActions();
1695 QAction
* showFilterBarAction
= actionCollection()->action(QStringLiteral("show_filter_bar"));
1696 showFilterBarAction
->setChecked(m_activeViewContainer
->isFilterBarVisible());
1698 updateSplitAction();
1700 QAction
* editableLocactionAction
= actionCollection()->action(QStringLiteral("editable_location"));
1701 const KUrlNavigator
* urlNavigator
= m_activeViewContainer
->urlNavigator();
1702 editableLocactionAction
->setChecked(urlNavigator
->isUrlEditable());
1705 void DolphinMainWindow::updateGoActions()
1707 QAction
* goUpAction
= actionCollection()->action(KStandardAction::name(KStandardAction::Up
));
1708 const QUrl currentUrl
= m_activeViewContainer
->url();
1709 // I think this is one of the best places to firstly be confronted
1710 // with a file system and its hierarchy. Talking about the root
1711 // directory might seem too much here but it is the question that
1712 // naturally arises in this context.
1713 goUpAction
->setWhatsThis(xi18nc("@info:whatsthis", "<para>Go to "
1714 "the folder that contains the currently viewed one.</para>"
1715 "<para>All files and folders are organized in a hierarchical "
1716 "<emphasis>file system</emphasis>. At the top of this hierarchy is "
1717 "a directory that contains all data connected to this computer"
1718 "—the <emphasis>root directory</emphasis>.</para>"));
1719 goUpAction
->setEnabled(KIO::upUrl(currentUrl
) != currentUrl
);
1722 void DolphinMainWindow::createControlButton()
1724 if (m_controlButton
) {
1727 Q_ASSERT(!m_controlButton
);
1729 m_controlButton
= new QToolButton(this);
1730 m_controlButton
->setIcon(QIcon::fromTheme(QStringLiteral("application-menu")));
1731 m_controlButton
->setText(i18nc("@action", "Control"));
1732 m_controlButton
->setAttribute(Qt::WidgetAttribute::WA_CustomWhatsThis
);
1733 m_controlButton
->setPopupMode(QToolButton::InstantPopup
);
1734 m_controlButton
->setToolButtonStyle(toolBar()->toolButtonStyle());
1736 QMenu
* controlMenu
= new QMenu(m_controlButton
);
1737 connect(controlMenu
, &QMenu::aboutToShow
, this, &DolphinMainWindow::updateControlMenu
);
1738 controlMenu
->installEventFilter(this);
1740 m_controlButton
->setMenu(controlMenu
);
1742 toolBar()->addWidget(m_controlButton
);
1743 connect(toolBar(), &KToolBar::iconSizeChanged
,
1744 m_controlButton
, &QToolButton::setIconSize
);
1745 connect(toolBar(), &KToolBar::toolButtonStyleChanged
,
1746 m_controlButton
, &QToolButton::setToolButtonStyle
);
1748 // The added widgets are owned by the toolbar and may get deleted when e.g. the toolbar
1749 // gets edited. In this case we must add them again. The adding is done asynchronously by
1750 // m_updateToolBarTimer.
1751 connect(m_controlButton
, &QToolButton::destroyed
, this, &DolphinMainWindow::slotControlButtonDeleted
);
1752 m_updateToolBarTimer
= new QTimer(this);
1753 m_updateToolBarTimer
->setInterval(500);
1754 connect(m_updateToolBarTimer
, &QTimer::timeout
, this, &DolphinMainWindow::updateToolBar
);
1757 void DolphinMainWindow::deleteControlButton()
1759 delete m_controlButton
;
1760 m_controlButton
= nullptr;
1762 delete m_updateToolBarTimer
;
1763 m_updateToolBarTimer
= nullptr;
1766 bool DolphinMainWindow::addActionToMenu(QAction
* action
, QMenu
* menu
)
1771 const KToolBar
* toolBarWidget
= toolBar();
1772 foreach (const QWidget
* widget
, action
->associatedWidgets()) {
1773 if (widget
== toolBarWidget
) {
1778 menu
->addAction(action
);
1782 void DolphinMainWindow::refreshViews()
1784 m_tabWidget
->refreshViews();
1786 if (GeneralSettings::modifiedStartupSettings()) {
1787 // The startup settings have been changed by the user (see bug #254947).
1788 // Synchronize the split-view setting with the active view:
1789 const bool splitView
= GeneralSettings::splitView();
1790 m_tabWidget
->currentTabPage()->setSplitViewEnabled(splitView
);
1791 updateSplitAction();
1792 updateWindowTitle();
1795 emit
settingsChanged();
1798 void DolphinMainWindow::clearStatusBar()
1800 m_activeViewContainer
->statusBar()->resetToDefaultText();
1803 void DolphinMainWindow::connectViewSignals(DolphinViewContainer
* container
)
1805 connect(container
, &DolphinViewContainer::showFilterBarChanged
,
1806 this, &DolphinMainWindow::updateFilterBarAction
);
1807 connect(container
, &DolphinViewContainer::writeStateChanged
,
1808 this, &DolphinMainWindow::slotWriteStateChanged
);
1810 const DolphinView
* view
= container
->view();
1811 connect(view
, &DolphinView::selectionChanged
,
1812 this, &DolphinMainWindow::slotSelectionChanged
);
1813 connect(view
, &DolphinView::requestItemInfo
,
1814 this, &DolphinMainWindow::requestItemInfo
);
1815 connect(view
, &DolphinView::tabRequested
,
1816 this, &DolphinMainWindow::openNewTab
);
1817 connect(view
, &DolphinView::requestContextMenu
,
1818 this, &DolphinMainWindow::openContextMenu
);
1819 connect(view
, &DolphinView::directoryLoadingStarted
,
1820 this, &DolphinMainWindow::enableStopAction
);
1821 connect(view
, &DolphinView::directoryLoadingCompleted
,
1822 this, &DolphinMainWindow::disableStopAction
);
1823 connect(view
, &DolphinView::directoryLoadingCompleted
,
1824 this, &DolphinMainWindow::slotDirectoryLoadingCompleted
);
1825 connect(view
, &DolphinView::goBackRequested
,
1826 this, &DolphinMainWindow::goBack
);
1827 connect(view
, &DolphinView::goForwardRequested
,
1828 this, &DolphinMainWindow::goForward
);
1829 connect(view
, &DolphinView::urlActivated
,
1830 this, &DolphinMainWindow::handleUrl
);
1832 const KUrlNavigator
* navigator
= container
->urlNavigator();
1833 connect(navigator
, &KUrlNavigator::urlChanged
,
1834 this, &DolphinMainWindow::changeUrl
);
1835 connect(navigator
, &KUrlNavigator::historyChanged
,
1836 this, &DolphinMainWindow::updateHistory
);
1837 connect(navigator
, &KUrlNavigator::editableStateChanged
,
1838 this, &DolphinMainWindow::slotEditableStateChanged
);
1839 connect(navigator
, &KUrlNavigator::tabRequested
,
1840 this, &DolphinMainWindow::openNewTabAfterLastTab
);
1843 void DolphinMainWindow::updateSplitAction()
1845 QAction
* splitAction
= actionCollection()->action(QStringLiteral("split_view"));
1846 const DolphinTabPage
* tabPage
= m_tabWidget
->currentTabPage();
1847 if (tabPage
->splitViewEnabled()) {
1848 if (GeneralSettings::closeActiveSplitView() ? tabPage
->primaryViewActive() : !tabPage
->primaryViewActive()) {
1849 splitAction
->setText(i18nc("@action:intoolbar Close left view", "Close"));
1850 splitAction
->setToolTip(i18nc("@info", "Close left view"));
1851 splitAction
->setIcon(QIcon::fromTheme(QStringLiteral("view-left-close")));
1853 splitAction
->setText(i18nc("@action:intoolbar Close right view", "Close"));
1854 splitAction
->setToolTip(i18nc("@info", "Close right view"));
1855 splitAction
->setIcon(QIcon::fromTheme(QStringLiteral("view-right-close")));
1858 splitAction
->setText(i18nc("@action:intoolbar Split view", "Split"));
1859 splitAction
->setToolTip(i18nc("@info", "Split view"));
1860 splitAction
->setIcon(QIcon::fromTheme(QStringLiteral("view-right-new")));
1864 bool DolphinMainWindow::isKompareInstalled() const
1866 static bool initialized
= false;
1867 static bool installed
= false;
1869 // TODO: maybe replace this approach later by using a menu
1870 // plugin like kdiff3plugin.cpp
1871 installed
= !QStandardPaths::findExecutable(QStringLiteral("kompare")).isEmpty();
1877 void DolphinMainWindow::createPanelAction(const QIcon
& icon
,
1878 const QKeySequence
& shortcut
,
1879 QAction
* dockAction
,
1880 const QString
& actionName
)
1882 QAction
* panelAction
= actionCollection()->addAction(actionName
);
1883 panelAction
->setCheckable(true);
1884 panelAction
->setChecked(dockAction
->isChecked());
1885 panelAction
->setText(dockAction
->text());
1886 panelAction
->setIcon(icon
);
1887 actionCollection()->setDefaultShortcut(panelAction
, shortcut
);
1889 connect(panelAction
, &QAction::triggered
, dockAction
, &QAction::trigger
);
1890 connect(dockAction
, &QAction::toggled
, panelAction
, &QAction::setChecked
);
1893 void DolphinMainWindow::setupWhatsThis()
1896 menuBar()->setWhatsThis(xi18nc("@info:whatsthis", "<para>This is the "
1897 "<emphasis>Menubar</emphasis>. It provides access to commands and "
1898 "configuration options. Left-click on any of the menus on this "
1899 "bar to see its contents.</para><para>The Menubar can be hidden "
1900 "by unchecking <interface>Settings|Show Menubar</interface>. Then "
1901 "most of its contents become available through a <interface>Control"
1902 "</interface> button on the <emphasis>Toolbar</emphasis>.</para>"));
1903 toolBar()->setWhatsThis(xi18nc("@info:whatsthis", "<para>This is the "
1904 "<emphasis>Toolbar</emphasis>. It allows quick access to "
1905 "frequently used actions.</para><para>It is highly customizable. "
1906 "All items you see in the <interface>Control</interface> menu or "
1907 "in the <interface>Menubar</interface> can be placed on the "
1908 "Toolbar. Just right-click on it and select <interface>Configure "
1909 "Toolbars…</interface> or find this action in the <interface>"
1910 "Control</interface> or <interface>Settings</interface> menu."
1911 "</para><para>The location of the bar and the style of its "
1912 "buttons can also be changed in the right-click menu. Right-click "
1913 "a button if you want to show or hide its text.</para>"));
1914 m_tabWidget
->setWhatsThis(xi18nc("@info:whatsthis main view",
1915 "<para>Here you can see the <emphasis>folders</emphasis> and "
1916 "<emphasis>files</emphasis> that are at the location described in "
1917 "the <interface>Location Bar</interface> above. This area is the "
1918 "central part of this application where you navigate to the files "
1919 "you want to use.</para><para>For an elaborate and general "
1920 "introduction to this application <link "
1921 "url='https://userbase.kde.org/Dolphin/File_Management#Introduction_to_Dolphin'>"
1922 "click here</link>. This will open an introductory article from "
1923 "the <emphasis>KDE UserBase Wiki</emphasis>.</para><para>For brief "
1924 "explanations of all the features of this <emphasis>view</emphasis> "
1925 "<link url='help:/dolphin/dolphin-view.html'>click here</link> "
1926 "instead. This will open a page from the <emphasis>Handbook"
1927 "</emphasis> that covers the basics.</para>"));
1930 actionCollection()->action(KStandardAction::name(KStandardAction::KeyBindings
))
1931 ->setWhatsThis(xi18nc("@info:whatsthis","<para>This opens a window "
1932 "that lists the <emphasis>keyboard shortcuts</emphasis>.<nl/>"
1933 "There you can set up key combinations to trigger an action when "
1934 "they are pressed simultaneously. All commands in this application can "
1935 "be triggered this way.</para>"));
1936 actionCollection()->action(KStandardAction::name(KStandardAction::ConfigureToolbars
))
1937 ->setWhatsThis(xi18nc("@info:whatsthis","<para>This opens a window in which "
1938 "you can change which buttons appear on the <emphasis>Toolbar</emphasis>.</para>"
1939 "<para>All items you see in the <interface>Control</interface> menu "
1940 "or in the <interface>Menubar</interface> can also be placed on the Toolbar.</para>"));
1941 actionCollection()->action(KStandardAction::name(KStandardAction::Preferences
))
1942 ->setWhatsThis(xi18nc("@info:whatsthis","This opens a window where you can "
1943 "change a multitude of settings for this application. For an explanation "
1944 "of the various settings go to the chapter <emphasis>Configuring Dolphin"
1945 "</emphasis> in <interface>Help|Dolphin Handbook</interface>."));
1948 // The whatsthis has to be set for the m_helpMenu and for the
1949 // StandardAction separately because both are used in different locations.
1950 // m_helpMenu is only used for createControlButton() button.
1952 // Links do not work within the Menubar so texts without links are provided there.
1954 // i18n: If the external link isn't available in your language you should
1955 // probably state the external link language at least in brackets to not
1956 // frustrate the user. If there are multiple languages that the user might
1957 // know with a reasonable chance you might want to have 2 external links.
1958 // The same is in my opinion true for every external link you translate.
1959 const QString whatsThisHelpContents
= xi18nc("@info:whatsthis handbook",
1960 "<para>This opens the Handbook for this application. It provides "
1961 "explanations for every part of <emphasis>Dolphin</emphasis>.</para>");
1962 actionCollection()->action(KStandardAction::name(KStandardAction::HelpContents
))
1963 ->setWhatsThis(whatsThisHelpContents
1964 + xi18nc("@info:whatsthis second half of handbook hb text without link",
1965 "<para>If you want more elaborate introductions to the "
1966 "different features of <emphasis>Dolphin</emphasis> "
1967 "go to the KDE UserBase Wiki.</para>"));
1968 m_helpMenu
->action(KHelpMenu::menuHelpContents
)->setWhatsThis(whatsThisHelpContents
1969 + xi18nc("@info:whatsthis second half of handbook text with link",
1970 "<para>If you want more elaborate introductions to the "
1971 "different features of <emphasis>Dolphin</emphasis> "
1972 "<link url='https://userbase.kde.org/Dolphin/File_Management'>click here</link>. "
1973 "It will open the dedicated page in the KDE UserBase Wiki.</para>"));
1975 const QString whatsThisWhatsThis
= xi18nc("@info:whatsthis whatsthis button",
1976 "<para>This is the button that invokes the help feature you are "
1977 "using right now! Click it, then click any component of this "
1978 "application to ask \"What's this?\" about it. The mouse cursor "
1979 "will change appearance if no help is available for a spot.</para>");
1980 actionCollection()->action(KStandardAction::name(KStandardAction::WhatsThis
))
1981 ->setWhatsThis(whatsThisWhatsThis
1982 + xi18nc("@info:whatsthis second half of whatsthis button text without link",
1983 "<para>There are two other ways to get help for this application: The "
1984 "<interface>Dolphin Handbook</interface> in the <interface>Help"
1985 "</interface> menu and the <emphasis>KDE UserBase Wiki</emphasis> "
1986 "article about <emphasis>File Management</emphasis> online."
1987 "</para><para>The \"What's this?\" help is "
1988 "missing in most other windows so don't get too used to this.</para>"));
1989 m_helpMenu
->action(KHelpMenu::menuWhatsThis
)->setWhatsThis(whatsThisWhatsThis
1990 + xi18nc("@info:whatsthis second half of whatsthis button text with link",
1991 "<para>There are two other ways to get help: "
1992 "The <link url='help:/dolphin/index.html'>Dolphin Handbook</link> and "
1993 "the <link url='https://userbase.kde.org/Dolphin/File_Management'>KDE "
1994 "UserBase Wiki</link>.</para><para>The \"What's this?\" help is "
1995 "missing in most other windows so don't get too used to this.</para>"));
1997 const QString whatsThisReportBug
= xi18nc("@info:whatsthis","<para>This opens a "
1998 "window that will guide you through reporting errors or flaws "
1999 "in this application or in other KDE software.</para>");
2000 actionCollection()->action(KStandardAction::name(KStandardAction::ReportBug
))
2001 ->setWhatsThis(whatsThisReportBug
);
2002 m_helpMenu
->action(KHelpMenu::menuReportBug
)->setWhatsThis(whatsThisReportBug
2003 + xi18nc("@info:whatsthis second half of reportbug text with link",
2004 "<para>High-quality bug reports are much appreciated. To learn "
2005 "how to make your bug report as effective as possible "
2006 "<link url='https://community.kde.org/Get_Involved/Bug_Reporting'>"
2007 "click here</link>.</para>"));
2009 const QString whatsThisDonate
= xi18nc("@info:whatsthis","<para>This opens a "
2010 "<emphasis>web page</emphasis> where you can donate to "
2011 "support the continued work on this application and many "
2012 "other projects by the <emphasis>KDE</emphasis> community.</para>"
2013 "<para>Donating is the easiest and fastest way to efficiently "
2014 "support KDE and its projects. KDE projects are available for "
2015 "free therefore your donation is needed to cover things that "
2016 "require money like servers, contributor meetings, etc.</para>"
2017 "<para><emphasis>KDE e.V.</emphasis> is the non-profit "
2018 "organization behind the KDE community.</para>");
2019 actionCollection()->action(KStandardAction::name(KStandardAction::Donate
))
2020 ->setWhatsThis(whatsThisDonate
);
2021 m_helpMenu
->action(KHelpMenu::menuDonate
)->setWhatsThis(whatsThisDonate
);
2023 const QString whatsThisSwitchLanguage
= xi18nc("@info:whatsthis",
2024 "With this you can change the language this application uses."
2025 "<nl/>You can even set secondary languages which will be used "
2026 "if texts are not available in your preferred language.");
2027 actionCollection()->action(KStandardAction::name(KStandardAction::SwitchApplicationLanguage
))
2028 ->setWhatsThis(whatsThisSwitchLanguage
);
2029 m_helpMenu
->action(KHelpMenu::menuSwitchLanguage
)->setWhatsThis(whatsThisSwitchLanguage
);
2031 const QString whatsThisAboutApp
= xi18nc("@info:whatsthis","This opens a "
2032 "window that informs you about the version, license, "
2033 "used libraries and maintainers of this application.");
2034 actionCollection()->action(KStandardAction::name(KStandardAction::AboutApp
))
2035 ->setWhatsThis(whatsThisAboutApp
);
2036 m_helpMenu
->action(KHelpMenu::menuAboutApp
)->setWhatsThis(whatsThisAboutApp
);
2038 const QString whatsThisAboutKDE
= xi18nc("@info:whatsthis","This opens a "
2039 "window with information about <emphasis>KDE</emphasis>. "
2040 "The KDE community are the people behind this free software."
2041 "<nl/>If you like using this application but don't know "
2042 "about KDE or want to see a cute dragon have a look!");
2043 actionCollection()->action(KStandardAction::name(KStandardAction::AboutKDE
))
2044 ->setWhatsThis(whatsThisAboutKDE
);
2045 m_helpMenu
->action(KHelpMenu::menuAboutKDE
)->setWhatsThis(whatsThisAboutKDE
);
2048 bool DolphinMainWindow::event(QEvent
*event
)
2050 if (event
->type() == QEvent::WhatsThisClicked
) {
2052 QWhatsThisClickedEvent
* whatsThisEvent
= dynamic_cast<QWhatsThisClickedEvent
*>(event
);
2053 QDesktopServices::openUrl(QUrl(whatsThisEvent
->href()));
2056 return KXmlGuiWindow::event(event
);
2059 bool DolphinMainWindow::eventFilter(QObject
* obj
, QEvent
* event
)
2062 if (event
->type() == QEvent::WhatsThisClicked
) {
2064 QWhatsThisClickedEvent
* whatsThisEvent
= dynamic_cast<QWhatsThisClickedEvent
*>(event
);
2065 QDesktopServices::openUrl(QUrl(whatsThisEvent
->href()));
2071 DolphinMainWindow::UndoUiInterface::UndoUiInterface() :
2072 KIO::FileUndoManager::UiInterface()
2076 DolphinMainWindow::UndoUiInterface::~UndoUiInterface()
2080 void DolphinMainWindow::UndoUiInterface::jobError(KIO::Job
* job
)
2082 DolphinMainWindow
* mainWin
= qobject_cast
<DolphinMainWindow
*>(parentWidget());
2084 DolphinViewContainer
* container
= mainWin
->activeViewContainer();
2085 container
->showMessage(job
->errorString(), DolphinViewContainer::Error
);
2087 KIO::FileUndoManager::UiInterface::jobError(job
);
2091 bool DolphinMainWindow::isUrlOpen(const QString
& url
)
2093 if (m_tabWidget
->getIndexByUrl(QUrl::fromUserInput((url
))) >= 0) {