Review Request 110965: fix broken conversion of results from koscript code evaluation in KRScriptHandler::evaluate()
Friedrich W. H. Kossebau
kossebau at kde.org
Sat Jun 15 02:00:53 BST 2013
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/110965/
-----------------------------------------------------------
(Updated June 15, 2013, 1 a.m.)
Status
------
This change has been discarded.
Review request for Calligra, Sebastian Sauer and Jarosław Staniek.
Description
-------
How to see the symptom which hopefully is fixed at its root:
1. Start Plan, create a new project from the Simple->Plain template
2. Click "Edit Main Project"
3. Enter some non-latin1 text for the Name: and Manager: fields, close dialog with Okay
4. Select the view "Task Status Report" (last in list in docker)
5. See how the non-latin1 characters are wrongly rendered at the top of the report page.
I could not find in any documentation that the result of Kross::Action::evaluate() can not be simply converted into a QString, but instead needs to be converted to a QByteArray and then converted via QString::fromUtf8.
KPlato::ReportWidget::slotRefreshView() registers KPlato::ProjectAccess as script object which feeds "Name" and "Manager" as QString, not encoded into QByteArray. Thus the attached patch fixes the above behaviour.
Jaros?aw, you introduced that behaviour in 8694fc63ae51f2f6f89514d5816187d8907cf2a5 as fix for https://bugs.kde.org/show_bug.cgi?id=277731
But I think you misunderstood Sebastian, he possibly only meant to do the explicit conversion for the "code" parameter, not the result. So this patch also undoes that explixit conversion to QByteArray if a string in KRScriptFunctions::value(...).
Sebastian, can you confirm that only the parameter "code" needs to be given as QByteArray text (in UTF-8 encoding), while the QVariant result of the method should contain normal QStrings if those are the result of the evaluation?
Diffs
-----
kexi/plugins/reports/krscriptfunctions.cpp b25b92d
libs/koreport/renderer/scripting/krscripthandler.cpp 833f4f3
Diff: http://git.reviewboard.kde.org/r/110965/diff/
Testing
-------
Thanks,
Friedrich W. H. Kossebau
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/calligra-devel/attachments/20130615/00d9a735/attachment.htm>
More information about the calligra-devel
mailing list