Changeset 471 for trunk/src/gui/kernel/qdnd_pm.cpp
- Timestamp:
- Jan 25, 2010, 5:03:17 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gui/kernel/qdnd_pm.cpp
r470 r471 611 611 DrgFreeDraginfo(info); 612 612 613 DEBUG(("DM_DRAGOVER: return %08lx default %08lx", 614 dropReply, toPmDragDropOp(dragData->lastAction))); 613 615 return MRFROM2SHORT(dropReply, toPmDragDropOp(dragData->lastAction)); 614 616 } … … 913 915 } 914 916 915 if (!mimeData->formats().count()) {916 // The drag source doesn't provide any format, so we've got no workers.917 // Although it may look strange, but it is a supported case: for918 // example, designer uses it a lot for in-process DnD. Instead of MIME919 // data, it works directly with the QMimeData object from the drag920 // source. We will go through the converters passing a special value of921 // QString::null as MIME type -- one of them (e.g. QPMAnyMime) should922 // take it over and return itself.923 Q_ASSERT(!workers.count());924 DEBUG(() << "QPMCoopDragWorker: Source provides NO data, looking for a "925 "converter that can handle this");926 foreach (QPMMime *mime, QPMMime::all()) {927 DragWorker *wrk = mime->dragWorkerFor(QString::null, mimeData);928 if (wrk) {929 workers.append(wrk);930 break;931 }932 }933 }934 935 917 #if defined(QDND_DEBUG) 936 918 foreach (DragWorker *wrk, workers) { … … 941 923 #endif 942 924 925 if (!mimeData->formats().count()) { 926 // The drag source doesn't provide any format, so we've got no workers. 927 // Although it may look strange, it is a supported case: for example, 928 // designer uses it a lot for in-process DnD. Instead of MIME data, it 929 // works directly with the QMimeData object from the drag source. We 930 // will handle this situation by providing a dummy DRAGINFO structure. 931 DEBUG(() << "QPMCoopDragWorker: Source provides NO data, will use " 932 "dummy DRAGINFO"); 933 Q_ASSERT(!workers.count()); 934 return true; 935 } 936 943 937 Q_ASSERT(workers.count() > 0); 944 938 return workers.count() > 0; … … 947 941 HWND QPMCoopDragWorker::hwnd() const 948 942 { 949 DragWorker *firstWorker = workers.first();950 Q_ASSERT(firstWorker);951 if (!firstWorker)952 return 0;953 954 if (firstWorker->isExclusive() && firstWorker->itemCount() == 0) {955 // this is a super exclusive worker that will do everything on its own956 return firstWorker->hwnd();943 if (!workers.count()) { 944 // The drag source doesn't provide any format; will handle it ourselves 945 } else { 946 DragWorker *firstWorker = workers.first(); 947 if (firstWorker->isExclusive() && firstWorker->itemCount() == 0) { 948 // this is a super exclusive worker that will do everything on its own 949 return firstWorker->hwnd(); 950 } 957 951 } 958 952 … … 989 983 if (info) 990 984 return 0; 985 986 if (!workers.count()) { 987 // The drag source doesn't provide any format; provide a dummy DRAGINFO 988 // with a null DRAGITEM that we will never render 989 info = DrgAllocDraginfo(1); 990 Q_ASSERT(info); 991 if (!info) 992 return 0; 993 994 DRAGITEM *item = DrgQueryDragitemPtr(info, 0); 995 Q_ASSERT(item); 996 if (!item) { 997 DrgFreeDraginfo(info); 998 info = 0; 999 return 0; 1000 } 1001 1002 item->hwndItem = hwnd(); 1003 item->ulItemID = 0; 1004 item->hstrType = 0; 1005 item->hstrRMF = 0; 1006 item->hstrContainerName = 0; 1007 item->hstrSourceName = 0; 1008 item->hstrTargetName = 0; 1009 item->cxOffset = 0; 1010 item->cyOffset = 0; 1011 item->fsControl = DC_PREPARE; // require DM_RENDERPREPARE from target 1012 item->fsSupportedOps = supportedOps; 1013 1014 return info; 1015 } 991 1016 992 1017 DragWorker *firstWorker = workers.first();
Note:
See TracChangeset
for help on using the changeset viewer.