[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-panel-devel
Subject: Re: Review Request 111748: Better wrap QMimeData by retaining support for QByteArray
From: "Eike Hein" <hein () kde ! org>
Date: 2013-07-27 18:41:12
Message-ID: 20130727184112.22041.90400 () vidsolbach ! de
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
-----------------------------------------------------------
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
[Attachment #5 (text/html)]
<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
<tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="http://git.reviewboard.kde.org/r/111748/">http://git.reviewboard.kde.org/r/111748/</a>
</td>
</tr>
</table>
<br />
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: \
url('http://git.reviewboard.kde.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); \
background-position: left top; background-repeat: repeat-x; border: 1px black solid;"> <tr>
<td>
<div>Review request for Plasma, Marco Martin and Sebastian Kügler.</div>
<div>By Eike Hein.</div>
<p style="color: grey;"><i>Updated July 27, 2013, 6:41 p.m.</i></p>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Changes</h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid \
#b8b5a0"> <tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Cleaned up diff; v1 \
contained an accidental paste.</pre> </td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px \
solid #b8b5a0"> <tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">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.</pre> </td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid \
#b8b5a0"> <tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I haven't even \
built the thing. It's terribad.</pre> </td>
</tr>
</table>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>
<a href="http://bugs.kde.org/show_bug.cgi?id=322567">322567</a>
</div>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> (updated)</h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>src/declarativeimports/draganddrop/DeclarativeMimeData.h <span style="color: \
grey">(ec725af)</span></li>
<li>src/declarativeimports/draganddrop/DeclarativeMimeData.cpp <span style="color: \
grey">(e7cab10)</span></li>
</ul>
<p><a href="http://git.reviewboard.kde.org/r/111748/diff/" style="margin-left: 3em;">View \
Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>
_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic