diff options
| -rw-r--r-- | src/views/dolphincolumnview.cpp | 12 | ||||
| -rw-r--r-- | src/views/dolphindetailsview.cpp | 10 | ||||
| -rw-r--r-- | src/views/dolphiniconsview.cpp | 9 | ||||
| -rw-r--r-- | src/views/draganddrophelper.cpp | 28 | ||||
| -rw-r--r-- | src/views/draganddrophelper.h | 12 |
5 files changed, 20 insertions, 51 deletions
diff --git a/src/views/dolphincolumnview.cpp b/src/views/dolphincolumnview.cpp index 02b4b62e3..41d281bac 100644 --- a/src/views/dolphincolumnview.cpp +++ b/src/views/dolphincolumnview.cpp @@ -283,21 +283,15 @@ void DolphinColumnView::startDrag(Qt::DropActions supportedActions) void DolphinColumnView::dragEnterEvent(QDragEnterEvent* event) { - if (DragAndDropHelper::instance().isMimeDataSupported(event->mimeData())) { - event->acceptProposedAction(); - requestActivation(); - } + event->acceptProposedAction(); + requestActivation(); DolphinTreeView::dragEnterEvent(event); } void DolphinColumnView::dragMoveEvent(QDragMoveEvent* event) { DolphinTreeView::dragMoveEvent(event); - - if (DragAndDropHelper::instance().isMimeDataSupported(event->mimeData())) { - // accept url drops, independently from the destination item - event->acceptProposedAction(); - } + event->acceptProposedAction(); } void DolphinColumnView::dropEvent(QDropEvent* event) diff --git a/src/views/dolphindetailsview.cpp b/src/views/dolphindetailsview.cpp index 64f964aa8..dcde4b496 100644 --- a/src/views/dolphindetailsview.cpp +++ b/src/views/dolphindetailsview.cpp @@ -225,20 +225,14 @@ void DolphinDetailsView::startDrag(Qt::DropActions supportedActions) void DolphinDetailsView::dragEnterEvent(QDragEnterEvent* event) { - if (DragAndDropHelper::instance().isMimeDataSupported(event->mimeData())) { - event->acceptProposedAction(); - } + event->acceptProposedAction(); DolphinTreeView::dragEnterEvent(event); } void DolphinDetailsView::dragMoveEvent(QDragMoveEvent* event) { DolphinTreeView::dragMoveEvent(event); - - if (DragAndDropHelper::instance().isMimeDataSupported(event->mimeData())) { - // Accept URL drops, independently from the destination item - event->acceptProposedAction(); - } + event->acceptProposedAction(); } void DolphinDetailsView::dropEvent(QDropEvent* event) diff --git a/src/views/dolphiniconsview.cpp b/src/views/dolphiniconsview.cpp index ce7265af7..522a90787 100644 --- a/src/views/dolphiniconsview.cpp +++ b/src/views/dolphiniconsview.cpp @@ -192,9 +192,7 @@ void DolphinIconsView::startDrag(Qt::DropActions supportedActions) void DolphinIconsView::dragEnterEvent(QDragEnterEvent* event) { - if (DragAndDropHelper::instance().isMimeDataSupported(event->mimeData())) { - event->acceptProposedAction(); - } + event->acceptProposedAction(); } void DolphinIconsView::dragLeaveEvent(QDragLeaveEvent* event) @@ -220,10 +218,7 @@ void DolphinIconsView::dragMoveEvent(QDragMoveEvent* event) m_dropRect.setSize(QSize()); // set as invalid } } - if (DragAndDropHelper::instance().isMimeDataSupported(event->mimeData())) { - // accept url drops, independently from the destination item - event->acceptProposedAction(); - } + event->acceptProposedAction(); setDirtyRegion(m_dropRect); } diff --git a/src/views/draganddrophelper.cpp b/src/views/draganddrophelper.cpp index 8ab96d368..9708415f0 100644 --- a/src/views/draganddrophelper.cpp +++ b/src/views/draganddrophelper.cpp @@ -47,14 +47,6 @@ DragAndDropHelper& DragAndDropHelper::instance() return s_dragAndDropHelper->instance; } -bool DragAndDropHelper::isMimeDataSupported(const QMimeData* mimeData) const -{ - // We support everything, cf KonqOperations::doDrop which can save any data. - //return mimeData->hasUrls() || mimeData->hasFormat("application/x-kde-dndextract"); - Q_UNUSED(mimeData); - return true; -} - void DragAndDropHelper::startDrag(QAbstractItemView* itemView, Qt::DropActions supportedActions, DolphinViewController* dolphinViewController) @@ -129,14 +121,14 @@ DragAndDropHelper::DragAndDropHelper() QPixmap DragAndDropHelper::createDragPixmap(QAbstractItemView* itemView) const { - const QModelIndexList selectedIndexes = itemView->selectionModel()->selectedIndexes(); + const QModelIndexList selectedIndexes = itemView->selectionModel()->selectedIndexes(); Q_ASSERT(!selectedIndexes.isEmpty()); - + QAbstractProxyModel* proxyModel = static_cast<QAbstractProxyModel*>(itemView->model()); KDirModel* dirModel = static_cast<KDirModel*>(proxyModel->sourceModel()); - + const int itemCount = selectedIndexes.count(); - + // If more than one item is dragged, align the items inside a // rectangular grid. The maximum grid size is limited to 5 x 5 items. int xCount = 3; @@ -148,11 +140,11 @@ QPixmap DragAndDropHelper::createDragPixmap(QAbstractItemView* itemView) const xCount = 4; size = KIconLoader::SizeSmallMedium; } - + if (itemCount < xCount) { xCount = itemCount; } - + int yCount = itemCount / xCount; if (itemCount % xCount != 0) { ++yCount; @@ -161,10 +153,10 @@ QPixmap DragAndDropHelper::createDragPixmap(QAbstractItemView* itemView) const yCount = xCount; } - // Draw the selected items into the grid cells + // Draw the selected items into the grid cells QPixmap dragPixmap(xCount * size + xCount - 1, yCount * size + yCount - 1); dragPixmap.fill(Qt::transparent); - + QPainter painter(&dragPixmap); int x = 0; int y = 0; @@ -173,7 +165,7 @@ QPixmap DragAndDropHelper::createDragPixmap(QAbstractItemView* itemView) const const KFileItem item = dirModel->itemForIndex(index); const QPixmap pixmap = item.pixmap(size, size); painter.drawPixmap(x, y, pixmap); - + x += size + 1; if (x >= dragPixmap.width()) { x = 0; @@ -183,7 +175,7 @@ QPixmap DragAndDropHelper::createDragPixmap(QAbstractItemView* itemView) const break; } } - + return dragPixmap; } diff --git a/src/views/draganddrophelper.h b/src/views/draganddrophelper.h index 3cb506c43..f26f769e9 100644 --- a/src/views/draganddrophelper.h +++ b/src/views/draganddrophelper.h @@ -48,12 +48,6 @@ public: static DragAndDropHelper& instance(); /** - * Returns true, if Dolphin supports the dragging of - * the given mime data. - */ - bool isMimeDataSupported(const QMimeData* mimeData) const; - - /** * Creates a drag object for the view \a itemView for all selected items. */ void startDrag(QAbstractItemView* itemView, @@ -61,7 +55,7 @@ public: DolphinViewController* dolphinViewController = 0); /** - * Returns true if and only if the view \a itemView was the last view to + * Returns true if and only if the view \a itemView was the last view to * be passed to startDrag(...), and that drag is still in progress. */ bool isDragSource(QAbstractItemView* itemView) const; @@ -85,13 +79,13 @@ signals: private: DragAndDropHelper(); - + /** * Creates a pixmap the contains the all icons of the items * that are dragged. */ QPixmap createDragPixmap(QAbstractItemView* itemView) const; - + // The last view passed in startDrag(...), or 0 if // no startDrag(...) initiated drag is in progress. QAbstractItemView *m_dragSource; |
