Sophie

Sophie

distrib > Mageia > 1 > i586 > media > core-updates-src > by-pkgid > 83ecf8f3cf39318860f0dc9917c84068 > files > 37

kdebase4-workspace-4.6.5-1.4.mga1.src.rpm

commit 12cb6f5cd7939eec512f0dbec8be0ad3fac010d1
Author: Aaron Seigo <aseigo@kde.org>
Date:   Fri Sep 30 17:07:48 2011 +0200

    apparently something (bad) changed in QGraphicsView and now dragMoveEvent gets called repeatedly with the same pos
    
    this made people confused about br#261443 as it was supposed to be fixed (it was) but a different issue entirely
    had cropped up in the meantime. *sigh*
    
    BUG:261443

diff --git a/plasma/desktop/applets/tasks/abstracttaskitem.cpp b/plasma/desktop/applets/tasks/abstracttaskitem.cpp
index 91e9064..00140ef 100644
--- a/plasma/desktop/applets/tasks/abstracttaskitem.cpp
+++ b/plasma/desktop/applets/tasks/abstracttaskitem.cpp
@@ -877,8 +877,8 @@ void AbstractTaskItem::setBackgroundFadeAlpha(qreal progress)
 
 bool AbstractTaskItem::shouldIgnoreDragEvent(QGraphicsSceneDragDropEvent *event)
 {
-   if (event->mimeData()->hasFormat(TaskManager::Task::mimetype()) ||
-       event->mimeData()->hasFormat(TaskManager::Task::groupMimetype())) {
+    if (event->mimeData()->hasFormat(TaskManager::Task::mimetype()) ||
+        event->mimeData()->hasFormat(TaskManager::Task::groupMimetype())) {
         return true;
     }
 
@@ -889,13 +889,15 @@ bool AbstractTaskItem::shouldIgnoreDragEvent(QGraphicsSceneDragDropEvent *event)
         if (!uris.isEmpty()) {
             foreach (const QUrl &uri, uris) {
                 KUrl url(uri);
-                if (url.isLocalFile()) {
-                    const QString path = url.toLocalFile();
-                    QFileInfo info(path);
-                    if (info.isDir() || !info.isExecutable()) {
-                        return false;
-                        break;
-                    }
+                if (!url.isLocalFile()) {
+                    return false;
+                }
+
+                const QString path = url.toLocalFile();
+                QFileInfo info(path);
+                if (info.isDir() || !info.isExecutable()) {
+                    return false;
+                    break;
                 }
             }
 
@@ -916,19 +918,19 @@ void AbstractTaskItem::dragEnterEvent(QGraphicsSceneDragDropEvent *event)
     event->accept();
 
     if (!m_activateTimerId) {
-        m_activateTimerId = startTimer(500);
+        m_activateTimerId = startTimer(250);
+        m_oldDragPos = event->pos();
     }
 }
 
 void AbstractTaskItem::dragMoveEvent(QGraphicsSceneDragDropEvent *event)
 {
-    Q_UNUSED(event);
-
     // restart the timer so that activate() is only called after the mouse
     // stops moving
-    if (m_activateTimerId) {
+    if (m_activateTimerId && event->pos() != m_oldDragPos) {
+        m_oldDragPos = event->pos();
         killTimer(m_activateTimerId);
-        m_activateTimerId = startTimer(500);
+        m_activateTimerId = startTimer(250);
     }
 }
 
diff --git a/plasma/desktop/applets/tasks/abstracttaskitem.h b/plasma/desktop/applets/tasks/abstracttaskitem.h
index 1cda386..9520e1f 100644
--- a/plasma/desktop/applets/tasks/abstracttaskitem.h
+++ b/plasma/desktop/applets/tasks/abstracttaskitem.h
@@ -260,6 +260,7 @@ private:
     bool m_showText : 1;
     bool m_layoutAnimationLock : 1;
     bool m_firstGeometryUpdate : 1;
+    QPointF m_oldDragPos;
 };
 
 #endif