Ticket #292: dnd_ignoreaction.diff
File dnd_ignoreaction.diff, 3.6 KB (added by , 11 years ago) |
---|
-
src/gui/kernel/qdnd_pm.cpp
110 110 friend class QDragManager; 111 111 112 112 void initWorkers(); 113 bool allowedOp(USHORT realOp); 113 114 114 115 bool initialized : 1; 115 116 bool fakeDrop : 1; … … 123 124 USHORT lastDragOverOp; // last DM_DRAGOVER operation 124 125 125 126 USHORT supportedOps; // operations supported by all items 126 bool sourceAllowsOp : 1; // does source allow requested operation127 127 128 128 USHORT lastDropReply; // last reply to DM_DRAGOVER 129 129 … … 135 135 : initialized(false), fakeDrop(false) 136 136 , gotWorkers(false), canSyncRndr(false), di(NULL) 137 137 , lastDragOverWidget(0), lastDragOverOp(0) 138 , supportedOps(0) , sourceAllowsOp(false)138 , supportedOps(0) 139 139 , lastDropReply(DOR_NEVERDROP) 140 140 , lastAction(Qt::CopyAction) 141 141 { … … 246 246 } 247 247 } 248 248 249 // does source allow requested operation 250 bool QPMDragData::allowedOp(USHORT realOp) 251 { 252 return ((supportedOps & DO_MOVEABLE) && realOp == DO_MOVE) || 253 ((supportedOps & DO_COPYABLE) && realOp == DO_COPY) || 254 ((supportedOps & DO_LINKABLE) && realOp == DO_LINK); 255 } 256 249 257 void QPMDragData::reset(bool isAccepted) 250 258 { 251 259 if (!initialized) … … 505 513 dragData->lastDragOverWidget = dragOverWidget; 506 514 dragData->lastDragOverOp = 0; 507 515 dragData->supportedOps = DO_COPYABLE | DO_MOVEABLE | DO_LINKABLE; 508 dragData->sourceAllowsOp = false;509 516 dragData->lastDropReply = DOR_NEVERDROP; 510 517 dragData->lastAction = 511 518 manager->defaultAction(toQDragDropActions(dragData->supportedOps), … … 547 554 548 555 if (dropReply != DOR_NEVERDROP) { 549 556 557 #if 0 550 558 if (first || dragData->lastDragOverOp != info->usOperation) { 551 559 // the current drop operation was changed by a modifier key 552 560 USHORT realOp = info->usOperation; … … 571 579 // events anyway (stealing them from Qt would be confusing), but 572 580 // we will silently ignore any accept commands and always reject 573 581 // the drop. Other platforms seem to do the same. 574 582 #endif 575 583 QMimeData *data = manager->source() ? manager->dragPrivate()->data : manager->dropData; 576 584 577 585 if (first) { … … 583 591 sendDropEvent(dragOverWidget, &dee); 584 592 // if not allowed or not accepted, always reply DOR_NODROP 585 593 // to have DM_DRAGOVER delivered to us again for a new test 586 if (dragData-> sourceAllowsOp&& dee.isAccepted()) {594 if (dragData->allowedOp(toPmDragDropOp(dee.dropAction())) && dee.isAccepted()) { 587 595 dropReply = DOR_DROP; 588 596 dragData->lastAction = dee.dropAction(); 589 597 dragData->lastAnswerRect = dee.answerRect(); … … 605 613 if (dropReply == DOR_DROP) 606 614 dme.accept(); 607 615 sendDropEvent(dragOverWidget, &dme); 608 if (dragData-> sourceAllowsOp&& dme.isAccepted()) {616 if (dragData->allowedOp(toPmDragDropOp(dme.dropAction())) && dme.isAccepted()) { 609 617 dropReply = DOR_DROP; 610 618 dragData->lastAction = dme.dropAction(); 611 619 dragData->lastAnswerRect = dme.answerRect();