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"
25 #include <QApplication>
27 #include <QItemSelectionModel>
28 #include <QMouseEvent>
29 #include <QVBoxLayout>
31 #include <kdirmodel.h>
32 #include <kfileitemdelegate.h>
34 #include <kio/netaccess.h>
35 #include <kio/renamedialog.h>
36 #include <kmimetyperesolver.h>
37 #include <konq_operations.h>
40 #include "dolphincontroller.h"
41 #include "dolphinstatusbar.h"
42 #include "dolphinmainwindow.h"
43 #include "dolphindirlister.h"
44 #include "dolphinsortfilterproxymodel.h"
45 #include "dolphindetailsview.h"
46 #include "dolphiniconsview.h"
47 #include "dolphincontextmenu.h"
48 #include "filterbar.h"
49 #include "renamedialog.h"
50 #include "urlnavigator.h"
51 #include "viewproperties.h"
53 DolphinView::DolphinView(DolphinMainWindow
* mainWindow
,
57 bool showHiddenFiles
) :
59 m_showProgress(false),
64 m_mainWindow(mainWindow
),
77 setFocusPolicy(Qt::StrongFocus
);
78 m_topLayout
= new QVBoxLayout(this);
79 m_topLayout
->setSpacing(0);
80 m_topLayout
->setMargin(0);
82 m_urlNavigator
= new UrlNavigator(url
, this);
83 connect(m_urlNavigator
, SIGNAL(urlChanged(const KUrl
&)),
84 this, SLOT(loadDirectory(const KUrl
&)));
86 m_statusBar
= new DolphinStatusBar(this);
88 m_dirLister
= new DolphinDirLister();
89 m_dirLister
->setAutoUpdate(true);
90 m_dirLister
->setMainWindow(this);
91 m_dirLister
->setShowingDotFiles(showHiddenFiles
);
92 m_dirLister
->setDelayedMimeTypes(true);
94 connect(m_dirLister
, SIGNAL(clear()),
95 this, SLOT(updateStatusBar()));
96 connect(m_dirLister
, SIGNAL(percent(int)),
97 this, SLOT(updateProgress(int)));
98 connect(m_dirLister
, SIGNAL(deleteItem(KFileItem
*)),
99 this, SLOT(updateStatusBar()));
100 connect(m_dirLister
, SIGNAL(completed()),
101 this, SLOT(updateItemCount()));
102 connect(m_dirLister
, SIGNAL(infoMessage(const QString
&)),
103 this, SLOT(showInfoMessage(const QString
&)));
104 connect(m_dirLister
, SIGNAL(errorMessage(const QString
&)),
105 this, SLOT(showErrorMessage(const QString
&)));
107 m_dirModel
= new KDirModel();
108 m_dirModel
->setDirLister(m_dirLister
);
109 m_dirModel
->setDropsAllowed(KDirModel::DropOnDirectory
);
111 m_proxyModel
= new DolphinSortFilterProxyModel(this);
112 m_proxyModel
->setSourceModel(m_dirModel
);
114 m_controller
= new DolphinController(this);
115 connect(m_controller
, SIGNAL(requestContextMenu(const QPoint
&)),
116 this, SLOT(openContextMenu(const QPoint
&)));
117 connect(m_controller
, SIGNAL(urlsDropped(const KUrl::List
&, const QPoint
&)),
118 this, SLOT(dropUrls(const KUrl::List
&, const QPoint
&)));
119 connect(m_controller
, SIGNAL(sortingChanged(DolphinView::Sorting
)),
120 this, SLOT(updateSorting(DolphinView::Sorting
)));
121 connect(m_controller
, SIGNAL(sortOrderChanged(Qt::SortOrder
)),
122 this, SLOT(updateSortOrder(Qt::SortOrder
)));
123 connect(m_controller
, SIGNAL(itemTriggered(const QModelIndex
&)),
124 this, SLOT(triggerItem(const QModelIndex
&)));
125 connect(m_controller
, SIGNAL(selectionChanged()),
126 this, SLOT(emitSelectionChangedSignal()));
127 connect(m_controller
, SIGNAL(activated()),
128 this, SLOT(requestActivation()));
132 m_iconSize
= K3Icon::SizeMedium
;
134 m_filterBar
= new FilterBar(this);
136 connect(m_filterBar
, SIGNAL(filterChanged(const QString
&)),
137 this, SLOT(changeNameFilter(const QString
&)));
138 connect(m_filterBar
, SIGNAL(closeRequest()),
139 this, SLOT(closeFilterBar()));
141 m_topLayout
->addWidget(m_urlNavigator
);
142 m_topLayout
->addWidget(itemView());
143 m_topLayout
->addWidget(m_filterBar
);
144 m_topLayout
->addWidget(m_statusBar
);
146 loadDirectory(m_urlNavigator
->url());
149 DolphinView::~DolphinView()
155 void DolphinView::setUrl(const KUrl
& url
)
157 m_urlNavigator
->setUrl(url
);
158 m_controller
->setUrl(url
);
161 const KUrl
& DolphinView::url() const
163 return m_urlNavigator
->url();
166 bool DolphinView::isActive() const
168 return (mainWindow()->activeView() == this);
171 void DolphinView::setMode(Mode mode
)
173 if (mode
== m_mode
) {
174 return; // the wished mode is already set
179 ViewProperties
props(m_urlNavigator
->url());
180 props
.setViewMode(m_mode
);
183 startDirLister(m_urlNavigator
->url());
188 DolphinView::Mode
DolphinView::mode() const
193 void DolphinView::setShowPreview(bool show
)
195 ViewProperties
props(m_urlNavigator
->url());
196 props
.setShowPreview(show
);
198 // TODO: wait until previews are possible with KFileItemDelegate
200 emit
showPreviewChanged();
203 bool DolphinView::showPreview() const
205 // TODO: wait until previews are possible with KFileItemDelegate
209 void DolphinView::setShowHiddenFiles(bool show
)
211 if (m_dirLister
->showingDotFiles() == show
) {
215 ViewProperties
props(m_urlNavigator
->url());
216 props
.setShowHiddenFiles(show
);
219 m_dirLister
->setShowingDotFiles(show
);
221 emit
showHiddenFilesChanged();
226 bool DolphinView::showHiddenFiles() const
228 return m_dirLister
->showingDotFiles();
231 void DolphinView::renameSelectedItems()
233 const KUrl::List urls
= selectedUrls();
234 if (urls
.count() > 1) {
235 // More than one item has been selected for renaming. Open
236 // a rename dialog and rename all items afterwards.
237 RenameDialog
dialog(urls
);
238 if (dialog
.exec() == QDialog::Rejected
) {
242 DolphinView
* view
= mainWindow()->activeView();
243 const QString
& newName
= dialog
.newName();
244 if (newName
.isEmpty()) {
245 view
->statusBar()->setMessage(i18n("The new item name is invalid."),
246 DolphinStatusBar::Error
);
249 // TODO: check how this can be integrated into KonqUndoManager/KonqOperations
251 //UndoManager& undoMan = UndoManager::instance();
252 //undoMan.beginMacro();
254 assert(newName
.contains('#'));
256 const int urlsCount
= urls
.count();
258 // iterate through all selected items and rename them...
259 const int replaceIndex
= newName
.indexOf('#');
260 assert(replaceIndex
>= 0);
261 for (int i
= 0; i
< urlsCount
; ++i
) {
262 const KUrl
& source
= urls
[i
];
264 number
.setNum(i
+ 1);
266 QString
name(newName
);
267 name
.replace(replaceIndex
, 1, number
);
269 if (source
.fileName() != name
) {
270 KUrl
dest(source
.upUrl());
273 const bool destExists
= KIO::NetAccess::exists(dest
, false, view
);
275 view
->statusBar()->setMessage(i18n("Renaming failed (item '%1' already exists).",name
),
276 DolphinStatusBar::Error
);
279 else if (KIO::NetAccess::file_move(source
, dest
)) {
280 // TODO: From the users point of view he executed one 'rename n files' operation,
281 // but internally we store it as n 'rename 1 file' operations for the undo mechanism.
282 //DolphinCommand command(DolphinCommand::Rename, source, dest);
283 //undoMan.addCommand(command);
288 //undoMan.endMacro();
292 // Only one item has been selected for renaming. Use the custom
293 // renaming mechanism from the views.
294 assert(urls
.count() == 1);
296 /*if (m_mode == DetailsView) {
297 Q3ListViewItem* item = m_iconsView->firstChild();
299 if (item->isSelected()) {
300 m_iconsView->rename(item, DolphinDetailsView::NameColumn);
303 item = item->nextSibling();
307 KFileIconViewItem* item = static_cast<KFileIconViewItem*>(m_iconsView->firstItem());
309 if (item->isSelected()) {
313 item = static_cast<KFileIconViewItem*>(item->nextItem());
319 void DolphinView::selectAll()
321 selectAll(QItemSelectionModel::Select
);
324 void DolphinView::invertSelection()
326 selectAll(QItemSelectionModel::Toggle
);
329 DolphinStatusBar
* DolphinView::statusBar() const
334 int DolphinView::contentsX() const
337 return itemView()->horizontalScrollBar()->value();
340 int DolphinView::contentsY() const
342 return itemView()->verticalScrollBar()->value();
345 void DolphinView::refreshSettings()
347 startDirLister(m_urlNavigator
->url());
350 void DolphinView::emitRequestItemInfo(const KUrl
& url
)
352 emit
requestItemInfo(url
);
355 bool DolphinView::isFilterBarVisible() const
357 return m_filterBar
->isVisible();
360 bool DolphinView::isUrlEditable() const
362 return m_urlNavigator
->isUrlEditable();
365 void DolphinView::zoomIn()
367 //itemEffectsManager()->zoomIn();
370 void DolphinView::zoomOut()
372 //itemEffectsManager()->zoomOut();
375 bool DolphinView::isZoomInPossible() const
377 return false; //itemEffectsManager()->isZoomInPossible();
380 bool DolphinView::isZoomOutPossible() const
382 return false; //itemEffectsManager()->isZoomOutPossible();
385 void DolphinView::setSorting(Sorting sorting
)
387 if (sorting
!= this->sorting()) {
388 updateSorting(sorting
);
392 DolphinView::Sorting
DolphinView::sorting() const
394 return m_proxyModel
->sorting();
397 void DolphinView::setSortOrder(Qt::SortOrder order
)
399 if (sortOrder() != order
) {
400 updateSortOrder(order
);
404 Qt::SortOrder
DolphinView::sortOrder() const
406 return m_proxyModel
->sortOrder();
409 void DolphinView::goBack()
411 m_urlNavigator
->goBack();
414 void DolphinView::goForward()
416 m_urlNavigator
->goForward();
419 void DolphinView::goUp()
421 m_urlNavigator
->goUp();
424 void DolphinView::goHome()
426 m_urlNavigator
->goHome();
429 void DolphinView::setUrlEditable(bool editable
)
431 m_urlNavigator
->editUrl(editable
);
434 const QLinkedList
<UrlNavigator::HistoryElem
> DolphinView::urlHistory(int& index
) const
436 return m_urlNavigator
->history(index
);
439 bool DolphinView::hasSelection() const
441 return itemView()->selectionModel()->hasSelection();
444 KFileItemList
DolphinView::selectedItems() const
446 const QAbstractItemView
* view
= itemView();
448 // Our view has a selection, we will map them back to the DirModel
449 // and then fill the KFileItemList.
450 assert((view
!= 0) && (view
->selectionModel() != 0));
452 const QItemSelection selection
= m_proxyModel
->mapSelectionToSource(view
->selectionModel()->selection());
453 KFileItemList itemList
;
455 const QModelIndexList indexList
= selection
.indexes();
456 QModelIndexList::const_iterator end
= indexList
.end();
457 for (QModelIndexList::const_iterator it
= indexList
.begin(); it
!= end
; ++it
) {
458 assert((*it
).isValid());
460 KFileItem
* item
= m_dirModel
->itemForIndex(*it
);
462 itemList
.append(item
);
469 KUrl::List
DolphinView::selectedUrls() const
473 const KFileItemList list
= selectedItems();
474 KFileItemList::const_iterator it
= list
.begin();
475 const KFileItemList::const_iterator end
= list
.end();
477 KFileItem
* item
= *it
;
478 urls
.append(item
->url());
485 KFileItem
* DolphinView::fileItem(const QModelIndex index
) const
487 const QModelIndex dirModelIndex
= m_proxyModel
->mapToSource(index
);
488 return m_dirModel
->itemForIndex(dirModelIndex
);
491 void DolphinView::rename(const KUrl
& source
, const QString
& newName
)
495 if (newName
.isEmpty() || (source
.fileName() == newName
)) {
499 KUrl
dest(source
.upUrl());
500 dest
.addPath(newName
);
502 const bool destExists
= KIO::NetAccess::exists(dest
,
504 mainWindow()->activeView());
506 // the destination already exists, hence ask the user
508 KIO::RenameDialog
renameDialog(this,
509 i18n("File Already Exists"),
513 switch (renameDialog
.exec()) {
514 case KIO::R_OVERWRITE
:
515 // the destination should be overwritten
516 ok
= KIO::NetAccess::file_move(source
, dest
, -1, true);
519 case KIO::R_RENAME
: {
520 // a new name for the destination has been used
521 KUrl
newDest(renameDialog
.newDestUrl());
522 ok
= KIO::NetAccess::file_move(source
, newDest
);
527 // the renaming operation has been canceled
533 // no destination exists, hence just move the file to
535 ok
= KIO::NetAccess::file_move(source
, dest
);
538 const QString destFileName
= dest
.fileName();
540 m_statusBar
->setMessage(i18n("Renamed file '%1' to '%2'.",source
.fileName(), destFileName
),
541 DolphinStatusBar::OperationCompleted
);
543 KonqOperations::rename(this, source
, destFileName
);
546 m_statusBar
->setMessage(i18n("Renaming of file '%1' to '%2' failed.",source
.fileName(), destFileName
),
547 DolphinStatusBar::Error
);
552 void DolphinView::reload()
554 startDirLister(m_urlNavigator
->url(), true);
557 void DolphinView::declareViewActive()
559 mainWindow()->setActiveView( this );
562 void DolphinView::mouseReleaseEvent(QMouseEvent
* event
)
564 QWidget::mouseReleaseEvent(event
);
565 mainWindow()->setActiveView(this);
568 DolphinMainWindow
* DolphinView::mainWindow() const
573 void DolphinView::loadDirectory(const KUrl
& url
)
575 const ViewProperties
props(url
);
577 const Mode mode
= props
.viewMode();
578 if (m_mode
!= mode
) {
584 const bool showHiddenFiles
= props
.showHiddenFiles();
585 if (showHiddenFiles
!= m_dirLister
->showingDotFiles()) {
586 m_dirLister
->setShowingDotFiles(showHiddenFiles
);
587 emit
showHiddenFilesChanged();
590 const DolphinView::Sorting sorting
= props
.sorting();
591 if (sorting
!= m_proxyModel
->sorting()) {
592 m_proxyModel
->setSorting(sorting
);
593 emit
sortingChanged(sorting
);
596 const Qt::SortOrder sortOrder
= props
.sortOrder();
597 if (sortOrder
!= m_proxyModel
->sortOrder()) {
598 m_proxyModel
->setSortOrder(sortOrder
);
599 emit
sortOrderChanged(sortOrder
);
602 // TODO: handle previews (props.showPreview())
605 emit
urlChanged(url
);
607 m_statusBar
->clear();
610 void DolphinView::triggerItem(const QModelIndex
& index
)
612 const Qt::KeyboardModifiers modifier
= QApplication::keyboardModifiers();
613 if ((modifier
& Qt::ShiftModifier
) || (modifier
& Qt::ControlModifier
)) {
614 // items are selected by the user, hence don't trigger the
615 // item specified by 'index'
619 KFileItem
* item
= m_dirModel
->itemForIndex(m_proxyModel
->mapToSource(index
));
625 // Prefer the local path over the URL. This assures that the
626 // volume space information is correct. Assuming that the URL is media:/sda1,
627 // and the local path is /windows/C: For the URL the space info is related
628 // to the root partition (and hence wrong) and for the local path the space
629 // info is related to the windows partition (-> correct).
630 const QString
localPath(item
->localPath());
631 if (localPath
.isEmpty()) {
635 setUrl(KUrl(localPath
));
643 void DolphinView::updateProgress(int percent
)
645 if (m_showProgress
) {
646 m_statusBar
->setProgress(percent
);
650 void DolphinView::updateItemCount()
652 if (m_showProgress
) {
653 m_statusBar
->setProgressText(QString::null
);
654 m_statusBar
->setProgress(100);
655 m_showProgress
= false;
658 KFileItemList
items(m_dirLister
->items());
659 KFileItemList::const_iterator it
= items
.begin();
660 const KFileItemList::const_iterator end
= items
.end();
666 KFileItem
* item
= *it
;
678 QTimer::singleShot(0, this, SLOT(restoreContentsPos()));
681 void DolphinView::restoreContentsPos()
684 const QLinkedList
<UrlNavigator::HistoryElem
> history
= urlHistory(index
);
685 if (!history
.isEmpty()) {
686 QAbstractItemView
* view
= itemView();
687 // TODO: view->setCurrentItem(history[index].currentFileName());
689 QLinkedList
<UrlNavigator::HistoryElem
>::const_iterator it
= history
.begin();
691 view
->horizontalScrollBar()->setValue((*it
).contentsX());
692 view
->verticalScrollBar()->setValue((*it
).contentsY());
696 void DolphinView::showInfoMessage(const QString
& msg
)
698 m_statusBar
->setMessage(msg
, DolphinStatusBar::Information
);
701 void DolphinView::showErrorMessage(const QString
& msg
)
703 m_statusBar
->setMessage(msg
, DolphinStatusBar::Error
);
706 void DolphinView::emitSelectionChangedSignal()
708 emit
selectionChanged();
711 void DolphinView::closeFilterBar()
714 emit
showFilterBarChanged(false);
717 void DolphinView::startDirLister(const KUrl
& url
, bool reload
)
719 if (!url
.isValid()) {
720 const QString
location(url
.pathOrUrl());
721 if (location
.isEmpty()) {
722 m_statusBar
->setMessage(i18n("The location is empty."), DolphinStatusBar::Error
);
725 m_statusBar
->setMessage(i18n("The location '%1' is invalid.",location
),
726 DolphinStatusBar::Error
);
731 // Only show the directory loading progress if the status bar does
732 // not contain another progress information. This means that
733 // the directory loading progress information has the lowest priority.
734 const QString
progressText(m_statusBar
->progressText());
735 m_showProgress
= progressText
.isEmpty() ||
736 (progressText
== i18n("Loading directory..."));
737 if (m_showProgress
) {
738 m_statusBar
->setProgressText(i18n("Loading directory..."));
739 m_statusBar
->setProgress(0);
743 m_dirLister
->openUrl(url
, false, reload
);
746 QString
DolphinView::defaultStatusBarText() const
748 return KIO::itemsSummaryString(m_fileCount
+ m_folderCount
,
754 QString
DolphinView::selectionStatusBarText() const
757 const KFileItemList list
= selectedItems();
758 if (list
.isEmpty()) {
759 // when an item is triggered, it is temporary selected but selectedItems()
760 // will return an empty list
766 KIO::filesize_t byteSize
= 0;
767 KFileItemList::const_iterator it
= list
.begin();
768 const KFileItemList::const_iterator end
= list
.end();
770 KFileItem
* item
= *it
;
776 byteSize
+= item
->size();
781 if (folderCount
> 0) {
782 text
= i18np("1 Folder selected", "%1 Folders selected", folderCount
);
789 const QString
sizeText(KIO::convertSize(byteSize
));
790 text
+= i18np("1 File selected (%2)", "%1 Files selected (%2)", fileCount
, sizeText
);
796 void DolphinView::showFilterBar(bool show
)
798 assert(m_filterBar
!= 0);
807 void DolphinView::updateStatusBar()
809 // As the item count information is less important
810 // in comparison with other messages, it should only
812 // - the status bar is empty or
813 // - shows already the item count information or
814 // - shows only a not very important information
815 // - if any progress is given don't show the item count info at all
816 const QString
msg(m_statusBar
->message());
817 const bool updateStatusBarMsg
= (msg
.isEmpty() ||
818 (msg
== m_statusBar
->defaultText()) ||
819 (m_statusBar
->type() == DolphinStatusBar::Information
)) &&
820 (m_statusBar
->progress() == 100);
822 const QString
text(hasSelection() ? selectionStatusBarText() : defaultStatusBarText());
823 m_statusBar
->setDefaultText(text
);
825 if (updateStatusBarMsg
) {
826 m_statusBar
->setMessage(text
, DolphinStatusBar::Default
);
830 void DolphinView::requestActivation()
832 m_mainWindow
->setActiveView(this);
835 void DolphinView::changeNameFilter(const QString
& nameFilter
)
837 // The name filter of KDirLister does a 'hard' filtering, which
838 // means that only the items are shown where the names match
839 // exactly the filter. This is non-transparent for the user, which
840 // just wants to have a 'soft' filtering: does the name contain
841 // the filter string?
842 QString
adjustedFilter(nameFilter
);
843 adjustedFilter
.insert(0, '*');
844 adjustedFilter
.append('*');
846 // Use the ProxyModel to filter:
847 // This code is #ifdefed as setNameFilter behaves
848 // slightly different than the QSortFilterProxyModel
849 // as it will not remove directories. I will ask
850 // our beloved usability experts for input
853 m_dirLister
->setNameFilter(adjustedFilter
);
854 m_dirLister
->emitChanges();
856 m_proxyModel
->setFilterRegExp( nameFilter
);
860 void DolphinView::openContextMenu(const QPoint
& pos
)
864 const QModelIndex index
= itemView()->indexAt(pos
);
865 if (index
.isValid()) {
866 item
= fileItem(index
);
869 DolphinContextMenu
contextMenu(this, item
);
873 void DolphinView::dropUrls(const KUrl::List
& urls
,
876 KFileItem
* directory
= 0;
877 const QModelIndex index
= itemView()->indexAt(pos
);
878 if (index
.isValid()) {
879 KFileItem
* item
= fileItem(index
);
882 // the URLs are dropped above a directory
887 const KUrl
& destination
= (directory
== 0) ? url() :
889 m_mainWindow
->dropUrls(urls
, destination
);
892 void DolphinView::updateSorting(DolphinView::Sorting sorting
)
894 ViewProperties
props(url());
895 props
.setSorting(sorting
);
897 m_proxyModel
->setSorting(sorting
);
899 emit
sortingChanged(sorting
);
902 void DolphinView::updateSortOrder(Qt::SortOrder order
)
904 ViewProperties
props(url());
905 props
.setSortOrder(order
);
907 m_proxyModel
->setSortOrder(order
);
909 emit
sortOrderChanged(order
);
912 void DolphinView::createView()
914 // delete current view
915 QAbstractItemView
* view
= itemView();
917 m_topLayout
->removeWidget(view
);
924 assert(m_iconsView
== 0);
925 assert(m_detailsView
== 0);
927 // ... and recreate it representing the current mode
930 m_iconsView
= new DolphinIconsView(this, m_controller
);
935 m_detailsView
= new DolphinDetailsView(this, m_controller
);
936 view
= m_detailsView
;
940 view
->setModel(m_proxyModel
);
941 view
->setSelectionMode(QAbstractItemView::ExtendedSelection
);
943 KFileItemDelegate
* delegate
= new KFileItemDelegate(this);
944 delegate
->setAdditionalInformation(KFileItemDelegate::FriendlyMimeType
);
945 view
->setItemDelegate(delegate
);
947 new KMimeTypeResolver(view
, m_dirModel
);
948 m_topLayout
->insertWidget(1, view
);
950 connect(view
->selectionModel(), SIGNAL(selectionChanged(const QItemSelection
&, const QItemSelection
&)),
951 m_controller
, SLOT(indicateSelectionChange()));
954 void DolphinView::selectAll(QItemSelectionModel::SelectionFlags flags
)
956 QItemSelectionModel
* selectionModel
= itemView()->selectionModel();
957 const QAbstractItemModel
* itemModel
= selectionModel
->model();
959 const QModelIndex topLeft
= itemModel
->index(0, 0);
960 const QModelIndex bottomRight
= itemModel
->index(itemModel
->rowCount() - 1,
961 itemModel
->columnCount() - 1);
963 QItemSelection
selection(topLeft
, bottomRight
);
964 selectionModel
->select(selection
, flags
);
967 QAbstractItemView
* DolphinView::itemView() const
969 assert((m_iconsView
== 0) || (m_detailsView
== 0));
970 if (m_detailsView
!= 0) {
971 return m_detailsView
;
976 #include "dolphinview.moc"