X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/642110309ace0ec0da270615464d7d04944d5dcf..ee4e21530b21efe7a3b6fa108ec186f553ed4b65:/src/dolphinview.cpp diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp index 35737e41b..9b2286c87 100644 --- a/src/dolphinview.cpp +++ b/src/dolphinview.cpp @@ -20,42 +20,40 @@ #include "dolphinview.h" -#include -#include +#include + #include +#include #include #include #include #include -#include #include #include -#include +#include #include -#include +#include +#include -#include "urlnavigator.h" #include "dolphinstatusbar.h" #include "dolphinmainwindow.h" #include "dolphindirlister.h" #include "dolphinsortfilterproxymodel.h" -#include "viewproperties.h" #include "dolphindetailsview.h" #include "dolphiniconsview.h" #include "dolphincontextmenu.h" -#include "undomanager.h" -#include "renamedialog.h" -#include "progressindicator.h" #include "filterbar.h" +#include "renamedialog.h" +#include "urlnavigator.h" +#include "viewproperties.h" -DolphinView::DolphinView(DolphinMainWindow *mainWindow, - QWidget *parent, +DolphinView::DolphinView(DolphinMainWindow* mainWindow, + QWidget* parent, const KUrl& url, Mode mode, bool showHiddenFiles) : QWidget(parent), - m_refreshing(false), m_showProgress(false), m_mode(mode), m_iconSize(0), @@ -65,6 +63,7 @@ DolphinView::DolphinView(DolphinMainWindow *mainWindow, m_topLayout(0), m_urlNavigator(0), m_iconsView(0), + m_detailsView(0), m_filterBar(0), m_statusBar(0), m_dirModel(0), @@ -87,57 +86,45 @@ DolphinView::DolphinView(DolphinMainWindow *mainWindow, m_dirLister->setAutoUpdate(true); m_dirLister->setMainWindow(this); m_dirLister->setShowingDotFiles(showHiddenFiles); + m_dirLister->setDelayedMimeTypes(true); + connect(m_dirLister, SIGNAL(clear()), - this, SLOT(slotClear())); + this, SLOT(updateStatusBar())); connect(m_dirLister, SIGNAL(percent(int)), - this, SLOT(slotPercent(int))); + this, SLOT(updateProgress(int))); connect(m_dirLister, SIGNAL(deleteItem(KFileItem*)), - this, SLOT(slotDeleteItem(KFileItem*))); + this, SLOT(updateStatusBar())); connect(m_dirLister, SIGNAL(completed()), - this, SLOT(slotCompleted())); + this, SLOT(updateItemCount())); connect(m_dirLister, SIGNAL(infoMessage(const QString&)), - this, SLOT(slotInfoMessage(const QString&))); + this, SLOT(showInfoMessage(const QString&))); connect(m_dirLister, SIGNAL(errorMessage(const QString&)), - this, SLOT(slotErrorMessage(const QString&))); - - m_iconsView = new DolphinIconsView(this); - applyModeToView(); + this, SLOT(showErrorMessage(const QString&))); m_dirModel = new KDirModel(); m_dirModel->setDirLister(m_dirLister); + m_dirModel->setDropsAllowed(KDirModel::DropOnDirectory); m_proxyModel = new DolphinSortFilterProxyModel(this); m_proxyModel->setSourceModel(m_dirModel); - m_iconsView->setModel(m_dirModel); // TODO: using m_proxyModel crashes when clicking on an item - - KFileItemDelegate* delegate = new KFileItemDelegate(this); - delegate->setAdditionalInformation(KFileItemDelegate::FriendlyMimeType); - m_iconsView->setItemDelegate(delegate); - - m_dirLister->setDelayedMimeTypes(true); - new KMimeTypeResolver(m_iconsView, m_dirModel); + createView(); m_iconSize = K3Icon::SizeMedium; m_filterBar = new FilterBar(this); m_filterBar->hide(); connect(m_filterBar, SIGNAL(filterChanged(const QString&)), - this, SLOT(slotChangeNameFilter(const QString&))); - connect(m_filterBar, SIGNAL(closed()), + this, SLOT(changeNameFilter(const QString&))); + connect(m_filterBar, SIGNAL(closeRequest()), this, SLOT(closeFilterBar())); m_topLayout->addWidget(m_urlNavigator); - m_topLayout->addWidget(m_iconsView); + m_topLayout->addWidget(itemView()); m_topLayout->addWidget(m_filterBar); m_topLayout->addWidget(m_statusBar); - connect(m_iconsView, SIGNAL(clicked(const QModelIndex&)), - this, SLOT(triggerItem(const QModelIndex&))); - connect(m_iconsView->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)), - this, SLOT(emitSelectionChangedSignal())); - - startDirLister(m_urlNavigator->url()); + loadDirectory(m_urlNavigator->url()); } DolphinView::~DolphinView() @@ -169,7 +156,7 @@ bool DolphinView::isActive() const void DolphinView::setMode(Mode mode) { if (mode == m_mode) { - return; // the wished mode is already set + return; // the wished mode is already set } m_mode = mode; @@ -177,7 +164,7 @@ void DolphinView::setMode(Mode mode) ViewProperties props(m_urlNavigator->url()); props.setViewMode(m_mode); - applyModeToView(); + createView(); startDirLister(m_urlNavigator->url()); emit modeChanged(); @@ -188,6 +175,22 @@ DolphinView::Mode DolphinView::mode() const return m_mode; } +void DolphinView::setShowPreview(bool show) +{ + ViewProperties props(m_urlNavigator->url()); + props.setShowPreview(show); + + // TODO: wait until previews are possible with KFileItemDelegate + + emit showPreviewChanged(); +} + +bool DolphinView::showPreview() const +{ + // TODO: wait until previews are possible with KFileItemDelegate + return true; +} + void DolphinView::setShowHiddenFiles(bool show) { if (m_dirLister->showingDotFiles() == show) { @@ -210,14 +213,6 @@ bool DolphinView::showHiddenFiles() const return m_dirLister->showingDotFiles(); } -void DolphinView::setViewProperties(const ViewProperties& props) -{ - setMode(props.viewMode()); - setSorting(props.sorting()); - setSortOrder(props.sortOrder()); - setShowHiddenFiles(props.showHiddenFiles()); -} - void DolphinView::renameSelectedItems() { const KUrl::List urls = selectedUrls(); @@ -236,25 +231,25 @@ void DolphinView::renameSelectedItems() DolphinStatusBar::Error); } else { - UndoManager& undoMan = UndoManager::instance(); - undoMan.beginMacro(); + // TODO: check how this can be integrated into KonqUndoManager/KonqOperations + + //UndoManager& undoMan = UndoManager::instance(); + //undoMan.beginMacro(); assert(newName.contains('#')); const int urlsCount = urls.count(); - ProgressIndicator* progressIndicator = - new ProgressIndicator(mainWindow(), - i18n("Renaming items..."), - i18n("Renaming finished."), - urlsCount); // iterate through all selected items and rename them... const int replaceIndex = newName.indexOf('#'); assert(replaceIndex >= 0); for (int i = 0; i < urlsCount; ++i) { const KUrl& source = urls[i]; + QString number; + number.setNum(i + 1); + QString name(newName); - name.replace(replaceIndex, 1, renameIndexPresentation(i + 1, urlsCount)); + name.replace(replaceIndex, 1, number); if (source.fileName() != name) { KUrl dest(source.upUrl()); @@ -262,8 +257,6 @@ void DolphinView::renameSelectedItems() const bool destExists = KIO::NetAccess::exists(dest, false, view); if (destExists) { - delete progressIndicator; - progressIndicator = 0; view->statusBar()->setMessage(i18n("Renaming failed (item '%1' already exists).",name), DolphinStatusBar::Error); break; @@ -271,17 +264,13 @@ void DolphinView::renameSelectedItems() else if (KIO::NetAccess::file_move(source, dest)) { // TODO: From the users point of view he executed one 'rename n files' operation, // but internally we store it as n 'rename 1 file' operations for the undo mechanism. - DolphinCommand command(DolphinCommand::Rename, source, dest); - undoMan.addCommand(command); + //DolphinCommand command(DolphinCommand::Rename, source, dest); + //undoMan.addCommand(command); } } - - progressIndicator->execOperation(); } - delete progressIndicator; - progressIndicator = 0; - undoMan.endMacro(); + //undoMan.endMacro(); } } else { @@ -343,29 +332,6 @@ void DolphinView::refreshSettings() startDirLister(m_urlNavigator->url()); } -void DolphinView::updateStatusBar() -{ - // As the item count information is less important - // in comparison with other messages, it should only - // be shown if: - // - the status bar is empty or - // - shows already the item count information or - // - shows only a not very important information - // - if any progress is given don't show the item count info at all - const QString msg(m_statusBar->message()); - const bool updateStatusBarMsg = (msg.isEmpty() || - (msg == m_statusBar->defaultText()) || - (m_statusBar->type() == DolphinStatusBar::Information)) && - (m_statusBar->progress() == 100); - - const QString text(hasSelection() ? selectionStatusBarText() : defaultStatusBarText()); - m_statusBar->setDefaultText(text); - - if (updateStatusBarMsg) { - m_statusBar->setMessage(text, DolphinStatusBar::Default); - } -} - void DolphinView::emitRequestItemInfo(const KUrl& url) { emit requestItemInfo(url); @@ -460,33 +426,38 @@ void DolphinView::setUrlEditable(bool editable) m_urlNavigator->editUrl(editable); } -const Q3ValueList DolphinView::urlHistory(int& index) const +const QLinkedList DolphinView::urlHistory(int& index) const { return m_urlNavigator->history(index); } bool DolphinView::hasSelection() const { - return m_iconsView->selectionModel()->hasSelection(); + return itemView()->selectionModel()->hasSelection(); } KFileItemList DolphinView::selectedItems() const { - QItemSelectionModel* selModel = m_iconsView->selectionModel(); - assert(selModel != 0); + const QAbstractItemView* view = itemView(); + + // Our view has a selection, we will map them back to the DirModel + // and then fill the KFileItemList. + assert((view != 0) && (view->selectionModel() != 0)); + const QItemSelection selection = m_proxyModel->mapSelectionToSource(view->selectionModel()->selection()); KFileItemList itemList; - if (selModel->hasSelection()) { - const QModelIndexList indexList = selModel->selectedIndexes(); - - QModelIndexList::const_iterator end = indexList.end(); - for (QModelIndexList::const_iterator it = indexList.begin(); it != end; ++it) { - KFileItem* item = m_dirModel->itemForIndex(*it); - if (item != 0) { - itemList.append(item); - } + + const QModelIndexList indexList = selection.indexes(); + QModelIndexList::const_iterator end = indexList.end(); + for (QModelIndexList::const_iterator it = indexList.begin(); it != end; ++it) { + assert((*it).isValid()); + + KFileItem* item = m_dirModel->itemForIndex(*it); + if (item != 0) { + itemList.append(item); } } + return itemList; } @@ -506,9 +477,10 @@ KUrl::List DolphinView::selectedUrls() const return urls; } -const KFileItem* DolphinView::currentFileItem() const +KFileItem* DolphinView::fileItem(const QModelIndex index) const { - return 0; // fileView()->currentFileItem(); + const QModelIndex dirModelIndex = m_proxyModel->mapToSource(index); + return m_dirModel->itemForIndex(dirModelIndex); } void DolphinView::openContextMenu(KFileItem* fileInfo, const QPoint& pos) @@ -534,11 +506,11 @@ void DolphinView::rename(const KUrl& source, const QString& newName) if (destExists) { // the destination already exists, hence ask the user // how to proceed... - KIO::RenameDlg renameDialog(this, - i18n("File Already Exists"), - source.path(), - dest.path(), - KIO::M_OVERWRITE); + KIO::RenameDialog renameDialog(this, + i18n("File Already Exists"), + source.path(), + dest.path(), + KIO::M_OVERWRITE); switch (renameDialog.exec()) { case KIO::R_OVERWRITE: // the destination should be overwritten @@ -564,15 +536,15 @@ void DolphinView::rename(const KUrl& source, const QString& newName) ok = KIO::NetAccess::file_move(source, dest); } + const QString destFileName = dest.fileName(); if (ok) { - m_statusBar->setMessage(i18n("Renamed file '%1' to '%2'.",source.fileName(), dest.fileName()), + m_statusBar->setMessage(i18n("Renamed file '%1' to '%2'.",source.fileName(), destFileName), DolphinStatusBar::OperationCompleted); - DolphinCommand command(DolphinCommand::Rename, source, dest); - UndoManager::instance().addCommand(command); + KonqOperations::rename(this, source, destFileName); } else { - m_statusBar->setMessage(i18n("Renaming of file '%1' to '%2' failed.",source.fileName(), dest.fileName()), + m_statusBar->setMessage(i18n("Renaming of file '%1' to '%2' failed.",source.fileName(), destFileName), DolphinStatusBar::Error); reload(); } @@ -583,25 +555,9 @@ void DolphinView::reload() startDirLister(m_urlNavigator->url(), true); } -void DolphinView::slotUrlListDropped(QDropEvent* /* event */, - const KUrl::List& urls, - const KUrl& url) +void DolphinView::declareViewActive() { - KUrl destination(url); - if (destination.isEmpty()) { - destination = m_urlNavigator->url(); - } - else { - // Check whether the destination Url is a directory. If this is not the - // case, use the navigator Url as destination (otherwise the destination, - // which represents a file, would be replaced by a copy- or move-operation). - KFileItem fileItem(KFileItem::Unknown, KFileItem::Unknown, destination); - if (!fileItem.isDir()) { - destination = m_urlNavigator->url(); - } - } - - mainWindow()->dropUrls(urls, destination); + mainWindow()->setActiveView( this ); } void DolphinView::mouseReleaseEvent(QMouseEvent* event) @@ -618,37 +574,43 @@ DolphinMainWindow* DolphinView::mainWindow() const void DolphinView::loadDirectory(const KUrl& url) { const ViewProperties props(url); - setMode(props.viewMode()); + + const Mode mode = props.viewMode(); + if (m_mode != mode) { + m_mode = mode; + createView(); + emit modeChanged(); + } const bool showHiddenFiles = props.showHiddenFiles(); - setShowHiddenFiles(showHiddenFiles); - m_dirLister->setShowingDotFiles(showHiddenFiles); + if (showHiddenFiles != m_dirLister->showingDotFiles()) { + m_dirLister->setShowingDotFiles(showHiddenFiles); + emit showHiddenFilesChanged(); + } + + const DolphinView::Sorting sorting = props.sorting(); + if (sorting != m_proxyModel->sorting()) { + m_proxyModel->setSorting(sorting); + emit sortingChanged(sorting); + } - setSorting(props.sorting()); - setSortOrder(props.sortOrder()); + const Qt::SortOrder sortOrder = props.sortOrder(); + if (sortOrder != m_proxyModel->sortOrder()) { + m_proxyModel->setSortOrder(sortOrder); + emit sortOrderChanged(sortOrder); + } + + // TODO: handle previews (props.showPreview()) startDirLister(url); emit urlChanged(url); -} -void DolphinView::triggerIconsViewItem(Q3IconViewItem* item) -{ - /* KDE4-TODO: - const Qt::ButtonState keyboardState = KApplication::keyboardMouseState(); - const bool isSelectionActive = ((keyboardState & Qt::ShiftModifier) > 0) || - ((keyboardState & Qt::ControlModifier) > 0);*/ - const bool isSelectionActive = false; - if ((item != 0) && !isSelectionActive) { - // Updating the Url must be done outside the scope of this slot, - // as iconview items will get deleted. - QTimer::singleShot(0, this, SLOT(updateUrl())); - mainWindow()->setActiveView(this); - } + m_statusBar->clear(); } void DolphinView::triggerItem(const QModelIndex& index) { - KFileItem* item = m_dirModel->itemForIndex(index); + KFileItem* item = m_dirModel->itemForIndex(m_proxyModel->mapToSource(index)); if (item == 0) { return; } @@ -659,10 +621,6 @@ void DolphinView::triggerItem(const QModelIndex& index) // and the local path is /windows/C: For the Url the space info is related // to the root partition (and hence wrong) and for the local path the space // info is related to the windows partition (-> correct). - //m_dirLister->stop(); - //m_dirLister->openUrl(item->url()); - //return; - const QString localPath(item->localPath()); if (localPath.isEmpty()) { setUrl(item->url()); @@ -676,70 +634,15 @@ void DolphinView::triggerItem(const QModelIndex& index) } } -void DolphinView::updateUrl() -{ - //KFileView* fileView = (m_iconsView != 0) ? static_cast(m_iconsView) : - // static_cast(m_iconsView); - - KFileItem* fileItem = 0; // TODO: fileView->currentFileItem(); - if (fileItem == 0) { - return; - } - - if (fileItem->isDir()) { - // Prefer the local path over the Url. This assures that the - // volume space information is correct. Assuming that the Url is media:/sda1, - // and the local path is /windows/C: For the Url the space info is related - // to the root partition (and hence wrong) and for the local path the space - // info is related to the windows partition (-> correct). - const QString localPath(fileItem->localPath()); - if (localPath.isEmpty()) { - setUrl(fileItem->url()); - } - else { - setUrl(KUrl(localPath)); - } - } - else { - fileItem->run(); - } -} - -void DolphinView::slotPercent(int percent) +void DolphinView::updateProgress(int percent) { if (m_showProgress) { m_statusBar->setProgress(percent); } } -void DolphinView::slotClear() -{ - //fileView()->clearView(); - updateStatusBar(); -} - -void DolphinView::slotDeleteItem(KFileItem* item) -{ - //fileView()->removeItem(item); - updateStatusBar(); -} - -void DolphinView::slotCompleted() +void DolphinView::updateItemCount() { - m_refreshing = true; - - //KFileView* view = fileView(); - //view->clearView(); - - // TODO: in Qt4 the code should get a lot - // simpler and nicer due to Interview... - /*if (m_iconsView != 0) { - m_iconsView->beginItemUpdates(); - } - if (m_iconsView != 0) { - m_iconsView->beginItemUpdates(); - }*/ - if (m_showProgress) { m_statusBar->setProgressText(QString::null); m_statusBar->setProgress(100); @@ -755,7 +658,6 @@ void DolphinView::slotCompleted() while (it != end) { KFileItem* item = *it; - //view->insertItem(item); if (item->isDir()) { ++m_folderCount; } @@ -766,35 +668,18 @@ void DolphinView::slotCompleted() } updateStatusBar(); - - /*if (m_iconsView != 0) { - // Prevent a flickering of the icon view widget by giving a small - // timeslot to swallow asynchronous update events. - m_iconsView->setUpdatesEnabled(false); - QTimer::singleShot(10, this, SLOT(slotDelayedUpdate())); - } - - if (m_iconsView != 0) { - m_iconsView->endItemUpdates(); - m_refreshing = false; - }*/ } -void DolphinView::slotInfoMessage(const QString& msg) +void DolphinView::showInfoMessage(const QString& msg) { m_statusBar->setMessage(msg, DolphinStatusBar::Information); } -void DolphinView::slotErrorMessage(const QString& msg) +void DolphinView::showErrorMessage(const QString& msg) { m_statusBar->setMessage(msg, DolphinStatusBar::Error); } -void DolphinView::slotGrabActivation() -{ - mainWindow()->setActiveView(this); -} - void DolphinView::emitSelectionChangedSignal() { emit selectionChanged(); @@ -806,16 +691,6 @@ void DolphinView::closeFilterBar() emit showFilterBarChanged(false); } -void DolphinView::slotContentsMoving(int x, int y) -{ - if (!m_refreshing) { - // Only emit a 'contents moved' signal if the user - // moved the content by adjusting the sliders. Adjustments - // resulted by refreshing a directory should not be respected. - emit contentsMoved(x, y); - } -} - void DolphinView::startDirLister(const KUrl& url, bool reload) { if (!url.isValid()) { @@ -841,7 +716,6 @@ void DolphinView::startDirLister(const KUrl& url, bool reload) m_statusBar->setProgress(0); } - m_refreshing = true; m_dirLister->stop(); m_dirLister->openUrl(url, false, reload); } @@ -934,26 +808,7 @@ QString DolphinView::selectionStatusBarText() const return text; } -QString DolphinView::renameIndexPresentation(int index, int itemCount) const -{ - // assure that the string reprentation for all indicess have the same - // number of characters based on the given number of items - QString str(QString::number(index)); - int chrCount = 1; - while (itemCount >= 10) { - ++chrCount; - itemCount /= 10; - } - str.reserve(chrCount); - - const int insertCount = chrCount - str.length(); - for (int i = 0; i < insertCount; ++i) { - str.insert(0, '0'); - } - return str; -} - -void DolphinView::slotShowFilterBar(bool show) +void DolphinView::showFilterBar(bool show) { assert(m_filterBar != 0); if (show) { @@ -964,12 +819,30 @@ void DolphinView::slotShowFilterBar(bool show) } } -void DolphinView::declareViewActive() +void DolphinView::updateStatusBar() { - mainWindow()->setActiveView( this ); + // As the item count information is less important + // in comparison with other messages, it should only + // be shown if: + // - the status bar is empty or + // - shows already the item count information or + // - shows only a not very important information + // - if any progress is given don't show the item count info at all + const QString msg(m_statusBar->message()); + const bool updateStatusBarMsg = (msg.isEmpty() || + (msg == m_statusBar->defaultText()) || + (m_statusBar->type() == DolphinStatusBar::Information)) && + (m_statusBar->progress() == 100); + + const QString text(hasSelection() ? selectionStatusBarText() : defaultStatusBarText()); + m_statusBar->setDefaultText(text); + + if (updateStatusBarMsg) { + m_statusBar->setMessage(text, DolphinStatusBar::Default); + } } -void DolphinView::slotChangeNameFilter(const QString& nameFilter) +void DolphinView::changeNameFilter(const QString& nameFilter) { // The name filter of KDirLister does a 'hard' filtering, which // means that only the items are shown where the names match @@ -980,30 +853,68 @@ void DolphinView::slotChangeNameFilter(const QString& nameFilter) adjustedFilter.insert(0, '*'); adjustedFilter.append('*'); + // Use the ProxyModel to filter: + // This code is #ifdefed as setNameFilter behaves + // slightly different than the QSortFilterProxyModel + // as it will not remove directories. I will ask + // our beloved usability experts for input + // -- z. +#if 0 m_dirLister->setNameFilter(adjustedFilter); m_dirLister->emitChanges(); +#else + m_proxyModel->setFilterRegExp( nameFilter ); +#endif } -void DolphinView::applyModeToView() +void DolphinView::createView() { - m_iconsView->setSelectionMode(QAbstractItemView::ExtendedSelection); + // delete current view + QAbstractItemView* view = itemView(); + if (view != 0) { + m_topLayout->removeWidget(view); + view->close(); + view->deleteLater(); + m_iconsView = 0; + m_detailsView = 0; + } - // TODO: the following code just tries to test some QListView capabilities + assert(m_iconsView == 0); + assert(m_detailsView == 0); + + // ... and recreate it representing the current mode switch (m_mode) { case IconsView: + m_iconsView = new DolphinIconsView(this); m_iconsView->setViewMode(QListView::IconMode); m_iconsView->setSpacing(32); - // m_iconsView->setAlternatingRowColors(false); - // m_iconsView->setGridSize(QSize(128, 64)); + view = m_iconsView; + // TODO: read out view settings break; case DetailsView: - m_iconsView->setViewMode(QListView::ListMode); - m_iconsView->setSpacing(0); - // m_iconsView->setAlternatingRowColors(true); - // m_iconsView->setGridSize(QSize(256, 24)); + m_detailsView = new DolphinDetailsView(this); + view = m_detailsView; + // TODO: read out view settings break; } + + view->setModel(m_proxyModel); + + view->setSelectionMode(QAbstractItemView::ExtendedSelection); + + KFileItemDelegate* delegate = new KFileItemDelegate(this); + delegate->setAdditionalInformation(KFileItemDelegate::FriendlyMimeType); + view->setItemDelegate(delegate); + + new KMimeTypeResolver(view, m_dirModel); + + connect(view, SIGNAL(clicked(const QModelIndex&)), + this, SLOT(triggerItem(const QModelIndex&))); + connect(view->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)), + this, SLOT(emitSelectionChangedSignal())); + + m_topLayout->insertWidget(1, view); } int DolphinView::columnIndex(Sorting sorting) const @@ -1020,7 +931,7 @@ int DolphinView::columnIndex(Sorting sorting) const void DolphinView::selectAll(QItemSelectionModel::SelectionFlags flags) { - QItemSelectionModel* selectionModel = m_iconsView->selectionModel(); + QItemSelectionModel* selectionModel = itemView()->selectionModel(); const QAbstractItemModel* itemModel = selectionModel->model(); const QModelIndex topLeft = itemModel->index(0, 0); @@ -1031,4 +942,13 @@ void DolphinView::selectAll(QItemSelectionModel::SelectionFlags flags) selectionModel->select(selection, flags); } +QAbstractItemView* DolphinView::itemView() const +{ + assert((m_iconsView == 0) || (m_detailsView == 0)); + if (m_detailsView != 0) { + return m_detailsView; + } + return m_iconsView; +} + #include "dolphinview.moc"