[KDE/Mac] more doodling around the OS X keychain integration: programming exercise, yay!

Ian Wadham iandw.au at gmail.com
Thu Sep 11 06:04:35 UTC 2014


Hi René,

On 10/09/2014, at 12:16 AM, René J.V. Bertin wrote:
> I keep tweaking this baby of mine. I think  my idle timer close feature is about functional now, at least if there's only 1 application working with a wallet. That's rarely the case, so I still have to think up something to prevent an "infrequent" wallet user from generating a timeout that will close the wallet on a more frequent user. That could probably be done with a "timeLastAccessed" member variable that lives in shared memory, and that is checked against the timeout value when an idle timer has triggered.
> 
> There's also the fact IMHO that if application A closes a wallet (say at exit), this should not affect application B that also has the wallet open. In other words, I should heed (reinterpret) the kwallet setting "close when last app exits" ... and that will require maintaining a registry in shared memory.

FWIW, Dr Konqi contains the following two pieces of code…

void BugzillaLoginPage::openWallet()
{
   //Store if the wallet was previously opened so we can know if we should close it later
   m_walletWasOpenedBefore = KWallet::Wallet::isOpen(KWallet::Wallet::NetworkWallet());
   //Request open the wallet
   m_wallet = KWallet::Wallet::openWallet(KWallet::Wallet::NetworkWallet(),
                                   static_cast<QWidget*>(this->parent())->winId());
}

and later… ----------------------------------------------------------------------------

       if (m_wallet) {
           if (m_wallet->isOpen() && !m_walletWasOpenedBefore) {
               m_wallet->lockWallet();
           }
       }

Crude, but effective(?).  I wonder if all wallet-using KDE apps do that?

> Of course KDE already has that in the regular wallet implementation, using DBus and kwalletd (i.e. IPC via messages). As said earlier, this doesn't work properly (yet) in kwallet_mac (I can see the kwalletd signals and methods in qdbusviewer, but messages don't pass). And frankly, I'd prefer not to require a daemon - not as long as it gets build as a GUI application in any case.
> 
> The only shared memory work I have done till now was either on machines that only had shared memory (my beloved old Amiga), and more recently, sharing of fixed-size objects between threads of a single application. For that I simply overloaded the new operator …

Heh, heh!  I liked the Amiga too.  I still have my old Amiga 500 and it still works… :-)

Cheers, Ian W.



More information about the kde-mac mailing list