• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KDEUI

  • kdeui
  • util
kwallet_mac.cpp
Go to the documentation of this file.
1/* This file is part of the KDE project
2 *
3 * Copyright (C) 2002-2004 George Staikos <staikos@kde.org>
4 * Copyright (C) 2008 Michael Leupold <lemma@confuego.org>
5 * Copyright (C) 2010 Frank Osterfeld <osterfeld@kde.org>
6 * Copyright (C) 2014 René Bertin <rjvbertin@gmail.com>
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
17 *
18 * You should have received a copy of the GNU Library General Public License
19 * along with this library; see the file COPYING.LIB. If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
22 */
23
24#include "kwallet.h"
25#include <ksharedconfig.h>
26#include <kdebug.h>
27#include <kdeversion.h>
28#include <QtGui/QApplication>
29#include <QtCore/QPointer>
30#include <QtGui/QWidget>
31#include <ktoolinvocation.h>
32
33#include <kglobal.h>
34#include <kcomponentdata.h>
35#include <kaboutdata.h>
36#include <kconfiggroup.h>
37
38#include <cassert>
39
40#include <sys/param.h>
41
42#include "qosxkeychain.h"
43
44using namespace KWallet;
45
46typedef QMap<QString, QString> StringStringMap;
47Q_DECLARE_METATYPE(StringStringMap)
48typedef QMap<QString, StringStringMap> StringToStringStringMapMap;
49Q_DECLARE_METATYPE(StringToStringStringMapMap)
50typedef QMap<QString, QByteArray> StringByteArrayMap;
51Q_DECLARE_METATYPE(StringByteArrayMap)
52
53#ifdef OSX_KEYCHAIN_PORT_DISABLED
54static QString appid()
55{
56 KComponentData cData = KGlobal::mainComponent();
57 if (cData.isValid()) {
58 const KAboutData* aboutData = cData.aboutData();
59 if (aboutData) {
60 return aboutData->programName();
61 }
62 return cData.componentName();
63 }
64 return qApp->applicationName();
65}
66#endif
67
68/*static*/ const QString Wallet::LocalWallet()
69{
70 KConfigGroup cfg(KSharedConfig::openConfig("kwalletrc")->group("Wallet"));
71 if (!cfg.readEntry("Use One Wallet", true)) {
72 QString tmp = cfg.readEntry("Local Wallet", "localwallet");
73 if (tmp.isEmpty()) {
74 return "localwallet";
75 }
76 return tmp;
77 }
78
79 QString tmp = cfg.readEntry("Default Wallet", "kdewallet");
80 if (tmp.isEmpty()) {
81 return "kdewallet";
82 }
83 return tmp;
84}
85
86/*static*/ const QString Wallet::NetworkWallet()
87{
88 KConfigGroup cfg(KSharedConfig::openConfig("kwalletrc")->group("Wallet"));
89
90 QString tmp = cfg.readEntry("Default Wallet", "kdewallet");
91 if (tmp.isEmpty()) {
92 return "kdewallet";
93 }
94 return tmp;
95}
96
97/*static*/ const QString Wallet::PasswordFolder()
98{
99 return "Passwords";
100}
101
102/*static*/ const QString Wallet::FormDataFolder()
103{
104 return "Form Data";
105}
106
107#pragma mark ==== Wallet::WalletPrivate ====
108class Wallet::WalletPrivate : public OSXKeychain
109{
110public:
111 explicit WalletPrivate(const QString &n)
112 : OSXKeychain(n)
113 {
114 isKDEChain = ( n == LocalWallet() || n == NetworkWallet() || n.contains( "wallet", Qt::CaseInsensitive ) );
115 }
116
117 // needed for compilation reasons
118 void walletServiceUnregistered()
119 {
120 }
121};
122
123Wallet::Wallet(int handle, const QString& name)
124 : QObject(0L), d(new WalletPrivate(name))
125{
126 Q_UNUSED(handle);
127}
128
129Wallet::~Wallet()
130{
131 delete d;
132}
133
134/*static*/ QStringList Wallet::walletList()
135{
136#ifdef OSX_KEYCHAIN_PORT_DISABLED
137 return walletLauncher->getInterface().wallets();
138#else
139 // RJVB: Mac OS X's Keychain supports multiple keychains, but they can only be accesses by full path, not
140 // found by name. That makes it cumbersome to map to multiple wallets when using only the wallet name.
141 // However, it would be perfectly possible to create OS X Keychains called Wallet::LocalWallet() and
142 // Wallet::NetworkWallet() in the equivalent of ~/.kde/share/apps/kwallet .
143 QStringList l;
144 OSXKeychain::KeychainList(l);
145 return l;
146#endif
147}
148
149
150/*static*/ void Wallet::changePassword(const QString& name, WId w)
151{
152#ifdef OSX_KEYCHAIN_PORT_DISABLED
153 if( w == 0 )
154 kDebug(285) << "Pass a valid window to KWallet::Wallet::changePassword().";
155 walletLauncher->getInterface().changePassword(name, (qlonglong)w, appid());
156#else
157 Q_UNUSED(w);
158 kWarning() << "Wallet::changePassword unimplemented '" << name << "'";
159#endif
160}
161
162
163/*static*/ bool Wallet::isEnabled()
164{
165 //PENDING(frank) check
166 return true;
167}
168
169
170/*static*/ bool Wallet::isOpen(const QString& name)
171{
172#ifdef OSX_KEYCHAIN_PORT_DISABLED
173 return walletLauncher->getInterface().isOpen(name); // default is false
174#else
175 return OSXKeychain::IsOpen(name);
176#endif
177}
178
179bool Wallet::isOpen() const
180{
181#ifdef OSX_KEYCHAIN_PORT_DISABLED
182 return d->handle != -1;
183#else
184 return d->isOpen();
185#endif
186}
187
188
189/*static*/ int Wallet::closeWallet(const QString& name, bool force)
190{
191#ifdef OSX_KEYCHAIN_PORT_DISABLED
192 QDBusReply<int> r = walletLauncher->getInterface().close(name, force);
193 return r.isValid() ? r : -1;
194#else
195 Q_UNUSED(force);
196 return OSXKeychain::Lock(name);
197#endif
198}
199
200
201/*static*/ int Wallet::deleteWallet(const QString& name)
202{
203#ifdef OSX_KEYCHAIN_PORT_DISABLED
204 QDBusReply<int> r = walletLauncher->getInterface().deleteWallet(name);
205 return r.isValid() ? r : -1;
206#else
207 return OSXKeychain::Destroy(name);
208#endif
209}
210
211
212/*static*/ Wallet *Wallet::openWallet(const QString& name, WId w, OpenType ot)
213{
214 Q_UNUSED(w);
215 Q_UNUSED(ot);
216 Wallet *wallet = new Wallet(-1, name);
217 QMetaObject::invokeMethod( wallet, "emitWalletOpened", Qt::QueuedConnection );
218 OSStatus err = wallet->d->unLock();
219 kDebug() << "Opened wallet '" << name << "': " << wallet << " error=" << err;
220 return wallet;
221}
222
223
224/*static*/ bool Wallet::disconnectApplication(const QString& wallet, const QString& app)
225{
226#ifdef OSX_KEYCHAIN_PORT_DISABLED
227 return walletLauncher->getInterface().disconnectApplication(wallet, app); // default is false
228#else
229 kWarning() << "Wallet::disconnectApplication unimplemented, '" << app << "' from '" << wallet << "'";
230 return true;
231#endif
232}
233
234
235/*static*/ QStringList Wallet::users(const QString& name)
236{
237#ifdef OSX_KEYCHAIN_PORT_DISABLED
238 return walletLauncher->getInterface().users(name); // default is QStringList()
239#else
240 kWarning() << "Wallet::users unimplemented, '" << name << "'";
241 return QStringList();
242#endif
243}
244
245
246int Wallet::sync()
247{
248#ifdef OSX_KEYCHAIN_PORT_DISABLED
249 if (d->handle == -1) {
250 return -1;
251 }
252
253 walletLauncher->getInterface().sync(d->handle, appid());
254#endif
255 return 0;
256}
257
258
259int Wallet::lockWallet()
260{
261#ifdef OSX_KEYCHAIN_PORT_DISABLED
262 if (d->handle == -1) {
263 return -1;
264 }
265
266 QDBusReply<int> r = walletLauncher->getInterface().close(d->handle, true, appid());
267 d->handle = -1;
268 d->folder.clear();
269 d->name.clear();
270 if (r.isValid()) {
271 return r;
272 }
273#else
274 d->currentService.clear();
275#endif
276 return d->lock();
277}
278
279
280const QString& Wallet::walletName() const
281{
282 return d->name;
283}
284
285
286void Wallet::requestChangePassword(WId w)
287{
288#ifdef OSX_KEYCHAIN_PORT_DISABLED
289 if( w == 0 )
290 kDebug(285) << "Pass a valid window to KWallet::Wallet::requestChangePassword().";
291 if (d->handle == -1) {
292 return;
293 }
294
295 walletLauncher->getInterface().changePassword(d->name, (qlonglong)w, appid());
296#else
297 Q_UNUSED(w);
298 kWarning() << "Wallet::requestChangePassword unimplemented '" << d->name << "'";
299#endif
300}
301
302
303void Wallet::slotWalletClosed(int handle)
304{
305#ifdef OSX_KEYCHAIN_PORT_DISABLED
306 if (d->handle == handle) {
307 d->handle = -1;
308 d->folder.clear();
309 d->name.clear();
310 emit walletClosed();
311 }
312#else
313 Q_UNUSED(handle);
314 kWarning() << "Wallet::slotWalletClosed unimplemented '" << d->name << "'";
315 d->currentService.clear();
316#endif
317}
318
319
320QStringList Wallet::folderList()
321{
322#ifdef OSX_KEYCHAIN_PORT_DISABLED
323 if (d->handle == -1) {
324 return QStringList();
325 }
326
327 QDBusReply<QStringList> r = walletLauncher->getInterface().folderList(d->handle, appid());
328 return r;
329#else
330 return QStringList(d->folderList());
331#endif
332}
333
334
335QStringList Wallet::entryList()
336{
337#ifdef OSX_KEYCHAIN_PORT_DISABLED
338 if (d->handle == -1) {
339 return QStringList();
340 }
341
342 QDBusReply<QStringList> r = walletLauncher->getInterface().entryList(d->handle, d->folder, appid());
343 return r;
344#else
345 QStringList r = QStringList();
346 d->itemList(r);
347 return r;
348#endif
349}
350
351
352bool Wallet::hasFolder(const QString& f)
353{
354#ifdef OSX_KEYCHAIN_PORT_DISABLED
355 if (d->handle == -1) {
356 return false;
357 }
358
359 QDBusReply<bool> r = walletLauncher->getInterface().hasFolder(d->handle, f, appid());
360 return r; // default is false
361#else
362 d->folderList();
363 return d->serviceList.contains(f);
364#endif
365}
366
367
368bool Wallet::createFolder(const QString& f)
369{
370#ifdef OSX_KEYCHAIN_PORT_DISABLED
371 if (d->handle == -1) {
372 return false;
373 }
374
375 if (!hasFolder(f)) {
376 QDBusReply<bool> r = walletLauncher->getInterface().createFolder(d->handle, f, appid());
377 return r;
378 }
379
380 return true; // folder already exists
381#else
382 return setFolder(f);
383#endif
384}
385
386
387bool Wallet::setFolder(const QString &f)
388{
389#ifdef OSX_KEYCHAIN_PORT_DISABLED
390 bool rc = false;
391
392 if (d->handle == -1) {
393 return rc;
394 }
395
396 // Don't do this - the folder could have disappeared?
397#if 0
398 if (f == d->folder) {
399 return true;
400 }
401#endif
402
403 if (hasFolder(f)) {
404 d->folder = f;
405 rc = true;
406 }
407
408 return rc;
409#else
410 // act as if we just changed folders even if we have no such things; the property
411 // is stored as the ServiceItemAttr (which shows up as the "Where" field in the Keychain Utility).
412 if( f.size() == 0 ){
413 d->currentService.clear();
414 }
415 else{
416 d->currentService = QString(f);
417 }
418 return true;
419#endif
420}
421
422
423bool Wallet::removeFolder(const QString& f)
424{
425#ifdef OSX_KEYCHAIN_PORT_DISABLED
426 if (d->handle == -1) {
427 return false;
428 }
429
430 QDBusReply<bool> r = walletLauncher->getInterface().removeFolder(d->handle, f, appid());
431 if (d->folder == f) {
432 setFolder(QString());
433 }
434
435 return r; // default is false
436#else
437 kWarning() << "Wallet::removeFolder unimplemented (returns true) '" << d->name << "'";
438 if( d->currentService == f ){
439 d->currentService.clear();
440 }
441 return true;
442#endif
443}
444
445
446const QString& Wallet::currentFolder() const
447{
448#ifdef OSX_KEYCHAIN_PORT_DISABLED
449 return d->folder;
450#else
451 return d->currentService;
452#endif
453}
454
455
456int Wallet::readEntry(const QString &key, QByteArray &value)
457{ OSStatus err = d->readItem( key, &value, NULL );
458 kDebug() << "Wallet::readEntry '" << key << "' from wallet " << d->name << ", error=" << ((err)? -1 : 0);
459 return (err)? -1 : 0;
460}
461
462
463int Wallet::readEntryList(const QString& key, QMap<QString, QByteArray>& value)
464{
465#ifdef OSX_KEYCHAIN_PORT_DISABLED
466 registerTypes();
467
468 int rc = -1;
469
470 if (d->handle == -1) {
471 return rc;
472 }
473
474 QDBusReply<QVariantMap> r = walletLauncher->getInterface().readEntryList(d->handle, d->folder, key, appid());
475 if (r.isValid()) {
476 rc = 0;
477 // convert <QString, QVariant> to <QString, QByteArray>
478 const QVariantMap val = r.value();
479 for( QVariantMap::const_iterator it = val.begin(); it != val.end(); ++it ) {
480 value.insert(it.key(), it.value().toByteArray());
481 }
482 }
483
484 return rc;
485#else
486 Q_UNUSED(key);
487 Q_UNUSED(value);
488 kWarning() << "Wallet::readEntryList unimplemented (returns -1) '" << d->name << "'";
489 return -1;
490#endif
491}
492
493
494int Wallet::renameEntry(const QString& oldName, const QString& newName)
495{
496#ifdef OSX_KEYCHAIN_PORT_DISABLED
497 int rc = -1;
498
499 if (d->handle == -1) {
500 return rc;
501 }
502
503 QDBusReply<int> r = walletLauncher->getInterface().renameEntry(d->handle, d->folder, oldName, newName, appid());
504 if (r.isValid()) {
505 rc = r;
506 }
507
508 return rc;
509#else
510 return d->renameItem( oldName, newName );
511#endif
512}
513
514
515int Wallet::readMap(const QString &key, QMap<QString,QString> &value)
516{
517 QByteArray v;
518 const int ret = (d->readItem( key, &v, NULL ))? -1 : 0;
519 if( ret != 0 ){
520 return ret;
521 }
522 if( !v.isEmpty() ){
523 QByteArray w = QByteArray::fromBase64(v);
524 QDataStream ds( &w, QIODevice::ReadOnly );
525 ds >> value;
526 }
527 kDebug() << "Wallet::readMap '" << key << "' from wallet " << d->name << ", error=0";
528 return 0;
529}
530
531
532int Wallet::readMapList(const QString& key, QMap<QString, QMap<QString, QString> >& value)
533{
534#ifdef OSX_KEYCHAIN_PORT_DISABLED
535 registerTypes();
536
537 int rc = -1;
538
539 if (d->handle == -1) {
540 return rc;
541 }
542
543 QDBusReply<QVariantMap> r =
544 walletLauncher->getInterface().readMapList(d->handle, d->folder, key, appid());
545 if (r.isValid()) {
546 rc = 0;
547 const QVariantMap val = r.value();
548 for( QVariantMap::const_iterator it = val.begin(); it != val.end(); ++it ) {
549 QByteArray mapData = it.value().toByteArray();
550 if (!mapData.isEmpty()) {
551 QDataStream ds(&mapData, QIODevice::ReadOnly);
552 QMap<QString,QString> v;
553 ds >> v;
554 value.insert(it.key(), v);
555 }
556 }
557 }
558
559 return rc;
560#else
561 Q_UNUSED(key);
562 Q_UNUSED(value);
563 kWarning() << "Wallet::readMapList unimplemented (returns -1) '" << d->name << "'";
564 return -1;
565#endif
566}
567
568
569int Wallet::readPassword(const QString& key, QString& value)
570{
571 QByteArray ba;
572 const int ret = (d->readItem( key, &ba, NULL ))? -1 : 0;
573 if ( ret == 0 ){
574 value = QString::fromUtf8( ba.constData() );
575 }
576 kDebug() << "Wallet::readPassword '" << key << "' from wallet " << d->name << ", error=" << ret;
577 return ret;
578}
579
580
581int Wallet::readPasswordList(const QString& key, QMap<QString, QString>& value)
582{
583 Q_UNUSED(key);
584 Q_UNUSED(value);
585 kWarning() << "Wallet::readPasswordList unimplemented (returns -1) '" << d->name << "'";
586 return -1;
587}
588
589int Wallet::writeEntry(const QString& key, const QByteArray& password )
590{ int ret = d->writeItem( key, password );
591 kDebug() << "wrote entry '" << key << "' to wallet " << d->name << ", error=" << ret;
592 return ret;
593}
594
595int Wallet::writeEntry(const QString& key, const QByteArray& password, EntryType entryType)
596{
597 OSXKeychain::EntryType entryCode;
598 switch( entryType ){
599 case Wallet::Password:
600 entryCode = OSXKeychain::Password;
601 break;
602 case Wallet::Map:
603 entryCode = OSXKeychain::Map;
604 break;
605 case Wallet::Stream:
606 entryCode = OSXKeychain::Stream;
607 break;
608 default:
609 entryCode = OSXKeychain::Unknown;
610 break;
611 }
612 int ret = d->writeItem( key, password, &entryCode );
613 kDebug() << "wrote entry '" << key << "' of type=" << (int) entryType << "to wallet " << d->name << ", error=" << ret;
614 return ret;
615}
616
617int Wallet::writeMap(const QString& key, const QMap<QString,QString>& value)
618{
619 QByteArray mapData;
620 QDataStream ds(&mapData, QIODevice::WriteOnly);
621 ds << value;
622 OSXKeychain::EntryType etype = OSXKeychain::Map;
623 int ret = d->writeItem( key, mapData.toBase64(),
624 "This is a KDE Wallet::Map item. Its password\n"
625 "cannot be read in the OS X Keychain Utility.\n"
626 "Use KDE's own kwalletmanager for that.", &etype );
627 kDebug() << "wrote map '" << key << "' to wallet " << d->name << ", error=" << ret;
628 return ret;
629}
630
631
632int Wallet::writePassword(const QString &key, const QString& value)
633{ OSXKeychain::EntryType etype = OSXKeychain::Password;
634 int ret = d->writeItem( key, value.toUtf8(), &etype );
635 kDebug() << "wrote password '" << key << "' to wallet " << d->name << ", error=" << ret;
636 return ret;
637}
638
639
640bool Wallet::hasEntry(const QString &key)
641{ bool ret = d->hasItem( key, NULL );
642 kDebug() << "wallet '" << d->name << "'" << ((ret)? " has" : " does not have") << " entry '" << key << "'";
643 return ret;
644}
645
646int Wallet::removeEntry(const QString& key)
647{ int ret = d->removeItem( key );
648 kDebug() << "removed entry '" << key << "' from wallet " << d->name << ", error=" << ret;
649 return ret;
650}
651
652
653Wallet::EntryType Wallet::entryType(const QString& key)
654{
655#ifdef OSX_KEYCHAIN_PORT_DISABLED
656 int rc = 0;
657
658 if (d->handle == -1) {
659 return Wallet::Unknown;
660 }
661
662 QDBusReply<int> r = walletLauncher->getInterface().entryType(d->handle, d->folder, key, appid());
663 if (r.isValid()) {
664 rc = r;
665 }
666
667 return static_cast<EntryType>(rc);
668#else
669 // RJVB: a priori, entries are always 'password' on OS X, but since we also do use them for storing
670 // maps, it may be best to return Wallet::Unknown to leave some uncertainty and not mislead our caller.
671 OSXKeychain::EntryType etype;
672 if( !d->itemType( key, &etype ) ){
673 switch( etype ){
674 case OSXKeychain::Password:
675 return Wallet::Password;
676 break;
677 case OSXKeychain::Map:
678 return Wallet::Map;
679 break;
680 case OSXKeychain::Stream:
681 return Wallet::Stream;
682 break;
683 }
684 }
685 return Wallet::Unknown;
686#endif
687}
688
689
690void Wallet::slotFolderUpdated(const QString& wallet, const QString& folder)
691{
692 if (d->name == wallet) {
693 emit folderUpdated(folder);
694 }
695}
696
697
698void Wallet::slotFolderListUpdated(const QString& wallet)
699{
700 if (d->name == wallet) {
701 emit folderListUpdated();
702 }
703}
704
705
706void Wallet::slotApplicationDisconnected(const QString& wallet, const QString& application)
707{
708#ifdef OSX_KEYCHAIN_PORT_DISABLED
709 if (d->handle >= 0
710 && d->name == wallet
711 && application == appid()) {
712 slotWalletClosed(d->handle);
713 }
714#else
715 Q_UNUSED(wallet);
716 Q_UNUSED(application);
717 kWarning() << "Wallet::slotApplicationDisconnected unimplemented '" << d->name << "'";
718#endif
719}
720
721void Wallet::walletAsyncOpened(int tId, int handle)
722{
723#ifdef OSX_KEYCHAIN_PORT_DISABLED
724 // ignore responses to calls other than ours
725 if (d->transactionId != tId || d->handle != -1) {
726 return;
727 }
728
729 // disconnect the async signal
730 disconnect(this, SLOT(walletAsyncOpened(int,int)));
731
732 d->handle = handle;
733 emit walletOpened(handle > 0);
734#else
735 Q_UNUSED(tId);
736 Q_UNUSED(handle);
737 kWarning() << "Wallet::walletAsyncOpened unimplemented '" << d->name << "'";
738#endif
739}
740
741void Wallet::emitWalletAsyncOpenError()
742{
743 emit walletOpened(false);
744}
745
746void Wallet::emitWalletOpened()
747{
748 emit walletOpened(true);
749}
750
751
752bool Wallet::folderDoesNotExist(const QString& wallet, const QString& folder)
753{
754#ifdef OSX_KEYCHAIN_PORT_DISABLED
755 QDBusReply<bool> r = walletLauncher->getInterface().folderDoesNotExist(wallet, folder);
756 return r;
757#else
758 bool ret = true;
759 if( Wallet::walletList().contains(wallet) ){
760 ret = !Wallet(-1, wallet).hasFolder(folder);
761 }
762 return ret;
763#endif
764}
765
766
767bool Wallet::keyDoesNotExist(const QString& wallet, const QString& folder, const QString& key)
768{
769#ifdef OSX_KEYCHAIN_PORT_DISABLED
770 QDBusReply<bool> r = walletLauncher->getInterface().keyDoesNotExist(wallet, folder, key);
771 return r;
772#else
773 bool ret = true;
774 if( Wallet::walletList().contains(wallet) ){
775 Wallet w(-1, wallet);
776 if( w.hasFolder(folder) ){
777 ret = !w.hasEntry(key);
778 }
779 }
780 return ret;
781#endif
782}
783
784void Wallet::slotCollectionStatusChanged(int status)
785{
786 Q_UNUSED(status);
787 kWarning() << "Wallet::slotCollectionStatusChanged unimplemented '" << d->name << "' status=" << status;
788}
789
790void Wallet::slotCollectionDeleted()
791{
792#ifdef OSX_KEYCHAIN_PORT_DISABLED
793 d->folder.clear();
794#else
795 d->currentService.clear();
796#endif
797 kDebug() << "Wallet::slotCollectionDeleted: closing private data '" << d->name;
798 d->close();
799 emit walletClosed();
800}
801
802
803void Wallet::virtual_hook(int, void*)
804{
805 //BASE::virtual_hook( id, data );
806}
807
808#include "kwallet.moc"
KAboutData
KAboutData::programName
QString programName() const
KComponentData
KComponentData::isValid
bool isValid() const
KComponentData::componentName
QString componentName() const
KComponentData::aboutData
const KAboutData * aboutData() const
KConfigGroup
KSharedConfig::openConfig
static KSharedConfig::Ptr openConfig(const KComponentData &componentData, const QString &fileName=QString(), OpenFlags mode=FullConfig, const char *resourceType="config")
KWallet::Wallet
KDE Wallet.
Definition: kwallet.h:63
KWallet::Wallet::PasswordFolder
static const QString PasswordFolder()
The standardized name of the password folder.
Definition: kwallet.cpp:138
KWallet::Wallet::readEntryList
int readEntryList(const QString &key, QMap< QString, QByteArray > &value)
Read the entries matching key from the current folder.
Definition: kwallet.cpp:1078
KWallet::Wallet::Wallet
Wallet(int handle, const QString &name)
Construct a KWallet object.
Definition: kwallet.cpp:243
KWallet::Wallet::virtual_hook
virtual void virtual_hook(int id, void *data)
Definition: kwallet.cpp:1658
KWallet::Wallet::renameEntry
virtual int renameEntry(const QString &oldName, const QString &newName)
Rename the entry oldName to newName.
Definition: kwallet.cpp:1111
KWallet::Wallet::sync
virtual int sync()
This syncs the wallet file on disk with what is in memory.
Definition: kwallet.cpp:605
KWallet::Wallet::createFolder
virtual bool createFolder(const QString &f)
Created the folder f.
Definition: kwallet.cpp:849
KWallet::Wallet::lockWallet
virtual int lockWallet()
This closes and locks the current wallet.
Definition: kwallet.cpp:624
KWallet::Wallet::users
static QStringList users(const QString &wallet)
List the applications that are using the wallet wallet.
Definition: kwallet.cpp:583
KWallet::Wallet::removeEntry
virtual int removeEntry(const QString &key)
Remove the entry key from the current folder.
Definition: kwallet.cpp:1439
KWallet::Wallet::folderUpdated
void folderUpdated(const QString &folder)
Emitted when a folder in this wallet is updated.
KWallet::Wallet::closeWallet
static int closeWallet(const QString &name, bool force)
Close the wallet name.
Definition: kwallet.cpp:403
KWallet::Wallet::hasEntry
virtual bool hasEntry(const QString &key)
Determine if the current folder has they entry key.
Definition: kwallet.cpp:1413
KWallet::Wallet::folderList
virtual QStringList folderList()
Obtain the list of all folders contained in the wallet.
Definition: kwallet.cpp:727
KWallet::Wallet::~Wallet
virtual ~Wallet()
Destroy a KWallet object.
Definition: kwallet.cpp:272
KWallet::Wallet::walletList
static QStringList walletList()
List all the wallets available.
Definition: kwallet.cpp:299
KWallet::Wallet::isOpen
virtual bool isOpen() const
Determine if the current wallet is open, and is a valid wallet handle.
Definition: kwallet.cpp:666
KWallet::Wallet::NetworkWallet
static const QString NetworkWallet()
The name of the wallet used to store network passwords.
Definition: kwallet.cpp:127
KWallet::Wallet::currentFolder
virtual const QString & currentFolder() const
Determine the current working folder in the wallet.
Definition: kwallet.cpp:968
KWallet::Wallet::walletClosed
void walletClosed()
Emitted when this wallet is closed.
KWallet::Wallet::deleteWallet
static int deleteWallet(const QString &name)
Delete the wallet name.
Definition: kwallet.cpp:426
KWallet::Wallet::folderListUpdated
void folderListUpdated()
Emitted when the folder list is changed in this wallet.
KWallet::Wallet::writeEntry
virtual int writeEntry(const QString &key, const QByteArray &value, EntryType entryType)
Write key = value as a binary entry to the current folder.
Definition: kwallet.cpp:1308
KWallet::Wallet::readPasswordList
int readPasswordList(const QString &key, QMap< QString, QString > &value)
Read the password entry key from the current folder.
Definition: kwallet.cpp:1277
KWallet::Wallet::hasFolder
virtual bool hasFolder(const QString &f)
Determine if the folder f exists in the wallet.
Definition: kwallet.cpp:820
KWallet::Wallet::changePassword
static void changePassword(const QString &name, WId w)
Request to the wallet service to change the password of the wallet name.
Definition: kwallet.cpp:328
KWallet::Wallet::readEntry
virtual int readEntry(const QString &key, QByteArray &value)
Read the entry key from the current folder.
Definition: kwallet.cpp:1034
KWallet::Wallet::entryList
virtual QStringList entryList()
Return the list of keys of all entries in this folder.
Definition: kwallet.cpp:777
KWallet::Wallet::readMapList
int readMapList(const QString &key, QMap< QString, QMap< QString, QString > > &value)
Read the map entry key from the current folder.
Definition: kwallet.cpp:1198
KWallet::Wallet::readMap
virtual int readMap(const QString &key, QMap< QString, QString > &value)
Read the map entry key from the current folder.
Definition: kwallet.cpp:1146
KWallet::Wallet::requestChangePassword
virtual void requestChangePassword(WId w)
Request to the wallet service to change the password of the current wallet.
Definition: kwallet.cpp:680
KWallet::Wallet::EntryType
EntryType
Definition: kwallet.h:80
KWallet::Wallet::Unknown
@ Unknown
Definition: kwallet.h:80
KWallet::Wallet::Password
@ Password
Definition: kwallet.h:80
KWallet::Wallet::Map
@ Map
Definition: kwallet.h:80
KWallet::Wallet::Stream
@ Stream
Definition: kwallet.h:80
KWallet::Wallet::isEnabled
static bool isEnabled()
Determine if the KDE wallet is enabled.
Definition: kwallet.cpp:352
KWallet::Wallet::disconnectApplication
static bool disconnectApplication(const QString &wallet, const QString &app)
Disconnect the application app from wallet.
Definition: kwallet.cpp:560
KWallet::Wallet::removeFolder
virtual bool removeFolder(const QString &f)
Remove the folder f and all its entries from the wallet.
Definition: kwallet.cpp:917
KWallet::Wallet::LocalWallet
static const QString LocalWallet()
The name of the wallet used to store local passwords.
Definition: kwallet.cpp:109
KWallet::Wallet::folderDoesNotExist
static bool folderDoesNotExist(const QString &wallet, const QString &folder)
Determine if a folder does not exist in a wallet.
Definition: kwallet.cpp:1603
KWallet::Wallet::entryType
virtual EntryType entryType(const QString &key)
Determine the type of the entry key in this folder.
Definition: kwallet.cpp:1471
KWallet::Wallet::readPassword
virtual int readPassword(const QString &key, QString &value)
Read the password entry key from the current folder.
Definition: kwallet.cpp:1236
KWallet::Wallet::openWallet
static Wallet * openWallet(const QString &name, WId w, OpenType ot=Synchronous)
Open the wallet name.
Definition: kwallet.cpp:452
KWallet::Wallet::writePassword
virtual int writePassword(const QString &key, const QString &value)
Write key = value as a password to the current folder.
Definition: kwallet.cpp:1388
KWallet::Wallet::walletName
virtual const QString & walletName() const
The name of the current wallet.
Definition: kwallet.cpp:661
KWallet::Wallet::setFolder
virtual bool setFolder(const QString &f)
Set the current working folder to f.
Definition: kwallet.cpp:882
KWallet::Wallet::walletOpened
void walletOpened(bool success)
Emitted when a wallet is opened in asynchronous mode.
KWallet::Wallet::keyDoesNotExist
static bool keyDoesNotExist(const QString &wallet, const QString &folder, const QString &key)
Determine if an entry in a folder does not exist in a wallet.
Definition: kwallet.cpp:1632
KWallet::Wallet::FormDataFolder
static const QString FormDataFolder()
The standardized name of the form data folder.
Definition: kwallet.cpp:142
KWallet::Wallet::writeMap
virtual int writeMap(const QString &key, const QMap< QString, QString > &value)
Write key = value as a map to the current folder.
Definition: kwallet.cpp:1358
OSXKeychain
Definition: qosxkeychain.h:91
OSXKeychain::IsOpen
static bool IsOpen(const SecKeychainRef keychain)
Definition: qosxkeychain.cpp:261
OSXKeychain::Lock
static OSStatus Lock(const SecKeychainRef keychain)
Definition: qosxkeychain.cpp:310
OSXKeychain::EntryType
EntryType
Definition: qosxkeychain.h:98
OSXKeychain::Password
@ Password
Definition: qosxkeychain.h:98
OSXKeychain::Stream
@ Stream
Definition: qosxkeychain.h:98
OSXKeychain::Unknown
@ Unknown
Definition: qosxkeychain.h:98
OSXKeychain::Map
@ Map
Definition: qosxkeychain.h:98
OSXKeychain::Destroy
static OSStatus Destroy(SecKeychainRef *keychain)
Definition: qosxkeychain.cpp:700
OSXKeychain::KeychainList
static OSStatus KeychainList(QStringList &theList)
Definition: qosxkeychain.cpp:232
QMap
QObject
kDebug
#define kDebug
kWarning
#define kWarning
kaboutdata.h
kcomponentdata.h
kconfiggroup.h
kdebug.h
kglobal.h
ksharedconfig.h
ktoolinvocation.h
kwallet.h
StringStringMap
QMap< QString, QString > StringStringMap
Definition: kwallet_mac.cpp:46
KGlobal::mainComponent
const KComponentData & mainComponent()
group
group
KStandardAction::name
const char * name(StandardAction id)
This will return the internal name of a given standard action.
Definition: kstandardaction.cpp:223
KWallet
Definition: kwallet.cpp:56
KWallet::appid
static QString appid()
Definition: kwallet.cpp:76
KWallet::registerTypes
static void registerTypes()
Definition: kwallet.cpp:91
qosxkeychain.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal