SHOW:
|
|
- or go back to the newest paste.
1 | void TestClass::walletIsOpen( bool walletIsOpen ) | |
2 | { | |
3 | if( walletIsOpen ){ | |
4 | QVector<lxqt::Wallet::walletKeyValues> s = m_wallet->readAllKeyValues() ; | |
5 | size_t j = s.size() ; | |
6 | for( size_t i = 0 ; i < j ; i++ ){ | |
7 | const QString& key = s.at( i ).getKey() ; | |
8 | const QByteArray& value = s.at( i ).getValue() ; | |
9 | qDebug() << "key=" << key << ":value=" << value ; | |
10 | } | |
11 | }else{ | |
12 | qDebug() << "failed to open wallet" ; | |
13 | } | |
14 | ||
15 | /* | |
16 | * Delete the wallet object when done with it | |
17 | */ | |
18 | m_wallet->deleteLater() ; | |
19 | } | |
20 | ||
21 | void TestClass::testWallet() | |
22 | { | |
23 | /* | |
24 | - | * open a default backend( internal one ) |
24 | + | * open GNOME's libsecret backend |
25 | */ | |
26 | - | m_wallet = lxqt::Wallet::getWalletBackend() ; |
26 | + | m_wallet = lxqt::Wallet::getWalletBackend( lxqt::Wallet::secretServiceBackEnd ) ; |
27 | ||
28 | /* | |
29 | * set the QObject with "walletIsOpen(bool)" slot | |
30 | */ | |
31 | m_wallet->setInterfaceObject( this ) ; | |
32 | ||
33 | /* | |
34 | * open a wallet. | |
35 | * This method will return the result of the attempt though a slot on an object set above. | |
36 | */ | |
37 | m_wallet->open( "test_wallet_name","test_application_name" ) ; | |
38 | } |