]> cloud.milkyroute.net Git - dolphin.git/commitdiff
DragAndDropHelper::isMimeTypeSupported() returns always true in the meantime - remove it
authorPeter Penz <peter.penz19@gmail.com>
Fri, 26 Nov 2010 18:51:04 +0000 (18:51 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Fri, 26 Nov 2010 18:51:04 +0000 (18:51 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=1201101

src/views/dolphincolumnview.cpp
src/views/dolphindetailsview.cpp
src/views/dolphiniconsview.cpp
src/views/draganddrophelper.cpp
src/views/draganddrophelper.h

index 02b4b62e3e48cfd6f4a14f5b8e490c689a9213e7..41d281bac1aa5a7cc30bed6d41e5ff007fe7d8d2 100644 (file)
@@ -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)
index 64f964aa862e1df2a3ca6fa367b6a415c566e4e6..dcde4b49676a631a99d229f6498f8237433a4cc5 100644 (file)
@@ -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)
index ce7265af702c134e7c8c1e2ffe8fc17e6d4616d1..522a9078779ba6b00d18ce5d209d00d5dbe9cca9 100644 (file)
@@ -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);
 }
index 8ab96d36820e16fe9f3cdbe84d23403b8a66cd4d..9708415f0a057953b32aeaa7d5b24e3b662de5bc 100644 (file)
@@ -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;
 }
 
index 3cb506c43a0dca90fc12b19ebb976432782f9a85..f26f769e9d2d8befeb322d93866382af6d1b1eab 100644 (file)
@@ -47,12 +47,6 @@ class LIBDOLPHINPRIVATE_EXPORT DragAndDropHelper : public QObject
 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.
      */
@@ -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;