X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/cb928888f7e8b0450fc8c4cf0dd4f5ea3c46eb42..e9b697bdf6b8de3a40ac2d4689a9b20a6d7cf550:/src/dolphinview.cpp diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp index 9d6038c2c..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 "dolphindropcontroller.h" #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), @@ -90,7 +104,10 @@ DolphinView::DolphinView(QWidget* parent, m_previewGenerator(0), m_toolTipManager(0), m_rootUrl(), - m_currentItemUrl() + m_currentItemUrl(), + m_createdItemUrl(), + m_selectedItems(), + m_expandedDragSource(0) { m_topLayout = new QVBoxLayout(this); m_topLayout->setSpacing(0); @@ -104,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)), @@ -126,9 +143,17 @@ DolphinView::DolphinView(QWidget* parent, this, SLOT(clearHoverInformation())); connect(m_dirLister, SIGNAL(redirection(KUrl, KUrl)), - this, SLOT(slotRedirection(KUrl, KUrl))); + 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()); @@ -136,6 +161,8 @@ DolphinView::DolphinView(QWidget* parent, DolphinView::~DolphinView() { + delete m_expandedDragSource; + m_expandedDragSource = 0; } const KUrl& DolphinView::url() const @@ -220,7 +247,11 @@ void DolphinView::setMode(Mode mode) } emit modeChanged(); + updateZoomLevel(oldZoomLevel); + if (m_showPreview) { + loadDirectory(viewPropsUrl); + } } DolphinView::Mode DolphinView::mode() const @@ -295,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 @@ -372,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); } } @@ -438,7 +472,10 @@ void DolphinView::reload() void DolphinView::refresh() { + m_ignoreViewProperties = false; + const bool oldActivationState = m_active; + const int oldZoomLevel = m_controller->zoomLevel(); m_active = true; createView(); @@ -446,6 +483,7 @@ void DolphinView::refresh() reload(); setActive(oldActivationState); + updateZoomLevel(oldZoomLevel); } void DolphinView::updateView(const KUrl& url, const KUrl& rootUrl) @@ -483,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) { @@ -517,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) @@ -561,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. @@ -593,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 { @@ -627,7 +680,7 @@ void DolphinView::renameSelectedItems() } } else { Q_ASSERT(itemCount == 1); - + RenameDialog dialog(this, items); if (dialog.exec() == QDialog::Rejected) { return; @@ -636,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() @@ -668,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); } @@ -709,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: @@ -808,8 +861,47 @@ void DolphinView::wheelEvent(QWheelEvent* event) bool DolphinView::eventFilter(QObject* watched, QEvent* event) { - if ((watched == itemView()) && (event->type() == QEvent::FocusIn)) { - m_controller->requestActivation(); + switch (event->type()) { + case QEvent::FocusIn: + if (watched == itemView()) { + m_controller->requestActivation(); + } + break; + + case QEvent::MouseButtonPress: + 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. + 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; } return QWidget::eventFilter(watched, event); @@ -845,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()) { @@ -863,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; } @@ -871,7 +964,7 @@ void DolphinView::dropUrls(const KFileItem& destItem, const KUrl& destPath, QDropEvent* event) { - DolphinDropController::dropUrls(destItem, destPath, event, this); + DragAndDropHelper::instance().dropUrls(destItem, destPath, event, this); } void DolphinView::updateSorting(DolphinView::Sorting sorting) @@ -959,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()); +} + +void DolphinView::setTabsForFilesEnabled(bool tabsForFiles) +{ + m_tabsForFiles = tabsForFiles; +} + +bool DolphinView::isTabsForFilesEnabled() const +{ + return m_tabsForFiles; +} - 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(); +bool DolphinView::itemsExpandable() const +{ + return (m_detailsView != 0) && m_detailsView->itemsExpandable(); +} - 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"); +void DolphinView::deleteWhenNotDragSource(QAbstractItemView *view) +{ + if (view == 0) + return; - } else { - ret.second = i18ncp("@action:inmenu", "Paste One Item", "Paste %1 Items", urls.count()); + 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() @@ -1027,13 +1148,6 @@ void DolphinView::slotDeleteFileFinished(KJob* job) } } -void DolphinView::slotRedirection(const KUrl& oldUrl, const KUrl& newUrl) -{ - if (oldUrl == m_controller->url()) { - m_controller->setUrl(newUrl); - } -} - void DolphinView::slotRequestUrlChange(const KUrl& url) { emit requestUrlChange(url); @@ -1054,6 +1168,14 @@ void DolphinView::restoreCurrentItem() } } +void DolphinView::slotRefreshItems() +{ + if (m_assureVisibleCurrentIndex) { + m_assureVisibleCurrentIndex = false; + itemView()->scrollTo(itemView()->currentIndex()); + } +} + void DolphinView::loadDirectory(const KUrl& url, bool reload) { if (!url.isValid()) { @@ -1068,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); @@ -1093,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 @@ -1105,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) { @@ -1153,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() @@ -1192,6 +1330,8 @@ 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 @@ -1206,6 +1346,11 @@ void DolphinView::createView() 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); @@ -1254,17 +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(); - 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; } } @@ -1300,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) @@ -1325,14 +1472,22 @@ KUrl::List DolphinView::simplifiedSelectedUrls() const { KUrl::List list = selectedUrls(); if (itemsExpandable() ) { - list = KonqOperations::simplifiedUrlList(list); + list = KDirModel::simplifiedUrlList(list); } return list; } -bool DolphinView::itemsExpandable() const +QMimeData* DolphinView::selectionMimeData() const { - return (m_detailsView != 0) && m_detailsView->itemsExpandable(); + if (isColumnViewActive()) { + return m_columnView->selectionMimeData(); + } + + 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"