[Kst] kdeextragear-2/kst/kst

Andrew Walker arwalker at sumusltd.com
Wed Apr 28 22:18:49 CEST 2004


CVS commit by arwalker: 

Better handle drag/drop when the source and target are the same.


  M +22 -14    kstviewwidget.cpp   1.20


--- kdeextragear-2/kst/kst/kstviewwidget.cpp  #1.19:1.20
@@ -174,8 +174,5 @@ void KstViewWidget::dragEnterEvent(QDrag
   if (e->provides(KstPlotDrag::mimeType())) {
     if (e->source() == this) {
-      delete _drag;
-      _drag = 0L;
-      _view->restartMove();
-      e->accept(false);
+      e->ignore();
     } else {
       e->acceptAction(true);
@@ -189,6 +186,13 @@ void KstViewWidget::dragEnterEvent(QDrag
 void KstViewWidget::dragMoveEvent(QDragMoveEvent *e) {
   if (!_dragEnabled) {
-    e->accept(false);
+    e->ignore();
+  } else {
+    if (e->provides(KstPlotDrag::mimeType())) {
+      if (e->source() == this) {
+        e->ignore();
   } else {
+        e->acceptAction(true);
+      }
+    }
     // e->accept(true);  FIXME: check mimetype etc
     QWidget::dragMoveEvent(e);
@@ -204,5 +208,6 @@ void KstViewWidget::dragLeaveEvent(QDrag
 
 void KstViewWidget::dropEvent(QDropEvent *e) {
-  if (e->source() != this && e->provides(KstPlotDrag::mimeType())) {
+  if(e->provides(KstPlotDrag::mimeType())) {
+    if (e->source() != this) {
     // FIXME: support both copy and move
     QByteArray a = e->encodedData(KstPlotDrag::mimeType());
@@ -215,4 +220,7 @@ void KstViewWidget::dropEvent(QDropEvent
     _view->paint();
   } else {
+      e->ignore();
+    }
+  } else {
     QWidget::dropEvent(e);
   }





More information about the Kst mailing list