X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/b08ed55218cce6609ac4296b0507864833140f05..e9b697bdf6b8de3a40ac2d4689a9b20a6d7cf550:/src/dolphinview.cpp diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp index 404000cf4..57a2551ad 100644 --- a/src/dolphinview.cpp +++ b/src/dolphinview.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -44,26 +45,37 @@ #include #include #include +#include #include #include #include "dolphinmodel.h" #include "dolphincolumnview.h" #include "dolphincontroller.h" +#include "dolphindetailsview.h" #include "dolphinfileitemdelegate.h" +#include "dolphinnewmenuobserver.h" #include "dolphinsortfilterproxymodel.h" -#include "dolphindetailsview.h" #include "dolphin_detailsmodesettings.h" #include "dolphiniconsview.h" -#include "dolphinsettings.h" #include "dolphin_generalsettings.h" #include "draganddrophelper.h" #include "folderexpander.h" #include "renamedialog.h" -#include "tooltipmanager.h" +#include "tooltips/tooltipmanager.h" +#include "settings/dolphinsettings.h" #include "viewproperties.h" #include "zoomlevelinfo.h" +/** + * Helper function for sorting items with qSort() in + * DolphinView::renameSelectedItems(). + */ +bool lessThan(const KFileItem& item1, const KFileItem& item2) +{ + return KStringHandler::naturalCompare(item1.name(), item2.name()) < 0; +} + DolphinView::DolphinView(QWidget* parent, const KUrl& url, KDirLister* dirLister, @@ -76,6 +88,8 @@ DolphinView::DolphinView(QWidget* parent, m_storedCategorizedSorting(false), m_tabsForFiles(false), m_isContextMenuOpen(false), + m_ignoreViewProperties(false), + m_assureVisibleCurrentIndex(false), m_mode(DolphinView::IconsView), m_topLayout(0), m_controller(0), @@ -91,7 +105,9 @@ DolphinView::DolphinView(QWidget* parent, m_toolTipManager(0), m_rootUrl(), m_currentItemUrl(), - m_expandedViews() + m_createdItemUrl(), + m_selectedItems(), + m_expandedDragSource(0) { m_topLayout = new QVBoxLayout(this); m_topLayout->setSpacing(0); @@ -105,8 +121,8 @@ DolphinView::DolphinView(QWidget* parent, connect(m_controller, SIGNAL(requestUrlChange(const KUrl&)), this, SLOT(slotRequestUrlChange(const KUrl&))); - connect(m_controller, SIGNAL(requestContextMenu(const QPoint&)), - this, SLOT(openContextMenu(const QPoint&))); + connect(m_controller, SIGNAL(requestContextMenu(const QPoint&, const QList&)), + this, SLOT(openContextMenu(const QPoint&, const QList&))); connect(m_controller, SIGNAL(urlsDropped(const KFileItem&, const KUrl&, QDropEvent*)), this, SLOT(dropUrls(const KFileItem&, const KUrl&, QDropEvent*))); connect(m_controller, SIGNAL(sortingChanged(DolphinView::Sorting)), @@ -130,6 +146,14 @@ DolphinView::DolphinView(QWidget* parent, this, SIGNAL(redirection(KUrl, KUrl))); connect(m_dirLister, SIGNAL(completed()), this, SLOT(restoreCurrentItem())); + connect(m_dirLister, SIGNAL(refreshItems(const QList>&)), + this, SLOT(slotRefreshItems())); + + // When a new item has been created by the "Create New..." menu, the item should + // get selected and it must be assured that the item will get visible. As the + // creation is done asynchronously, several signals must be checked: + connect(&DolphinNewMenuObserver::instance(), SIGNAL(itemCreated(const KUrl&)), + this, SLOT(observeCreatedItem(const KUrl&))); applyViewProperties(url); m_topLayout->addWidget(itemView()); @@ -137,7 +161,8 @@ DolphinView::DolphinView(QWidget* parent, DolphinView::~DolphinView() { - deleteExpandedViews(); + delete m_expandedDragSource; + m_expandedDragSource = 0; } const KUrl& DolphinView::url() const @@ -222,7 +247,11 @@ void DolphinView::setMode(Mode mode) } emit modeChanged(); + updateZoomLevel(oldZoomLevel); + if (m_showPreview) { + loadDirectory(viewPropsUrl); + } } DolphinView::Mode DolphinView::mode() const @@ -297,7 +326,10 @@ bool DolphinView::hasSelection() const void DolphinView::clearSelection() { - itemView()->selectionModel()->clear(); + QItemSelectionModel* selModel = itemView()->selectionModel(); + const QModelIndex currentIndex = selModel->currentIndex(); + selModel->setCurrentIndex(currentIndex, QItemSelectionModel::Current | + QItemSelectionModel::Clear); } KFileItemList DolphinView::selectedItems() const @@ -374,10 +406,10 @@ void DolphinView::setZoomLevel(int level) } else if (level > ZoomLevelInfo::maximumLevel()) { level = ZoomLevelInfo::maximumLevel(); } - + if (level != zoomLevel()) { m_controller->setZoomLevel(level); - m_previewGenerator->updatePreviews(); + m_previewGenerator->updateIcons(); emit zoomLevelChanged(level); } } @@ -440,6 +472,8 @@ void DolphinView::reload() void DolphinView::refresh() { + m_ignoreViewProperties = false; + const bool oldActivationState = m_active; const int oldZoomLevel = m_controller->zoomLevel(); m_active = true; @@ -487,32 +521,36 @@ void DolphinView::setNameFilter(const QString& nameFilter) } } -void DolphinView::calculateItemCount(int& fileCount, int& folderCount) const +void DolphinView::calculateItemCount(int& fileCount, + int& folderCount, + KIO::filesize_t& totalFileSize) const { foreach (const KFileItem& item, m_dirLister->items()) { if (item.isDir()) { ++folderCount; } else { ++fileCount; + totalFileSize += item.size(); } } } QString DolphinView::statusBarText() const -{ +{ + QString text; + int folderCount = 0; + int fileCount = 0; + KIO::filesize_t totalFileSize = 0; + if (hasSelection()) { // give a summary of the status of the selected files - QString text; const KFileItemList list = selectedItems(); if (list.isEmpty()) { // when an item is triggered, it is temporary selected but selectedItems() // will return an empty list - return QString(); + return text; } - int fileCount = 0; - int folderCount = 0; - KIO::filesize_t byteSize = 0; KFileItemList::const_iterator it = list.begin(); const KFileItemList::const_iterator end = list.end(); while (it != end) { @@ -521,33 +559,39 @@ QString DolphinView::statusBarText() const ++folderCount; } else { ++fileCount; - byteSize += item.size(); + totalFileSize += item.size(); } ++it; } - if (folderCount > 0) { - text = i18ncp("@info:status", "1 Folder selected", "%1 Folders selected", folderCount); - if (fileCount > 0) { - text += ", "; + if (folderCount + fileCount == 1) { + // if only one item is selected, show the filename + const QString name = list.first().name(); + text = (folderCount == 1) ? i18nc("@info:status", "%1 selected", name) : + i18nc("@info:status", "%1 selected (%2)", + name, KIO::convertSize(totalFileSize)); + } else { + // at least 2 items are selected + const QString foldersText = i18ncp("@info:status", "1 Folder selected", "%1 Folders selected", folderCount); + const QString filesText = i18ncp("@info:status", "1 File selected", "%1 Files selected", fileCount); + if ((folderCount > 0) && (fileCount > 0)) { + text = i18nc("@info:status folders, files (size)", "%1, %2 (%3)", + foldersText, filesText, KIO::convertSize(totalFileSize)); + } else if (fileCount > 0) { + text = i18nc("@info:status files (size)", "%1 (%2)", filesText, KIO::convertSize(totalFileSize)); + } else { + Q_ASSERT(folderCount > 0); + text = foldersText; } } - - if (fileCount > 0) { - const QString sizeText(KIO::convertSize(byteSize)); - text += i18ncp("@info:status", "1 File selected (%2)", "%1 Files selected (%2)", fileCount, sizeText); - } - return text; } else { - // Give a summary of the status of the current folder. - int folderCount = 0; - int fileCount = 0; - calculateItemCount(fileCount, folderCount); - return KIO::itemsSummaryString(fileCount + folderCount, - fileCount, - folderCount, - 0, false); + calculateItemCount(fileCount, folderCount, totalFileSize); + text = KIO::itemsSummaryString(fileCount + folderCount, + fileCount, folderCount, + totalFileSize, true); } + + return text; } void DolphinView::setUrl(const KUrl& url) @@ -565,27 +609,27 @@ void DolphinView::changeSelection(const KFileItemList& selection) } const KUrl& baseUrl = url(); KUrl url; - QItemSelection new_selection; + QItemSelection newSelection; foreach(const KFileItem& item, selection) { url = item.url().upUrl(); if (baseUrl.equals(url, KUrl::CompareWithoutTrailingSlash)) { QModelIndex index = m_proxyModel->mapFromSource(m_dolphinModel->indexForItem(item)); - new_selection.select(index, index); + newSelection.select(index, index); } } - itemView()->selectionModel()->select(new_selection, + itemView()->selectionModel()->select(newSelection, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Current); } void DolphinView::renameSelectedItems() { - const KFileItemList items = selectedItems(); + KFileItemList items = selectedItems(); const int itemCount = items.count(); if (itemCount < 1) { return; } - + if (itemCount > 1) { // More than one item has been selected for renaming. Open // a rename dialog and rename all items afterwards. @@ -597,31 +641,36 @@ void DolphinView::renameSelectedItems() const QString newName = dialog.newName(); if (newName.isEmpty()) { emit errorMessage(dialog.errorString()); - } else { - // TODO: check how this can be integrated into KIO::FileUndoManager/KonqOperations - // as one operation instead of n rename operations like it is done now... - Q_ASSERT(newName.contains('#')); - - // iterate through all selected items and rename them... - int index = 1; - foreach (const KFileItem &item, items) { - const KUrl& oldUrl = item.url(); - QString number; - number.setNum(index++); - - QString name = newName; - name.replace('#', number); - - if (oldUrl.fileName() != name) { - KUrl newUrl = oldUrl; - newUrl.setFileName(name); - KonqOperations::rename(this, oldUrl, newUrl); - } + return; + } + + // TODO: check how this can be integrated into KIO::FileUndoManager/KonqOperations + // as one operation instead of n rename operations like it is done now... + Q_ASSERT(newName.contains('#')); + + // currently the items are sorted by the selection order, resort + // them by the file name + qSort(items.begin(), items.end(), lessThan); + + // iterate through all selected items and rename them... + int index = 1; + foreach (const KFileItem& item, items) { + const KUrl& oldUrl = item.url(); + QString number; + number.setNum(index++); + + QString name = newName; + name.replace('#', number); + + if (oldUrl.fileName() != name) { + KUrl newUrl = oldUrl; + newUrl.setFileName(name); + KonqOperations::rename(this, oldUrl, newUrl); } } } else if (DolphinSettings::instance().generalSettings()->renameInline()) { Q_ASSERT(itemCount == 1); - + if (isColumnViewActive()) { m_columnView->editItem(items.first()); } else { @@ -631,7 +680,7 @@ void DolphinView::renameSelectedItems() } } else { Q_ASSERT(itemCount == 1); - + RenameDialog dialog(this, items); if (dialog.exec() == QDialog::Rejected) { return; @@ -640,13 +689,18 @@ void DolphinView::renameSelectedItems() const QString& newName = dialog.newName(); if (newName.isEmpty()) { emit errorMessage(dialog.errorString()); - } else { - const KUrl& oldUrl = items.first().url(); - KUrl newUrl = oldUrl; - newUrl.setFileName(newName); - KonqOperations::rename(this, oldUrl, newUrl); + return; } + + const KUrl& oldUrl = items.first().url(); + KUrl newUrl = oldUrl; + newUrl.setFileName(newName); + KonqOperations::rename(this, oldUrl, newUrl); } + + // assure that the current index remains visible when KDirLister + // will notify the view about changed items + m_assureVisibleCurrentIndex = true; } void DolphinView::trashSelectedItems() @@ -672,19 +726,14 @@ void DolphinView::deleteSelectedItems() void DolphinView::cutSelectedItems() { - QMimeData* mimeData = new QMimeData(); - const KUrl::List kdeUrls = simplifiedSelectedUrls(); - const KUrl::List mostLocalUrls; - KonqMimeData::populateMimeData(mimeData, kdeUrls, mostLocalUrls, true); + QMimeData* mimeData = selectionMimeData(); + KonqMimeData::addIsCutSelection(mimeData, true); QApplication::clipboard()->setMimeData(mimeData); } void DolphinView::copySelectedItems() { - QMimeData* mimeData = new QMimeData(); - const KUrl::List kdeUrls = selectedUrls(); - const KUrl::List mostLocalUrls; - KonqMimeData::populateMimeData(mimeData, kdeUrls, mostLocalUrls, false); + QMimeData* mimeData = selectionMimeData(); QApplication::clipboard()->setMimeData(mimeData); } @@ -713,10 +762,10 @@ void DolphinView::setShowPreview(bool show) m_showPreview = show; m_previewGenerator->setPreviewShown(show); - + const int oldZoomLevel = m_controller->zoomLevel(); emit showPreviewChanged(); - + // Enabling or disabling the preview might change the icon size of the view. // As the view does not emit a signal when the icon size has been changed, // the used zoom level of the controller must be adjusted manually: @@ -818,24 +867,39 @@ bool DolphinView::eventFilter(QObject* watched, QEvent* event) m_controller->requestActivation(); } break; - + case QEvent::MouseButtonPress: - if ((watched == itemView()->viewport()) && (m_expandedViews.count() > 0)) { + if ((watched == itemView()->viewport()) && (m_expandedDragSource != 0)) { // Listening to a mousebutton press event to delete expanded views is a // workaround, as it seems impossible for the FolderExpander to know when // a dragging outside a view has been finished. However it works quite well: // A mousebutton press event indicates that a drag operation must be // finished already. - deleteExpandedViews(); + m_expandedDragSource->deleteLater(); + m_expandedDragSource = 0; } break; - + case QEvent::DragEnter: if (watched == itemView()->viewport()) { setActive(true); } break; - + + case QEvent::KeyPress: + if (watched == itemView()) { + if (m_toolTipManager != 0) { + m_toolTipManager->hideTip(); + } + + // clear the selection when Escape has been pressed + QKeyEvent* keyEvent = static_cast(event); + if (keyEvent->key() == Qt::Key_Escape) { + clearSelection(); + } + } + break; + default: break; } @@ -873,7 +937,8 @@ void DolphinView::emitSelectionChangedSignal() emit selectionChanged(DolphinView::selectedItems()); } -void DolphinView::openContextMenu(const QPoint& pos) +void DolphinView::openContextMenu(const QPoint& pos, + const QList& customActions) { KFileItem item; if (isColumnViewActive()) { @@ -891,7 +956,7 @@ void DolphinView::openContextMenu(const QPoint& pos) } m_isContextMenuOpen = true; // TODO: workaround for Qt-issue 207192 - emit requestContextMenu(item, url()); + emit requestContextMenu(item, url(), customActions); m_isContextMenuOpen = false; } @@ -899,7 +964,7 @@ void DolphinView::dropUrls(const KFileItem& destItem, const KUrl& destPath, QDropEvent* event) { - DragAndDropHelper::dropUrls(destItem, destPath, event, this); + DragAndDropHelper::instance().dropUrls(destItem, destPath, event, this); } void DolphinView::updateSorting(DolphinView::Sorting sorting) @@ -987,40 +1052,68 @@ void DolphinView::updateAdditionalInfoActions(KActionCollection* collection) QPair DolphinView::pasteInfo() const { - QPair ret; - QClipboard* clipboard = QApplication::clipboard(); - const QMimeData* mimeData = clipboard->mimeData(); + return KonqOperations::pasteInfo(url()); +} - KUrl::List urls = KUrl::List::fromMimeData(mimeData); - if (!urls.isEmpty()) { - // disable the paste action if no writing is supported - KFileItem item(KFileItem::Unknown, KFileItem::Unknown, url()); - ret.first = KonqFileItemCapabilities(KFileItemList() << item).supportsWriting(); +void DolphinView::setTabsForFilesEnabled(bool tabsForFiles) +{ + m_tabsForFiles = tabsForFiles; +} - if (urls.count() == 1) { - const KFileItem item(KFileItem::Unknown, KFileItem::Unknown, urls.first(), true); - ret.second = item.isDir() ? i18nc("@action:inmenu", "Paste One Folder") : - i18nc("@action:inmenu", "Paste One File"); +bool DolphinView::isTabsForFilesEnabled() const +{ + return m_tabsForFiles; +} - } else { - ret.second = i18ncp("@action:inmenu", "Paste One Item", "Paste %1 Items", urls.count()); +bool DolphinView::itemsExpandable() const +{ + return (m_detailsView != 0) && m_detailsView->itemsExpandable(); +} + +void DolphinView::deleteWhenNotDragSource(QAbstractItemView *view) +{ + if (view == 0) + return; + + if (DragAndDropHelper::instance().isDragSource(view)) { + // We must store for later deletion. + if (m_expandedDragSource != 0) { + // The old stored view is obviously not the drag source anymore. + m_expandedDragSource->deleteLater(); + m_expandedDragSource = 0; } - } else { - ret.first = false; - ret.second = i18nc("@action:inmenu", "Paste"); + view->hide(); + m_expandedDragSource = view; } + else { + view->deleteLater(); + } +} - return ret; +void DolphinView::observeCreatedItem(const KUrl& url) +{ + m_createdItemUrl = url; + connect(m_dolphinModel, SIGNAL(rowsInserted(const QModelIndex&, int, int)), + this, SLOT(selectAndScrollToCreatedItem())); } -void DolphinView::setTabsForFilesEnabled(bool tabsForFiles) +void DolphinView::selectAndScrollToCreatedItem() { - m_tabsForFiles = tabsForFiles; + const QModelIndex dirIndex = m_dolphinModel->indexForUrl(m_createdItemUrl); + if (dirIndex.isValid()) { + const QModelIndex proxyIndex = m_proxyModel->mapFromSource(dirIndex); + itemView()->setCurrentIndex(proxyIndex); + } + + disconnect(m_dolphinModel, SIGNAL(rowsInserted(const QModelIndex&, int, int)), + this, SLOT(selectAndScrollToCreatedItem())); + m_createdItemUrl = KUrl(); } -bool DolphinView::isTabsForFilesEnabled() const +void DolphinView::restoreSelection() { - return m_tabsForFiles; + disconnect(m_dirLister, SIGNAL(completed()), this, SLOT(restoreSelection())); + changeSelection(m_selectedItems); } void DolphinView::emitContentsMoved() @@ -1075,14 +1168,12 @@ void DolphinView::restoreCurrentItem() } } -void DolphinView::enterDir(const QModelIndex& index, QAbstractItemView* view) +void DolphinView::slotRefreshItems() { - // Deleting a view that is the root of a drag operation is not allowed, otherwise - // the dragging gets automatically cancelled by Qt. So before entering a new - // directory, the current view is remembered in m_expandedViews and deleted - // later when the drag operation has been finished (see DolphinView::eventFilter()). - m_expandedViews.append(view); - m_controller->triggerItem(index); + if (m_assureVisibleCurrentIndex) { + m_assureVisibleCurrentIndex = false; + itemView()->scrollTo(itemView()->currentIndex()); + } } void DolphinView::loadDirectory(const KUrl& url, bool reload) @@ -1099,6 +1190,11 @@ void DolphinView::loadDirectory(const KUrl& url, bool reload) m_loadingDirectory = true; + if (reload) { + m_selectedItems = selectedItems(); + connect(m_dirLister, SIGNAL(completed()), this, SLOT(restoreSelection())); + } + m_dirLister->stop(); m_dirLister->openUrl(url, reload ? KDirLister::Reload : KDirLister::NoFlags); @@ -1124,6 +1220,10 @@ KUrl DolphinView::viewPropertiesUrl() const void DolphinView::applyViewProperties(const KUrl& url) { + if (m_ignoreViewProperties) { + return; + } + if (isColumnViewActive() && rootUrl().isParentOf(url)) { // The column view is active, hence don't apply the view properties // of sub directories (represented by columns) to the view. The @@ -1136,11 +1236,11 @@ void DolphinView::applyViewProperties(const KUrl& url) const Mode mode = props.viewMode(); if (m_mode != mode) { const int oldZoomLevel = m_controller->zoomLevel(); - + m_mode = mode; createView(); emit modeChanged(); - + updateZoomLevel(oldZoomLevel); } if (itemView() == 0) { @@ -1184,15 +1284,22 @@ void DolphinView::applyViewProperties(const KUrl& url) if (showPreview != m_showPreview) { m_showPreview = showPreview; m_previewGenerator->setPreviewShown(showPreview); - + const int oldZoomLevel = m_controller->zoomLevel(); emit showPreviewChanged(); - + // Enabling or disabling the preview might change the icon size of the view. // As the view does not emit a signal when the icon size has been changed, // the used zoom level of the controller must be adjusted manually: updateZoomLevel(oldZoomLevel); } + + if (DolphinSettings::instance().generalSettings()->globalViewProps()) { + // During the lifetime of a DolphinView instance the global view properties + // should not be changed. This allows e. g. to split a view and use different + // view properties for each view. + m_ignoreViewProperties = true; + } } void DolphinView::createView() @@ -1224,6 +1331,7 @@ void DolphinView::createView() Q_ASSERT(view != 0); view->installEventFilter(this); view->viewport()->installEventFilter(this); + setFocusProxy(view); if (m_mode != ColumnView) { // Give the view the ability to auto-expand its directories on hovering @@ -1235,8 +1343,13 @@ void DolphinView::createView() FolderExpander* folderExpander = new FolderExpander(view, m_proxyModel); folderExpander->setEnabled(enabled); - connect(folderExpander, SIGNAL(enterDir(const QModelIndex&, QAbstractItemView*)), - this, SLOT(enterDir(const QModelIndex&, QAbstractItemView*))); + connect(folderExpander, SIGNAL(enterDir(const QModelIndex&)), + m_controller, SLOT(triggerItem(const QModelIndex&))); + } + else { + // Listen out for requests to delete the current column. + connect(m_columnView, SIGNAL(requestColumnDeletion(QAbstractItemView*)), + this, SLOT(deleteWhenNotDragSource(QAbstractItemView*))); } m_controller->setItemView(view); @@ -1286,30 +1399,28 @@ void DolphinView::deleteView() // before deleting the view: Otherwise when having a split // view the other view will get the focus and will request // an activation (see DolphinView::eventFilter()). + setFocusProxy(0); setFocus(); m_topLayout->removeWidget(view); view->close(); - - bool deleteView = true; - foreach (const QAbstractItemView* expandedView, m_expandedViews) { - if (view == expandedView) { - // the current view got already expanded and must stay alive - // until the dragging has been completed - deleteView = false; - break; - } - } - if (deleteView) { - view->deleteLater(); - } + + // m_previewGenerator's parent is not always destroyed, and we + // don't want two active at once - manually delete. + delete m_previewGenerator; + m_previewGenerator = 0; + + disconnect(view); + m_controller->disconnect(view); + view->disconnect(); + + deleteWhenNotDragSource(view); view = 0; - + m_iconsView = 0; m_detailsView = 0; m_columnView = 0; m_fileItemDelegate = 0; - m_previewGenerator = 0; m_toolTipManager = 0; } } @@ -1345,16 +1456,7 @@ bool DolphinView::isCutItem(const KFileItem& item) const void DolphinView::pasteToUrl(const KUrl& url) { - QClipboard* clipboard = QApplication::clipboard(); - const QMimeData* mimeData = clipboard->mimeData(); - - const KUrl::List sourceUrls = KUrl::List::fromMimeData(mimeData); - if (KonqMimeData::decodeIsCutSelection(mimeData)) { - KonqOperations::copy(this, KonqOperations::MOVE, sourceUrls, url); - clipboard->clear(); - } else { - KonqOperations::copy(this, KonqOperations::COPY, sourceUrls, url); - } + KonqOperations::doPaste(this, url); } void DolphinView::updateZoomLevel(int oldZoomLevel) @@ -1370,25 +1472,22 @@ KUrl::List DolphinView::simplifiedSelectedUrls() const { KUrl::List list = selectedUrls(); if (itemsExpandable() ) { - list = KonqOperations::simplifiedUrlList(list); + list = KDirModel::simplifiedUrlList(list); } return list; } -void DolphinView::deleteExpandedViews() +QMimeData* DolphinView::selectionMimeData() const { - const QAbstractItemView* view = itemView(); - foreach (QAbstractItemView* expandedView, m_expandedViews) { - if (expandedView != view) { - expandedView->deleteLater(); - } + if (isColumnViewActive()) { + return m_columnView->selectionMimeData(); } - m_expandedViews.clear(); -} -bool DolphinView::itemsExpandable() const -{ - return (m_detailsView != 0) && m_detailsView->itemsExpandable(); + const QAbstractItemView* view = itemView(); + Q_ASSERT((view != 0) && (view->selectionModel() != 0)); + const QItemSelection selection = m_proxyModel->mapSelectionToSource(view->selectionModel()->selection()); + return m_dolphinModel->mimeData(selection.indexes()); } + #include "dolphinview.moc"