How a non-KDE application access Kwallet

Thiago Macieira thiago at
Mon Mar 28 12:54:29 BST 2005

Suryanarayanan Rajaram wrote:
>Thanks for the answer.
>I am pasting here the stack trace for the crash when KApplication is not
>Also please find the snippet of my code sequence below..
>So is there no way for me to access kwallet secrets without linking to

There's no way to use the KWallet classes in KDE without creating a 
KApplication or a KInstance because it will crash with the backtrace 

>#0  0x40a4b062 in KInstance::dirs () from /opt/kde3/lib/

I am pretty sure this frame has this == 0x0.

>#1  0x40a4b0f2 in KGlobal::dirs () from /opt/kde3/lib/
>#2  0x40a75fc4 in KConfigBackEnd::changeFileName () from
>#3  0x40a76287 in KConfigBackEnd::KConfigBackEnd () from
>#4  0x40a77f8b in KConfig::KConfig () from /opt/kde3/lib/
>#5  0x4003cc54 in KWallet::Wallet::NetworkWallet () from
>#6  0x0804a099 in DCOPDemoWidget::setKWalletSecret (this=0x8050968) at
>#7  0x0804a2a5 in main (argc=1, argv=0xbfffe894) at mytest.cpp:169
>(gdb) quit

You need at least a KInstance object in order to use the wallet and config 
classes. A KApplication is not necessary, but is sufficient.

>DCOP should still work without a KApplication, but it definitely
>requires linking to Qt.

DCOP is a protocol. You can use it without Qt. What you can't use without 
Qt is the DCOPObject class and libdcop library that comes with KDE.

I think there are other bindings to DCOP available, but I am not sure the 
state they are in.

  Thiago Macieira  -  thiago (AT) macieira (DOT) info
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

3. Ac seo woruld wearð geborod, swá se Scieppend cweað "Gewurde Unix" and 
wundor fremede and him "Unix" genemned, þæt is se rihtendgesamnung.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <>

More information about the kde-core-devel mailing list