1 /***************************************************************************
2 * Copyright (C) 2006 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 <kmimetyperesolver.h>
45 #include <konq_fileitemcapabilities.h>
46 #include <konq_operations.h>
47 #include <konqmimedata.h>
48 #include <kstringhandler.h>
49 #include <ktoggleaction.h>
52 #include "dolphinmodel.h"
53 #include "dolphincolumnviewcontainer.h"
54 #include "dolphincontroller.h"
55 #include "dolphindetailsview.h"
56 #include "dolphinfileitemdelegate.h"
57 #include "dolphinnewmenuobserver.h"
58 #include "dolphinsortfilterproxymodel.h"
59 #include "dolphin_detailsmodesettings.h"
60 #include "dolphiniconsview.h"
61 #include "dolphin_generalsettings.h"
62 #include "draganddrophelper.h"
63 #include "folderexpander.h"
64 #include "renamedialog.h"
65 #include "settings/dolphinsettings.h"
66 #include "versioncontrolobserver.h"
67 #include "viewproperties.h"
68 #include "zoomlevelinfo.h"
71 * Helper function for sorting items with qSort() in
72 * DolphinView::renameSelectedItems().
74 bool lessThan(const KFileItem
& item1
, const KFileItem
& item2
)
76 return KStringHandler::naturalCompare(item1
.name(), item2
.name()) < 0;
79 DolphinView::DolphinView(QWidget
* parent
,
81 DolphinSortFilterProxyModel
* proxyModel
) :
85 m_loadingDirectory(false),
86 m_storedCategorizedSorting(false),
87 m_tabsForFiles(false),
88 m_isContextMenuOpen(false),
89 m_ignoreViewProperties(false),
90 m_assureVisibleCurrentIndex(false),
91 m_mode(DolphinView::IconsView
),
94 m_viewAccessor(proxyModel
),
95 m_selectionChangedTimer(0),
96 m_versionControlObserver(0),
102 m_expandedDragSource(0)
104 m_topLayout
= new QVBoxLayout(this);
105 m_topLayout
->setSpacing(0);
106 m_topLayout
->setMargin(0);
108 m_controller
= new DolphinController(this);
109 m_controller
->setUrl(url
);
111 connect(m_controller
, SIGNAL(urlChanged(const KUrl
&)),
112 this, SIGNAL(urlChanged(const KUrl
&)));
113 connect(m_controller
, SIGNAL(requestUrlChange(const KUrl
&)),
114 this, SLOT(slotRequestUrlChange(const KUrl
&)));
116 connect(m_controller
, SIGNAL(requestContextMenu(const QPoint
&, const QList
<QAction
*>&)),
117 this, SLOT(openContextMenu(const QPoint
&, const QList
<QAction
*>&)));
118 connect(m_controller
, SIGNAL(urlsDropped(const KFileItem
&, const KUrl
&, QDropEvent
*)),
119 this, SLOT(dropUrls(const KFileItem
&, const KUrl
&, QDropEvent
*)));
120 connect(m_controller
, SIGNAL(sortingChanged(DolphinView::Sorting
)),
121 this, SLOT(updateSorting(DolphinView::Sorting
)));
122 connect(m_controller
, SIGNAL(sortOrderChanged(Qt::SortOrder
)),
123 this, SLOT(updateSortOrder(Qt::SortOrder
)));
124 connect(m_controller
, SIGNAL(sortFoldersFirstChanged(bool)),
125 this, SLOT(updateSortFoldersFirst(bool)));
126 connect(m_controller
, SIGNAL(additionalInfoChanged(const KFileItemDelegate::InformationList
&)),
127 this, SLOT(updateAdditionalInfo(const KFileItemDelegate::InformationList
&)));
128 connect(m_controller
, SIGNAL(itemTriggered(const KFileItem
&)),
129 this, SLOT(triggerItem(const KFileItem
&)));
130 connect(m_controller
, SIGNAL(tabRequested(const KUrl
&)),
131 this, SIGNAL(tabRequested(const KUrl
&)));
132 connect(m_controller
, SIGNAL(activated()),
133 this, SLOT(activate()));
134 connect(m_controller
, SIGNAL(itemEntered(const KFileItem
&)),
135 this, SLOT(showHoverInformation(const KFileItem
&)));
136 connect(m_controller
, SIGNAL(viewportEntered()),
137 this, SLOT(clearHoverInformation()));
139 KDirLister
* dirLister
= m_viewAccessor
.dirLister();
140 connect(dirLister
, SIGNAL(redirection(KUrl
, KUrl
)),
141 this, SIGNAL(redirection(KUrl
, KUrl
)));
142 connect(dirLister
, SIGNAL(completed()),
143 this, SLOT(slotDirListerCompleted()));
144 connect(dirLister
, SIGNAL(refreshItems(const QList
<QPair
<KFileItem
,KFileItem
>>&)),
145 this, SLOT(slotRefreshItems()));
147 // When a new item has been created by the "Create New..." menu, the item should
148 // get selected and it must be assured that the item will get visible. As the
149 // creation is done asynchronously, several signals must be checked:
150 connect(&DolphinNewMenuObserver::instance(), SIGNAL(itemCreated(const KUrl
&)),
151 this, SLOT(observeCreatedItem(const KUrl
&)));
153 applyViewProperties();
154 m_topLayout
->addWidget(m_viewAccessor
.itemView());
157 DolphinView::~DolphinView()
159 delete m_expandedDragSource
;
160 m_expandedDragSource
= 0;
163 const KUrl
& DolphinView::url() const
165 return m_controller
->url();
168 KUrl
DolphinView::rootUrl() const
170 const KUrl viewUrl
= url();
171 const KUrl root
= m_viewAccessor
.rootUrl();
172 if (root
.isEmpty() || !root
.isParentOf(viewUrl
)) {
178 void DolphinView::setActive(bool active
)
180 if (active
== m_active
) {
186 QColor color
= KColorScheme(QPalette::Active
, KColorScheme::View
).background().color();
188 emitSelectionChangedSignal();
193 QWidget
* viewport
= m_viewAccessor
.itemView()->viewport();
195 palette
.setColor(viewport
->backgroundRole(), color
);
196 viewport
->setPalette(palette
);
201 m_viewAccessor
.itemView()->setFocus();
205 m_controller
->indicateActivationChange(active
);
208 bool DolphinView::isActive() const
213 void DolphinView::setMode(Mode mode
)
215 if (mode
== m_mode
) {
216 return; // the wished mode is already set
219 const int oldZoomLevel
= m_controller
->zoomLevel();
224 const KUrl viewPropsUrl
= rootUrl();
225 ViewProperties
props(viewPropsUrl
);
226 props
.setViewMode(m_mode
);
229 // the file item delegate has been recreated, apply the current
230 // additional information manually
231 const KFileItemDelegate::InformationList infoList
= props
.additionalInfo();
232 m_viewAccessor
.itemDelegate()->setShowInformation(infoList
);
233 emit
additionalInfoChanged();
235 // Not all view modes support categorized sorting. Adjust the sorting model
236 // if changing the view mode results in a change of the categorized sorting
238 m_storedCategorizedSorting
= props
.categorizedSorting();
239 const bool categorized
= m_storedCategorizedSorting
&& supportsCategorizedSorting();
240 if (categorized
!= m_viewAccessor
.proxyModel()->isCategorizedModel()) {
241 m_viewAccessor
.proxyModel()->setCategorizedModel(categorized
);
242 emit
categorizedSortingChanged();
247 updateZoomLevel(oldZoomLevel
);
249 loadDirectory(viewPropsUrl
);
253 DolphinView::Mode
DolphinView::mode() const
258 bool DolphinView::showPreview() const
260 return m_showPreview
;
263 bool DolphinView::showHiddenFiles() const
265 return m_viewAccessor
.dirLister()->showingDotFiles();
268 bool DolphinView::categorizedSorting() const
270 // If all view modes would support categorized sorting, returning
271 // m_viewAccessor.proxyModel()->isCategorizedModel() would be the way to go. As
272 // currently only the icons view supports caterized sorting, we remember
273 // the stored view properties state in m_storedCategorizedSorting and
274 // return this state. The application takes care to disable the corresponding
275 // checkbox by checking DolphinView::supportsCategorizedSorting() to indicate
276 // that this setting is not applied to the current view mode.
277 return m_storedCategorizedSorting
;
280 bool DolphinView::supportsCategorizedSorting() const
282 return m_viewAccessor
.supportsCategorizedSorting();
285 void DolphinView::selectAll()
287 QAbstractItemView
* view
= m_viewAccessor
.itemView();
288 // TODO: there seems to be a bug in QAbstractItemView::selectAll(); if
289 // the Ctrl-key is pressed (e. g. for Ctrl+A), selectAll() inverts the
290 // selection instead of selecting all items. This is bypassed for KDE 4.0
291 // by invoking clearSelection() first.
292 view
->clearSelection();
296 void DolphinView::invertSelection()
298 QItemSelectionModel
* selectionModel
= m_viewAccessor
.itemView()->selectionModel();
299 const QAbstractItemModel
* itemModel
= selectionModel
->model();
301 const QModelIndex topLeft
= itemModel
->index(0, 0);
302 const QModelIndex bottomRight
= itemModel
->index(itemModel
->rowCount() - 1,
303 itemModel
->columnCount() - 1);
305 const QItemSelection
selection(topLeft
, bottomRight
);
306 selectionModel
->select(selection
, QItemSelectionModel::Toggle
);
309 bool DolphinView::hasSelection() const
311 return m_viewAccessor
.itemView()->selectionModel()->hasSelection();
314 void DolphinView::clearSelection()
316 QItemSelectionModel
* selModel
= m_viewAccessor
.itemView()->selectionModel();
317 const QModelIndex currentIndex
= selModel
->currentIndex();
318 selModel
->setCurrentIndex(currentIndex
, QItemSelectionModel::Current
|
319 QItemSelectionModel::Clear
);
320 m_selectedItems
.clear();
323 KFileItemList
DolphinView::selectedItems() const
325 const QAbstractItemView
* view
= m_viewAccessor
.itemView();
327 // Our view has a selection, we will map them back to the DolphinModel
328 // and then fill the KFileItemList.
329 Q_ASSERT((view
!= 0) && (view
->selectionModel() != 0));
331 const QItemSelection selection
= m_viewAccessor
.proxyModel()->mapSelectionToSource(view
->selectionModel()->selection());
332 KFileItemList itemList
;
334 const QModelIndexList indexList
= selection
.indexes();
335 foreach (const QModelIndex
&index
, indexList
) {
336 KFileItem item
= m_viewAccessor
.dirModel()->itemForIndex(index
);
337 if (!item
.isNull()) {
338 itemList
.append(item
);
345 KUrl::List
DolphinView::selectedUrls() const
348 const KFileItemList list
= selectedItems();
349 foreach (const KFileItem
&item
, list
) {
350 urls
.append(item
.url());
355 int DolphinView::selectedItemsCount() const
357 return m_viewAccessor
.itemView()->selectionModel()->selectedIndexes().count();
360 void DolphinView::setContentsPosition(int x
, int y
)
362 QAbstractItemView
* view
= m_viewAccessor
.itemView();
363 view
->horizontalScrollBar()->setValue(x
);
364 view
->verticalScrollBar()->setValue(y
);
366 m_loadingDirectory
= false;
369 QPoint
DolphinView::contentsPosition() const
371 const int x
= m_viewAccessor
.itemView()->horizontalScrollBar()->value();
372 const int y
= m_viewAccessor
.itemView()->verticalScrollBar()->value();
376 void DolphinView::setZoomLevel(int level
)
378 if (level
< ZoomLevelInfo::minimumLevel()) {
379 level
= ZoomLevelInfo::minimumLevel();
380 } else if (level
> ZoomLevelInfo::maximumLevel()) {
381 level
= ZoomLevelInfo::maximumLevel();
384 if (level
!= zoomLevel()) {
385 m_controller
->setZoomLevel(level
);
386 emit
zoomLevelChanged(level
);
390 int DolphinView::zoomLevel() const
392 return m_controller
->zoomLevel();
395 void DolphinView::setSorting(Sorting sorting
)
397 if (sorting
!= this->sorting()) {
398 updateSorting(sorting
);
402 DolphinView::Sorting
DolphinView::sorting() const
404 return m_viewAccessor
.proxyModel()->sorting();
407 void DolphinView::setSortOrder(Qt::SortOrder order
)
409 if (sortOrder() != order
) {
410 updateSortOrder(order
);
414 Qt::SortOrder
DolphinView::sortOrder() const
416 return m_viewAccessor
.proxyModel()->sortOrder();
419 void DolphinView::setSortFoldersFirst(bool foldersFirst
)
421 if (sortFoldersFirst() != foldersFirst
) {
422 updateSortFoldersFirst(foldersFirst
);
426 bool DolphinView::sortFoldersFirst() const
428 return m_viewAccessor
.proxyModel()->sortFoldersFirst();
431 void DolphinView::setAdditionalInfo(KFileItemDelegate::InformationList info
)
433 const KUrl viewPropsUrl
= rootUrl();
434 ViewProperties
props(viewPropsUrl
);
435 props
.setAdditionalInfo(info
);
436 m_viewAccessor
.itemDelegate()->setShowInformation(info
);
438 emit
additionalInfoChanged();
440 if (m_viewAccessor
.reloadOnAdditionalInfoChange()) {
441 loadDirectory(viewPropsUrl
);
445 KFileItemDelegate::InformationList
DolphinView::additionalInfo() const
447 return m_viewAccessor
.itemDelegate()->showInformation();
450 void DolphinView::reload()
453 loadDirectory(url(), true);
456 void DolphinView::refresh()
458 m_ignoreViewProperties
= false;
460 const bool oldActivationState
= m_active
;
461 const int oldZoomLevel
= m_controller
->zoomLevel();
465 applyViewProperties();
468 setActive(oldActivationState
);
469 updateZoomLevel(oldZoomLevel
);
472 void DolphinView::updateView(const KUrl
& url
, const KUrl
& rootUrl
)
474 Q_UNUSED(rootUrl
); // TODO: remove after columnview-cleanup has been finished
476 if (m_controller
->url() == url
) {
480 m_controller
->setUrl(url
); // emits urlChanged, which we forward
481 m_viewAccessor
.prepareUrlChange(url
);
482 applyViewProperties();
485 // When changing the URL there is no need to keep the version
486 // data of the previous URL.
487 m_viewAccessor
.dirModel()->clearVersionData();
489 emit
startedPathLoading(url
);
492 void DolphinView::setNameFilter(const QString
& nameFilter
)
494 m_controller
->setNameFilter(nameFilter
);
497 void DolphinView::calculateItemCount(int& fileCount
,
499 KIO::filesize_t
& totalFileSize
) const
501 foreach (const KFileItem
& item
, m_viewAccessor
.dirLister()->items()) {
506 totalFileSize
+= item
.size();
511 QString
DolphinView::statusBarText() const
516 KIO::filesize_t totalFileSize
= 0;
518 if (hasSelection()) {
519 // give a summary of the status of the selected files
520 const KFileItemList list
= selectedItems();
521 if (list
.isEmpty()) {
522 // when an item is triggered, it is temporary selected but selectedItems()
523 // will return an empty list
527 KFileItemList::const_iterator it
= list
.begin();
528 const KFileItemList::const_iterator end
= list
.end();
530 const KFileItem
& item
= *it
;
535 totalFileSize
+= item
.size();
540 if (folderCount
+ fileCount
== 1) {
541 // if only one item is selected, show the filename
542 const QString name
= list
.first().name();
543 text
= (folderCount
== 1) ? i18nc("@info:status", "<filename>%1</filename> selected", name
) :
544 i18nc("@info:status", "<filename>%1</filename> selected (%2)",
545 name
, KIO::convertSize(totalFileSize
));
547 // at least 2 items are selected
548 const QString foldersText
= i18ncp("@info:status", "1 Folder selected", "%1 Folders selected", folderCount
);
549 const QString filesText
= i18ncp("@info:status", "1 File selected", "%1 Files selected", fileCount
);
550 if ((folderCount
> 0) && (fileCount
> 0)) {
551 text
= i18nc("@info:status folders, files (size)", "%1, %2 (%3)",
552 foldersText
, filesText
, KIO::convertSize(totalFileSize
));
553 } else if (fileCount
> 0) {
554 text
= i18nc("@info:status files (size)", "%1 (%2)", filesText
, KIO::convertSize(totalFileSize
));
556 Q_ASSERT(folderCount
> 0);
561 calculateItemCount(fileCount
, folderCount
, totalFileSize
);
562 text
= KIO::itemsSummaryString(fileCount
+ folderCount
,
563 fileCount
, folderCount
,
564 totalFileSize
, true);
570 QList
<QAction
*> DolphinView::versionControlActions(const KFileItemList
& items
) const
572 return items
.isEmpty()
573 ? m_versionControlObserver
->contextMenuActions(url().path(KUrl::AddTrailingSlash
))
574 : m_versionControlObserver
->contextMenuActions(items
);
577 void DolphinView::setUrl(const KUrl
& url
)
579 m_newFileNames
.clear();
580 updateView(url
, KUrl());
583 void DolphinView::changeSelection(const KFileItemList
& selection
)
586 if (selection
.isEmpty()) {
589 const KUrl
& baseUrl
= url();
591 QItemSelection newSelection
;
592 foreach(const KFileItem
& item
, selection
) {
593 url
= item
.url().upUrl();
594 if (baseUrl
.equals(url
, KUrl::CompareWithoutTrailingSlash
)) {
595 QModelIndex index
= m_viewAccessor
.proxyModel()->mapFromSource(m_viewAccessor
.dirModel()->indexForItem(item
));
596 newSelection
.select(index
, index
);
599 m_viewAccessor
.itemView()->selectionModel()->select(newSelection
,
600 QItemSelectionModel::ClearAndSelect
601 | QItemSelectionModel::Current
);
604 void DolphinView::renameSelectedItems()
606 KFileItemList items
= selectedItems();
607 const int itemCount
= items
.count();
613 // More than one item has been selected for renaming. Open
614 // a rename dialog and rename all items afterwards.
615 QPointer
<RenameDialog
> dialog
= new RenameDialog(this, items
);
616 if (dialog
->exec() == QDialog::Rejected
) {
621 const QString newName
= dialog
->newName();
622 if (newName
.isEmpty()) {
623 emit
errorMessage(dialog
->errorString());
629 // the selection would be invalid after renaming the items, so just clear
633 // TODO: check how this can be integrated into KIO::FileUndoManager/KonqOperations
634 // as one operation instead of n rename operations like it is done now...
635 Q_ASSERT(newName
.contains('#'));
637 // currently the items are sorted by the selection order, resort
638 // them by the file name
639 qSort(items
.begin(), items
.end(), lessThan
);
641 // iterate through all selected items and rename them...
643 foreach (const KFileItem
& item
, items
) {
644 const KUrl
& oldUrl
= item
.url();
646 number
.setNum(index
++);
648 QString name
= newName
;
649 name
.replace('#', number
);
651 if (oldUrl
.fileName() != name
) {
652 KUrl newUrl
= oldUrl
;
653 newUrl
.setFileName(name
);
654 KonqOperations::rename(this, oldUrl
, newUrl
);
657 } else if (DolphinSettings::instance().generalSettings()->renameInline()) {
658 Q_ASSERT(itemCount
== 1);
659 const QModelIndex dirIndex
= m_viewAccessor
.dirModel()->indexForItem(items
.first());
660 const QModelIndex proxyIndex
= m_viewAccessor
.proxyModel()->mapFromSource(dirIndex
);
661 m_viewAccessor
.itemView()->edit(proxyIndex
);
663 Q_ASSERT(itemCount
== 1);
665 QPointer
<RenameDialog
> dialog
= new RenameDialog(this, items
);
666 if (dialog
->exec() == QDialog::Rejected
) {
671 const QString newName
= dialog
->newName();
672 if (newName
.isEmpty()) {
673 emit
errorMessage(dialog
->errorString());
679 const KUrl
& oldUrl
= items
.first().url();
680 KUrl newUrl
= oldUrl
;
681 newUrl
.setFileName(newName
);
682 KonqOperations::rename(this, oldUrl
, newUrl
);
685 // assure that the current index remains visible when KDirLister
686 // will notify the view about changed items
687 m_assureVisibleCurrentIndex
= true;
690 void DolphinView::trashSelectedItems()
692 const KUrl::List list
= simplifiedSelectedUrls();
693 KonqOperations::del(this, KonqOperations::TRASH
, list
);
696 void DolphinView::deleteSelectedItems()
698 const KUrl::List list
= simplifiedSelectedUrls();
699 const bool del
= KonqOperations::askDeleteConfirmation(list
,
701 KonqOperations::DEFAULT_CONFIRMATION
,
705 KIO::Job
* job
= KIO::del(list
);
706 connect(job
, SIGNAL(result(KJob
*)),
707 this, SLOT(slotDeleteFileFinished(KJob
*)));
711 void DolphinView::cutSelectedItems()
713 QMimeData
* mimeData
= selectionMimeData();
714 KonqMimeData::addIsCutSelection(mimeData
, true);
715 QApplication::clipboard()->setMimeData(mimeData
);
718 void DolphinView::copySelectedItems()
720 QMimeData
* mimeData
= selectionMimeData();
721 QApplication::clipboard()->setMimeData(mimeData
);
724 void DolphinView::paste()
729 void DolphinView::pasteIntoFolder()
731 const KFileItemList items
= selectedItems();
732 if ((items
.count() == 1) && items
.first().isDir()) {
733 pasteToUrl(items
.first().url());
737 void DolphinView::setShowPreview(bool show
)
739 if (m_showPreview
== show
) {
743 const KUrl viewPropsUrl
= rootUrl();
744 ViewProperties
props(viewPropsUrl
);
745 props
.setShowPreview(show
);
747 m_showPreview
= show
;
748 const int oldZoomLevel
= m_controller
->zoomLevel();
749 emit
showPreviewChanged();
751 // Enabling or disabling the preview might change the icon size of the view.
752 // As the view does not emit a signal when the icon size has been changed,
753 // the used zoom level of the controller must be adjusted manually:
754 updateZoomLevel(oldZoomLevel
);
756 loadDirectory(viewPropsUrl
);
759 void DolphinView::setShowHiddenFiles(bool show
)
761 if (m_viewAccessor
.dirLister()->showingDotFiles() == show
) {
765 const KUrl viewPropsUrl
= rootUrl();
766 ViewProperties
props(viewPropsUrl
);
767 props
.setShowHiddenFiles(show
);
769 m_viewAccessor
.dirLister()->setShowingDotFiles(show
);
770 emit
showHiddenFilesChanged();
772 loadDirectory(viewPropsUrl
);
775 void DolphinView::setCategorizedSorting(bool categorized
)
777 if (categorized
== categorizedSorting()) {
781 // setCategorizedSorting(true) may only get invoked
782 // if the view supports categorized sorting
783 Q_ASSERT(!categorized
|| supportsCategorizedSorting());
785 ViewProperties
props(rootUrl());
786 props
.setCategorizedSorting(categorized
);
789 m_storedCategorizedSorting
= categorized
;
790 m_viewAccessor
.proxyModel()->setCategorizedModel(categorized
);
792 emit
categorizedSortingChanged();
795 void DolphinView::toggleSortOrder()
797 const Qt::SortOrder order
= (sortOrder() == Qt::AscendingOrder
) ?
798 Qt::DescendingOrder
:
803 void DolphinView::toggleSortFoldersFirst()
805 setSortFoldersFirst(!sortFoldersFirst());
808 void DolphinView::toggleAdditionalInfo(QAction
* action
)
810 const KFileItemDelegate::Information info
=
811 static_cast<KFileItemDelegate::Information
>(action
->data().toInt());
813 KFileItemDelegate::InformationList list
= additionalInfo();
815 const bool show
= action
->isChecked();
817 const int index
= list
.indexOf(info
);
818 const bool containsInfo
= (index
>= 0);
819 if (show
&& !containsInfo
) {
821 setAdditionalInfo(list
);
822 } else if (!show
&& containsInfo
) {
823 list
.removeAt(index
);
824 setAdditionalInfo(list
);
825 Q_ASSERT(list
.indexOf(info
) < 0);
829 void DolphinView::mouseReleaseEvent(QMouseEvent
* event
)
831 QWidget::mouseReleaseEvent(event
);
835 void DolphinView::wheelEvent(QWheelEvent
* event
)
837 if (event
->modifiers() & Qt::ControlModifier
) {
838 const int delta
= event
->delta();
839 const int level
= zoomLevel();
841 setZoomLevel(level
+ 1);
842 } else if (delta
< 0) {
843 setZoomLevel(level
- 1);
849 bool DolphinView::eventFilter(QObject
* watched
, QEvent
* event
)
851 switch (event
->type()) {
852 case QEvent::FocusIn
:
853 if (watched
== m_viewAccessor
.itemView()) {
854 m_controller
->requestActivation();
858 case QEvent::MouseButtonPress
:
859 if ((watched
== m_viewAccessor
.itemView()->viewport()) && (m_expandedDragSource
!= 0)) {
860 // Listening to a mousebutton press event to delete expanded views is a
861 // workaround, as it seems impossible for the FolderExpander to know when
862 // a dragging outside a view has been finished. However it works quite well:
863 // A mousebutton press event indicates that a drag operation must be
865 m_expandedDragSource
->deleteLater();
866 m_expandedDragSource
= 0;
870 case QEvent::DragEnter
:
871 if (watched
== m_viewAccessor
.itemView()->viewport()) {
876 case QEvent::KeyPress
:
877 if (watched
== m_viewAccessor
.itemView()) {
878 // clear the selection when Escape has been pressed
879 QKeyEvent
* keyEvent
= static_cast<QKeyEvent
*>(event
);
880 if (keyEvent
->key() == Qt::Key_Escape
) {
890 return QWidget::eventFilter(watched
, event
);
893 void DolphinView::activate()
898 void DolphinView::triggerItem(const KFileItem
& item
)
900 const Qt::KeyboardModifiers modifier
= QApplication::keyboardModifiers();
901 if ((modifier
& Qt::ShiftModifier
) || (modifier
& Qt::ControlModifier
)) {
902 // items are selected by the user, hence don't trigger the
903 // item specified by 'index'
907 // TODO: the m_isContextMenuOpen check is a workaround for Qt-issue 207192
908 if (item
.isNull() || m_isContextMenuOpen
) {
912 emit
itemTriggered(item
); // caught by DolphinViewContainer or DolphinPart
915 void DolphinView::emitDelayedSelectionChangedSignal()
917 // Invoke emitSelectionChangedSignal() with a delay of 300 ms. This assures
918 // that fast selection changes don't result in expensive operations to
919 // collect all file items for the signal (see DolphinView::selectedItems()).
920 m_selectionChangedTimer
->start();
923 void DolphinView::emitSelectionChangedSignal()
925 emit
selectionChanged(DolphinView::selectedItems());
928 void DolphinView::openContextMenu(const QPoint
& pos
,
929 const QList
<QAction
*>& customActions
)
932 const QModelIndex index
= m_viewAccessor
.itemView()->indexAt(pos
);
933 if (index
.isValid() && (index
.column() == DolphinModel::Name
)) {
934 const QModelIndex dolphinModelIndex
= m_viewAccessor
.proxyModel()->mapToSource(index
);
935 item
= m_viewAccessor
.dirModel()->itemForIndex(dolphinModelIndex
);
938 m_isContextMenuOpen
= true; // TODO: workaround for Qt-issue 207192
939 emit
requestContextMenu(item
, url(), customActions
);
940 m_isContextMenuOpen
= false;
943 void DolphinView::dropUrls(const KFileItem
& destItem
,
944 const KUrl
& destPath
,
947 addNewFileNames(event
->mimeData());
948 DragAndDropHelper::instance().dropUrls(destItem
, destPath
, event
, this);
951 void DolphinView::updateSorting(DolphinView::Sorting sorting
)
953 ViewProperties
props(rootUrl());
954 props
.setSorting(sorting
);
956 m_viewAccessor
.proxyModel()->setSorting(sorting
);
958 emit
sortingChanged(sorting
);
961 void DolphinView::updateSortOrder(Qt::SortOrder order
)
963 ViewProperties
props(rootUrl());
964 props
.setSortOrder(order
);
966 m_viewAccessor
.proxyModel()->setSortOrder(order
);
968 emit
sortOrderChanged(order
);
971 void DolphinView::updateSortFoldersFirst(bool foldersFirst
)
973 ViewProperties
props(rootUrl());
974 props
.setSortFoldersFirst(foldersFirst
);
976 m_viewAccessor
.proxyModel()->setSortFoldersFirst(foldersFirst
);
978 emit
sortFoldersFirstChanged(foldersFirst
);
981 void DolphinView::updateAdditionalInfo(const KFileItemDelegate::InformationList
& info
)
983 ViewProperties
props(rootUrl());
984 props
.setAdditionalInfo(info
);
987 m_viewAccessor
.itemDelegate()->setShowInformation(info
);
989 emit
additionalInfoChanged();
992 void DolphinView::updateAdditionalInfoActions(KActionCollection
* collection
)
994 const bool enable
= (m_mode
== DolphinView::DetailsView
) ||
995 (m_mode
== DolphinView::IconsView
);
997 QAction
* showSizeInfo
= collection
->action("show_size_info");
998 QAction
* showDateInfo
= collection
->action("show_date_info");
999 QAction
* showPermissionsInfo
= collection
->action("show_permissions_info");
1000 QAction
* showOwnerInfo
= collection
->action("show_owner_info");
1001 QAction
* showGroupInfo
= collection
->action("show_group_info");
1002 QAction
* showMimeInfo
= collection
->action("show_mime_info");
1004 showSizeInfo
->setChecked(false);
1005 showDateInfo
->setChecked(false);
1006 showPermissionsInfo
->setChecked(false);
1007 showOwnerInfo
->setChecked(false);
1008 showGroupInfo
->setChecked(false);
1009 showMimeInfo
->setChecked(false);
1011 showSizeInfo
->setEnabled(enable
);
1012 showDateInfo
->setEnabled(enable
);
1013 showPermissionsInfo
->setEnabled(enable
);
1014 showOwnerInfo
->setEnabled(enable
);
1015 showGroupInfo
->setEnabled(enable
);
1016 showMimeInfo
->setEnabled(enable
);
1018 foreach (KFileItemDelegate::Information info
, m_viewAccessor
.itemDelegate()->showInformation()) {
1020 case KFileItemDelegate::Size
:
1021 showSizeInfo
->setChecked(true);
1023 case KFileItemDelegate::ModificationTime
:
1024 showDateInfo
->setChecked(true);
1026 case KFileItemDelegate::Permissions
:
1027 showPermissionsInfo
->setChecked(true);
1029 case KFileItemDelegate::Owner
:
1030 showOwnerInfo
->setChecked(true);
1032 case KFileItemDelegate::OwnerAndGroup
:
1033 showGroupInfo
->setChecked(true);
1035 case KFileItemDelegate::FriendlyMimeType
:
1036 showMimeInfo
->setChecked(true);
1044 QPair
<bool, QString
> DolphinView::pasteInfo() const
1046 return KonqOperations::pasteInfo(url());
1049 void DolphinView::setTabsForFilesEnabled(bool tabsForFiles
)
1051 m_tabsForFiles
= tabsForFiles
;
1054 bool DolphinView::isTabsForFilesEnabled() const
1056 return m_tabsForFiles
;
1059 void DolphinView::activateItem(const KUrl
& url
)
1061 m_activeItemUrl
= url
;
1064 bool DolphinView::itemsExpandable() const
1066 return m_viewAccessor
.itemsExpandable();
1069 void DolphinView::deleteWhenNotDragSource(QAbstractItemView
*view
)
1074 if (DragAndDropHelper::instance().isDragSource(view
)) {
1075 // We must store for later deletion.
1076 if (m_expandedDragSource
!= 0) {
1077 // The old stored view is obviously not the drag source anymore.
1078 m_expandedDragSource
->deleteLater();
1079 m_expandedDragSource
= 0;
1082 m_expandedDragSource
= view
;
1085 view
->deleteLater();
1089 void DolphinView::observeCreatedItem(const KUrl
& url
)
1091 m_createdItemUrl
= url
;
1092 connect(m_viewAccessor
.dirModel(), SIGNAL(rowsInserted(const QModelIndex
&, int, int)),
1093 this, SLOT(selectAndScrollToCreatedItem()));
1096 void DolphinView::selectAndScrollToCreatedItem()
1098 const QModelIndex dirIndex
= m_viewAccessor
.dirModel()->indexForUrl(m_createdItemUrl
);
1099 if (dirIndex
.isValid()) {
1100 const QModelIndex proxyIndex
= m_viewAccessor
.proxyModel()->mapFromSource(dirIndex
);
1101 m_viewAccessor
.itemView()->setCurrentIndex(proxyIndex
);
1104 disconnect(m_viewAccessor
.dirModel(), SIGNAL(rowsInserted(const QModelIndex
&, int, int)),
1105 this, SLOT(selectAndScrollToCreatedItem()));
1106 m_createdItemUrl
= KUrl();
1109 void DolphinView::restoreSelection()
1111 disconnect(m_viewAccessor
.dirLister(), SIGNAL(completed()), this, SLOT(restoreSelection()));
1112 changeSelection(m_selectedItems
);
1115 void DolphinView::emitContentsMoved()
1117 // only emit the contents moved signal if no directory loading is ongoing
1118 // (this would reset the contents position always to (0, 0))
1119 if (!m_loadingDirectory
) {
1120 const QPoint
pos(contentsPosition());
1121 emit
contentsMoved(pos
.x(), pos
.y());
1125 void DolphinView::showHoverInformation(const KFileItem
& item
)
1127 emit
requestItemInfo(item
);
1130 void DolphinView::clearHoverInformation()
1132 emit
requestItemInfo(KFileItem());
1135 void DolphinView::slotDeleteFileFinished(KJob
* job
)
1137 if (job
->error() == 0) {
1138 emit
operationCompletedMessage(i18nc("@info:status", "Delete operation completed."));
1139 } else if (job
->error() != KIO::ERR_USER_CANCELED
) {
1140 emit
errorMessage(job
->errorString());
1144 void DolphinView::slotRequestUrlChange(const KUrl
& url
)
1146 emit
requestUrlChange(url
);
1147 m_controller
->setUrl(url
);
1150 void DolphinView::slotDirListerCompleted()
1152 if (!m_activeItemUrl
.isEmpty()) {
1153 // assure that the current item remains visible
1154 const QModelIndex dirIndex
= m_viewAccessor
.dirModel()->indexForUrl(m_activeItemUrl
);
1155 if (dirIndex
.isValid()) {
1156 const QModelIndex proxyIndex
= m_viewAccessor
.proxyModel()->mapFromSource(dirIndex
);
1157 QAbstractItemView
* view
= m_viewAccessor
.itemView();
1158 const bool clearSelection
= !hasSelection();
1159 view
->setCurrentIndex(proxyIndex
);
1160 if (clearSelection
) {
1161 view
->clearSelection();
1163 m_activeItemUrl
.clear();
1167 if (!m_newFileNames
.isEmpty()) {
1168 // select all newly added items created by a paste operation or
1169 // a drag & drop operation
1170 const int rowCount
= m_viewAccessor
.proxyModel()->rowCount();
1171 QItemSelection selection
;
1172 for (int row
= 0; row
< rowCount
; ++row
) {
1173 const QModelIndex proxyIndex
= m_viewAccessor
.proxyModel()->index(row
, 0);
1174 const QModelIndex dirIndex
= m_viewAccessor
.proxyModel()->mapToSource(proxyIndex
);
1175 const KUrl url
= m_viewAccessor
.dirModel()->itemForIndex(dirIndex
).url();
1176 if (m_newFileNames
.contains(url
.fileName())) {
1177 selection
.merge(QItemSelection(proxyIndex
, proxyIndex
), QItemSelectionModel::Select
);
1180 m_viewAccessor
.itemView()->selectionModel()->select(selection
, QItemSelectionModel::Select
);
1182 m_newFileNames
.clear();
1186 void DolphinView::slotRefreshItems()
1188 if (m_assureVisibleCurrentIndex
) {
1189 m_assureVisibleCurrentIndex
= false;
1190 m_viewAccessor
.itemView()->scrollTo(m_viewAccessor
.itemView()->currentIndex());
1194 void DolphinView::loadDirectory(const KUrl
& url
, bool reload
)
1196 if (!url
.isValid()) {
1197 const QString
location(url
.pathOrUrl());
1198 if (location
.isEmpty()) {
1199 emit
errorMessage(i18nc("@info:status", "The location is empty."));
1201 emit
errorMessage(i18nc("@info:status", "The location '%1' is invalid.", location
));
1206 m_loadingDirectory
= true;
1209 m_selectedItems
= selectedItems();
1210 connect(m_viewAccessor
.dirLister(), SIGNAL(completed()), this, SLOT(restoreSelection()));
1213 m_viewAccessor
.dirLister()->stop();
1214 m_viewAccessor
.dirLister()->openUrl(url
, reload
? KDirLister::Reload
: KDirLister::NoFlags
);
1217 void DolphinView::applyViewProperties()
1219 if (m_ignoreViewProperties
) {
1223 const ViewProperties
props(rootUrl());
1225 const Mode mode
= props
.viewMode();
1226 if (m_mode
!= mode
) {
1227 const int oldZoomLevel
= m_controller
->zoomLevel();
1233 updateZoomLevel(oldZoomLevel
);
1235 if (m_viewAccessor
.itemView() == 0) {
1238 Q_ASSERT(m_viewAccessor
.itemView() != 0);
1239 Q_ASSERT(m_fileItemDelegate
!= 0);
1241 const bool showHiddenFiles
= props
.showHiddenFiles();
1242 if (showHiddenFiles
!= m_viewAccessor
.dirLister()->showingDotFiles()) {
1243 m_viewAccessor
.dirLister()->setShowingDotFiles(showHiddenFiles
);
1244 emit
showHiddenFilesChanged();
1247 m_storedCategorizedSorting
= props
.categorizedSorting();
1248 const bool categorized
= m_storedCategorizedSorting
&& supportsCategorizedSorting();
1249 if (categorized
!= m_viewAccessor
.proxyModel()->isCategorizedModel()) {
1250 m_viewAccessor
.proxyModel()->setCategorizedModel(categorized
);
1251 emit
categorizedSortingChanged();
1254 const DolphinView::Sorting sorting
= props
.sorting();
1255 if (sorting
!= m_viewAccessor
.proxyModel()->sorting()) {
1256 m_viewAccessor
.proxyModel()->setSorting(sorting
);
1257 emit
sortingChanged(sorting
);
1260 const Qt::SortOrder sortOrder
= props
.sortOrder();
1261 if (sortOrder
!= m_viewAccessor
.proxyModel()->sortOrder()) {
1262 m_viewAccessor
.proxyModel()->setSortOrder(sortOrder
);
1263 emit
sortOrderChanged(sortOrder
);
1266 const bool sortFoldersFirst
= props
.sortFoldersFirst();
1267 if (sortFoldersFirst
!= m_viewAccessor
.proxyModel()->sortFoldersFirst()) {
1268 m_viewAccessor
.proxyModel()->setSortFoldersFirst(sortFoldersFirst
);
1269 emit
sortFoldersFirstChanged(sortFoldersFirst
);
1272 KFileItemDelegate::InformationList info
= props
.additionalInfo();
1273 if (info
!= m_viewAccessor
.itemDelegate()->showInformation()) {
1274 m_viewAccessor
.itemDelegate()->setShowInformation(info
);
1275 emit
additionalInfoChanged();
1278 const bool showPreview
= props
.showPreview();
1279 if (showPreview
!= m_showPreview
) {
1280 m_showPreview
= showPreview
;
1281 const int oldZoomLevel
= m_controller
->zoomLevel();
1282 emit
showPreviewChanged();
1284 // Enabling or disabling the preview might change the icon size of the view.
1285 // As the view does not emit a signal when the icon size has been changed,
1286 // the used zoom level of the controller must be adjusted manually:
1287 updateZoomLevel(oldZoomLevel
);
1290 if (DolphinSettings::instance().generalSettings()->globalViewProps()) {
1291 // During the lifetime of a DolphinView instance the global view properties
1292 // should not be changed. This allows e. g. to split a view and use different
1293 // view properties for each view.
1294 m_ignoreViewProperties
= true;
1298 void DolphinView::createView()
1301 Q_ASSERT(m_viewAccessor
.itemView() == 0);
1302 m_viewAccessor
.createView(this, m_controller
, m_mode
);
1304 m_topLayout
->insertWidget(1, m_viewAccessor
.layoutTarget());
1307 void DolphinView::deleteView()
1309 QAbstractItemView
* view
= m_viewAccessor
.itemView();
1311 // It's important to set the keyboard focus to the parent
1312 // before deleting the view: Otherwise when having a split
1313 // view the other view will get the focus and will request
1314 // an activation (see DolphinView::eventFilter()).
1318 m_topLayout
->removeWidget(view
);
1322 m_controller
->disconnect(view
);
1325 // TODO: move this code into ViewAccessor::deleteView()
1326 deleteWhenNotDragSource(view
);
1329 m_viewAccessor
.deleteView();
1333 void DolphinView::initializeView()
1335 QAbstractItemView
* view
= m_viewAccessor
.itemView();
1336 Q_ASSERT(view
!= 0);
1337 view
->installEventFilter(this);
1338 view
->viewport()->installEventFilter(this);
1339 setFocusProxy(view
);
1341 //if (m_mode != ColumnView) {
1342 // Give the view the ability to auto-expand its directories on hovering
1343 // (the column view takes care about this itself). If the details view
1344 // uses expandable folders, the auto-expanding should be used always.
1345 FolderExpander
* folderExpander
= new FolderExpander(view
, m_viewAccessor
.proxyModel());
1346 folderExpander
->setEnabled(m_viewAccessor
.hasExpandableFolders());
1347 connect(folderExpander
, SIGNAL(enterDir(const QModelIndex
&)),
1348 m_controller
, SLOT(triggerItem(const QModelIndex
&)));
1350 // TODO: enable again later
1353 // Listen out for requests to delete the current column.
1354 connect(m_viewAccessor.columnsContainer(), SIGNAL(requestColumnDeletion(QAbstractItemView*)),
1355 this, SLOT(deleteWhenNotDragSource(QAbstractItemView*)));
1358 m_controller
->setItemView(view
);
1360 // TODO: reactivate selection model
1361 /*view->setModel(m_viewAccessor.proxyModel());
1362 if (m_selectionModel != 0) {
1363 view->setSelectionModel(m_selectionModel);
1365 m_selectionModel = view->selectionModel();
1368 m_selectionChangedTimer
= new QTimer(this);
1369 m_selectionChangedTimer
->setSingleShot(true);
1370 m_selectionChangedTimer
->setInterval(300);
1371 connect(m_selectionChangedTimer
, SIGNAL(timeout()),
1372 this, SLOT(emitSelectionChangedSignal()));
1374 // reparent the selection model, as it should not be deleted
1375 // when deleting the model
1376 //m_selectionModel->setParent(this);
1378 view
->setSelectionMode(QAbstractItemView::ExtendedSelection
);
1380 m_versionControlObserver
= new VersionControlObserver(view
);
1381 connect(m_versionControlObserver
, SIGNAL(infoMessage(const QString
&)),
1382 this, SIGNAL(infoMessage(const QString
&)));
1383 connect(m_versionControlObserver
, SIGNAL(errorMessage(const QString
&)),
1384 this, SIGNAL(errorMessage(const QString
&)));
1385 connect(m_versionControlObserver
, SIGNAL(operationCompletedMessage(const QString
&)),
1386 this, SIGNAL(operationCompletedMessage(const QString
&)));
1388 connect(view
->selectionModel(), SIGNAL(selectionChanged(const QItemSelection
&, const QItemSelection
&)),
1389 this, SLOT(emitDelayedSelectionChangedSignal()));
1390 connect(view
->verticalScrollBar(), SIGNAL(valueChanged(int)),
1391 this, SLOT(emitContentsMoved()));
1392 connect(view
->horizontalScrollBar(), SIGNAL(valueChanged(int)),
1393 this, SLOT(emitContentsMoved()));
1396 void DolphinView::pasteToUrl(const KUrl
& url
)
1398 addNewFileNames(QApplication::clipboard()->mimeData());
1399 KonqOperations::doPaste(this, url
);
1402 void DolphinView::updateZoomLevel(int oldZoomLevel
)
1404 const int newZoomLevel
= ZoomLevelInfo::zoomLevelForIconSize(m_viewAccessor
.itemView()->iconSize());
1405 if (oldZoomLevel
!= newZoomLevel
) {
1406 m_controller
->setZoomLevel(newZoomLevel
);
1407 emit
zoomLevelChanged(newZoomLevel
);
1411 KUrl::List
DolphinView::simplifiedSelectedUrls() const
1413 KUrl::List list
= selectedUrls();
1414 if (itemsExpandable() ) {
1415 list
= KDirModel::simplifiedUrlList(list
);
1420 QMimeData
* DolphinView::selectionMimeData() const
1422 const QAbstractItemView
* view
= m_viewAccessor
.itemView();
1423 Q_ASSERT((view
!= 0) && (view
->selectionModel() != 0));
1424 const QItemSelection selection
= m_viewAccessor
.proxyModel()->mapSelectionToSource(view
->selectionModel()->selection());
1425 return m_viewAccessor
.dirModel()->mimeData(selection
.indexes());
1428 void DolphinView::addNewFileNames(const QMimeData
* mimeData
)
1430 const KUrl::List urls
= KUrl::List::fromMimeData(mimeData
);
1431 foreach (const KUrl
& url
, urls
) {
1432 m_newFileNames
.insert(url
.fileName());
1436 DolphinView::ViewAccessor::ViewAccessor(DolphinSortFilterProxyModel
* proxyModel
) :
1439 m_columnsContainer(0),
1440 m_proxyModel(proxyModel
)
1444 void DolphinView::ViewAccessor::createView(QWidget
* parent
,
1445 DolphinController
* controller
,
1448 Q_ASSERT(itemView() == 0);
1452 m_iconsView
= new DolphinIconsView(parent
, controller
, m_proxyModel
);
1456 m_detailsView
= new DolphinDetailsView(parent
, controller
, m_proxyModel
);
1460 m_columnsContainer
= new DolphinColumnViewContainer(parent
, controller
);
1468 void DolphinView::ViewAccessor::deleteView()
1470 // TODO: Move the deleteWhenNotDragSource() code into the view
1471 // accessor, so that creating and deleting is fully done by
1472 // the view accessor.
1476 m_columnsContainer
->deleteLater();
1477 m_columnsContainer
= 0;
1481 void DolphinView::ViewAccessor::prepareUrlChange(const KUrl
& url
)
1483 if (m_columnsContainer
!= 0) {
1484 m_columnsContainer
->showColumn(url
);
1488 QAbstractItemView
* DolphinView::ViewAccessor::itemView() const
1490 if (m_iconsView
!= 0) {
1494 if (m_detailsView
!= 0) {
1495 return m_detailsView
;
1498 if (m_columnsContainer
!= 0) {
1499 return m_columnsContainer
->activeColumn();
1505 KFileItemDelegate
* DolphinView::ViewAccessor::itemDelegate() const
1507 return static_cast<KFileItemDelegate
*>(itemView()->itemDelegate());
1510 QWidget
* DolphinView::ViewAccessor::layoutTarget() const
1512 if (m_columnsContainer
!= 0) {
1513 return m_columnsContainer
;
1518 KUrl
DolphinView::ViewAccessor::rootUrl() const
1520 return (m_columnsContainer
!= 0) ? m_columnsContainer
->rootUrl() : KUrl();
1523 bool DolphinView::ViewAccessor::supportsCategorizedSorting() const
1525 return m_iconsView
!= 0;
1528 bool DolphinView::ViewAccessor::hasExpandableFolders() const
1530 const DolphinSettings
& settings
= DolphinSettings::instance();
1531 return settings
.generalSettings()->autoExpandFolders() ||
1532 ((m_detailsView
!= 0) && settings
.detailsModeSettings()->expandableFolders());
1535 bool DolphinView::ViewAccessor::itemsExpandable() const
1537 return (m_detailsView
!= 0) && m_detailsView
->itemsExpandable();
1540 bool DolphinView::ViewAccessor::reloadOnAdditionalInfoChange() const
1542 // the details view requires no reloading of the directory, as it maps
1543 // the file item delegate info to its columns internally
1544 return m_detailsView
!= 0;
1548 DolphinModel
* DolphinView::ViewAccessor::dirModel() const
1550 return static_cast<DolphinModel
*>(proxyModel()->sourceModel());
1553 DolphinSortFilterProxyModel
* DolphinView::ViewAccessor::proxyModel() const
1555 if (m_columnsContainer
!= 0) {
1556 return static_cast<DolphinSortFilterProxyModel
*>(m_columnsContainer
->activeColumn()->model());
1558 return m_proxyModel
;
1561 KDirLister
* DolphinView::ViewAccessor::dirLister() const
1563 return dirModel()->dirLister();
1566 #include "dolphinview.moc"