~ubuntu-branches/ubuntu/precise/kde-workspace/precise-security

« back to all changes in this revision

Viewing changes to plasma/desktop/applets/tasks/abstracttaskitem.cpp

Tags: upstream-4.7.2
Import upstream version 4.7.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
877
877
 
878
878
bool AbstractTaskItem::shouldIgnoreDragEvent(QGraphicsSceneDragDropEvent *event)
879
879
{
880
 
   if (event->mimeData()->hasFormat(TaskManager::Task::mimetype()) ||
881
 
       event->mimeData()->hasFormat(TaskManager::Task::groupMimetype())) {
 
880
    if (event->mimeData()->hasFormat(TaskManager::Task::mimetype()) ||
 
881
        event->mimeData()->hasFormat(TaskManager::Task::groupMimetype())) {
882
882
        return true;
883
883
    }
884
884
 
889
889
        if (!uris.isEmpty()) {
890
890
            foreach (const QUrl &uri, uris) {
891
891
                KUrl url(uri);
892
 
                if (url.isLocalFile()) {
893
 
                    const QString path = url.toLocalFile();
894
 
                    QFileInfo info(path);
895
 
                    if (info.isDir() || !info.isExecutable()) {
896
 
                        return false;
897
 
                        break;
898
 
                    }
 
892
                if (!url.isLocalFile()) {
 
893
                    return false;
 
894
                }
 
895
 
 
896
                const QString path = url.toLocalFile();
 
897
                QFileInfo info(path);
 
898
                if (info.isDir() || !info.isExecutable()) {
 
899
                    return false;
 
900
                    break;
899
901
                }
900
902
            }
901
903
 
916
918
    event->accept();
917
919
 
918
920
    if (!m_activateTimerId) {
919
 
        m_activateTimerId = startTimer(500);
 
921
        m_activateTimerId = startTimer(250);
 
922
        m_oldDragPos = event->pos();
920
923
    }
921
924
}
922
925
 
923
926
void AbstractTaskItem::dragMoveEvent(QGraphicsSceneDragDropEvent *event)
924
927
{
925
 
    Q_UNUSED(event);
926
 
 
927
928
    // restart the timer so that activate() is only called after the mouse
928
929
    // stops moving
929
 
    if (m_activateTimerId) {
 
930
    if (m_activateTimerId && event->pos() != m_oldDragPos) {
 
931
        m_oldDragPos = event->pos();
930
932
        killTimer(m_activateTimerId);
931
 
        m_activateTimerId = startTimer(500);
 
933
        m_activateTimerId = startTimer(250);
932
934
    }
933
935
}
934
936