1 /***************************************************************************
2 * Copyright (C) 2006 by Peter Penz <peter.penz19@gmail.com> *
3 * Copyright (C) 2006 by Stefan Monov <logixoul@gmail.com> *
4 * Copyright (C) 2006 by Cvetoslav Ludmiloff <ludmiloff@gmail.com> *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the *
18 * Free Software Foundation, Inc., *
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
20 ***************************************************************************/
22 #include "dolphinmainwindow.h"
24 #include "dolphinapplication.h"
25 #include "dolphindockwidget.h"
26 #include "dolphincontextmenu.h"
27 #include "dolphinnewfilemenu.h"
28 #include "dolphinrecenttabsmenu.h"
29 #include "dolphinviewcontainer.h"
30 #include "dolphintabpage.h"
31 #include "panels/folders/folderspanel.h"
32 #include "panels/places/placespanel.h"
33 #include "panels/information/informationpanel.h"
34 #include "settings/dolphinsettingsdialog.h"
35 #include "statusbar/dolphinstatusbar.h"
36 #include "views/dolphinviewactionhandler.h"
37 #include "views/dolphinremoteencoding.h"
38 #include "views/draganddrophelper.h"
39 #include "views/viewproperties.h"
40 #include "views/dolphinnewfilemenuobserver.h"
43 #include "panels/terminal/terminalpanel.h"
46 #include "dolphin_generalsettings.h"
48 #include <KAcceleratorManager>
50 #include <KActionCollection>
51 #include <KActionMenu>
53 #include <KDesktopFile>
54 #include <kdeversion.h>
55 #include <kdualaction.h>
56 #include <KFileDialog>
61 #include <KIconLoader>
62 #include <KIO/NetAccess>
63 #include <KIO/JobUiDelegate>
64 #include <KInputDialog>
66 #include <KProtocolManager>
69 #include <KMessageBox>
70 #include <KFileItemListProperties>
71 #include <konqmimedata.h>
72 #include <KProtocolInfo>
75 #include <KStandardDirs>
76 #include <kstatusbar.h>
77 #include <KStandardAction>
79 #include <KToggleAction>
80 #include <KUrlNavigator>
82 #include <KUrlComboBox>
83 #include <KToolInvocation>
85 #include <QDesktopWidget>
86 #include <QDBusMessage>
89 #include <QToolButton>
92 // Used for GeneralSettings::version() to determine whether
93 // an updated version of Dolphin is running.
94 const int CurrentDolphinVersion
= 200;
97 DolphinMainWindow::DolphinMainWindow() :
101 m_activeViewContainer(0),
102 m_centralWidgetLayout(0),
109 m_updateToolBarTimer(0),
110 m_lastHandleUrlStatJob(0)
112 setObjectName("Dolphin#");
114 connect(&DolphinNewFileMenuObserver::instance(), SIGNAL(errorMessage(QString
)),
115 this, SLOT(showErrorMessage(QString
)));
117 KIO::FileUndoManager
* undoManager
= KIO::FileUndoManager::self();
118 undoManager
->setUiInterface(new UndoUiInterface());
120 connect(undoManager
, SIGNAL(undoAvailable(bool)),
121 this, SLOT(slotUndoAvailable(bool)));
122 connect(undoManager
, SIGNAL(undoTextChanged(QString
)),
123 this, SLOT(slotUndoTextChanged(QString
)));
124 connect(undoManager
, SIGNAL(jobRecordingStarted(CommandType
)),
125 this, SLOT(clearStatusBar()));
126 connect(undoManager
, SIGNAL(jobRecordingFinished(CommandType
)),
127 this, SLOT(showCommand(CommandType
)));
129 GeneralSettings
* generalSettings
= GeneralSettings::self();
130 const bool firstRun
= (generalSettings
->version() < 200);
132 generalSettings
->setViewPropsTimestamp(QDateTime::currentDateTime());
135 setAcceptDrops(true);
139 m_actionHandler
= new DolphinViewActionHandler(actionCollection(), this);
140 connect(m_actionHandler
, SIGNAL(actionBeingHandled()), SLOT(clearStatusBar()));
141 connect(m_actionHandler
, SIGNAL(createDirectory()), SLOT(createDirectory()));
143 m_remoteEncoding
= new DolphinRemoteEncoding(this, m_actionHandler
);
144 connect(this, SIGNAL(urlChanged(KUrl
)),
145 m_remoteEncoding
, SLOT(slotAboutToOpenUrl()));
147 m_tabBar
= new KTabBar(this);
148 m_tabBar
->setMovable(true);
149 m_tabBar
->setTabsClosable(true);
150 connect(m_tabBar
, SIGNAL(currentChanged(int)),
151 this, SLOT(setActiveTab(int)));
152 connect(m_tabBar
, SIGNAL(tabCloseRequested(int)),
153 this, SLOT(closeTab(int)));
154 connect(m_tabBar
, SIGNAL(contextMenu(int,QPoint
)),
155 this, SLOT(openTabContextMenu(int,QPoint
)));
156 connect(m_tabBar
, SIGNAL(newTabRequest()),
157 this, SLOT(openNewTab()));
158 connect(m_tabBar
, SIGNAL(testCanDecode(const QDragMoveEvent
*,bool&)),
159 this, SLOT(slotTestCanDecode(const QDragMoveEvent
*,bool&)));
160 connect(m_tabBar
, SIGNAL(mouseMiddleClick(int)),
161 this, SLOT(closeTab(int)));
162 connect(m_tabBar
, SIGNAL(tabMoved(int,int)),
163 this, SLOT(slotTabMoved(int,int)));
164 connect(m_tabBar
, SIGNAL(receivedDropEvent(int,QDropEvent
*)),
165 this, SLOT(tabDropEvent(int,QDropEvent
*)));
167 m_tabBar
->blockSignals(true); // signals get unblocked after at least 2 tabs are open
170 QWidget
* centralWidget
= new QWidget(this);
171 m_centralWidgetLayout
= new QVBoxLayout(centralWidget
);
172 m_centralWidgetLayout
->setSpacing(0);
173 m_centralWidgetLayout
->setMargin(0);
174 m_centralWidgetLayout
->addWidget(m_tabBar
);
176 setCentralWidget(centralWidget
);
179 setupGUI(Keys
| Save
| Create
| ToolBar
);
180 stateChanged("new_file");
182 QClipboard
* clipboard
= QApplication::clipboard();
183 connect(clipboard
, SIGNAL(dataChanged()),
184 this, SLOT(updatePasteAction()));
186 QAction
* showFilterBarAction
= actionCollection()->action("show_filter_bar");
187 showFilterBarAction
->setChecked(generalSettings
->filterBar());
190 menuBar()->setVisible(false);
191 // Assure a proper default size if Dolphin runs the first time
195 const bool showMenu
= !menuBar()->isHidden();
196 QAction
* showMenuBarAction
= actionCollection()->action(KStandardAction::name(KStandardAction::ShowMenubar
));
197 showMenuBarAction
->setChecked(showMenu
); // workaround for bug #171080
199 createControlButton();
203 DolphinMainWindow::~DolphinMainWindow()
207 void DolphinMainWindow::openDirectories(const QList
<KUrl
>& dirs
)
209 const bool hasSplitView
= GeneralSettings::splitView();
211 // Open each directory inside a new tab. If the "split view" option has been enabled,
212 // always show two directories within one tab.
213 QList
<KUrl
>::const_iterator it
= dirs
.constBegin();
214 while (it
!= dirs
.constEnd()) {
215 const KUrl
& primaryUrl
= *(it
++);
216 if (hasSplitView
&& (it
!= dirs
.constEnd())) {
217 const KUrl
& secondaryUrl
= *(it
++);
218 openNewTab(primaryUrl
, secondaryUrl
);
220 openNewTab(primaryUrl
);
225 void DolphinMainWindow::openFiles(const QList
<KUrl
>& files
)
227 if (files
.isEmpty()) {
231 // Get all distinct directories from 'files' and open a tab
232 // for each directory. If the "split view" option is enabled, two
233 // directories are shown inside one tab (see openDirectories()).
235 foreach (const KUrl
& url
, files
) {
236 const KUrl
dir(url
.directory());
237 if (!dirs
.contains(dir
)) {
242 openDirectories(dirs
);
244 // Select the files. Although the files can be split between several
245 // tabs, there is no need to split 'files' accordingly, as
246 // the DolphinView will just ignore invalid selections.
247 foreach (DolphinTabPage
* tabPage
, m_viewTab
) {
248 tabPage
->markUrlsAsSelected(files
);
249 tabPage
->markUrlAsCurrent(files
.first());
253 void DolphinMainWindow::showCommand(CommandType command
)
255 DolphinStatusBar
* statusBar
= m_activeViewContainer
->statusBar();
257 case KIO::FileUndoManager::Copy
:
258 statusBar
->setText(i18nc("@info:status", "Successfully copied."));
260 case KIO::FileUndoManager::Move
:
261 statusBar
->setText(i18nc("@info:status", "Successfully moved."));
263 case KIO::FileUndoManager::Link
:
264 statusBar
->setText(i18nc("@info:status", "Successfully linked."));
266 case KIO::FileUndoManager::Trash
:
267 statusBar
->setText(i18nc("@info:status", "Successfully moved to trash."));
269 case KIO::FileUndoManager::Rename
:
270 statusBar
->setText(i18nc("@info:status", "Successfully renamed."));
273 case KIO::FileUndoManager::Mkdir
:
274 statusBar
->setText(i18nc("@info:status", "Created folder."));
282 void DolphinMainWindow::pasteIntoFolder()
284 m_activeViewContainer
->view()->pasteIntoFolder();
287 void DolphinMainWindow::changeUrl(const KUrl
& url
)
289 if (!KProtocolManager::supportsListing(url
)) {
290 // The URL navigator only checks for validity, not
291 // if the URL can be listed. An error message is
292 // shown due to DolphinViewContainer::restoreView().
296 DolphinViewContainer
* view
= activeViewContainer();
303 setUrlAsCaption(url
);
305 const QString iconName
= KMimeType::iconNameForUrl(url
);
306 m_tabBar
->setTabIcon(m_tabIndex
, KIcon(iconName
));
307 m_tabBar
->setTabText(m_tabIndex
, squeezedText(tabName(view
->url())));
309 emit
urlChanged(url
);
313 void DolphinMainWindow::slotTerminalDirectoryChanged(const KUrl
& url
)
315 m_activeViewContainer
->setAutoGrabFocus(false);
317 m_activeViewContainer
->setAutoGrabFocus(true);
320 void DolphinMainWindow::slotEditableStateChanged(bool editable
)
322 KToggleAction
* editableLocationAction
=
323 static_cast<KToggleAction
*>(actionCollection()->action("editable_location"));
324 editableLocationAction
->setChecked(editable
);
327 void DolphinMainWindow::slotSelectionChanged(const KFileItemList
& selection
)
331 const int selectedUrlsCount
= m_viewTab
.at(m_tabIndex
)->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");
355 backAction
->setToolTip(i18nc("@info", "Go back"));
356 backAction
->setEnabled(index
< urlNavigator
->historySize() - 1);
359 QAction
* forwardAction
= actionCollection()->action("go_forward");
361 forwardAction
->setToolTip(i18nc("@info", "Go forward"));
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 KRun::run("dolphin %u", KUrl::List(), this);
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
& primaryUrl
, const KUrl
& secondaryUrl
)
398 QWidget
* focusWidget
= QApplication::focusWidget();
400 DolphinTabPage
* tabPage
= new DolphinTabPage(primaryUrl
, secondaryUrl
, this);
401 m_viewTab
.append(tabPage
);
403 connect(tabPage
, SIGNAL(activeViewChanged()),
404 this, SLOT(activeViewChanged()));
406 // The places-selector from the URL navigator should only be shown
407 // if the places dock is invisible
408 QDockWidget
* placesDock
= findChild
<QDockWidget
*>("placesDock");
409 const bool placesSelectorVisible
= !placesDock
|| !placesDock
->isVisible();
410 tabPage
->setPlacesSelectorVisible(placesSelectorVisible
);
412 DolphinViewContainer
* primaryContainer
= tabPage
->primaryViewContainer();
413 connectViewSignals(primaryContainer
);
415 if (tabPage
->splitViewEnabled()) {
416 DolphinViewContainer
* secondaryContainer
= tabPage
->secondaryViewContainer();
417 connectViewSignals(secondaryContainer
);
422 m_tabBar
->addTab(KIcon(KMimeType::iconNameForUrl(primaryUrl
)),
423 squeezedText(tabName(primaryUrl
)));
425 if (m_viewTab
.count() > 1) {
426 actionCollection()->action("close_tab")->setEnabled(true);
427 actionCollection()->action("activate_prev_tab")->setEnabled(true);
428 actionCollection()->action("activate_next_tab")->setEnabled(true);
430 m_tabBar
->blockSignals(false);
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::openNewActivatedTab(const KUrl
& primaryUrl
, const KUrl
& secondaryUrl
)
442 openNewTab(primaryUrl
, secondaryUrl
);
443 setActiveTab(m_viewTab
.count() - 1);
446 void DolphinMainWindow::activateNextTab()
448 if (m_viewTab
.count() >= 2) {
449 const int tabIndex
= (m_tabBar
->currentIndex() + 1) % m_tabBar
->count();
450 setActiveTab(tabIndex
);
454 void DolphinMainWindow::activatePrevTab()
456 if (m_viewTab
.count() >= 2) {
457 int tabIndex
= m_tabBar
->currentIndex() - 1;
458 if (tabIndex
== -1) {
459 tabIndex
= m_tabBar
->count() - 1;
461 setActiveTab(tabIndex
);
465 void DolphinMainWindow::openInNewTab()
467 const KFileItemList
& list
= m_activeViewContainer
->view()->selectedItems();
468 if (list
.isEmpty()) {
469 openNewTab(m_activeViewContainer
->url());
471 foreach (const KFileItem
& item
, list
) {
472 const KUrl
& url
= DolphinView::openItemAsFolderUrl(item
);
473 if (!url
.isEmpty()) {
480 void DolphinMainWindow::openInNewWindow()
484 const KFileItemList list
= m_activeViewContainer
->view()->selectedItems();
485 if (list
.isEmpty()) {
486 newWindowUrl
= m_activeViewContainer
->url();
487 } else if (list
.count() == 1) {
488 const KFileItem
& item
= list
.first();
489 newWindowUrl
= DolphinView::openItemAsFolderUrl(item
);
492 if (!newWindowUrl
.isEmpty()) {
493 KRun::run("dolphin %u", KUrl::List() << newWindowUrl
, this);
497 void DolphinMainWindow::showEvent(QShowEvent
* event
)
499 KXmlGuiWindow::showEvent(event
);
501 if (!m_activeViewContainer
&& m_viewTab
.count() > 0) {
502 // If we have no active view container yet, we set the primary view container
503 // of the first tab as active view container.
507 if (!event
->spontaneous()) {
508 m_activeViewContainer
->view()->setFocus();
512 void DolphinMainWindow::closeEvent(QCloseEvent
* event
)
514 // Find out if Dolphin is closed directly by the user or
515 // by the session manager because the session is closed
516 bool closedByUser
= true;
517 DolphinApplication
*application
= qobject_cast
<DolphinApplication
*>(qApp
);
518 if (application
&& application
->sessionSaving()) {
519 closedByUser
= false;
522 if (m_viewTab
.count() > 1 && GeneralSettings::confirmClosingMultipleTabs() && closedByUser
) {
523 // Ask the user if he really wants to quit and close all tabs.
524 // Open a confirmation dialog with 3 buttons:
525 // KDialog::Yes -> Quit
526 // KDialog::No -> Close only the current tab
527 // KDialog::Cancel -> do nothing
528 KDialog
*dialog
= new KDialog(this, Qt::Dialog
);
529 dialog
->setCaption(i18nc("@title:window", "Confirmation"));
530 dialog
->setButtons(KDialog::Yes
| KDialog::No
| KDialog::Cancel
);
531 dialog
->setModal(true);
532 dialog
->setButtonGuiItem(KDialog::Yes
, KStandardGuiItem::quit());
533 dialog
->setButtonGuiItem(KDialog::No
, KGuiItem(i18n("C&lose Current Tab"), KIcon("tab-close")));
534 dialog
->setButtonGuiItem(KDialog::Cancel
, KStandardGuiItem::cancel());
535 dialog
->setDefaultButton(KDialog::Yes
);
537 bool doNotAskAgainCheckboxResult
= false;
539 const int result
= KMessageBox::createKMessageBox(dialog
,
540 QMessageBox::Warning
,
541 i18n("You have multiple tabs open in this window, are you sure you want to quit?"),
543 i18n("Do not ask again"),
544 &doNotAskAgainCheckboxResult
,
545 KMessageBox::Notify
);
547 if (doNotAskAgainCheckboxResult
) {
548 GeneralSettings::setConfirmClosingMultipleTabs(false);
556 // Close only the current tab
564 GeneralSettings::setVersion(CurrentDolphinVersion
);
565 GeneralSettings::self()->writeConfig();
567 KXmlGuiWindow::closeEvent(event
);
570 void DolphinMainWindow::saveProperties(KConfigGroup
& group
)
572 const int tabCount
= m_viewTab
.count();
573 group
.writeEntry("Tab Count", tabCount
);
574 group
.writeEntry("Active Tab Index", m_tabBar
->currentIndex());
576 for (int i
= 0; i
< tabCount
; ++i
) {
577 const DolphinTabPage
* tabPage
= m_viewTab
.at(i
);
578 group
.writeEntry("Tab " % QString::number(i
), tabPage
->saveState());
582 void DolphinMainWindow::readProperties(const KConfigGroup
& group
)
584 const int tabCount
= group
.readEntry("Tab Count", 1);
585 for (int i
= 0; i
< tabCount
; ++i
) {
586 const QByteArray state
= group
.readEntry("Tab " % QString::number(i
), QByteArray());
587 DolphinTabPage
* tabPage
= m_viewTab
.at(i
);
588 tabPage
->restoreState(state
);
590 // openNewTab() needs to be called only tabCount - 1 times
591 if (i
!= tabCount
- 1) {
596 const int index
= group
.readEntry("Active Tab Index", 0);
597 m_tabBar
->setCurrentIndex(index
);
600 void DolphinMainWindow::updateNewMenu()
602 m_newFileMenu
->setViewShowsHiddenFiles(activeViewContainer()->view()->hiddenFilesShown());
603 m_newFileMenu
->checkUpToDate();
604 m_newFileMenu
->setPopupFiles(activeViewContainer()->url());
607 void DolphinMainWindow::createDirectory()
609 m_newFileMenu
->setViewShowsHiddenFiles(activeViewContainer()->view()->hiddenFilesShown());
610 m_newFileMenu
->setPopupFiles(activeViewContainer()->url());
611 m_newFileMenu
->createDirectory();
614 void DolphinMainWindow::quit()
619 void DolphinMainWindow::showErrorMessage(const QString
& message
)
621 m_activeViewContainer
->showMessage(message
, DolphinViewContainer::Error
);
624 void DolphinMainWindow::slotUndoAvailable(bool available
)
626 QAction
* undoAction
= actionCollection()->action(KStandardAction::name(KStandardAction::Undo
));
628 undoAction
->setEnabled(available
);
632 void DolphinMainWindow::slotUndoTextChanged(const QString
& text
)
634 QAction
* undoAction
= actionCollection()->action(KStandardAction::name(KStandardAction::Undo
));
636 undoAction
->setText(text
);
640 void DolphinMainWindow::undo()
643 KIO::FileUndoManager::self()->uiInterface()->setParentWidget(this);
644 KIO::FileUndoManager::self()->undo();
647 void DolphinMainWindow::cut()
649 m_activeViewContainer
->view()->cutSelectedItems();
652 void DolphinMainWindow::copy()
654 m_activeViewContainer
->view()->copySelectedItems();
657 void DolphinMainWindow::paste()
659 m_activeViewContainer
->view()->paste();
662 void DolphinMainWindow::find()
664 m_activeViewContainer
->setSearchModeEnabled(true);
667 void DolphinMainWindow::updatePasteAction()
669 QAction
* pasteAction
= actionCollection()->action(KStandardAction::name(KStandardAction::Paste
));
670 QPair
<bool, QString
> pasteInfo
= m_activeViewContainer
->view()->pasteInfo();
671 pasteAction
->setEnabled(pasteInfo
.first
);
672 pasteAction
->setText(pasteInfo
.second
);
675 void DolphinMainWindow::selectAll()
679 // if the URL navigator is editable and focused, select the whole
680 // URL instead of all items of the view
682 KUrlNavigator
* urlNavigator
= m_activeViewContainer
->urlNavigator();
683 QLineEdit
* lineEdit
= urlNavigator
->editor()->lineEdit(); // krazy:exclude=qclasses
684 const bool selectUrl
= urlNavigator
->isUrlEditable() &&
685 lineEdit
->hasFocus();
687 lineEdit
->selectAll();
689 m_activeViewContainer
->view()->selectAll();
693 void DolphinMainWindow::invertSelection()
696 m_activeViewContainer
->view()->invertSelection();
699 void DolphinMainWindow::toggleSplitView()
701 DolphinTabPage
* tabPage
= m_viewTab
.at(m_tabIndex
);
702 tabPage
->setSplitViewEnabled(!tabPage
->splitViewEnabled());
704 if (tabPage
->splitViewEnabled()) {
705 connectViewSignals(tabPage
->secondaryViewContainer());
711 void DolphinMainWindow::reloadView()
714 m_activeViewContainer
->view()->reload();
717 void DolphinMainWindow::stopLoading()
719 m_activeViewContainer
->view()->stopLoading();
722 void DolphinMainWindow::enableStopAction()
724 actionCollection()->action("stop")->setEnabled(true);
727 void DolphinMainWindow::disableStopAction()
729 actionCollection()->action("stop")->setEnabled(false);
732 void DolphinMainWindow::showFilterBar()
734 m_activeViewContainer
->setFilterBarVisible(true);
737 void DolphinMainWindow::toggleEditLocation()
741 QAction
* action
= actionCollection()->action("editable_location");
742 KUrlNavigator
* urlNavigator
= m_activeViewContainer
->urlNavigator();
743 urlNavigator
->setUrlEditable(action
->isChecked());
746 void DolphinMainWindow::replaceLocation()
748 KUrlNavigator
* navigator
= m_activeViewContainer
->urlNavigator();
749 navigator
->setUrlEditable(true);
750 navigator
->setFocus();
752 // select the whole text of the combo box editor
753 QLineEdit
* lineEdit
= navigator
->editor()->lineEdit(); // krazy:exclude=qclasses
754 lineEdit
->selectAll();
757 void DolphinMainWindow::togglePanelLockState()
759 const bool newLockState
= !GeneralSettings::lockPanels();
760 foreach (QObject
* child
, children()) {
761 DolphinDockWidget
* dock
= qobject_cast
<DolphinDockWidget
*>(child
);
763 dock
->setLocked(newLockState
);
767 GeneralSettings::setLockPanels(newLockState
);
770 void DolphinMainWindow::slotPlacesPanelVisibilityChanged(bool visible
)
772 foreach (DolphinTabPage
* tabPage
, m_viewTab
) {
773 tabPage
->setPlacesSelectorVisible(visible
);
777 void DolphinMainWindow::goBack()
779 KUrlNavigator
* urlNavigator
= m_activeViewContainer
->urlNavigator();
780 urlNavigator
->goBack();
782 if (urlNavigator
->locationState().isEmpty()) {
783 // An empty location state indicates a redirection URL,
784 // which must be skipped too
785 urlNavigator
->goBack();
789 void DolphinMainWindow::goForward()
791 m_activeViewContainer
->urlNavigator()->goForward();
794 void DolphinMainWindow::goUp()
796 m_activeViewContainer
->urlNavigator()->goUp();
799 void DolphinMainWindow::goHome()
801 m_activeViewContainer
->urlNavigator()->goHome();
804 void DolphinMainWindow::goBack(Qt::MouseButtons buttons
)
806 // The default case (left button pressed) is handled in goBack().
807 if (buttons
== Qt::MidButton
) {
808 KUrlNavigator
* urlNavigator
= activeViewContainer()->urlNavigator();
809 const int index
= urlNavigator
->historyIndex() + 1;
810 openNewTab(urlNavigator
->locationUrl(index
));
814 void DolphinMainWindow::goForward(Qt::MouseButtons buttons
)
816 // The default case (left button pressed) is handled in goForward().
817 if (buttons
== Qt::MidButton
) {
818 KUrlNavigator
* urlNavigator
= activeViewContainer()->urlNavigator();
819 const int index
= urlNavigator
->historyIndex() - 1;
820 openNewTab(urlNavigator
->locationUrl(index
));
824 void DolphinMainWindow::goUp(Qt::MouseButtons buttons
)
826 // The default case (left button pressed) is handled in goUp().
827 if (buttons
== Qt::MidButton
) {
828 openNewTab(activeViewContainer()->url().upUrl());
832 void DolphinMainWindow::goHome(Qt::MouseButtons buttons
)
834 // The default case (left button pressed) is handled in goHome().
835 if (buttons
== Qt::MidButton
) {
836 openNewTab(GeneralSettings::self()->homeUrl());
840 void DolphinMainWindow::compareFiles()
842 const KFileItemList items
= m_viewTab
.at(m_tabIndex
)->selectedItems();
843 if (items
.count() != 2) {
844 // The action is disabled in this case, but it could have been triggered
845 // via D-Bus, see https://bugs.kde.org/show_bug.cgi?id=325517
849 KUrl urlA
= items
.at(0).url();
850 KUrl urlB
= items
.at(1).url();
852 QString
command("kompare -c \"");
853 command
.append(urlA
.pathOrUrl());
854 command
.append("\" \"");
855 command
.append(urlB
.pathOrUrl());
856 command
.append('\"');
857 KRun::runCommand(command
, "Kompare", "kompare", this);
860 void DolphinMainWindow::toggleShowMenuBar()
862 const bool visible
= menuBar()->isVisible();
863 menuBar()->setVisible(!visible
);
865 createControlButton();
867 deleteControlButton();
871 void DolphinMainWindow::openTerminal()
873 QString
dir(QDir::homePath());
875 // If the given directory is not local, it can still be the URL of an
876 // ioslave using UDS_LOCAL_PATH which to be converted first.
877 KUrl url
= KIO::NetAccess::mostLocalUrl(m_activeViewContainer
->url(), this);
879 //If the URL is local after the above conversion, set the directory.
880 if (url
.isLocalFile()) {
881 dir
= url
.toLocalFile();
884 KToolInvocation::invokeTerminal(QString(), dir
);
887 void DolphinMainWindow::editSettings()
889 if (!m_settingsDialog
) {
890 DolphinViewContainer
* container
= activeViewContainer();
891 container
->view()->writeSettings();
893 const KUrl url
= container
->url();
894 DolphinSettingsDialog
* settingsDialog
= new DolphinSettingsDialog(url
, this);
895 connect(settingsDialog
, SIGNAL(settingsChanged()), this, SLOT(refreshViews()));
896 settingsDialog
->setAttribute(Qt::WA_DeleteOnClose
);
897 settingsDialog
->show();
898 m_settingsDialog
= settingsDialog
;
900 m_settingsDialog
.data()->raise();
904 void DolphinMainWindow::setActiveTab(int index
)
906 Q_ASSERT(index
>= 0);
907 Q_ASSERT(index
< m_viewTab
.count());
908 if (index
== m_tabIndex
) {
912 m_tabBar
->setCurrentIndex(index
);
914 // hide current tab content
915 if (m_tabIndex
>= 0) {
916 DolphinTabPage
* hiddenTabPage
= m_viewTab
.at(m_tabIndex
);
917 hiddenTabPage
->hide();
918 m_centralWidgetLayout
->removeWidget(hiddenTabPage
);
921 // show active tab content
924 DolphinTabPage
* tabPage
= m_viewTab
.at(index
);
925 m_centralWidgetLayout
->addWidget(tabPage
, 1);
928 setActiveViewContainer(tabPage
->activeViewContainer());
931 void DolphinMainWindow::closeTab()
933 closeTab(m_tabBar
->currentIndex());
936 void DolphinMainWindow::closeTab(int index
)
938 Q_ASSERT(index
>= 0);
939 Q_ASSERT(index
< m_viewTab
.count());
940 if (m_viewTab
.count() == 1) {
941 // the last tab may never get closed
945 if (index
== m_tabIndex
) {
946 // The tab that should be closed is the active tab. Activate the
947 // previous tab before closing the tab.
948 m_tabBar
->setCurrentIndex((index
> 0) ? index
- 1 : 1);
951 DolphinTabPage
* tabPage
= m_viewTab
.at(index
);
953 if (tabPage
->splitViewEnabled()) {
954 emit
rememberClosedTab(tabPage
->primaryViewContainer()->url(),
955 tabPage
->secondaryViewContainer()->url());
957 emit
rememberClosedTab(tabPage
->primaryViewContainer()->url(), KUrl());
961 m_viewTab
.removeAt(index
);
962 tabPage
->deleteLater();
964 m_tabBar
->blockSignals(true);
965 m_tabBar
->removeTab(index
);
967 if (m_tabIndex
> index
) {
969 Q_ASSERT(m_tabIndex
>= 0);
972 // if only one tab is left, also remove the tab entry so that
973 // closing the last tab is not possible
974 if (m_viewTab
.count() < 2) {
975 actionCollection()->action("close_tab")->setEnabled(false);
976 actionCollection()->action("activate_prev_tab")->setEnabled(false);
977 actionCollection()->action("activate_next_tab")->setEnabled(false);
980 m_tabBar
->blockSignals(false);
984 void DolphinMainWindow::openTabContextMenu(int index
, const QPoint
& pos
)
988 QAction
* newTabAction
= menu
.addAction(KIcon("tab-new"), i18nc("@action:inmenu", "New Tab"));
989 newTabAction
->setShortcut(actionCollection()->action("new_tab")->shortcut());
991 QAction
* detachTabAction
= menu
.addAction(KIcon("tab-detach"), i18nc("@action:inmenu", "Detach Tab"));
993 QAction
* closeOtherTabsAction
= menu
.addAction(KIcon("tab-close-other"), i18nc("@action:inmenu", "Close Other Tabs"));
995 QAction
* closeTabAction
= menu
.addAction(KIcon("tab-close"), i18nc("@action:inmenu", "Close Tab"));
996 closeTabAction
->setShortcut(actionCollection()->action("close_tab")->shortcut());
997 QAction
* selectedAction
= menu
.exec(pos
);
998 if (selectedAction
== newTabAction
) {
999 const KUrl url
= m_viewTab
.at(index
)->activeViewContainer()->url();
1001 m_tabBar
->setCurrentIndex(m_viewTab
.count() - 1);
1002 } else if (selectedAction
== detachTabAction
) {
1003 const QString
separator(QLatin1Char(' '));
1004 QString command
= QLatin1String("dolphin");
1006 const DolphinTabPage
* tabPage
= m_viewTab
.at(index
);
1008 command
+= separator
+ tabPage
->primaryViewContainer()->url().url();
1009 if (tabPage
->splitViewEnabled()) {
1010 command
+= separator
+ tabPage
->secondaryViewContainer()->url().url();
1011 command
+= separator
+ QLatin1String("-split");
1014 KRun::runCommand(command
, this);
1017 } else if (selectedAction
== closeOtherTabsAction
) {
1018 const int count
= m_tabBar
->count();
1019 for (int i
= 0; i
< index
; ++i
) {
1022 for (int i
= index
+ 1; i
< count
; ++i
) {
1025 } else if (selectedAction
== closeTabAction
) {
1030 void DolphinMainWindow::slotTabMoved(int from
, int to
)
1032 m_viewTab
.move(from
, to
);
1033 m_tabIndex
= m_tabBar
->currentIndex();
1036 void DolphinMainWindow::slotTestCanDecode(const QDragMoveEvent
* event
, bool& canDecode
)
1038 canDecode
= KUrl::List::canDecode(event
->mimeData());
1041 void DolphinMainWindow::handleUrl(const KUrl
& url
)
1043 delete m_lastHandleUrlStatJob
;
1044 m_lastHandleUrlStatJob
= 0;
1046 if (url
.isLocalFile() && QFileInfo(url
.toLocalFile()).isDir()) {
1047 activeViewContainer()->setUrl(url
);
1048 } else if (KProtocolManager::supportsListing(url
)) {
1049 // stat the URL to see if it is a dir or not
1050 m_lastHandleUrlStatJob
= KIO::stat(url
, KIO::HideProgressInfo
);
1051 if (m_lastHandleUrlStatJob
->ui()) {
1052 m_lastHandleUrlStatJob
->ui()->setWindow(this);
1054 connect(m_lastHandleUrlStatJob
, SIGNAL(result(KJob
*)),
1055 this, SLOT(slotHandleUrlStatFinished(KJob
*)));
1058 new KRun(url
, this); // Automatically deletes itself after being finished
1062 void DolphinMainWindow::slotHandleUrlStatFinished(KJob
* job
)
1064 m_lastHandleUrlStatJob
= 0;
1065 const KIO::UDSEntry entry
= static_cast<KIO::StatJob
*>(job
)->statResult();
1066 const KUrl url
= static_cast<KIO::StatJob
*>(job
)->url();
1067 if (entry
.isDir()) {
1068 activeViewContainer()->setUrl(url
);
1070 new KRun(url
, this); // Automatically deletes itself after being finished
1074 void DolphinMainWindow::tabDropEvent(int tab
, QDropEvent
* event
)
1076 const KUrl::List urls
= KUrl::List::fromMimeData(event
->mimeData());
1077 if (!urls
.isEmpty() && tab
!= -1) {
1078 const DolphinView
* view
= m_viewTab
.at(tab
)->activeViewContainer()->view();
1081 DragAndDropHelper::dropUrls(view
->rootItem(), view
->url(), event
, error
);
1082 if (!error
.isEmpty()) {
1083 activeViewContainer()->showMessage(error
, DolphinViewContainer::Error
);
1088 void DolphinMainWindow::slotWriteStateChanged(bool isFolderWritable
)
1090 newFileMenu()->setEnabled(isFolderWritable
);
1093 void DolphinMainWindow::openContextMenu(const QPoint
& pos
,
1094 const KFileItem
& item
,
1096 const QList
<QAction
*>& customActions
)
1098 QWeakPointer
<DolphinContextMenu
> contextMenu
= new DolphinContextMenu(this, pos
, item
, url
);
1099 contextMenu
.data()->setCustomActions(customActions
);
1100 const DolphinContextMenu::Command command
= contextMenu
.data()->open();
1103 case DolphinContextMenu::OpenParentFolderInNewWindow
: {
1104 KRun::run("dolphin %u", KUrl::List() << item
.url().upUrl(), this);
1108 case DolphinContextMenu::OpenParentFolderInNewTab
:
1109 openNewTab(item
.url().upUrl());
1112 case DolphinContextMenu::None
:
1117 delete contextMenu
.data();
1120 void DolphinMainWindow::updateControlMenu()
1122 KMenu
* menu
= qobject_cast
<KMenu
*>(sender());
1125 // All actions get cleared by KMenu::clear(). The sub-menus are deleted
1126 // by connecting to the aboutToHide() signal from the parent-menu.
1129 KActionCollection
* ac
= actionCollection();
1131 // Add "Edit" actions
1132 bool added
= addActionToMenu(ac
->action(KStandardAction::name(KStandardAction::Undo
)), menu
) |
1133 addActionToMenu(ac
->action(KStandardAction::name(KStandardAction::Find
)), menu
) |
1134 addActionToMenu(ac
->action("select_all"), menu
) |
1135 addActionToMenu(ac
->action("invert_selection"), menu
);
1138 menu
->addSeparator();
1141 // Add "View" actions
1142 if (!GeneralSettings::showZoomSlider()) {
1143 addActionToMenu(ac
->action(KStandardAction::name(KStandardAction::ZoomIn
)), menu
);
1144 addActionToMenu(ac
->action(KStandardAction::name(KStandardAction::ZoomOut
)), menu
);
1145 menu
->addSeparator();
1148 added
= addActionToMenu(ac
->action("view_mode"), menu
) |
1149 addActionToMenu(ac
->action("sort"), menu
) |
1150 addActionToMenu(ac
->action("additional_info"), menu
) |
1151 addActionToMenu(ac
->action("show_preview"), menu
) |
1152 addActionToMenu(ac
->action("show_in_groups"), menu
) |
1153 addActionToMenu(ac
->action("show_hidden_files"), menu
);
1156 menu
->addSeparator();
1159 added
= addActionToMenu(ac
->action("split_view"), menu
) |
1160 addActionToMenu(ac
->action("reload"), menu
) |
1161 addActionToMenu(ac
->action("view_properties"), menu
);
1163 menu
->addSeparator();
1166 addActionToMenu(ac
->action("panels"), menu
);
1167 KMenu
* locationBarMenu
= new KMenu(i18nc("@action:inmenu", "Location Bar"), menu
);
1168 locationBarMenu
->addAction(ac
->action("editable_location"));
1169 locationBarMenu
->addAction(ac
->action("replace_location"));
1170 menu
->addMenu(locationBarMenu
);
1172 menu
->addSeparator();
1175 KMenu
* goMenu
= new KMenu(i18nc("@action:inmenu", "Go"), menu
);
1176 connect(menu
, SIGNAL(aboutToHide()), goMenu
, SLOT(deleteLater()));
1177 goMenu
->addAction(ac
->action(KStandardAction::name(KStandardAction::Back
)));
1178 goMenu
->addAction(ac
->action(KStandardAction::name(KStandardAction::Forward
)));
1179 goMenu
->addAction(ac
->action(KStandardAction::name(KStandardAction::Up
)));
1180 goMenu
->addAction(ac
->action(KStandardAction::name(KStandardAction::Home
)));
1181 goMenu
->addAction(ac
->action("closed_tabs"));
1182 menu
->addMenu(goMenu
);
1185 KMenu
* toolsMenu
= new KMenu(i18nc("@action:inmenu", "Tools"), menu
);
1186 connect(menu
, SIGNAL(aboutToHide()), toolsMenu
, SLOT(deleteLater()));
1187 toolsMenu
->addAction(ac
->action("show_filter_bar"));
1188 toolsMenu
->addAction(ac
->action("compare_files"));
1189 toolsMenu
->addAction(ac
->action("open_terminal"));
1190 toolsMenu
->addAction(ac
->action("change_remote_encoding"));
1191 menu
->addMenu(toolsMenu
);
1193 // Add "Settings" menu entries
1194 addActionToMenu(ac
->action(KStandardAction::name(KStandardAction::KeyBindings
)), menu
);
1195 addActionToMenu(ac
->action(KStandardAction::name(KStandardAction::ConfigureToolbars
)), menu
);
1196 addActionToMenu(ac
->action(KStandardAction::name(KStandardAction::Preferences
)), menu
);
1199 KMenu
* helpMenu
= new KMenu(i18nc("@action:inmenu", "Help"), menu
);
1200 connect(menu
, SIGNAL(aboutToHide()), helpMenu
, SLOT(deleteLater()));
1201 helpMenu
->addAction(ac
->action(KStandardAction::name(KStandardAction::HelpContents
)));
1202 helpMenu
->addAction(ac
->action(KStandardAction::name(KStandardAction::WhatsThis
)));
1203 helpMenu
->addSeparator();
1204 helpMenu
->addAction(ac
->action(KStandardAction::name(KStandardAction::ReportBug
)));
1205 helpMenu
->addSeparator();
1206 helpMenu
->addAction(ac
->action(KStandardAction::name(KStandardAction::SwitchApplicationLanguage
)));
1207 helpMenu
->addSeparator();
1208 helpMenu
->addAction(ac
->action(KStandardAction::name(KStandardAction::AboutApp
)));
1209 helpMenu
->addAction(ac
->action(KStandardAction::name(KStandardAction::AboutKDE
)));
1210 menu
->addMenu(helpMenu
);
1212 menu
->addSeparator();
1213 addActionToMenu(ac
->action(KStandardAction::name(KStandardAction::ShowMenubar
)), menu
);
1216 void DolphinMainWindow::updateToolBar()
1218 if (!menuBar()->isVisible()) {
1219 createControlButton();
1223 void DolphinMainWindow::slotControlButtonDeleted()
1225 m_controlButton
= 0;
1226 m_updateToolBarTimer
->start();
1229 void DolphinMainWindow::slotPanelErrorMessage(const QString
& error
)
1231 activeViewContainer()->showMessage(error
, DolphinViewContainer::Error
);
1234 void DolphinMainWindow::slotPlaceActivated(const KUrl
& url
)
1236 DolphinViewContainer
* view
= activeViewContainer();
1238 if (view
->url() == url
) {
1239 // We can end up here if the user clicked a device in the Places Panel
1240 // which had been unmounted earlier, see https://bugs.kde.org/show_bug.cgi?id=161385.
1247 void DolphinMainWindow::activeViewChanged()
1249 const DolphinTabPage
* tabPage
= m_viewTab
.at(m_tabIndex
);
1250 setActiveViewContainer(tabPage
->activeViewContainer());
1253 void DolphinMainWindow::setActiveViewContainer(DolphinViewContainer
* viewContainer
)
1255 Q_ASSERT(viewContainer
);
1256 Q_ASSERT((viewContainer
== m_viewTab
.at(m_tabIndex
)->primaryViewContainer()) ||
1257 (viewContainer
== m_viewTab
.at(m_tabIndex
)->secondaryViewContainer()));
1258 if (m_activeViewContainer
== viewContainer
) {
1262 m_activeViewContainer
= viewContainer
;
1263 m_actionHandler
->setCurrentView(viewContainer
->view());
1266 updateEditActions();
1267 updatePasteAction();
1268 updateViewActions();
1271 const KUrl url
= m_activeViewContainer
->url();
1272 setUrlAsCaption(url
);
1273 m_tabBar
->setTabText(m_tabIndex
, squeezedText(tabName(url
)));
1274 m_tabBar
->setTabIcon(m_tabIndex
, KIcon(KMimeType::iconNameForUrl(url
)));
1276 emit
urlChanged(url
);
1279 void DolphinMainWindow::setupActions()
1281 // setup 'File' menu
1282 m_newFileMenu
= new DolphinNewFileMenu(actionCollection(), this);
1283 KMenu
* menu
= m_newFileMenu
->menu();
1284 menu
->setTitle(i18nc("@title:menu Create new folder, file, link, etc.", "Create New"));
1285 menu
->setIcon(KIcon("document-new"));
1286 m_newFileMenu
->setDelayed(false);
1287 connect(menu
, SIGNAL(aboutToShow()),
1288 this, SLOT(updateNewMenu()));
1290 KAction
* newWindow
= actionCollection()->addAction("new_window");
1291 newWindow
->setIcon(KIcon("window-new"));
1292 newWindow
->setText(i18nc("@action:inmenu File", "New &Window"));
1293 newWindow
->setShortcut(Qt::CTRL
| Qt::Key_N
);
1294 connect(newWindow
, SIGNAL(triggered()), this, SLOT(openNewMainWindow()));
1296 KAction
* newTab
= actionCollection()->addAction("new_tab");
1297 newTab
->setIcon(KIcon("tab-new"));
1298 newTab
->setText(i18nc("@action:inmenu File", "New Tab"));
1299 newTab
->setShortcut(KShortcut(Qt::CTRL
| Qt::Key_T
, Qt::CTRL
| Qt::SHIFT
| Qt::Key_N
));
1300 connect(newTab
, SIGNAL(triggered()), this, SLOT(openNewTab()));
1302 KAction
* closeTab
= actionCollection()->addAction("close_tab");
1303 closeTab
->setIcon(KIcon("tab-close"));
1304 closeTab
->setText(i18nc("@action:inmenu File", "Close Tab"));
1305 closeTab
->setShortcut(Qt::CTRL
| Qt::Key_W
);
1306 closeTab
->setEnabled(false);
1307 connect(closeTab
, SIGNAL(triggered()), this, SLOT(closeTab()));
1309 KStandardAction::quit(this, SLOT(quit()), actionCollection());
1311 // setup 'Edit' menu
1312 KStandardAction::undo(this,
1314 actionCollection());
1316 // need to remove shift+del from cut action, else the shortcut for deletejob
1318 KAction
* cut
= KStandardAction::cut(this, SLOT(cut()), actionCollection());
1319 KShortcut cutShortcut
= cut
->shortcut();
1320 cutShortcut
.remove(Qt::SHIFT
| Qt::Key_Delete
, KShortcut::KeepEmpty
);
1321 cut
->setShortcut(cutShortcut
);
1322 KStandardAction::copy(this, SLOT(copy()), actionCollection());
1323 KAction
* paste
= KStandardAction::paste(this, SLOT(paste()), actionCollection());
1324 // The text of the paste-action is modified dynamically by Dolphin
1325 // (e. g. to "Paste One Folder"). To prevent that the size of the toolbar changes
1326 // due to the long text, the text "Paste" is used:
1327 paste
->setIconText(i18nc("@action:inmenu Edit", "Paste"));
1329 KStandardAction::find(this, SLOT(find()), actionCollection());
1331 KAction
* selectAll
= actionCollection()->addAction("select_all");
1332 selectAll
->setText(i18nc("@action:inmenu Edit", "Select All"));
1333 selectAll
->setShortcut(Qt::CTRL
| Qt::Key_A
);
1334 connect(selectAll
, SIGNAL(triggered()), this, SLOT(selectAll()));
1336 KAction
* invertSelection
= actionCollection()->addAction("invert_selection");
1337 invertSelection
->setText(i18nc("@action:inmenu Edit", "Invert Selection"));
1338 invertSelection
->setShortcut(Qt::CTRL
| Qt::SHIFT
| Qt::Key_A
);
1339 connect(invertSelection
, SIGNAL(triggered()), this, SLOT(invertSelection()));
1341 // setup 'View' menu
1342 // (note that most of it is set up in DolphinViewActionHandler)
1344 KAction
* split
= actionCollection()->addAction("split_view");
1345 split
->setShortcut(Qt::Key_F3
);
1346 connect(split
, SIGNAL(triggered()), this, SLOT(toggleSplitView()));
1348 KAction
* reload
= actionCollection()->addAction("reload");
1349 reload
->setText(i18nc("@action:inmenu View", "Reload"));
1350 reload
->setShortcut(Qt::Key_F5
);
1351 reload
->setIcon(KIcon("view-refresh"));
1352 connect(reload
, SIGNAL(triggered()), this, SLOT(reloadView()));
1354 KAction
* stop
= actionCollection()->addAction("stop");
1355 stop
->setText(i18nc("@action:inmenu View", "Stop"));
1356 stop
->setToolTip(i18nc("@info", "Stop loading"));
1357 stop
->setIcon(KIcon("process-stop"));
1358 connect(stop
, SIGNAL(triggered()), this, SLOT(stopLoading()));
1360 KToggleAction
* editableLocation
= actionCollection()->add
<KToggleAction
>("editable_location");
1361 editableLocation
->setText(i18nc("@action:inmenu Navigation Bar", "Editable Location"));
1362 editableLocation
->setShortcut(Qt::Key_F6
);
1363 connect(editableLocation
, SIGNAL(triggered()), this, SLOT(toggleEditLocation()));
1365 KAction
* replaceLocation
= actionCollection()->addAction("replace_location");
1366 replaceLocation
->setText(i18nc("@action:inmenu Navigation Bar", "Replace Location"));
1367 replaceLocation
->setShortcut(Qt::CTRL
| Qt::Key_L
);
1368 connect(replaceLocation
, SIGNAL(triggered()), this, SLOT(replaceLocation()));
1371 KAction
* backAction
= KStandardAction::back(this, SLOT(goBack()), actionCollection());
1372 connect(backAction
, SIGNAL(triggered(Qt::MouseButtons
,Qt::KeyboardModifiers
)), this, SLOT(goBack(Qt::MouseButtons
)));
1373 KShortcut backShortcut
= backAction
->shortcut();
1374 backShortcut
.setAlternate(Qt::Key_Backspace
);
1375 backAction
->setShortcut(backShortcut
);
1377 DolphinRecentTabsMenu
* recentTabsMenu
= new DolphinRecentTabsMenu(this);
1378 actionCollection()->addAction("closed_tabs", recentTabsMenu
);
1379 connect(this, SIGNAL(rememberClosedTab(KUrl
,KUrl
)),
1380 recentTabsMenu
, SLOT(rememberClosedTab(KUrl
,KUrl
)));
1381 connect(recentTabsMenu
, SIGNAL(restoreClosedTab(KUrl
,KUrl
)),
1382 this, SLOT(openNewActivatedTab(KUrl
,KUrl
)));
1384 KAction
* forwardAction
= KStandardAction::forward(this, SLOT(goForward()), actionCollection());
1385 connect(forwardAction
, SIGNAL(triggered(Qt::MouseButtons
,Qt::KeyboardModifiers
)), this, SLOT(goForward(Qt::MouseButtons
)));
1387 KAction
* upAction
= KStandardAction::up(this, SLOT(goUp()), actionCollection());
1388 connect(upAction
, SIGNAL(triggered(Qt::MouseButtons
,Qt::KeyboardModifiers
)), this, SLOT(goUp(Qt::MouseButtons
)));
1390 KAction
* homeAction
= KStandardAction::home(this, SLOT(goHome()), actionCollection());
1391 connect(homeAction
, SIGNAL(triggered(Qt::MouseButtons
,Qt::KeyboardModifiers
)), this, SLOT(goHome(Qt::MouseButtons
)));
1393 // setup 'Tools' menu
1394 KAction
* showFilterBar
= actionCollection()->addAction("show_filter_bar");
1395 showFilterBar
->setText(i18nc("@action:inmenu Tools", "Show Filter Bar"));
1396 showFilterBar
->setIcon(KIcon("view-filter"));
1397 showFilterBar
->setShortcut(Qt::CTRL
| Qt::Key_I
);
1398 connect(showFilterBar
, SIGNAL(triggered()), this, SLOT(showFilterBar()));
1400 KAction
* compareFiles
= actionCollection()->addAction("compare_files");
1401 compareFiles
->setText(i18nc("@action:inmenu Tools", "Compare Files"));
1402 compareFiles
->setIcon(KIcon("kompare"));
1403 compareFiles
->setEnabled(false);
1404 connect(compareFiles
, SIGNAL(triggered()), this, SLOT(compareFiles()));
1406 KAction
* openTerminal
= actionCollection()->addAction("open_terminal");
1407 openTerminal
->setText(i18nc("@action:inmenu Tools", "Open Terminal"));
1408 openTerminal
->setIcon(KIcon("utilities-terminal"));
1409 openTerminal
->setShortcut(Qt::SHIFT
| Qt::Key_F4
);
1410 connect(openTerminal
, SIGNAL(triggered()), this, SLOT(openTerminal()));
1412 // setup 'Settings' menu
1413 KToggleAction
* showMenuBar
= KStandardAction::showMenubar(0, 0, actionCollection());
1414 connect(showMenuBar
, SIGNAL(triggered(bool)), // Fixes #286822
1415 this, SLOT(toggleShowMenuBar()), Qt::QueuedConnection
);
1416 KStandardAction::preferences(this, SLOT(editSettings()), actionCollection());
1418 // not in menu actions
1419 QList
<QKeySequence
> nextTabKeys
;
1420 nextTabKeys
.append(KStandardShortcut::tabNext().primary());
1421 nextTabKeys
.append(QKeySequence(Qt::CTRL
| Qt::Key_Tab
));
1423 QList
<QKeySequence
> prevTabKeys
;
1424 prevTabKeys
.append(KStandardShortcut::tabPrev().primary());
1425 prevTabKeys
.append(QKeySequence(Qt::CTRL
| Qt::SHIFT
| Qt::Key_Tab
));
1427 KAction
* activateNextTab
= actionCollection()->addAction("activate_next_tab");
1428 activateNextTab
->setIconText(i18nc("@action:inmenu", "Next Tab"));
1429 activateNextTab
->setText(i18nc("@action:inmenu", "Activate Next Tab"));
1430 activateNextTab
->setEnabled(false);
1431 connect(activateNextTab
, SIGNAL(triggered()), SLOT(activateNextTab()));
1432 activateNextTab
->setShortcuts(QApplication::isRightToLeft() ? prevTabKeys
: nextTabKeys
);
1434 KAction
* activatePrevTab
= actionCollection()->addAction("activate_prev_tab");
1435 activatePrevTab
->setIconText(i18nc("@action:inmenu", "Previous Tab"));
1436 activatePrevTab
->setText(i18nc("@action:inmenu", "Activate Previous Tab"));
1437 activatePrevTab
->setEnabled(false);
1438 connect(activatePrevTab
, SIGNAL(triggered()), SLOT(activatePrevTab()));
1439 activatePrevTab
->setShortcuts(QApplication::isRightToLeft() ? nextTabKeys
: prevTabKeys
);
1442 KAction
* openInNewTab
= actionCollection()->addAction("open_in_new_tab");
1443 openInNewTab
->setText(i18nc("@action:inmenu", "Open in New Tab"));
1444 openInNewTab
->setIcon(KIcon("tab-new"));
1445 connect(openInNewTab
, SIGNAL(triggered()), this, SLOT(openInNewTab()));
1447 KAction
* openInNewTabs
= actionCollection()->addAction("open_in_new_tabs");
1448 openInNewTabs
->setText(i18nc("@action:inmenu", "Open in New Tabs"));
1449 openInNewTabs
->setIcon(KIcon("tab-new"));
1450 connect(openInNewTabs
, SIGNAL(triggered()), this, SLOT(openInNewTab()));
1452 KAction
* openInNewWindow
= actionCollection()->addAction("open_in_new_window");
1453 openInNewWindow
->setText(i18nc("@action:inmenu", "Open in New Window"));
1454 openInNewWindow
->setIcon(KIcon("window-new"));
1455 connect(openInNewWindow
, SIGNAL(triggered()), this, SLOT(openInNewWindow()));
1458 void DolphinMainWindow::setupDockWidgets()
1460 const bool lock
= GeneralSettings::lockPanels();
1462 KDualAction
* lockLayoutAction
= actionCollection()->add
<KDualAction
>("lock_panels");
1463 lockLayoutAction
->setActiveText(i18nc("@action:inmenu Panels", "Unlock Panels"));
1464 lockLayoutAction
->setActiveIcon(KIcon("object-unlocked"));
1465 lockLayoutAction
->setInactiveText(i18nc("@action:inmenu Panels", "Lock Panels"));
1466 lockLayoutAction
->setInactiveIcon(KIcon("object-locked"));
1467 lockLayoutAction
->setActive(lock
);
1468 connect(lockLayoutAction
, SIGNAL(triggered()), this, SLOT(togglePanelLockState()));
1470 // Setup "Information"
1471 DolphinDockWidget
* infoDock
= new DolphinDockWidget(i18nc("@title:window", "Information"));
1472 infoDock
->setLocked(lock
);
1473 infoDock
->setObjectName("infoDock");
1474 infoDock
->setAllowedAreas(Qt::LeftDockWidgetArea
| Qt::RightDockWidgetArea
);
1475 Panel
* infoPanel
= new InformationPanel(infoDock
);
1476 infoPanel
->setCustomContextMenuActions(QList
<QAction
*>() << lockLayoutAction
);
1477 connect(infoPanel
, SIGNAL(urlActivated(KUrl
)), this, SLOT(handleUrl(KUrl
)));
1478 infoDock
->setWidget(infoPanel
);
1480 QAction
* infoAction
= infoDock
->toggleViewAction();
1481 createPanelAction(KIcon("dialog-information"), Qt::Key_F11
, infoAction
, "show_information_panel");
1483 addDockWidget(Qt::RightDockWidgetArea
, infoDock
);
1484 connect(this, SIGNAL(urlChanged(KUrl
)),
1485 infoPanel
, SLOT(setUrl(KUrl
)));
1486 connect(this, SIGNAL(selectionChanged(KFileItemList
)),
1487 infoPanel
, SLOT(setSelection(KFileItemList
)));
1488 connect(this, SIGNAL(requestItemInfo(KFileItem
)),
1489 infoPanel
, SLOT(requestDelayedItemInfo(KFileItem
)));
1492 DolphinDockWidget
* foldersDock
= new DolphinDockWidget(i18nc("@title:window", "Folders"));
1493 foldersDock
->setLocked(lock
);
1494 foldersDock
->setObjectName("foldersDock");
1495 foldersDock
->setAllowedAreas(Qt::LeftDockWidgetArea
| Qt::RightDockWidgetArea
);
1496 FoldersPanel
* foldersPanel
= new FoldersPanel(foldersDock
);
1497 foldersPanel
->setCustomContextMenuActions(QList
<QAction
*>() << lockLayoutAction
);
1498 foldersDock
->setWidget(foldersPanel
);
1500 QAction
* foldersAction
= foldersDock
->toggleViewAction();
1501 createPanelAction(KIcon("folder"), Qt::Key_F7
, foldersAction
, "show_folders_panel");
1503 addDockWidget(Qt::LeftDockWidgetArea
, foldersDock
);
1504 connect(this, SIGNAL(urlChanged(KUrl
)),
1505 foldersPanel
, SLOT(setUrl(KUrl
)));
1506 connect(foldersPanel
, SIGNAL(folderActivated(KUrl
)),
1507 this, SLOT(changeUrl(KUrl
)));
1508 connect(foldersPanel
, SIGNAL(folderMiddleClicked(KUrl
)),
1509 this, SLOT(openNewTab(KUrl
)));
1510 connect(foldersPanel
, SIGNAL(errorMessage(QString
)),
1511 this, SLOT(slotPanelErrorMessage(QString
)));
1515 DolphinDockWidget
* terminalDock
= new DolphinDockWidget(i18nc("@title:window Shell terminal", "Terminal"));
1516 terminalDock
->setLocked(lock
);
1517 terminalDock
->setObjectName("terminalDock");
1518 terminalDock
->setAllowedAreas(Qt::TopDockWidgetArea
| Qt::BottomDockWidgetArea
);
1519 Panel
* terminalPanel
= new TerminalPanel(terminalDock
);
1520 terminalPanel
->setCustomContextMenuActions(QList
<QAction
*>() << lockLayoutAction
);
1521 terminalDock
->setWidget(terminalPanel
);
1523 connect(terminalPanel
, SIGNAL(hideTerminalPanel()), terminalDock
, SLOT(hide()));
1524 connect(terminalPanel
, SIGNAL(changeUrl(KUrl
)), this, SLOT(slotTerminalDirectoryChanged(KUrl
)));
1525 connect(terminalDock
, SIGNAL(visibilityChanged(bool)),
1526 terminalPanel
, SLOT(dockVisibilityChanged()));
1528 QAction
* terminalAction
= terminalDock
->toggleViewAction();
1529 createPanelAction(KIcon("utilities-terminal"), Qt::Key_F4
, terminalAction
, "show_terminal_panel");
1531 addDockWidget(Qt::BottomDockWidgetArea
, terminalDock
);
1532 connect(this, SIGNAL(urlChanged(KUrl
)),
1533 terminalPanel
, SLOT(setUrl(KUrl
)));
1536 if (GeneralSettings::version() < 200) {
1538 foldersDock
->hide();
1540 terminalDock
->hide();
1545 DolphinDockWidget
* placesDock
= new DolphinDockWidget(i18nc("@title:window", "Places"));
1546 placesDock
->setLocked(lock
);
1547 placesDock
->setObjectName("placesDock");
1548 placesDock
->setAllowedAreas(Qt::LeftDockWidgetArea
| Qt::RightDockWidgetArea
);
1550 PlacesPanel
* placesPanel
= new PlacesPanel(placesDock
);
1551 placesPanel
->setCustomContextMenuActions(QList
<QAction
*>() << lockLayoutAction
);
1552 placesDock
->setWidget(placesPanel
);
1554 QAction
* placesAction
= placesDock
->toggleViewAction();
1555 createPanelAction(KIcon("bookmarks"), Qt::Key_F9
, placesAction
, "show_places_panel");
1557 addDockWidget(Qt::LeftDockWidgetArea
, placesDock
);
1558 connect(placesPanel
, SIGNAL(placeActivated(KUrl
)),
1559 this, SLOT(slotPlaceActivated(KUrl
)));
1560 connect(placesPanel
, SIGNAL(placeMiddleClicked(KUrl
)),
1561 this, SLOT(openNewTab(KUrl
)));
1562 connect(placesPanel
, SIGNAL(errorMessage(QString
)),
1563 this, SLOT(slotPanelErrorMessage(QString
)));
1564 connect(this, SIGNAL(urlChanged(KUrl
)),
1565 placesPanel
, SLOT(setUrl(KUrl
)));
1566 connect(placesDock
, SIGNAL(visibilityChanged(bool)),
1567 this, SLOT(slotPlacesPanelVisibilityChanged(bool)));
1568 connect(this, SIGNAL(settingsChanged()),
1569 placesPanel
, SLOT(readSettings()));
1571 // Add actions into the "Panels" menu
1572 KActionMenu
* panelsMenu
= new KActionMenu(i18nc("@action:inmenu View", "Panels"), this);
1573 actionCollection()->addAction("panels", panelsMenu
);
1574 panelsMenu
->setDelayed(false);
1575 const KActionCollection
* ac
= actionCollection();
1576 panelsMenu
->addAction(ac
->action("show_places_panel"));
1577 panelsMenu
->addAction(ac
->action("show_information_panel"));
1578 panelsMenu
->addAction(ac
->action("show_folders_panel"));
1580 panelsMenu
->addAction(ac
->action("show_terminal_panel"));
1582 panelsMenu
->addSeparator();
1583 panelsMenu
->addAction(lockLayoutAction
);
1586 void DolphinMainWindow::updateEditActions()
1588 const KFileItemList list
= m_activeViewContainer
->view()->selectedItems();
1589 if (list
.isEmpty()) {
1590 stateChanged("has_no_selection");
1592 stateChanged("has_selection");
1594 KActionCollection
* col
= actionCollection();
1595 QAction
* renameAction
= col
->action("rename");
1596 QAction
* moveToTrashAction
= col
->action("move_to_trash");
1597 QAction
* deleteAction
= col
->action("delete");
1598 QAction
* cutAction
= col
->action(KStandardAction::name(KStandardAction::Cut
));
1599 QAction
* deleteWithTrashShortcut
= col
->action("delete_shortcut"); // see DolphinViewActionHandler
1601 KFileItemListProperties
capabilities(list
);
1602 const bool enableMoveToTrash
= capabilities
.isLocal() && capabilities
.supportsMoving();
1604 renameAction
->setEnabled(capabilities
.supportsMoving());
1605 moveToTrashAction
->setEnabled(enableMoveToTrash
);
1606 deleteAction
->setEnabled(capabilities
.supportsDeleting());
1607 deleteWithTrashShortcut
->setEnabled(capabilities
.supportsDeleting() && !enableMoveToTrash
);
1608 cutAction
->setEnabled(capabilities
.supportsMoving());
1612 void DolphinMainWindow::updateViewActions()
1614 m_actionHandler
->updateViewActions();
1616 QAction
* showFilterBarAction
= actionCollection()->action("show_filter_bar");
1617 showFilterBarAction
->setChecked(m_activeViewContainer
->isFilterBarVisible());
1619 updateSplitAction();
1621 QAction
* editableLocactionAction
= actionCollection()->action("editable_location");
1622 const KUrlNavigator
* urlNavigator
= m_activeViewContainer
->urlNavigator();
1623 editableLocactionAction
->setChecked(urlNavigator
->isUrlEditable());
1626 void DolphinMainWindow::updateGoActions()
1628 QAction
* goUpAction
= actionCollection()->action(KStandardAction::name(KStandardAction::Up
));
1629 const KUrl currentUrl
= m_activeViewContainer
->url();
1630 goUpAction
->setEnabled(currentUrl
.upUrl() != currentUrl
);
1633 void DolphinMainWindow::createControlButton()
1635 if (m_controlButton
) {
1638 Q_ASSERT(!m_controlButton
);
1640 m_controlButton
= new QToolButton(this);
1641 m_controlButton
->setIcon(KIcon("applications-system"));
1642 m_controlButton
->setText(i18nc("@action", "Control"));
1643 m_controlButton
->setPopupMode(QToolButton::InstantPopup
);
1644 m_controlButton
->setToolButtonStyle(toolBar()->toolButtonStyle());
1646 KMenu
* controlMenu
= new KMenu(m_controlButton
);
1647 connect(controlMenu
, SIGNAL(aboutToShow()), this, SLOT(updateControlMenu()));
1649 m_controlButton
->setMenu(controlMenu
);
1651 toolBar()->addWidget(m_controlButton
);
1652 connect(toolBar(), SIGNAL(iconSizeChanged(QSize
)),
1653 m_controlButton
, SLOT(setIconSize(QSize
)));
1654 connect(toolBar(), SIGNAL(toolButtonStyleChanged(Qt::ToolButtonStyle
)),
1655 m_controlButton
, SLOT(setToolButtonStyle(Qt::ToolButtonStyle
)));
1657 // The added widgets are owned by the toolbar and may get deleted when e.g. the toolbar
1658 // gets edited. In this case we must add them again. The adding is done asynchronously by
1659 // m_updateToolBarTimer.
1660 connect(m_controlButton
, SIGNAL(destroyed()), this, SLOT(slotControlButtonDeleted()));
1661 m_updateToolBarTimer
= new QTimer(this);
1662 m_updateToolBarTimer
->setInterval(500);
1663 connect(m_updateToolBarTimer
, SIGNAL(timeout()), this, SLOT(updateToolBar()));
1666 void DolphinMainWindow::deleteControlButton()
1668 delete m_controlButton
;
1669 m_controlButton
= 0;
1671 delete m_updateToolBarTimer
;
1672 m_updateToolBarTimer
= 0;
1675 bool DolphinMainWindow::addActionToMenu(QAction
* action
, KMenu
* menu
)
1680 const KToolBar
* toolBarWidget
= toolBar();
1681 foreach (const QWidget
* widget
, action
->associatedWidgets()) {
1682 if (widget
== toolBarWidget
) {
1687 menu
->addAction(action
);
1691 void DolphinMainWindow::refreshViews()
1693 foreach (DolphinTabPage
* tabPage
, m_viewTab
) {
1694 tabPage
->refreshViews();
1697 if (GeneralSettings::modifiedStartupSettings()) {
1698 // The startup settings have been changed by the user (see bug #254947).
1699 // Synchronize the split-view setting with the active view:
1700 const bool splitView
= GeneralSettings::splitView();
1701 m_viewTab
.at(m_tabIndex
)->setSplitViewEnabled(splitView
);
1702 updateSplitAction();
1705 emit
settingsChanged();
1708 void DolphinMainWindow::clearStatusBar()
1710 m_activeViewContainer
->statusBar()->resetToDefaultText();
1713 void DolphinMainWindow::connectViewSignals(DolphinViewContainer
* container
)
1715 connect(container
, SIGNAL(showFilterBarChanged(bool)),
1716 this, SLOT(updateFilterBarAction(bool)));
1717 connect(container
, SIGNAL(writeStateChanged(bool)),
1718 this, SLOT(slotWriteStateChanged(bool)));
1720 const DolphinView
* view
= container
->view();
1721 connect(view
, SIGNAL(selectionChanged(KFileItemList
)),
1722 this, SLOT(slotSelectionChanged(KFileItemList
)));
1723 connect(view
, SIGNAL(requestItemInfo(KFileItem
)),
1724 this, SLOT(slotRequestItemInfo(KFileItem
)));
1725 connect(view
, SIGNAL(tabRequested(KUrl
)),
1726 this, SLOT(openNewTab(KUrl
)));
1727 connect(view
, SIGNAL(requestContextMenu(QPoint
,KFileItem
,KUrl
,QList
<QAction
*>)),
1728 this, SLOT(openContextMenu(QPoint
,KFileItem
,KUrl
,QList
<QAction
*>)));
1729 connect(view
, SIGNAL(directoryLoadingStarted()),
1730 this, SLOT(enableStopAction()));
1731 connect(view
, SIGNAL(directoryLoadingCompleted()),
1732 this, SLOT(disableStopAction()));
1733 connect(view
, SIGNAL(goBackRequested()),
1734 this, SLOT(goBack()));
1735 connect(view
, SIGNAL(goForwardRequested()),
1736 this, SLOT(goForward()));
1738 const KUrlNavigator
* navigator
= container
->urlNavigator();
1739 connect(navigator
, SIGNAL(urlChanged(KUrl
)),
1740 this, SLOT(changeUrl(KUrl
)));
1741 connect(navigator
, SIGNAL(historyChanged()),
1742 this, SLOT(updateHistory()));
1743 connect(navigator
, SIGNAL(editableStateChanged(bool)),
1744 this, SLOT(slotEditableStateChanged(bool)));
1745 connect(navigator
, SIGNAL(tabRequested(KUrl
)),
1746 this, SLOT(openNewTab(KUrl
)));
1749 void DolphinMainWindow::updateSplitAction()
1751 QAction
* splitAction
= actionCollection()->action("split_view");
1752 const DolphinTabPage
* tabPage
= m_viewTab
.at(m_tabIndex
);
1753 if (tabPage
->splitViewEnabled()) {
1754 if (tabPage
->primaryViewActive()) {
1755 splitAction
->setText(i18nc("@action:intoolbar Close left view", "Close"));
1756 splitAction
->setToolTip(i18nc("@info", "Close left view"));
1757 splitAction
->setIcon(KIcon("view-left-close"));
1759 splitAction
->setText(i18nc("@action:intoolbar Close right view", "Close"));
1760 splitAction
->setToolTip(i18nc("@info", "Close right view"));
1761 splitAction
->setIcon(KIcon("view-right-close"));
1764 splitAction
->setText(i18nc("@action:intoolbar Split view", "Split"));
1765 splitAction
->setToolTip(i18nc("@info", "Split view"));
1766 splitAction
->setIcon(KIcon("view-right-new"));
1770 QString
DolphinMainWindow::tabName(const KUrl
& url
) const
1773 if (url
.equals(KUrl("file:///"))) {
1776 name
= url
.fileName();
1777 if (name
.isEmpty()) {
1778 name
= url
.protocol();
1780 // Make sure that a '&' inside the directory name is displayed correctly
1781 // and not misinterpreted as a keyboard shortcut in QTabBar::setTabText()
1782 name
.replace('&', "&&");
1788 bool DolphinMainWindow::isKompareInstalled() const
1790 static bool initialized
= false;
1791 static bool installed
= false;
1793 // TODO: maybe replace this approach later by using a menu
1794 // plugin like kdiff3plugin.cpp
1795 installed
= !KGlobal::dirs()->findExe("kompare").isEmpty();
1801 void DolphinMainWindow::setUrlAsCaption(const KUrl
& url
)
1804 if (!url
.isLocalFile()) {
1805 caption
.append(url
.protocol() + " - ");
1806 if (url
.hasHost()) {
1807 caption
.append(url
.host() + " - ");
1811 const QString fileName
= url
.fileName().isEmpty() ? "/" : url
.fileName();
1812 caption
.append(fileName
);
1814 setCaption(caption
);
1817 QString
DolphinMainWindow::squeezedText(const QString
& text
) const
1819 const QFontMetrics fm
= fontMetrics();
1820 return fm
.elidedText(text
, Qt::ElideMiddle
, fm
.maxWidth() * 10);
1823 void DolphinMainWindow::createPanelAction(const KIcon
& icon
,
1824 const QKeySequence
& shortcut
,
1825 QAction
* dockAction
,
1826 const QString
& actionName
)
1828 KAction
* panelAction
= actionCollection()->addAction(actionName
);
1829 panelAction
->setCheckable(true);
1830 panelAction
->setChecked(dockAction
->isChecked());
1831 panelAction
->setText(dockAction
->text());
1832 panelAction
->setIcon(icon
);
1833 panelAction
->setShortcut(shortcut
);
1835 connect(panelAction
, SIGNAL(triggered()), dockAction
, SLOT(trigger()));
1836 connect(dockAction
, SIGNAL(toggled(bool)), panelAction
, SLOT(setChecked(bool)));
1839 DolphinMainWindow::UndoUiInterface::UndoUiInterface() :
1840 KIO::FileUndoManager::UiInterface()
1844 DolphinMainWindow::UndoUiInterface::~UndoUiInterface()
1848 void DolphinMainWindow::UndoUiInterface::jobError(KIO::Job
* job
)
1850 DolphinMainWindow
* mainWin
= qobject_cast
<DolphinMainWindow
*>(parentWidget());
1852 DolphinViewContainer
* container
= mainWin
->activeViewContainer();
1853 container
->showMessage(job
->errorString(), DolphinViewContainer::Error
);
1855 KIO::FileUndoManager::UiInterface::jobError(job
);
1859 #include "dolphinmainwindow.moc"