From kde-panel-devel Sat Jul 27 18:41:12 2013 From: "Eike Hein" Date: Sat, 27 Jul 2013 18:41:12 +0000 To: kde-panel-devel Subject: Re: Review Request 111748: Better wrap QMimeData by retaining support for QByteArray Message-Id: <20130727184112.22041.90400 () vidsolbach ! de> X-MARC-Message: https://marc.info/?l=kde-panel-devel&m=137495049626096 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--===============0508903896286906738==" --===============0508903896286906738== Content-Type: multipart/alternative; boundary="===============2495582355988505994==" --===============2495582355988505994== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: http://git.reviewboard.kde.org/r/111748/ ----------------------------------------------------------- (Updated July 27, 2013, 6:41 p.m.) Review request for Plasma, Marco Martin and Sebastian Kügler. Changes ------- Cleaned up diff; v1 contained an accidental paste. 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 (updated) ----- 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 --===============2495582355988505994== Content-Type: text/html; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit
This is an automatically generated e-mail. To reply, visit: http://git.reviewboard.kde.org/r/111748/

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

Updated July 27, 2013, 6:41 p.m.

Changes

Cleaned up diff; v1 contained an accidental paste.

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.

Testing

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

Diffs (updated)

  • src/declarativeimports/draganddrop/DeclarativeMimeData.h (ec725af)
  • src/declarativeimports/draganddrop/DeclarativeMimeData.cpp (e7cab10)

View Diff

--===============2495582355988505994==-- --===============0508903896286906738== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel --===============0508903896286906738==--