Review Request 111748: Better wrap QMimeData by retaining support for QByteArray

Commit Hook null at kde.org
Tue Aug 6 10:01:55 UTC 2013


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/111748/
-----------------------------------------------------------

(Updated Aug. 6, 2013, 10:01 a.m.)


Status
------

This change has been marked as submitted.


Review request for Plasma, Marco Martin and Sebastian Kügler.


Description
-------

DeclarativeMimeData::setData() is QString type, QString data, while QMimeData::setData() is QString type, QByteArray data. The former ends up calling the latter with data.toLatin1().

I have a need to set a QByteArray payload in the taskbar - X11 WIds, as understood e.g. by pagers.

The proposed patch changes the DeclarativeMimeData::setData() signature to QString type, QVariant data. The implementation checks whether the QVariant is a byte array, and if so, hands it to the base class implementation. If it's not a byte array, it checks if it can be converted to a QString, and if so, hands the string version's toLatin1() to the base class. If the QVariant is neither a byte array nor convertable to a string, nothing is done.

This means behavior changes as follows:
- Byte array support is back.
- Anything that QVariant knows how to convert to a QString is converted. This maybe subtly different from how QML "casts" to QString, but I think fits the original sentiment of changing the signature to use QString.
- Non-bytearray/string-convertable data is silently dropped.

If this patch is accepted, I would like to backport it to KDE/4.11 as well and make use of the improved implementation to restore drag-task-to-pager behavior in the new QML task manager.


This addresses bug 322567.
    http://bugs.kde.org/show_bug.cgi?id=322567


Diffs
-----

  src/declarativeimports/draganddrop/DeclarativeMimeData.h ec725af 
  src/declarativeimports/draganddrop/DeclarativeMimeData.cpp e7cab10 

Diff: http://git.reviewboard.kde.org/r/111748/diff/


Testing
-------

I haven't even built the thing. It's terribad.


Thanks,

Eike Hein

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20130806/b2201120/attachment.html>


More information about the Plasma-devel mailing list