Changeset 470 for trunk/src/gui/kernel


Ignore:
Timestamp:
Jan 23, 2010, 3:44:11 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

gui: DnD: Added support for dragging empty QMimeData with no formats (used in particular by QDesigner for in-process drag and drop).

Location:
trunk/src/gui/kernel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gui/kernel/qdnd_pm.cpp

    r469 r470  
    913913    }
    914914
     915
     916
     917
     918
     919
     920
     921
     922
     923
     924
     925
     926
     927
     928
     929
     930
     931
     932
     933
     934
    915935#if defined(QDND_DEBUG)
    916936    foreach (DragWorker *wrk, workers) {
  • trunk/src/gui/kernel/qmime_pm.cpp

    r465 r470  
    365365        return formats;
    366366
    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>";
     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    }
    374379
    375380    DEBUG(() << "DefaultDragWorker: formats" << formats
     
    477482                 << req->provider);
    478483
    479         // We would lile to post WM_USER to ourselves to do actual rendering
     484        // We would lie to post WM_USER to ourselves to do actual rendering
    480485        // after we return from DM_RENDER. But we are inside DrgDrag() at this
    481486        // point (our DND implementation is fully synchronous by design), so
     
    483488        // DrgDrag(). Thus, we have to send it.
    484489
    485         WinSendMsg(hwnd(), WM_USER, MPFROMLONG(xfer->pditem->ulItemID),
    486                                      MPFROMP(req));
     490        WinSendMsg(hwnd(), WM_USER,
     491                    MPFROMP(req));
    487492
    488493        return (MRESULT)TRUE;
     
    827832    if (!provider)
    828833        return ret;
     834
     835
     836
     837
     838
    829839
    830840    QByteArray drf = provider->drf(mimeType);
     
    11171127                                             Provider *provider)
    11181128{
    1119     Q_ASSERT(!mimeType.isEmpty() && provider);
    1120     if (!mimeType.isEmpty() && provider && !d->exclusive) {
     1129    // note: as a special case, mimeType may be null (see
     1130    // QPMCoopDragWorker::collectWorkers())
     1131
     1132    Q_ASSERT(provider);
     1133    if (provider && !d->exclusive) {
    11211134        // ensure there are no dups (several providers for the same mime)
    11221135        if (!d->providerFor(mimeType))
     
    12911304{
    12921305    ULONG cf = WinAddAtom(WinQuerySystemAtomTable(), mime.toLocal8Bit());
    1293     if (!cf) {
    12941306#ifndef QT_NO_DEBUG
     1307
    12951308        qWarning("QPMMime: WinAddAtom failed with 0x%lX",
    12961309                 WinGetLastError(NULLHANDLE));
    12971310#endif
    1298         return 0;
    1299     }
    13001311
    13011312    return cf;
     
    27232734                                               QString &type, QString &ext)
    27242735{
    2725     // file type = mime
    2726     type = format(drf);
    2727     Q_ASSERT(!type.isEmpty());
     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    }
    27282744
    27292745    // no way to determine the extension
     
    27592775                                                   QMimeData *mimeData)
    27602776{
     2777
     2778
     2779
     2780
     2781
     2782
     2783
     2784
     2785
     2786
     2787
     2788
    27612789    ULONG cf = cfMap.value(mimeType);
    27622790    if (!cf)
     
    27882816        DefaultDropWorker *defWorker = defaultDropWorker();
    27892817        bool atLeastOneSupported = false;
     2818
     2819
     2820
     2821
     2822
     2823
     2824
     2825
     2826
     2827
    27902828
    27912829        // check that we support one of DRMs and the format is CF_hhhhhhh
     
    28642902    if (atomStr.startsWith(mimePrefix)) {
    28652903        // 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);
    28692904        // extract the real mime type (w/o our prefix)
    28702905        mime = atomStr.mid(mimePrefix.size());
     2906
    28712907        if (!mime.isEmpty()) {
     2908
     2909
     2910
    28722911            cfMap[mime] = cf;
    28732912            mimeMap[cf] = mime;
Note: See TracChangeset for help on using the changeset viewer.