Changeset 450 for trunk/src/gui/kernel/qdnd_pm.cpp
- Timestamp:
- Jan 19, 2010, 11:30:46 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gui/kernel/qdnd_pm.cpp
r449 r450 119 119 120 120 USHORT lastDropReply; // last reply to DM_DRAGOVER 121 USHORT lastOpRequest; // last op requested in DM_DRAGOVER 122 123 Qt::DropAction lastProposedAction; // last proposed action 121 122 Qt::DropAction lastAction; // last target-accepted action 124 123 QRect lastAnswerRect; // last accepted rectangle from the target 125 124 }; … … 130 129 , lastDragOverWidget(0), lastDragOverOp(0) 131 130 , supportedOps(0), sourceAllowsOp(false) 132 , lastDropReply(DOR_NEVERDROP) , lastOpRequest(DO_UNKNOWN)133 , last ProposedAction(Qt::CopyAction)131 , lastDropReply(DOR_NEVERDROP) 132 , lastAction(Qt::CopyAction) 134 133 { 135 134 } … … 379 378 dragData->sourceAllowsOp = false; 380 379 dragData->lastDropReply = DOR_NEVERDROP; 381 dragData->lastOpRequest = DO_UNKNOWN; 382 dragData->lastProposedAction = 380 dragData->lastAction = 383 381 manager->defaultAction(toQDragDropActions(dragData->supportedOps), 384 382 Qt::NoModifier); … … 425 423 if (first || dragData->lastDragOverOp != info->usOperation) { 426 424 // the current drop operation was changed by a modifier key 427 dragData->lastDragOverOp = info->usOperation;428 425 USHORT realOp = info->usOperation; 429 426 if (realOp == DO_DEFAULT || realOp == DO_UNKNOWN) { 430 427 // the default operation is requested 431 realOp = toPmDragDropOp(dragData->lastProposedAction); 428 realOp = toPmDragDropOp(dragData->lastAction); 429 } else { 430 dragData->lastAction = toQDragDropAction(realOp); 432 431 } 433 432 dragData->sourceAllowsOp = … … 435 434 ((dragData->supportedOps & DO_COPYABLE) && realOp == DO_COPY) || 436 435 ((dragData->supportedOps & DO_LINKABLE) && realOp == DO_LINK); 436 dragData->lastDragOverOp = realOp; 437 437 } 438 438 … … 443 443 444 444 QMimeData *data = manager->source() ? manager->dragPrivate()->data : manager->dropData; 445 446 Qt::DropAction action = toQDragDropAction(dragData->lastOpRequest);447 445 448 446 if (first) { … … 452 450 data, QApplication::mouseButtons(), 453 451 QApplication::keyboardModifiers()); 452 dee.setDropAction(dragData->lastAction); 454 453 sendDropEvent(dragOverWidget, &dee); 455 454 // if not allowed or not accepted, always reply DOR_NODROP … … 457 456 if (dragData->sourceAllowsOp && dee.isAccepted()) { 458 457 dropReply = DOR_DROP; 459 action = dee.dropAction(); 460 dragData->lastProposedAction = dee.proposedAction(); 458 dragData->lastAction = dee.dropAction(); 461 459 dragData->lastAnswerRect = dee.answerRect(); 462 460 } else { … … 474 472 QApplication::keyboardModifiers()); 475 473 // accept by default, since enter event was accepted. 476 dme.setDropAction( action);474 dme.setDropAction(dragData->lastAction); 477 475 dme.accept(); 478 476 sendDropEvent(dragOverWidget, &dme); 479 477 if (dragData->sourceAllowsOp && dme.isAccepted()) { 480 478 dropReply = DOR_DROP; 481 action = dme.dropAction(); 482 dragData->lastProposedAction = dme.proposedAction(); 479 dragData->lastAction = dme.dropAction(); 483 480 dragData->lastAnswerRect = dme.answerRect(); 484 481 } else { … … 488 485 489 486 dragData->lastDropReply = dropReply; 490 dragData->lastOpRequest = toPmDragDropOp(action);491 487 } 492 488 493 489 DrgFreeDraginfo(info); 494 490 495 return MRFROM2SHORT(dropReply, dragData->lastOpRequest);491 return MRFROM2SHORT(dropReply, toPmDragDropOp(dragData->lastAction)); 496 492 } 497 493 case DM_DRAGLEAVE: { … … 540 536 pnt = widget->mapFromGlobal(pnt); 541 537 542 Q_ASSERT(dragData->last OpRequest== info->usOperation);538 Q_ASSERT(dragData->lastDragOverOp == info->usOperation); 543 539 544 540 Q_ASSERT(dragData->lastDragOverWidget->acceptDrops()); … … 551 547 QMimeData *data = manager->source() ? manager->dragPrivate()->data : manager->dropData; 552 548 553 Qt::DropAction action = toQDragDropAction(dragData->lastOpRequest);554 555 549 dragData->setDropped(true); 556 550 557 QDropEvent de(pnt, action, data, QApplication::mouseButtons(),551 QDropEvent de(pnt, dragData->lastAction, data, QApplication::mouseButtons(), 558 552 QApplication::keyboardModifiers()); 559 553 if (dragData->lastDropReply == DOR_DROP) 560 de.setDropAction( action);554 de.setDropAction(dragData->lastAction); 561 555 562 556 sendDropEvent(dragData->lastDragOverWidget, &de); … … 686 680 continue; 687 681 DEBUG(() << "QPMCoopDragWorker: Got worker" << wrk 688 << "( isExclusive" << wrk->isExclusive() << ", "682 << "( isExclusive" << wrk->isExclusive() 689 683 << "itemCount" << wrk->itemCount() << ") from convertor" 690 << mime << " (gotExclForMime"691 << gotExclForMime << ", " <<"gotExcl" << gotExcl692 << " , skipExcl" << skipExcl << ",coopLevel"684 << mime << "( gotExclForMime" << gotExclForMime 685 << "gotExcl" << gotExcl 686 << "skipExcl" << skipExcl << "coopLevel" 693 687 << coopLevel << ")"); 694 688 if (wrk->isExclusive()) { … … 748 742 if (w->isExclusive() || w->itemCount() > 1) { 749 743 DEBUG(() << "QPMCoopDragWorker: DragWorker" << w 750 << "for" << fmt << "( isExclusive" << w->isExclusive()751 << " ,itemCount" << w->itemCount()744 << "for" << fmt << "( isExclusive" << w->isExclusive() 745 << "itemCount" << w->itemCount() 752 746 <<") has no fall-back cooperative 1-item worker!"); 753 747 workers.removeLast(); … … 763 757 // (depending on skipExcl) and remove duplicates 764 758 for (QList<DragWorker*>::iterator it = workers.begin(); 765 it < =workers.end();) {759 it < workers.end();) { 766 760 DragWorker *wrk = *it; 767 761 bool excl = wrk->isExclusive() || wrk->itemCount() > 1; … … 776 770 foreach (DragWorker *wrk, workers) { 777 771 DEBUG(() << "QPMCoopDragWorker: Will use worker" << wrk 778 << "( isExclusive" << wrk->isExclusive()779 << " ,itemCount" << wrk->itemCount() << ")");772 << "( isExclusive" << wrk->isExclusive() 773 << "itemCount" << wrk->itemCount() << ")"); 780 774 } 781 775 #endif … … 934 928 if (msg == DM_RENDERPREPARE) { 935 929 if (!info) { 936 qWarning("Drop target sent DM_RENDERPREPARE after the DnD session"937 "is over!");930 DEBUG(() << "Drop target sent DM_RENDERPREPARE after the DnD " 931 "session is over!"); 938 932 // free the given DRAGTRANSFER structure to avoud memory leak 939 933 DRAGTRANSFER *xfer = (DRAGTRANSFER *)mp1; … … 961 955 DEBUG(() << "QPMCoopDragWorker: Got DM_RENDERPREPARE to" 962 956 << QPMMime::queryHSTR(xfer->hstrSelectedRMF) << "for item" 963 << index << "( id" << xfer->pditem->ulItemID << ")");957 << index << "( id" << xfer->pditem->ulItemID << ")"); 964 958 965 959 QByteArray drm, drf; … … 984 978 985 979 if (msg == DM_RENDER || msg == DM_ENDCONVERSATION) { 986 qWarning("Drop target sent DM_RENDER or DM_ENDCONVERSATION to the "987 "drag source window instead of the drag item window!");980 DEBUG(() << "Drop target sent DM_RENDER or DM_ENDCONVERSATION to the " 981 "drag source window instead of the drag item window!"); 988 982 if (msg == DM_RENDER) { 989 983 // free the given DRAGTRANSFER structure to avoud memory leak … … 1045 1039 } 1046 1040 1047 USHORT supportedOps = toPmDragDropOps( dragPrivate()->possible_actions);1041 USHORT supportedOps = toPmDragDropOps(o->d_func()->possible_actions); 1048 1042 1049 1043 static QPMCoopDragWorker dragWorker;
Note:
See TracChangeset
for help on using the changeset viewer.