X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/ca7aaecbdbddb27f7442e69d2770b97b4307f338..aa0b09dac43ec2a58bd32a1e08d59acd35bd86aa:/src/dolphinview.cpp diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp index 45fdfebaf..b3be62252 100644 --- a/src/dolphinview.cpp +++ b/src/dolphinview.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -58,7 +59,6 @@ #include "dolphinsettings.h" #include "dolphin_generalsettings.h" #include "folderexpander.h" -#include "iconmanager.h" #include "renamedialog.h" #include "tooltipmanager.h" #include "viewproperties.h" @@ -87,7 +87,7 @@ DolphinView::DolphinView(QWidget* parent, m_dolphinModel(dolphinModel), m_dirLister(dirLister), m_proxyModel(proxyModel), - m_iconManager(0), + m_previewGenerator(0), m_toolTipManager(0), m_rootUrl(), m_currentItemUrl() @@ -106,8 +106,8 @@ DolphinView::DolphinView(QWidget* parent, connect(m_controller, SIGNAL(requestContextMenu(const QPoint&)), this, SLOT(openContextMenu(const QPoint&))); - connect(m_controller, SIGNAL(urlsDropped(const KUrl::List&, const KUrl&, const KFileItem&)), - this, SLOT(dropUrls(const KUrl::List&, const KUrl&, const KFileItem&))); + 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)), this, SLOT(updateSorting(DolphinView::Sorting))); connect(m_controller, SIGNAL(sortOrderChanged(Qt::SortOrder)), @@ -373,7 +373,7 @@ void DolphinView::setZoomLevel(int level) if (level != zoomLevel()) { m_controller->setZoomLevel(level); - m_iconManager->updatePreviews(); + m_previewGenerator->updatePreviews(); emit zoomLevelChanged(level); } } @@ -452,7 +452,7 @@ void DolphinView::updateView(const KUrl& url, const KUrl& rootUrl) return; } - m_iconManager->cancelPreviews(); + m_previewGenerator->cancelPreviews(); m_controller->setUrl(url); // emits urlChanged, which we forward if (!rootUrl.isEmpty() && rootUrl.isParentOf(url)) { @@ -558,7 +558,6 @@ void DolphinView::renameSelectedItems() KUrl newUrl = oldUrl; newUrl.setFileName(name); KonqOperations::rename(this, oldUrl, newUrl); - emit doingOperation(KIO::FileUndoManager::Rename); } } } @@ -588,14 +587,12 @@ void DolphinView::renameSelectedItems() KUrl newUrl = oldUrl; newUrl.setFileName(newName); KonqOperations::rename(this, oldUrl, newUrl); - emit doingOperation(KIO::FileUndoManager::Rename); } } } void DolphinView::trashSelectedItems() { - emit doingOperation(KIO::FileUndoManager::Trash); const KUrl::List list = simplifiedSelectedUrls(); KonqOperations::del(this, KonqOperations::TRASH, list); } @@ -657,7 +654,7 @@ void DolphinView::setShowPreview(bool show) props.setShowPreview(show); m_showPreview = show; - m_iconManager->setShowPreview(show); + m_previewGenerator->setPreviewShown(show); const int oldZoomLevel = m_controller->zoomLevel(); emit showPreviewChanged(); @@ -816,21 +813,11 @@ void DolphinView::openContextMenu(const QPoint& pos) m_isContextMenuOpen = false; } -void DolphinView::dropUrls(const KUrl::List& urls, +void DolphinView::dropUrls(const KFileItem& destItem, const KUrl& destPath, - const KFileItem& destItem) + QDropEvent* event) { - Q_ASSERT(!urls.isEmpty()); - const KUrl destination = !destItem.isNull() && destItem.isDir() ? - destItem.url() : destPath; - const KUrl sourceDir = KUrl(urls.first().directory()); - if (sourceDir != destination) { - DolphinDropController dropController(this); - // forward doingOperation signal up to the mainwindow - connect(&dropController, SIGNAL(doingOperation(KIO::FileUndoManager::CommandType)), - this, SIGNAL(doingOperation(KIO::FileUndoManager::CommandType))); - dropController.dropUrls(urls, destination); - } + DolphinDropController::dropUrls(destItem, destPath, event, this); } void DolphinView::updateSorting(DolphinView::Sorting sorting) @@ -1107,7 +1094,7 @@ void DolphinView::applyViewProperties(const KUrl& url) const bool showPreview = props.showPreview(); if (showPreview != m_showPreview) { m_showPreview = showPreview; - m_iconManager->setShowPreview(showPreview); + m_previewGenerator->setPreviewShown(showPreview); const int oldZoomLevel = m_controller->zoomLevel(); emit showPreviewChanged(); @@ -1165,6 +1152,7 @@ void DolphinView::createView() m_controller->setItemView(view); m_fileItemDelegate = new KFileItemDelegate(view); + m_fileItemDelegate->setShowToolTipWhenElided(false); view->setItemDelegate(m_fileItemDelegate); view->setModel(m_proxyModel); @@ -1180,8 +1168,8 @@ void DolphinView::createView() view->setSelectionMode(QAbstractItemView::ExtendedSelection); - m_iconManager = new IconManager(view, m_proxyModel); - m_iconManager->setShowPreview(m_showPreview); + m_previewGenerator = new KFilePreviewGenerator(view, m_proxyModel); + m_previewGenerator->setPreviewShown(m_showPreview); if (DolphinSettings::instance().generalSettings()->showToolTips()) { m_toolTipManager = new ToolTipManager(view, m_proxyModel); @@ -1215,7 +1203,7 @@ void DolphinView::deleteView() m_detailsView = 0; m_columnView = 0; m_fileItemDelegate = 0; - m_iconManager = 0; + m_previewGenerator = 0; m_toolTipManager = 0; } } @@ -1257,11 +1245,9 @@ void DolphinView::pasteToUrl(const KUrl& url) const KUrl::List sourceUrls = KUrl::List::fromMimeData(mimeData); if (KonqMimeData::decodeIsCutSelection(mimeData)) { KonqOperations::copy(this, KonqOperations::MOVE, sourceUrls, url); - emit doingOperation(KIO::FileUndoManager::Move); clipboard->clear(); } else { KonqOperations::copy(this, KonqOperations::COPY, sourceUrls, url); - emit doingOperation(KIO::FileUndoManager::Copy); } }