1 /***************************************************************************
2 * Copyright (C) 2006 by Peter Penz <peter.penz@gmx.at> *
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-nepomuk.h>
26 #include "dolphinapplication.h"
27 #include "dolphincontextmenu.h"
28 #include "dolphinnewfilemenu.h"
29 #include "dolphinviewcontainer.h"
30 #include "mainwindowadaptor.h"
31 #include "panels/filter/filterpanel.h"
32 #include "panels/folders/folderspanel.h"
33 #include "panels/places/placespanel.h"
34 #include "panels/information/informationpanel.h"
35 #include "settings/dolphinsettings.h"
36 #include "settings/dolphinsettingsdialog.h"
37 #include "statusbar/dolphinstatusbar.h"
38 #include "views/dolphinviewactionhandler.h"
39 #include "views/dolphinremoteencoding.h"
40 #include "views/draganddrophelper.h"
41 #include "views/viewproperties.h"
44 #include "panels/terminal/terminalpanel.h"
47 #include "dolphin_generalsettings.h"
48 #include "dolphin_iconsmodesettings.h"
51 #include <kactioncollection.h>
52 #include <kactionmenu.h>
54 #include <kdesktopfile.h>
55 #include <kdeversion.h>
56 #include <kfiledialog.h>
57 #include <kfileplacesmodel.h>
59 #include <klineedit.h>
62 #include <kiconloader.h>
63 #include <kio/netaccess.h>
64 #include <kinputdialog.h>
66 #include <kprotocolmanager.h>
69 #include <kmessagebox.h>
70 #include <kfileitemlistproperties.h>
71 #include <konqmimedata.h>
72 #include <kprotocolinfo.h>
75 #include <kstandarddirs.h>
76 #include <kstatusbar.h>
77 #include <kstandardaction.h>
79 #include <ktoggleaction.h>
80 #include <kurlnavigator.h>
82 #include <kurlcombobox.h>
83 #include <ktoolinvocation.h>
85 #include <QDBusMessage>
89 #include <QDockWidget>
90 #include <kacceleratormanager.h>
93 * Remembers the tab configuration if a tab has been closed.
94 * Each closed tab can be restored by the menu
95 * "Go -> Recently Closed Tabs".
103 Q_DECLARE_METATYPE(ClosedTab
)
105 DolphinMainWindow::DolphinMainWindow(int id
) :
110 m_activeViewContainer(0),
111 m_centralWidgetLayout(0),
118 m_lastHandleUrlStatJob(0)
120 // Workaround for a X11-issue in combination with KModifierInfo
121 // (see DolphinContextMenu::initializeModifierKeyInfo() for
122 // more information):
123 DolphinContextMenu::initializeModifierKeyInfo();
125 setObjectName("Dolphin#");
127 m_viewTab
.append(ViewTab());
129 new MainWindowAdaptor(this);
130 QDBusConnection::sessionBus().registerObject(QString("/dolphin/MainWindow%1").arg(m_id
), this);
132 KIO::FileUndoManager
* undoManager
= KIO::FileUndoManager::self();
133 undoManager
->setUiInterface(new UndoUiInterface());
135 connect(undoManager
, SIGNAL(undoAvailable(bool)),
136 this, SLOT(slotUndoAvailable(bool)));
137 connect(undoManager
, SIGNAL(undoTextChanged(const QString
&)),
138 this, SLOT(slotUndoTextChanged(const QString
&)));
139 connect(undoManager
, SIGNAL(jobRecordingStarted(CommandType
)),
140 this, SLOT(clearStatusBar()));
141 connect(undoManager
, SIGNAL(jobRecordingFinished(CommandType
)),
142 this, SLOT(showCommand(CommandType
)));
143 connect(DolphinSettings::instance().placesModel(), SIGNAL(errorMessage(const QString
&)),
144 this, SLOT(showErrorMessage(const QString
&)));
145 connect(&DragAndDropHelper::instance(), SIGNAL(errorMessage(const QString
&)),
146 this, SLOT(showErrorMessage(const QString
&)));
149 DolphinMainWindow::~DolphinMainWindow()
151 DolphinApplication::app()->removeMainWindow(this);
154 void DolphinMainWindow::openDirectories(const QList
<KUrl
>& dirs
)
156 if (dirs
.isEmpty()) {
160 const int oldOpenTabsCount
= m_viewTab
.count();
162 const GeneralSettings
* generalSettings
= DolphinSettings::instance().generalSettings();
163 const bool hasSplitView
= generalSettings
->splitView();
165 // Open each directory inside a new tab. If the "split view" option has been enabled,
166 // always show two directories within one tab.
167 QList
<KUrl
>::const_iterator it
= dirs
.begin();
168 while (it
!= dirs
.end()) {
172 if (hasSplitView
&& (it
!= dirs
.end())) {
173 const int tabIndex
= m_viewTab
.count() - 1;
174 m_viewTab
[tabIndex
].secondaryView
->setUrl(*it
);
179 // remove the previously opened tabs
180 for (int i
= 0; i
< oldOpenTabsCount
; ++i
) {
185 void DolphinMainWindow::openFiles(const QList
<KUrl
>& files
)
187 if (files
.isEmpty()) {
191 // Get all distinct directories from 'files' and open a tab
192 // for each directory. If the "split view" option is enabled, two
193 // directories are shown inside one tab (see openDirectories()).
195 foreach (const KUrl
& url
, files
) {
196 const KUrl
dir(url
.directory());
197 if (!dirs
.contains(dir
)) {
202 openDirectories(dirs
);
204 // Select the files. Although the files can be split between several
205 // tabs, there is no need to split 'files' accordingly, as
206 // the DolphinView will just ignore invalid selections.
207 const int tabCount
= m_viewTab
.count();
208 for (int i
= 0; i
< tabCount
; ++i
) {
209 m_viewTab
[i
].primaryView
->view()->markUrlsAsSelected(files
);
210 if (m_viewTab
[i
].secondaryView
!= 0) {
211 m_viewTab
[i
].secondaryView
->view()->markUrlsAsSelected(files
);
216 void DolphinMainWindow::toggleViews()
218 if (m_viewTab
[m_tabIndex
].primaryView
== 0) {
222 // move secondary view from the last position of the splitter
223 // to the first position
224 m_viewTab
[m_tabIndex
].splitter
->insertWidget(0, m_viewTab
[m_tabIndex
].secondaryView
);
226 DolphinViewContainer
* container
= m_viewTab
[m_tabIndex
].primaryView
;
227 m_viewTab
[m_tabIndex
].primaryView
= m_viewTab
[m_tabIndex
].secondaryView
;
228 m_viewTab
[m_tabIndex
].secondaryView
= container
;
231 void DolphinMainWindow::showCommand(CommandType command
)
233 DolphinStatusBar
* statusBar
= m_activeViewContainer
->statusBar();
235 case KIO::FileUndoManager::Copy
:
236 statusBar
->setMessage(i18nc("@info:status", "Successfully copied."),
237 DolphinStatusBar::OperationCompleted
);
239 case KIO::FileUndoManager::Move
:
240 statusBar
->setMessage(i18nc("@info:status", "Successfully moved."),
241 DolphinStatusBar::OperationCompleted
);
243 case KIO::FileUndoManager::Link
:
244 statusBar
->setMessage(i18nc("@info:status", "Successfully linked."),
245 DolphinStatusBar::OperationCompleted
);
247 case KIO::FileUndoManager::Trash
:
248 statusBar
->setMessage(i18nc("@info:status", "Successfully moved to trash."),
249 DolphinStatusBar::OperationCompleted
);
251 case KIO::FileUndoManager::Rename
:
252 statusBar
->setMessage(i18nc("@info:status", "Successfully renamed."),
253 DolphinStatusBar::OperationCompleted
);
256 case KIO::FileUndoManager::Mkdir
:
257 statusBar
->setMessage(i18nc("@info:status", "Created folder."),
258 DolphinStatusBar::OperationCompleted
);
266 void DolphinMainWindow::refreshViews()
268 Q_ASSERT(m_viewTab
[m_tabIndex
].primaryView
!= 0);
270 // remember the current active view, as because of
271 // the refreshing the active view might change to
272 // the secondary view
273 DolphinViewContainer
* activeViewContainer
= m_activeViewContainer
;
275 const int tabCount
= m_viewTab
.count();
276 for (int i
= 0; i
< tabCount
; ++i
) {
277 m_viewTab
[i
].primaryView
->refresh();
278 if (m_viewTab
[i
].secondaryView
!= 0) {
279 m_viewTab
[i
].secondaryView
->refresh();
283 setActiveViewContainer(activeViewContainer
);
286 void DolphinMainWindow::pasteIntoFolder()
288 m_activeViewContainer
->view()->pasteIntoFolder();
291 void DolphinMainWindow::changeUrl(const KUrl
& url
)
293 if (!KProtocolManager::supportsListing(url
)) {
294 // The URL navigator only checks for validity, not
295 // if the URL can be listed. An error message is
296 // shown due to DolphinViewContainer::restoreView().
300 DolphinViewContainer
* view
= activeViewContainer();
306 setUrlAsCaption(url
);
307 if (m_viewTab
.count() > 1) {
308 m_tabBar
->setTabText(m_tabIndex
, squeezedText(tabName(m_activeViewContainer
->url())));
310 const QString iconName
= KMimeType::iconNameForUrl(url
);
311 m_tabBar
->setTabIcon(m_tabIndex
, KIcon(iconName
));
312 emit
urlChanged(url
);
316 void DolphinMainWindow::slotEditableStateChanged(bool editable
)
318 KToggleAction
* editableLocationAction
=
319 static_cast<KToggleAction
*>(actionCollection()->action("editable_location"));
320 editableLocationAction
->setChecked(editable
);
323 void DolphinMainWindow::slotSelectionChanged(const KFileItemList
& selection
)
327 Q_ASSERT(m_viewTab
[m_tabIndex
].primaryView
!= 0);
328 int selectedUrlsCount
= m_viewTab
[m_tabIndex
].primaryView
->view()->selectedItemsCount();
329 if (m_viewTab
[m_tabIndex
].secondaryView
!= 0) {
330 selectedUrlsCount
+= m_viewTab
[m_tabIndex
].secondaryView
->view()->selectedItemsCount();
333 QAction
* compareFilesAction
= actionCollection()->action("compare_files");
334 if (selectedUrlsCount
== 2) {
335 compareFilesAction
->setEnabled(isKompareInstalled());
337 compareFilesAction
->setEnabled(false);
340 emit
selectionChanged(selection
);
343 void DolphinMainWindow::slotRequestItemInfo(const KFileItem
& item
)
345 emit
requestItemInfo(item
);
348 void DolphinMainWindow::updateHistory()
350 const KUrlNavigator
* urlNavigator
= m_activeViewContainer
->urlNavigator();
351 const int index
= urlNavigator
->historyIndex();
353 QAction
* backAction
= actionCollection()->action("go_back");
354 backAction
->setToolTip(i18nc("@info", "Go back"));
355 if (backAction
!= 0) {
356 backAction
->setEnabled(index
< urlNavigator
->historySize() - 1);
359 QAction
* forwardAction
= actionCollection()->action("go_forward");
360 forwardAction
->setToolTip(i18nc("@info", "Go forward"));
361 if (forwardAction
!= 0) {
362 forwardAction
->setEnabled(index
> 0);
366 void DolphinMainWindow::updateFilterBarAction(bool show
)
368 QAction
* showFilterBarAction
= actionCollection()->action("show_filter_bar");
369 showFilterBarAction
->setChecked(show
);
372 void DolphinMainWindow::openNewMainWindow()
374 DolphinApplication::app()->createMainWindow()->show();
377 void DolphinMainWindow::openNewTab()
379 const bool isUrlEditable
= m_activeViewContainer
->urlNavigator()->isUrlEditable();
381 openNewTab(m_activeViewContainer
->url());
382 m_tabBar
->setCurrentIndex(m_viewTab
.count() - 1);
384 // The URL navigator of the new tab should have the same editable state
385 // as the current tab
386 KUrlNavigator
* navigator
= m_activeViewContainer
->urlNavigator();
387 navigator
->setUrlEditable(isUrlEditable
);
390 // If a new tab is opened and the URL is editable, assure that
391 // the user can edit the URL without manually setting the focus
392 navigator
->setFocus();
396 void DolphinMainWindow::openNewTab(const KUrl
& url
)
398 QWidget
* focusWidget
= QApplication::focusWidget();
400 if (m_viewTab
.count() == 1) {
401 // Only one view is open currently and hence no tab is shown at
402 // all. Before creating a tab for 'url', provide a tab for the current URL.
403 const KUrl currentUrl
= m_activeViewContainer
->url();
404 m_tabBar
->addTab(KIcon(KMimeType::iconNameForUrl(currentUrl
)),
405 squeezedText(tabName(currentUrl
)));
406 m_tabBar
->blockSignals(false);
409 m_tabBar
->addTab(KIcon(KMimeType::iconNameForUrl(url
)),
410 squeezedText(tabName(url
)));
413 viewTab
.splitter
= new QSplitter(this);
414 viewTab
.splitter
->setChildrenCollapsible(false);
415 viewTab
.primaryView
= new DolphinViewContainer(url
, viewTab
.splitter
);
416 viewTab
.primaryView
->setActive(false);
417 connectViewSignals(viewTab
.primaryView
);
418 viewTab
.primaryView
->view()->reload();
420 m_viewTab
.append(viewTab
);
422 actionCollection()->action("close_tab")->setEnabled(true);
424 // provide a split view, if the startup settings are set this way
425 const GeneralSettings
* generalSettings
= DolphinSettings::instance().generalSettings();
426 if (generalSettings
->splitView()) {
427 const int tabIndex
= m_viewTab
.count() - 1;
428 createSecondaryView(tabIndex
);
429 m_viewTab
[tabIndex
].secondaryView
->setActive(true);
430 m_viewTab
[tabIndex
].isPrimaryViewActive
= false;
433 if (focusWidget
!= 0) {
434 // The DolphinViewContainer grabbed the keyboard focus. As the tab is opened
435 // in background, assure that the previous focused widget gets the focus back.
436 focusWidget
->setFocus();
440 void DolphinMainWindow::activateNextTab()
442 if ((m_viewTab
.count() == 1) || (m_tabBar
->count() < 2)) {
446 const int tabIndex
= (m_tabBar
->currentIndex() + 1) % m_tabBar
->count();
447 m_tabBar
->setCurrentIndex(tabIndex
);
450 void DolphinMainWindow::activatePrevTab()
452 if ((m_viewTab
.count() == 1) || (m_tabBar
->count() < 2)) {
456 int tabIndex
= m_tabBar
->currentIndex() - 1;
457 if (tabIndex
== -1) {
458 tabIndex
= m_tabBar
->count() - 1;
460 m_tabBar
->setCurrentIndex(tabIndex
);
463 void DolphinMainWindow::openInNewTab()
465 const KFileItemList list
= m_activeViewContainer
->view()->selectedItems();
466 if (list
.isEmpty()) {
467 openNewTab(m_activeViewContainer
->url());
468 } else if ((list
.count() == 1) && list
[0].isDir()) {
469 openNewTab(list
[0].url());
473 void DolphinMainWindow::openInNewWindow()
477 const KFileItemList list
= m_activeViewContainer
->view()->selectedItems();
478 if (list
.isEmpty()) {
479 newWindowUrl
= m_activeViewContainer
->url();
480 } else if ((list
.count() == 1) && list
[0].isDir()) {
481 newWindowUrl
= list
[0].url();
484 if (!newWindowUrl
.isEmpty()) {
485 DolphinMainWindow
* window
= DolphinApplication::app()->createMainWindow();
486 window
->changeUrl(newWindowUrl
);
491 void DolphinMainWindow::toggleActiveView()
493 if (m_viewTab
[m_tabIndex
].secondaryView
== 0) {
494 // only one view is available
498 Q_ASSERT(m_activeViewContainer
!= 0);
499 Q_ASSERT(m_viewTab
[m_tabIndex
].primaryView
!= 0);
501 DolphinViewContainer
* left
= m_viewTab
[m_tabIndex
].primaryView
;
502 DolphinViewContainer
* right
= m_viewTab
[m_tabIndex
].secondaryView
;
503 setActiveViewContainer(m_activeViewContainer
== right
? left
: right
);
506 void DolphinMainWindow::showEvent(QShowEvent
* event
)
508 KXmlGuiWindow::showEvent(event
);
509 if (!event
->spontaneous()) {
510 m_activeViewContainer
->view()->setFocus();
514 void DolphinMainWindow::closeEvent(QCloseEvent
* event
)
516 DolphinSettings
& settings
= DolphinSettings::instance();
517 GeneralSettings
* generalSettings
= settings
.generalSettings();
519 // Find out if Dolphin is closed directly by the user or
520 // by the session manager because the session is closed
521 bool closedByUser
= true;
522 DolphinApplication
*application
= qobject_cast
<DolphinApplication
*>(qApp
);
523 if (application
&& application
->sessionSaving()) {
524 closedByUser
= false;
527 if ((m_viewTab
.count() > 1) && generalSettings
->confirmClosingMultipleTabs() && closedByUser
) {
528 // Ask the user if he really wants to quit and close all tabs.
529 // Open a confirmation dialog with 3 buttons:
530 // KDialog::Yes -> Quit
531 // KDialog::No -> Close only the current tab
532 // KDialog::Cancel -> do nothing
533 KDialog
*dialog
= new KDialog(this, Qt::Dialog
);
534 dialog
->setCaption(i18nc("@title:window", "Confirmation"));
535 dialog
->setButtons(KDialog::Yes
| KDialog::No
| KDialog::Cancel
);
536 dialog
->setModal(true);
537 dialog
->setButtonGuiItem(KDialog::Yes
, KStandardGuiItem::quit());
538 dialog
->setButtonGuiItem(KDialog::No
, KGuiItem(i18n("C&lose Current Tab"), KIcon("tab-close")));
539 dialog
->setButtonGuiItem(KDialog::Cancel
, KStandardGuiItem::cancel());
540 dialog
->setDefaultButton(KDialog::Yes
);
542 bool doNotAskAgainCheckboxResult
= false;
544 const int result
= KMessageBox::createKMessageBox(dialog
,
545 QMessageBox::Warning
,
546 i18n("You have multiple tabs open in this window, are you sure you want to quit?"),
548 i18n("Do not ask again"),
549 &doNotAskAgainCheckboxResult
,
550 KMessageBox::Notify
);
552 if (doNotAskAgainCheckboxResult
) {
553 generalSettings
->setConfirmClosingMultipleTabs(false);
561 // Close only the current tab
569 generalSettings
->setFirstRun(false);
573 KXmlGuiWindow::closeEvent(event
);
576 void DolphinMainWindow::saveProperties(KConfigGroup
& group
)
578 const int tabCount
= m_viewTab
.count();
579 group
.writeEntry("Tab Count", tabCount
);
580 group
.writeEntry("Active Tab Index", m_tabBar
->currentIndex());
582 for (int i
= 0; i
< tabCount
; ++i
) {
583 const DolphinViewContainer
* cont
= m_viewTab
[i
].primaryView
;
584 group
.writeEntry(tabProperty("Primary URL", i
), cont
->url().url());
585 group
.writeEntry(tabProperty("Primary Editable", i
),
586 cont
->urlNavigator()->isUrlEditable());
588 cont
= m_viewTab
[i
].secondaryView
;
590 group
.writeEntry(tabProperty("Secondary URL", i
), cont
->url().url());
591 group
.writeEntry(tabProperty("Secondary Editable", i
),
592 cont
->urlNavigator()->isUrlEditable());
597 void DolphinMainWindow::readProperties(const KConfigGroup
& group
)
599 const int tabCount
= group
.readEntry("Tab Count", 1);
600 for (int i
= 0; i
< tabCount
; ++i
) {
601 DolphinViewContainer
* cont
= m_viewTab
[i
].primaryView
;
603 cont
->setUrl(group
.readEntry(tabProperty("Primary URL", i
)));
604 const bool editable
= group
.readEntry(tabProperty("Primary Editable", i
), false);
605 cont
->urlNavigator()->setUrlEditable(editable
);
607 cont
= m_viewTab
[i
].secondaryView
;
608 const QString secondaryUrl
= group
.readEntry(tabProperty("Secondary URL", i
));
609 if (!secondaryUrl
.isEmpty()) {
611 // a secondary view should be shown, but no one is available
612 // currently -> create a new view
614 cont
= m_viewTab
[i
].secondaryView
;
618 cont
->setUrl(secondaryUrl
);
619 const bool editable
= group
.readEntry(tabProperty("Secondary Editable", i
), false);
620 cont
->urlNavigator()->setUrlEditable(editable
);
621 } else if (cont
!= 0) {
622 // no secondary view should be shown, but the default setting shows
623 // one already -> close the view
627 // openNewTab() needs to be called only tabCount - 1 times
628 if (i
!= tabCount
- 1) {
633 const int index
= group
.readEntry("Active Tab Index", 0);
634 m_tabBar
->setCurrentIndex(index
);
637 void DolphinMainWindow::updateNewMenu()
639 m_newFileMenu
->setViewShowsHiddenFiles(activeViewContainer()->view()->showHiddenFiles());
640 m_newFileMenu
->checkUpToDate();
641 m_newFileMenu
->setPopupFiles(activeViewContainer()->url());
644 void DolphinMainWindow::createDirectory()
646 m_newFileMenu
->setViewShowsHiddenFiles(activeViewContainer()->view()->showHiddenFiles());
647 m_newFileMenu
->setPopupFiles(activeViewContainer()->url());
648 m_newFileMenu
->createDirectory();
651 void DolphinMainWindow::quit()
656 void DolphinMainWindow::showErrorMessage(const QString
& message
)
658 if (!message
.isEmpty()) {
659 DolphinStatusBar
* statusBar
= m_activeViewContainer
->statusBar();
660 statusBar
->setMessage(message
, DolphinStatusBar::Error
);
664 void DolphinMainWindow::slotUndoAvailable(bool available
)
666 QAction
* undoAction
= actionCollection()->action(KStandardAction::name(KStandardAction::Undo
));
667 if (undoAction
!= 0) {
668 undoAction
->setEnabled(available
);
672 void DolphinMainWindow::restoreClosedTab(QAction
* action
)
674 if (action
->data().toBool()) {
675 // clear all actions except the "Empty Recently Closed Tabs"
676 // action and the separator
677 QList
<QAction
*> actions
= m_recentTabsMenu
->menu()->actions();
678 const int count
= actions
.size();
679 for (int i
= 2; i
< count
; ++i
) {
680 m_recentTabsMenu
->menu()->removeAction(actions
.at(i
));
683 const ClosedTab closedTab
= action
->data().value
<ClosedTab
>();
684 openNewTab(closedTab
.primaryUrl
);
685 m_tabBar
->setCurrentIndex(m_viewTab
.count() - 1);
687 if (closedTab
.isSplit
) {
688 // create secondary view
690 m_viewTab
[m_tabIndex
].secondaryView
->setUrl(closedTab
.secondaryUrl
);
693 m_recentTabsMenu
->removeAction(action
);
696 if (m_recentTabsMenu
->menu()->actions().count() == 2) {
697 m_recentTabsMenu
->setEnabled(false);
701 void DolphinMainWindow::slotUndoTextChanged(const QString
& text
)
703 QAction
* undoAction
= actionCollection()->action(KStandardAction::name(KStandardAction::Undo
));
704 if (undoAction
!= 0) {
705 undoAction
->setText(text
);
709 void DolphinMainWindow::undo()
712 KIO::FileUndoManager::self()->uiInterface()->setParentWidget(this);
713 KIO::FileUndoManager::self()->undo();
716 void DolphinMainWindow::cut()
718 m_activeViewContainer
->view()->cutSelectedItems();
721 void DolphinMainWindow::copy()
723 m_activeViewContainer
->view()->copySelectedItems();
726 void DolphinMainWindow::paste()
728 m_activeViewContainer
->view()->paste();
731 void DolphinMainWindow::find()
733 m_activeViewContainer
->setSearchModeEnabled(true);
736 void DolphinMainWindow::updatePasteAction()
738 QAction
* pasteAction
= actionCollection()->action(KStandardAction::name(KStandardAction::Paste
));
739 QPair
<bool, QString
> pasteInfo
= m_activeViewContainer
->view()->pasteInfo();
740 pasteAction
->setEnabled(pasteInfo
.first
);
741 pasteAction
->setText(pasteInfo
.second
);
744 void DolphinMainWindow::selectAll()
748 // if the URL navigator is editable and focused, select the whole
749 // URL instead of all items of the view
751 KUrlNavigator
* urlNavigator
= m_activeViewContainer
->urlNavigator();
752 QLineEdit
* lineEdit
= urlNavigator
->editor()->lineEdit(); // krazy:exclude=qclasses
753 const bool selectUrl
= urlNavigator
->isUrlEditable() &&
754 lineEdit
->hasFocus();
756 lineEdit
->selectAll();
758 m_activeViewContainer
->view()->selectAll();
762 void DolphinMainWindow::invertSelection()
765 m_activeViewContainer
->view()->invertSelection();
768 void DolphinMainWindow::toggleSplitView()
770 if (m_viewTab
[m_tabIndex
].secondaryView
== 0) {
771 createSecondaryView(m_tabIndex
);
772 setActiveViewContainer(m_viewTab
[m_tabIndex
].secondaryView
);
773 } else if (m_activeViewContainer
== m_viewTab
[m_tabIndex
].secondaryView
) {
774 // remove secondary view
775 m_viewTab
[m_tabIndex
].secondaryView
->close();
776 m_viewTab
[m_tabIndex
].secondaryView
->deleteLater();
777 m_viewTab
[m_tabIndex
].secondaryView
= 0;
779 setActiveViewContainer(m_viewTab
[m_tabIndex
].primaryView
);
781 // The primary view is active and should be closed. Hence from a users point of view
782 // the content of the secondary view should be moved to the primary view.
783 // From an implementation point of view it is more efficient to close
784 // the primary view and exchange the internal pointers afterwards.
786 m_viewTab
[m_tabIndex
].primaryView
->close();
787 m_viewTab
[m_tabIndex
].primaryView
->deleteLater();
788 m_viewTab
[m_tabIndex
].primaryView
= m_viewTab
[m_tabIndex
].secondaryView
;
789 m_viewTab
[m_tabIndex
].secondaryView
= 0;
791 setActiveViewContainer(m_viewTab
[m_tabIndex
].primaryView
);
797 void DolphinMainWindow::reloadView()
800 m_activeViewContainer
->view()->reload();
803 void DolphinMainWindow::stopLoading()
805 m_activeViewContainer
->view()->stopLoading();
808 void DolphinMainWindow::enableStopAction()
810 actionCollection()->action("stop")->setEnabled(true);
813 void DolphinMainWindow::disableStopAction()
815 actionCollection()->action("stop")->setEnabled(false);
818 void DolphinMainWindow::toggleFilterBarVisibility(bool show
)
820 m_activeViewContainer
->showFilterBar(show
);
823 void DolphinMainWindow::toggleEditLocation()
827 QAction
* action
= actionCollection()->action("editable_location");
828 KUrlNavigator
* urlNavigator
= m_activeViewContainer
->urlNavigator();
829 urlNavigator
->setUrlEditable(action
->isChecked());
832 void DolphinMainWindow::replaceLocation()
834 KUrlNavigator
* navigator
= m_activeViewContainer
->urlNavigator();
835 navigator
->setUrlEditable(true);
836 navigator
->setFocus();
838 // select the whole text of the combo box editor
839 QLineEdit
* lineEdit
= navigator
->editor()->lineEdit(); // krazy:exclude=qclasses
840 const QString text
= lineEdit
->text();
841 lineEdit
->setSelection(0, text
.length());
844 void DolphinMainWindow::goBack()
848 KUrlNavigator
* urlNavigator
= m_activeViewContainer
->urlNavigator();
849 urlNavigator
->goBack();
851 if (urlNavigator
->locationState().isEmpty()) {
852 // An empty location state indicates a redirection URL,
853 // which must be skipped too
854 urlNavigator
->goBack();
858 void DolphinMainWindow::goForward()
861 m_activeViewContainer
->urlNavigator()->goForward();
864 void DolphinMainWindow::goUp()
867 m_activeViewContainer
->urlNavigator()->goUp();
870 void DolphinMainWindow::goBack(Qt::MouseButtons buttons
)
872 // The default case (left button pressed) is handled in goBack().
873 if (buttons
== Qt::MidButton
) {
874 KUrlNavigator
* urlNavigator
= activeViewContainer()->urlNavigator();
875 const int index
= urlNavigator
->historyIndex() + 1;
876 openNewTab(urlNavigator
->locationUrl(index
));
880 void DolphinMainWindow::goForward(Qt::MouseButtons buttons
)
882 // The default case (left button pressed) is handled in goForward().
883 if (buttons
== Qt::MidButton
) {
884 KUrlNavigator
* urlNavigator
= activeViewContainer()->urlNavigator();
885 const int index
= urlNavigator
->historyIndex() - 1;
886 openNewTab(urlNavigator
->locationUrl(index
));
890 void DolphinMainWindow::goUp(Qt::MouseButtons buttons
)
892 // The default case (left button pressed) is handled in goUp().
893 if (buttons
== Qt::MidButton
) {
894 openNewTab(activeViewContainer()->url().upUrl());
898 void DolphinMainWindow::goHome()
901 m_activeViewContainer
->urlNavigator()->goHome();
904 void DolphinMainWindow::compareFiles()
906 // The method is only invoked if exactly 2 files have
907 // been selected. The selected files may be:
908 // - both in the primary view
909 // - both in the secondary view
910 // - one in the primary view and the other in the secondary
912 Q_ASSERT(m_viewTab
[m_tabIndex
].primaryView
!= 0);
917 KFileItemList items
= m_viewTab
[m_tabIndex
].primaryView
->view()->selectedItems();
919 switch (items
.count()) {
921 Q_ASSERT(m_viewTab
[m_tabIndex
].secondaryView
!= 0);
922 items
= m_viewTab
[m_tabIndex
].secondaryView
->view()->selectedItems();
923 Q_ASSERT(items
.count() == 2);
924 urlA
= items
[0].url();
925 urlB
= items
[1].url();
930 urlA
= items
[0].url();
931 Q_ASSERT(m_viewTab
[m_tabIndex
].secondaryView
!= 0);
932 items
= m_viewTab
[m_tabIndex
].secondaryView
->view()->selectedItems();
933 Q_ASSERT(items
.count() == 1);
934 urlB
= items
[0].url();
939 urlA
= items
[0].url();
940 urlB
= items
[1].url();
945 // may not happen: compareFiles may only get invoked if 2
946 // files are selected
951 QString
command("kompare -c \"");
952 command
.append(urlA
.pathOrUrl());
953 command
.append("\" \"");
954 command
.append(urlB
.pathOrUrl());
955 command
.append('\"');
956 KRun::runCommand(command
, "Kompare", "kompare", this);
959 void DolphinMainWindow::toggleShowMenuBar()
961 const bool visible
= menuBar()->isVisible();
962 menuBar()->setVisible(!visible
);
965 void DolphinMainWindow::openTerminal()
967 QString
dir(QDir::homePath());
969 // If the given directory is not local, it can still be the URL of an
970 // ioslave using UDS_LOCAL_PATH which to be converted first.
971 KUrl url
= KIO::NetAccess::mostLocalUrl(m_activeViewContainer
->url(), this);
973 //If the URL is local after the above conversion, set the directory.
974 if (url
.isLocalFile()) {
975 dir
= url
.toLocalFile();
978 KToolInvocation::invokeTerminal(QString(), dir
);
981 void DolphinMainWindow::editSettings()
983 if (m_settingsDialog
== 0) {
984 const KUrl url
= activeViewContainer()->url();
985 m_settingsDialog
= new DolphinSettingsDialog(url
, this);
986 m_settingsDialog
->setAttribute(Qt::WA_DeleteOnClose
);
987 m_settingsDialog
->show();
989 m_settingsDialog
->raise();
993 void DolphinMainWindow::setActiveTab(int index
)
995 Q_ASSERT(index
>= 0);
996 Q_ASSERT(index
< m_viewTab
.count());
997 if (index
== m_tabIndex
) {
1001 // hide current tab content
1002 ViewTab
& hiddenTab
= m_viewTab
[m_tabIndex
];
1003 hiddenTab
.isPrimaryViewActive
= hiddenTab
.primaryView
->isActive();
1004 hiddenTab
.primaryView
->setActive(false);
1005 if (hiddenTab
.secondaryView
!= 0) {
1006 hiddenTab
.secondaryView
->setActive(false);
1008 QSplitter
* splitter
= m_viewTab
[m_tabIndex
].splitter
;
1010 m_centralWidgetLayout
->removeWidget(splitter
);
1012 // show active tab content
1015 ViewTab
& viewTab
= m_viewTab
[index
];
1016 m_centralWidgetLayout
->addWidget(viewTab
.splitter
, 1);
1017 viewTab
.primaryView
->show();
1018 if (viewTab
.secondaryView
!= 0) {
1019 viewTab
.secondaryView
->show();
1021 viewTab
.splitter
->show();
1023 setActiveViewContainer(viewTab
.isPrimaryViewActive
? viewTab
.primaryView
:
1024 viewTab
.secondaryView
);
1027 void DolphinMainWindow::closeTab()
1029 closeTab(m_tabBar
->currentIndex());
1032 void DolphinMainWindow::closeTab(int index
)
1034 Q_ASSERT(index
>= 0);
1035 Q_ASSERT(index
< m_viewTab
.count());
1036 if (m_viewTab
.count() == 1) {
1037 // the last tab may never get closed
1041 if (index
== m_tabIndex
) {
1042 // The tab that should be closed is the active tab. Activate the
1043 // previous tab before closing the tab.
1044 m_tabBar
->setCurrentIndex((index
> 0) ? index
- 1 : 1);
1046 rememberClosedTab(index
);
1049 m_viewTab
[index
].primaryView
->deleteLater();
1050 if (m_viewTab
[index
].secondaryView
!= 0) {
1051 m_viewTab
[index
].secondaryView
->deleteLater();
1053 m_viewTab
[index
].splitter
->deleteLater();
1054 m_viewTab
.erase(m_viewTab
.begin() + index
);
1056 m_tabBar
->blockSignals(true);
1057 m_tabBar
->removeTab(index
);
1059 if (m_tabIndex
> index
) {
1061 Q_ASSERT(m_tabIndex
>= 0);
1064 // if only one tab is left, also remove the tab entry so that
1065 // closing the last tab is not possible
1066 if (m_viewTab
.count() == 1) {
1067 m_tabBar
->removeTab(0);
1068 actionCollection()->action("close_tab")->setEnabled(false);
1070 m_tabBar
->blockSignals(false);
1074 void DolphinMainWindow::openTabContextMenu(int index
, const QPoint
& pos
)
1078 QAction
* newTabAction
= menu
.addAction(KIcon("tab-new"), i18nc("@action:inmenu", "New Tab"));
1079 newTabAction
->setShortcut(actionCollection()->action("new_tab")->shortcut());
1081 QAction
* detachTabAction
= menu
.addAction(KIcon("tab-detach"), i18nc("@action:inmenu", "Detach Tab"));
1083 QAction
* closeOtherTabsAction
= menu
.addAction(KIcon("tab-close-other"), i18nc("@action:inmenu", "Close Other Tabs"));
1085 QAction
* closeTabAction
= menu
.addAction(KIcon("tab-close"), i18nc("@action:inmenu", "Close Tab"));
1086 closeTabAction
->setShortcut(actionCollection()->action("close_tab")->shortcut());
1087 QAction
* selectedAction
= menu
.exec(pos
);
1088 if (selectedAction
== newTabAction
) {
1089 const ViewTab
& tab
= m_viewTab
[index
];
1090 Q_ASSERT(tab
.primaryView
!= 0);
1091 const KUrl url
= (tab
.secondaryView
!= 0) && tab
.secondaryView
->isActive() ?
1092 tab
.secondaryView
->url() : tab
.primaryView
->url();
1094 m_tabBar
->setCurrentIndex(m_viewTab
.count() - 1);
1095 } else if (selectedAction
== detachTabAction
) {
1096 const ViewTab
& tab
= m_viewTab
[index
];
1097 Q_ASSERT(tab
.primaryView
!= 0);
1098 const KUrl primaryUrl
= tab
.primaryView
->url();
1099 DolphinMainWindow
* window
= DolphinApplication::app()->createMainWindow();
1100 window
->changeUrl(primaryUrl
);
1102 if (tab
.secondaryView
!= 0) {
1103 const KUrl secondaryUrl
= tab
.secondaryView
->url();
1104 window
->toggleSplitView();
1105 window
->m_viewTab
[0].secondaryView
->setUrl(secondaryUrl
);
1106 if (tab
.primaryView
->isActive()) {
1107 window
->m_viewTab
[0].primaryView
->setActive(true);
1109 window
->m_viewTab
[0].secondaryView
->setActive(true);
1114 } else if (selectedAction
== closeOtherTabsAction
) {
1115 const int count
= m_tabBar
->count();
1116 for (int i
= 0; i
< index
; ++i
) {
1119 for (int i
= index
+ 1; i
< count
; ++i
) {
1122 } else if (selectedAction
== closeTabAction
) {
1127 void DolphinMainWindow::slotTabMoved(int from
, int to
)
1129 m_viewTab
.move(from
, to
);
1130 m_tabIndex
= m_tabBar
->currentIndex();
1133 void DolphinMainWindow::handlePlacesClick(const KUrl
& url
, Qt::MouseButtons buttons
)
1135 if (buttons
& Qt::MidButton
) {
1137 m_tabBar
->setCurrentIndex(m_viewTab
.count() - 1);
1143 void DolphinMainWindow::slotTestCanDecode(const QDragMoveEvent
* event
, bool& canDecode
)
1145 canDecode
= KUrl::List::canDecode(event
->mimeData());
1148 void DolphinMainWindow::handleUrl(const KUrl
& url
)
1150 delete m_lastHandleUrlStatJob
;
1151 m_lastHandleUrlStatJob
= 0;
1153 if (url
.isLocalFile() && QFileInfo(url
.toLocalFile()).isDir()) {
1154 activeViewContainer()->setUrl(url
);
1155 } else if (KProtocolManager::supportsListing(url
)) {
1156 // stat the URL to see if it is a dir or not
1157 m_lastHandleUrlStatJob
= KIO::stat(url
, KIO::HideProgressInfo
);
1158 connect(m_lastHandleUrlStatJob
, SIGNAL(result(KJob
*)),
1159 this, SLOT(slotHandleUrlStatFinished(KJob
*)));
1162 new KRun(url
, this);
1166 void DolphinMainWindow::slotHandleUrlStatFinished(KJob
* job
)
1168 m_lastHandleUrlStatJob
= 0;
1169 const KIO::UDSEntry entry
= static_cast<KIO::StatJob
*>(job
)->statResult();
1170 const KUrl url
= static_cast<KIO::StatJob
*>(job
)->url();
1171 if ( entry
.isDir() ) {
1172 activeViewContainer()->setUrl(url
);
1174 new KRun(url
, this);
1178 void DolphinMainWindow::tabDropEvent(int tab
, QDropEvent
* event
)
1180 const KUrl::List urls
= KUrl::List::fromMimeData(event
->mimeData());
1181 if (!urls
.isEmpty() && tab
!= -1) {
1182 const ViewTab
& viewTab
= m_viewTab
[tab
];
1183 const KUrl destPath
= viewTab
.isPrimaryViewActive
? viewTab
.primaryView
->url() : viewTab
.secondaryView
->url();
1184 DragAndDropHelper::instance().dropUrls(KFileItem(), destPath
, event
, m_tabBar
);
1188 void DolphinMainWindow::slotWriteStateChanged(bool isFolderWritable
)
1190 newFileMenu()->setEnabled(isFolderWritable
);
1193 void DolphinMainWindow::openContextMenu(const KFileItem
& item
,
1195 const QList
<QAction
*>& customActions
)
1197 QPointer
<DolphinContextMenu
> contextMenu
= new DolphinContextMenu(this, item
, url
);
1198 contextMenu
->setCustomActions(customActions
);
1199 const DolphinContextMenu::Command command
= contextMenu
->open();
1202 case DolphinContextMenu::OpenParentFolderInNewWindow
: {
1203 DolphinMainWindow
* window
= DolphinApplication::app()->createMainWindow();
1204 window
->changeUrl(item
.url().upUrl());
1209 case DolphinContextMenu::OpenParentFolderInNewTab
:
1210 openNewTab(item
.url().upUrl());
1213 case DolphinContextMenu::None
:
1221 void DolphinMainWindow::init()
1223 DolphinSettings
& settings
= DolphinSettings::instance();
1225 // Check whether Dolphin runs the first time. If yes then
1226 // a proper default window size is given at the end of DolphinMainWindow::init().
1227 GeneralSettings
* generalSettings
= settings
.generalSettings();
1228 const bool firstRun
= generalSettings
->firstRun();
1230 generalSettings
->setViewPropsTimestamp(QDateTime::currentDateTime());
1233 setAcceptDrops(true);
1235 m_viewTab
[m_tabIndex
].splitter
= new QSplitter(this);
1236 m_viewTab
[m_tabIndex
].splitter
->setChildrenCollapsible(false);
1240 const KUrl
homeUrl(generalSettings
->homeUrl());
1241 setUrlAsCaption(homeUrl
);
1242 m_actionHandler
= new DolphinViewActionHandler(actionCollection(), this);
1243 connect(m_actionHandler
, SIGNAL(actionBeingHandled()), SLOT(clearStatusBar()));
1244 connect(m_actionHandler
, SIGNAL(createDirectory()), SLOT(createDirectory()));
1245 ViewProperties
props(homeUrl
);
1246 m_viewTab
[m_tabIndex
].primaryView
= new DolphinViewContainer(homeUrl
,
1247 m_viewTab
[m_tabIndex
].splitter
);
1249 m_activeViewContainer
= m_viewTab
[m_tabIndex
].primaryView
;
1250 connectViewSignals(m_activeViewContainer
);
1251 DolphinView
* view
= m_activeViewContainer
->view();
1253 m_activeViewContainer
->show();
1254 m_actionHandler
->setCurrentView(view
);
1256 m_remoteEncoding
= new DolphinRemoteEncoding(this, m_actionHandler
);
1257 connect(this, SIGNAL(urlChanged(const KUrl
&)),
1258 m_remoteEncoding
, SLOT(slotAboutToOpenUrl()));
1260 m_tabBar
= new KTabBar(this);
1261 m_tabBar
->setMovable(true);
1262 m_tabBar
->setTabsClosable(true);
1263 connect(m_tabBar
, SIGNAL(currentChanged(int)),
1264 this, SLOT(setActiveTab(int)));
1265 connect(m_tabBar
, SIGNAL(tabCloseRequested(int)),
1266 this, SLOT(closeTab(int)));
1267 connect(m_tabBar
, SIGNAL(contextMenu(int, const QPoint
&)),
1268 this, SLOT(openTabContextMenu(int, const QPoint
&)));
1269 connect(m_tabBar
, SIGNAL(newTabRequest()),
1270 this, SLOT(openNewTab()));
1271 connect(m_tabBar
, SIGNAL(testCanDecode(const QDragMoveEvent
*, bool&)),
1272 this, SLOT(slotTestCanDecode(const QDragMoveEvent
*, bool&)));
1273 connect(m_tabBar
, SIGNAL(mouseMiddleClick(int)),
1274 this, SLOT(closeTab(int)));
1275 connect(m_tabBar
, SIGNAL(tabMoved(int, int)),
1276 this, SLOT(slotTabMoved(int, int)));
1277 connect(m_tabBar
, SIGNAL(receivedDropEvent(int, QDropEvent
*)),
1278 this, SLOT(tabDropEvent(int, QDropEvent
*)));
1280 m_tabBar
->blockSignals(true); // signals get unblocked after at least 2 tabs are open
1282 QWidget
* centralWidget
= new QWidget(this);
1283 m_centralWidgetLayout
= new QVBoxLayout(centralWidget
);
1284 m_centralWidgetLayout
->setSpacing(0);
1285 m_centralWidgetLayout
->setMargin(0);
1286 m_centralWidgetLayout
->addWidget(m_tabBar
);
1287 m_centralWidgetLayout
->addWidget(m_viewTab
[m_tabIndex
].splitter
, 1);
1289 setCentralWidget(centralWidget
);
1291 emit
urlChanged(homeUrl
);
1293 setupGUI(Keys
| Save
| Create
| ToolBar
);
1294 stateChanged("new_file");
1296 QClipboard
* clipboard
= QApplication::clipboard();
1297 connect(clipboard
, SIGNAL(dataChanged()),
1298 this, SLOT(updatePasteAction()));
1300 if (generalSettings
->splitView()) {
1303 updateEditActions();
1304 updateViewActions();
1307 QAction
* showFilterBarAction
= actionCollection()->action("show_filter_bar");
1308 showFilterBarAction
->setChecked(generalSettings
->filterBar());
1311 // assure a proper default size if Dolphin runs the first time
1315 m_showMenuBar
->setChecked(!menuBar()->isHidden()); // workaround for bug #171080
1318 void DolphinMainWindow::setActiveViewContainer(DolphinViewContainer
* viewContainer
)
1320 Q_ASSERT(viewContainer
!= 0);
1321 Q_ASSERT((viewContainer
== m_viewTab
[m_tabIndex
].primaryView
) ||
1322 (viewContainer
== m_viewTab
[m_tabIndex
].secondaryView
));
1323 if (m_activeViewContainer
== viewContainer
) {
1327 m_activeViewContainer
->setActive(false);
1328 m_activeViewContainer
= viewContainer
;
1330 // Activating the view container might trigger a recursive setActiveViewContainer() call
1331 // inside DolphinMainWindow::toggleActiveView() when having a split view. Temporary
1332 // disconnect the activated() signal in this case:
1333 disconnect(m_activeViewContainer
->view(), SIGNAL(activated()), this, SLOT(toggleActiveView()));
1334 m_activeViewContainer
->setActive(true);
1335 connect(m_activeViewContainer
->view(), SIGNAL(activated()), this, SLOT(toggleActiveView()));
1337 m_actionHandler
->setCurrentView(viewContainer
->view());
1340 updateEditActions();
1341 updateViewActions();
1344 const KUrl url
= m_activeViewContainer
->url();
1345 setUrlAsCaption(url
);
1346 if (m_viewTab
.count() > 1) {
1347 m_tabBar
->setTabText(m_tabIndex
, tabName(url
));
1348 m_tabBar
->setTabIcon(m_tabIndex
, KIcon(KMimeType::iconNameForUrl(url
)));
1351 emit
urlChanged(url
);
1354 void DolphinMainWindow::setupActions()
1356 // setup 'File' menu
1357 m_newFileMenu
= new DolphinNewFileMenu(this, this);
1358 KMenu
* menu
= m_newFileMenu
->menu();
1359 menu
->setTitle(i18nc("@title:menu Create new folder, file, link, etc.", "Create New"));
1360 menu
->setIcon(KIcon("document-new"));
1361 connect(menu
, SIGNAL(aboutToShow()),
1362 this, SLOT(updateNewMenu()));
1364 KAction
* newWindow
= actionCollection()->addAction("new_window");
1365 newWindow
->setIcon(KIcon("window-new"));
1366 newWindow
->setText(i18nc("@action:inmenu File", "New &Window"));
1367 newWindow
->setShortcut(Qt::CTRL
| Qt::Key_N
);
1368 connect(newWindow
, SIGNAL(triggered()), this, SLOT(openNewMainWindow()));
1370 KAction
* newTab
= actionCollection()->addAction("new_tab");
1371 newTab
->setIcon(KIcon("tab-new"));
1372 newTab
->setText(i18nc("@action:inmenu File", "New Tab"));
1373 newTab
->setShortcut(KShortcut(Qt::CTRL
| Qt::Key_T
, Qt::CTRL
| Qt::SHIFT
| Qt::Key_N
));
1374 connect(newTab
, SIGNAL(triggered()), this, SLOT(openNewTab()));
1376 KAction
* closeTab
= actionCollection()->addAction("close_tab");
1377 closeTab
->setIcon(KIcon("tab-close"));
1378 closeTab
->setText(i18nc("@action:inmenu File", "Close Tab"));
1379 closeTab
->setShortcut(Qt::CTRL
| Qt::Key_W
);
1380 closeTab
->setEnabled(false);
1381 connect(closeTab
, SIGNAL(triggered()), this, SLOT(closeTab()));
1383 KStandardAction::quit(this, SLOT(quit()), actionCollection());
1385 // setup 'Edit' menu
1386 KStandardAction::undo(this,
1388 actionCollection());
1390 // need to remove shift+del from cut action, else the shortcut for deletejob
1392 KAction
* cut
= KStandardAction::cut(this, SLOT(cut()), actionCollection());
1393 KShortcut cutShortcut
= cut
->shortcut();
1394 cutShortcut
.remove(Qt::SHIFT
+ Qt::Key_Delete
, KShortcut::KeepEmpty
);
1395 cut
->setShortcut(cutShortcut
);
1396 KStandardAction::copy(this, SLOT(copy()), actionCollection());
1397 KAction
* paste
= KStandardAction::paste(this, SLOT(paste()), actionCollection());
1398 // The text of the paste-action is modified dynamically by Dolphin
1399 // (e. g. to "Paste One Folder"). To prevent that the size of the toolbar changes
1400 // due to the long text, the text "Paste" is used:
1401 paste
->setIconText(i18nc("@action:inmenu Edit", "Paste"));
1403 KStandardAction::find(this, SLOT(find()), actionCollection());
1405 KAction
* selectAll
= actionCollection()->addAction("select_all");
1406 selectAll
->setText(i18nc("@action:inmenu Edit", "Select All"));
1407 selectAll
->setShortcut(Qt::CTRL
+ Qt::Key_A
);
1408 connect(selectAll
, SIGNAL(triggered()), this, SLOT(selectAll()));
1410 KAction
* invertSelection
= actionCollection()->addAction("invert_selection");
1411 invertSelection
->setText(i18nc("@action:inmenu Edit", "Invert Selection"));
1412 invertSelection
->setShortcut(Qt::CTRL
| Qt::SHIFT
| Qt::Key_A
);
1413 connect(invertSelection
, SIGNAL(triggered()), this, SLOT(invertSelection()));
1415 // setup 'View' menu
1416 // (note that most of it is set up in DolphinViewActionHandler)
1418 KAction
* split
= actionCollection()->addAction("split_view");
1419 split
->setShortcut(Qt::Key_F3
);
1420 updateSplitAction();
1421 connect(split
, SIGNAL(triggered()), this, SLOT(toggleSplitView()));
1423 KAction
* reload
= actionCollection()->addAction("reload");
1424 reload
->setText(i18nc("@action:inmenu View", "Reload"));
1425 reload
->setShortcut(Qt::Key_F5
);
1426 reload
->setIcon(KIcon("view-refresh"));
1427 connect(reload
, SIGNAL(triggered()), this, SLOT(reloadView()));
1429 KAction
* stop
= actionCollection()->addAction("stop");
1430 stop
->setText(i18nc("@action:inmenu View", "Stop"));
1431 stop
->setToolTip(i18nc("@info", "Stop loading"));
1432 stop
->setIcon(KIcon("process-stop"));
1433 connect(stop
, SIGNAL(triggered()), this, SLOT(stopLoading()));
1435 KToggleAction
* showFullLocation
= actionCollection()->add
<KToggleAction
>("editable_location");
1436 showFullLocation
->setText(i18nc("@action:inmenu Navigation Bar", "Editable Location"));
1437 showFullLocation
->setShortcut(Qt::CTRL
| Qt::Key_L
);
1438 connect(showFullLocation
, SIGNAL(triggered()), this, SLOT(toggleEditLocation()));
1440 KAction
* replaceLocation
= actionCollection()->addAction("replace_location");
1441 replaceLocation
->setText(i18nc("@action:inmenu Navigation Bar", "Replace Location"));
1442 replaceLocation
->setShortcut(Qt::Key_F6
);
1443 connect(replaceLocation
, SIGNAL(triggered()), this, SLOT(replaceLocation()));
1446 KAction
* backAction
= KStandardAction::back(this, SLOT(goBack()), actionCollection());
1447 connect(backAction
, SIGNAL(triggered(Qt::MouseButtons
, Qt::KeyboardModifiers
)), this, SLOT(goBack(Qt::MouseButtons
)));
1448 KShortcut backShortcut
= backAction
->shortcut();
1449 backShortcut
.setAlternate(Qt::Key_Backspace
);
1450 backAction
->setShortcut(backShortcut
);
1452 m_recentTabsMenu
= new KActionMenu(i18n("Recently Closed Tabs"), this);
1453 m_recentTabsMenu
->setIcon(KIcon("edit-undo"));
1454 actionCollection()->addAction("closed_tabs", m_recentTabsMenu
);
1455 connect(m_recentTabsMenu
->menu(), SIGNAL(triggered(QAction
*)),
1456 this, SLOT(restoreClosedTab(QAction
*)));
1458 QAction
* action
= new QAction("Empty Recently Closed Tabs", m_recentTabsMenu
);
1459 action
->setIcon(KIcon("edit-clear-list"));
1460 action
->setData(QVariant::fromValue(true));
1461 m_recentTabsMenu
->addAction(action
);
1462 m_recentTabsMenu
->addSeparator();
1463 m_recentTabsMenu
->setEnabled(false);
1465 KAction
* forwardAction
= KStandardAction::forward(this, SLOT(goForward()), actionCollection());
1466 connect(forwardAction
, SIGNAL(triggered(Qt::MouseButtons
, Qt::KeyboardModifiers
)), this, SLOT(goForward(Qt::MouseButtons
)));
1468 KAction
* upAction
= KStandardAction::up(this, SLOT(goUp()), actionCollection());
1469 connect(upAction
, SIGNAL(triggered(Qt::MouseButtons
, Qt::KeyboardModifiers
)), this, SLOT(goUp(Qt::MouseButtons
)));
1471 KStandardAction::home(this, SLOT(goHome()), actionCollection());
1473 // setup 'Tools' menu
1474 KToggleAction
* showFilterBar
= actionCollection()->add
<KToggleAction
>("show_filter_bar");
1475 showFilterBar
->setText(i18nc("@action:inmenu Tools", "Show Filter Bar"));
1476 showFilterBar
->setIcon(KIcon("view-filter"));
1477 showFilterBar
->setShortcut(Qt::CTRL
| Qt::Key_I
);
1478 connect(showFilterBar
, SIGNAL(triggered(bool)), this, SLOT(toggleFilterBarVisibility(bool)));
1480 KAction
* compareFiles
= actionCollection()->addAction("compare_files");
1481 compareFiles
->setText(i18nc("@action:inmenu Tools", "Compare Files"));
1482 compareFiles
->setIcon(KIcon("kompare"));
1483 compareFiles
->setEnabled(false);
1484 connect(compareFiles
, SIGNAL(triggered()), this, SLOT(compareFiles()));
1486 KAction
* openTerminal
= actionCollection()->addAction("open_terminal");
1487 openTerminal
->setText(i18nc("@action:inmenu Tools", "Open Terminal"));
1488 openTerminal
->setIcon(KIcon("utilities-terminal"));
1489 openTerminal
->setShortcut(Qt::SHIFT
| Qt::Key_F4
);
1490 connect(openTerminal
, SIGNAL(triggered()), this, SLOT(openTerminal()));
1492 // setup 'Settings' menu
1493 m_showMenuBar
= KStandardAction::showMenubar(this, SLOT(toggleShowMenuBar()), actionCollection());
1494 KStandardAction::preferences(this, SLOT(editSettings()), actionCollection());
1496 // not in menu actions
1497 QList
<QKeySequence
> nextTabKeys
;
1498 nextTabKeys
.append(KStandardShortcut::tabNext().primary());
1499 nextTabKeys
.append(QKeySequence(Qt::CTRL
+ Qt::Key_Tab
));
1501 QList
<QKeySequence
> prevTabKeys
;
1502 prevTabKeys
.append(KStandardShortcut::tabPrev().primary());
1503 prevTabKeys
.append(QKeySequence(Qt::CTRL
+ Qt::SHIFT
+ Qt::Key_Tab
));
1505 KAction
* activateNextTab
= actionCollection()->addAction("activate_next_tab");
1506 activateNextTab
->setText(i18nc("@action:inmenu", "Activate Next Tab"));
1507 connect(activateNextTab
, SIGNAL(triggered()), SLOT(activateNextTab()));
1508 activateNextTab
->setShortcuts(QApplication::isRightToLeft() ? prevTabKeys
: nextTabKeys
);
1510 KAction
* activatePrevTab
= actionCollection()->addAction("activate_prev_tab");
1511 activatePrevTab
->setText(i18nc("@action:inmenu", "Activate Previous Tab"));
1512 connect(activatePrevTab
, SIGNAL(triggered()), SLOT(activatePrevTab()));
1513 activatePrevTab
->setShortcuts(QApplication::isRightToLeft() ? nextTabKeys
: prevTabKeys
);
1516 KAction
* openInNewTab
= actionCollection()->addAction("open_in_new_tab");
1517 openInNewTab
->setText(i18nc("@action:inmenu", "Open in New Tab"));
1518 openInNewTab
->setIcon(KIcon("tab-new"));
1519 connect(openInNewTab
, SIGNAL(triggered()), this, SLOT(openInNewTab()));
1521 KAction
* openInNewWindow
= actionCollection()->addAction("open_in_new_window");
1522 openInNewWindow
->setText(i18nc("@action:inmenu", "Open in New Window"));
1523 openInNewWindow
->setIcon(KIcon("window-new"));
1524 connect(openInNewWindow
, SIGNAL(triggered()), this, SLOT(openInNewWindow()));
1527 void DolphinMainWindow::setupDockWidgets()
1529 // setup "Information"
1530 QDockWidget
* infoDock
= new QDockWidget(i18nc("@title:window", "Information"));
1531 infoDock
->setObjectName("infoDock");
1532 infoDock
->setAllowedAreas(Qt::LeftDockWidgetArea
| Qt::RightDockWidgetArea
);
1533 Panel
* infoPanel
= new InformationPanel(infoDock
);
1534 connect(infoPanel
, SIGNAL(urlActivated(KUrl
)), this, SLOT(handleUrl(KUrl
)));
1535 infoDock
->setWidget(infoPanel
);
1537 QAction
* infoAction
= infoDock
->toggleViewAction();
1538 infoAction
->setIcon(KIcon("dialog-information"));
1539 infoAction
->setShortcut(Qt::Key_F11
);
1541 addDockWidget(Qt::RightDockWidgetArea
, infoDock
);
1542 connect(this, SIGNAL(urlChanged(KUrl
)),
1543 infoPanel
, SLOT(setUrl(KUrl
)));
1544 connect(this, SIGNAL(selectionChanged(KFileItemList
)),
1545 infoPanel
, SLOT(setSelection(KFileItemList
)));
1546 connect(this, SIGNAL(requestItemInfo(KFileItem
)),
1547 infoPanel
, SLOT(requestDelayedItemInfo(KFileItem
)));
1550 QDockWidget
* foldersDock
= new QDockWidget(i18nc("@title:window", "Folders"));
1551 foldersDock
->setObjectName("foldersDock");
1552 foldersDock
->setAllowedAreas(Qt::LeftDockWidgetArea
| Qt::RightDockWidgetArea
);
1553 FoldersPanel
* foldersPanel
= new FoldersPanel(foldersDock
);
1554 foldersDock
->setWidget(foldersPanel
);
1556 QAction
* foldersAction
= foldersDock
->toggleViewAction();
1557 foldersAction
->setShortcut(Qt::Key_F7
);
1558 foldersAction
->setIcon(KIcon("folder"));
1560 addDockWidget(Qt::LeftDockWidgetArea
, foldersDock
);
1561 connect(this, SIGNAL(urlChanged(KUrl
)),
1562 foldersPanel
, SLOT(setUrl(KUrl
)));
1563 connect(foldersPanel
, SIGNAL(changeUrl(KUrl
, Qt::MouseButtons
)),
1564 this, SLOT(handlePlacesClick(KUrl
, Qt::MouseButtons
)));
1568 QDockWidget
* filterDock
= new QDockWidget(i18nc("@title:window", "Filter"));
1569 filterDock
->setObjectName("filterDock");
1570 filterDock
->setAllowedAreas(Qt::LeftDockWidgetArea
| Qt::RightDockWidgetArea
);
1571 Panel
* filterPanel
= new FilterPanel(filterDock
);
1572 connect(filterPanel
, SIGNAL(urlActivated(KUrl
)), this, SLOT(handleUrl(KUrl
)));
1573 filterDock
->setWidget(filterPanel
);
1575 QAction
* filterAction
= filterDock
->toggleViewAction();
1576 filterAction
->setIcon(KIcon("dialog-facet"));
1577 addDockWidget(Qt::RightDockWidgetArea
, filterDock
);
1578 connect(this, SIGNAL(urlChanged(KUrl
)),
1579 filterPanel
, SLOT(setUrl(KUrl
)));
1584 QDockWidget
* terminalDock
= new QDockWidget(i18nc("@title:window Shell terminal", "Terminal"));
1585 terminalDock
->setObjectName("terminalDock");
1586 terminalDock
->setAllowedAreas(Qt::TopDockWidgetArea
| Qt::BottomDockWidgetArea
);
1587 Panel
* terminalPanel
= new TerminalPanel(terminalDock
);
1588 terminalDock
->setWidget(terminalPanel
);
1590 connect(terminalPanel
, SIGNAL(hideTerminalPanel()), terminalDock
, SLOT(hide()));
1592 QAction
* terminalAction
= terminalDock
->toggleViewAction();
1593 terminalAction
->setShortcut(Qt::Key_F4
);
1594 terminalAction
->setIcon(KIcon("utilities-terminal"));
1596 addDockWidget(Qt::BottomDockWidgetArea
, terminalDock
);
1597 connect(this, SIGNAL(urlChanged(KUrl
)),
1598 terminalPanel
, SLOT(setUrl(KUrl
)));
1601 const bool firstRun
= DolphinSettings::instance().generalSettings()->firstRun();
1604 foldersDock
->hide();
1606 terminalDock
->hide();
1611 QDockWidget
* placesDock
= new QDockWidget(i18nc("@title:window", "Places"));
1612 placesDock
->setObjectName("placesDock");
1613 placesDock
->setAllowedAreas(Qt::LeftDockWidgetArea
| Qt::RightDockWidgetArea
);
1615 PlacesPanel
* placesPanel
= new PlacesPanel(placesDock
);
1616 placesDock
->setWidget(placesPanel
);
1617 placesPanel
->setModel(DolphinSettings::instance().placesModel());
1618 placesPanel
->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff
);
1620 QAction
* placesAction
= placesDock
->toggleViewAction();
1621 placesAction
->setShortcut(Qt::Key_F9
);
1622 placesAction
->setIcon(KIcon("bookmarks"));
1624 addDockWidget(Qt::LeftDockWidgetArea
, placesDock
);
1625 connect(placesPanel
, SIGNAL(urlChanged(KUrl
, Qt::MouseButtons
)),
1626 this, SLOT(handlePlacesClick(KUrl
, Qt::MouseButtons
)));
1627 connect(this, SIGNAL(urlChanged(KUrl
)),
1628 placesPanel
, SLOT(setUrl(KUrl
)));
1630 KActionMenu
* panelsMenu
= new KActionMenu(i18nc("@action:inmenu View", "Panels"), this);
1631 actionCollection()->addAction("panels", panelsMenu
);
1632 panelsMenu
->setDelayed(false);
1633 panelsMenu
->addAction(placesAction
);
1634 panelsMenu
->addAction(infoAction
);
1635 panelsMenu
->addAction(foldersAction
);
1637 panelsMenu
->addAction(filterAction
);
1640 panelsMenu
->addAction(terminalAction
);
1644 void DolphinMainWindow::updateEditActions()
1646 const KFileItemList list
= m_activeViewContainer
->view()->selectedItems();
1647 if (list
.isEmpty()) {
1648 stateChanged("has_no_selection");
1650 stateChanged("has_selection");
1652 KActionCollection
* col
= actionCollection();
1653 QAction
* renameAction
= col
->action("rename");
1654 QAction
* moveToTrashAction
= col
->action("move_to_trash");
1655 QAction
* deleteAction
= col
->action("delete");
1656 QAction
* cutAction
= col
->action(KStandardAction::name(KStandardAction::Cut
));
1657 QAction
* deleteWithTrashShortcut
= col
->action("delete_shortcut"); // see DolphinViewActionHandler
1659 KFileItemListProperties
capabilities(list
);
1660 const bool enableMoveToTrash
= capabilities
.isLocal() && capabilities
.supportsMoving();
1662 renameAction
->setEnabled(capabilities
.supportsMoving());
1663 moveToTrashAction
->setEnabled(enableMoveToTrash
);
1664 deleteAction
->setEnabled(capabilities
.supportsDeleting());
1665 deleteWithTrashShortcut
->setEnabled(capabilities
.supportsDeleting() && !enableMoveToTrash
);
1666 cutAction
->setEnabled(capabilities
.supportsMoving());
1668 updatePasteAction();
1671 void DolphinMainWindow::updateViewActions()
1673 m_actionHandler
->updateViewActions();
1675 QAction
* showFilterBarAction
= actionCollection()->action("show_filter_bar");
1676 showFilterBarAction
->setChecked(m_activeViewContainer
->isFilterBarVisible());
1678 updateSplitAction();
1680 QAction
* editableLocactionAction
= actionCollection()->action("editable_location");
1681 const KUrlNavigator
* urlNavigator
= m_activeViewContainer
->urlNavigator();
1682 editableLocactionAction
->setChecked(urlNavigator
->isUrlEditable());
1685 void DolphinMainWindow::updateGoActions()
1687 QAction
* goUpAction
= actionCollection()->action(KStandardAction::name(KStandardAction::Up
));
1688 const KUrl currentUrl
= m_activeViewContainer
->url();
1689 goUpAction
->setEnabled(currentUrl
.upUrl() != currentUrl
);
1692 void DolphinMainWindow::rememberClosedTab(int index
)
1694 KMenu
* tabsMenu
= m_recentTabsMenu
->menu();
1696 const QString primaryPath
= m_viewTab
[index
].primaryView
->url().path();
1697 const QString iconName
= KMimeType::iconNameForUrl(primaryPath
);
1699 QAction
* action
= new QAction(squeezedText(primaryPath
), tabsMenu
);
1701 ClosedTab closedTab
;
1702 closedTab
.primaryUrl
= m_viewTab
[index
].primaryView
->url();
1704 if (m_viewTab
[index
].secondaryView
!= 0) {
1705 closedTab
.secondaryUrl
= m_viewTab
[index
].secondaryView
->url();
1706 closedTab
.isSplit
= true;
1708 closedTab
.isSplit
= false;
1711 action
->setData(QVariant::fromValue(closedTab
));
1712 action
->setIcon(KIcon(iconName
));
1714 // add the closed tab menu entry after the separator and
1715 // "Empty Recently Closed Tabs" entry
1716 if (tabsMenu
->actions().size() == 2) {
1717 tabsMenu
->addAction(action
);
1719 tabsMenu
->insertAction(tabsMenu
->actions().at(2), action
);
1722 // assure that only up to 8 closed tabs are shown in the menu
1723 if (tabsMenu
->actions().size() > 8) {
1724 tabsMenu
->removeAction(tabsMenu
->actions().last());
1726 actionCollection()->action("closed_tabs")->setEnabled(true);
1727 KAcceleratorManager::manage(tabsMenu
);
1730 void DolphinMainWindow::clearStatusBar()
1732 m_activeViewContainer
->statusBar()->clear();
1735 void DolphinMainWindow::connectViewSignals(DolphinViewContainer
* container
)
1737 connect(container
, SIGNAL(showFilterBarChanged(bool)),
1738 this, SLOT(updateFilterBarAction(bool)));
1739 connect(container
, SIGNAL(writeStateChanged(bool)),
1740 this, SLOT(slotWriteStateChanged(bool)));
1742 DolphinView
* view
= container
->view();
1743 connect(view
, SIGNAL(selectionChanged(KFileItemList
)),
1744 this, SLOT(slotSelectionChanged(KFileItemList
)));
1745 connect(view
, SIGNAL(requestItemInfo(KFileItem
)),
1746 this, SLOT(slotRequestItemInfo(KFileItem
)));
1747 connect(view
, SIGNAL(activated()),
1748 this, SLOT(toggleActiveView()));
1749 connect(view
, SIGNAL(tabRequested(const KUrl
&)),
1750 this, SLOT(openNewTab(const KUrl
&)));
1751 connect(view
, SIGNAL(requestContextMenu(KFileItem
, const KUrl
&, const QList
<QAction
*>&)),
1752 this, SLOT(openContextMenu(KFileItem
, const KUrl
&, const QList
<QAction
*>&)));
1753 connect(view
, SIGNAL(startedPathLoading(KUrl
)),
1754 this, SLOT(enableStopAction()));
1755 connect(view
, SIGNAL(finishedPathLoading(KUrl
)),
1756 this, SLOT(disableStopAction()));
1758 const KUrlNavigator
* navigator
= container
->urlNavigator();
1759 connect(navigator
, SIGNAL(urlChanged(const KUrl
&)),
1760 this, SLOT(changeUrl(const KUrl
&)));
1761 connect(navigator
, SIGNAL(historyChanged()),
1762 this, SLOT(updateHistory()));
1763 connect(navigator
, SIGNAL(editableStateChanged(bool)),
1764 this, SLOT(slotEditableStateChanged(bool)));
1765 connect(navigator
, SIGNAL(tabRequested(const KUrl
&)),
1766 this, SLOT(openNewTab(KUrl
)));
1769 void DolphinMainWindow::updateSplitAction()
1771 QAction
* splitAction
= actionCollection()->action("split_view");
1772 if (m_viewTab
[m_tabIndex
].secondaryView
!= 0) {
1773 if (m_activeViewContainer
== m_viewTab
[m_tabIndex
].secondaryView
) {
1774 splitAction
->setText(i18nc("@action:intoolbar Close right view", "Close"));
1775 splitAction
->setToolTip(i18nc("@info", "Close right view"));
1776 splitAction
->setIcon(KIcon("view-right-close"));
1778 splitAction
->setText(i18nc("@action:intoolbar Close left view", "Close"));
1779 splitAction
->setToolTip(i18nc("@info", "Close left view"));
1780 splitAction
->setIcon(KIcon("view-left-close"));
1783 splitAction
->setText(i18nc("@action:intoolbar Split view", "Split"));
1784 splitAction
->setToolTip(i18nc("@info", "Split view"));
1785 splitAction
->setIcon(KIcon("view-right-new"));
1789 QString
DolphinMainWindow::tabName(const KUrl
& url
) const
1792 if (url
.equals(KUrl("file:///"))) {
1795 name
= url
.fileName();
1796 if (name
.isEmpty()) {
1797 name
= url
.protocol();
1799 // Make sure that a '&' inside the directory name is displayed correctly
1800 // and not misinterpreted as a keyboard shortcut in QTabBar::setTabText()
1801 name
.replace('&', "&&");
1807 bool DolphinMainWindow::isKompareInstalled() const
1809 static bool initialized
= false;
1810 static bool installed
= false;
1812 // TODO: maybe replace this approach later by using a menu
1813 // plugin like kdiff3plugin.cpp
1814 installed
= !KGlobal::dirs()->findExe("kompare").isEmpty();
1820 void DolphinMainWindow::createSecondaryView(int tabIndex
)
1822 QSplitter
* splitter
= m_viewTab
[tabIndex
].splitter
;
1823 const int newWidth
= (m_viewTab
[tabIndex
].primaryView
->width() - splitter
->handleWidth()) / 2;
1825 const DolphinView
* view
= m_viewTab
[tabIndex
].primaryView
->view();
1826 m_viewTab
[tabIndex
].secondaryView
= new DolphinViewContainer(view
->rootUrl(), 0);
1827 splitter
->addWidget(m_viewTab
[tabIndex
].secondaryView
);
1828 splitter
->setSizes(QList
<int>() << newWidth
<< newWidth
);
1829 connectViewSignals(m_viewTab
[tabIndex
].secondaryView
);
1830 m_viewTab
[tabIndex
].secondaryView
->view()->reload();
1831 m_viewTab
[tabIndex
].secondaryView
->setActive(false);
1832 m_viewTab
[tabIndex
].secondaryView
->show();
1835 QString
DolphinMainWindow::tabProperty(const QString
& property
, int tabIndex
) const
1837 return "Tab " + QString::number(tabIndex
) + ' ' + property
;
1840 void DolphinMainWindow::setUrlAsCaption(const KUrl
& url
)
1843 if (!url
.isLocalFile()) {
1844 caption
.append(url
.protocol() + " - ");
1845 if (url
.hasHost()) {
1846 caption
.append(url
.host() + " - ");
1850 const QString fileName
= url
.fileName().isEmpty() ? "/" : url
.fileName();
1851 caption
.append(fileName
);
1853 setCaption(caption
);
1856 QString
DolphinMainWindow::squeezedText(const QString
& text
) const
1858 const QFontMetrics fm
= fontMetrics();
1859 return fm
.elidedText(text
, Qt::ElideMiddle
, fm
.maxWidth() * 10);
1862 DolphinMainWindow::UndoUiInterface::UndoUiInterface() :
1863 KIO::FileUndoManager::UiInterface()
1867 DolphinMainWindow::UndoUiInterface::~UndoUiInterface()
1871 void DolphinMainWindow::UndoUiInterface::jobError(KIO::Job
* job
)
1873 DolphinMainWindow
* mainWin
= qobject_cast
<DolphinMainWindow
*>(parentWidget());
1875 DolphinStatusBar
* statusBar
= mainWin
->activeViewContainer()->statusBar();
1876 statusBar
->setMessage(job
->errorString(), DolphinStatusBar::Error
);
1878 KIO::FileUndoManager::UiInterface::jobError(job
);
1882 #include "dolphinmainwindow.moc"