1 /***************************************************************************
2 * Copyright (C) 2006-2009 by Peter Penz <peter.penz@gmx.at> *
3 * Copyright (C) 2006 by Gregor Kališnik <gregor@podnapisi.net> *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
19 ***************************************************************************/
21 #include "dolphinview.h"
23 #include <QAbstractItemView>
24 #include <QApplication>
27 #include <QItemSelection>
32 #include <kactioncollection.h>
33 #include <kcolorscheme.h>
34 #include <kdirlister.h>
35 #include <kiconeffect.h>
36 #include <kfileitem.h>
38 #include <kio/deletejob.h>
39 #include <kio/netaccess.h>
40 #include <kio/previewjob.h>
43 #include <kmessagebox.h>
44 #include <konq_fileitemcapabilities.h>
45 #include <konq_operations.h>
46 #include <konqmimedata.h>
47 #include <ktoggleaction.h>
50 #include "additionalinfoaccessor.h"
51 #include "dolphinmodel.h"
52 #include "dolphincolumnviewcontainer.h"
53 #include "dolphinviewcontroller.h"
54 #include "dolphindetailsview.h"
55 #include "dolphinfileitemdelegate.h"
56 #include "dolphinnewfilemenuobserver.h"
57 #include "dolphinsortfilterproxymodel.h"
58 #include "dolphin_detailsmodesettings.h"
59 #include "dolphiniconsview.h"
60 #include "dolphin_generalsettings.h"
61 #include "draganddrophelper.h"
62 #include "renamedialog.h"
63 #include "settings/dolphinsettings.h"
64 #include "viewmodecontroller.h"
65 #include "viewproperties.h"
66 #include "zoomlevelinfo.h"
67 #include "dolphindetailsviewexpander.h"
69 DolphinView::DolphinView(QWidget
* parent
,
71 DolphinSortFilterProxyModel
* proxyModel
) :
75 m_storedCategorizedSorting(false),
76 m_tabsForFiles(false),
77 m_isContextMenuOpen(false),
78 m_assureVisibleCurrentIndex(false),
79 m_mode(DolphinView::IconsView
),
81 m_dolphinViewController(0),
82 m_viewModeController(0),
83 m_viewAccessor(proxyModel
),
84 m_selectionChangedTimer(0),
86 m_restoredContentsPosition(),
91 m_topLayout
= new QVBoxLayout(this);
92 m_topLayout
->setSpacing(0);
93 m_topLayout
->setMargin(0);
95 m_dolphinViewController
= new DolphinViewController(this);
97 m_viewModeController
= new ViewModeController(this);
98 m_viewModeController
->setUrl(url
);
100 connect(m_viewModeController
, SIGNAL(urlChanged(const KUrl
&)),
101 this, SIGNAL(urlChanged(const KUrl
&)));
103 connect(m_dolphinViewController
, SIGNAL(requestContextMenu(const QPoint
&, const QList
<QAction
*>&)),
104 this, SLOT(openContextMenu(const QPoint
&, const QList
<QAction
*>&)));
105 connect(m_dolphinViewController
, SIGNAL(urlsDropped(const KFileItem
&, const KUrl
&, QDropEvent
*)),
106 this, SLOT(dropUrls(const KFileItem
&, const KUrl
&, QDropEvent
*)));
107 connect(m_dolphinViewController
, SIGNAL(sortingChanged(DolphinView::Sorting
)),
108 this, SLOT(updateSorting(DolphinView::Sorting
)));
109 connect(m_dolphinViewController
, SIGNAL(sortOrderChanged(Qt::SortOrder
)),
110 this, SLOT(updateSortOrder(Qt::SortOrder
)));
111 connect(m_dolphinViewController
, SIGNAL(sortFoldersFirstChanged(bool)),
112 this, SLOT(updateSortFoldersFirst(bool)));
113 connect(m_dolphinViewController
, SIGNAL(additionalInfoChanged(const KFileItemDelegate::InformationList
&)),
114 this, SLOT(updateAdditionalInfo(const KFileItemDelegate::InformationList
&)));
115 connect(m_dolphinViewController
, SIGNAL(itemTriggered(const KFileItem
&)),
116 this, SLOT(triggerItem(const KFileItem
&)));
117 connect(m_dolphinViewController
, SIGNAL(tabRequested(const KUrl
&)),
118 this, SIGNAL(tabRequested(const KUrl
&)));
119 connect(m_dolphinViewController
, SIGNAL(activated()),
120 this, SLOT(activate()));
121 connect(m_dolphinViewController
, SIGNAL(itemEntered(const KFileItem
&)),
122 this, SLOT(showHoverInformation(const KFileItem
&)));
123 connect(m_dolphinViewController
, SIGNAL(viewportEntered()),
124 this, SLOT(clearHoverInformation()));
125 connect(m_dolphinViewController
, SIGNAL(urlChangeRequested(KUrl
)),
126 m_viewModeController
, SLOT(setUrl(KUrl
)));
128 KDirLister
* dirLister
= m_viewAccessor
.dirLister();
129 connect(dirLister
, SIGNAL(redirection(KUrl
,KUrl
)),
130 this, SLOT(slotRedirection(KUrl
,KUrl
)));
131 connect(dirLister
, SIGNAL(completed()),
132 this, SLOT(slotDirListerCompleted()));
133 connect(dirLister
, SIGNAL(refreshItems(const QList
<QPair
<KFileItem
,KFileItem
>>&)),
134 this, SLOT(slotRefreshItems()));
136 // When a new item has been created by the "Create New..." menu, the item should
137 // get selected and it must be assured that the item will get visible. As the
138 // creation is done asynchronously, several signals must be checked:
139 connect(&DolphinNewFileMenuObserver::instance(), SIGNAL(itemCreated(const KUrl
&)),
140 this, SLOT(observeCreatedItem(const KUrl
&)));
142 m_selectionChangedTimer
= new QTimer(this);
143 m_selectionChangedTimer
->setSingleShot(true);
144 m_selectionChangedTimer
->setInterval(300);
145 connect(m_selectionChangedTimer
, SIGNAL(timeout()),
146 this, SLOT(emitSelectionChangedSignal()));
148 applyViewProperties();
149 m_topLayout
->addWidget(m_viewAccessor
.layoutTarget());
152 DolphinView::~DolphinView()
156 KUrl
DolphinView::url() const
158 return m_viewModeController
->url();
161 KUrl
DolphinView::rootUrl() const
163 const KUrl viewUrl
= url();
164 const KUrl root
= m_viewAccessor
.rootUrl();
165 if (root
.isEmpty() || !root
.isParentOf(viewUrl
)) {
171 void DolphinView::setActive(bool active
)
173 if (active
== m_active
) {
179 QColor color
= KColorScheme(QPalette::Active
, KColorScheme::View
).background().color();
181 emitSelectionChangedSignal();
186 QWidget
* viewport
= m_viewAccessor
.itemView()->viewport();
188 palette
.setColor(viewport
->backgroundRole(), color
);
189 viewport
->setPalette(palette
);
194 m_viewAccessor
.itemView()->setFocus();
198 m_viewModeController
->indicateActivationChange(active
);
201 bool DolphinView::isActive() const
206 void DolphinView::setMode(Mode mode
)
208 if (mode
== m_mode
) {
209 return; // the wished mode is already set
212 const int oldZoomLevel
= m_viewModeController
->zoomLevel();
215 // remember the currently selected items, so that they will
216 // be restored after reloading the directory
217 m_selectedItems
= selectedItems();
221 const KUrl viewPropsUrl
= rootUrl();
222 ViewProperties
props(viewPropsUrl
);
223 props
.setViewMode(m_mode
);
226 // the file item delegate has been recreated, apply the current
227 // additional information manually
228 const KFileItemDelegate::InformationList infoList
= props
.additionalInfo();
229 m_viewAccessor
.itemDelegate()->setShowInformation(infoList
);
230 emit
additionalInfoChanged();
232 // Not all view modes support categorized sorting. Adjust the sorting model
233 // if changing the view mode results in a change of the categorized sorting
235 m_storedCategorizedSorting
= props
.categorizedSorting();
236 const bool categorized
= m_storedCategorizedSorting
&& supportsCategorizedSorting();
237 if (categorized
!= m_viewAccessor
.proxyModel()->isCategorizedModel()) {
238 m_viewAccessor
.proxyModel()->setCategorizedModel(categorized
);
239 emit
categorizedSortingChanged();
244 updateZoomLevel(oldZoomLevel
);
245 loadDirectory(viewPropsUrl
);
248 DolphinView::Mode
DolphinView::mode() const
253 bool DolphinView::showPreview() const
255 return m_showPreview
;
258 bool DolphinView::showHiddenFiles() const
260 return m_viewAccessor
.dirLister()->showingDotFiles();
263 bool DolphinView::categorizedSorting() const
265 // If all view modes would support categorized sorting, returning
266 // m_viewAccessor.proxyModel()->isCategorizedModel() would be the way to go. As
267 // currently only the icons view supports caterized sorting, we remember
268 // the stored view properties state in m_storedCategorizedSorting and
269 // return this state. The application takes care to disable the corresponding
270 // checkbox by checking DolphinView::supportsCategorizedSorting() to indicate
271 // that this setting is not applied to the current view mode.
272 return m_storedCategorizedSorting
;
275 bool DolphinView::supportsCategorizedSorting() const
277 return m_viewAccessor
.supportsCategorizedSorting();
280 KFileItemList
DolphinView::items() const
282 return m_viewAccessor
.dirLister()->items();
285 KFileItemList
DolphinView::selectedItems() const
287 KFileItemList itemList
;
288 const QAbstractItemView
* view
= m_viewAccessor
.itemView();
293 const QItemSelection selection
= m_viewAccessor
.proxyModel()->mapSelectionToSource(view
->selectionModel()->selection());
295 const QModelIndexList indexList
= selection
.indexes();
296 foreach (const QModelIndex
&index
, indexList
) {
297 KFileItem item
= m_viewAccessor
.dirModel()->itemForIndex(index
);
298 if (!item
.isNull()) {
299 itemList
.append(item
);
306 int DolphinView::selectedItemsCount() const
308 const QAbstractItemView
* view
= m_viewAccessor
.itemView();
313 return view
->selectionModel()->selectedIndexes().count();
316 void DolphinView::markUrlsAsSelected(const QList
<KUrl
>& urls
)
318 foreach (const KUrl
& url
, urls
) {
319 KFileItem
item(KFileItem::Unknown
, KFileItem::Unknown
, url
);
320 m_selectedItems
.append(item
);
324 void DolphinView::setItemSelectionEnabled(const QRegExp
& pattern
, bool enabled
)
326 const QItemSelection matchingIndexes
= childrenMatchingPattern(QModelIndex(), pattern
);
327 const QItemSelectionModel::SelectionFlags command
= enabled
328 ? QItemSelectionModel::Select
329 : QItemSelectionModel::Deselect
;
330 m_viewAccessor
.itemView()->selectionModel()->select(matchingIndexes
, command
);
333 void DolphinView::setZoomLevel(int level
)
335 if (level
< ZoomLevelInfo::minimumLevel()) {
336 level
= ZoomLevelInfo::minimumLevel();
337 } else if (level
> ZoomLevelInfo::maximumLevel()) {
338 level
= ZoomLevelInfo::maximumLevel();
341 if (level
!= zoomLevel()) {
342 m_viewModeController
->setZoomLevel(level
);
343 emit
zoomLevelChanged(level
);
347 int DolphinView::zoomLevel() const
349 return m_viewModeController
->zoomLevel();
352 void DolphinView::setSorting(Sorting sorting
)
354 if (sorting
!= this->sorting()) {
355 updateSorting(sorting
);
359 DolphinView::Sorting
DolphinView::sorting() const
361 return m_viewAccessor
.proxyModel()->sorting();
364 void DolphinView::setSortOrder(Qt::SortOrder order
)
366 if (sortOrder() != order
) {
367 updateSortOrder(order
);
371 Qt::SortOrder
DolphinView::sortOrder() const
373 return m_viewAccessor
.proxyModel()->sortOrder();
376 void DolphinView::setSortFoldersFirst(bool foldersFirst
)
378 if (sortFoldersFirst() != foldersFirst
) {
379 updateSortFoldersFirst(foldersFirst
);
383 bool DolphinView::sortFoldersFirst() const
385 return m_viewAccessor
.proxyModel()->sortFoldersFirst();
388 void DolphinView::setAdditionalInfo(KFileItemDelegate::InformationList info
)
390 const KUrl viewPropsUrl
= rootUrl();
391 ViewProperties
props(viewPropsUrl
);
392 props
.setAdditionalInfo(info
);
393 m_viewAccessor
.itemDelegate()->setShowInformation(info
);
395 emit
additionalInfoChanged();
397 if (m_viewAccessor
.reloadOnAdditionalInfoChange()) {
398 loadDirectory(viewPropsUrl
);
402 KFileItemDelegate::InformationList
DolphinView::additionalInfo() const
404 return m_viewAccessor
.itemDelegate()->showInformation();
407 void DolphinView::reload()
409 QByteArray viewState
;
410 QDataStream
saveStream(&viewState
, QIODevice::WriteOnly
);
411 saveState(saveStream
);
412 m_selectedItems
= selectedItems();
415 loadDirectory(url(), true);
417 QDataStream
restoreStream(viewState
);
418 restoreState(restoreStream
);
421 void DolphinView::stopLoading()
423 m_viewAccessor
.dirLister()->stop();
426 void DolphinView::refresh()
428 const bool oldActivationState
= m_active
;
429 const int oldZoomLevel
= m_viewModeController
->zoomLevel();
433 applyViewProperties();
436 setActive(oldActivationState
);
437 updateZoomLevel(oldZoomLevel
);
440 void DolphinView::setNameFilter(const QString
& nameFilter
)
442 m_viewModeController
->setNameFilter(nameFilter
);
445 void DolphinView::calculateItemCount(int& fileCount
,
447 KIO::filesize_t
& totalFileSize
) const
449 foreach (const KFileItem
& item
, m_viewAccessor
.dirLister()->items()) {
454 totalFileSize
+= item
.size();
459 QString
DolphinView::statusBarText() const
464 KIO::filesize_t totalFileSize
= 0;
466 if (hasSelection()) {
467 // give a summary of the status of the selected files
468 const KFileItemList list
= selectedItems();
469 if (list
.isEmpty()) {
470 // when an item is triggered, it is temporary selected but selectedItems()
471 // will return an empty list
475 KFileItemList::const_iterator it
= list
.begin();
476 const KFileItemList::const_iterator end
= list
.end();
478 const KFileItem
& item
= *it
;
483 totalFileSize
+= item
.size();
488 if (folderCount
+ fileCount
== 1) {
489 // if only one item is selected, show the filename
490 const QString name
= list
.first().text();
491 text
= (folderCount
== 1) ? i18nc("@info:status", "<filename>%1</filename> selected", name
) :
492 i18nc("@info:status", "<filename>%1</filename> selected (%2)",
493 name
, KIO::convertSize(totalFileSize
));
495 // at least 2 items are selected
496 const QString foldersText
= i18ncp("@info:status", "1 Folder selected", "%1 Folders selected", folderCount
);
497 const QString filesText
= i18ncp("@info:status", "1 File selected", "%1 Files selected", fileCount
);
498 if ((folderCount
> 0) && (fileCount
> 0)) {
499 text
= i18nc("@info:status folders, files (size)", "%1, %2 (%3)",
500 foldersText
, filesText
, KIO::convertSize(totalFileSize
));
501 } else if (fileCount
> 0) {
502 text
= i18nc("@info:status files (size)", "%1 (%2)", filesText
, KIO::convertSize(totalFileSize
));
504 Q_ASSERT(folderCount
> 0);
509 calculateItemCount(fileCount
, folderCount
, totalFileSize
);
510 text
= KIO::itemsSummaryString(fileCount
+ folderCount
,
511 fileCount
, folderCount
,
512 totalFileSize
, true);
518 QList
<QAction
*> DolphinView::versionControlActions(const KFileItemList
& items
) const
520 return m_dolphinViewController
->versionControlActions(items
);
523 void DolphinView::setUrl(const KUrl
& url
)
525 if (m_viewModeController
->url() == url
) {
529 // The selection model might change in the case of the column view. Disconnect
530 // from the current selection model and reconnect later after the URL switch.
531 const bool hadSelection
= hasSelection();
532 QAbstractItemView
* view
= m_viewAccessor
.itemView();
533 disconnect(view
->selectionModel(), SIGNAL(selectionChanged(QItemSelection
, QItemSelection
)),
534 this, SLOT(slotSelectionChanged(QItemSelection
, QItemSelection
)));
536 m_newFileNames
.clear();
538 m_viewModeController
->setUrl(url
); // emits urlChanged, which we forward
539 m_viewAccessor
.prepareUrlChange(url
);
540 applyViewProperties();
543 // When changing the URL there is no need to keep the version
544 // data of the previous URL.
545 m_viewAccessor
.dirModel()->clearVersionData();
547 emit
startedPathLoading(url
);
549 // Reconnect to the (probably) new selection model
550 view
= m_viewAccessor
.itemView();
551 connect(view
->selectionModel(), SIGNAL(selectionChanged(QItemSelection
, QItemSelection
)),
552 this, SLOT(slotSelectionChanged(QItemSelection
, QItemSelection
)));
553 if (hadSelection
|| hasSelection()) {
554 emitSelectionChangedSignal();
558 void DolphinView::selectAll()
560 m_viewAccessor
.itemView()->selectAll();
563 void DolphinView::invertSelection()
565 QItemSelectionModel
* selectionModel
= m_viewAccessor
.itemView()->selectionModel();
566 const QAbstractItemModel
* itemModel
= selectionModel
->model();
568 const QModelIndex topLeft
= itemModel
->index(0, 0);
569 const QModelIndex bottomRight
= itemModel
->index(itemModel
->rowCount() - 1,
570 itemModel
->columnCount() - 1);
572 const QItemSelection
selection(topLeft
, bottomRight
);
573 selectionModel
->select(selection
, QItemSelectionModel::Toggle
);
576 void DolphinView::clearSelection()
578 m_viewAccessor
.itemView()->clearSelection();
581 void DolphinView::renameSelectedItems()
583 KFileItemList items
= selectedItems();
584 const int itemCount
= items
.count();
589 if ((itemCount
== 1) && DolphinSettings::instance().generalSettings()->renameInline()) {
590 const QModelIndex dirIndex
= m_viewAccessor
.dirModel()->indexForItem(items
.first());
591 const QModelIndex proxyIndex
= m_viewAccessor
.proxyModel()->mapFromSource(dirIndex
);
592 m_viewAccessor
.itemView()->edit(proxyIndex
);
594 RenameDialog
* dialog
= new RenameDialog(this, items
);
595 dialog
->setAttribute(Qt::WA_DeleteOnClose
);
598 dialog
->activateWindow();
602 void DolphinView::trashSelectedItems()
604 const KUrl::List list
= simplifiedSelectedUrls();
605 KonqOperations::del(this, KonqOperations::TRASH
, list
);
608 void DolphinView::deleteSelectedItems()
610 const KUrl::List list
= simplifiedSelectedUrls();
611 const bool del
= KonqOperations::askDeleteConfirmation(list
,
613 KonqOperations::DEFAULT_CONFIRMATION
,
617 KIO::Job
* job
= KIO::del(list
);
618 connect(job
, SIGNAL(result(KJob
*)),
619 this, SLOT(slotDeleteFileFinished(KJob
*)));
623 void DolphinView::cutSelectedItems()
625 QMimeData
* mimeData
= selectionMimeData();
626 KonqMimeData::addIsCutSelection(mimeData
, true);
627 QApplication::clipboard()->setMimeData(mimeData
);
630 void DolphinView::copySelectedItems()
632 QMimeData
* mimeData
= selectionMimeData();
633 QApplication::clipboard()->setMimeData(mimeData
);
636 void DolphinView::paste()
641 void DolphinView::pasteIntoFolder()
643 const KFileItemList items
= selectedItems();
644 if ((items
.count() == 1) && items
.first().isDir()) {
645 pasteToUrl(items
.first().url());
649 void DolphinView::setShowPreview(bool show
)
651 if (m_showPreview
== show
) {
655 const KUrl viewPropsUrl
= rootUrl();
656 ViewProperties
props(viewPropsUrl
);
657 props
.setShowPreview(show
);
659 m_showPreview
= show
;
660 const int oldZoomLevel
= m_viewModeController
->zoomLevel();
661 emit
showPreviewChanged();
663 // Enabling or disabling the preview might change the icon size of the view.
664 // As the view does not emit a signal when the icon size has been changed,
665 // the used zoom level of the controller must be adjusted manually:
666 updateZoomLevel(oldZoomLevel
);
669 void DolphinView::setShowHiddenFiles(bool show
)
671 if (m_viewAccessor
.dirLister()->showingDotFiles() == show
) {
675 const KUrl viewPropsUrl
= rootUrl();
676 ViewProperties
props(viewPropsUrl
);
677 props
.setShowHiddenFiles(show
);
679 m_viewAccessor
.dirLister()->setShowingDotFiles(show
);
680 emit
showHiddenFilesChanged();
683 void DolphinView::setCategorizedSorting(bool categorized
)
685 if (categorized
== categorizedSorting()) {
689 // setCategorizedSorting(true) may only get invoked
690 // if the view supports categorized sorting
691 Q_ASSERT(!categorized
|| supportsCategorizedSorting());
693 ViewProperties
props(rootUrl());
694 props
.setCategorizedSorting(categorized
);
697 m_storedCategorizedSorting
= categorized
;
698 m_viewAccessor
.proxyModel()->setCategorizedModel(categorized
);
700 emit
categorizedSortingChanged();
703 void DolphinView::mouseReleaseEvent(QMouseEvent
* event
)
705 QWidget::mouseReleaseEvent(event
);
709 bool DolphinView::eventFilter(QObject
* watched
, QEvent
* event
)
711 switch (event
->type()) {
712 case QEvent::FocusIn
:
713 if (watched
== m_viewAccessor
.itemView()) {
714 m_dolphinViewController
->requestActivation();
718 case QEvent::DragEnter
:
719 if (watched
== m_viewAccessor
.itemView()->viewport()) {
724 case QEvent::KeyPress
:
725 if (watched
== m_viewAccessor
.itemView()) {
726 // clear the selection when Escape has been pressed
727 QKeyEvent
* keyEvent
= static_cast<QKeyEvent
*>(event
);
728 if (keyEvent
->key() == Qt::Key_Escape
) {
735 if (watched
== m_viewAccessor
.itemView()->viewport()) {
736 // Ctrl+wheel events should cause icon zooming, but not if the left mouse button is pressed
737 // (the user is probably trying to scroll during a selection in that case)
738 QWheelEvent
* wheelEvent
= static_cast<QWheelEvent
*>(event
);
739 if (wheelEvent
->modifiers() & Qt::ControlModifier
&& !(wheelEvent
->buttons() & Qt::LeftButton
)) {
740 const int delta
= wheelEvent
->delta();
741 const int level
= zoomLevel();
743 setZoomLevel(level
+ 1);
744 } else if (delta
< 0) {
745 setZoomLevel(level
- 1);
756 return QWidget::eventFilter(watched
, event
);
759 void DolphinView::activate()
764 void DolphinView::triggerItem(const KFileItem
& item
)
766 const Qt::KeyboardModifiers modifier
= QApplication::keyboardModifiers();
767 if ((modifier
& Qt::ShiftModifier
) || (modifier
& Qt::ControlModifier
)) {
768 // items are selected by the user, hence don't trigger the
769 // item specified by 'index'
773 // TODO: the m_isContextMenuOpen check is a workaround for Qt-issue 207192
774 if (item
.isNull() || m_isContextMenuOpen
) {
778 emit
itemTriggered(item
); // caught by DolphinViewContainer or DolphinPart
781 void DolphinView::slotSelectionChanged(const QItemSelection
& selected
, const QItemSelection
& deselected
)
783 const int count
= selectedItemsCount();
784 const bool selectionStateChanged
= ((count
> 0) && (selected
.count() == count
)) ||
785 ((count
== 0) && !deselected
.isEmpty());
787 // If nothing has been selected before and something got selected (or if something
788 // was selected before and now nothing is selected) the selectionChangedSignal must
789 // be emitted asynchronously as fast as possible to update the edit-actions.
790 m_selectionChangedTimer
->setInterval(selectionStateChanged
? 0 : 300);
791 m_selectionChangedTimer
->start();
794 void DolphinView::emitSelectionChangedSignal()
796 m_selectionChangedTimer
->stop();
797 emit
selectionChanged(selectedItems());
800 void DolphinView::openContextMenu(const QPoint
& pos
,
801 const QList
<QAction
*>& customActions
)
804 const QModelIndex index
= m_viewAccessor
.itemView()->indexAt(pos
);
805 if (index
.isValid() && (index
.column() == DolphinModel::Name
)) {
806 const QModelIndex dolphinModelIndex
= m_viewAccessor
.proxyModel()->mapToSource(index
);
807 item
= m_viewAccessor
.dirModel()->itemForIndex(dolphinModelIndex
);
810 m_isContextMenuOpen
= true; // TODO: workaround for Qt-issue 207192
811 emit
requestContextMenu(item
, url(), customActions
);
812 m_isContextMenuOpen
= false;
815 void DolphinView::dropUrls(const KFileItem
& destItem
,
816 const KUrl
& destPath
,
819 addNewFileNames(event
->mimeData());
820 DragAndDropHelper::instance().dropUrls(destItem
, destPath
, event
, this);
823 void DolphinView::updateSorting(DolphinView::Sorting sorting
)
825 ViewProperties
props(rootUrl());
826 props
.setSorting(sorting
);
828 m_viewAccessor
.proxyModel()->setSorting(sorting
);
830 emit
sortingChanged(sorting
);
833 void DolphinView::updateSortOrder(Qt::SortOrder order
)
835 ViewProperties
props(rootUrl());
836 props
.setSortOrder(order
);
838 m_viewAccessor
.proxyModel()->setSortOrder(order
);
840 emit
sortOrderChanged(order
);
843 void DolphinView::updateSortFoldersFirst(bool foldersFirst
)
845 ViewProperties
props(rootUrl());
846 props
.setSortFoldersFirst(foldersFirst
);
848 m_viewAccessor
.proxyModel()->setSortFoldersFirst(foldersFirst
);
850 emit
sortFoldersFirstChanged(foldersFirst
);
853 void DolphinView::updateAdditionalInfo(const KFileItemDelegate::InformationList
& info
)
855 ViewProperties
props(rootUrl());
856 props
.setAdditionalInfo(info
);
859 m_viewAccessor
.itemDelegate()->setShowInformation(info
);
861 emit
additionalInfoChanged();
864 void DolphinView::updateAdditionalInfoActions(KActionCollection
* collection
)
866 const AdditionalInfoAccessor
& infoAccessor
= AdditionalInfoAccessor::instance();
868 const KFileItemDelegate::InformationList checkedInfo
= m_viewAccessor
.itemDelegate()->showInformation();
869 const KFileItemDelegate::InformationList infoKeys
= infoAccessor
.keys();
871 const bool enable
= (m_mode
== DolphinView::DetailsView
) ||
872 (m_mode
== DolphinView::IconsView
);
874 foreach (const KFileItemDelegate::Information
& info
, infoKeys
) {
875 const QString name
= infoAccessor
.actionCollectionName(info
, AdditionalInfoAccessor::AdditionalInfoType
);
876 QAction
* action
= collection
->action(name
);
877 Q_ASSERT(action
!= 0);
878 action
->setEnabled(enable
);
879 action
->setChecked(checkedInfo
.contains(info
));
883 QPair
<bool, QString
> DolphinView::pasteInfo() const
885 return KonqOperations::pasteInfo(url());
888 void DolphinView::setTabsForFilesEnabled(bool tabsForFiles
)
890 m_tabsForFiles
= tabsForFiles
;
893 bool DolphinView::isTabsForFilesEnabled() const
895 return m_tabsForFiles
;
898 bool DolphinView::itemsExpandable() const
900 return m_viewAccessor
.itemsExpandable();
903 void DolphinView::restoreState(QDataStream
& stream
)
905 // Restore the URL of the current item that had the keyboard focus
906 stream
>> m_activeItemUrl
;
908 // Restore the root URL
911 m_viewAccessor
.setRootUrl(rootUrl
);
913 // Restore the view position
914 stream
>> m_restoredContentsPosition
;
916 // Restore expanded folders (only relevant for the details view - will be ignored by the view in other view modes)
917 QSet
<KUrl
> urlsToExpand
;
918 stream
>> urlsToExpand
;
919 const DolphinDetailsViewExpander
* expander
= m_viewAccessor
.setExpandedUrls(urlsToExpand
);
921 m_expanderActive
= true;
922 connect (expander
, SIGNAL(completed()), this, SLOT(slotLoadingCompleted()));
925 m_expanderActive
= false;
929 void DolphinView::saveState(QDataStream
& stream
)
931 // Save the URL of the current item that has the keyboard focus
932 KFileItem currentItem
;
933 const QAbstractItemView
* view
= m_viewAccessor
.itemView();
936 const QModelIndex proxyIndex
= view
->currentIndex();
937 const QModelIndex dirModelIndex
= m_viewAccessor
.proxyModel()->mapToSource(proxyIndex
);
938 currentItem
= m_viewAccessor
.dirModel()->itemForIndex(dirModelIndex
);
942 if (!currentItem
.isNull()) {
943 currentItemUrl
= currentItem
.url();
946 stream
<< currentItemUrl
;
949 stream
<< m_viewAccessor
.rootUrl();
951 // Save view position
952 const int x
= view
->horizontalScrollBar()->value();
953 const int y
= view
->verticalScrollBar()->value();
954 stream
<< QPoint(x
, y
);
956 // Save expanded folders (only relevant for the details view - the set will be empty in other view modes)
957 stream
<< m_viewAccessor
.expandedUrls();
960 bool DolphinView::hasSelection() const
962 const QAbstractItemView
* view
= m_viewAccessor
.itemView();
963 return (view
!= 0) && view
->selectionModel()->hasSelection();
966 void DolphinView::observeCreatedItem(const KUrl
& url
)
968 m_createdItemUrl
= url
;
969 connect(m_viewAccessor
.dirModel(), SIGNAL(rowsInserted(const QModelIndex
&, int, int)),
970 this, SLOT(selectAndScrollToCreatedItem()));
973 void DolphinView::selectAndScrollToCreatedItem()
975 const QModelIndex dirIndex
= m_viewAccessor
.dirModel()->indexForUrl(m_createdItemUrl
);
976 if (dirIndex
.isValid()) {
977 const QModelIndex proxyIndex
= m_viewAccessor
.proxyModel()->mapFromSource(dirIndex
);
978 m_viewAccessor
.itemView()->setCurrentIndex(proxyIndex
);
981 disconnect(m_viewAccessor
.dirModel(), SIGNAL(rowsInserted(const QModelIndex
&, int, int)),
982 this, SLOT(selectAndScrollToCreatedItem()));
983 m_createdItemUrl
= KUrl();
986 void DolphinView::showHoverInformation(const KFileItem
& item
)
988 emit
requestItemInfo(item
);
991 void DolphinView::clearHoverInformation()
993 emit
requestItemInfo(KFileItem());
996 void DolphinView::slotDeleteFileFinished(KJob
* job
)
998 if (job
->error() == 0) {
999 emit
operationCompletedMessage(i18nc("@info:status", "Delete operation completed."));
1000 } else if (job
->error() != KIO::ERR_USER_CANCELED
) {
1001 emit
errorMessage(job
->errorString());
1005 void DolphinView::slotDirListerCompleted()
1007 if (!m_expanderActive
) {
1008 slotLoadingCompleted();
1011 if (!m_newFileNames
.isEmpty()) {
1012 // select all newly added items created by a paste operation or
1013 // a drag & drop operation, and clear the previous selection
1014 m_viewAccessor
.itemView()->clearSelection();
1015 const int rowCount
= m_viewAccessor
.proxyModel()->rowCount();
1016 QItemSelection selection
;
1017 for (int row
= 0; row
< rowCount
; ++row
) {
1018 const QModelIndex proxyIndex
= m_viewAccessor
.proxyModel()->index(row
, 0);
1019 const QModelIndex dirIndex
= m_viewAccessor
.proxyModel()->mapToSource(proxyIndex
);
1020 const KUrl url
= m_viewAccessor
.dirModel()->itemForIndex(dirIndex
).url();
1021 if (m_newFileNames
.contains(url
.fileName())) {
1022 selection
.merge(QItemSelection(proxyIndex
, proxyIndex
), QItemSelectionModel::Select
);
1025 m_viewAccessor
.itemView()->selectionModel()->select(selection
, QItemSelectionModel::Select
);
1027 m_newFileNames
.clear();
1031 void DolphinView::slotLoadingCompleted()
1033 m_expanderActive
= false;
1035 if (!m_activeItemUrl
.isEmpty()) {
1036 // assure that the current item remains visible
1037 const QModelIndex dirIndex
= m_viewAccessor
.dirModel()->indexForUrl(m_activeItemUrl
);
1038 if (dirIndex
.isValid()) {
1039 const QModelIndex proxyIndex
= m_viewAccessor
.proxyModel()->mapFromSource(dirIndex
);
1040 QAbstractItemView
* view
= m_viewAccessor
.itemView();
1041 const bool clearSelection
= !hasSelection();
1042 view
->setCurrentIndex(proxyIndex
);
1043 if (clearSelection
) {
1044 view
->clearSelection();
1046 m_activeItemUrl
.clear();
1050 if (!m_selectedItems
.isEmpty()) {
1051 const KUrl
& baseUrl
= url();
1053 QItemSelection newSelection
;
1054 foreach(const KFileItem
& item
, m_selectedItems
) {
1055 url
= item
.url().upUrl();
1056 if (baseUrl
.equals(url
, KUrl::CompareWithoutTrailingSlash
)) {
1057 QModelIndex index
= m_viewAccessor
.proxyModel()->mapFromSource(m_viewAccessor
.dirModel()->indexForItem(item
));
1058 newSelection
.select(index
, index
);
1061 m_viewAccessor
.itemView()->selectionModel()->select(newSelection
,
1062 QItemSelectionModel::ClearAndSelect
1063 | QItemSelectionModel::Current
);
1064 m_selectedItems
.clear();
1067 // Restore the contents position. This has to be done using a Qt::QueuedConnection
1068 // because the view might not be in its final state yet.
1069 QMetaObject::invokeMethod(this, "restoreContentsPosition", Qt::QueuedConnection
);
1071 emit
finishedPathLoading(url());
1074 void DolphinView::slotRefreshItems()
1076 if (m_assureVisibleCurrentIndex
) {
1077 m_assureVisibleCurrentIndex
= false;
1078 m_viewAccessor
.itemView()->scrollTo(m_viewAccessor
.itemView()->currentIndex());
1082 void DolphinView::loadDirectory(const KUrl
& url
, bool reload
)
1084 if (!url
.isValid()) {
1085 const QString
location(url
.pathOrUrl());
1086 if (location
.isEmpty()) {
1087 emit
errorMessage(i18nc("@info:status", "The location is empty."));
1089 emit
errorMessage(i18nc("@info:status", "The location '%1' is invalid.", location
));
1094 KDirLister
* dirLister
= m_viewAccessor
.dirLister();
1095 dirLister
->openUrl(url
, reload
? KDirLister::Reload
: KDirLister::NoFlags
);
1098 void DolphinView::applyViewProperties()
1100 const ViewProperties
props(rootUrl());
1102 const Mode mode
= props
.viewMode();
1103 if (m_mode
!= mode
) {
1104 const int oldZoomLevel
= m_viewModeController
->zoomLevel();
1110 updateZoomLevel(oldZoomLevel
);
1112 if (m_viewAccessor
.itemView() == 0) {
1116 Q_ASSERT(m_viewAccessor
.itemView() != 0);
1117 Q_ASSERT(m_viewAccessor
.itemDelegate() != 0);
1119 const bool showHiddenFiles
= props
.showHiddenFiles();
1120 if (showHiddenFiles
!= m_viewAccessor
.dirLister()->showingDotFiles()) {
1121 m_viewAccessor
.dirLister()->setShowingDotFiles(showHiddenFiles
);
1122 emit
showHiddenFilesChanged();
1125 m_storedCategorizedSorting
= props
.categorizedSorting();
1126 const bool categorized
= m_storedCategorizedSorting
&& supportsCategorizedSorting();
1127 if (categorized
!= m_viewAccessor
.proxyModel()->isCategorizedModel()) {
1128 m_viewAccessor
.proxyModel()->setCategorizedModel(categorized
);
1129 emit
categorizedSortingChanged();
1132 const DolphinView::Sorting sorting
= props
.sorting();
1133 if (sorting
!= m_viewAccessor
.proxyModel()->sorting()) {
1134 m_viewAccessor
.proxyModel()->setSorting(sorting
);
1135 emit
sortingChanged(sorting
);
1138 const Qt::SortOrder sortOrder
= props
.sortOrder();
1139 if (sortOrder
!= m_viewAccessor
.proxyModel()->sortOrder()) {
1140 m_viewAccessor
.proxyModel()->setSortOrder(sortOrder
);
1141 emit
sortOrderChanged(sortOrder
);
1144 const bool sortFoldersFirst
= props
.sortFoldersFirst();
1145 if (sortFoldersFirst
!= m_viewAccessor
.proxyModel()->sortFoldersFirst()) {
1146 m_viewAccessor
.proxyModel()->setSortFoldersFirst(sortFoldersFirst
);
1147 emit
sortFoldersFirstChanged(sortFoldersFirst
);
1150 KFileItemDelegate::InformationList info
= props
.additionalInfo();
1151 if (info
!= m_viewAccessor
.itemDelegate()->showInformation()) {
1152 m_viewAccessor
.itemDelegate()->setShowInformation(info
);
1153 emit
additionalInfoChanged();
1156 const bool showPreview
= props
.showPreview();
1157 if (showPreview
!= m_showPreview
) {
1158 m_showPreview
= showPreview
;
1159 const int oldZoomLevel
= m_viewModeController
->zoomLevel();
1160 emit
showPreviewChanged();
1162 // Enabling or disabling the preview might change the icon size of the view.
1163 // As the view does not emit a signal when the icon size has been changed,
1164 // the used zoom level of the controller must be adjusted manually:
1165 updateZoomLevel(oldZoomLevel
);
1169 void DolphinView::createView()
1173 Q_ASSERT(m_viewAccessor
.itemView() == 0);
1174 Q_ASSERT(m_dolphinViewController
->itemView() == 0);
1175 m_viewAccessor
.createView(this, m_dolphinViewController
, m_viewModeController
, m_mode
);
1177 QAbstractItemView
* view
= m_viewAccessor
.itemView();
1178 Q_ASSERT(view
!= 0);
1179 view
->installEventFilter(this);
1180 view
->viewport()->installEventFilter(this);
1182 m_dolphinViewController
->setItemView(view
);
1184 const int zoomLevel
= ZoomLevelInfo::zoomLevelForIconSize(view
->iconSize());
1185 m_viewModeController
->setZoomLevel(zoomLevel
);
1187 connect(view
->selectionModel(), SIGNAL(selectionChanged(QItemSelection
, QItemSelection
)),
1188 this, SLOT(slotSelectionChanged(QItemSelection
, QItemSelection
)));
1190 setFocusProxy(m_viewAccessor
.layoutTarget());
1191 m_topLayout
->insertWidget(1, m_viewAccessor
.layoutTarget());
1194 void DolphinView::deleteView()
1196 QAbstractItemView
* view
= m_viewAccessor
.itemView();
1197 Q_ASSERT((m_dolphinViewController
->itemView() == 0) || (m_dolphinViewController
->itemView() == view
));
1198 m_dolphinViewController
->setItemView(0);
1201 if (view
->selectionModel() != 0) {
1202 disconnect(view
->selectionModel(), SIGNAL(selectionChanged(QItemSelection
, QItemSelection
)),
1203 this, SLOT(slotSelectionChanged(QItemSelection
, QItemSelection
)));
1206 // It's important to set the keyboard focus to the parent
1207 // before deleting the view: Otherwise when having a split
1208 // view the other view will get the focus and will request
1209 // an activation (see DolphinView::eventFilter()).
1213 m_viewModeController
->disconnect(view
);
1215 m_viewAccessor
.deleteView();
1219 void DolphinView::pasteToUrl(const KUrl
& url
)
1221 addNewFileNames(QApplication::clipboard()->mimeData());
1222 KonqOperations::doPaste(this, url
);
1225 void DolphinView::updateZoomLevel(int oldZoomLevel
)
1227 const int newZoomLevel
= ZoomLevelInfo::zoomLevelForIconSize(m_viewAccessor
.itemView()->iconSize());
1228 if (oldZoomLevel
!= newZoomLevel
) {
1229 m_viewModeController
->setZoomLevel(newZoomLevel
);
1230 emit
zoomLevelChanged(newZoomLevel
);
1234 KUrl::List
DolphinView::simplifiedSelectedUrls() const
1238 const KFileItemList items
= selectedItems();
1239 foreach (const KFileItem
&item
, items
) {
1240 urls
.append(item
.url());
1244 if (itemsExpandable()) {
1245 urls
= KDirModel::simplifiedUrlList(urls
);
1251 QMimeData
* DolphinView::selectionMimeData() const
1253 const QAbstractItemView
* view
= m_viewAccessor
.itemView();
1254 Q_ASSERT((view
!= 0) && (view
->selectionModel() != 0));
1255 const QItemSelection selection
= m_viewAccessor
.proxyModel()->mapSelectionToSource(view
->selectionModel()->selection());
1256 return m_viewAccessor
.dirModel()->mimeData(selection
.indexes());
1259 void DolphinView::addNewFileNames(const QMimeData
* mimeData
)
1261 const KUrl::List urls
= KUrl::List::fromMimeData(mimeData
);
1262 foreach (const KUrl
& url
, urls
) {
1263 m_newFileNames
.insert(url
.fileName());
1267 QItemSelection
DolphinView::childrenMatchingPattern(const QModelIndex
& parent
, const QRegExp
& pattern
) const
1269 QItemSelection matchingIndexes
;
1270 const DolphinSortFilterProxyModel
* proxyModel
= m_viewAccessor
.proxyModel();
1271 const DolphinModel
* dolphinModel
= m_viewAccessor
.dirModel();
1273 const int rowCount
= proxyModel
->rowCount(parent
);
1275 for (int row
= 0; row
< rowCount
; ++row
) {
1276 QModelIndex index
= proxyModel
->index(row
, 0, parent
);
1277 QModelIndex sourceIndex
= proxyModel
->mapToSource(index
);
1279 if (sourceIndex
.isValid() && pattern
.exactMatch(dolphinModel
->data(sourceIndex
).toString())) {
1280 matchingIndexes
+= QItemSelectionRange(index
);
1283 if (proxyModel
->hasChildren(index
)) {
1284 matchingIndexes
+= childrenMatchingPattern(index
, pattern
);
1288 return matchingIndexes
;
1291 DolphinView::ViewAccessor::ViewAccessor(DolphinSortFilterProxyModel
* proxyModel
) :
1295 m_columnsContainer(0),
1296 m_proxyModel(proxyModel
),
1301 DolphinView::ViewAccessor::~ViewAccessor()
1303 delete m_dragSource
;
1307 void DolphinView::ViewAccessor::createView(QWidget
* parent
,
1308 DolphinViewController
* dolphinViewController
,
1309 const ViewModeController
* viewModeController
,
1312 Q_ASSERT(itemView() == 0);
1316 m_iconsView
= new DolphinIconsView(parent
,
1317 dolphinViewController
,
1323 m_detailsView
= new DolphinDetailsView(parent
,
1324 dolphinViewController
,
1330 m_columnsContainer
= new DolphinColumnViewContainer(parent
,
1331 dolphinViewController
,
1332 viewModeController
);
1333 if (!m_rootUrl
.isEmpty() && m_rootUrl
.isParentOf(viewModeController
->url())) {
1334 // The column-view must show several columns starting with m_rootUrl as
1335 // first column and viewModeController->url() as last column.
1336 m_columnsContainer
->showColumn(m_rootUrl
);
1337 m_columnsContainer
->showColumn(viewModeController
->url());
1346 void DolphinView::ViewAccessor::deleteView()
1348 if (m_columnsContainer
!= 0) {
1349 m_columnsContainer
->close();
1350 m_columnsContainer
->disconnect();
1351 m_columnsContainer
->deleteLater();
1352 m_columnsContainer
= 0;
1354 QAbstractItemView
* view
= itemView();
1359 if (DragAndDropHelper::instance().isDragSource(view
)) {
1360 // The view is a drag source (the feature "Open folders
1361 // during drag operations" is used). Deleting the view
1362 // during an ongoing drag operation is not allowed, so
1363 // this will postponed.
1364 if (m_dragSource
!= 0) {
1365 // the old stored view is obviously not the drag source anymore
1366 m_dragSource
->deleteLater();
1370 m_dragSource
= view
;
1372 view
->deleteLater();
1382 void DolphinView::ViewAccessor::prepareUrlChange(const KUrl
& url
)
1384 if (m_columnsContainer
!= 0) {
1385 m_columnsContainer
->showColumn(url
);
1389 QAbstractItemView
* DolphinView::ViewAccessor::itemView() const
1391 if (m_iconsView
!= 0) {
1395 if (m_detailsView
!= 0) {
1396 return m_detailsView
;
1399 if (m_columnsContainer
!= 0) {
1400 return m_columnsContainer
->activeColumn();
1406 KFileItemDelegate
* DolphinView::ViewAccessor::itemDelegate() const
1408 return static_cast<KFileItemDelegate
*>(itemView()->itemDelegate());
1411 QWidget
* DolphinView::ViewAccessor::layoutTarget() const
1413 if (m_columnsContainer
!= 0) {
1414 return m_columnsContainer
;
1419 void DolphinView::ViewAccessor::setRootUrl(const KUrl
& rootUrl
)
1421 m_rootUrl
= rootUrl
;
1424 KUrl
DolphinView::ViewAccessor::rootUrl() const
1426 return (m_columnsContainer
!= 0) ? m_columnsContainer
->rootUrl() : m_rootUrl
;
1429 bool DolphinView::ViewAccessor::supportsCategorizedSorting() const
1431 return m_iconsView
!= 0;
1434 bool DolphinView::ViewAccessor::itemsExpandable() const
1436 return (m_detailsView
!= 0) && m_detailsView
->itemsExpandable();
1439 QSet
<KUrl
> DolphinView::ViewAccessor::expandedUrls() const
1441 if (m_detailsView
!= 0) {
1442 return m_detailsView
->expandedUrls();
1445 return QSet
<KUrl
>();
1448 const DolphinDetailsViewExpander
* DolphinView::ViewAccessor::setExpandedUrls(const QSet
<KUrl
>& urlsToExpand
)
1450 if ((m_detailsView
!= 0) && m_detailsView
->itemsExpandable() && !urlsToExpand
.isEmpty()) {
1451 // Check if another expander is already active and stop it if necessary.
1452 if(!m_detailsViewExpander
.isNull()) {
1453 m_detailsViewExpander
->stop();
1456 m_detailsViewExpander
= new DolphinDetailsViewExpander(m_detailsView
, urlsToExpand
);
1457 return m_detailsViewExpander
;
1464 bool DolphinView::ViewAccessor::reloadOnAdditionalInfoChange() const
1466 // the details view requires no reloading of the directory, as it maps
1467 // the file item delegate info to its columns internally
1468 return m_detailsView
!= 0;
1471 DolphinModel
* DolphinView::ViewAccessor::dirModel() const
1473 return static_cast<DolphinModel
*>(proxyModel()->sourceModel());
1476 DolphinSortFilterProxyModel
* DolphinView::ViewAccessor::proxyModel() const
1478 if (m_columnsContainer
!= 0) {
1479 return static_cast<DolphinSortFilterProxyModel
*>(m_columnsContainer
->activeColumn()->model());
1481 return m_proxyModel
;
1484 KDirLister
* DolphinView::ViewAccessor::dirLister() const
1486 return dirModel()->dirLister();
1489 void DolphinView::slotRedirection(const KUrl
& oldUrl
, const KUrl
& newUrl
)
1491 if (oldUrl
.equals(url(), KUrl::CompareWithoutTrailingSlash
)) {
1492 emit
redirection(oldUrl
, newUrl
);
1493 m_viewModeController
->redirectToUrl(newUrl
); // #186947
1497 void DolphinView::restoreContentsPosition()
1499 if (!m_restoredContentsPosition
.isNull()) {
1500 const int x
= m_restoredContentsPosition
.x();
1501 const int y
= m_restoredContentsPosition
.y();
1502 m_restoredContentsPosition
= QPoint();
1504 QAbstractItemView
* view
= m_viewAccessor
.itemView();
1505 Q_ASSERT(view
!= 0);
1506 view
->horizontalScrollBar()->setValue(x
);
1507 view
->verticalScrollBar()->setValue(y
);
1511 #include "dolphinview.moc"