Question

I'm writing a kde plasmoid using qml. It's a widget, displaying mobile usage for one of largets mobile priveders in our country, using the api provided by the operater. In order to get the data one must do a request using phone number + password and I'd like to use kwallet to store "accounts" in some kwallet's folder for this widget. The question is, how do I use kwallet in qml/javascript based widget, if it is even possible? I can't find any info on the web. I found this plasmoid using kwallet: http://kde-look.org/content/show.php/gmail-plasmoid?content=101229 but this one is written in python and is importing some python kde libs, so I can't really use that. Any suggestions or even links to some usefull api would be great.

Was it helpful?

Solution

Kwallet can be accessed using qdbus on the command-line. And apparently there is a way to make command-line calls in Javascript plasmoids using the extension LaunchApp, like this:

Button {
    onButtonClick: plasmoid.runCommand("qdbus",
        ["<add-missing-parameters-here>"]);
}

For the extension to work, you need to add this line to your desktop file:

X-Plasma-RequiredExtensions=LaunchApp

The exact command-line calls go something like this:

  1. Make a call to open the wallet

    qdbus org.kde.kwalletd /modules/kwalletd org.kde.KWallet.open <wallet name> 0 "<your application name>"
    
  2. Use the returned ID to acess a password

    qdbus org.kde.kwalletd /modules/kwalletd readPasswordList <wallet-id> kmail "<entry name>" "<your application name>"
    

I haven't tried any of this, but theoretically it could work.

Links:

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top