Changeset 471 for trunk/src/gui/kernel/qmime_pm.cpp
- Timestamp:
- Jan 25, 2010, 5:03:17 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gui/kernel/qmime_pm.cpp
r470 r471 365 365 return formats; 366 366 367 if (qstrcmp(formats, "DRF_NULL") == 0) { 368 // special case, see QPMMimeAnyMime::dragWorkerFor() 369 formats = "<DRM_NULL," + formats + ">"; 370 } else { 371 // DRM_SHAREDMEM comes first to prevent native DRM_OS2FILE 372 // rendering on the target side w/o involving the source. 373 // Also, we add <DRM_SHAREDMEM,DRF_POINTERDATA> just like WPS does it 374 // (however, it doesn't help when dropping objects to it -- WPS still 375 // chooses DRM_OS2FILE). 376 formats = "(DRM_SHAREDMEM,DRM_OS2FILE)x(" + formats + ")," 377 "<DRM_SHAREDMEM,DRF_POINTERDATA>"; 378 } 367 // DRM_SHAREDMEM comes first to prevent native DRM_OS2FILE 368 // rendering on the target side w/o involving the source. 369 // Also, we add <DRM_SHAREDMEM,DRF_POINTERDATA> just like WPS does it 370 // (however, it doesn't help when dropping objects to it -- WPS still 371 // chooses DRM_OS2FILE). 372 formats = "(DRM_SHAREDMEM,DRM_OS2FILE)x(" + formats + ")," 373 "<DRM_SHAREDMEM,DRF_POINTERDATA>"; 379 374 380 375 DEBUG(() << "DefaultDragWorker: formats" << formats … … 832 827 if (!provider) 833 828 return ret; 834 835 if (mimeType.isEmpty()) {836 // special case, see QPMMimeAnyMime::dropWorkerFor()837 return ret;838 }839 829 840 830 QByteArray drf = provider->drf(mimeType); … … 1127 1117 Provider *provider) 1128 1118 { 1129 // note: as a special case, mimeType may be null (see 1130 // QPMCoopDragWorker::collectWorkers()) 1131 1132 Q_ASSERT(provider); 1133 if (provider && !d->exclusive) { 1119 Q_ASSERT(!mimeType.isEmpty() && provider); 1120 if (!mimeType.isEmpty() && provider && !d->exclusive) { 1134 1121 // ensure there are no dups (several providers for the same mime) 1135 1122 if (!d->providerFor(mimeType)) … … 1304 1291 { 1305 1292 ULONG cf = WinAddAtom(WinQuerySystemAtomTable(), mime.toLocal8Bit()); 1293 if (!cf) { 1306 1294 #ifndef QT_NO_DEBUG 1307 if (!cf)1308 1295 qWarning("QPMMime: WinAddAtom failed with 0x%lX", 1309 1296 WinGetLastError(NULLHANDLE)); 1310 1297 #endif 1298 return 0; 1299 } 1311 1300 1312 1301 return cf; … … 2734 2723 QString &type, QString &ext) 2735 2724 { 2736 if (qstrcmp(drf, "DRF_NULL") == 0) { 2737 // special case (see QPMMimeAnyMime::dragWorkerFor()) 2738 type = QString::null; 2739 } else { 2740 // file type = mime 2741 type = format(drf); 2742 Q_ASSERT(!type.isEmpty()); 2743 } 2725 // file type = mime 2726 type = format(drf); 2727 Q_ASSERT(!type.isEmpty()); 2744 2728 2745 2729 // no way to determine the extension … … 2775 2759 QMimeData *mimeData) 2776 2760 { 2777 if (mimeType.isEmpty()) {2778 // special case: QMimeData with no formats() (see2779 // QPMCoopDragWorker::collectWorkers())2780 Q_ASSERT(!mimeData->formats().count());2781 // add an exclusive provider with a special format DRF_NULL. Note that2782 // any attemt to render this format should fail so we don't expect2783 // AnyDragProvider::format()/provide() to be actually called.2784 DefaultDragWorker *defWorker = defaultExclDragWorker();2785 defWorker->addProvider(QByteArray("DRF_NULL"), &anyDragProvider);2786 return defWorker;2787 }2788 2789 2761 ULONG cf = cfMap.value(mimeType); 2790 2762 if (!cf) … … 2816 2788 DefaultDropWorker *defWorker = defaultDropWorker(); 2817 2789 bool atLeastOneSupported = false; 2818 2819 if (qstrcmp(queryHSTR(item->hstrRMF), "<DRM_NULL,DRF_NULL>") == 0) {2820 // special case: QMimeData with no formats() (see2821 // QPMCoopDragWorker::collectWorkers()), use a special MIME format2822 // value of null. Note that any attemt to retrieve data in this2823 // format should fail so we don't expect AnyDropProvider::drf()/2824 // provide() to be actually called.2825 defWorker->addProvider(QString::null, &anyDropProvider);2826 return defWorker;2827 }2828 2790 2829 2791 // check that we support one of DRMs and the format is CF_hhhhhhh … … 2902 2864 if (atomStr.startsWith(mimePrefix)) { 2903 2865 // the format represents the mime type we can recognize 2866 // increase the reference count 2867 ULONG cf = QPMMime::registerMimeType(atomStr); 2868 Q_ASSERT(cf == format); 2904 2869 // extract the real mime type (w/o our prefix) 2905 2870 mime = atomStr.mid(mimePrefix.size()); 2906 Q_ASSERT(!mime.isEmpty());2907 2871 if (!mime.isEmpty()) { 2908 // increase the reference count (will decrease on destruction)2909 ULONG cf = QPMMime::registerMimeType(atomStr);2910 Q_ASSERT(cf == format);2911 2872 cfMap[mime] = cf; 2912 2873 mimeMap[cf] = mime;
Note:
See TracChangeset
for help on using the changeset viewer.