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
),
96 m_selectionChangedTimer(0),
97 m_versionControlObserver(0),
103 m_expandedDragSource(0)
105 m_topLayout
= new QVBoxLayout(this);
106 m_topLayout
->setSpacing(0);
107 m_topLayout
->setMargin(0);
109 m_controller
= new DolphinController(this);
110 m_controller
->setUrl(url
);
112 connect(m_controller
, SIGNAL(urlChanged(const KUrl
&)),
113 this, SIGNAL(urlChanged(const KUrl
&)));
114 connect(m_controller
, SIGNAL(requestUrlChange(const KUrl
&)),
115 this, SLOT(slotRequestUrlChange(const KUrl
&)));
117 connect(m_controller
, SIGNAL(requestContextMenu(const QPoint
&, const QList
<QAction
*>&)),
118 this, SLOT(openContextMenu(const QPoint
&, const QList
<QAction
*>&)));
119 connect(m_controller
, SIGNAL(urlsDropped(const KFileItem
&, const KUrl
&, QDropEvent
*)),
120 this, SLOT(dropUrls(const KFileItem
&, const KUrl
&, QDropEvent
*)));
121 connect(m_controller
, SIGNAL(sortingChanged(DolphinView::Sorting
)),
122 this, SLOT(updateSorting(DolphinView::Sorting
)));
123 connect(m_controller
, SIGNAL(sortOrderChanged(Qt::SortOrder
)),
124 this, SLOT(updateSortOrder(Qt::SortOrder
)));
125 connect(m_controller
, SIGNAL(sortFoldersFirstChanged(bool)),
126 this, SLOT(updateSortFoldersFirst(bool)));
127 connect(m_controller
, SIGNAL(additionalInfoChanged(const KFileItemDelegate::InformationList
&)),
128 this, SLOT(updateAdditionalInfo(const KFileItemDelegate::InformationList
&)));
129 connect(m_controller
, SIGNAL(itemTriggered(const KFileItem
&)),
130 this, SLOT(triggerItem(const KFileItem
&)));
131 connect(m_controller
, SIGNAL(tabRequested(const KUrl
&)),
132 this, SIGNAL(tabRequested(const KUrl
&)));
133 connect(m_controller
, SIGNAL(activated()),
134 this, SLOT(activate()));
135 connect(m_controller
, SIGNAL(itemEntered(const KFileItem
&)),
136 this, SLOT(showHoverInformation(const KFileItem
&)));
137 connect(m_controller
, SIGNAL(viewportEntered()),
138 this, SLOT(clearHoverInformation()));
140 KDirLister
* dirLister
= m_viewAccessor
.dirLister();
141 connect(dirLister
, SIGNAL(redirection(KUrl
, KUrl
)),
142 this, SIGNAL(redirection(KUrl
, KUrl
)));
143 connect(dirLister
, SIGNAL(completed()),
144 this, SLOT(slotDirListerCompleted()));
145 connect(dirLister
, SIGNAL(refreshItems(const QList
<QPair
<KFileItem
,KFileItem
>>&)),
146 this, SLOT(slotRefreshItems()));
148 // When a new item has been created by the "Create New..." menu, the item should
149 // get selected and it must be assured that the item will get visible. As the
150 // creation is done asynchronously, several signals must be checked:
151 connect(&DolphinNewMenuObserver::instance(), SIGNAL(itemCreated(const KUrl
&)),
152 this, SLOT(observeCreatedItem(const KUrl
&)));
154 applyViewProperties();
155 m_topLayout
->addWidget(m_viewAccessor
.itemView());
158 DolphinView::~DolphinView()
160 delete m_expandedDragSource
;
161 m_expandedDragSource
= 0;
164 const KUrl
& DolphinView::url() const
166 return m_controller
->url();
169 KUrl
DolphinView::rootUrl() const
171 const KUrl viewUrl
= url();
172 const KUrl root
= m_viewAccessor
.rootUrl();
173 if (root
.isEmpty() || !root
.isParentOf(viewUrl
)) {
179 void DolphinView::setActive(bool active
)
181 if (active
== m_active
) {
187 QColor color
= KColorScheme(QPalette::Active
, KColorScheme::View
).background().color();
189 emitSelectionChangedSignal();
194 QWidget
* viewport
= m_viewAccessor
.itemView()->viewport();
196 palette
.setColor(viewport
->backgroundRole(), color
);
197 viewport
->setPalette(palette
);
202 m_viewAccessor
.itemView()->setFocus();
206 m_controller
->indicateActivationChange(active
);
209 bool DolphinView::isActive() const
214 void DolphinView::setMode(Mode mode
)
216 if (mode
== m_mode
) {
217 return; // the wished mode is already set
220 const int oldZoomLevel
= m_controller
->zoomLevel();
225 const KUrl viewPropsUrl
= rootUrl();
226 ViewProperties
props(viewPropsUrl
);
227 props
.setViewMode(m_mode
);
230 // the file item delegate has been recreated, apply the current
231 // additional information manually
232 const KFileItemDelegate::InformationList infoList
= props
.additionalInfo();
233 m_viewAccessor
.itemDelegate()->setShowInformation(infoList
);
234 emit
additionalInfoChanged();
236 // Not all view modes support categorized sorting. Adjust the sorting model
237 // if changing the view mode results in a change of the categorized sorting
239 m_storedCategorizedSorting
= props
.categorizedSorting();
240 const bool categorized
= m_storedCategorizedSorting
&& supportsCategorizedSorting();
241 if (categorized
!= m_viewAccessor
.proxyModel()->isCategorizedModel()) {
242 m_viewAccessor
.proxyModel()->setCategorizedModel(categorized
);
243 emit
categorizedSortingChanged();
248 updateZoomLevel(oldZoomLevel
);
250 loadDirectory(viewPropsUrl
);
254 DolphinView::Mode
DolphinView::mode() const
259 bool DolphinView::showPreview() const
261 return m_showPreview
;
264 bool DolphinView::showHiddenFiles() const
266 return m_viewAccessor
.dirLister()->showingDotFiles();
269 bool DolphinView::categorizedSorting() const
271 // If all view modes would support categorized sorting, returning
272 // m_viewAccessor.proxyModel()->isCategorizedModel() would be the way to go. As
273 // currently only the icons view supports caterized sorting, we remember
274 // the stored view properties state in m_storedCategorizedSorting and
275 // return this state. The application takes care to disable the corresponding
276 // checkbox by checking DolphinView::supportsCategorizedSorting() to indicate
277 // that this setting is not applied to the current view mode.
278 return m_storedCategorizedSorting
;
281 bool DolphinView::supportsCategorizedSorting() const
283 return m_viewAccessor
.supportsCategorizedSorting();
286 void DolphinView::selectAll()
288 QAbstractItemView
* view
= m_viewAccessor
.itemView();
289 // TODO: there seems to be a bug in QAbstractItemView::selectAll(); if
290 // the Ctrl-key is pressed (e. g. for Ctrl+A), selectAll() inverts the
291 // selection instead of selecting all items. This is bypassed for KDE 4.0
292 // by invoking clearSelection() first.
293 view
->clearSelection();
297 void DolphinView::invertSelection()
299 QItemSelectionModel
* selectionModel
= m_viewAccessor
.itemView()->selectionModel();
300 const QAbstractItemModel
* itemModel
= selectionModel
->model();
302 const QModelIndex topLeft
= itemModel
->index(0, 0);
303 const QModelIndex bottomRight
= itemModel
->index(itemModel
->rowCount() - 1,
304 itemModel
->columnCount() - 1);
306 const QItemSelection
selection(topLeft
, bottomRight
);
307 selectionModel
->select(selection
, QItemSelectionModel::Toggle
);
310 bool DolphinView::hasSelection() const
312 return m_viewAccessor
.itemView()->selectionModel()->hasSelection();
315 void DolphinView::clearSelection()
317 QItemSelectionModel
* selModel
= m_viewAccessor
.itemView()->selectionModel();
318 const QModelIndex currentIndex
= selModel
->currentIndex();
319 selModel
->setCurrentIndex(currentIndex
, QItemSelectionModel::Current
|
320 QItemSelectionModel::Clear
);
321 m_selectedItems
.clear();
324 KFileItemList
DolphinView::selectedItems() const
326 const QAbstractItemView
* view
= m_viewAccessor
.itemView();
328 // Our view has a selection, we will map them back to the DolphinModel
329 // and then fill the KFileItemList.
330 Q_ASSERT((view
!= 0) && (view
->selectionModel() != 0));
332 const QItemSelection selection
= m_viewAccessor
.proxyModel()->mapSelectionToSource(view
->selectionModel()->selection());
333 KFileItemList itemList
;
335 const QModelIndexList indexList
= selection
.indexes();
336 foreach (const QModelIndex
&index
, indexList
) {
337 KFileItem item
= m_viewAccessor
.dirModel()->itemForIndex(index
);
338 if (!item
.isNull()) {
339 itemList
.append(item
);
346 KUrl::List
DolphinView::selectedUrls() const
349 const KFileItemList list
= selectedItems();
350 foreach (const KFileItem
&item
, list
) {
351 urls
.append(item
.url());
356 int DolphinView::selectedItemsCount() const
358 return m_viewAccessor
.itemView()->selectionModel()->selectedIndexes().count();
361 void DolphinView::setContentsPosition(int x
, int y
)
363 QAbstractItemView
* view
= m_viewAccessor
.itemView();
364 view
->horizontalScrollBar()->setValue(x
);
365 view
->verticalScrollBar()->setValue(y
);
367 m_loadingDirectory
= false;
370 QPoint
DolphinView::contentsPosition() const
372 const int x
= m_viewAccessor
.itemView()->horizontalScrollBar()->value();
373 const int y
= m_viewAccessor
.itemView()->verticalScrollBar()->value();
377 void DolphinView::setZoomLevel(int level
)
379 if (level
< ZoomLevelInfo::minimumLevel()) {
380 level
= ZoomLevelInfo::minimumLevel();
381 } else if (level
> ZoomLevelInfo::maximumLevel()) {
382 level
= ZoomLevelInfo::maximumLevel();
385 if (level
!= zoomLevel()) {
386 m_controller
->setZoomLevel(level
);
387 emit
zoomLevelChanged(level
);
391 int DolphinView::zoomLevel() const
393 return m_controller
->zoomLevel();
396 void DolphinView::setSorting(Sorting sorting
)
398 if (sorting
!= this->sorting()) {
399 updateSorting(sorting
);
403 DolphinView::Sorting
DolphinView::sorting() const
405 return m_viewAccessor
.proxyModel()->sorting();
408 void DolphinView::setSortOrder(Qt::SortOrder order
)
410 if (sortOrder() != order
) {
411 updateSortOrder(order
);
415 Qt::SortOrder
DolphinView::sortOrder() const
417 return m_viewAccessor
.proxyModel()->sortOrder();
420 void DolphinView::setSortFoldersFirst(bool foldersFirst
)
422 if (sortFoldersFirst() != foldersFirst
) {
423 updateSortFoldersFirst(foldersFirst
);
427 bool DolphinView::sortFoldersFirst() const
429 return m_viewAccessor
.proxyModel()->sortFoldersFirst();
432 void DolphinView::setAdditionalInfo(KFileItemDelegate::InformationList info
)
434 const KUrl viewPropsUrl
= rootUrl();
435 ViewProperties
props(viewPropsUrl
);
436 props
.setAdditionalInfo(info
);
437 m_viewAccessor
.itemDelegate()->setShowInformation(info
);
439 emit
additionalInfoChanged();
441 if (m_viewAccessor
.reloadOnAdditionalInfoChange()) {
442 loadDirectory(viewPropsUrl
);
446 KFileItemDelegate::InformationList
DolphinView::additionalInfo() const
448 return m_viewAccessor
.itemDelegate()->showInformation();
451 void DolphinView::reload()
454 loadDirectory(url(), true);
457 void DolphinView::refresh()
459 m_ignoreViewProperties
= false;
461 const bool oldActivationState
= m_active
;
462 const int oldZoomLevel
= m_controller
->zoomLevel();
466 applyViewProperties();
469 setActive(oldActivationState
);
470 updateZoomLevel(oldZoomLevel
);
473 void DolphinView::updateView(const KUrl
& url
, const KUrl
& rootUrl
)
475 Q_UNUSED(rootUrl
); // TODO: remove after columnview-cleanup has been finished
477 if (m_controller
->url() == url
) {
481 m_controller
->setUrl(url
); // emits urlChanged, which we forward
482 m_viewAccessor
.prepareUrlChange(url
);
483 applyViewProperties();
486 // When changing the URL there is no need to keep the version
487 // data of the previous URL.
488 m_viewAccessor
.dirModel()->clearVersionData();
490 emit
startedPathLoading(url
);
493 void DolphinView::setNameFilter(const QString
& nameFilter
)
495 m_controller
->setNameFilter(nameFilter
);
498 void DolphinView::calculateItemCount(int& fileCount
,
500 KIO::filesize_t
& totalFileSize
) const
502 foreach (const KFileItem
& item
, m_viewAccessor
.dirLister()->items()) {
507 totalFileSize
+= item
.size();
512 QString
DolphinView::statusBarText() const
517 KIO::filesize_t totalFileSize
= 0;
519 if (hasSelection()) {
520 // give a summary of the status of the selected files
521 const KFileItemList list
= selectedItems();
522 if (list
.isEmpty()) {
523 // when an item is triggered, it is temporary selected but selectedItems()
524 // will return an empty list
528 KFileItemList::const_iterator it
= list
.begin();
529 const KFileItemList::const_iterator end
= list
.end();
531 const KFileItem
& item
= *it
;
536 totalFileSize
+= item
.size();
541 if (folderCount
+ fileCount
== 1) {
542 // if only one item is selected, show the filename
543 const QString name
= list
.first().name();
544 text
= (folderCount
== 1) ? i18nc("@info:status", "<filename>%1</filename> selected", name
) :
545 i18nc("@info:status", "<filename>%1</filename> selected (%2)",
546 name
, KIO::convertSize(totalFileSize
));
548 // at least 2 items are selected
549 const QString foldersText
= i18ncp("@info:status", "1 Folder selected", "%1 Folders selected", folderCount
);
550 const QString filesText
= i18ncp("@info:status", "1 File selected", "%1 Files selected", fileCount
);
551 if ((folderCount
> 0) && (fileCount
> 0)) {
552 text
= i18nc("@info:status folders, files (size)", "%1, %2 (%3)",
553 foldersText
, filesText
, KIO::convertSize(totalFileSize
));
554 } else if (fileCount
> 0) {
555 text
= i18nc("@info:status files (size)", "%1 (%2)", filesText
, KIO::convertSize(totalFileSize
));
557 Q_ASSERT(folderCount
> 0);
562 calculateItemCount(fileCount
, folderCount
, totalFileSize
);
563 text
= KIO::itemsSummaryString(fileCount
+ folderCount
,
564 fileCount
, folderCount
,
565 totalFileSize
, true);
571 QList
<QAction
*> DolphinView::versionControlActions(const KFileItemList
& items
) const
573 return items
.isEmpty()
574 ? m_versionControlObserver
->contextMenuActions(url().path(KUrl::AddTrailingSlash
))
575 : m_versionControlObserver
->contextMenuActions(items
);
578 void DolphinView::setUrl(const KUrl
& url
)
580 m_newFileNames
.clear();
581 updateView(url
, KUrl());
584 void DolphinView::changeSelection(const KFileItemList
& selection
)
587 if (selection
.isEmpty()) {
590 const KUrl
& baseUrl
= url();
592 QItemSelection newSelection
;
593 foreach(const KFileItem
& item
, selection
) {
594 url
= item
.url().upUrl();
595 if (baseUrl
.equals(url
, KUrl::CompareWithoutTrailingSlash
)) {
596 QModelIndex index
= m_viewAccessor
.proxyModel()->mapFromSource(m_viewAccessor
.dirModel()->indexForItem(item
));
597 newSelection
.select(index
, index
);
600 m_viewAccessor
.itemView()->selectionModel()->select(newSelection
,
601 QItemSelectionModel::ClearAndSelect
602 | QItemSelectionModel::Current
);
605 void DolphinView::renameSelectedItems()
607 KFileItemList items
= selectedItems();
608 const int itemCount
= items
.count();
614 // More than one item has been selected for renaming. Open
615 // a rename dialog and rename all items afterwards.
616 QPointer
<RenameDialog
> dialog
= new RenameDialog(this, items
);
617 if (dialog
->exec() == QDialog::Rejected
) {
622 const QString newName
= dialog
->newName();
623 if (newName
.isEmpty()) {
624 emit
errorMessage(dialog
->errorString());
630 // the selection would be invalid after renaming the items, so just clear
634 // TODO: check how this can be integrated into KIO::FileUndoManager/KonqOperations
635 // as one operation instead of n rename operations like it is done now...
636 Q_ASSERT(newName
.contains('#'));
638 // currently the items are sorted by the selection order, resort
639 // them by the file name
640 qSort(items
.begin(), items
.end(), lessThan
);
642 // iterate through all selected items and rename them...
644 foreach (const KFileItem
& item
, items
) {
645 const KUrl
& oldUrl
= item
.url();
647 number
.setNum(index
++);
649 QString name
= newName
;
650 name
.replace('#', number
);
652 if (oldUrl
.fileName() != name
) {
653 KUrl newUrl
= oldUrl
;
654 newUrl
.setFileName(name
);
655 KonqOperations::rename(this, oldUrl
, newUrl
);
658 } else if (DolphinSettings::instance().generalSettings()->renameInline()) {
659 Q_ASSERT(itemCount
== 1);
660 const QModelIndex dirIndex
= m_viewAccessor
.dirModel()->indexForItem(items
.first());
661 const QModelIndex proxyIndex
= m_viewAccessor
.proxyModel()->mapFromSource(dirIndex
);
662 m_viewAccessor
.itemView()->edit(proxyIndex
);
664 Q_ASSERT(itemCount
== 1);
666 QPointer
<RenameDialog
> dialog
= new RenameDialog(this, items
);
667 if (dialog
->exec() == QDialog::Rejected
) {
672 const QString newName
= dialog
->newName();
673 if (newName
.isEmpty()) {
674 emit
errorMessage(dialog
->errorString());
680 const KUrl
& oldUrl
= items
.first().url();
681 KUrl newUrl
= oldUrl
;
682 newUrl
.setFileName(newName
);
683 KonqOperations::rename(this, oldUrl
, newUrl
);
686 // assure that the current index remains visible when KDirLister
687 // will notify the view about changed items
688 m_assureVisibleCurrentIndex
= true;
691 void DolphinView::trashSelectedItems()
693 const KUrl::List list
= simplifiedSelectedUrls();
694 KonqOperations::del(this, KonqOperations::TRASH
, list
);
697 void DolphinView::deleteSelectedItems()
699 const KUrl::List list
= simplifiedSelectedUrls();
700 const bool del
= KonqOperations::askDeleteConfirmation(list
,
702 KonqOperations::DEFAULT_CONFIRMATION
,
706 KIO::Job
* job
= KIO::del(list
);
707 connect(job
, SIGNAL(result(KJob
*)),
708 this, SLOT(slotDeleteFileFinished(KJob
*)));
712 void DolphinView::cutSelectedItems()
714 QMimeData
* mimeData
= selectionMimeData();
715 KonqMimeData::addIsCutSelection(mimeData
, true);
716 QApplication::clipboard()->setMimeData(mimeData
);
719 void DolphinView::copySelectedItems()
721 QMimeData
* mimeData
= selectionMimeData();
722 QApplication::clipboard()->setMimeData(mimeData
);
725 void DolphinView::paste()
730 void DolphinView::pasteIntoFolder()
732 const KFileItemList items
= selectedItems();
733 if ((items
.count() == 1) && items
.first().isDir()) {
734 pasteToUrl(items
.first().url());
738 void DolphinView::setShowPreview(bool show
)
740 if (m_showPreview
== show
) {
744 const KUrl viewPropsUrl
= rootUrl();
745 ViewProperties
props(viewPropsUrl
);
746 props
.setShowPreview(show
);
748 m_showPreview
= show
;
749 const int oldZoomLevel
= m_controller
->zoomLevel();
750 emit
showPreviewChanged();
752 // Enabling or disabling the preview might change the icon size of the view.
753 // As the view does not emit a signal when the icon size has been changed,
754 // the used zoom level of the controller must be adjusted manually:
755 updateZoomLevel(oldZoomLevel
);
757 loadDirectory(viewPropsUrl
);
760 void DolphinView::setShowHiddenFiles(bool show
)
762 if (m_viewAccessor
.dirLister()->showingDotFiles() == show
) {
766 const KUrl viewPropsUrl
= rootUrl();
767 ViewProperties
props(viewPropsUrl
);
768 props
.setShowHiddenFiles(show
);
770 m_viewAccessor
.dirLister()->setShowingDotFiles(show
);
771 emit
showHiddenFilesChanged();
773 loadDirectory(viewPropsUrl
);
776 void DolphinView::setCategorizedSorting(bool categorized
)
778 if (categorized
== categorizedSorting()) {
782 // setCategorizedSorting(true) may only get invoked
783 // if the view supports categorized sorting
784 Q_ASSERT(!categorized
|| supportsCategorizedSorting());
786 ViewProperties
props(rootUrl());
787 props
.setCategorizedSorting(categorized
);
790 m_storedCategorizedSorting
= categorized
;
791 m_viewAccessor
.proxyModel()->setCategorizedModel(categorized
);
793 emit
categorizedSortingChanged();
796 void DolphinView::toggleSortOrder()
798 const Qt::SortOrder order
= (sortOrder() == Qt::AscendingOrder
) ?
799 Qt::DescendingOrder
:
804 void DolphinView::toggleSortFoldersFirst()
806 setSortFoldersFirst(!sortFoldersFirst());
809 void DolphinView::toggleAdditionalInfo(QAction
* action
)
811 const KFileItemDelegate::Information info
=
812 static_cast<KFileItemDelegate::Information
>(action
->data().toInt());
814 KFileItemDelegate::InformationList list
= additionalInfo();
816 const bool show
= action
->isChecked();
818 const int index
= list
.indexOf(info
);
819 const bool containsInfo
= (index
>= 0);
820 if (show
&& !containsInfo
) {
822 setAdditionalInfo(list
);
823 } else if (!show
&& containsInfo
) {
824 list
.removeAt(index
);
825 setAdditionalInfo(list
);
826 Q_ASSERT(list
.indexOf(info
) < 0);
830 void DolphinView::mouseReleaseEvent(QMouseEvent
* event
)
832 QWidget::mouseReleaseEvent(event
);
836 void DolphinView::wheelEvent(QWheelEvent
* event
)
838 if (event
->modifiers() & Qt::ControlModifier
) {
839 const int delta
= event
->delta();
840 const int level
= zoomLevel();
842 setZoomLevel(level
+ 1);
843 } else if (delta
< 0) {
844 setZoomLevel(level
- 1);
850 bool DolphinView::eventFilter(QObject
* watched
, QEvent
* event
)
852 switch (event
->type()) {
853 case QEvent::FocusIn
:
854 if (watched
== m_viewAccessor
.itemView()) {
855 m_controller
->requestActivation();
859 case QEvent::MouseButtonPress
:
860 if ((watched
== m_viewAccessor
.itemView()->viewport()) && (m_expandedDragSource
!= 0)) {
861 // Listening to a mousebutton press event to delete expanded views is a
862 // workaround, as it seems impossible for the FolderExpander to know when
863 // a dragging outside a view has been finished. However it works quite well:
864 // A mousebutton press event indicates that a drag operation must be
866 m_expandedDragSource
->deleteLater();
867 m_expandedDragSource
= 0;
871 case QEvent::DragEnter
:
872 if (watched
== m_viewAccessor
.itemView()->viewport()) {
877 case QEvent::KeyPress
:
878 if (watched
== m_viewAccessor
.itemView()) {
879 // clear the selection when Escape has been pressed
880 QKeyEvent
* keyEvent
= static_cast<QKeyEvent
*>(event
);
881 if (keyEvent
->key() == Qt::Key_Escape
) {
891 return QWidget::eventFilter(watched
, event
);
894 void DolphinView::activate()
899 void DolphinView::triggerItem(const KFileItem
& item
)
901 const Qt::KeyboardModifiers modifier
= QApplication::keyboardModifiers();
902 if ((modifier
& Qt::ShiftModifier
) || (modifier
& Qt::ControlModifier
)) {
903 // items are selected by the user, hence don't trigger the
904 // item specified by 'index'
908 // TODO: the m_isContextMenuOpen check is a workaround for Qt-issue 207192
909 if (item
.isNull() || m_isContextMenuOpen
) {
913 emit
itemTriggered(item
); // caught by DolphinViewContainer or DolphinPart
916 void DolphinView::emitDelayedSelectionChangedSignal()
918 // Invoke emitSelectionChangedSignal() with a delay of 300 ms. This assures
919 // that fast selection changes don't result in expensive operations to
920 // collect all file items for the signal (see DolphinView::selectedItems()).
921 m_selectionChangedTimer
->start();
924 void DolphinView::emitSelectionChangedSignal()
926 emit
selectionChanged(DolphinView::selectedItems());
929 void DolphinView::openContextMenu(const QPoint
& pos
,
930 const QList
<QAction
*>& customActions
)
933 const QModelIndex index
= m_viewAccessor
.itemView()->indexAt(pos
);
934 if (index
.isValid() && (index
.column() == DolphinModel::Name
)) {
935 const QModelIndex dolphinModelIndex
= m_viewAccessor
.proxyModel()->mapToSource(index
);
936 item
= m_viewAccessor
.dirModel()->itemForIndex(dolphinModelIndex
);
939 m_isContextMenuOpen
= true; // TODO: workaround for Qt-issue 207192
940 emit
requestContextMenu(item
, url(), customActions
);
941 m_isContextMenuOpen
= false;
944 void DolphinView::dropUrls(const KFileItem
& destItem
,
945 const KUrl
& destPath
,
948 addNewFileNames(event
->mimeData());
949 DragAndDropHelper::instance().dropUrls(destItem
, destPath
, event
, this);
952 void DolphinView::updateSorting(DolphinView::Sorting sorting
)
954 ViewProperties
props(rootUrl());
955 props
.setSorting(sorting
);
957 m_viewAccessor
.proxyModel()->setSorting(sorting
);
959 emit
sortingChanged(sorting
);
962 void DolphinView::updateSortOrder(Qt::SortOrder order
)
964 ViewProperties
props(rootUrl());
965 props
.setSortOrder(order
);
967 m_viewAccessor
.proxyModel()->setSortOrder(order
);
969 emit
sortOrderChanged(order
);
972 void DolphinView::updateSortFoldersFirst(bool foldersFirst
)
974 ViewProperties
props(rootUrl());
975 props
.setSortFoldersFirst(foldersFirst
);
977 m_viewAccessor
.proxyModel()->setSortFoldersFirst(foldersFirst
);
979 emit
sortFoldersFirstChanged(foldersFirst
);
982 void DolphinView::updateAdditionalInfo(const KFileItemDelegate::InformationList
& info
)
984 ViewProperties
props(rootUrl());
985 props
.setAdditionalInfo(info
);
988 m_viewAccessor
.itemDelegate()->setShowInformation(info
);
990 emit
additionalInfoChanged();
993 void DolphinView::updateAdditionalInfoActions(KActionCollection
* collection
)
995 const bool enable
= (m_mode
== DolphinView::DetailsView
) ||
996 (m_mode
== DolphinView::IconsView
);
998 QAction
* showSizeInfo
= collection
->action("show_size_info");
999 QAction
* showDateInfo
= collection
->action("show_date_info");
1000 QAction
* showPermissionsInfo
= collection
->action("show_permissions_info");
1001 QAction
* showOwnerInfo
= collection
->action("show_owner_info");
1002 QAction
* showGroupInfo
= collection
->action("show_group_info");
1003 QAction
* showMimeInfo
= collection
->action("show_mime_info");
1005 showSizeInfo
->setChecked(false);
1006 showDateInfo
->setChecked(false);
1007 showPermissionsInfo
->setChecked(false);
1008 showOwnerInfo
->setChecked(false);
1009 showGroupInfo
->setChecked(false);
1010 showMimeInfo
->setChecked(false);
1012 showSizeInfo
->setEnabled(enable
);
1013 showDateInfo
->setEnabled(enable
);
1014 showPermissionsInfo
->setEnabled(enable
);
1015 showOwnerInfo
->setEnabled(enable
);
1016 showGroupInfo
->setEnabled(enable
);
1017 showMimeInfo
->setEnabled(enable
);
1019 foreach (KFileItemDelegate::Information info
, m_viewAccessor
.itemDelegate()->showInformation()) {
1021 case KFileItemDelegate::Size
:
1022 showSizeInfo
->setChecked(true);
1024 case KFileItemDelegate::ModificationTime
:
1025 showDateInfo
->setChecked(true);
1027 case KFileItemDelegate::Permissions
:
1028 showPermissionsInfo
->setChecked(true);
1030 case KFileItemDelegate::Owner
:
1031 showOwnerInfo
->setChecked(true);
1033 case KFileItemDelegate::OwnerAndGroup
:
1034 showGroupInfo
->setChecked(true);
1036 case KFileItemDelegate::FriendlyMimeType
:
1037 showMimeInfo
->setChecked(true);
1045 QPair
<bool, QString
> DolphinView::pasteInfo() const
1047 return KonqOperations::pasteInfo(url());
1050 void DolphinView::setTabsForFilesEnabled(bool tabsForFiles
)
1052 m_tabsForFiles
= tabsForFiles
;
1055 bool DolphinView::isTabsForFilesEnabled() const
1057 return m_tabsForFiles
;
1060 void DolphinView::activateItem(const KUrl
& url
)
1062 m_activeItemUrl
= url
;
1065 bool DolphinView::itemsExpandable() const
1067 return m_viewAccessor
.itemsExpandable();
1070 void DolphinView::deleteWhenNotDragSource(QAbstractItemView
*view
)
1075 if (DragAndDropHelper::instance().isDragSource(view
)) {
1076 // We must store for later deletion.
1077 if (m_expandedDragSource
!= 0) {
1078 // The old stored view is obviously not the drag source anymore.
1079 m_expandedDragSource
->deleteLater();
1080 m_expandedDragSource
= 0;
1083 m_expandedDragSource
= view
;
1086 view
->deleteLater();
1090 void DolphinView::observeCreatedItem(const KUrl
& url
)
1092 m_createdItemUrl
= url
;
1093 connect(m_viewAccessor
.dirModel(), SIGNAL(rowsInserted(const QModelIndex
&, int, int)),
1094 this, SLOT(selectAndScrollToCreatedItem()));
1097 void DolphinView::selectAndScrollToCreatedItem()
1099 const QModelIndex dirIndex
= m_viewAccessor
.dirModel()->indexForUrl(m_createdItemUrl
);
1100 if (dirIndex
.isValid()) {
1101 const QModelIndex proxyIndex
= m_viewAccessor
.proxyModel()->mapFromSource(dirIndex
);
1102 m_viewAccessor
.itemView()->setCurrentIndex(proxyIndex
);
1105 disconnect(m_viewAccessor
.dirModel(), SIGNAL(rowsInserted(const QModelIndex
&, int, int)),
1106 this, SLOT(selectAndScrollToCreatedItem()));
1107 m_createdItemUrl
= KUrl();
1110 void DolphinView::restoreSelection()
1112 disconnect(m_viewAccessor
.dirLister(), SIGNAL(completed()), this, SLOT(restoreSelection()));
1113 changeSelection(m_selectedItems
);
1116 void DolphinView::emitContentsMoved()
1118 // only emit the contents moved signal if no directory loading is ongoing
1119 // (this would reset the contents position always to (0, 0))
1120 if (!m_loadingDirectory
) {
1121 const QPoint
pos(contentsPosition());
1122 emit
contentsMoved(pos
.x(), pos
.y());
1126 void DolphinView::showHoverInformation(const KFileItem
& item
)
1128 emit
requestItemInfo(item
);
1131 void DolphinView::clearHoverInformation()
1133 emit
requestItemInfo(KFileItem());
1136 void DolphinView::slotDeleteFileFinished(KJob
* job
)
1138 if (job
->error() == 0) {
1139 emit
operationCompletedMessage(i18nc("@info:status", "Delete operation completed."));
1140 } else if (job
->error() != KIO::ERR_USER_CANCELED
) {
1141 emit
errorMessage(job
->errorString());
1145 void DolphinView::slotRequestUrlChange(const KUrl
& url
)
1147 emit
requestUrlChange(url
);
1148 m_controller
->setUrl(url
);
1151 void DolphinView::slotDirListerCompleted()
1153 if (!m_activeItemUrl
.isEmpty()) {
1154 // assure that the current item remains visible
1155 const QModelIndex dirIndex
= m_viewAccessor
.dirModel()->indexForUrl(m_activeItemUrl
);
1156 if (dirIndex
.isValid()) {
1157 const QModelIndex proxyIndex
= m_viewAccessor
.proxyModel()->mapFromSource(dirIndex
);
1158 QAbstractItemView
* view
= m_viewAccessor
.itemView();
1159 const bool clearSelection
= !hasSelection();
1160 view
->setCurrentIndex(proxyIndex
);
1161 if (clearSelection
) {
1162 view
->clearSelection();
1164 m_activeItemUrl
.clear();
1168 if (!m_newFileNames
.isEmpty()) {
1169 // select all newly added items created by a paste operation or
1170 // a drag & drop operation
1171 const int rowCount
= m_viewAccessor
.proxyModel()->rowCount();
1172 QItemSelection selection
;
1173 for (int row
= 0; row
< rowCount
; ++row
) {
1174 const QModelIndex proxyIndex
= m_viewAccessor
.proxyModel()->index(row
, 0);
1175 const QModelIndex dirIndex
= m_viewAccessor
.proxyModel()->mapToSource(proxyIndex
);
1176 const KUrl url
= m_viewAccessor
.dirModel()->itemForIndex(dirIndex
).url();
1177 if (m_newFileNames
.contains(url
.fileName())) {
1178 selection
.merge(QItemSelection(proxyIndex
, proxyIndex
), QItemSelectionModel::Select
);
1181 m_viewAccessor
.itemView()->selectionModel()->select(selection
, QItemSelectionModel::Select
);
1183 m_newFileNames
.clear();
1187 void DolphinView::slotRefreshItems()
1189 if (m_assureVisibleCurrentIndex
) {
1190 m_assureVisibleCurrentIndex
= false;
1191 m_viewAccessor
.itemView()->scrollTo(m_viewAccessor
.itemView()->currentIndex());
1195 void DolphinView::loadDirectory(const KUrl
& url
, bool reload
)
1197 if (!url
.isValid()) {
1198 const QString
location(url
.pathOrUrl());
1199 if (location
.isEmpty()) {
1200 emit
errorMessage(i18nc("@info:status", "The location is empty."));
1202 emit
errorMessage(i18nc("@info:status", "The location '%1' is invalid.", location
));
1207 m_loadingDirectory
= true;
1210 m_selectedItems
= selectedItems();
1211 connect(m_viewAccessor
.dirLister(), SIGNAL(completed()), this, SLOT(restoreSelection()));
1214 m_viewAccessor
.dirLister()->stop();
1215 m_viewAccessor
.dirLister()->openUrl(url
, reload
? KDirLister::Reload
: KDirLister::NoFlags
);
1218 void DolphinView::applyViewProperties()
1220 if (m_ignoreViewProperties
) {
1224 const ViewProperties
props(rootUrl());
1226 const Mode mode
= props
.viewMode();
1227 if (m_mode
!= mode
) {
1228 const int oldZoomLevel
= m_controller
->zoomLevel();
1234 updateZoomLevel(oldZoomLevel
);
1236 if (m_viewAccessor
.itemView() == 0) {
1239 Q_ASSERT(m_viewAccessor
.itemView() != 0);
1240 Q_ASSERT(m_viewAccessor
.itemDelegate() != 0);
1242 const bool showHiddenFiles
= props
.showHiddenFiles();
1243 if (showHiddenFiles
!= m_viewAccessor
.dirLister()->showingDotFiles()) {
1244 m_viewAccessor
.dirLister()->setShowingDotFiles(showHiddenFiles
);
1245 emit
showHiddenFilesChanged();
1248 m_storedCategorizedSorting
= props
.categorizedSorting();
1249 const bool categorized
= m_storedCategorizedSorting
&& supportsCategorizedSorting();
1250 if (categorized
!= m_viewAccessor
.proxyModel()->isCategorizedModel()) {
1251 m_viewAccessor
.proxyModel()->setCategorizedModel(categorized
);
1252 emit
categorizedSortingChanged();
1255 const DolphinView::Sorting sorting
= props
.sorting();
1256 if (sorting
!= m_viewAccessor
.proxyModel()->sorting()) {
1257 m_viewAccessor
.proxyModel()->setSorting(sorting
);
1258 emit
sortingChanged(sorting
);
1261 const Qt::SortOrder sortOrder
= props
.sortOrder();
1262 if (sortOrder
!= m_viewAccessor
.proxyModel()->sortOrder()) {
1263 m_viewAccessor
.proxyModel()->setSortOrder(sortOrder
);
1264 emit
sortOrderChanged(sortOrder
);
1267 const bool sortFoldersFirst
= props
.sortFoldersFirst();
1268 if (sortFoldersFirst
!= m_viewAccessor
.proxyModel()->sortFoldersFirst()) {
1269 m_viewAccessor
.proxyModel()->setSortFoldersFirst(sortFoldersFirst
);
1270 emit
sortFoldersFirstChanged(sortFoldersFirst
);
1273 KFileItemDelegate::InformationList info
= props
.additionalInfo();
1274 if (info
!= m_viewAccessor
.itemDelegate()->showInformation()) {
1275 m_viewAccessor
.itemDelegate()->setShowInformation(info
);
1276 emit
additionalInfoChanged();
1279 const bool showPreview
= props
.showPreview();
1280 if (showPreview
!= m_showPreview
) {
1281 m_showPreview
= showPreview
;
1282 const int oldZoomLevel
= m_controller
->zoomLevel();
1283 emit
showPreviewChanged();
1285 // Enabling or disabling the preview might change the icon size of the view.
1286 // As the view does not emit a signal when the icon size has been changed,
1287 // the used zoom level of the controller must be adjusted manually:
1288 updateZoomLevel(oldZoomLevel
);
1291 if (DolphinSettings::instance().generalSettings()->globalViewProps()) {
1292 // During the lifetime of a DolphinView instance the global view properties
1293 // should not be changed. This allows e. g. to split a view and use different
1294 // view properties for each view.
1295 m_ignoreViewProperties
= true;
1299 void DolphinView::createView()
1302 Q_ASSERT(m_viewAccessor
.itemView() == 0);
1303 m_viewAccessor
.createView(this, m_controller
, m_mode
);
1305 QAbstractItemView
* view
= m_viewAccessor
.itemView();
1306 Q_ASSERT(view
!= 0);
1307 view
->installEventFilter(this);
1308 view
->viewport()->installEventFilter(this);
1309 setFocusProxy(view
);
1311 /* TODO: enable folder expanding again later
1313 if (m_mode != ColumnView) {
1314 // Give the view the ability to auto-expand its directories on hovering
1315 // (the column view takes care about this itself). If the details view
1316 // uses expandable folders, the auto-expanding should be used always.
1317 FolderExpander* folderExpander = new FolderExpander(view, m_viewAccessor.proxyModel());
1318 folderExpander->setEnabled(m_viewAccessor.hasExpandableFolders());
1319 connect(folderExpander, SIGNAL(enterDir(const QModelIndex&)),
1320 m_controller, SLOT(triggerItem(const QModelIndex&)));
1324 // Listen out for requests to delete the current column.
1325 connect(m_viewAccessor.columnsContainer(), SIGNAL(requestColumnDeletion(QAbstractItemView*)),
1326 this, SLOT(deleteWhenNotDragSource(QAbstractItemView*)));
1329 m_controller
->setItemView(view
);
1331 m_selectionChangedTimer
= new QTimer(this);
1332 m_selectionChangedTimer
->setSingleShot(true);
1333 m_selectionChangedTimer
->setInterval(300);
1334 connect(m_selectionChangedTimer
, SIGNAL(timeout()),
1335 this, SLOT(emitSelectionChangedSignal()));
1337 // When changing the view mode, the selection is lost due to reinstantiating
1338 // a new item view with a custom selection model. Pass the ownership of the
1339 // selection model to DolphinView, so that it can be shared by all item views.
1340 if (m_selectionModel
!= 0) {
1341 view
->setSelectionModel(m_selectionModel
);
1343 m_selectionModel
= view
->selectionModel();
1345 m_selectionModel
->setParent(this);
1347 view
->setSelectionMode(QAbstractItemView::ExtendedSelection
);
1349 m_versionControlObserver
= new VersionControlObserver(view
);
1350 connect(m_versionControlObserver
, SIGNAL(infoMessage(const QString
&)),
1351 this, SIGNAL(infoMessage(const QString
&)));
1352 connect(m_versionControlObserver
, SIGNAL(errorMessage(const QString
&)),
1353 this, SIGNAL(errorMessage(const QString
&)));
1354 connect(m_versionControlObserver
, SIGNAL(operationCompletedMessage(const QString
&)),
1355 this, SIGNAL(operationCompletedMessage(const QString
&)));
1357 connect(view
->selectionModel(), SIGNAL(selectionChanged(const QItemSelection
&, const QItemSelection
&)),
1358 this, SLOT(emitDelayedSelectionChangedSignal()));
1359 connect(view
->verticalScrollBar(), SIGNAL(valueChanged(int)),
1360 this, SLOT(emitContentsMoved()));
1361 connect(view
->horizontalScrollBar(), SIGNAL(valueChanged(int)),
1362 this, SLOT(emitContentsMoved()));
1364 m_topLayout
->insertWidget(1, m_viewAccessor
.layoutTarget());
1367 void DolphinView::deleteView()
1369 QAbstractItemView
* view
= m_viewAccessor
.itemView();
1371 // It's important to set the keyboard focus to the parent
1372 // before deleting the view: Otherwise when having a split
1373 // view the other view will get the focus and will request
1374 // an activation (see DolphinView::eventFilter()).
1378 m_topLayout
->removeWidget(view
);
1382 m_controller
->disconnect(view
);
1385 // TODO: move this code into ViewAccessor::deleteView()
1386 deleteWhenNotDragSource(view
);
1389 m_viewAccessor
.deleteView();
1393 void DolphinView::pasteToUrl(const KUrl
& url
)
1395 addNewFileNames(QApplication::clipboard()->mimeData());
1396 KonqOperations::doPaste(this, url
);
1399 void DolphinView::updateZoomLevel(int oldZoomLevel
)
1401 const int newZoomLevel
= ZoomLevelInfo::zoomLevelForIconSize(m_viewAccessor
.itemView()->iconSize());
1402 if (oldZoomLevel
!= newZoomLevel
) {
1403 m_controller
->setZoomLevel(newZoomLevel
);
1404 emit
zoomLevelChanged(newZoomLevel
);
1408 KUrl::List
DolphinView::simplifiedSelectedUrls() const
1410 KUrl::List list
= selectedUrls();
1411 if (itemsExpandable() ) {
1412 list
= KDirModel::simplifiedUrlList(list
);
1417 QMimeData
* DolphinView::selectionMimeData() const
1419 const QAbstractItemView
* view
= m_viewAccessor
.itemView();
1420 Q_ASSERT((view
!= 0) && (view
->selectionModel() != 0));
1421 const QItemSelection selection
= m_viewAccessor
.proxyModel()->mapSelectionToSource(view
->selectionModel()->selection());
1422 return m_viewAccessor
.dirModel()->mimeData(selection
.indexes());
1425 void DolphinView::addNewFileNames(const QMimeData
* mimeData
)
1427 const KUrl::List urls
= KUrl::List::fromMimeData(mimeData
);
1428 foreach (const KUrl
& url
, urls
) {
1429 m_newFileNames
.insert(url
.fileName());
1433 DolphinView::ViewAccessor::ViewAccessor(DolphinSortFilterProxyModel
* proxyModel
) :
1436 m_columnsContainer(0),
1437 m_proxyModel(proxyModel
)
1441 void DolphinView::ViewAccessor::createView(QWidget
* parent
,
1442 DolphinController
* controller
,
1445 Q_ASSERT(itemView() == 0);
1449 m_iconsView
= new DolphinIconsView(parent
, controller
, m_proxyModel
);
1453 m_detailsView
= new DolphinDetailsView(parent
, controller
, m_proxyModel
);
1457 m_columnsContainer
= new DolphinColumnViewContainer(parent
, controller
);
1465 void DolphinView::ViewAccessor::deleteView()
1467 // TODO: Move the deleteWhenNotDragSource() code into the view
1468 // accessor, so that creating and deleting is fully done by
1469 // the view accessor.
1473 m_columnsContainer
->deleteLater();
1474 m_columnsContainer
= 0;
1478 void DolphinView::ViewAccessor::prepareUrlChange(const KUrl
& url
)
1480 if (m_columnsContainer
!= 0) {
1481 m_columnsContainer
->showColumn(url
);
1485 QAbstractItemView
* DolphinView::ViewAccessor::itemView() const
1487 if (m_iconsView
!= 0) {
1491 if (m_detailsView
!= 0) {
1492 return m_detailsView
;
1495 if (m_columnsContainer
!= 0) {
1496 return m_columnsContainer
->activeColumn();
1502 KFileItemDelegate
* DolphinView::ViewAccessor::itemDelegate() const
1504 return static_cast<KFileItemDelegate
*>(itemView()->itemDelegate());
1507 QWidget
* DolphinView::ViewAccessor::layoutTarget() const
1509 if (m_columnsContainer
!= 0) {
1510 return m_columnsContainer
;
1515 KUrl
DolphinView::ViewAccessor::rootUrl() const
1517 return (m_columnsContainer
!= 0) ? m_columnsContainer
->rootUrl() : KUrl();
1520 bool DolphinView::ViewAccessor::supportsCategorizedSorting() const
1522 return m_iconsView
!= 0;
1525 bool DolphinView::ViewAccessor::hasExpandableFolders() const
1527 const DolphinSettings
& settings
= DolphinSettings::instance();
1528 return settings
.generalSettings()->autoExpandFolders() ||
1529 ((m_detailsView
!= 0) && settings
.detailsModeSettings()->expandableFolders());
1532 bool DolphinView::ViewAccessor::itemsExpandable() const
1534 return (m_detailsView
!= 0) && m_detailsView
->itemsExpandable();
1537 bool DolphinView::ViewAccessor::reloadOnAdditionalInfoChange() const
1539 // the details view requires no reloading of the directory, as it maps
1540 // the file item delegate info to its columns internally
1541 return m_detailsView
!= 0;
1545 DolphinModel
* DolphinView::ViewAccessor::dirModel() const
1547 return static_cast<DolphinModel
*>(proxyModel()->sourceModel());
1550 DolphinSortFilterProxyModel
* DolphinView::ViewAccessor::proxyModel() const
1552 if (m_columnsContainer
!= 0) {
1553 return static_cast<DolphinSortFilterProxyModel
*>(m_columnsContainer
->activeColumn()->model());
1555 return m_proxyModel
;
1558 KDirLister
* DolphinView::ViewAccessor::dirLister() const
1560 return dirModel()->dirLister();
1563 #include "dolphinview.moc"