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 // When a new item has been created by the "Create New..." menu, the item should
129 // get selected and it must be assured that the item will get visible. As the
130 // creation is done asynchronously, several signals must be checked:
131 connect(&DolphinNewFileMenuObserver::instance(), SIGNAL(itemCreated(const KUrl
&)),
132 this, SLOT(observeCreatedItem(const KUrl
&)));
134 m_selectionChangedTimer
= new QTimer(this);
135 m_selectionChangedTimer
->setSingleShot(true);
136 m_selectionChangedTimer
->setInterval(300);
137 connect(m_selectionChangedTimer
, SIGNAL(timeout()),
138 this, SLOT(emitSelectionChangedSignal()));
140 applyViewProperties();
141 m_topLayout
->addWidget(m_viewAccessor
.layoutTarget());
144 DolphinView::~DolphinView()
148 KUrl
DolphinView::url() const
150 return m_viewModeController
->url();
153 KUrl
DolphinView::rootUrl() const
155 const KUrl viewUrl
= url();
156 const KUrl root
= m_viewAccessor
.rootUrl();
157 if (root
.isEmpty() || !root
.isParentOf(viewUrl
)) {
163 void DolphinView::setActive(bool active
)
165 if (active
== m_active
) {
171 QColor color
= KColorScheme(QPalette::Active
, KColorScheme::View
).background().color();
173 emitSelectionChangedSignal();
178 QWidget
* viewport
= m_viewAccessor
.itemView()->viewport();
180 palette
.setColor(viewport
->backgroundRole(), color
);
181 viewport
->setPalette(palette
);
186 m_viewAccessor
.itemView()->setFocus();
190 m_viewModeController
->indicateActivationChange(active
);
193 bool DolphinView::isActive() const
198 void DolphinView::setMode(Mode mode
)
200 if (mode
== m_mode
) {
201 return; // the wished mode is already set
204 const int oldZoomLevel
= m_viewModeController
->zoomLevel();
207 // remember the currently selected items, so that they will
208 // be restored after reloading the directory
209 m_selectedItems
= selectedItems();
213 const KUrl viewPropsUrl
= rootUrl();
214 ViewProperties
props(viewPropsUrl
);
215 props
.setViewMode(m_mode
);
218 // the file item delegate has been recreated, apply the current
219 // additional information manually
220 const KFileItemDelegate::InformationList infoList
= props
.additionalInfo();
221 m_viewAccessor
.itemDelegate()->setShowInformation(infoList
);
222 emit
additionalInfoChanged();
224 // Not all view modes support categorized sorting. Adjust the sorting model
225 // if changing the view mode results in a change of the categorized sorting
227 m_storedCategorizedSorting
= props
.categorizedSorting();
228 const bool categorized
= m_storedCategorizedSorting
&& supportsCategorizedSorting();
229 if (categorized
!= m_viewAccessor
.proxyModel()->isCategorizedModel()) {
230 m_viewAccessor
.proxyModel()->setCategorizedModel(categorized
);
231 emit
categorizedSortingChanged();
236 updateZoomLevel(oldZoomLevel
);
237 loadDirectory(viewPropsUrl
);
240 DolphinView::Mode
DolphinView::mode() const
245 bool DolphinView::showPreview() const
247 return m_showPreview
;
250 bool DolphinView::showHiddenFiles() const
252 return m_viewAccessor
.dirLister()->showingDotFiles();
255 bool DolphinView::categorizedSorting() const
257 // If all view modes would support categorized sorting, returning
258 // m_viewAccessor.proxyModel()->isCategorizedModel() would be the way to go. As
259 // currently only the icons view supports caterized sorting, we remember
260 // the stored view properties state in m_storedCategorizedSorting and
261 // return this state. The application takes care to disable the corresponding
262 // checkbox by checking DolphinView::supportsCategorizedSorting() to indicate
263 // that this setting is not applied to the current view mode.
264 return m_storedCategorizedSorting
;
267 bool DolphinView::supportsCategorizedSorting() const
269 return m_viewAccessor
.supportsCategorizedSorting();
272 KFileItemList
DolphinView::items() const
274 return m_viewAccessor
.dirLister()->items();
277 KFileItemList
DolphinView::selectedItems() const
279 KFileItemList itemList
;
280 const QAbstractItemView
* view
= m_viewAccessor
.itemView();
285 const QItemSelection selection
= m_viewAccessor
.proxyModel()->mapSelectionToSource(view
->selectionModel()->selection());
287 const QModelIndexList indexList
= selection
.indexes();
288 foreach (const QModelIndex
&index
, indexList
) {
289 KFileItem item
= m_viewAccessor
.dirModel()->itemForIndex(index
);
290 if (!item
.isNull()) {
291 itemList
.append(item
);
298 int DolphinView::selectedItemsCount() const
300 const QAbstractItemView
* view
= m_viewAccessor
.itemView();
305 return view
->selectionModel()->selectedIndexes().count();
308 void DolphinView::markUrlsAsSelected(const QList
<KUrl
>& urls
)
310 foreach (const KUrl
& url
, urls
) {
311 KFileItem
item(KFileItem::Unknown
, KFileItem::Unknown
, url
);
312 m_selectedItems
.append(item
);
316 void DolphinView::setItemSelectionEnabled(const QRegExp
& pattern
, bool enabled
)
318 const QItemSelection matchingIndexes
= childrenMatchingPattern(QModelIndex(), pattern
);
319 const QItemSelectionModel::SelectionFlags command
= enabled
320 ? QItemSelectionModel::Select
321 : QItemSelectionModel::Deselect
;
322 m_viewAccessor
.itemView()->selectionModel()->select(matchingIndexes
, command
);
325 void DolphinView::setZoomLevel(int level
)
327 if (level
< ZoomLevelInfo::minimumLevel()) {
328 level
= ZoomLevelInfo::minimumLevel();
329 } else if (level
> ZoomLevelInfo::maximumLevel()) {
330 level
= ZoomLevelInfo::maximumLevel();
333 if (level
!= zoomLevel()) {
334 m_viewModeController
->setZoomLevel(level
);
335 emit
zoomLevelChanged(level
);
339 int DolphinView::zoomLevel() const
341 return m_viewModeController
->zoomLevel();
344 void DolphinView::setSorting(Sorting sorting
)
346 if (sorting
!= this->sorting()) {
347 updateSorting(sorting
);
351 DolphinView::Sorting
DolphinView::sorting() const
353 return m_viewAccessor
.proxyModel()->sorting();
356 void DolphinView::setSortOrder(Qt::SortOrder order
)
358 if (sortOrder() != order
) {
359 updateSortOrder(order
);
363 Qt::SortOrder
DolphinView::sortOrder() const
365 return m_viewAccessor
.proxyModel()->sortOrder();
368 void DolphinView::setSortFoldersFirst(bool foldersFirst
)
370 if (sortFoldersFirst() != foldersFirst
) {
371 updateSortFoldersFirst(foldersFirst
);
375 bool DolphinView::sortFoldersFirst() const
377 return m_viewAccessor
.proxyModel()->sortFoldersFirst();
380 void DolphinView::setAdditionalInfo(KFileItemDelegate::InformationList info
)
382 const KUrl viewPropsUrl
= rootUrl();
383 ViewProperties
props(viewPropsUrl
);
384 props
.setAdditionalInfo(info
);
385 m_viewAccessor
.itemDelegate()->setShowInformation(info
);
387 emit
additionalInfoChanged();
389 if (m_viewAccessor
.reloadOnAdditionalInfoChange()) {
390 loadDirectory(viewPropsUrl
);
394 KFileItemDelegate::InformationList
DolphinView::additionalInfo() const
396 return m_viewAccessor
.itemDelegate()->showInformation();
399 void DolphinView::reload()
401 QByteArray viewState
;
402 QDataStream
saveStream(&viewState
, QIODevice::WriteOnly
);
403 saveState(saveStream
);
404 m_selectedItems
= selectedItems();
407 loadDirectory(url(), true);
409 QDataStream
restoreStream(viewState
);
410 restoreState(restoreStream
);
413 void DolphinView::stopLoading()
415 m_viewAccessor
.dirLister()->stop();
418 void DolphinView::refresh()
420 const bool oldActivationState
= m_active
;
421 const int oldZoomLevel
= m_viewModeController
->zoomLevel();
425 applyViewProperties();
428 setActive(oldActivationState
);
429 updateZoomLevel(oldZoomLevel
);
432 void DolphinView::setNameFilter(const QString
& nameFilter
)
434 m_viewModeController
->setNameFilter(nameFilter
);
437 void DolphinView::calculateItemCount(int& fileCount
,
439 KIO::filesize_t
& totalFileSize
) const
441 foreach (const KFileItem
& item
, m_viewAccessor
.dirLister()->items()) {
446 totalFileSize
+= item
.size();
451 QString
DolphinView::statusBarText() const
456 KIO::filesize_t totalFileSize
= 0;
458 if (hasSelection()) {
459 // give a summary of the status of the selected files
460 const KFileItemList list
= selectedItems();
461 if (list
.isEmpty()) {
462 // when an item is triggered, it is temporary selected but selectedItems()
463 // will return an empty list
467 KFileItemList::const_iterator it
= list
.begin();
468 const KFileItemList::const_iterator end
= list
.end();
470 const KFileItem
& item
= *it
;
475 totalFileSize
+= item
.size();
480 if (folderCount
+ fileCount
== 1) {
481 // if only one item is selected, show the filename
482 const QString name
= list
.first().text();
483 text
= (folderCount
== 1) ? i18nc("@info:status", "<filename>%1</filename> selected", name
) :
484 i18nc("@info:status", "<filename>%1</filename> selected (%2)",
485 name
, KIO::convertSize(totalFileSize
));
487 // at least 2 items are selected
488 const QString foldersText
= i18ncp("@info:status", "1 Folder selected", "%1 Folders selected", folderCount
);
489 const QString filesText
= i18ncp("@info:status", "1 File selected", "%1 Files selected", fileCount
);
490 if ((folderCount
> 0) && (fileCount
> 0)) {
491 text
= i18nc("@info:status folders, files (size)", "%1, %2 (%3)",
492 foldersText
, filesText
, KIO::convertSize(totalFileSize
));
493 } else if (fileCount
> 0) {
494 text
= i18nc("@info:status files (size)", "%1 (%2)", filesText
, KIO::convertSize(totalFileSize
));
496 Q_ASSERT(folderCount
> 0);
501 calculateItemCount(fileCount
, folderCount
, totalFileSize
);
502 text
= KIO::itemsSummaryString(fileCount
+ folderCount
,
503 fileCount
, folderCount
,
504 totalFileSize
, true);
510 QList
<QAction
*> DolphinView::versionControlActions(const KFileItemList
& items
) const
512 return m_dolphinViewController
->versionControlActions(items
);
515 void DolphinView::setUrl(const KUrl
& url
)
517 if (m_viewModeController
->url() == url
) {
521 const bool hadSelection
= hasSelection();
523 // The selection model and directory lister might change in the case of the column view:
524 disconnectViewAccessor();
526 m_newFileNames
.clear();
528 m_viewModeController
->setUrl(url
); // emits urlChanged, which we forward
529 m_viewAccessor
.prepareUrlChange(url
);
530 applyViewProperties();
533 // When changing the URL there is no need to keep the version
534 // data of the previous URL.
535 m_viewAccessor
.dirModel()->clearVersionData();
537 emit
startedPathLoading(url
);
539 // Reconnect to the (probably) new selection model and directory lister
540 connectViewAccessor();
542 if (hadSelection
|| hasSelection()) {
543 emitSelectionChangedSignal();
547 void DolphinView::selectAll()
549 m_viewAccessor
.itemView()->selectAll();
552 void DolphinView::invertSelection()
554 QItemSelectionModel
* selectionModel
= m_viewAccessor
.itemView()->selectionModel();
555 const QAbstractItemModel
* itemModel
= selectionModel
->model();
557 const QModelIndex topLeft
= itemModel
->index(0, 0);
558 const QModelIndex bottomRight
= itemModel
->index(itemModel
->rowCount() - 1,
559 itemModel
->columnCount() - 1);
561 const QItemSelection
selection(topLeft
, bottomRight
);
562 selectionModel
->select(selection
, QItemSelectionModel::Toggle
);
565 void DolphinView::clearSelection()
567 m_viewAccessor
.itemView()->clearSelection();
570 void DolphinView::renameSelectedItems()
572 KFileItemList items
= selectedItems();
573 const int itemCount
= items
.count();
578 if ((itemCount
== 1) && DolphinSettings::instance().generalSettings()->renameInline()) {
579 const QModelIndex dirIndex
= m_viewAccessor
.dirModel()->indexForItem(items
.first());
580 const QModelIndex proxyIndex
= m_viewAccessor
.proxyModel()->mapFromSource(dirIndex
);
581 m_viewAccessor
.itemView()->edit(proxyIndex
);
583 RenameDialog
* dialog
= new RenameDialog(this, items
);
584 dialog
->setAttribute(Qt::WA_DeleteOnClose
);
587 dialog
->activateWindow();
591 void DolphinView::trashSelectedItems()
593 const KUrl::List list
= simplifiedSelectedUrls();
594 KonqOperations::del(this, KonqOperations::TRASH
, list
);
597 void DolphinView::deleteSelectedItems()
599 const KUrl::List list
= simplifiedSelectedUrls();
600 const bool del
= KonqOperations::askDeleteConfirmation(list
,
602 KonqOperations::DEFAULT_CONFIRMATION
,
606 KIO::Job
* job
= KIO::del(list
);
607 connect(job
, SIGNAL(result(KJob
*)),
608 this, SLOT(slotDeleteFileFinished(KJob
*)));
612 void DolphinView::cutSelectedItems()
614 QMimeData
* mimeData
= selectionMimeData();
615 KonqMimeData::addIsCutSelection(mimeData
, true);
616 QApplication::clipboard()->setMimeData(mimeData
);
619 void DolphinView::copySelectedItems()
621 QMimeData
* mimeData
= selectionMimeData();
622 QApplication::clipboard()->setMimeData(mimeData
);
625 void DolphinView::paste()
630 void DolphinView::pasteIntoFolder()
632 const KFileItemList items
= selectedItems();
633 if ((items
.count() == 1) && items
.first().isDir()) {
634 pasteToUrl(items
.first().url());
638 void DolphinView::setShowPreview(bool show
)
640 if (m_showPreview
== show
) {
644 const KUrl viewPropsUrl
= rootUrl();
645 ViewProperties
props(viewPropsUrl
);
646 props
.setShowPreview(show
);
648 m_showPreview
= show
;
649 const int oldZoomLevel
= m_viewModeController
->zoomLevel();
650 emit
showPreviewChanged();
652 // Enabling or disabling the preview might change the icon size of the view.
653 // As the view does not emit a signal when the icon size has been changed,
654 // the used zoom level of the controller must be adjusted manually:
655 updateZoomLevel(oldZoomLevel
);
658 void DolphinView::setShowHiddenFiles(bool show
)
660 if (m_viewAccessor
.dirLister()->showingDotFiles() == show
) {
664 const KUrl viewPropsUrl
= rootUrl();
665 ViewProperties
props(viewPropsUrl
);
666 props
.setShowHiddenFiles(show
);
668 m_viewAccessor
.dirLister()->setShowingDotFiles(show
);
669 emit
showHiddenFilesChanged();
672 void DolphinView::setCategorizedSorting(bool categorized
)
674 if (categorized
== categorizedSorting()) {
678 // setCategorizedSorting(true) may only get invoked
679 // if the view supports categorized sorting
680 Q_ASSERT(!categorized
|| supportsCategorizedSorting());
682 ViewProperties
props(rootUrl());
683 props
.setCategorizedSorting(categorized
);
686 m_storedCategorizedSorting
= categorized
;
687 m_viewAccessor
.proxyModel()->setCategorizedModel(categorized
);
689 emit
categorizedSortingChanged();
692 void DolphinView::mouseReleaseEvent(QMouseEvent
* event
)
694 QWidget::mouseReleaseEvent(event
);
698 bool DolphinView::eventFilter(QObject
* watched
, QEvent
* event
)
700 switch (event
->type()) {
701 case QEvent::FocusIn
:
702 if (watched
== m_viewAccessor
.itemView()) {
703 m_dolphinViewController
->requestActivation();
707 case QEvent::DragEnter
:
708 if (watched
== m_viewAccessor
.itemView()->viewport()) {
713 case QEvent::KeyPress
:
714 if (watched
== m_viewAccessor
.itemView()) {
715 // clear the selection when Escape has been pressed
716 QKeyEvent
* keyEvent
= static_cast<QKeyEvent
*>(event
);
717 if (keyEvent
->key() == Qt::Key_Escape
) {
724 if (watched
== m_viewAccessor
.itemView()->viewport()) {
725 // Ctrl+wheel events should cause icon zooming, but not if the left mouse button is pressed
726 // (the user is probably trying to scroll during a selection in that case)
727 QWheelEvent
* wheelEvent
= static_cast<QWheelEvent
*>(event
);
728 if (wheelEvent
->modifiers() & Qt::ControlModifier
&& !(wheelEvent
->buttons() & Qt::LeftButton
)) {
729 const int delta
= wheelEvent
->delta();
730 const int level
= zoomLevel();
732 setZoomLevel(level
+ 1);
733 } else if (delta
< 0) {
734 setZoomLevel(level
- 1);
745 return QWidget::eventFilter(watched
, event
);
748 void DolphinView::activate()
753 void DolphinView::triggerItem(const KFileItem
& item
)
755 const Qt::KeyboardModifiers modifier
= QApplication::keyboardModifiers();
756 if ((modifier
& Qt::ShiftModifier
) || (modifier
& Qt::ControlModifier
)) {
757 // items are selected by the user, hence don't trigger the
758 // item specified by 'index'
762 // TODO: the m_isContextMenuOpen check is a workaround for Qt-issue 207192
763 if (item
.isNull() || m_isContextMenuOpen
) {
767 emit
itemTriggered(item
); // caught by DolphinViewContainer or DolphinPart
770 void DolphinView::slotSelectionChanged(const QItemSelection
& selected
, const QItemSelection
& deselected
)
772 const int count
= selectedItemsCount();
773 const bool selectionStateChanged
= ((count
> 0) && (selected
.count() == count
)) ||
774 ((count
== 0) && !deselected
.isEmpty());
776 // If nothing has been selected before and something got selected (or if something
777 // was selected before and now nothing is selected) the selectionChangedSignal must
778 // be emitted asynchronously as fast as possible to update the edit-actions.
779 m_selectionChangedTimer
->setInterval(selectionStateChanged
? 0 : 300);
780 m_selectionChangedTimer
->start();
783 void DolphinView::emitSelectionChangedSignal()
785 m_selectionChangedTimer
->stop();
786 emit
selectionChanged(selectedItems());
789 void DolphinView::openContextMenu(const QPoint
& pos
,
790 const QList
<QAction
*>& customActions
)
793 const QModelIndex index
= m_viewAccessor
.itemView()->indexAt(pos
);
794 if (index
.isValid() && (index
.column() == DolphinModel::Name
)) {
795 const QModelIndex dolphinModelIndex
= m_viewAccessor
.proxyModel()->mapToSource(index
);
796 item
= m_viewAccessor
.dirModel()->itemForIndex(dolphinModelIndex
);
799 m_isContextMenuOpen
= true; // TODO: workaround for Qt-issue 207192
800 emit
requestContextMenu(item
, url(), customActions
);
801 m_isContextMenuOpen
= false;
804 void DolphinView::dropUrls(const KFileItem
& destItem
,
805 const KUrl
& destPath
,
808 addNewFileNames(event
->mimeData());
809 DragAndDropHelper::instance().dropUrls(destItem
, destPath
, event
, this);
812 void DolphinView::updateSorting(DolphinView::Sorting sorting
)
814 ViewProperties
props(rootUrl());
815 props
.setSorting(sorting
);
817 m_viewAccessor
.proxyModel()->setSorting(sorting
);
819 emit
sortingChanged(sorting
);
822 void DolphinView::updateSortOrder(Qt::SortOrder order
)
824 ViewProperties
props(rootUrl());
825 props
.setSortOrder(order
);
827 m_viewAccessor
.proxyModel()->setSortOrder(order
);
829 emit
sortOrderChanged(order
);
832 void DolphinView::updateSortFoldersFirst(bool foldersFirst
)
834 ViewProperties
props(rootUrl());
835 props
.setSortFoldersFirst(foldersFirst
);
837 m_viewAccessor
.proxyModel()->setSortFoldersFirst(foldersFirst
);
839 emit
sortFoldersFirstChanged(foldersFirst
);
842 void DolphinView::updateAdditionalInfo(const KFileItemDelegate::InformationList
& info
)
844 ViewProperties
props(rootUrl());
845 props
.setAdditionalInfo(info
);
848 m_viewAccessor
.itemDelegate()->setShowInformation(info
);
850 emit
additionalInfoChanged();
853 void DolphinView::updateAdditionalInfoActions(KActionCollection
* collection
)
855 const AdditionalInfoAccessor
& infoAccessor
= AdditionalInfoAccessor::instance();
857 const KFileItemDelegate::InformationList checkedInfo
= m_viewAccessor
.itemDelegate()->showInformation();
858 const KFileItemDelegate::InformationList infoKeys
= infoAccessor
.keys();
860 const bool enable
= (m_mode
== DolphinView::DetailsView
) ||
861 (m_mode
== DolphinView::IconsView
);
863 foreach (const KFileItemDelegate::Information
& info
, infoKeys
) {
864 const QString name
= infoAccessor
.actionCollectionName(info
, AdditionalInfoAccessor::AdditionalInfoType
);
865 QAction
* action
= collection
->action(name
);
866 Q_ASSERT(action
!= 0);
867 action
->setEnabled(enable
);
868 action
->setChecked(checkedInfo
.contains(info
));
872 QPair
<bool, QString
> DolphinView::pasteInfo() const
874 return KonqOperations::pasteInfo(url());
877 void DolphinView::setTabsForFilesEnabled(bool tabsForFiles
)
879 m_tabsForFiles
= tabsForFiles
;
882 bool DolphinView::isTabsForFilesEnabled() const
884 return m_tabsForFiles
;
887 bool DolphinView::itemsExpandable() const
889 return m_viewAccessor
.itemsExpandable();
892 void DolphinView::restoreState(QDataStream
& stream
)
894 // Restore the URL of the current item that had the keyboard focus
895 stream
>> m_activeItemUrl
;
897 // Restore the root URL
900 m_viewAccessor
.setRootUrl(rootUrl
);
902 // Restore the view position
903 stream
>> m_restoredContentsPosition
;
905 // Restore expanded folders (only relevant for the details view - will be ignored by the view in other view modes)
906 QSet
<KUrl
> urlsToExpand
;
907 stream
>> urlsToExpand
;
908 const DolphinDetailsViewExpander
* expander
= m_viewAccessor
.setExpandedUrls(urlsToExpand
);
910 m_expanderActive
= true;
911 connect (expander
, SIGNAL(completed()), this, SLOT(slotLoadingCompleted()));
914 m_expanderActive
= false;
918 void DolphinView::saveState(QDataStream
& stream
)
920 // Save the URL of the current item that has the keyboard focus
921 KFileItem currentItem
;
922 const QAbstractItemView
* view
= m_viewAccessor
.itemView();
925 const QModelIndex proxyIndex
= view
->currentIndex();
926 const QModelIndex dirModelIndex
= m_viewAccessor
.proxyModel()->mapToSource(proxyIndex
);
927 currentItem
= m_viewAccessor
.dirModel()->itemForIndex(dirModelIndex
);
931 if (!currentItem
.isNull()) {
932 currentItemUrl
= currentItem
.url();
935 stream
<< currentItemUrl
;
938 stream
<< m_viewAccessor
.rootUrl();
940 // Save view position
941 const int x
= view
->horizontalScrollBar()->value();
942 const int y
= view
->verticalScrollBar()->value();
943 stream
<< QPoint(x
, y
);
945 // Save expanded folders (only relevant for the details view - the set will be empty in other view modes)
946 stream
<< m_viewAccessor
.expandedUrls();
949 bool DolphinView::hasSelection() const
951 const QAbstractItemView
* view
= m_viewAccessor
.itemView();
952 return (view
!= 0) && view
->selectionModel()->hasSelection();
955 void DolphinView::observeCreatedItem(const KUrl
& url
)
957 m_createdItemUrl
= url
;
958 connect(m_viewAccessor
.dirModel(), SIGNAL(rowsInserted(const QModelIndex
&, int, int)),
959 this, SLOT(selectAndScrollToCreatedItem()));
962 void DolphinView::selectAndScrollToCreatedItem()
964 const QModelIndex dirIndex
= m_viewAccessor
.dirModel()->indexForUrl(m_createdItemUrl
);
965 if (dirIndex
.isValid()) {
966 const QModelIndex proxyIndex
= m_viewAccessor
.proxyModel()->mapFromSource(dirIndex
);
967 m_viewAccessor
.itemView()->setCurrentIndex(proxyIndex
);
970 disconnect(m_viewAccessor
.dirModel(), SIGNAL(rowsInserted(const QModelIndex
&, int, int)),
971 this, SLOT(selectAndScrollToCreatedItem()));
972 m_createdItemUrl
= KUrl();
975 void DolphinView::showHoverInformation(const KFileItem
& item
)
977 emit
requestItemInfo(item
);
980 void DolphinView::clearHoverInformation()
982 emit
requestItemInfo(KFileItem());
985 void DolphinView::slotDeleteFileFinished(KJob
* job
)
987 if (job
->error() == 0) {
988 emit
operationCompletedMessage(i18nc("@info:status", "Delete operation completed."));
989 } else if (job
->error() != KIO::ERR_USER_CANCELED
) {
990 emit
errorMessage(job
->errorString());
994 void DolphinView::slotDirListerCompleted()
996 if (!m_expanderActive
) {
997 slotLoadingCompleted();
1000 if (!m_newFileNames
.isEmpty()) {
1001 // select all newly added items created by a paste operation or
1002 // a drag & drop operation, and clear the previous selection
1003 m_viewAccessor
.itemView()->clearSelection();
1004 const int rowCount
= m_viewAccessor
.proxyModel()->rowCount();
1005 QItemSelection selection
;
1006 for (int row
= 0; row
< rowCount
; ++row
) {
1007 const QModelIndex proxyIndex
= m_viewAccessor
.proxyModel()->index(row
, 0);
1008 const QModelIndex dirIndex
= m_viewAccessor
.proxyModel()->mapToSource(proxyIndex
);
1009 const KUrl url
= m_viewAccessor
.dirModel()->itemForIndex(dirIndex
).url();
1010 if (m_newFileNames
.contains(url
.fileName())) {
1011 selection
.merge(QItemSelection(proxyIndex
, proxyIndex
), QItemSelectionModel::Select
);
1014 m_viewAccessor
.itemView()->selectionModel()->select(selection
, QItemSelectionModel::Select
);
1016 m_newFileNames
.clear();
1020 void DolphinView::slotLoadingCompleted()
1022 m_expanderActive
= false;
1024 if (!m_activeItemUrl
.isEmpty()) {
1025 // assure that the current item remains visible
1026 const QModelIndex dirIndex
= m_viewAccessor
.dirModel()->indexForUrl(m_activeItemUrl
);
1027 if (dirIndex
.isValid()) {
1028 const QModelIndex proxyIndex
= m_viewAccessor
.proxyModel()->mapFromSource(dirIndex
);
1029 QAbstractItemView
* view
= m_viewAccessor
.itemView();
1030 const bool clearSelection
= !hasSelection();
1031 view
->setCurrentIndex(proxyIndex
);
1032 if (clearSelection
) {
1033 view
->clearSelection();
1035 m_activeItemUrl
.clear();
1039 if (!m_selectedItems
.isEmpty()) {
1040 const KUrl
& baseUrl
= url();
1042 QItemSelection newSelection
;
1043 foreach(const KFileItem
& item
, m_selectedItems
) {
1044 url
= item
.url().upUrl();
1045 if (baseUrl
.equals(url
, KUrl::CompareWithoutTrailingSlash
)) {
1046 QModelIndex index
= m_viewAccessor
.proxyModel()->mapFromSource(m_viewAccessor
.dirModel()->indexForItem(item
));
1047 newSelection
.select(index
, index
);
1050 m_viewAccessor
.itemView()->selectionModel()->select(newSelection
,
1051 QItemSelectionModel::ClearAndSelect
1052 | QItemSelectionModel::Current
);
1053 m_selectedItems
.clear();
1056 // Restore the contents position. This has to be done using a Qt::QueuedConnection
1057 // because the view might not be in its final state yet.
1058 QMetaObject::invokeMethod(this, "restoreContentsPosition", Qt::QueuedConnection
);
1060 emit
finishedPathLoading(url());
1063 void DolphinView::slotRefreshItems()
1065 if (m_assureVisibleCurrentIndex
) {
1066 m_assureVisibleCurrentIndex
= false;
1067 m_viewAccessor
.itemView()->scrollTo(m_viewAccessor
.itemView()->currentIndex());
1071 void DolphinView::loadDirectory(const KUrl
& url
, bool reload
)
1073 if (!url
.isValid()) {
1074 const QString
location(url
.pathOrUrl());
1075 if (location
.isEmpty()) {
1076 emit
errorMessage(i18nc("@info:status", "The location is empty."));
1078 emit
errorMessage(i18nc("@info:status", "The location '%1' is invalid.", location
));
1083 KDirLister
* dirLister
= m_viewAccessor
.dirLister();
1084 dirLister
->openUrl(url
, reload
? KDirLister::Reload
: KDirLister::NoFlags
);
1087 void DolphinView::applyViewProperties()
1089 const ViewProperties
props(rootUrl());
1091 const Mode mode
= props
.viewMode();
1092 if (m_mode
!= mode
) {
1093 const int oldZoomLevel
= m_viewModeController
->zoomLevel();
1099 updateZoomLevel(oldZoomLevel
);
1101 if (m_viewAccessor
.itemView() == 0) {
1105 Q_ASSERT(m_viewAccessor
.itemView() != 0);
1106 Q_ASSERT(m_viewAccessor
.itemDelegate() != 0);
1108 const bool showHiddenFiles
= props
.showHiddenFiles();
1109 if (showHiddenFiles
!= m_viewAccessor
.dirLister()->showingDotFiles()) {
1110 m_viewAccessor
.dirLister()->setShowingDotFiles(showHiddenFiles
);
1111 emit
showHiddenFilesChanged();
1114 m_storedCategorizedSorting
= props
.categorizedSorting();
1115 const bool categorized
= m_storedCategorizedSorting
&& supportsCategorizedSorting();
1116 if (categorized
!= m_viewAccessor
.proxyModel()->isCategorizedModel()) {
1117 m_viewAccessor
.proxyModel()->setCategorizedModel(categorized
);
1118 emit
categorizedSortingChanged();
1121 const DolphinView::Sorting sorting
= props
.sorting();
1122 if (sorting
!= m_viewAccessor
.proxyModel()->sorting()) {
1123 m_viewAccessor
.proxyModel()->setSorting(sorting
);
1124 emit
sortingChanged(sorting
);
1127 const Qt::SortOrder sortOrder
= props
.sortOrder();
1128 if (sortOrder
!= m_viewAccessor
.proxyModel()->sortOrder()) {
1129 m_viewAccessor
.proxyModel()->setSortOrder(sortOrder
);
1130 emit
sortOrderChanged(sortOrder
);
1133 const bool sortFoldersFirst
= props
.sortFoldersFirst();
1134 if (sortFoldersFirst
!= m_viewAccessor
.proxyModel()->sortFoldersFirst()) {
1135 m_viewAccessor
.proxyModel()->setSortFoldersFirst(sortFoldersFirst
);
1136 emit
sortFoldersFirstChanged(sortFoldersFirst
);
1139 KFileItemDelegate::InformationList info
= props
.additionalInfo();
1140 if (info
!= m_viewAccessor
.itemDelegate()->showInformation()) {
1141 m_viewAccessor
.itemDelegate()->setShowInformation(info
);
1142 emit
additionalInfoChanged();
1145 const bool showPreview
= props
.showPreview();
1146 if (showPreview
!= m_showPreview
) {
1147 m_showPreview
= showPreview
;
1148 const int oldZoomLevel
= m_viewModeController
->zoomLevel();
1149 emit
showPreviewChanged();
1151 // Enabling or disabling the preview might change the icon size of the view.
1152 // As the view does not emit a signal when the icon size has been changed,
1153 // the used zoom level of the controller must be adjusted manually:
1154 updateZoomLevel(oldZoomLevel
);
1158 void DolphinView::createView()
1162 Q_ASSERT(m_viewAccessor
.itemView() == 0);
1163 Q_ASSERT(m_dolphinViewController
->itemView() == 0);
1164 m_viewAccessor
.createView(this, m_dolphinViewController
, m_viewModeController
, m_mode
);
1166 QAbstractItemView
* view
= m_viewAccessor
.itemView();
1167 Q_ASSERT(view
!= 0);
1168 view
->installEventFilter(this);
1169 view
->viewport()->installEventFilter(this);
1171 m_dolphinViewController
->setItemView(view
);
1173 const int zoomLevel
= ZoomLevelInfo::zoomLevelForIconSize(view
->iconSize());
1174 m_viewModeController
->setZoomLevel(zoomLevel
);
1176 connectViewAccessor();
1178 setFocusProxy(m_viewAccessor
.layoutTarget());
1179 m_topLayout
->insertWidget(1, m_viewAccessor
.layoutTarget());
1182 void DolphinView::deleteView()
1184 QAbstractItemView
* view
= m_viewAccessor
.itemView();
1185 Q_ASSERT((m_dolphinViewController
->itemView() == 0) || (m_dolphinViewController
->itemView() == view
));
1186 m_dolphinViewController
->setItemView(0);
1189 disconnectViewAccessor();
1191 // It's important to set the keyboard focus to the parent
1192 // before deleting the view: Otherwise when having a split
1193 // view the other view will get the focus and will request
1194 // an activation (see DolphinView::eventFilter()).
1198 m_viewModeController
->disconnect(view
);
1200 m_viewAccessor
.deleteView();
1204 void DolphinView::pasteToUrl(const KUrl
& url
)
1206 addNewFileNames(QApplication::clipboard()->mimeData());
1207 KonqOperations::doPaste(this, url
);
1210 void DolphinView::updateZoomLevel(int oldZoomLevel
)
1212 const int newZoomLevel
= ZoomLevelInfo::zoomLevelForIconSize(m_viewAccessor
.itemView()->iconSize());
1213 if (oldZoomLevel
!= newZoomLevel
) {
1214 m_viewModeController
->setZoomLevel(newZoomLevel
);
1215 emit
zoomLevelChanged(newZoomLevel
);
1219 KUrl::List
DolphinView::simplifiedSelectedUrls() const
1223 const KFileItemList items
= selectedItems();
1224 foreach (const KFileItem
&item
, items
) {
1225 urls
.append(item
.url());
1229 if (itemsExpandable()) {
1230 urls
= KDirModel::simplifiedUrlList(urls
);
1236 QMimeData
* DolphinView::selectionMimeData() const
1238 const QAbstractItemView
* view
= m_viewAccessor
.itemView();
1239 Q_ASSERT((view
!= 0) && (view
->selectionModel() != 0));
1240 const QItemSelection selection
= m_viewAccessor
.proxyModel()->mapSelectionToSource(view
->selectionModel()->selection());
1241 return m_viewAccessor
.dirModel()->mimeData(selection
.indexes());
1244 void DolphinView::addNewFileNames(const QMimeData
* mimeData
)
1246 const KUrl::List urls
= KUrl::List::fromMimeData(mimeData
);
1247 foreach (const KUrl
& url
, urls
) {
1248 m_newFileNames
.insert(url
.fileName());
1252 QItemSelection
DolphinView::childrenMatchingPattern(const QModelIndex
& parent
, const QRegExp
& pattern
) const
1254 QItemSelection matchingIndexes
;
1255 const DolphinSortFilterProxyModel
* proxyModel
= m_viewAccessor
.proxyModel();
1256 const DolphinModel
* dolphinModel
= m_viewAccessor
.dirModel();
1258 const int rowCount
= proxyModel
->rowCount(parent
);
1260 for (int row
= 0; row
< rowCount
; ++row
) {
1261 QModelIndex index
= proxyModel
->index(row
, 0, parent
);
1262 QModelIndex sourceIndex
= proxyModel
->mapToSource(index
);
1264 if (sourceIndex
.isValid() && pattern
.exactMatch(dolphinModel
->data(sourceIndex
).toString())) {
1265 matchingIndexes
+= QItemSelectionRange(index
);
1268 if (proxyModel
->hasChildren(index
)) {
1269 matchingIndexes
+= childrenMatchingPattern(index
, pattern
);
1273 return matchingIndexes
;
1276 void DolphinView::connectViewAccessor()
1278 KDirLister
* dirLister
= m_viewAccessor
.dirLister();
1279 connect(dirLister
, SIGNAL(redirection(KUrl
,KUrl
)),
1280 this, SLOT(slotRedirection(KUrl
,KUrl
)));
1281 connect(dirLister
, SIGNAL(completed()),
1282 this, SLOT(slotDirListerCompleted()));
1283 connect(dirLister
, SIGNAL(refreshItems(const QList
<QPair
<KFileItem
,KFileItem
>>&)),
1284 this, SLOT(slotRefreshItems()));
1286 QAbstractItemView
* view
= m_viewAccessor
.itemView();
1287 connect(view
->selectionModel(), SIGNAL(selectionChanged(QItemSelection
, QItemSelection
)),
1288 this, SLOT(slotSelectionChanged(QItemSelection
, QItemSelection
)));
1291 void DolphinView::disconnectViewAccessor()
1293 KDirLister
* dirLister
= m_viewAccessor
.dirLister();
1294 disconnect(dirLister
, SIGNAL(redirection(KUrl
,KUrl
)),
1295 this, SLOT(slotRedirection(KUrl
,KUrl
)));
1296 disconnect(dirLister
, SIGNAL(completed()),
1297 this, SLOT(slotDirListerCompleted()));
1298 disconnect(dirLister
, SIGNAL(refreshItems(const QList
<QPair
<KFileItem
,KFileItem
>>&)),
1299 this, SLOT(slotRefreshItems()));
1301 QAbstractItemView
* view
= m_viewAccessor
.itemView();
1302 disconnect(view
->selectionModel(), SIGNAL(selectionChanged(QItemSelection
, QItemSelection
)),
1303 this, SLOT(slotSelectionChanged(QItemSelection
, QItemSelection
)));
1306 DolphinView::ViewAccessor::ViewAccessor(DolphinSortFilterProxyModel
* proxyModel
) :
1310 m_columnsContainer(0),
1311 m_proxyModel(proxyModel
),
1316 DolphinView::ViewAccessor::~ViewAccessor()
1318 delete m_dragSource
;
1322 void DolphinView::ViewAccessor::createView(QWidget
* parent
,
1323 DolphinViewController
* dolphinViewController
,
1324 const ViewModeController
* viewModeController
,
1327 Q_ASSERT(itemView() == 0);
1331 m_iconsView
= new DolphinIconsView(parent
,
1332 dolphinViewController
,
1338 m_detailsView
= new DolphinDetailsView(parent
,
1339 dolphinViewController
,
1345 m_columnsContainer
= new DolphinColumnViewContainer(parent
,
1346 dolphinViewController
,
1347 viewModeController
);
1348 if (!m_rootUrl
.isEmpty() && m_rootUrl
.isParentOf(viewModeController
->url())) {
1349 // The column-view must show several columns starting with m_rootUrl as
1350 // first column and viewModeController->url() as last column.
1351 m_columnsContainer
->showColumn(m_rootUrl
);
1352 m_columnsContainer
->showColumn(viewModeController
->url());
1361 void DolphinView::ViewAccessor::deleteView()
1363 if (m_columnsContainer
!= 0) {
1364 m_columnsContainer
->close();
1365 m_columnsContainer
->disconnect();
1366 m_columnsContainer
->deleteLater();
1367 m_columnsContainer
= 0;
1369 QAbstractItemView
* view
= itemView();
1374 if (DragAndDropHelper::instance().isDragSource(view
)) {
1375 // The view is a drag source (the feature "Open folders
1376 // during drag operations" is used). Deleting the view
1377 // during an ongoing drag operation is not allowed, so
1378 // this will postponed.
1379 if (m_dragSource
!= 0) {
1380 // the old stored view is obviously not the drag source anymore
1381 m_dragSource
->deleteLater();
1385 m_dragSource
= view
;
1387 view
->deleteLater();
1397 void DolphinView::ViewAccessor::prepareUrlChange(const KUrl
& url
)
1399 if (m_columnsContainer
!= 0) {
1400 m_columnsContainer
->showColumn(url
);
1404 QAbstractItemView
* DolphinView::ViewAccessor::itemView() const
1406 if (m_iconsView
!= 0) {
1410 if (m_detailsView
!= 0) {
1411 return m_detailsView
;
1414 if (m_columnsContainer
!= 0) {
1415 return m_columnsContainer
->activeColumn();
1421 KFileItemDelegate
* DolphinView::ViewAccessor::itemDelegate() const
1423 return static_cast<KFileItemDelegate
*>(itemView()->itemDelegate());
1426 QWidget
* DolphinView::ViewAccessor::layoutTarget() const
1428 if (m_columnsContainer
!= 0) {
1429 return m_columnsContainer
;
1434 void DolphinView::ViewAccessor::setRootUrl(const KUrl
& rootUrl
)
1436 m_rootUrl
= rootUrl
;
1439 KUrl
DolphinView::ViewAccessor::rootUrl() const
1441 return (m_columnsContainer
!= 0) ? m_columnsContainer
->rootUrl() : m_rootUrl
;
1444 bool DolphinView::ViewAccessor::supportsCategorizedSorting() const
1446 return m_iconsView
!= 0;
1449 bool DolphinView::ViewAccessor::itemsExpandable() const
1451 return (m_detailsView
!= 0) && m_detailsView
->itemsExpandable();
1454 QSet
<KUrl
> DolphinView::ViewAccessor::expandedUrls() const
1456 if (m_detailsView
!= 0) {
1457 return m_detailsView
->expandedUrls();
1460 return QSet
<KUrl
>();
1463 const DolphinDetailsViewExpander
* DolphinView::ViewAccessor::setExpandedUrls(const QSet
<KUrl
>& urlsToExpand
)
1465 if ((m_detailsView
!= 0) && m_detailsView
->itemsExpandable() && !urlsToExpand
.isEmpty()) {
1466 // Check if another expander is already active and stop it if necessary.
1467 if(!m_detailsViewExpander
.isNull()) {
1468 m_detailsViewExpander
->stop();
1471 m_detailsViewExpander
= new DolphinDetailsViewExpander(m_detailsView
, urlsToExpand
);
1472 return m_detailsViewExpander
;
1479 bool DolphinView::ViewAccessor::reloadOnAdditionalInfoChange() const
1481 // the details view requires no reloading of the directory, as it maps
1482 // the file item delegate info to its columns internally
1483 return m_detailsView
!= 0;
1486 DolphinModel
* DolphinView::ViewAccessor::dirModel() const
1488 return static_cast<DolphinModel
*>(proxyModel()->sourceModel());
1491 DolphinSortFilterProxyModel
* DolphinView::ViewAccessor::proxyModel() const
1493 if (m_columnsContainer
!= 0) {
1494 return static_cast<DolphinSortFilterProxyModel
*>(m_columnsContainer
->activeColumn()->model());
1496 return m_proxyModel
;
1499 KDirLister
* DolphinView::ViewAccessor::dirLister() const
1501 return dirModel()->dirLister();
1504 void DolphinView::slotRedirection(const KUrl
& oldUrl
, const KUrl
& newUrl
)
1506 if (oldUrl
.equals(url(), KUrl::CompareWithoutTrailingSlash
)) {
1507 emit
redirection(oldUrl
, newUrl
);
1508 m_viewModeController
->redirectToUrl(newUrl
); // #186947
1512 void DolphinView::restoreContentsPosition()
1514 if (!m_restoredContentsPosition
.isNull()) {
1515 const int x
= m_restoredContentsPosition
.x();
1516 const int y
= m_restoredContentsPosition
.y();
1517 m_restoredContentsPosition
= QPoint();
1519 QAbstractItemView
* view
= m_viewAccessor
.itemView();
1520 Q_ASSERT(view
!= 0);
1521 view
->horizontalScrollBar()->setValue(x
);
1522 view
->verticalScrollBar()->setValue(y
);
1526 #include "dolphinview.moc"