Ruby applet dataEngine service operation call

Richard Dale richard.j.dale at gmail.com
Tue Aug 18 14:21:38 CEST 2009


On Tue, Aug 18, 2009 at 12:45 PM, Richard Dale<richard.j.dale at gmail.com> wrote:
> On Tue, Aug 18, 2009 at 9:24 AM, Cédric<kde at xfou.com> wrote:
>> Well,
>>
>> Thanks for your answer Aaron.
>>
>> I think your first suggestion is the write one. I tried to implement this
>> code with the Javascript binding and in the tutorial page
>> (http://techbase.kde.org/Development/Tutorials/Plasma/JavaScript/CheatSheet)
>> they state this :
>>
>> DO NOT use plasmoid.dataEngine("engine name").serviceForSource("source
>> name") - you will get a dummy service back (in 4.2 at least).
>> Instead, use plasmoid.service("engine name", "source name")
>>
>> and so in javascript the second method works but in ruby the service method
>> does not seems to exist.
> As far as I can see serviceForSource() exists in the Ruby bindings and
> should work:
>
> $ rbqtapi -rplasma_applet -mserviceForSource
> Plasma::Service* Plasma::DataEngineScript::serviceForSource(const QString&)
> Plasma::Service* Plasma::DataEngine::serviceForSource(const QString&)
>
> So we are calling in on an actual Plasma::DataEngine here, not a
> DataEngineScript. If I this debugging print out the various items
> created like this:
>
> engine = dataEngine("tasks")
> sources = engine.sources
> pp engine
> p sources
> service = engine.serviceForSource(engine.sources[1])
> pp service
> p service.operationNames
> close_description = service.operationDescription("close")
>  pp close_description
> service.startOperationCall(close_description)
>
> I get:
>
> #<Plasma::DataEngine:0xa8ef8f3c
>  children=Array (15 element(s)),
>  metaObject=#<Qt::MetaObject:0x0 className=TasksEngine,
> superClass=#<Qt::MetaObject:0x0 className=Plasma::DataEngine>>,
>  objectName=Window Information,
>  sources=nil,
>  valid=true,
>  icon=user-desktop>
>
> ["71303776", "65011736", "52428825", "60817446", "16777241",
> "67108924", "69206018", "44040217", "37748765", "27262978",
> "46137441", "58720281", "62914562", "71303343", "56623131"]
>
> #<Plasma::Service:0xa8ef69e4
>  parent=#<TasksEngine:0x0 objectName="Window Information">,
>  metaObject=#<Qt::MetaObject:0x0 className=Plasma::Service,
> superClass=#<Qt::MetaObject:0x0 className=QObject>>,
>  objectName=nil>
>
> []
>
> #<KDE::ConfigGroup:0xa8ef52ec>
>
> So is that Plasma::Service a dummy one? How can I tell? Is doesn't
> seem to have got any operation names associated with it.
When I print out the name of the service I get "NullService", which I
assume is why it doesn't have operations. So what do the bindings need
to do to get a real service back instead?

-- Richard


More information about the Plasma-devel mailing list