Bug 311896

Summary: callDBus always fails for methods with signature containing array of strings
Product: [Plasma] kwin Reporter: Jan Palus <jan.palus>
Component: scriptingAssignee: KWin default assignee <kwin-bugs-null>
Severity: normal    
Priority: NOR    
Version: 4.9.4   
Target Milestone: 4.10   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 4.10
Attachments: Simple fix for string arrays

Description Jan Palus 2012-12-18 18:40:59 UTC
All method arguments passed to callDBus represented by QScriptValue are simply converted to QVariant with QScriptValue.toVariant(). In case of arrays such call results in array of variants. If service declares method signature explicitly and expects array of strings then call will be rejected by message bus. Perfect solution would probably require checking of both method signature and QScriptValue type and do the proper casting, but for quick solution it is safe to assume we prefer array of strings instead of array of variants. See attachment for fix that works for me.

Reproducible: Always

Steps to Reproduce:
1. Try to call method which expects array of strings ie callDBus("org.kde.klauncher","/","org.kde.KLauncher","exec_blind","konsole",new Array())
Comment 1 Jan Palus 2012-12-18 18:41:45 UTC
Created attachment 75905 [details]
Simple fix for string arrays
Comment 2 Martin Flöser 2012-12-29 07:59:11 UTC
could you please open a review request for the patch? I totally missed the patch attached to the report, we only use review board.
Comment 3 Martin Flöser 2013-01-09 07:22:17 UTC
I just reviewed the patch - looks good to me, can go in. Do you have a push privileges? If yes, please push to 4.10 branch, if not please upload a patch exported with
git format-patch 

That will keep your ownership.
Comment 4 Martin Flöser 2013-01-17 08:31:04 UTC
Git commit 5712da0bb06ecfe86017895cbbb72cd5c5551fcd by Martin Gräßlin.
Committed on 17/01/2013 at 09:30.
Pushed by graesslin into branch 'KDE/4.10'.

Support arrays in callDBus method of KWin Scripting

Thanks to Jan Palus for providing the patch.
FIXED-IN: 4.10

M  +6    -1    kwin/scripting/scripting.cpp