This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Javascript Plasma settings and KUrlRequester

Tags: None
(comma "," separated)
marriedto51
Registered Member
Posts
3
Karma
0
OS
First of all, apologies if this is in the wrong forum.

I am trying to write a simple plasmoid using the Javascript API, and would like to include a KUrlRequester widget in the configuration UI, but cannot find any way of reading the URL that the user picks.

So far, as a test, I have added the following function definition in the Javascript:
Code: Select all
plasmoid.configChanged = function()
{
    print("Reading options...");
    cfg_KUrlRequester = plasmoid.readConfig("KUrlRequesterInput");
    print("  KUrlRequester = '" + cfg_KUrlRequester + "'");
}

which clearly does nothing useful except report the value to the terminal.

My config.ui file has:
Code: Select all
<ui version="4.0">
...
   <widget class="KUrlRequester" name="kcfg_KUrlRequesterInput"/>
...
</ui>

and the Kcfg file has:
Code: Select all
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
                          http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
  <kcfgfile/>
  <group>
    <entry name="KUrlRequesterInput" type="Path">
      <label>URL</label>
      <default></default>
    </entry>
  </group>
</kcfg>


When I run the plasmoid, the configuration UI is rendered correctly, but no matter what value I enter in the URL requester, the script always prints the empty string as the result of the call to plasmoid.readConfig().

I have found I can readily read values of type String from KLineEdit widgets, or Boolean values from QRadioButton widgets, but this one is defeating me.

Any help would be greatly appreciated! Thanks in advance.
marriedto51
Registered Member
Posts
3
Karma
0
OS
Further to my original post: I think this is a gap in the Plasma Javascript API.

If I make the fairly simple changes to embed my Javascript in an HTML file, change the config/main.xml file to have
Code: Select all
    <entry name="KUrlRequesterInput" type="Url">

and use the webkit API instead, then the KUrlRequester widget on the configuration dialog works as I would expect.

Also, converting the script to Python (rather harder for me because I know nothing about Python!) seems to work as expected.

It's not clear to me whether this is a bug in the Plasma Javascript API, or just something that hasn't been written (or perhaps not yet).
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
I suggest you ask about this problem on kde-devel@kde.org as this definitely appears to be a bug.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
marriedto51
Registered Member
Posts
3
Karma
0
OS
Thanks for the pointer.


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot], ourcraft