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 "dolphinapplication.h"
25 #include "dolphindockwidget.h"
26 #include "dolphincontextmenu.h"
27 #include "dolphinnewfilemenu.h"
28 #include "dolphinrecenttabsmenu.h"
29 #include "dolphintabbar.h"
30 #include "dolphinviewcontainer.h"
31 #include "dolphintabpage.h"
32 #include "panels/folders/folderspanel.h"
33 #include "panels/places/placespanel.h"
34 #include "panels/information/informationpanel.h"
35 #include "settings/dolphinsettingsdialog.h"
36 #include "statusbar/dolphinstatusbar.h"
37 #include "views/dolphinviewactionhandler.h"
38 #include "views/dolphinremoteencoding.h"
39 #include "views/draganddrophelper.h"
40 #include "views/viewproperties.h"
41 #include "views/dolphinnewfilemenuobserver.h"
44 #include "panels/terminal/terminalpanel.h"
47 #include "dolphin_generalsettings.h"
49 #include <KAcceleratorManager>
51 #include <KActionCollection>
52 #include <KActionMenu>
54 #include <KDesktopFile>
55 #include <kdeversion.h>
56 #include <kdualaction.h>
57 #include <KFileDialog>
62 #include <KIconLoader>
63 #include <KIO/NetAccess>
64 #include <KIO/JobUiDelegate>
65 #include <KInputDialog>
67 #include <KProtocolManager>
70 #include <KMessageBox>
71 #include <KFileItemListProperties>
72 #include <konqmimedata.h>
73 #include <KProtocolInfo>
76 #include <KStandardDirs>
77 #include <kstatusbar.h>
78 #include <KStandardAction>
79 #include <KToggleAction>
80 #include <KUrlNavigator>
82 #include <KUrlComboBox>
83 #include <KToolInvocation>
85 #include <QDesktopWidget>
86 #include <QDBusMessage>
89 #include <QToolButton>
92 // Used for GeneralSettings::version() to determine whether
93 // an updated version of Dolphin is running.
94 const int CurrentDolphinVersion
= 200;
97 DolphinMainWindow::DolphinMainWindow() :
101 m_activeViewContainer(0),
102 m_centralWidgetLayout(0),
109 m_updateToolBarTimer(0),
110 m_lastHandleUrlStatJob(0)
112 setObjectName("Dolphin#");
114 connect(&DolphinNewFileMenuObserver::instance(), SIGNAL(errorMessage(QString
)),
115 this, SLOT(showErrorMessage(QString
)));
117 KIO::FileUndoManager
* undoManager
= KIO::FileUndoManager::self();
118 undoManager
->setUiInterface(new UndoUiInterface());
120 connect(undoManager
, SIGNAL(undoAvailable(bool)),
121 this, SLOT(slotUndoAvailable(bool)));
122 connect(undoManager
, SIGNAL(undoTextChanged(QString
)),
123 this, SLOT(slotUndoTextChanged(QString
)));
124 connect(undoManager
, SIGNAL(jobRecordingStarted(CommandType
)),
125 this, SLOT(clearStatusBar()));
126 connect(undoManager
, SIGNAL(jobRecordingFinished(CommandType
)),
127 this, SLOT(showCommand(CommandType
)));
129 GeneralSettings
* generalSettings
= GeneralSettings::self();
130 const bool firstRun
= (generalSettings
->version() < 200);
132 generalSettings
->setViewPropsTimestamp(QDateTime::currentDateTime());
135 setAcceptDrops(true);
139 m_actionHandler
= new DolphinViewActionHandler(actionCollection(), this);
140 connect(m_actionHandler
, SIGNAL(actionBeingHandled()), SLOT(clearStatusBar()));
141 connect(m_actionHandler
, SIGNAL(createDirectory()), SLOT(createDirectory()));
143 m_remoteEncoding
= new DolphinRemoteEncoding(this, m_actionHandler
);
144 connect(this, SIGNAL(urlChanged(KUrl
)),
145 m_remoteEncoding
, SLOT(slotAboutToOpenUrl()));
147 m_tabBar
= new DolphinTabBar(this);
148 connect(m_tabBar
, SIGNAL(currentChanged(int)),
149 this, SLOT(setActiveTab(int)));
150 connect(m_tabBar
, SIGNAL(tabCloseRequested(int)),
151 this, SLOT(closeTab(int)));
152 connect(m_tabBar
, SIGNAL(openNewActivatedTab(int)),
153 this, SLOT(openNewActivatedTab(int)));
154 connect(m_tabBar
, SIGNAL(tabMoved(int,int)),
155 this, SLOT(slotTabMoved(int,int)));
156 connect(m_tabBar
, SIGNAL(tabDropEvent(int,QDropEvent
*)),
157 this, SLOT(tabDropEvent(int,QDropEvent
*)));
158 connect(m_tabBar
, SIGNAL(tabDetachRequested(int)),
159 this, SLOT(detachTab(int)));
161 m_tabBar
->blockSignals(true); // signals get unblocked after at least 2 tabs are open
164 QWidget
* centralWidget
= new QWidget(this);
165 m_centralWidgetLayout
= new QVBoxLayout(centralWidget
);
166 m_centralWidgetLayout
->setSpacing(0);
167 m_centralWidgetLayout
->setMargin(0);
168 m_centralWidgetLayout
->addWidget(m_tabBar
);
170 setCentralWidget(centralWidget
);
173 setupGUI(Keys
| Save
| Create
| ToolBar
);
174 stateChanged("new_file");
176 QClipboard
* clipboard
= QApplication::clipboard();
177 connect(clipboard
, SIGNAL(dataChanged()),
178 this, SLOT(updatePasteAction()));
180 QAction
* showFilterBarAction
= actionCollection()->action("show_filter_bar");
181 showFilterBarAction
->setChecked(generalSettings
->filterBar());
184 menuBar()->setVisible(false);
185 // Assure a proper default size if Dolphin runs the first time
189 const bool showMenu
= !menuBar()->isHidden();
190 QAction
* showMenuBarAction
= actionCollection()->action(KStandardAction::name(KStandardAction::ShowMenubar
));
191 showMenuBarAction
->setChecked(showMenu
); // workaround for bug #171080
193 createControlButton();
197 DolphinMainWindow::~DolphinMainWindow()
201 void DolphinMainWindow::openDirectories(const QList
<KUrl
>& dirs
)
203 const bool hasSplitView
= GeneralSettings::splitView();
205 // Open each directory inside a new tab. If the "split view" option has been enabled,
206 // always show two directories within one tab.
207 QList
<KUrl
>::const_iterator it
= dirs
.constBegin();
208 while (it
!= dirs
.constEnd()) {
209 const KUrl
& primaryUrl
= *(it
++);
210 if (hasSplitView
&& (it
!= dirs
.constEnd())) {
211 const KUrl
& secondaryUrl
= *(it
++);
212 openNewTab(primaryUrl
, secondaryUrl
);
214 openNewTab(primaryUrl
);
219 void DolphinMainWindow::openFiles(const QList
<KUrl
>& files
)
221 if (files
.isEmpty()) {
225 // Get all distinct directories from 'files' and open a tab
226 // for each directory. If the "split view" option is enabled, two
227 // directories are shown inside one tab (see openDirectories()).
229 foreach (const KUrl
& url
, files
) {
230 const KUrl
dir(url
.directory());
231 if (!dirs
.contains(dir
)) {
236 openDirectories(dirs
);
238 // Select the files. Although the files can be split between several
239 // tabs, there is no need to split 'files' accordingly, as
240 // the DolphinView will just ignore invalid selections.
241 foreach (DolphinTabPage
* tabPage
, m_viewTab
) {
242 tabPage
->markUrlsAsSelected(files
);
243 tabPage
->markUrlAsCurrent(files
.first());
247 void DolphinMainWindow::showCommand(CommandType command
)
249 DolphinStatusBar
* statusBar
= m_activeViewContainer
->statusBar();
251 case KIO::FileUndoManager::Copy
:
252 statusBar
->setText(i18nc("@info:status", "Successfully copied."));
254 case KIO::FileUndoManager::Move
:
255 statusBar
->setText(i18nc("@info:status", "Successfully moved."));
257 case KIO::FileUndoManager::Link
:
258 statusBar
->setText(i18nc("@info:status", "Successfully linked."));
260 case KIO::FileUndoManager::Trash
:
261 statusBar
->setText(i18nc("@info:status", "Successfully moved to trash."));
263 case KIO::FileUndoManager::Rename
:
264 statusBar
->setText(i18nc("@info:status", "Successfully renamed."));
267 case KIO::FileUndoManager::Mkdir
:
268 statusBar
->setText(i18nc("@info:status", "Created folder."));
276 void DolphinMainWindow::pasteIntoFolder()
278 m_activeViewContainer
->view()->pasteIntoFolder();
281 void DolphinMainWindow::changeUrl(const KUrl
& url
)
283 if (!KProtocolManager::supportsListing(url
)) {
284 // The URL navigator only checks for validity, not
285 // if the URL can be listed. An error message is
286 // shown due to DolphinViewContainer::restoreView().
290 DolphinViewContainer
* view
= activeViewContainer();
297 setUrlAsCaption(url
);
299 const QString iconName
= KMimeType::iconNameForUrl(url
);
300 m_tabBar
->setTabIcon(m_tabIndex
, KIcon(iconName
));
301 m_tabBar
->setTabText(m_tabIndex
, squeezedText(tabName(view
->url())));
303 emit
urlChanged(url
);
307 void DolphinMainWindow::slotTerminalDirectoryChanged(const KUrl
& url
)
309 m_activeViewContainer
->setAutoGrabFocus(false);
311 m_activeViewContainer
->setAutoGrabFocus(true);
314 void DolphinMainWindow::slotEditableStateChanged(bool editable
)
316 KToggleAction
* editableLocationAction
=
317 static_cast<KToggleAction
*>(actionCollection()->action("editable_location"));
318 editableLocationAction
->setChecked(editable
);
321 void DolphinMainWindow::slotSelectionChanged(const KFileItemList
& selection
)
325 const int selectedUrlsCount
= m_viewTab
.at(m_tabIndex
)->selectedItemsCount();
327 QAction
* compareFilesAction
= actionCollection()->action("compare_files");
328 if (selectedUrlsCount
== 2) {
329 compareFilesAction
->setEnabled(isKompareInstalled());
331 compareFilesAction
->setEnabled(false);
334 emit
selectionChanged(selection
);
337 void DolphinMainWindow::slotRequestItemInfo(const KFileItem
& item
)
339 emit
requestItemInfo(item
);
342 void DolphinMainWindow::updateHistory()
344 const KUrlNavigator
* urlNavigator
= m_activeViewContainer
->urlNavigator();
345 const int index
= urlNavigator
->historyIndex();
347 QAction
* backAction
= actionCollection()->action("go_back");
349 backAction
->setToolTip(i18nc("@info", "Go back"));
350 backAction
->setEnabled(index
< urlNavigator
->historySize() - 1);
353 QAction
* forwardAction
= actionCollection()->action("go_forward");
355 forwardAction
->setToolTip(i18nc("@info", "Go forward"));
356 forwardAction
->setEnabled(index
> 0);
360 void DolphinMainWindow::updateFilterBarAction(bool show
)
362 QAction
* showFilterBarAction
= actionCollection()->action("show_filter_bar");
363 showFilterBarAction
->setChecked(show
);
366 void DolphinMainWindow::openNewMainWindow()
368 KRun::run("dolphin %u", KUrl::List(), this);
371 void DolphinMainWindow::openNewTab()
373 const bool isUrlEditable
= m_activeViewContainer
->urlNavigator()->isUrlEditable();
375 openNewTab(m_activeViewContainer
->url());
376 m_tabBar
->setCurrentIndex(m_viewTab
.count() - 1);
378 // The URL navigator of the new tab should have the same editable state
379 // as the current tab
380 KUrlNavigator
* navigator
= m_activeViewContainer
->urlNavigator();
381 navigator
->setUrlEditable(isUrlEditable
);
384 // If a new tab is opened and the URL is editable, assure that
385 // the user can edit the URL without manually setting the focus
386 navigator
->setFocus();
390 void DolphinMainWindow::openNewTab(const KUrl
& primaryUrl
, const KUrl
& secondaryUrl
)
392 QWidget
* focusWidget
= QApplication::focusWidget();
394 DolphinTabPage
* tabPage
= new DolphinTabPage(primaryUrl
, secondaryUrl
, this);
395 m_viewTab
.append(tabPage
);
397 connect(tabPage
, SIGNAL(activeViewChanged()),
398 this, SLOT(activeViewChanged()));
400 // The places-selector from the URL navigator should only be shown
401 // if the places dock is invisible
402 QDockWidget
* placesDock
= findChild
<QDockWidget
*>("placesDock");
403 const bool placesSelectorVisible
= !placesDock
|| !placesDock
->isVisible();
404 tabPage
->setPlacesSelectorVisible(placesSelectorVisible
);
406 DolphinViewContainer
* primaryContainer
= tabPage
->primaryViewContainer();
407 connectViewSignals(primaryContainer
);
409 if (tabPage
->splitViewEnabled()) {
410 DolphinViewContainer
* secondaryContainer
= tabPage
->secondaryViewContainer();
411 connectViewSignals(secondaryContainer
);
416 m_tabBar
->addTab(KIcon(KMimeType::iconNameForUrl(primaryUrl
)),
417 squeezedText(tabName(primaryUrl
)));
419 if (m_viewTab
.count() > 1) {
420 actionCollection()->action("close_tab")->setEnabled(true);
421 actionCollection()->action("activate_prev_tab")->setEnabled(true);
422 actionCollection()->action("activate_next_tab")->setEnabled(true);
424 m_tabBar
->blockSignals(false);
428 // The DolphinViewContainer grabbed the keyboard focus. As the tab is opened
429 // in background, assure that the previous focused widget gets the focus back.
430 focusWidget
->setFocus();
434 void DolphinMainWindow::openNewActivatedTab(const KUrl
& primaryUrl
, const KUrl
& secondaryUrl
)
436 openNewTab(primaryUrl
, secondaryUrl
);
437 setActiveTab(m_viewTab
.count() - 1);
440 void DolphinMainWindow::openNewActivatedTab(int index
)
442 Q_ASSERT(index
>= 0);
443 const DolphinTabPage
* tabPage
= m_viewTab
.at(index
);
444 openNewActivatedTab(tabPage
->activeViewContainer()->url());
447 void DolphinMainWindow::activateNextTab()
449 if (m_viewTab
.count() >= 2) {
450 const int tabIndex
= (m_tabBar
->currentIndex() + 1) % m_tabBar
->count();
451 setActiveTab(tabIndex
);
455 void DolphinMainWindow::activatePrevTab()
457 if (m_viewTab
.count() >= 2) {
458 int tabIndex
= m_tabBar
->currentIndex() - 1;
459 if (tabIndex
== -1) {
460 tabIndex
= m_tabBar
->count() - 1;
462 setActiveTab(tabIndex
);
466 void DolphinMainWindow::openInNewTab()
468 const KFileItemList
& list
= m_activeViewContainer
->view()->selectedItems();
469 if (list
.isEmpty()) {
470 openNewTab(m_activeViewContainer
->url());
472 foreach (const KFileItem
& item
, list
) {
473 const KUrl
& url
= DolphinView::openItemAsFolderUrl(item
);
474 if (!url
.isEmpty()) {
481 void DolphinMainWindow::openInNewWindow()
485 const KFileItemList list
= m_activeViewContainer
->view()->selectedItems();
486 if (list
.isEmpty()) {
487 newWindowUrl
= m_activeViewContainer
->url();
488 } else if (list
.count() == 1) {
489 const KFileItem
& item
= list
.first();
490 newWindowUrl
= DolphinView::openItemAsFolderUrl(item
);
493 if (!newWindowUrl
.isEmpty()) {
494 KRun::run("dolphin %u", KUrl::List() << newWindowUrl
, this);
498 void DolphinMainWindow::showEvent(QShowEvent
* event
)
500 KXmlGuiWindow::showEvent(event
);
502 if (!m_activeViewContainer
&& m_viewTab
.count() > 0) {
503 // If we have no active view container yet, we set the primary view container
504 // of the first tab as active view container.
508 if (!event
->spontaneous()) {
509 m_activeViewContainer
->view()->setFocus();
513 void DolphinMainWindow::closeEvent(QCloseEvent
* event
)
515 // Find out if Dolphin is closed directly by the user or
516 // by the session manager because the session is closed
517 bool closedByUser
= true;
518 DolphinApplication
*application
= qobject_cast
<DolphinApplication
*>(qApp
);
519 if (application
&& application
->sessionSaving()) {
520 closedByUser
= false;
523 if (m_viewTab
.count() > 1 && GeneralSettings::confirmClosingMultipleTabs() && closedByUser
) {
524 // Ask the user if he really wants to quit and close all tabs.
525 // Open a confirmation dialog with 3 buttons:
526 // KDialog::Yes -> Quit
527 // KDialog::No -> Close only the current tab
528 // KDialog::Cancel -> do nothing
529 KDialog
*dialog
= new KDialog(this, Qt::Dialog
);
530 dialog
->setCaption(i18nc("@title:window", "Confirmation"));
531 dialog
->setButtons(KDialog::Yes
| KDialog::No
| KDialog::Cancel
);
532 dialog
->setModal(true);
533 dialog
->setButtonGuiItem(KDialog::Yes
, KStandardGuiItem::quit());
534 dialog
->setButtonGuiItem(KDialog::No
, KGuiItem(i18n("C&lose Current Tab"), KIcon("tab-close")));
535 dialog
->setButtonGuiItem(KDialog::Cancel
, KStandardGuiItem::cancel());
536 dialog
->setDefaultButton(KDialog::Yes
);
538 bool doNotAskAgainCheckboxResult
= false;
540 const int result
= KMessageBox::createKMessageBox(dialog
,
541 QMessageBox::Warning
,
542 i18n("You have multiple tabs open in this window, are you sure you want to quit?"),
544 i18n("Do not ask again"),
545 &doNotAskAgainCheckboxResult
,
546 KMessageBox::Notify
);
548 if (doNotAskAgainCheckboxResult
) {
549 GeneralSettings::setConfirmClosingMultipleTabs(false);
557 // Close only the current tab
565 GeneralSettings::setVersion(CurrentDolphinVersion
);
566 GeneralSettings::self()->writeConfig();
568 KXmlGuiWindow::closeEvent(event
);
571 void DolphinMainWindow::saveProperties(KConfigGroup
& group
)
573 const int tabCount
= m_viewTab
.count();
574 group
.writeEntry("Tab Count", tabCount
);
575 group
.writeEntry("Active Tab Index", m_tabBar
->currentIndex());
577 for (int i
= 0; i
< tabCount
; ++i
) {
578 const DolphinTabPage
* tabPage
= m_viewTab
.at(i
);
579 group
.writeEntry("Tab " % QString::number(i
), tabPage
->saveState());
583 void DolphinMainWindow::readProperties(const KConfigGroup
& group
)
585 const int tabCount
= group
.readEntry("Tab Count", 1);
586 for (int i
= 0; i
< tabCount
; ++i
) {
587 const QByteArray state
= group
.readEntry("Tab " % QString::number(i
), QByteArray());
588 DolphinTabPage
* tabPage
= m_viewTab
.at(i
);
589 tabPage
->restoreState(state
);
591 // openNewTab() needs to be called only tabCount - 1 times
592 if (i
!= tabCount
- 1) {
597 const int index
= group
.readEntry("Active Tab Index", 0);
598 m_tabBar
->setCurrentIndex(index
);
601 void DolphinMainWindow::updateNewMenu()
603 m_newFileMenu
->setViewShowsHiddenFiles(activeViewContainer()->view()->hiddenFilesShown());
604 m_newFileMenu
->checkUpToDate();
605 m_newFileMenu
->setPopupFiles(activeViewContainer()->url());
608 void DolphinMainWindow::createDirectory()
610 m_newFileMenu
->setViewShowsHiddenFiles(activeViewContainer()->view()->hiddenFilesShown());
611 m_newFileMenu
->setPopupFiles(activeViewContainer()->url());
612 m_newFileMenu
->createDirectory();
615 void DolphinMainWindow::quit()
620 void DolphinMainWindow::showErrorMessage(const QString
& message
)
622 m_activeViewContainer
->showMessage(message
, DolphinViewContainer::Error
);
625 void DolphinMainWindow::slotUndoAvailable(bool available
)
627 QAction
* undoAction
= actionCollection()->action(KStandardAction::name(KStandardAction::Undo
));
629 undoAction
->setEnabled(available
);
633 void DolphinMainWindow::slotUndoTextChanged(const QString
& text
)
635 QAction
* undoAction
= actionCollection()->action(KStandardAction::name(KStandardAction::Undo
));
637 undoAction
->setText(text
);
641 void DolphinMainWindow::undo()
644 KIO::FileUndoManager::self()->uiInterface()->setParentWidget(this);
645 KIO::FileUndoManager::self()->undo();
648 void DolphinMainWindow::cut()
650 m_activeViewContainer
->view()->cutSelectedItems();
653 void DolphinMainWindow::copy()
655 m_activeViewContainer
->view()->copySelectedItems();
658 void DolphinMainWindow::paste()
660 m_activeViewContainer
->view()->paste();
663 void DolphinMainWindow::find()
665 m_activeViewContainer
->setSearchModeEnabled(true);
668 void DolphinMainWindow::updatePasteAction()
670 QAction
* pasteAction
= actionCollection()->action(KStandardAction::name(KStandardAction::Paste
));
671 QPair
<bool, QString
> pasteInfo
= m_activeViewContainer
->view()->pasteInfo();
672 pasteAction
->setEnabled(pasteInfo
.first
);
673 pasteAction
->setText(pasteInfo
.second
);
676 void DolphinMainWindow::selectAll()
680 // if the URL navigator is editable and focused, select the whole
681 // URL instead of all items of the view
683 KUrlNavigator
* urlNavigator
= m_activeViewContainer
->urlNavigator();
684 QLineEdit
* lineEdit
= urlNavigator
->editor()->lineEdit(); // krazy:exclude=qclasses
685 const bool selectUrl
= urlNavigator
->isUrlEditable() &&
686 lineEdit
->hasFocus();
688 lineEdit
->selectAll();
690 m_activeViewContainer
->view()->selectAll();
694 void DolphinMainWindow::invertSelection()
697 m_activeViewContainer
->view()->invertSelection();
700 void DolphinMainWindow::toggleSplitView()
702 DolphinTabPage
* tabPage
= m_viewTab
.at(m_tabIndex
);
703 tabPage
->setSplitViewEnabled(!tabPage
->splitViewEnabled());
705 if (tabPage
->splitViewEnabled()) {
706 connectViewSignals(tabPage
->secondaryViewContainer());
712 void DolphinMainWindow::reloadView()
715 m_activeViewContainer
->view()->reload();
718 void DolphinMainWindow::stopLoading()
720 m_activeViewContainer
->view()->stopLoading();
723 void DolphinMainWindow::enableStopAction()
725 actionCollection()->action("stop")->setEnabled(true);
728 void DolphinMainWindow::disableStopAction()
730 actionCollection()->action("stop")->setEnabled(false);
733 void DolphinMainWindow::showFilterBar()
735 m_activeViewContainer
->setFilterBarVisible(true);
738 void DolphinMainWindow::toggleEditLocation()
742 QAction
* action
= actionCollection()->action("editable_location");
743 KUrlNavigator
* urlNavigator
= m_activeViewContainer
->urlNavigator();
744 urlNavigator
->setUrlEditable(action
->isChecked());
747 void DolphinMainWindow::replaceLocation()
749 KUrlNavigator
* navigator
= m_activeViewContainer
->urlNavigator();
750 navigator
->setUrlEditable(true);
751 navigator
->setFocus();
753 // select the whole text of the combo box editor
754 QLineEdit
* lineEdit
= navigator
->editor()->lineEdit(); // krazy:exclude=qclasses
755 lineEdit
->selectAll();
758 void DolphinMainWindow::togglePanelLockState()
760 const bool newLockState
= !GeneralSettings::lockPanels();
761 foreach (QObject
* child
, children()) {
762 DolphinDockWidget
* dock
= qobject_cast
<DolphinDockWidget
*>(child
);
764 dock
->setLocked(newLockState
);
768 GeneralSettings::setLockPanels(newLockState
);
771 void DolphinMainWindow::slotPlacesPanelVisibilityChanged(bool visible
)
773 foreach (DolphinTabPage
* tabPage
, m_viewTab
) {
774 // The Places selector in the location bar should be shown if and only if the Places panel is hidden.
775 tabPage
->setPlacesSelectorVisible(!visible
);
779 void DolphinMainWindow::goBack()
781 KUrlNavigator
* urlNavigator
= m_activeViewContainer
->urlNavigator();
782 urlNavigator
->goBack();
784 if (urlNavigator
->locationState().isEmpty()) {
785 // An empty location state indicates a redirection URL,
786 // which must be skipped too
787 urlNavigator
->goBack();
791 void DolphinMainWindow::goForward()
793 m_activeViewContainer
->urlNavigator()->goForward();
796 void DolphinMainWindow::goUp()
798 m_activeViewContainer
->urlNavigator()->goUp();
801 void DolphinMainWindow::goHome()
803 m_activeViewContainer
->urlNavigator()->goHome();
806 void DolphinMainWindow::goBack(Qt::MouseButtons buttons
)
808 // The default case (left button pressed) is handled in goBack().
809 if (buttons
== Qt::MidButton
) {
810 KUrlNavigator
* urlNavigator
= activeViewContainer()->urlNavigator();
811 const int index
= urlNavigator
->historyIndex() + 1;
812 openNewTab(urlNavigator
->locationUrl(index
));
816 void DolphinMainWindow::goForward(Qt::MouseButtons buttons
)
818 // The default case (left button pressed) is handled in goForward().
819 if (buttons
== Qt::MidButton
) {
820 KUrlNavigator
* urlNavigator
= activeViewContainer()->urlNavigator();
821 const int index
= urlNavigator
->historyIndex() - 1;
822 openNewTab(urlNavigator
->locationUrl(index
));
826 void DolphinMainWindow::goUp(Qt::MouseButtons buttons
)
828 // The default case (left button pressed) is handled in goUp().
829 if (buttons
== Qt::MidButton
) {
830 openNewTab(activeViewContainer()->url().upUrl());
834 void DolphinMainWindow::goHome(Qt::MouseButtons buttons
)
836 // The default case (left button pressed) is handled in goHome().
837 if (buttons
== Qt::MidButton
) {
838 openNewTab(GeneralSettings::self()->homeUrl());
842 void DolphinMainWindow::compareFiles()
844 const KFileItemList items
= m_viewTab
.at(m_tabIndex
)->selectedItems();
845 if (items
.count() != 2) {
846 // The action is disabled in this case, but it could have been triggered
847 // via D-Bus, see https://bugs.kde.org/show_bug.cgi?id=325517
851 KUrl urlA
= items
.at(0).url();
852 KUrl urlB
= items
.at(1).url();
854 QString
command("kompare -c \"");
855 command
.append(urlA
.pathOrUrl());
856 command
.append("\" \"");
857 command
.append(urlB
.pathOrUrl());
858 command
.append('\"');
859 KRun::runCommand(command
, "Kompare", "kompare", this);
862 void DolphinMainWindow::toggleShowMenuBar()
864 const bool visible
= menuBar()->isVisible();
865 menuBar()->setVisible(!visible
);
867 createControlButton();
869 deleteControlButton();
873 void DolphinMainWindow::openTerminal()
875 QString
dir(QDir::homePath());
877 // If the given directory is not local, it can still be the URL of an
878 // ioslave using UDS_LOCAL_PATH which to be converted first.
879 KUrl url
= KIO::NetAccess::mostLocalUrl(m_activeViewContainer
->url(), this);
881 //If the URL is local after the above conversion, set the directory.
882 if (url
.isLocalFile()) {
883 dir
= url
.toLocalFile();
886 KToolInvocation::invokeTerminal(QString(), dir
);
889 void DolphinMainWindow::editSettings()
891 if (!m_settingsDialog
) {
892 DolphinViewContainer
* container
= activeViewContainer();
893 container
->view()->writeSettings();
895 const KUrl url
= container
->url();
896 DolphinSettingsDialog
* settingsDialog
= new DolphinSettingsDialog(url
, this);
897 connect(settingsDialog
, SIGNAL(settingsChanged()), this, SLOT(refreshViews()));
898 settingsDialog
->setAttribute(Qt::WA_DeleteOnClose
);
899 settingsDialog
->show();
900 m_settingsDialog
= settingsDialog
;
902 m_settingsDialog
.data()->raise();
906 void DolphinMainWindow::setActiveTab(int index
)
908 Q_ASSERT(index
>= 0);
909 Q_ASSERT(index
< m_viewTab
.count());
910 if (index
== m_tabIndex
) {
914 m_tabBar
->setCurrentIndex(index
);
916 // hide current tab content
917 if (m_tabIndex
>= 0) {
918 DolphinTabPage
* hiddenTabPage
= m_viewTab
.at(m_tabIndex
);
919 hiddenTabPage
->hide();
920 m_centralWidgetLayout
->removeWidget(hiddenTabPage
);
923 // show active tab content
926 DolphinTabPage
* tabPage
= m_viewTab
.at(index
);
927 m_centralWidgetLayout
->addWidget(tabPage
, 1);
930 setActiveViewContainer(tabPage
->activeViewContainer());
933 void DolphinMainWindow::closeTab()
935 closeTab(m_tabBar
->currentIndex());
938 void DolphinMainWindow::closeTab(int index
)
940 Q_ASSERT(index
>= 0);
941 Q_ASSERT(index
< m_viewTab
.count());
942 if (m_viewTab
.count() == 1) {
943 // the last tab may never get closed
947 if (index
== m_tabIndex
) {
948 // The tab that should be closed is the active tab. Activate the
949 // previous tab before closing the tab.
950 m_tabBar
->setCurrentIndex((index
> 0) ? index
- 1 : 1);
953 DolphinTabPage
* tabPage
= m_viewTab
.at(index
);
955 if (tabPage
->splitViewEnabled()) {
956 emit
rememberClosedTab(tabPage
->primaryViewContainer()->url(),
957 tabPage
->secondaryViewContainer()->url());
959 emit
rememberClosedTab(tabPage
->primaryViewContainer()->url(), KUrl());
963 m_viewTab
.removeAt(index
);
964 tabPage
->deleteLater();
966 m_tabBar
->blockSignals(true);
967 m_tabBar
->removeTab(index
);
969 if (m_tabIndex
> index
) {
971 Q_ASSERT(m_tabIndex
>= 0);
974 // if only one tab is left, also remove the tab entry so that
975 // closing the last tab is not possible
976 if (m_viewTab
.count() < 2) {
977 actionCollection()->action("close_tab")->setEnabled(false);
978 actionCollection()->action("activate_prev_tab")->setEnabled(false);
979 actionCollection()->action("activate_next_tab")->setEnabled(false);
982 m_tabBar
->blockSignals(false);
986 void DolphinMainWindow::detachTab(int index
)
988 Q_ASSERT(index
>= 0);
990 const QString
separator(QLatin1Char(' '));
991 QString command
= QLatin1String("dolphin");
993 const DolphinTabPage
* tabPage
= m_viewTab
.at(index
);
994 command
+= separator
+ tabPage
->primaryViewContainer()->url().url();
995 if (tabPage
->splitViewEnabled()) {
996 command
+= separator
+ tabPage
->secondaryViewContainer()->url().url();
997 command
+= separator
+ QLatin1String("-split");
1000 KRun::runCommand(command
, this);
1005 void DolphinMainWindow::slotTabMoved(int from
, int to
)
1007 m_viewTab
.move(from
, to
);
1008 m_tabIndex
= m_tabBar
->currentIndex();
1011 void DolphinMainWindow::handleUrl(const KUrl
& url
)
1013 delete m_lastHandleUrlStatJob
;
1014 m_lastHandleUrlStatJob
= 0;
1016 if (url
.isLocalFile() && QFileInfo(url
.toLocalFile()).isDir()) {
1017 activeViewContainer()->setUrl(url
);
1018 } else if (KProtocolManager::supportsListing(url
)) {
1019 // stat the URL to see if it is a dir or not
1020 m_lastHandleUrlStatJob
= KIO::stat(url
, KIO::HideProgressInfo
);
1021 if (m_lastHandleUrlStatJob
->ui()) {
1022 m_lastHandleUrlStatJob
->ui()->setWindow(this);
1024 connect(m_lastHandleUrlStatJob
, SIGNAL(result(KJob
*)),
1025 this, SLOT(slotHandleUrlStatFinished(KJob
*)));
1028 new KRun(url
, this); // Automatically deletes itself after being finished
1032 void DolphinMainWindow::slotHandleUrlStatFinished(KJob
* job
)
1034 m_lastHandleUrlStatJob
= 0;
1035 const KIO::UDSEntry entry
= static_cast<KIO::StatJob
*>(job
)->statResult();
1036 const KUrl url
= static_cast<KIO::StatJob
*>(job
)->url();
1037 if (entry
.isDir()) {
1038 activeViewContainer()->setUrl(url
);
1040 new KRun(url
, this); // Automatically deletes itself after being finished
1044 void DolphinMainWindow::tabDropEvent(int tab
, QDropEvent
* event
)
1046 const KUrl::List urls
= KUrl::List::fromMimeData(event
->mimeData());
1047 if (!urls
.isEmpty() && tab
!= -1) {
1048 const DolphinView
* view
= m_viewTab
.at(tab
)->activeViewContainer()->view();
1051 DragAndDropHelper::dropUrls(view
->rootItem(), view
->url(), event
, error
);
1052 if (!error
.isEmpty()) {
1053 activeViewContainer()->showMessage(error
, DolphinViewContainer::Error
);
1058 void DolphinMainWindow::slotWriteStateChanged(bool isFolderWritable
)
1060 newFileMenu()->setEnabled(isFolderWritable
);
1063 void DolphinMainWindow::openContextMenu(const QPoint
& pos
,
1064 const KFileItem
& item
,
1066 const QList
<QAction
*>& customActions
)
1068 QWeakPointer
<DolphinContextMenu
> contextMenu
= new DolphinContextMenu(this, pos
, item
, url
);
1069 contextMenu
.data()->setCustomActions(customActions
);
1070 const DolphinContextMenu::Command command
= contextMenu
.data()->open();
1073 case DolphinContextMenu::OpenParentFolderInNewWindow
: {
1074 KRun::run("dolphin %u", KUrl::List() << item
.url().upUrl(), this);
1078 case DolphinContextMenu::OpenParentFolderInNewTab
:
1079 openNewTab(item
.url().upUrl());
1082 case DolphinContextMenu::None
:
1087 delete contextMenu
.data();
1090 void DolphinMainWindow::updateControlMenu()
1092 KMenu
* menu
= qobject_cast
<KMenu
*>(sender());
1095 // All actions get cleared by KMenu::clear(). The sub-menus are deleted
1096 // by connecting to the aboutToHide() signal from the parent-menu.
1099 KActionCollection
* ac
= actionCollection();
1101 // Add "Edit" actions
1102 bool added
= addActionToMenu(ac
->action(KStandardAction::name(KStandardAction::Undo
)), menu
) |
1103 addActionToMenu(ac
->action(KStandardAction::name(KStandardAction::Find
)), menu
) |
1104 addActionToMenu(ac
->action("select_all"), menu
) |
1105 addActionToMenu(ac
->action("invert_selection"), menu
);
1108 menu
->addSeparator();
1111 // Add "View" actions
1112 if (!GeneralSettings::showZoomSlider()) {
1113 addActionToMenu(ac
->action(KStandardAction::name(KStandardAction::ZoomIn
)), menu
);
1114 addActionToMenu(ac
->action(KStandardAction::name(KStandardAction::ZoomOut
)), menu
);
1115 menu
->addSeparator();
1118 added
= addActionToMenu(ac
->action("view_mode"), menu
) |
1119 addActionToMenu(ac
->action("sort"), menu
) |
1120 addActionToMenu(ac
->action("additional_info"), menu
) |
1121 addActionToMenu(ac
->action("show_preview"), menu
) |
1122 addActionToMenu(ac
->action("show_in_groups"), menu
) |
1123 addActionToMenu(ac
->action("show_hidden_files"), menu
);
1126 menu
->addSeparator();
1129 added
= addActionToMenu(ac
->action("split_view"), menu
) |
1130 addActionToMenu(ac
->action("reload"), menu
) |
1131 addActionToMenu(ac
->action("view_properties"), menu
);
1133 menu
->addSeparator();
1136 addActionToMenu(ac
->action("panels"), menu
);
1137 KMenu
* locationBarMenu
= new KMenu(i18nc("@action:inmenu", "Location Bar"), menu
);
1138 locationBarMenu
->addAction(ac
->action("editable_location"));
1139 locationBarMenu
->addAction(ac
->action("replace_location"));
1140 menu
->addMenu(locationBarMenu
);
1142 menu
->addSeparator();
1145 KMenu
* goMenu
= new KMenu(i18nc("@action:inmenu", "Go"), menu
);
1146 connect(menu
, SIGNAL(aboutToHide()), goMenu
, SLOT(deleteLater()));
1147 goMenu
->addAction(ac
->action(KStandardAction::name(KStandardAction::Back
)));
1148 goMenu
->addAction(ac
->action(KStandardAction::name(KStandardAction::Forward
)));
1149 goMenu
->addAction(ac
->action(KStandardAction::name(KStandardAction::Up
)));
1150 goMenu
->addAction(ac
->action(KStandardAction::name(KStandardAction::Home
)));
1151 goMenu
->addAction(ac
->action("closed_tabs"));
1152 menu
->addMenu(goMenu
);
1155 KMenu
* toolsMenu
= new KMenu(i18nc("@action:inmenu", "Tools"), menu
);
1156 connect(menu
, SIGNAL(aboutToHide()), toolsMenu
, SLOT(deleteLater()));
1157 toolsMenu
->addAction(ac
->action("show_filter_bar"));
1158 toolsMenu
->addAction(ac
->action("compare_files"));
1159 toolsMenu
->addAction(ac
->action("open_terminal"));
1160 toolsMenu
->addAction(ac
->action("change_remote_encoding"));
1161 menu
->addMenu(toolsMenu
);
1163 // Add "Settings" menu entries
1164 addActionToMenu(ac
->action(KStandardAction::name(KStandardAction::KeyBindings
)), menu
);
1165 addActionToMenu(ac
->action(KStandardAction::name(KStandardAction::ConfigureToolbars
)), menu
);
1166 addActionToMenu(ac
->action(KStandardAction::name(KStandardAction::Preferences
)), menu
);
1169 KMenu
* helpMenu
= new KMenu(i18nc("@action:inmenu", "Help"), menu
);
1170 connect(menu
, SIGNAL(aboutToHide()), helpMenu
, SLOT(deleteLater()));
1171 helpMenu
->addAction(ac
->action(KStandardAction::name(KStandardAction::HelpContents
)));
1172 helpMenu
->addAction(ac
->action(KStandardAction::name(KStandardAction::WhatsThis
)));
1173 helpMenu
->addSeparator();
1174 helpMenu
->addAction(ac
->action(KStandardAction::name(KStandardAction::ReportBug
)));
1175 helpMenu
->addSeparator();
1176 helpMenu
->addAction(ac
->action(KStandardAction::name(KStandardAction::SwitchApplicationLanguage
)));
1177 helpMenu
->addSeparator();
1178 helpMenu
->addAction(ac
->action(KStandardAction::name(KStandardAction::AboutApp
)));
1179 helpMenu
->addAction(ac
->action(KStandardAction::name(KStandardAction::AboutKDE
)));
1180 menu
->addMenu(helpMenu
);
1182 menu
->addSeparator();
1183 addActionToMenu(ac
->action(KStandardAction::name(KStandardAction::ShowMenubar
)), menu
);
1186 void DolphinMainWindow::updateToolBar()
1188 if (!menuBar()->isVisible()) {
1189 createControlButton();
1193 void DolphinMainWindow::slotControlButtonDeleted()
1195 m_controlButton
= 0;
1196 m_updateToolBarTimer
->start();
1199 void DolphinMainWindow::slotPanelErrorMessage(const QString
& error
)
1201 activeViewContainer()->showMessage(error
, DolphinViewContainer::Error
);
1204 void DolphinMainWindow::slotPlaceActivated(const KUrl
& url
)
1206 DolphinViewContainer
* view
= activeViewContainer();
1208 if (view
->url() == url
) {
1209 // We can end up here if the user clicked a device in the Places Panel
1210 // which had been unmounted earlier, see https://bugs.kde.org/show_bug.cgi?id=161385.
1217 void DolphinMainWindow::activeViewChanged()
1219 const DolphinTabPage
* tabPage
= m_viewTab
.at(m_tabIndex
);
1220 setActiveViewContainer(tabPage
->activeViewContainer());
1223 void DolphinMainWindow::closedTabsCountChanged(unsigned int count
)
1225 actionCollection()->action("undo_close_tab")->setEnabled(count
> 0);
1228 void DolphinMainWindow::setActiveViewContainer(DolphinViewContainer
* viewContainer
)
1230 Q_ASSERT(viewContainer
);
1231 Q_ASSERT((viewContainer
== m_viewTab
.at(m_tabIndex
)->primaryViewContainer()) ||
1232 (viewContainer
== m_viewTab
.at(m_tabIndex
)->secondaryViewContainer()));
1233 if (m_activeViewContainer
== viewContainer
) {
1237 m_activeViewContainer
= viewContainer
;
1238 m_actionHandler
->setCurrentView(viewContainer
->view());
1241 updateEditActions();
1242 updatePasteAction();
1243 updateViewActions();
1246 const KUrl url
= m_activeViewContainer
->url();
1247 setUrlAsCaption(url
);
1248 m_tabBar
->setTabText(m_tabIndex
, squeezedText(tabName(url
)));
1249 m_tabBar
->setTabIcon(m_tabIndex
, KIcon(KMimeType::iconNameForUrl(url
)));
1251 emit
urlChanged(url
);
1254 void DolphinMainWindow::setupActions()
1256 // setup 'File' menu
1257 m_newFileMenu
= new DolphinNewFileMenu(actionCollection(), this);
1258 KMenu
* menu
= m_newFileMenu
->menu();
1259 menu
->setTitle(i18nc("@title:menu Create new folder, file, link, etc.", "Create New"));
1260 menu
->setIcon(KIcon("document-new"));
1261 m_newFileMenu
->setDelayed(false);
1262 connect(menu
, SIGNAL(aboutToShow()),
1263 this, SLOT(updateNewMenu()));
1265 KAction
* newWindow
= actionCollection()->addAction("new_window");
1266 newWindow
->setIcon(KIcon("window-new"));
1267 newWindow
->setText(i18nc("@action:inmenu File", "New &Window"));
1268 newWindow
->setShortcut(Qt::CTRL
| Qt::Key_N
);
1269 connect(newWindow
, SIGNAL(triggered()), this, SLOT(openNewMainWindow()));
1271 KAction
* newTab
= actionCollection()->addAction("new_tab");
1272 newTab
->setIcon(KIcon("tab-new"));
1273 newTab
->setText(i18nc("@action:inmenu File", "New Tab"));
1274 newTab
->setShortcut(KShortcut(Qt::CTRL
| Qt::Key_T
, Qt::CTRL
| Qt::SHIFT
| Qt::Key_N
));
1275 connect(newTab
, SIGNAL(triggered()), this, SLOT(openNewTab()));
1277 KAction
* closeTab
= actionCollection()->addAction("close_tab");
1278 closeTab
->setIcon(KIcon("tab-close"));
1279 closeTab
->setText(i18nc("@action:inmenu File", "Close Tab"));
1280 closeTab
->setShortcut(Qt::CTRL
| Qt::Key_W
);
1281 closeTab
->setEnabled(false);
1282 connect(closeTab
, SIGNAL(triggered()), this, SLOT(closeTab()));
1284 KStandardAction::quit(this, SLOT(quit()), actionCollection());
1286 // setup 'Edit' menu
1287 KStandardAction::undo(this,
1289 actionCollection());
1291 // need to remove shift+del from cut action, else the shortcut for deletejob
1293 KAction
* cut
= KStandardAction::cut(this, SLOT(cut()), actionCollection());
1294 KShortcut cutShortcut
= cut
->shortcut();
1295 cutShortcut
.remove(Qt::SHIFT
| Qt::Key_Delete
, KShortcut::KeepEmpty
);
1296 cut
->setShortcut(cutShortcut
);
1297 KStandardAction::copy(this, SLOT(copy()), actionCollection());
1298 KAction
* paste
= KStandardAction::paste(this, SLOT(paste()), actionCollection());
1299 // The text of the paste-action is modified dynamically by Dolphin
1300 // (e. g. to "Paste One Folder"). To prevent that the size of the toolbar changes
1301 // due to the long text, the text "Paste" is used:
1302 paste
->setIconText(i18nc("@action:inmenu Edit", "Paste"));
1304 KStandardAction::find(this, SLOT(find()), actionCollection());
1306 KAction
* selectAll
= actionCollection()->addAction("select_all");
1307 selectAll
->setText(i18nc("@action:inmenu Edit", "Select All"));
1308 selectAll
->setShortcut(Qt::CTRL
| Qt::Key_A
);
1309 connect(selectAll
, SIGNAL(triggered()), this, SLOT(selectAll()));
1311 KAction
* invertSelection
= actionCollection()->addAction("invert_selection");
1312 invertSelection
->setText(i18nc("@action:inmenu Edit", "Invert Selection"));
1313 invertSelection
->setShortcut(Qt::CTRL
| Qt::SHIFT
| Qt::Key_A
);
1314 connect(invertSelection
, SIGNAL(triggered()), this, SLOT(invertSelection()));
1316 // setup 'View' menu
1317 // (note that most of it is set up in DolphinViewActionHandler)
1319 KAction
* split
= actionCollection()->addAction("split_view");
1320 split
->setShortcut(Qt::Key_F3
);
1321 connect(split
, SIGNAL(triggered()), this, SLOT(toggleSplitView()));
1323 KAction
* reload
= actionCollection()->addAction("reload");
1324 reload
->setText(i18nc("@action:inmenu View", "Reload"));
1325 reload
->setShortcut(Qt::Key_F5
);
1326 reload
->setIcon(KIcon("view-refresh"));
1327 connect(reload
, SIGNAL(triggered()), this, SLOT(reloadView()));
1329 KAction
* stop
= actionCollection()->addAction("stop");
1330 stop
->setText(i18nc("@action:inmenu View", "Stop"));
1331 stop
->setToolTip(i18nc("@info", "Stop loading"));
1332 stop
->setIcon(KIcon("process-stop"));
1333 connect(stop
, SIGNAL(triggered()), this, SLOT(stopLoading()));
1335 KToggleAction
* editableLocation
= actionCollection()->add
<KToggleAction
>("editable_location");
1336 editableLocation
->setText(i18nc("@action:inmenu Navigation Bar", "Editable Location"));
1337 editableLocation
->setShortcut(Qt::Key_F6
);
1338 connect(editableLocation
, SIGNAL(triggered()), this, SLOT(toggleEditLocation()));
1340 KAction
* replaceLocation
= actionCollection()->addAction("replace_location");
1341 replaceLocation
->setText(i18nc("@action:inmenu Navigation Bar", "Replace Location"));
1342 replaceLocation
->setShortcut(Qt::CTRL
| Qt::Key_L
);
1343 connect(replaceLocation
, SIGNAL(triggered()), this, SLOT(replaceLocation()));
1346 KAction
* backAction
= KStandardAction::back(this, SLOT(goBack()), actionCollection());
1347 connect(backAction
, SIGNAL(triggered(Qt::MouseButtons
,Qt::KeyboardModifiers
)), this, SLOT(goBack(Qt::MouseButtons
)));
1348 KShortcut backShortcut
= backAction
->shortcut();
1349 backShortcut
.setAlternate(Qt::Key_Backspace
);
1350 backAction
->setShortcut(backShortcut
);
1352 DolphinRecentTabsMenu
* recentTabsMenu
= new DolphinRecentTabsMenu(this);
1353 actionCollection()->addAction("closed_tabs", recentTabsMenu
);
1354 connect(this, SIGNAL(rememberClosedTab(KUrl
,KUrl
)),
1355 recentTabsMenu
, SLOT(rememberClosedTab(KUrl
,KUrl
)));
1356 connect(recentTabsMenu
, SIGNAL(restoreClosedTab(KUrl
,KUrl
)),
1357 this, SLOT(openNewActivatedTab(KUrl
,KUrl
)));
1358 connect(recentTabsMenu
, SIGNAL(closedTabsCountChanged(uint
)),
1359 this, SLOT(closedTabsCountChanged(uint
)));
1361 KAction
* undoCloseTab
= actionCollection()->addAction("undo_close_tab");
1362 undoCloseTab
->setText(i18nc("@action:inmenu File", "Undo close tab"));
1363 undoCloseTab
->setShortcut(Qt::CTRL
| Qt::SHIFT
| Qt::Key_T
);
1364 undoCloseTab
->setIcon(KIcon("edit-undo"));
1365 undoCloseTab
->setEnabled(false);
1366 connect(undoCloseTab
, SIGNAL(triggered()), recentTabsMenu
, SLOT(undoCloseTab()));
1368 KAction
* forwardAction
= KStandardAction::forward(this, SLOT(goForward()), actionCollection());
1369 connect(forwardAction
, SIGNAL(triggered(Qt::MouseButtons
,Qt::KeyboardModifiers
)), this, SLOT(goForward(Qt::MouseButtons
)));
1371 KAction
* upAction
= KStandardAction::up(this, SLOT(goUp()), actionCollection());
1372 connect(upAction
, SIGNAL(triggered(Qt::MouseButtons
,Qt::KeyboardModifiers
)), this, SLOT(goUp(Qt::MouseButtons
)));
1374 KAction
* homeAction
= KStandardAction::home(this, SLOT(goHome()), actionCollection());
1375 connect(homeAction
, SIGNAL(triggered(Qt::MouseButtons
,Qt::KeyboardModifiers
)), this, SLOT(goHome(Qt::MouseButtons
)));
1377 // setup 'Tools' menu
1378 KAction
* showFilterBar
= actionCollection()->addAction("show_filter_bar");
1379 showFilterBar
->setText(i18nc("@action:inmenu Tools", "Show Filter Bar"));
1380 showFilterBar
->setIcon(KIcon("view-filter"));
1381 showFilterBar
->setShortcut(Qt::CTRL
| Qt::Key_I
);
1382 connect(showFilterBar
, SIGNAL(triggered()), this, SLOT(showFilterBar()));
1384 KAction
* compareFiles
= actionCollection()->addAction("compare_files");
1385 compareFiles
->setText(i18nc("@action:inmenu Tools", "Compare Files"));
1386 compareFiles
->setIcon(KIcon("kompare"));
1387 compareFiles
->setEnabled(false);
1388 connect(compareFiles
, SIGNAL(triggered()), this, SLOT(compareFiles()));
1390 KAction
* openTerminal
= actionCollection()->addAction("open_terminal");
1391 openTerminal
->setText(i18nc("@action:inmenu Tools", "Open Terminal"));
1392 openTerminal
->setIcon(KIcon("utilities-terminal"));
1393 openTerminal
->setShortcut(Qt::SHIFT
| Qt::Key_F4
);
1394 connect(openTerminal
, SIGNAL(triggered()), this, SLOT(openTerminal()));
1396 // setup 'Settings' menu
1397 KToggleAction
* showMenuBar
= KStandardAction::showMenubar(0, 0, actionCollection());
1398 connect(showMenuBar
, SIGNAL(triggered(bool)), // Fixes #286822
1399 this, SLOT(toggleShowMenuBar()), Qt::QueuedConnection
);
1400 KStandardAction::preferences(this, SLOT(editSettings()), actionCollection());
1402 // not in menu actions
1403 QList
<QKeySequence
> nextTabKeys
;
1404 nextTabKeys
.append(KStandardShortcut::tabNext().primary());
1405 nextTabKeys
.append(QKeySequence(Qt::CTRL
| Qt::Key_Tab
));
1407 QList
<QKeySequence
> prevTabKeys
;
1408 prevTabKeys
.append(KStandardShortcut::tabPrev().primary());
1409 prevTabKeys
.append(QKeySequence(Qt::CTRL
| Qt::SHIFT
| Qt::Key_Tab
));
1411 KAction
* activateNextTab
= actionCollection()->addAction("activate_next_tab");
1412 activateNextTab
->setIconText(i18nc("@action:inmenu", "Next Tab"));
1413 activateNextTab
->setText(i18nc("@action:inmenu", "Activate Next Tab"));
1414 activateNextTab
->setEnabled(false);
1415 connect(activateNextTab
, SIGNAL(triggered()), SLOT(activateNextTab()));
1416 activateNextTab
->setShortcuts(QApplication::isRightToLeft() ? prevTabKeys
: nextTabKeys
);
1418 KAction
* activatePrevTab
= actionCollection()->addAction("activate_prev_tab");
1419 activatePrevTab
->setIconText(i18nc("@action:inmenu", "Previous Tab"));
1420 activatePrevTab
->setText(i18nc("@action:inmenu", "Activate Previous Tab"));
1421 activatePrevTab
->setEnabled(false);
1422 connect(activatePrevTab
, SIGNAL(triggered()), SLOT(activatePrevTab()));
1423 activatePrevTab
->setShortcuts(QApplication::isRightToLeft() ? nextTabKeys
: prevTabKeys
);
1426 KAction
* openInNewTab
= actionCollection()->addAction("open_in_new_tab");
1427 openInNewTab
->setText(i18nc("@action:inmenu", "Open in New Tab"));
1428 openInNewTab
->setIcon(KIcon("tab-new"));
1429 connect(openInNewTab
, SIGNAL(triggered()), this, SLOT(openInNewTab()));
1431 KAction
* openInNewTabs
= actionCollection()->addAction("open_in_new_tabs");
1432 openInNewTabs
->setText(i18nc("@action:inmenu", "Open in New Tabs"));
1433 openInNewTabs
->setIcon(KIcon("tab-new"));
1434 connect(openInNewTabs
, SIGNAL(triggered()), this, SLOT(openInNewTab()));
1436 KAction
* openInNewWindow
= actionCollection()->addAction("open_in_new_window");
1437 openInNewWindow
->setText(i18nc("@action:inmenu", "Open in New Window"));
1438 openInNewWindow
->setIcon(KIcon("window-new"));
1439 connect(openInNewWindow
, SIGNAL(triggered()), this, SLOT(openInNewWindow()));
1442 void DolphinMainWindow::setupDockWidgets()
1444 const bool lock
= GeneralSettings::lockPanels();
1446 KDualAction
* lockLayoutAction
= actionCollection()->add
<KDualAction
>("lock_panels");
1447 lockLayoutAction
->setActiveText(i18nc("@action:inmenu Panels", "Unlock Panels"));
1448 lockLayoutAction
->setActiveIcon(KIcon("object-unlocked"));
1449 lockLayoutAction
->setInactiveText(i18nc("@action:inmenu Panels", "Lock Panels"));
1450 lockLayoutAction
->setInactiveIcon(KIcon("object-locked"));
1451 lockLayoutAction
->setActive(lock
);
1452 connect(lockLayoutAction
, SIGNAL(triggered()), this, SLOT(togglePanelLockState()));
1454 // Setup "Information"
1455 DolphinDockWidget
* infoDock
= new DolphinDockWidget(i18nc("@title:window", "Information"));
1456 infoDock
->setLocked(lock
);
1457 infoDock
->setObjectName("infoDock");
1458 infoDock
->setAllowedAreas(Qt::LeftDockWidgetArea
| Qt::RightDockWidgetArea
);
1459 Panel
* infoPanel
= new InformationPanel(infoDock
);
1460 infoPanel
->setCustomContextMenuActions(QList
<QAction
*>() << lockLayoutAction
);
1461 connect(infoPanel
, SIGNAL(urlActivated(KUrl
)), this, SLOT(handleUrl(KUrl
)));
1462 infoDock
->setWidget(infoPanel
);
1464 QAction
* infoAction
= infoDock
->toggleViewAction();
1465 createPanelAction(KIcon("dialog-information"), Qt::Key_F11
, infoAction
, "show_information_panel");
1467 addDockWidget(Qt::RightDockWidgetArea
, infoDock
);
1468 connect(this, SIGNAL(urlChanged(KUrl
)),
1469 infoPanel
, SLOT(setUrl(KUrl
)));
1470 connect(this, SIGNAL(selectionChanged(KFileItemList
)),
1471 infoPanel
, SLOT(setSelection(KFileItemList
)));
1472 connect(this, SIGNAL(requestItemInfo(KFileItem
)),
1473 infoPanel
, SLOT(requestDelayedItemInfo(KFileItem
)));
1476 DolphinDockWidget
* foldersDock
= new DolphinDockWidget(i18nc("@title:window", "Folders"));
1477 foldersDock
->setLocked(lock
);
1478 foldersDock
->setObjectName("foldersDock");
1479 foldersDock
->setAllowedAreas(Qt::LeftDockWidgetArea
| Qt::RightDockWidgetArea
);
1480 FoldersPanel
* foldersPanel
= new FoldersPanel(foldersDock
);
1481 foldersPanel
->setCustomContextMenuActions(QList
<QAction
*>() << lockLayoutAction
);
1482 foldersDock
->setWidget(foldersPanel
);
1484 QAction
* foldersAction
= foldersDock
->toggleViewAction();
1485 createPanelAction(KIcon("folder"), Qt::Key_F7
, foldersAction
, "show_folders_panel");
1487 addDockWidget(Qt::LeftDockWidgetArea
, foldersDock
);
1488 connect(this, SIGNAL(urlChanged(KUrl
)),
1489 foldersPanel
, SLOT(setUrl(KUrl
)));
1490 connect(foldersPanel
, SIGNAL(folderActivated(KUrl
)),
1491 this, SLOT(changeUrl(KUrl
)));
1492 connect(foldersPanel
, SIGNAL(folderMiddleClicked(KUrl
)),
1493 this, SLOT(openNewTab(KUrl
)));
1494 connect(foldersPanel
, SIGNAL(errorMessage(QString
)),
1495 this, SLOT(slotPanelErrorMessage(QString
)));
1499 DolphinDockWidget
* terminalDock
= new DolphinDockWidget(i18nc("@title:window Shell terminal", "Terminal"));
1500 terminalDock
->setLocked(lock
);
1501 terminalDock
->setObjectName("terminalDock");
1502 terminalDock
->setAllowedAreas(Qt::TopDockWidgetArea
| Qt::BottomDockWidgetArea
);
1503 Panel
* terminalPanel
= new TerminalPanel(terminalDock
);
1504 terminalPanel
->setCustomContextMenuActions(QList
<QAction
*>() << lockLayoutAction
);
1505 terminalDock
->setWidget(terminalPanel
);
1507 connect(terminalPanel
, SIGNAL(hideTerminalPanel()), terminalDock
, SLOT(hide()));
1508 connect(terminalPanel
, SIGNAL(changeUrl(KUrl
)), this, SLOT(slotTerminalDirectoryChanged(KUrl
)));
1509 connect(terminalDock
, SIGNAL(visibilityChanged(bool)),
1510 terminalPanel
, SLOT(dockVisibilityChanged()));
1512 QAction
* terminalAction
= terminalDock
->toggleViewAction();
1513 createPanelAction(KIcon("utilities-terminal"), Qt::Key_F4
, terminalAction
, "show_terminal_panel");
1515 addDockWidget(Qt::BottomDockWidgetArea
, terminalDock
);
1516 connect(this, SIGNAL(urlChanged(KUrl
)),
1517 terminalPanel
, SLOT(setUrl(KUrl
)));
1520 if (GeneralSettings::version() < 200) {
1522 foldersDock
->hide();
1524 terminalDock
->hide();
1529 DolphinDockWidget
* placesDock
= new DolphinDockWidget(i18nc("@title:window", "Places"));
1530 placesDock
->setLocked(lock
);
1531 placesDock
->setObjectName("placesDock");
1532 placesDock
->setAllowedAreas(Qt::LeftDockWidgetArea
| Qt::RightDockWidgetArea
);
1534 PlacesPanel
* placesPanel
= new PlacesPanel(placesDock
);
1535 placesPanel
->setCustomContextMenuActions(QList
<QAction
*>() << lockLayoutAction
);
1536 placesDock
->setWidget(placesPanel
);
1538 QAction
* placesAction
= placesDock
->toggleViewAction();
1539 createPanelAction(KIcon("bookmarks"), Qt::Key_F9
, placesAction
, "show_places_panel");
1541 addDockWidget(Qt::LeftDockWidgetArea
, placesDock
);
1542 connect(placesPanel
, SIGNAL(placeActivated(KUrl
)),
1543 this, SLOT(slotPlaceActivated(KUrl
)));
1544 connect(placesPanel
, SIGNAL(placeMiddleClicked(KUrl
)),
1545 this, SLOT(openNewTab(KUrl
)));
1546 connect(placesPanel
, SIGNAL(errorMessage(QString
)),
1547 this, SLOT(slotPanelErrorMessage(QString
)));
1548 connect(this, SIGNAL(urlChanged(KUrl
)),
1549 placesPanel
, SLOT(setUrl(KUrl
)));
1550 connect(placesDock
, SIGNAL(visibilityChanged(bool)),
1551 this, SLOT(slotPlacesPanelVisibilityChanged(bool)));
1552 connect(this, SIGNAL(settingsChanged()),
1553 placesPanel
, SLOT(readSettings()));
1555 // Add actions into the "Panels" menu
1556 KActionMenu
* panelsMenu
= new KActionMenu(i18nc("@action:inmenu View", "Panels"), this);
1557 actionCollection()->addAction("panels", panelsMenu
);
1558 panelsMenu
->setDelayed(false);
1559 const KActionCollection
* ac
= actionCollection();
1560 panelsMenu
->addAction(ac
->action("show_places_panel"));
1561 panelsMenu
->addAction(ac
->action("show_information_panel"));
1562 panelsMenu
->addAction(ac
->action("show_folders_panel"));
1564 panelsMenu
->addAction(ac
->action("show_terminal_panel"));
1566 panelsMenu
->addSeparator();
1567 panelsMenu
->addAction(lockLayoutAction
);
1570 void DolphinMainWindow::updateEditActions()
1572 const KFileItemList list
= m_activeViewContainer
->view()->selectedItems();
1573 if (list
.isEmpty()) {
1574 stateChanged("has_no_selection");
1576 stateChanged("has_selection");
1578 KActionCollection
* col
= actionCollection();
1579 QAction
* renameAction
= col
->action("rename");
1580 QAction
* moveToTrashAction
= col
->action("move_to_trash");
1581 QAction
* deleteAction
= col
->action("delete");
1582 QAction
* cutAction
= col
->action(KStandardAction::name(KStandardAction::Cut
));
1583 QAction
* deleteWithTrashShortcut
= col
->action("delete_shortcut"); // see DolphinViewActionHandler
1585 KFileItemListProperties
capabilities(list
);
1586 const bool enableMoveToTrash
= capabilities
.isLocal() && capabilities
.supportsMoving();
1588 renameAction
->setEnabled(capabilities
.supportsMoving());
1589 moveToTrashAction
->setEnabled(enableMoveToTrash
);
1590 deleteAction
->setEnabled(capabilities
.supportsDeleting());
1591 deleteWithTrashShortcut
->setEnabled(capabilities
.supportsDeleting() && !enableMoveToTrash
);
1592 cutAction
->setEnabled(capabilities
.supportsMoving());
1596 void DolphinMainWindow::updateViewActions()
1598 m_actionHandler
->updateViewActions();
1600 QAction
* showFilterBarAction
= actionCollection()->action("show_filter_bar");
1601 showFilterBarAction
->setChecked(m_activeViewContainer
->isFilterBarVisible());
1603 updateSplitAction();
1605 QAction
* editableLocactionAction
= actionCollection()->action("editable_location");
1606 const KUrlNavigator
* urlNavigator
= m_activeViewContainer
->urlNavigator();
1607 editableLocactionAction
->setChecked(urlNavigator
->isUrlEditable());
1610 void DolphinMainWindow::updateGoActions()
1612 QAction
* goUpAction
= actionCollection()->action(KStandardAction::name(KStandardAction::Up
));
1613 const KUrl currentUrl
= m_activeViewContainer
->url();
1614 goUpAction
->setEnabled(currentUrl
.upUrl() != currentUrl
);
1617 void DolphinMainWindow::createControlButton()
1619 if (m_controlButton
) {
1622 Q_ASSERT(!m_controlButton
);
1624 m_controlButton
= new QToolButton(this);
1625 m_controlButton
->setIcon(KIcon("applications-system"));
1626 m_controlButton
->setText(i18nc("@action", "Control"));
1627 m_controlButton
->setPopupMode(QToolButton::InstantPopup
);
1628 m_controlButton
->setToolButtonStyle(toolBar()->toolButtonStyle());
1630 KMenu
* controlMenu
= new KMenu(m_controlButton
);
1631 connect(controlMenu
, SIGNAL(aboutToShow()), this, SLOT(updateControlMenu()));
1633 m_controlButton
->setMenu(controlMenu
);
1635 toolBar()->addWidget(m_controlButton
);
1636 connect(toolBar(), SIGNAL(iconSizeChanged(QSize
)),
1637 m_controlButton
, SLOT(setIconSize(QSize
)));
1638 connect(toolBar(), SIGNAL(toolButtonStyleChanged(Qt::ToolButtonStyle
)),
1639 m_controlButton
, SLOT(setToolButtonStyle(Qt::ToolButtonStyle
)));
1641 // The added widgets are owned by the toolbar and may get deleted when e.g. the toolbar
1642 // gets edited. In this case we must add them again. The adding is done asynchronously by
1643 // m_updateToolBarTimer.
1644 connect(m_controlButton
, SIGNAL(destroyed()), this, SLOT(slotControlButtonDeleted()));
1645 m_updateToolBarTimer
= new QTimer(this);
1646 m_updateToolBarTimer
->setInterval(500);
1647 connect(m_updateToolBarTimer
, SIGNAL(timeout()), this, SLOT(updateToolBar()));
1650 void DolphinMainWindow::deleteControlButton()
1652 delete m_controlButton
;
1653 m_controlButton
= 0;
1655 delete m_updateToolBarTimer
;
1656 m_updateToolBarTimer
= 0;
1659 bool DolphinMainWindow::addActionToMenu(QAction
* action
, KMenu
* menu
)
1664 const KToolBar
* toolBarWidget
= toolBar();
1665 foreach (const QWidget
* widget
, action
->associatedWidgets()) {
1666 if (widget
== toolBarWidget
) {
1671 menu
->addAction(action
);
1675 void DolphinMainWindow::refreshViews()
1677 foreach (DolphinTabPage
* tabPage
, m_viewTab
) {
1678 tabPage
->refreshViews();
1681 if (GeneralSettings::modifiedStartupSettings()) {
1682 // The startup settings have been changed by the user (see bug #254947).
1683 // Synchronize the split-view setting with the active view:
1684 const bool splitView
= GeneralSettings::splitView();
1685 m_viewTab
.at(m_tabIndex
)->setSplitViewEnabled(splitView
);
1686 updateSplitAction();
1689 emit
settingsChanged();
1692 void DolphinMainWindow::clearStatusBar()
1694 m_activeViewContainer
->statusBar()->resetToDefaultText();
1697 void DolphinMainWindow::connectViewSignals(DolphinViewContainer
* container
)
1699 connect(container
, SIGNAL(showFilterBarChanged(bool)),
1700 this, SLOT(updateFilterBarAction(bool)));
1701 connect(container
, SIGNAL(writeStateChanged(bool)),
1702 this, SLOT(slotWriteStateChanged(bool)));
1704 const DolphinView
* view
= container
->view();
1705 connect(view
, SIGNAL(selectionChanged(KFileItemList
)),
1706 this, SLOT(slotSelectionChanged(KFileItemList
)));
1707 connect(view
, SIGNAL(requestItemInfo(KFileItem
)),
1708 this, SLOT(slotRequestItemInfo(KFileItem
)));
1709 connect(view
, SIGNAL(tabRequested(KUrl
)),
1710 this, SLOT(openNewTab(KUrl
)));
1711 connect(view
, SIGNAL(requestContextMenu(QPoint
,KFileItem
,KUrl
,QList
<QAction
*>)),
1712 this, SLOT(openContextMenu(QPoint
,KFileItem
,KUrl
,QList
<QAction
*>)));
1713 connect(view
, SIGNAL(directoryLoadingStarted()),
1714 this, SLOT(enableStopAction()));
1715 connect(view
, SIGNAL(directoryLoadingCompleted()),
1716 this, SLOT(disableStopAction()));
1717 connect(view
, SIGNAL(goBackRequested()),
1718 this, SLOT(goBack()));
1719 connect(view
, SIGNAL(goForwardRequested()),
1720 this, SLOT(goForward()));
1722 const KUrlNavigator
* navigator
= container
->urlNavigator();
1723 connect(navigator
, SIGNAL(urlChanged(KUrl
)),
1724 this, SLOT(changeUrl(KUrl
)));
1725 connect(navigator
, SIGNAL(historyChanged()),
1726 this, SLOT(updateHistory()));
1727 connect(navigator
, SIGNAL(editableStateChanged(bool)),
1728 this, SLOT(slotEditableStateChanged(bool)));
1729 connect(navigator
, SIGNAL(tabRequested(KUrl
)),
1730 this, SLOT(openNewTab(KUrl
)));
1733 void DolphinMainWindow::updateSplitAction()
1735 QAction
* splitAction
= actionCollection()->action("split_view");
1736 const DolphinTabPage
* tabPage
= m_viewTab
.at(m_tabIndex
);
1737 if (tabPage
->splitViewEnabled()) {
1738 if (tabPage
->primaryViewActive()) {
1739 splitAction
->setText(i18nc("@action:intoolbar Close left view", "Close"));
1740 splitAction
->setToolTip(i18nc("@info", "Close left view"));
1741 splitAction
->setIcon(KIcon("view-left-close"));
1743 splitAction
->setText(i18nc("@action:intoolbar Close right view", "Close"));
1744 splitAction
->setToolTip(i18nc("@info", "Close right view"));
1745 splitAction
->setIcon(KIcon("view-right-close"));
1748 splitAction
->setText(i18nc("@action:intoolbar Split view", "Split"));
1749 splitAction
->setToolTip(i18nc("@info", "Split view"));
1750 splitAction
->setIcon(KIcon("view-right-new"));
1754 QString
DolphinMainWindow::tabName(const KUrl
& url
) const
1757 if (url
.equals(KUrl("file:///"))) {
1760 name
= url
.fileName();
1761 if (name
.isEmpty()) {
1762 name
= url
.protocol();
1764 // Make sure that a '&' inside the directory name is displayed correctly
1765 // and not misinterpreted as a keyboard shortcut in QTabBar::setTabText()
1766 name
.replace('&', "&&");
1772 bool DolphinMainWindow::isKompareInstalled() const
1774 static bool initialized
= false;
1775 static bool installed
= false;
1777 // TODO: maybe replace this approach later by using a menu
1778 // plugin like kdiff3plugin.cpp
1779 installed
= !KGlobal::dirs()->findExe("kompare").isEmpty();
1785 void DolphinMainWindow::setUrlAsCaption(const KUrl
& url
)
1788 if (!url
.isLocalFile()) {
1789 caption
.append(url
.protocol() + " - ");
1790 if (url
.hasHost()) {
1791 caption
.append(url
.host() + " - ");
1795 const QString fileName
= url
.fileName().isEmpty() ? "/" : url
.fileName();
1796 caption
.append(fileName
);
1798 setCaption(caption
);
1801 QString
DolphinMainWindow::squeezedText(const QString
& text
) const
1803 const QFontMetrics fm
= fontMetrics();
1804 return fm
.elidedText(text
, Qt::ElideMiddle
, fm
.maxWidth() * 10);
1807 void DolphinMainWindow::createPanelAction(const KIcon
& icon
,
1808 const QKeySequence
& shortcut
,
1809 QAction
* dockAction
,
1810 const QString
& actionName
)
1812 KAction
* panelAction
= actionCollection()->addAction(actionName
);
1813 panelAction
->setCheckable(true);
1814 panelAction
->setChecked(dockAction
->isChecked());
1815 panelAction
->setText(dockAction
->text());
1816 panelAction
->setIcon(icon
);
1817 panelAction
->setShortcut(shortcut
);
1819 connect(panelAction
, SIGNAL(triggered()), dockAction
, SLOT(trigger()));
1820 connect(dockAction
, SIGNAL(toggled(bool)), panelAction
, SLOT(setChecked(bool)));
1823 DolphinMainWindow::UndoUiInterface::UndoUiInterface() :
1824 KIO::FileUndoManager::UiInterface()
1828 DolphinMainWindow::UndoUiInterface::~UndoUiInterface()
1832 void DolphinMainWindow::UndoUiInterface::jobError(KIO::Job
* job
)
1834 DolphinMainWindow
* mainWin
= qobject_cast
<DolphinMainWindow
*>(parentWidget());
1836 DolphinViewContainer
* container
= mainWin
->activeViewContainer();
1837 container
->showMessage(job
->errorString(), DolphinViewContainer::Error
);
1839 KIO::FileUndoManager::UiInterface::jobError(job
);
1843 #include "dolphinmainwindow.moc"