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 <kdualaction.h>
57 #include <kfiledialog.h>
58 #include <kfileplacesmodel.h>
60 #include <klineedit.h>
63 #include <kiconloader.h>
64 #include <kio/netaccess.h>
65 #include <kinputdialog.h>
67 #include <kprotocolmanager.h>
70 #include <kmessagebox.h>
71 #include <kfileitemlistproperties.h>
72 #include <konqmimedata.h>
73 #include <kprotocolinfo.h>
76 #include <kstandarddirs.h>
77 #include <kstatusbar.h>
78 #include <kstandardaction.h>
80 #include <ktoggleaction.h>
81 #include <kurlnavigator.h>
83 #include <kurlcombobox.h>
84 #include <ktoolinvocation.h>
86 #include <QDBusMessage>
90 #include <QDockWidget>
91 #include <kacceleratormanager.h>
94 * Remembers the tab configuration if a tab has been closed.
95 * Each closed tab can be restored by the menu
96 * "Go -> Recently Closed Tabs".
104 Q_DECLARE_METATYPE(ClosedTab
)
106 DolphinMainWindow::DolphinMainWindow(int id
) :
111 m_activeViewContainer(0),
112 m_centralWidgetLayout(0),
119 m_lastHandleUrlStatJob(0)
121 // Workaround for a X11-issue in combination with KModifierInfo
122 // (see DolphinContextMenu::initializeModifierKeyInfo() for
123 // more information):
124 DolphinContextMenu::initializeModifierKeyInfo();
126 setObjectName("Dolphin#");
128 m_viewTab
.append(ViewTab());
130 new MainWindowAdaptor(this);
131 QDBusConnection::sessionBus().registerObject(QString("/dolphin/MainWindow%1").arg(m_id
), this);
133 KIO::FileUndoManager
* undoManager
= KIO::FileUndoManager::self();
134 undoManager
->setUiInterface(new UndoUiInterface());
136 connect(undoManager
, SIGNAL(undoAvailable(bool)),
137 this, SLOT(slotUndoAvailable(bool)));
138 connect(undoManager
, SIGNAL(undoTextChanged(const QString
&)),
139 this, SLOT(slotUndoTextChanged(const QString
&)));
140 connect(undoManager
, SIGNAL(jobRecordingStarted(CommandType
)),
141 this, SLOT(clearStatusBar()));
142 connect(undoManager
, SIGNAL(jobRecordingFinished(CommandType
)),
143 this, SLOT(showCommand(CommandType
)));
144 connect(DolphinSettings::instance().placesModel(), SIGNAL(errorMessage(const QString
&)),
145 this, SLOT(showErrorMessage(const QString
&)));
146 connect(&DragAndDropHelper::instance(), SIGNAL(errorMessage(const QString
&)),
147 this, SLOT(showErrorMessage(const QString
&)));
150 DolphinMainWindow::~DolphinMainWindow()
152 DolphinApplication::app()->removeMainWindow(this);
155 void DolphinMainWindow::openDirectories(const QList
<KUrl
>& dirs
)
157 if (dirs
.isEmpty()) {
161 const int oldOpenTabsCount
= m_viewTab
.count();
163 const GeneralSettings
* generalSettings
= DolphinSettings::instance().generalSettings();
164 const bool hasSplitView
= generalSettings
->splitView();
166 // Open each directory inside a new tab. If the "split view" option has been enabled,
167 // always show two directories within one tab.
168 QList
<KUrl
>::const_iterator it
= dirs
.begin();
169 while (it
!= dirs
.end()) {
173 if (hasSplitView
&& (it
!= dirs
.end())) {
174 const int tabIndex
= m_viewTab
.count() - 1;
175 m_viewTab
[tabIndex
].secondaryView
->setUrl(*it
);
180 // remove the previously opened tabs
181 for (int i
= 0; i
< oldOpenTabsCount
; ++i
) {
186 void DolphinMainWindow::openFiles(const QList
<KUrl
>& files
)
188 if (files
.isEmpty()) {
192 // Get all distinct directories from 'files' and open a tab
193 // for each directory. If the "split view" option is enabled, two
194 // directories are shown inside one tab (see openDirectories()).
196 foreach (const KUrl
& url
, files
) {
197 const KUrl
dir(url
.directory());
198 if (!dirs
.contains(dir
)) {
203 openDirectories(dirs
);
205 // Select the files. Although the files can be split between several
206 // tabs, there is no need to split 'files' accordingly, as
207 // the DolphinView will just ignore invalid selections.
208 const int tabCount
= m_viewTab
.count();
209 for (int i
= 0; i
< tabCount
; ++i
) {
210 m_viewTab
[i
].primaryView
->view()->markUrlsAsSelected(files
);
211 if (m_viewTab
[i
].secondaryView
!= 0) {
212 m_viewTab
[i
].secondaryView
->view()->markUrlsAsSelected(files
);
217 void DolphinMainWindow::toggleViews()
219 if (m_viewTab
[m_tabIndex
].primaryView
== 0) {
223 // move secondary view from the last position of the splitter
224 // to the first position
225 m_viewTab
[m_tabIndex
].splitter
->insertWidget(0, m_viewTab
[m_tabIndex
].secondaryView
);
227 DolphinViewContainer
* container
= m_viewTab
[m_tabIndex
].primaryView
;
228 m_viewTab
[m_tabIndex
].primaryView
= m_viewTab
[m_tabIndex
].secondaryView
;
229 m_viewTab
[m_tabIndex
].secondaryView
= container
;
232 void DolphinMainWindow::showCommand(CommandType command
)
234 DolphinStatusBar
* statusBar
= m_activeViewContainer
->statusBar();
236 case KIO::FileUndoManager::Copy
:
237 statusBar
->setMessage(i18nc("@info:status", "Successfully copied."),
238 DolphinStatusBar::OperationCompleted
);
240 case KIO::FileUndoManager::Move
:
241 statusBar
->setMessage(i18nc("@info:status", "Successfully moved."),
242 DolphinStatusBar::OperationCompleted
);
244 case KIO::FileUndoManager::Link
:
245 statusBar
->setMessage(i18nc("@info:status", "Successfully linked."),
246 DolphinStatusBar::OperationCompleted
);
248 case KIO::FileUndoManager::Trash
:
249 statusBar
->setMessage(i18nc("@info:status", "Successfully moved to trash."),
250 DolphinStatusBar::OperationCompleted
);
252 case KIO::FileUndoManager::Rename
:
253 statusBar
->setMessage(i18nc("@info:status", "Successfully renamed."),
254 DolphinStatusBar::OperationCompleted
);
257 case KIO::FileUndoManager::Mkdir
:
258 statusBar
->setMessage(i18nc("@info:status", "Created folder."),
259 DolphinStatusBar::OperationCompleted
);
267 void DolphinMainWindow::refreshViews()
269 Q_ASSERT(m_viewTab
[m_tabIndex
].primaryView
!= 0);
271 // remember the current active view, as because of
272 // the refreshing the active view might change to
273 // the secondary view
274 DolphinViewContainer
* activeViewContainer
= m_activeViewContainer
;
276 const int tabCount
= m_viewTab
.count();
277 for (int i
= 0; i
< tabCount
; ++i
) {
278 m_viewTab
[i
].primaryView
->refresh();
279 if (m_viewTab
[i
].secondaryView
!= 0) {
280 m_viewTab
[i
].secondaryView
->refresh();
284 setActiveViewContainer(activeViewContainer
);
287 void DolphinMainWindow::pasteIntoFolder()
289 m_activeViewContainer
->view()->pasteIntoFolder();
292 void DolphinMainWindow::changeUrl(const KUrl
& url
)
294 if (!KProtocolManager::supportsListing(url
)) {
295 // The URL navigator only checks for validity, not
296 // if the URL can be listed. An error message is
297 // shown due to DolphinViewContainer::restoreView().
301 DolphinViewContainer
* view
= activeViewContainer();
307 setUrlAsCaption(url
);
308 if (m_viewTab
.count() > 1) {
309 m_tabBar
->setTabText(m_tabIndex
, squeezedText(tabName(m_activeViewContainer
->url())));
311 const QString iconName
= KMimeType::iconNameForUrl(url
);
312 m_tabBar
->setTabIcon(m_tabIndex
, KIcon(iconName
));
313 emit
urlChanged(url
);
317 void DolphinMainWindow::slotEditableStateChanged(bool editable
)
319 KToggleAction
* editableLocationAction
=
320 static_cast<KToggleAction
*>(actionCollection()->action("editable_location"));
321 editableLocationAction
->setChecked(editable
);
324 void DolphinMainWindow::slotSelectionChanged(const KFileItemList
& selection
)
328 Q_ASSERT(m_viewTab
[m_tabIndex
].primaryView
!= 0);
329 int selectedUrlsCount
= m_viewTab
[m_tabIndex
].primaryView
->view()->selectedItemsCount();
330 if (m_viewTab
[m_tabIndex
].secondaryView
!= 0) {
331 selectedUrlsCount
+= m_viewTab
[m_tabIndex
].secondaryView
->view()->selectedItemsCount();
334 QAction
* compareFilesAction
= actionCollection()->action("compare_files");
335 if (selectedUrlsCount
== 2) {
336 compareFilesAction
->setEnabled(isKompareInstalled());
338 compareFilesAction
->setEnabled(false);
341 emit
selectionChanged(selection
);
344 void DolphinMainWindow::slotRequestItemInfo(const KFileItem
& item
)
346 emit
requestItemInfo(item
);
349 void DolphinMainWindow::updateHistory()
351 const KUrlNavigator
* urlNavigator
= m_activeViewContainer
->urlNavigator();
352 const int index
= urlNavigator
->historyIndex();
354 QAction
* backAction
= actionCollection()->action("go_back");
355 backAction
->setToolTip(i18nc("@info", "Go back"));
356 if (backAction
!= 0) {
357 backAction
->setEnabled(index
< urlNavigator
->historySize() - 1);
360 QAction
* forwardAction
= actionCollection()->action("go_forward");
361 forwardAction
->setToolTip(i18nc("@info", "Go forward"));
362 if (forwardAction
!= 0) {
363 forwardAction
->setEnabled(index
> 0);
367 void DolphinMainWindow::updateFilterBarAction(bool show
)
369 QAction
* showFilterBarAction
= actionCollection()->action("show_filter_bar");
370 showFilterBarAction
->setChecked(show
);
373 void DolphinMainWindow::openNewMainWindow()
375 DolphinApplication::app()->createMainWindow()->show();
378 void DolphinMainWindow::openNewTab()
380 const bool isUrlEditable
= m_activeViewContainer
->urlNavigator()->isUrlEditable();
382 openNewTab(m_activeViewContainer
->url());
383 m_tabBar
->setCurrentIndex(m_viewTab
.count() - 1);
385 // The URL navigator of the new tab should have the same editable state
386 // as the current tab
387 KUrlNavigator
* navigator
= m_activeViewContainer
->urlNavigator();
388 navigator
->setUrlEditable(isUrlEditable
);
391 // If a new tab is opened and the URL is editable, assure that
392 // the user can edit the URL without manually setting the focus
393 navigator
->setFocus();
397 void DolphinMainWindow::openNewTab(const KUrl
& url
)
399 QWidget
* focusWidget
= QApplication::focusWidget();
401 if (m_viewTab
.count() == 1) {
402 // Only one view is open currently and hence no tab is shown at
403 // all. Before creating a tab for 'url', provide a tab for the current URL.
404 const KUrl currentUrl
= m_activeViewContainer
->url();
405 m_tabBar
->addTab(KIcon(KMimeType::iconNameForUrl(currentUrl
)),
406 squeezedText(tabName(currentUrl
)));
407 m_tabBar
->blockSignals(false);
410 m_tabBar
->addTab(KIcon(KMimeType::iconNameForUrl(url
)),
411 squeezedText(tabName(url
)));
414 viewTab
.splitter
= new QSplitter(this);
415 viewTab
.splitter
->setChildrenCollapsible(false);
416 viewTab
.primaryView
= new DolphinViewContainer(url
, viewTab
.splitter
);
417 viewTab
.primaryView
->setActive(false);
418 connectViewSignals(viewTab
.primaryView
);
419 viewTab
.primaryView
->view()->reload();
421 m_viewTab
.append(viewTab
);
423 actionCollection()->action("close_tab")->setEnabled(true);
425 // provide a split view, if the startup settings are set this way
426 const GeneralSettings
* generalSettings
= DolphinSettings::instance().generalSettings();
427 if (generalSettings
->splitView()) {
428 const int tabIndex
= m_viewTab
.count() - 1;
429 createSecondaryView(tabIndex
);
430 m_viewTab
[tabIndex
].secondaryView
->setActive(true);
431 m_viewTab
[tabIndex
].isPrimaryViewActive
= false;
434 if (focusWidget
!= 0) {
435 // The DolphinViewContainer grabbed the keyboard focus. As the tab is opened
436 // in background, assure that the previous focused widget gets the focus back.
437 focusWidget
->setFocus();
441 void DolphinMainWindow::activateNextTab()
443 if ((m_viewTab
.count() == 1) || (m_tabBar
->count() < 2)) {
447 const int tabIndex
= (m_tabBar
->currentIndex() + 1) % m_tabBar
->count();
448 m_tabBar
->setCurrentIndex(tabIndex
);
451 void DolphinMainWindow::activatePrevTab()
453 if ((m_viewTab
.count() == 1) || (m_tabBar
->count() < 2)) {
457 int tabIndex
= m_tabBar
->currentIndex() - 1;
458 if (tabIndex
== -1) {
459 tabIndex
= m_tabBar
->count() - 1;
461 m_tabBar
->setCurrentIndex(tabIndex
);
464 void DolphinMainWindow::openInNewTab()
466 const KFileItemList list
= m_activeViewContainer
->view()->selectedItems();
467 if (list
.isEmpty()) {
468 openNewTab(m_activeViewContainer
->url());
469 } else if ((list
.count() == 1) && list
[0].isDir()) {
470 openNewTab(list
[0].url());
474 void DolphinMainWindow::openInNewWindow()
478 const KFileItemList list
= m_activeViewContainer
->view()->selectedItems();
479 if (list
.isEmpty()) {
480 newWindowUrl
= m_activeViewContainer
->url();
481 } else if ((list
.count() == 1) && list
[0].isDir()) {
482 newWindowUrl
= list
[0].url();
485 if (!newWindowUrl
.isEmpty()) {
486 DolphinMainWindow
* window
= DolphinApplication::app()->createMainWindow();
487 window
->changeUrl(newWindowUrl
);
492 void DolphinMainWindow::toggleActiveView()
494 if (m_viewTab
[m_tabIndex
].secondaryView
== 0) {
495 // only one view is available
499 Q_ASSERT(m_activeViewContainer
!= 0);
500 Q_ASSERT(m_viewTab
[m_tabIndex
].primaryView
!= 0);
502 DolphinViewContainer
* left
= m_viewTab
[m_tabIndex
].primaryView
;
503 DolphinViewContainer
* right
= m_viewTab
[m_tabIndex
].secondaryView
;
504 setActiveViewContainer(m_activeViewContainer
== right
? left
: right
);
507 void DolphinMainWindow::showEvent(QShowEvent
* event
)
509 KXmlGuiWindow::showEvent(event
);
510 if (!event
->spontaneous()) {
511 m_activeViewContainer
->view()->setFocus();
515 void DolphinMainWindow::closeEvent(QCloseEvent
* event
)
517 DolphinSettings
& settings
= DolphinSettings::instance();
518 GeneralSettings
* generalSettings
= settings
.generalSettings();
520 // Find out if Dolphin is closed directly by the user or
521 // by the session manager because the session is closed
522 bool closedByUser
= true;
523 DolphinApplication
*application
= qobject_cast
<DolphinApplication
*>(qApp
);
524 if (application
&& application
->sessionSaving()) {
525 closedByUser
= false;
528 if ((m_viewTab
.count() > 1) && generalSettings
->confirmClosingMultipleTabs() && closedByUser
) {
529 // Ask the user if he really wants to quit and close all tabs.
530 // Open a confirmation dialog with 3 buttons:
531 // KDialog::Yes -> Quit
532 // KDialog::No -> Close only the current tab
533 // KDialog::Cancel -> do nothing
534 KDialog
*dialog
= new KDialog(this, Qt::Dialog
);
535 dialog
->setCaption(i18nc("@title:window", "Confirmation"));
536 dialog
->setButtons(KDialog::Yes
| KDialog::No
| KDialog::Cancel
);
537 dialog
->setModal(true);
538 dialog
->setButtonGuiItem(KDialog::Yes
, KStandardGuiItem::quit());
539 dialog
->setButtonGuiItem(KDialog::No
, KGuiItem(i18n("C&lose Current Tab"), KIcon("tab-close")));
540 dialog
->setButtonGuiItem(KDialog::Cancel
, KStandardGuiItem::cancel());
541 dialog
->setDefaultButton(KDialog::Yes
);
543 bool doNotAskAgainCheckboxResult
= false;
545 const int result
= KMessageBox::createKMessageBox(dialog
,
546 QMessageBox::Warning
,
547 i18n("You have multiple tabs open in this window, are you sure you want to quit?"),
549 i18n("Do not ask again"),
550 &doNotAskAgainCheckboxResult
,
551 KMessageBox::Notify
);
553 if (doNotAskAgainCheckboxResult
) {
554 generalSettings
->setConfirmClosingMultipleTabs(false);
562 // Close only the current tab
570 generalSettings
->setFirstRun(false);
574 KXmlGuiWindow::closeEvent(event
);
577 void DolphinMainWindow::saveProperties(KConfigGroup
& group
)
579 const int tabCount
= m_viewTab
.count();
580 group
.writeEntry("Tab Count", tabCount
);
581 group
.writeEntry("Active Tab Index", m_tabBar
->currentIndex());
583 for (int i
= 0; i
< tabCount
; ++i
) {
584 const DolphinViewContainer
* cont
= m_viewTab
[i
].primaryView
;
585 group
.writeEntry(tabProperty("Primary URL", i
), cont
->url().url());
586 group
.writeEntry(tabProperty("Primary Editable", i
),
587 cont
->urlNavigator()->isUrlEditable());
589 cont
= m_viewTab
[i
].secondaryView
;
591 group
.writeEntry(tabProperty("Secondary URL", i
), cont
->url().url());
592 group
.writeEntry(tabProperty("Secondary Editable", i
),
593 cont
->urlNavigator()->isUrlEditable());
598 void DolphinMainWindow::readProperties(const KConfigGroup
& group
)
600 const int tabCount
= group
.readEntry("Tab Count", 1);
601 for (int i
= 0; i
< tabCount
; ++i
) {
602 DolphinViewContainer
* cont
= m_viewTab
[i
].primaryView
;
604 cont
->setUrl(group
.readEntry(tabProperty("Primary URL", i
)));
605 const bool editable
= group
.readEntry(tabProperty("Primary Editable", i
), false);
606 cont
->urlNavigator()->setUrlEditable(editable
);
608 cont
= m_viewTab
[i
].secondaryView
;
609 const QString secondaryUrl
= group
.readEntry(tabProperty("Secondary URL", i
));
610 if (!secondaryUrl
.isEmpty()) {
612 // a secondary view should be shown, but no one is available
613 // currently -> create a new view
615 cont
= m_viewTab
[i
].secondaryView
;
619 cont
->setUrl(secondaryUrl
);
620 const bool editable
= group
.readEntry(tabProperty("Secondary Editable", i
), false);
621 cont
->urlNavigator()->setUrlEditable(editable
);
622 } else if (cont
!= 0) {
623 // no secondary view should be shown, but the default setting shows
624 // one already -> close the view
628 // openNewTab() needs to be called only tabCount - 1 times
629 if (i
!= tabCount
- 1) {
634 const int index
= group
.readEntry("Active Tab Index", 0);
635 m_tabBar
->setCurrentIndex(index
);
638 void DolphinMainWindow::updateNewMenu()
640 m_newFileMenu
->setViewShowsHiddenFiles(activeViewContainer()->view()->showHiddenFiles());
641 m_newFileMenu
->checkUpToDate();
642 m_newFileMenu
->setPopupFiles(activeViewContainer()->url());
645 void DolphinMainWindow::createDirectory()
647 m_newFileMenu
->setViewShowsHiddenFiles(activeViewContainer()->view()->showHiddenFiles());
648 m_newFileMenu
->setPopupFiles(activeViewContainer()->url());
649 m_newFileMenu
->createDirectory();
652 void DolphinMainWindow::quit()
657 void DolphinMainWindow::showErrorMessage(const QString
& message
)
659 if (!message
.isEmpty()) {
660 DolphinStatusBar
* statusBar
= m_activeViewContainer
->statusBar();
661 statusBar
->setMessage(message
, DolphinStatusBar::Error
);
665 void DolphinMainWindow::slotUndoAvailable(bool available
)
667 QAction
* undoAction
= actionCollection()->action(KStandardAction::name(KStandardAction::Undo
));
668 if (undoAction
!= 0) {
669 undoAction
->setEnabled(available
);
673 void DolphinMainWindow::restoreClosedTab(QAction
* action
)
675 if (action
->data().toBool()) {
676 // clear all actions except the "Empty Recently Closed Tabs"
677 // action and the separator
678 QList
<QAction
*> actions
= m_recentTabsMenu
->menu()->actions();
679 const int count
= actions
.size();
680 for (int i
= 2; i
< count
; ++i
) {
681 m_recentTabsMenu
->menu()->removeAction(actions
.at(i
));
684 const ClosedTab closedTab
= action
->data().value
<ClosedTab
>();
685 openNewTab(closedTab
.primaryUrl
);
686 m_tabBar
->setCurrentIndex(m_viewTab
.count() - 1);
688 if (closedTab
.isSplit
) {
689 // create secondary view
691 m_viewTab
[m_tabIndex
].secondaryView
->setUrl(closedTab
.secondaryUrl
);
694 m_recentTabsMenu
->removeAction(action
);
697 if (m_recentTabsMenu
->menu()->actions().count() == 2) {
698 m_recentTabsMenu
->setEnabled(false);
702 void DolphinMainWindow::slotUndoTextChanged(const QString
& text
)
704 QAction
* undoAction
= actionCollection()->action(KStandardAction::name(KStandardAction::Undo
));
705 if (undoAction
!= 0) {
706 undoAction
->setText(text
);
710 void DolphinMainWindow::undo()
713 KIO::FileUndoManager::self()->uiInterface()->setParentWidget(this);
714 KIO::FileUndoManager::self()->undo();
717 void DolphinMainWindow::cut()
719 m_activeViewContainer
->view()->cutSelectedItems();
722 void DolphinMainWindow::copy()
724 m_activeViewContainer
->view()->copySelectedItems();
727 void DolphinMainWindow::paste()
729 m_activeViewContainer
->view()->paste();
732 void DolphinMainWindow::find()
734 m_activeViewContainer
->setSearchModeEnabled(true);
737 void DolphinMainWindow::updatePasteAction()
739 QAction
* pasteAction
= actionCollection()->action(KStandardAction::name(KStandardAction::Paste
));
740 QPair
<bool, QString
> pasteInfo
= m_activeViewContainer
->view()->pasteInfo();
741 pasteAction
->setEnabled(pasteInfo
.first
);
742 pasteAction
->setText(pasteInfo
.second
);
745 void DolphinMainWindow::selectAll()
749 // if the URL navigator is editable and focused, select the whole
750 // URL instead of all items of the view
752 KUrlNavigator
* urlNavigator
= m_activeViewContainer
->urlNavigator();
753 QLineEdit
* lineEdit
= urlNavigator
->editor()->lineEdit(); // krazy:exclude=qclasses
754 const bool selectUrl
= urlNavigator
->isUrlEditable() &&
755 lineEdit
->hasFocus();
757 lineEdit
->selectAll();
759 m_activeViewContainer
->view()->selectAll();
763 void DolphinMainWindow::invertSelection()
766 m_activeViewContainer
->view()->invertSelection();
769 void DolphinMainWindow::toggleSplitView()
771 if (m_viewTab
[m_tabIndex
].secondaryView
== 0) {
772 createSecondaryView(m_tabIndex
);
773 setActiveViewContainer(m_viewTab
[m_tabIndex
].secondaryView
);
774 } else if (m_activeViewContainer
== m_viewTab
[m_tabIndex
].secondaryView
) {
775 // remove secondary view
776 m_viewTab
[m_tabIndex
].secondaryView
->close();
777 m_viewTab
[m_tabIndex
].secondaryView
->deleteLater();
778 m_viewTab
[m_tabIndex
].secondaryView
= 0;
780 setActiveViewContainer(m_viewTab
[m_tabIndex
].primaryView
);
782 // The primary view is active and should be closed. Hence from a users point of view
783 // the content of the secondary view should be moved to the primary view.
784 // From an implementation point of view it is more efficient to close
785 // the primary view and exchange the internal pointers afterwards.
787 m_viewTab
[m_tabIndex
].primaryView
->close();
788 m_viewTab
[m_tabIndex
].primaryView
->deleteLater();
789 m_viewTab
[m_tabIndex
].primaryView
= m_viewTab
[m_tabIndex
].secondaryView
;
790 m_viewTab
[m_tabIndex
].secondaryView
= 0;
792 setActiveViewContainer(m_viewTab
[m_tabIndex
].primaryView
);
798 void DolphinMainWindow::reloadView()
801 m_activeViewContainer
->view()->reload();
804 void DolphinMainWindow::stopLoading()
806 m_activeViewContainer
->view()->stopLoading();
809 void DolphinMainWindow::enableStopAction()
811 actionCollection()->action("stop")->setEnabled(true);
814 void DolphinMainWindow::disableStopAction()
816 actionCollection()->action("stop")->setEnabled(false);
819 void DolphinMainWindow::toggleFilterBarVisibility(bool show
)
821 m_activeViewContainer
->showFilterBar(show
);
824 void DolphinMainWindow::toggleEditLocation()
828 QAction
* action
= actionCollection()->action("editable_location");
829 KUrlNavigator
* urlNavigator
= m_activeViewContainer
->urlNavigator();
830 urlNavigator
->setUrlEditable(action
->isChecked());
833 void DolphinMainWindow::replaceLocation()
835 KUrlNavigator
* navigator
= m_activeViewContainer
->urlNavigator();
836 navigator
->setUrlEditable(true);
837 navigator
->setFocus();
839 // select the whole text of the combo box editor
840 QLineEdit
* lineEdit
= navigator
->editor()->lineEdit(); // krazy:exclude=qclasses
841 const QString text
= lineEdit
->text();
842 lineEdit
->setSelection(0, text
.length());
845 void DolphinMainWindow::goBack()
849 KUrlNavigator
* urlNavigator
= m_activeViewContainer
->urlNavigator();
850 urlNavigator
->goBack();
852 if (urlNavigator
->locationState().isEmpty()) {
853 // An empty location state indicates a redirection URL,
854 // which must be skipped too
855 urlNavigator
->goBack();
859 void DolphinMainWindow::goForward()
862 m_activeViewContainer
->urlNavigator()->goForward();
865 void DolphinMainWindow::goUp()
868 m_activeViewContainer
->urlNavigator()->goUp();
871 void DolphinMainWindow::goBack(Qt::MouseButtons buttons
)
873 // The default case (left button pressed) is handled in goBack().
874 if (buttons
== Qt::MidButton
) {
875 KUrlNavigator
* urlNavigator
= activeViewContainer()->urlNavigator();
876 const int index
= urlNavigator
->historyIndex() + 1;
877 openNewTab(urlNavigator
->locationUrl(index
));
881 void DolphinMainWindow::goForward(Qt::MouseButtons buttons
)
883 // The default case (left button pressed) is handled in goForward().
884 if (buttons
== Qt::MidButton
) {
885 KUrlNavigator
* urlNavigator
= activeViewContainer()->urlNavigator();
886 const int index
= urlNavigator
->historyIndex() - 1;
887 openNewTab(urlNavigator
->locationUrl(index
));
891 void DolphinMainWindow::goUp(Qt::MouseButtons buttons
)
893 // The default case (left button pressed) is handled in goUp().
894 if (buttons
== Qt::MidButton
) {
895 openNewTab(activeViewContainer()->url().upUrl());
899 void DolphinMainWindow::goHome()
902 m_activeViewContainer
->urlNavigator()->goHome();
905 void DolphinMainWindow::compareFiles()
907 // The method is only invoked if exactly 2 files have
908 // been selected. The selected files may be:
909 // - both in the primary view
910 // - both in the secondary view
911 // - one in the primary view and the other in the secondary
913 Q_ASSERT(m_viewTab
[m_tabIndex
].primaryView
!= 0);
918 KFileItemList items
= m_viewTab
[m_tabIndex
].primaryView
->view()->selectedItems();
920 switch (items
.count()) {
922 Q_ASSERT(m_viewTab
[m_tabIndex
].secondaryView
!= 0);
923 items
= m_viewTab
[m_tabIndex
].secondaryView
->view()->selectedItems();
924 Q_ASSERT(items
.count() == 2);
925 urlA
= items
[0].url();
926 urlB
= items
[1].url();
931 urlA
= items
[0].url();
932 Q_ASSERT(m_viewTab
[m_tabIndex
].secondaryView
!= 0);
933 items
= m_viewTab
[m_tabIndex
].secondaryView
->view()->selectedItems();
934 Q_ASSERT(items
.count() == 1);
935 urlB
= items
[0].url();
940 urlA
= items
[0].url();
941 urlB
= items
[1].url();
946 // may not happen: compareFiles may only get invoked if 2
947 // files are selected
952 QString
command("kompare -c \"");
953 command
.append(urlA
.pathOrUrl());
954 command
.append("\" \"");
955 command
.append(urlB
.pathOrUrl());
956 command
.append('\"');
957 KRun::runCommand(command
, "Kompare", "kompare", this);
960 void DolphinMainWindow::toggleShowMenuBar()
962 const bool visible
= menuBar()->isVisible();
963 menuBar()->setVisible(!visible
);
966 void DolphinMainWindow::openTerminal()
968 QString
dir(QDir::homePath());
970 // If the given directory is not local, it can still be the URL of an
971 // ioslave using UDS_LOCAL_PATH which to be converted first.
972 KUrl url
= KIO::NetAccess::mostLocalUrl(m_activeViewContainer
->url(), this);
974 //If the URL is local after the above conversion, set the directory.
975 if (url
.isLocalFile()) {
976 dir
= url
.toLocalFile();
979 KToolInvocation::invokeTerminal(QString(), dir
);
982 void DolphinMainWindow::editSettings()
984 if (m_settingsDialog
== 0) {
985 const KUrl url
= activeViewContainer()->url();
986 m_settingsDialog
= new DolphinSettingsDialog(url
, this);
987 m_settingsDialog
->setAttribute(Qt::WA_DeleteOnClose
);
988 m_settingsDialog
->show();
990 m_settingsDialog
->raise();
994 void DolphinMainWindow::setActiveTab(int index
)
996 Q_ASSERT(index
>= 0);
997 Q_ASSERT(index
< m_viewTab
.count());
998 if (index
== m_tabIndex
) {
1002 // hide current tab content
1003 ViewTab
& hiddenTab
= m_viewTab
[m_tabIndex
];
1004 hiddenTab
.isPrimaryViewActive
= hiddenTab
.primaryView
->isActive();
1005 hiddenTab
.primaryView
->setActive(false);
1006 if (hiddenTab
.secondaryView
!= 0) {
1007 hiddenTab
.secondaryView
->setActive(false);
1009 QSplitter
* splitter
= m_viewTab
[m_tabIndex
].splitter
;
1011 m_centralWidgetLayout
->removeWidget(splitter
);
1013 // show active tab content
1016 ViewTab
& viewTab
= m_viewTab
[index
];
1017 m_centralWidgetLayout
->addWidget(viewTab
.splitter
, 1);
1018 viewTab
.primaryView
->show();
1019 if (viewTab
.secondaryView
!= 0) {
1020 viewTab
.secondaryView
->show();
1022 viewTab
.splitter
->show();
1024 setActiveViewContainer(viewTab
.isPrimaryViewActive
? viewTab
.primaryView
:
1025 viewTab
.secondaryView
);
1028 void DolphinMainWindow::closeTab()
1030 closeTab(m_tabBar
->currentIndex());
1033 void DolphinMainWindow::closeTab(int index
)
1035 Q_ASSERT(index
>= 0);
1036 Q_ASSERT(index
< m_viewTab
.count());
1037 if (m_viewTab
.count() == 1) {
1038 // the last tab may never get closed
1042 if (index
== m_tabIndex
) {
1043 // The tab that should be closed is the active tab. Activate the
1044 // previous tab before closing the tab.
1045 m_tabBar
->setCurrentIndex((index
> 0) ? index
- 1 : 1);
1047 rememberClosedTab(index
);
1050 m_viewTab
[index
].primaryView
->deleteLater();
1051 if (m_viewTab
[index
].secondaryView
!= 0) {
1052 m_viewTab
[index
].secondaryView
->deleteLater();
1054 m_viewTab
[index
].splitter
->deleteLater();
1055 m_viewTab
.erase(m_viewTab
.begin() + index
);
1057 m_tabBar
->blockSignals(true);
1058 m_tabBar
->removeTab(index
);
1060 if (m_tabIndex
> index
) {
1062 Q_ASSERT(m_tabIndex
>= 0);
1065 // if only one tab is left, also remove the tab entry so that
1066 // closing the last tab is not possible
1067 if (m_viewTab
.count() == 1) {
1068 m_tabBar
->removeTab(0);
1069 actionCollection()->action("close_tab")->setEnabled(false);
1071 m_tabBar
->blockSignals(false);
1075 void DolphinMainWindow::openTabContextMenu(int index
, const QPoint
& pos
)
1079 QAction
* newTabAction
= menu
.addAction(KIcon("tab-new"), i18nc("@action:inmenu", "New Tab"));
1080 newTabAction
->setShortcut(actionCollection()->action("new_tab")->shortcut());
1082 QAction
* detachTabAction
= menu
.addAction(KIcon("tab-detach"), i18nc("@action:inmenu", "Detach Tab"));
1084 QAction
* closeOtherTabsAction
= menu
.addAction(KIcon("tab-close-other"), i18nc("@action:inmenu", "Close Other Tabs"));
1086 QAction
* closeTabAction
= menu
.addAction(KIcon("tab-close"), i18nc("@action:inmenu", "Close Tab"));
1087 closeTabAction
->setShortcut(actionCollection()->action("close_tab")->shortcut());
1088 QAction
* selectedAction
= menu
.exec(pos
);
1089 if (selectedAction
== newTabAction
) {
1090 const ViewTab
& tab
= m_viewTab
[index
];
1091 Q_ASSERT(tab
.primaryView
!= 0);
1092 const KUrl url
= (tab
.secondaryView
!= 0) && tab
.secondaryView
->isActive() ?
1093 tab
.secondaryView
->url() : tab
.primaryView
->url();
1095 m_tabBar
->setCurrentIndex(m_viewTab
.count() - 1);
1096 } else if (selectedAction
== detachTabAction
) {
1097 const ViewTab
& tab
= m_viewTab
[index
];
1098 Q_ASSERT(tab
.primaryView
!= 0);
1099 const KUrl primaryUrl
= tab
.primaryView
->url();
1100 DolphinMainWindow
* window
= DolphinApplication::app()->createMainWindow();
1101 window
->changeUrl(primaryUrl
);
1103 if (tab
.secondaryView
!= 0) {
1104 const KUrl secondaryUrl
= tab
.secondaryView
->url();
1105 window
->toggleSplitView();
1106 window
->m_viewTab
[0].secondaryView
->setUrl(secondaryUrl
);
1107 if (tab
.primaryView
->isActive()) {
1108 window
->m_viewTab
[0].primaryView
->setActive(true);
1110 window
->m_viewTab
[0].secondaryView
->setActive(true);
1115 } else if (selectedAction
== closeOtherTabsAction
) {
1116 const int count
= m_tabBar
->count();
1117 for (int i
= 0; i
< index
; ++i
) {
1120 for (int i
= index
+ 1; i
< count
; ++i
) {
1123 } else if (selectedAction
== closeTabAction
) {
1128 void DolphinMainWindow::slotTabMoved(int from
, int to
)
1130 m_viewTab
.move(from
, to
);
1131 m_tabIndex
= m_tabBar
->currentIndex();
1134 void DolphinMainWindow::handlePlacesClick(const KUrl
& url
, Qt::MouseButtons buttons
)
1136 if (buttons
& Qt::MidButton
) {
1138 m_tabBar
->setCurrentIndex(m_viewTab
.count() - 1);
1144 void DolphinMainWindow::slotTestCanDecode(const QDragMoveEvent
* event
, bool& canDecode
)
1146 canDecode
= KUrl::List::canDecode(event
->mimeData());
1149 void DolphinMainWindow::handleUrl(const KUrl
& url
)
1151 delete m_lastHandleUrlStatJob
;
1152 m_lastHandleUrlStatJob
= 0;
1154 if (url
.isLocalFile() && QFileInfo(url
.toLocalFile()).isDir()) {
1155 activeViewContainer()->setUrl(url
);
1156 } else if (KProtocolManager::supportsListing(url
)) {
1157 // stat the URL to see if it is a dir or not
1158 m_lastHandleUrlStatJob
= KIO::stat(url
, KIO::HideProgressInfo
);
1159 connect(m_lastHandleUrlStatJob
, SIGNAL(result(KJob
*)),
1160 this, SLOT(slotHandleUrlStatFinished(KJob
*)));
1163 new KRun(url
, this);
1167 void DolphinMainWindow::slotHandleUrlStatFinished(KJob
* job
)
1169 m_lastHandleUrlStatJob
= 0;
1170 const KIO::UDSEntry entry
= static_cast<KIO::StatJob
*>(job
)->statResult();
1171 const KUrl url
= static_cast<KIO::StatJob
*>(job
)->url();
1172 if ( entry
.isDir() ) {
1173 activeViewContainer()->setUrl(url
);
1175 new KRun(url
, this);
1179 void DolphinMainWindow::tabDropEvent(int tab
, QDropEvent
* event
)
1181 const KUrl::List urls
= KUrl::List::fromMimeData(event
->mimeData());
1182 if (!urls
.isEmpty() && tab
!= -1) {
1183 const ViewTab
& viewTab
= m_viewTab
[tab
];
1184 const KUrl destPath
= viewTab
.isPrimaryViewActive
? viewTab
.primaryView
->url() : viewTab
.secondaryView
->url();
1185 DragAndDropHelper::instance().dropUrls(KFileItem(), destPath
, event
, m_tabBar
);
1189 void DolphinMainWindow::slotWriteStateChanged(bool isFolderWritable
)
1191 newFileMenu()->setEnabled(isFolderWritable
);
1194 void DolphinMainWindow::openContextMenu(const KFileItem
& item
,
1196 const QList
<QAction
*>& customActions
)
1198 QPointer
<DolphinContextMenu
> contextMenu
= new DolphinContextMenu(this, item
, url
);
1199 contextMenu
->setCustomActions(customActions
);
1200 const DolphinContextMenu::Command command
= contextMenu
->open();
1203 case DolphinContextMenu::OpenParentFolderInNewWindow
: {
1204 DolphinMainWindow
* window
= DolphinApplication::app()->createMainWindow();
1205 window
->changeUrl(item
.url().upUrl());
1210 case DolphinContextMenu::OpenParentFolderInNewTab
:
1211 openNewTab(item
.url().upUrl());
1214 case DolphinContextMenu::None
:
1222 void DolphinMainWindow::init()
1224 DolphinSettings
& settings
= DolphinSettings::instance();
1226 // Check whether Dolphin runs the first time. If yes then
1227 // a proper default window size is given at the end of DolphinMainWindow::init().
1228 GeneralSettings
* generalSettings
= settings
.generalSettings();
1229 const bool firstRun
= generalSettings
->firstRun();
1231 generalSettings
->setViewPropsTimestamp(QDateTime::currentDateTime());
1234 setAcceptDrops(true);
1236 m_viewTab
[m_tabIndex
].splitter
= new QSplitter(this);
1237 m_viewTab
[m_tabIndex
].splitter
->setChildrenCollapsible(false);
1241 const KUrl
homeUrl(generalSettings
->homeUrl());
1242 setUrlAsCaption(homeUrl
);
1243 m_actionHandler
= new DolphinViewActionHandler(actionCollection(), this);
1244 connect(m_actionHandler
, SIGNAL(actionBeingHandled()), SLOT(clearStatusBar()));
1245 connect(m_actionHandler
, SIGNAL(createDirectory()), SLOT(createDirectory()));
1246 ViewProperties
props(homeUrl
);
1247 m_viewTab
[m_tabIndex
].primaryView
= new DolphinViewContainer(homeUrl
,
1248 m_viewTab
[m_tabIndex
].splitter
);
1250 m_activeViewContainer
= m_viewTab
[m_tabIndex
].primaryView
;
1251 connectViewSignals(m_activeViewContainer
);
1252 DolphinView
* view
= m_activeViewContainer
->view();
1254 m_activeViewContainer
->show();
1255 m_actionHandler
->setCurrentView(view
);
1257 m_remoteEncoding
= new DolphinRemoteEncoding(this, m_actionHandler
);
1258 connect(this, SIGNAL(urlChanged(const KUrl
&)),
1259 m_remoteEncoding
, SLOT(slotAboutToOpenUrl()));
1261 m_tabBar
= new KTabBar(this);
1262 m_tabBar
->setMovable(true);
1263 m_tabBar
->setTabsClosable(true);
1264 connect(m_tabBar
, SIGNAL(currentChanged(int)),
1265 this, SLOT(setActiveTab(int)));
1266 connect(m_tabBar
, SIGNAL(tabCloseRequested(int)),
1267 this, SLOT(closeTab(int)));
1268 connect(m_tabBar
, SIGNAL(contextMenu(int, const QPoint
&)),
1269 this, SLOT(openTabContextMenu(int, const QPoint
&)));
1270 connect(m_tabBar
, SIGNAL(newTabRequest()),
1271 this, SLOT(openNewTab()));
1272 connect(m_tabBar
, SIGNAL(testCanDecode(const QDragMoveEvent
*, bool&)),
1273 this, SLOT(slotTestCanDecode(const QDragMoveEvent
*, bool&)));
1274 connect(m_tabBar
, SIGNAL(mouseMiddleClick(int)),
1275 this, SLOT(closeTab(int)));
1276 connect(m_tabBar
, SIGNAL(tabMoved(int, int)),
1277 this, SLOT(slotTabMoved(int, int)));
1278 connect(m_tabBar
, SIGNAL(receivedDropEvent(int, QDropEvent
*)),
1279 this, SLOT(tabDropEvent(int, QDropEvent
*)));
1281 m_tabBar
->blockSignals(true); // signals get unblocked after at least 2 tabs are open
1283 QWidget
* centralWidget
= new QWidget(this);
1284 m_centralWidgetLayout
= new QVBoxLayout(centralWidget
);
1285 m_centralWidgetLayout
->setSpacing(0);
1286 m_centralWidgetLayout
->setMargin(0);
1287 m_centralWidgetLayout
->addWidget(m_tabBar
);
1288 m_centralWidgetLayout
->addWidget(m_viewTab
[m_tabIndex
].splitter
, 1);
1290 setCentralWidget(centralWidget
);
1292 emit
urlChanged(homeUrl
);
1294 setupGUI(Keys
| Save
| Create
| ToolBar
);
1295 stateChanged("new_file");
1297 QClipboard
* clipboard
= QApplication::clipboard();
1298 connect(clipboard
, SIGNAL(dataChanged()),
1299 this, SLOT(updatePasteAction()));
1301 if (generalSettings
->splitView()) {
1304 updateEditActions();
1305 updateViewActions();
1308 QAction
* showFilterBarAction
= actionCollection()->action("show_filter_bar");
1309 showFilterBarAction
->setChecked(generalSettings
->filterBar());
1312 // assure a proper default size if Dolphin runs the first time
1316 m_showMenuBar
->setChecked(!menuBar()->isHidden()); // workaround for bug #171080
1319 void DolphinMainWindow::setActiveViewContainer(DolphinViewContainer
* viewContainer
)
1321 Q_ASSERT(viewContainer
!= 0);
1322 Q_ASSERT((viewContainer
== m_viewTab
[m_tabIndex
].primaryView
) ||
1323 (viewContainer
== m_viewTab
[m_tabIndex
].secondaryView
));
1324 if (m_activeViewContainer
== viewContainer
) {
1328 m_activeViewContainer
->setActive(false);
1329 m_activeViewContainer
= viewContainer
;
1331 // Activating the view container might trigger a recursive setActiveViewContainer() call
1332 // inside DolphinMainWindow::toggleActiveView() when having a split view. Temporary
1333 // disconnect the activated() signal in this case:
1334 disconnect(m_activeViewContainer
->view(), SIGNAL(activated()), this, SLOT(toggleActiveView()));
1335 m_activeViewContainer
->setActive(true);
1336 connect(m_activeViewContainer
->view(), SIGNAL(activated()), this, SLOT(toggleActiveView()));
1338 m_actionHandler
->setCurrentView(viewContainer
->view());
1341 updateEditActions();
1342 updateViewActions();
1345 const KUrl url
= m_activeViewContainer
->url();
1346 setUrlAsCaption(url
);
1347 if (m_viewTab
.count() > 1) {
1348 m_tabBar
->setTabText(m_tabIndex
, tabName(url
));
1349 m_tabBar
->setTabIcon(m_tabIndex
, KIcon(KMimeType::iconNameForUrl(url
)));
1352 emit
urlChanged(url
);
1355 void DolphinMainWindow::setupActions()
1357 // setup 'File' menu
1358 m_newFileMenu
= new DolphinNewFileMenu(this, this);
1359 KMenu
* menu
= m_newFileMenu
->menu();
1360 menu
->setTitle(i18nc("@title:menu Create new folder, file, link, etc.", "Create New"));
1361 menu
->setIcon(KIcon("document-new"));
1362 connect(menu
, SIGNAL(aboutToShow()),
1363 this, SLOT(updateNewMenu()));
1365 KAction
* newWindow
= actionCollection()->addAction("new_window");
1366 newWindow
->setIcon(KIcon("window-new"));
1367 newWindow
->setText(i18nc("@action:inmenu File", "New &Window"));
1368 newWindow
->setShortcut(Qt::CTRL
| Qt::Key_N
);
1369 connect(newWindow
, SIGNAL(triggered()), this, SLOT(openNewMainWindow()));
1371 KAction
* newTab
= actionCollection()->addAction("new_tab");
1372 newTab
->setIcon(KIcon("tab-new"));
1373 newTab
->setText(i18nc("@action:inmenu File", "New Tab"));
1374 newTab
->setShortcut(KShortcut(Qt::CTRL
| Qt::Key_T
, Qt::CTRL
| Qt::SHIFT
| Qt::Key_N
));
1375 connect(newTab
, SIGNAL(triggered()), this, SLOT(openNewTab()));
1377 KAction
* closeTab
= actionCollection()->addAction("close_tab");
1378 closeTab
->setIcon(KIcon("tab-close"));
1379 closeTab
->setText(i18nc("@action:inmenu File", "Close Tab"));
1380 closeTab
->setShortcut(Qt::CTRL
| Qt::Key_W
);
1381 closeTab
->setEnabled(false);
1382 connect(closeTab
, SIGNAL(triggered()), this, SLOT(closeTab()));
1384 KStandardAction::quit(this, SLOT(quit()), actionCollection());
1386 // setup 'Edit' menu
1387 KStandardAction::undo(this,
1389 actionCollection());
1391 // need to remove shift+del from cut action, else the shortcut for deletejob
1393 KAction
* cut
= KStandardAction::cut(this, SLOT(cut()), actionCollection());
1394 KShortcut cutShortcut
= cut
->shortcut();
1395 cutShortcut
.remove(Qt::SHIFT
+ Qt::Key_Delete
, KShortcut::KeepEmpty
);
1396 cut
->setShortcut(cutShortcut
);
1397 KStandardAction::copy(this, SLOT(copy()), actionCollection());
1398 KAction
* paste
= KStandardAction::paste(this, SLOT(paste()), actionCollection());
1399 // The text of the paste-action is modified dynamically by Dolphin
1400 // (e. g. to "Paste One Folder"). To prevent that the size of the toolbar changes
1401 // due to the long text, the text "Paste" is used:
1402 paste
->setIconText(i18nc("@action:inmenu Edit", "Paste"));
1404 KStandardAction::find(this, SLOT(find()), actionCollection());
1406 KAction
* selectAll
= actionCollection()->addAction("select_all");
1407 selectAll
->setText(i18nc("@action:inmenu Edit", "Select All"));
1408 selectAll
->setShortcut(Qt::CTRL
+ Qt::Key_A
);
1409 connect(selectAll
, SIGNAL(triggered()), this, SLOT(selectAll()));
1411 KAction
* invertSelection
= actionCollection()->addAction("invert_selection");
1412 invertSelection
->setText(i18nc("@action:inmenu Edit", "Invert Selection"));
1413 invertSelection
->setShortcut(Qt::CTRL
| Qt::SHIFT
| Qt::Key_A
);
1414 connect(invertSelection
, SIGNAL(triggered()), this, SLOT(invertSelection()));
1416 // setup 'View' menu
1417 // (note that most of it is set up in DolphinViewActionHandler)
1419 KAction
* split
= actionCollection()->addAction("split_view");
1420 split
->setShortcut(Qt::Key_F3
);
1421 updateSplitAction();
1422 connect(split
, SIGNAL(triggered()), this, SLOT(toggleSplitView()));
1424 KAction
* reload
= actionCollection()->addAction("reload");
1425 reload
->setText(i18nc("@action:inmenu View", "Reload"));
1426 reload
->setShortcut(Qt::Key_F5
);
1427 reload
->setIcon(KIcon("view-refresh"));
1428 connect(reload
, SIGNAL(triggered()), this, SLOT(reloadView()));
1430 KAction
* stop
= actionCollection()->addAction("stop");
1431 stop
->setText(i18nc("@action:inmenu View", "Stop"));
1432 stop
->setToolTip(i18nc("@info", "Stop loading"));
1433 stop
->setIcon(KIcon("process-stop"));
1434 connect(stop
, SIGNAL(triggered()), this, SLOT(stopLoading()));
1436 KToggleAction
* showFullLocation
= actionCollection()->add
<KToggleAction
>("editable_location");
1437 showFullLocation
->setText(i18nc("@action:inmenu Navigation Bar", "Editable Location"));
1438 showFullLocation
->setShortcut(Qt::CTRL
| Qt::Key_L
);
1439 connect(showFullLocation
, SIGNAL(triggered()), this, SLOT(toggleEditLocation()));
1441 KAction
* replaceLocation
= actionCollection()->addAction("replace_location");
1442 replaceLocation
->setText(i18nc("@action:inmenu Navigation Bar", "Replace Location"));
1443 replaceLocation
->setShortcut(Qt::Key_F6
);
1444 connect(replaceLocation
, SIGNAL(triggered()), this, SLOT(replaceLocation()));
1447 KAction
* backAction
= KStandardAction::back(this, SLOT(goBack()), actionCollection());
1448 connect(backAction
, SIGNAL(triggered(Qt::MouseButtons
, Qt::KeyboardModifiers
)), this, SLOT(goBack(Qt::MouseButtons
)));
1449 KShortcut backShortcut
= backAction
->shortcut();
1450 backShortcut
.setAlternate(Qt::Key_Backspace
);
1451 backAction
->setShortcut(backShortcut
);
1453 m_recentTabsMenu
= new KActionMenu(i18n("Recently Closed Tabs"), this);
1454 m_recentTabsMenu
->setIcon(KIcon("edit-undo"));
1455 actionCollection()->addAction("closed_tabs", m_recentTabsMenu
);
1456 connect(m_recentTabsMenu
->menu(), SIGNAL(triggered(QAction
*)),
1457 this, SLOT(restoreClosedTab(QAction
*)));
1459 QAction
* action
= new QAction("Empty Recently Closed Tabs", m_recentTabsMenu
);
1460 action
->setIcon(KIcon("edit-clear-list"));
1461 action
->setData(QVariant::fromValue(true));
1462 m_recentTabsMenu
->addAction(action
);
1463 m_recentTabsMenu
->addSeparator();
1464 m_recentTabsMenu
->setEnabled(false);
1466 KAction
* forwardAction
= KStandardAction::forward(this, SLOT(goForward()), actionCollection());
1467 connect(forwardAction
, SIGNAL(triggered(Qt::MouseButtons
, Qt::KeyboardModifiers
)), this, SLOT(goForward(Qt::MouseButtons
)));
1469 KAction
* upAction
= KStandardAction::up(this, SLOT(goUp()), actionCollection());
1470 connect(upAction
, SIGNAL(triggered(Qt::MouseButtons
, Qt::KeyboardModifiers
)), this, SLOT(goUp(Qt::MouseButtons
)));
1472 KStandardAction::home(this, SLOT(goHome()), actionCollection());
1474 // setup 'Tools' menu
1475 KToggleAction
* showFilterBar
= actionCollection()->add
<KToggleAction
>("show_filter_bar");
1476 showFilterBar
->setText(i18nc("@action:inmenu Tools", "Show Filter Bar"));
1477 showFilterBar
->setIcon(KIcon("view-filter"));
1478 showFilterBar
->setShortcut(Qt::CTRL
| Qt::Key_I
);
1479 connect(showFilterBar
, SIGNAL(triggered(bool)), this, SLOT(toggleFilterBarVisibility(bool)));
1481 KAction
* compareFiles
= actionCollection()->addAction("compare_files");
1482 compareFiles
->setText(i18nc("@action:inmenu Tools", "Compare Files"));
1483 compareFiles
->setIcon(KIcon("kompare"));
1484 compareFiles
->setEnabled(false);
1485 connect(compareFiles
, SIGNAL(triggered()), this, SLOT(compareFiles()));
1487 KAction
* openTerminal
= actionCollection()->addAction("open_terminal");
1488 openTerminal
->setText(i18nc("@action:inmenu Tools", "Open Terminal"));
1489 openTerminal
->setIcon(KIcon("utilities-terminal"));
1490 openTerminal
->setShortcut(Qt::SHIFT
| Qt::Key_F4
);
1491 connect(openTerminal
, SIGNAL(triggered()), this, SLOT(openTerminal()));
1493 // setup 'Settings' menu
1494 m_showMenuBar
= KStandardAction::showHideMenubar(this, SLOT(toggleShowMenuBar()), actionCollection());
1495 KStandardAction::preferences(this, SLOT(editSettings()), actionCollection());
1497 // not in menu actions
1498 QList
<QKeySequence
> nextTabKeys
;
1499 nextTabKeys
.append(KStandardShortcut::tabNext().primary());
1500 nextTabKeys
.append(QKeySequence(Qt::CTRL
+ Qt::Key_Tab
));
1502 QList
<QKeySequence
> prevTabKeys
;
1503 prevTabKeys
.append(KStandardShortcut::tabPrev().primary());
1504 prevTabKeys
.append(QKeySequence(Qt::CTRL
+ Qt::SHIFT
+ Qt::Key_Tab
));
1506 KAction
* activateNextTab
= actionCollection()->addAction("activate_next_tab");
1507 activateNextTab
->setText(i18nc("@action:inmenu", "Activate Next Tab"));
1508 connect(activateNextTab
, SIGNAL(triggered()), SLOT(activateNextTab()));
1509 activateNextTab
->setShortcuts(QApplication::isRightToLeft() ? prevTabKeys
: nextTabKeys
);
1511 KAction
* activatePrevTab
= actionCollection()->addAction("activate_prev_tab");
1512 activatePrevTab
->setText(i18nc("@action:inmenu", "Activate Previous Tab"));
1513 connect(activatePrevTab
, SIGNAL(triggered()), SLOT(activatePrevTab()));
1514 activatePrevTab
->setShortcuts(QApplication::isRightToLeft() ? nextTabKeys
: prevTabKeys
);
1517 KAction
* openInNewTab
= actionCollection()->addAction("open_in_new_tab");
1518 openInNewTab
->setText(i18nc("@action:inmenu", "Open in New Tab"));
1519 openInNewTab
->setIcon(KIcon("tab-new"));
1520 connect(openInNewTab
, SIGNAL(triggered()), this, SLOT(openInNewTab()));
1522 KAction
* openInNewWindow
= actionCollection()->addAction("open_in_new_window");
1523 openInNewWindow
->setText(i18nc("@action:inmenu", "Open in New Window"));
1524 openInNewWindow
->setIcon(KIcon("window-new"));
1525 connect(openInNewWindow
, SIGNAL(triggered()), this, SLOT(openInNewWindow()));
1528 void DolphinMainWindow::setupDockWidgets()
1530 // setup "Information"
1531 QDockWidget
* infoDock
= new QDockWidget(i18nc("@title:window", "Information"));
1532 infoDock
->setObjectName("infoDock");
1533 infoDock
->setAllowedAreas(Qt::LeftDockWidgetArea
| Qt::RightDockWidgetArea
);
1534 Panel
* infoPanel
= new InformationPanel(infoDock
);
1535 connect(infoPanel
, SIGNAL(urlActivated(KUrl
)), this, SLOT(handleUrl(KUrl
)));
1536 infoDock
->setWidget(infoPanel
);
1538 QAction
* infoAction
= infoDock
->toggleViewAction();
1539 infoAction
->setIcon(KIcon("dialog-information"));
1540 infoAction
->setShortcut(Qt::Key_F11
);
1542 addDockWidget(Qt::RightDockWidgetArea
, infoDock
);
1543 connect(this, SIGNAL(urlChanged(KUrl
)),
1544 infoPanel
, SLOT(setUrl(KUrl
)));
1545 connect(this, SIGNAL(selectionChanged(KFileItemList
)),
1546 infoPanel
, SLOT(setSelection(KFileItemList
)));
1547 connect(this, SIGNAL(requestItemInfo(KFileItem
)),
1548 infoPanel
, SLOT(requestDelayedItemInfo(KFileItem
)));
1551 QDockWidget
* foldersDock
= new QDockWidget(i18nc("@title:window", "Folders"));
1552 foldersDock
->setObjectName("foldersDock");
1553 foldersDock
->setAllowedAreas(Qt::LeftDockWidgetArea
| Qt::RightDockWidgetArea
);
1554 FoldersPanel
* foldersPanel
= new FoldersPanel(foldersDock
);
1555 foldersDock
->setWidget(foldersPanel
);
1557 QAction
* foldersAction
= foldersDock
->toggleViewAction();
1558 foldersAction
->setShortcut(Qt::Key_F7
);
1559 foldersAction
->setIcon(KIcon("folder"));
1561 addDockWidget(Qt::LeftDockWidgetArea
, foldersDock
);
1562 connect(this, SIGNAL(urlChanged(KUrl
)),
1563 foldersPanel
, SLOT(setUrl(KUrl
)));
1564 connect(foldersPanel
, SIGNAL(changeUrl(KUrl
, Qt::MouseButtons
)),
1565 this, SLOT(handlePlacesClick(KUrl
, Qt::MouseButtons
)));
1569 QDockWidget
* filterDock
= new QDockWidget(i18nc("@title:window", "Filter"));
1570 filterDock
->setObjectName("filterDock");
1571 filterDock
->setAllowedAreas(Qt::LeftDockWidgetArea
| Qt::RightDockWidgetArea
);
1572 Panel
* filterPanel
= new FilterPanel(filterDock
);
1573 connect(filterPanel
, SIGNAL(urlActivated(KUrl
)), this, SLOT(handleUrl(KUrl
)));
1574 filterDock
->setWidget(filterPanel
);
1576 QAction
* filterAction
= filterDock
->toggleViewAction();
1577 filterAction
->setIcon(KIcon("dialog-facet"));
1578 addDockWidget(Qt::RightDockWidgetArea
, filterDock
);
1579 connect(this, SIGNAL(urlChanged(KUrl
)),
1580 filterPanel
, SLOT(setUrl(KUrl
)));
1585 QDockWidget
* terminalDock
= new QDockWidget(i18nc("@title:window Shell terminal", "Terminal"));
1586 terminalDock
->setObjectName("terminalDock");
1587 terminalDock
->setAllowedAreas(Qt::TopDockWidgetArea
| Qt::BottomDockWidgetArea
);
1588 Panel
* terminalPanel
= new TerminalPanel(terminalDock
);
1589 terminalDock
->setWidget(terminalPanel
);
1591 connect(terminalPanel
, SIGNAL(hideTerminalPanel()), terminalDock
, SLOT(hide()));
1593 QAction
* terminalAction
= terminalDock
->toggleViewAction();
1594 terminalAction
->setShortcut(Qt::Key_F4
);
1595 terminalAction
->setIcon(KIcon("utilities-terminal"));
1597 addDockWidget(Qt::BottomDockWidgetArea
, terminalDock
);
1598 connect(this, SIGNAL(urlChanged(KUrl
)),
1599 terminalPanel
, SLOT(setUrl(KUrl
)));
1602 const bool firstRun
= DolphinSettings::instance().generalSettings()->firstRun();
1605 foldersDock
->hide();
1607 terminalDock
->hide();
1612 QDockWidget
* placesDock
= new QDockWidget(i18nc("@title:window", "Places"));
1613 placesDock
->setObjectName("placesDock");
1614 placesDock
->setAllowedAreas(Qt::LeftDockWidgetArea
| Qt::RightDockWidgetArea
);
1616 PlacesPanel
* placesPanel
= new PlacesPanel(placesDock
);
1617 placesDock
->setWidget(placesPanel
);
1618 placesPanel
->setModel(DolphinSettings::instance().placesModel());
1619 placesPanel
->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff
);
1621 QAction
* placesAction
= placesDock
->toggleViewAction();
1622 placesAction
->setShortcut(Qt::Key_F9
);
1623 placesAction
->setIcon(KIcon("bookmarks"));
1625 addDockWidget(Qt::LeftDockWidgetArea
, placesDock
);
1626 connect(placesPanel
, SIGNAL(urlChanged(KUrl
, Qt::MouseButtons
)),
1627 this, SLOT(handlePlacesClick(KUrl
, Qt::MouseButtons
)));
1628 connect(this, SIGNAL(urlChanged(KUrl
)),
1629 placesPanel
, SLOT(setUrl(KUrl
)));
1631 KActionMenu
* panelsMenu
= new KActionMenu(i18nc("@action:inmenu View", "Panels"), this);
1632 actionCollection()->addAction("panels", panelsMenu
);
1633 panelsMenu
->setDelayed(false);
1634 panelsMenu
->addAction(placesAction
);
1635 panelsMenu
->addAction(infoAction
);
1636 panelsMenu
->addAction(foldersAction
);
1638 panelsMenu
->addAction(filterAction
);
1641 panelsMenu
->addAction(terminalAction
);
1645 void DolphinMainWindow::updateEditActions()
1647 const KFileItemList list
= m_activeViewContainer
->view()->selectedItems();
1648 if (list
.isEmpty()) {
1649 stateChanged("has_no_selection");
1651 stateChanged("has_selection");
1653 KActionCollection
* col
= actionCollection();
1654 QAction
* renameAction
= col
->action("rename");
1655 QAction
* moveToTrashAction
= col
->action("move_to_trash");
1656 QAction
* deleteAction
= col
->action("delete");
1657 QAction
* cutAction
= col
->action(KStandardAction::name(KStandardAction::Cut
));
1658 QAction
* deleteWithTrashShortcut
= col
->action("delete_shortcut"); // see DolphinViewActionHandler
1660 KFileItemListProperties
capabilities(list
);
1661 const bool enableMoveToTrash
= capabilities
.isLocal() && capabilities
.supportsMoving();
1663 renameAction
->setEnabled(capabilities
.supportsMoving());
1664 moveToTrashAction
->setEnabled(enableMoveToTrash
);
1665 deleteAction
->setEnabled(capabilities
.supportsDeleting());
1666 deleteWithTrashShortcut
->setEnabled(capabilities
.supportsDeleting() && !enableMoveToTrash
);
1667 cutAction
->setEnabled(capabilities
.supportsMoving());
1669 updatePasteAction();
1672 void DolphinMainWindow::updateViewActions()
1674 m_actionHandler
->updateViewActions();
1676 QAction
* showFilterBarAction
= actionCollection()->action("show_filter_bar");
1677 showFilterBarAction
->setChecked(m_activeViewContainer
->isFilterBarVisible());
1679 updateSplitAction();
1681 QAction
* editableLocactionAction
= actionCollection()->action("editable_location");
1682 const KUrlNavigator
* urlNavigator
= m_activeViewContainer
->urlNavigator();
1683 editableLocactionAction
->setChecked(urlNavigator
->isUrlEditable());
1686 void DolphinMainWindow::updateGoActions()
1688 QAction
* goUpAction
= actionCollection()->action(KStandardAction::name(KStandardAction::Up
));
1689 const KUrl currentUrl
= m_activeViewContainer
->url();
1690 goUpAction
->setEnabled(currentUrl
.upUrl() != currentUrl
);
1693 void DolphinMainWindow::rememberClosedTab(int index
)
1695 KMenu
* tabsMenu
= m_recentTabsMenu
->menu();
1697 const QString primaryPath
= m_viewTab
[index
].primaryView
->url().path();
1698 const QString iconName
= KMimeType::iconNameForUrl(primaryPath
);
1700 QAction
* action
= new QAction(squeezedText(primaryPath
), tabsMenu
);
1702 ClosedTab closedTab
;
1703 closedTab
.primaryUrl
= m_viewTab
[index
].primaryView
->url();
1705 if (m_viewTab
[index
].secondaryView
!= 0) {
1706 closedTab
.secondaryUrl
= m_viewTab
[index
].secondaryView
->url();
1707 closedTab
.isSplit
= true;
1709 closedTab
.isSplit
= false;
1712 action
->setData(QVariant::fromValue(closedTab
));
1713 action
->setIcon(KIcon(iconName
));
1715 // add the closed tab menu entry after the separator and
1716 // "Empty Recently Closed Tabs" entry
1717 if (tabsMenu
->actions().size() == 2) {
1718 tabsMenu
->addAction(action
);
1720 tabsMenu
->insertAction(tabsMenu
->actions().at(2), action
);
1723 // assure that only up to 8 closed tabs are shown in the menu
1724 if (tabsMenu
->actions().size() > 8) {
1725 tabsMenu
->removeAction(tabsMenu
->actions().last());
1727 actionCollection()->action("closed_tabs")->setEnabled(true);
1728 KAcceleratorManager::manage(tabsMenu
);
1731 void DolphinMainWindow::clearStatusBar()
1733 m_activeViewContainer
->statusBar()->clear();
1736 void DolphinMainWindow::connectViewSignals(DolphinViewContainer
* container
)
1738 connect(container
, SIGNAL(showFilterBarChanged(bool)),
1739 this, SLOT(updateFilterBarAction(bool)));
1740 connect(container
, SIGNAL(writeStateChanged(bool)),
1741 this, SLOT(slotWriteStateChanged(bool)));
1743 DolphinView
* view
= container
->view();
1744 connect(view
, SIGNAL(selectionChanged(KFileItemList
)),
1745 this, SLOT(slotSelectionChanged(KFileItemList
)));
1746 connect(view
, SIGNAL(requestItemInfo(KFileItem
)),
1747 this, SLOT(slotRequestItemInfo(KFileItem
)));
1748 connect(view
, SIGNAL(activated()),
1749 this, SLOT(toggleActiveView()));
1750 connect(view
, SIGNAL(tabRequested(const KUrl
&)),
1751 this, SLOT(openNewTab(const KUrl
&)));
1752 connect(view
, SIGNAL(requestContextMenu(KFileItem
, const KUrl
&, const QList
<QAction
*>&)),
1753 this, SLOT(openContextMenu(KFileItem
, const KUrl
&, const QList
<QAction
*>&)));
1754 connect(view
, SIGNAL(startedPathLoading(KUrl
)),
1755 this, SLOT(enableStopAction()));
1756 connect(view
, SIGNAL(finishedPathLoading(KUrl
)),
1757 this, SLOT(disableStopAction()));
1759 const KUrlNavigator
* navigator
= container
->urlNavigator();
1760 connect(navigator
, SIGNAL(urlChanged(const KUrl
&)),
1761 this, SLOT(changeUrl(const KUrl
&)));
1762 connect(navigator
, SIGNAL(historyChanged()),
1763 this, SLOT(updateHistory()));
1764 connect(navigator
, SIGNAL(editableStateChanged(bool)),
1765 this, SLOT(slotEditableStateChanged(bool)));
1766 connect(navigator
, SIGNAL(tabRequested(const KUrl
&)),
1767 this, SLOT(openNewTab(KUrl
)));
1770 void DolphinMainWindow::updateSplitAction()
1772 QAction
* splitAction
= actionCollection()->action("split_view");
1773 if (m_viewTab
[m_tabIndex
].secondaryView
!= 0) {
1774 if (m_activeViewContainer
== m_viewTab
[m_tabIndex
].secondaryView
) {
1775 splitAction
->setText(i18nc("@action:intoolbar Close right view", "Close"));
1776 splitAction
->setToolTip(i18nc("@info", "Close right view"));
1777 splitAction
->setIcon(KIcon("view-right-close"));
1779 splitAction
->setText(i18nc("@action:intoolbar Close left view", "Close"));
1780 splitAction
->setToolTip(i18nc("@info", "Close left view"));
1781 splitAction
->setIcon(KIcon("view-left-close"));
1784 splitAction
->setText(i18nc("@action:intoolbar Split view", "Split"));
1785 splitAction
->setToolTip(i18nc("@info", "Split view"));
1786 splitAction
->setIcon(KIcon("view-right-new"));
1790 QString
DolphinMainWindow::tabName(const KUrl
& url
) const
1793 if (url
.equals(KUrl("file:///"))) {
1796 name
= url
.fileName();
1797 if (name
.isEmpty()) {
1798 name
= url
.protocol();
1800 // Make sure that a '&' inside the directory name is displayed correctly
1801 // and not misinterpreted as a keyboard shortcut in QTabBar::setTabText()
1802 name
.replace('&', "&&");
1808 bool DolphinMainWindow::isKompareInstalled() const
1810 static bool initialized
= false;
1811 static bool installed
= false;
1813 // TODO: maybe replace this approach later by using a menu
1814 // plugin like kdiff3plugin.cpp
1815 installed
= !KGlobal::dirs()->findExe("kompare").isEmpty();
1821 void DolphinMainWindow::createSecondaryView(int tabIndex
)
1823 QSplitter
* splitter
= m_viewTab
[tabIndex
].splitter
;
1824 const int newWidth
= (m_viewTab
[tabIndex
].primaryView
->width() - splitter
->handleWidth()) / 2;
1826 const DolphinView
* view
= m_viewTab
[tabIndex
].primaryView
->view();
1827 m_viewTab
[tabIndex
].secondaryView
= new DolphinViewContainer(view
->rootUrl(), 0);
1828 splitter
->addWidget(m_viewTab
[tabIndex
].secondaryView
);
1829 splitter
->setSizes(QList
<int>() << newWidth
<< newWidth
);
1830 connectViewSignals(m_viewTab
[tabIndex
].secondaryView
);
1831 m_viewTab
[tabIndex
].secondaryView
->view()->reload();
1832 m_viewTab
[tabIndex
].secondaryView
->setActive(false);
1833 m_viewTab
[tabIndex
].secondaryView
->show();
1836 QString
DolphinMainWindow::tabProperty(const QString
& property
, int tabIndex
) const
1838 return "Tab " + QString::number(tabIndex
) + ' ' + property
;
1841 void DolphinMainWindow::setUrlAsCaption(const KUrl
& url
)
1844 if (!url
.isLocalFile()) {
1845 caption
.append(url
.protocol() + " - ");
1846 if (url
.hasHost()) {
1847 caption
.append(url
.host() + " - ");
1851 const QString fileName
= url
.fileName().isEmpty() ? "/" : url
.fileName();
1852 caption
.append(fileName
);
1854 setCaption(caption
);
1857 QString
DolphinMainWindow::squeezedText(const QString
& text
) const
1859 const QFontMetrics fm
= fontMetrics();
1860 return fm
.elidedText(text
, Qt::ElideMiddle
, fm
.maxWidth() * 10);
1863 DolphinMainWindow::UndoUiInterface::UndoUiInterface() :
1864 KIO::FileUndoManager::UiInterface()
1868 DolphinMainWindow::UndoUiInterface::~UndoUiInterface()
1872 void DolphinMainWindow::UndoUiInterface::jobError(KIO::Job
* job
)
1874 DolphinMainWindow
* mainWin
= qobject_cast
<DolphinMainWindow
*>(parentWidget());
1876 DolphinStatusBar
* statusBar
= mainWin
->activeViewContainer()->statusBar();
1877 statusBar
->setMessage(job
->errorString(), DolphinStatusBar::Error
);
1879 KIO::FileUndoManager::UiInterface::jobError(job
);
1883 #include "dolphinmainwindow.moc"