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

KDEUI

  • sources
  • kde-4.12
  • kdelibs
  • 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  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public License
18  * along with this library; see the file COPYING.LIB. If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 #include "kwallet.h"
24 #include <ksharedconfig.h>
25 #include <kdebug.h>
26 #include <kdeversion.h>
27 #include <QtGui/QApplication>
28 #include <QtCore/QPointer>
29 #include <QtGui/QWidget>
30 #include <ktoolinvocation.h>
31 
32 #include <kglobal.h>
33 #include <kcomponentdata.h>
34 #include <kaboutdata.h>
35 #include <kconfiggroup.h>
36 
37 #include <cassert>
38 
39 #include <Carbon/Carbon.h>
40 #include <Security/Security.h>
41 #include <Security/SecKeychain.h>
42 
43 using namespace KWallet;
44 
45 typedef QMap<QString, QString> StringStringMap;
46 Q_DECLARE_METATYPE(StringStringMap)
47 typedef QMap<QString, StringStringMap> StringToStringStringMapMap;
48 Q_DECLARE_METATYPE(StringToStringStringMapMap)
49 typedef QMap<QString, QByteArray> StringByteArrayMap;
50 Q_DECLARE_METATYPE(StringByteArrayMap)
51 
52 namespace {
53  template <typename T>
54  struct CFReleaser {
55  explicit CFReleaser( const T& r ) : ref( r ) {}
56  ~CFReleaser() { CFRelease( ref ); }
57  T ref;
58  };
59 }
60 
61 static QString asQString( CFStringRef sr ) {
62  return QString::fromLatin1( CFStringGetCStringPtr( sr, NULL ) ); //TODO Latin1 correct?
63 }
64 
65 static QString errorString( OSStatus s ) {
66  const CFReleaser<CFStringRef> ref( SecCopyErrorMessageString( s, NULL ) );
67  return asQString( ref.ref );
68 }
69 
70 static bool isError( OSStatus s, QString* errMsg ) {
71  if ( errMsg )
72  *errMsg = errorString( s );
73  return s != 0;
74 }
75 
76 static QString appid()
77 {
78  KComponentData cData = KGlobal::mainComponent();
79  if (cData.isValid()) {
80  const KAboutData* aboutData = cData.aboutData();
81  if (aboutData) {
82  return aboutData->programName();
83  }
84  return cData.componentName();
85  }
86  return qApp->applicationName();
87 }
88 
89 static OSStatus removeEntryImplementation(const QString& walletName, const QString& key) {
90  const QByteArray serviceName( walletName.toUtf8() );
91  const QByteArray accountName( key.toUtf8() );
92  SecKeychainItemRef itemRef;
93  QString errMsg;
94  OSStatus result = SecKeychainFindGenericPassword( NULL, serviceName.size(), serviceName.constData(), accountName.size(), accountName.constData(), NULL, NULL, &itemRef );
95  if ( isError( result, &errMsg ) ) {
96  qWarning() << "Could not retrieve password:" << qPrintable(errMsg);
97  return result;
98  }
99  const CFReleaser<SecKeychainItemRef> itemReleaser( itemRef );
100  result = SecKeychainItemDelete( itemRef );
101  if ( isError( result, &errMsg ) ) {
102  qWarning() << "Could not delete password:" << qPrintable(errMsg);
103  return result;
104  }
105  return result;
106 }
107 
108 
109 const QString Wallet::LocalWallet() {
110  KConfigGroup cfg(KSharedConfig::openConfig("kwalletrc")->group("Wallet"));
111  if (!cfg.readEntry("Use One Wallet", true)) {
112  QString tmp = cfg.readEntry("Local Wallet", "localwallet");
113  if (tmp.isEmpty()) {
114  return "localwallet";
115  }
116  return tmp;
117  }
118 
119  QString tmp = cfg.readEntry("Default Wallet", "kdewallet");
120  if (tmp.isEmpty()) {
121  return "kdewallet";
122  }
123  return tmp;
124 }
125 
126 const QString Wallet::NetworkWallet() {
127  KConfigGroup cfg(KSharedConfig::openConfig("kwalletrc")->group("Wallet"));
128 
129  QString tmp = cfg.readEntry("Default Wallet", "kdewallet");
130  if (tmp.isEmpty()) {
131  return "kdewallet";
132  }
133  return tmp;
134 }
135 
136 const QString Wallet::PasswordFolder() {
137  return "Passwords";
138 }
139 
140 const QString Wallet::FormDataFolder() {
141  return "Form Data";
142 }
143 
144 class Wallet::WalletPrivate
145 {
146 public:
147  explicit WalletPrivate(const QString &n)
148  : name(n)
149  {}
150 
151  // needed for compilation reasons
152  void walletServiceUnregistered() {
153  }
154 
155  QString name;
156  QString folder;
157 };
158 
159 Wallet::Wallet(int handle, const QString& name)
160  : QObject(0L), d(new WalletPrivate(name)) {
161  Q_UNUSED(handle);
162 }
163 
164 Wallet::~Wallet() {
165  delete d;
166 }
167 
168 
169 QStringList Wallet::walletList() {
170 #ifdef OSX_KEYCHAIN_PORT_DISABLED
171  return walletLauncher->getInterface().wallets();
172 #else
173  return QStringList();
174 #endif
175 }
176 
177 
178 void Wallet::changePassword(const QString& name, WId w) {
179 #ifdef OSX_KEYCHAIN_PORT_DISABLED
180  if( w == 0 )
181  kDebug(285) << "Pass a valid window to KWallet::Wallet::changePassword().";
182  walletLauncher->getInterface().changePassword(name, (qlonglong)w, appid());
183 #endif
184 }
185 
186 
187 bool Wallet::isEnabled() {
188  //PENDING(frank) check
189  return true;
190 }
191 
192 
193 bool Wallet::isOpen(const QString& name) {
194 #ifdef OSX_KEYCHAIN_PORT_DISABLED
195  return walletLauncher->getInterface().isOpen(name); // default is false
196 #else
197  return true;
198 #endif
199 }
200 
201 
202 int Wallet::closeWallet(const QString& name, bool force) {
203 #ifdef OSX_KEYCHAIN_PORT_DISABLED
204  QDBusReply<int> r = walletLauncher->getInterface().close(name, force);
205  return r.isValid() ? r : -1;
206 #else
207  return 0;
208 #endif
209 }
210 
211 
212 int Wallet::deleteWallet(const QString& name) {
213 #ifdef OSX_KEYCHAIN_PORT_DISABLED
214  QDBusReply<int> r = walletLauncher->getInterface().deleteWallet(name);
215  return r.isValid() ? r : -1;
216 #else
217  return -1;
218 #endif
219 }
220 
221 
222 Wallet *Wallet::openWallet(const QString& name, WId w, OpenType ot) {
223  Q_UNUSED(w);
224  Q_UNUSED(ot);
225  Wallet *wallet = new Wallet(-1, name);
226  QMetaObject::invokeMethod( wallet, "emitWalletOpened", Qt::QueuedConnection );
227  return wallet;
228 }
229 
230 
231 bool Wallet::disconnectApplication(const QString& wallet, const QString& app) {
232 #ifdef OSX_KEYCHAIN_PORT_DISABLED
233  return walletLauncher->getInterface().disconnectApplication(wallet, app); // default is false
234 #else
235  return true;
236 #endif
237 }
238 
239 
240 QStringList Wallet::users(const QString& name) {
241 #ifdef OSX_KEYCHAIN_PORT_DISABLED
242  return walletLauncher->getInterface().users(name); // default is QStringList()
243 #else
244  return QStringList();
245 #endif
246 }
247 
248 
249 int Wallet::sync() {
250 #ifdef OSX_KEYCHAIN_PORT_DISABLED
251  if (d->handle == -1) {
252  return -1;
253  }
254 
255  walletLauncher->getInterface().sync(d->handle, appid());
256 #endif
257  return 0;
258 }
259 
260 
261 int Wallet::lockWallet() {
262 #ifdef OSX_KEYCHAIN_PORT_DISABLED
263  if (d->handle == -1) {
264  return -1;
265  }
266 
267  QDBusReply<int> r = walletLauncher->getInterface().close(d->handle, true, appid());
268  d->handle = -1;
269  d->folder.clear();
270  d->name.clear();
271  if (r.isValid()) {
272  return r;
273  }
274 #endif
275  return -1;
276 }
277 
278 
279 const QString& Wallet::walletName() const {
280  return d->name;
281 }
282 
283 
284 bool Wallet::isOpen() const {
285 #ifdef OSX_KEYCHAIN_PORT_DISABLED
286  return d->handle != -1;
287 #else
288  return true;
289 #endif
290 }
291 
292 
293 void Wallet::requestChangePassword(WId w) {
294 #ifdef OSX_KEYCHAIN_PORT_DISABLED
295  if( w == 0 )
296  kDebug(285) << "Pass a valid window to KWallet::Wallet::requestChangePassword().";
297  if (d->handle == -1) {
298  return;
299  }
300 
301  walletLauncher->getInterface().changePassword(d->name, (qlonglong)w, appid());
302 #endif
303 }
304 
305 
306 void Wallet::slotWalletClosed(int handle) {
307 #ifdef OSX_KEYCHAIN_PORT_DISABLED
308  if (d->handle == handle) {
309  d->handle = -1;
310  d->folder.clear();
311  d->name.clear();
312  emit walletClosed();
313  }
314 #endif
315 }
316 
317 
318 QStringList Wallet::folderList() {
319 #ifdef OSX_KEYCHAIN_PORT_DISABLED
320  if (d->handle == -1) {
321  return QStringList();
322  }
323 
324  QDBusReply<QStringList> r = walletLauncher->getInterface().folderList(d->handle, appid());
325  return r;
326 #else
327  return QStringList();
328 #endif
329 }
330 
331 
332 QStringList Wallet::entryList() {
333 #ifdef OSX_KEYCHAIN_PORT_DISABLED
334  if (d->handle == -1) {
335  return QStringList();
336  }
337 
338  QDBusReply<QStringList> r = walletLauncher->getInterface().entryList(d->handle, d->folder, appid());
339  return r;
340 #else
341  return QStringList();
342 #endif
343 }
344 
345 
346 bool Wallet::hasFolder(const QString& f) {
347 #ifdef OSX_KEYCHAIN_PORT_DISABLED
348  if (d->handle == -1) {
349  return false;
350  }
351 
352  QDBusReply<bool> r = walletLauncher->getInterface().hasFolder(d->handle, f, appid());
353  return r; // default is false
354 #else
355  return true;
356 #endif
357 }
358 
359 
360 bool Wallet::createFolder(const QString& f) {
361 #ifdef OSX_KEYCHAIN_PORT_DISABLED
362  if (d->handle == -1) {
363  return false;
364  }
365 
366  if (!hasFolder(f)) {
367  QDBusReply<bool> r = walletLauncher->getInterface().createFolder(d->handle, f, appid());
368  return r;
369  }
370 
371  return true; // folder already exists
372 #else
373  return true;
374 #endif
375 }
376 
377 
378 bool Wallet::setFolder(const QString& f) {
379 #ifdef OSX_KEYCHAIN_PORT_DISABLED
380  bool rc = false;
381 
382  if (d->handle == -1) {
383  return rc;
384  }
385 
386  // Don't do this - the folder could have disappeared?
387 #if 0
388  if (f == d->folder) {
389  return true;
390  }
391 #endif
392 
393  if (hasFolder(f)) {
394  d->folder = f;
395  rc = true;
396  }
397 
398  return rc;
399 #else
400  return true;
401 #endif
402 }
403 
404 
405 bool Wallet::removeFolder(const QString& f) {
406 #ifdef OSX_KEYCHAIN_PORT_DISABLED
407  if (d->handle == -1) {
408  return false;
409  }
410 
411  QDBusReply<bool> r = walletLauncher->getInterface().removeFolder(d->handle, f, appid());
412  if (d->folder == f) {
413  setFolder(QString());
414  }
415 
416  return r; // default is false
417 #else
418  return true;
419 #endif
420 }
421 
422 
423 const QString& Wallet::currentFolder() const {
424  return d->folder;
425 }
426 
427 
428 int Wallet::readEntry(const QString& key, QByteArray& value) {
429  const QByteArray serviceName( walletName().toUtf8() );
430  const QByteArray accountName( key.toUtf8() );
431  UInt32 passwordSize = 0;
432  void* passwordData = 0;
433  QString errMsg;
434  if ( isError( SecKeychainFindGenericPassword( NULL, serviceName.size(), serviceName.constData(), accountName.size(), accountName.constData(), &passwordSize, &passwordData, NULL ), &errMsg ) ) {
435  qWarning() << "Could not retrieve password:" << qPrintable(errMsg);
436  return -1;
437  }
438 
439  value = QByteArray( reinterpret_cast<const char*>( passwordData ), passwordSize );
440  SecKeychainItemFreeContent( NULL, passwordData );
441  return 0;
442 }
443 
444 
445 int Wallet::readEntryList(const QString& key, QMap<QString, QByteArray>& value) {
446 #ifdef OSX_KEYCHAIN_PORT_DISABLED
447  registerTypes();
448 
449  int rc = -1;
450 
451  if (d->handle == -1) {
452  return rc;
453  }
454 
455  QDBusReply<QVariantMap> r = walletLauncher->getInterface().readEntryList(d->handle, d->folder, key, appid());
456  if (r.isValid()) {
457  rc = 0;
458  // convert <QString, QVariant> to <QString, QByteArray>
459  const QVariantMap val = r.value();
460  for( QVariantMap::const_iterator it = val.begin(); it != val.end(); ++it ) {
461  value.insert(it.key(), it.value().toByteArray());
462  }
463  }
464 
465  return rc;
466 #else
467  return -1;
468 #endif
469 }
470 
471 
472 int Wallet::renameEntry(const QString& oldName, const QString& newName) {
473 #ifdef OSX_KEYCHAIN_PORT_DISABLED
474  int rc = -1;
475 
476  if (d->handle == -1) {
477  return rc;
478  }
479 
480  QDBusReply<int> r = walletLauncher->getInterface().renameEntry(d->handle, d->folder, oldName, newName, appid());
481  if (r.isValid()) {
482  rc = r;
483  }
484 
485  return rc;
486 #else
487  return -1;
488 #endif
489 }
490 
491 
492 int Wallet::readMap(const QString& key, QMap<QString,QString>& value) {
493  QByteArray v;
494  const int ret = readEntry( key, v );
495  if ( ret != 0 )
496  return ret;
497  if ( !v.isEmpty() ) {
498  QDataStream ds( &v, QIODevice::ReadOnly );
499  ds >> value;
500  }
501  return 0;
502 }
503 
504 
505 int Wallet::readMapList(const QString& key, QMap<QString, QMap<QString, QString> >& value) {
506 #ifdef OSX_KEYCHAIN_PORT_DISABLED
507  registerTypes();
508 
509  int rc = -1;
510 
511  if (d->handle == -1) {
512  return rc;
513  }
514 
515  QDBusReply<QVariantMap> r =
516  walletLauncher->getInterface().readMapList(d->handle, d->folder, key, appid());
517  if (r.isValid()) {
518  rc = 0;
519  const QVariantMap val = r.value();
520  for( QVariantMap::const_iterator it = val.begin(); it != val.end(); ++it ) {
521  QByteArray mapData = it.value().toByteArray();
522  if (!mapData.isEmpty()) {
523  QDataStream ds(&mapData, QIODevice::ReadOnly);
524  QMap<QString,QString> v;
525  ds >> v;
526  value.insert(it.key(), v);
527  }
528  }
529  }
530 
531  return rc;
532 #else
533  return -1;
534 #endif
535 }
536 
537 
538 int Wallet::readPassword(const QString& key, QString& value) {
539  QByteArray ba;
540  const int ret = readEntry( key, ba );
541  if ( ret == 0 )
542  value = QString::fromUtf8( ba.constData() );
543  return ret;
544 }
545 
546 
547 int Wallet::readPasswordList(const QString& key, QMap<QString, QString>& value) {
548  return -1;
549 }
550 
551 static OSStatus writeEntryImplementation( const QString& walletName, const QString& key, const QByteArray& value ) {
552  const QByteArray serviceName( walletName.toUtf8() );
553  const QByteArray accountName( key.toUtf8() );
554  QString errMsg;
555  OSStatus err = SecKeychainAddGenericPassword( NULL, serviceName.size(), serviceName.constData(), accountName.size(), accountName.constData(), value.size(), value.constData(), NULL );
556  if (err == errSecDuplicateItem) {
557  err = removeEntryImplementation( walletName, key );
558  if ( isError( err, &errMsg ) ) {
559  kWarning() << "Could not delete old key in keychain for replacing: " << qPrintable(errMsg);
560  return err;
561  }
562  }
563  if ( isError( err, &errMsg ) ) {
564  kWarning() << "Could not store password in keychain: " << qPrintable(errMsg);
565  return err;
566  }
567  kDebug() << "Succesfully written out key:" << key;
568  return err;
569 
570 }
571 
572 int Wallet::writeEntry(const QString& key, const QByteArray& password, EntryType entryType) {
573  Q_UNUSED( entryType )
574  return writeEntryImplementation( walletName(), key, password );
575 }
576 
577 
578 int Wallet::writeEntry(const QString& key, const QByteArray& value) {
579  return writeEntryImplementation( walletName(), key, value );
580 }
581 
582 
583 int Wallet::writeMap(const QString& key, const QMap<QString,QString>& value) {
584  QByteArray mapData;
585  QDataStream ds(&mapData, QIODevice::WriteOnly);
586  ds << value;
587  return writeEntry( key, mapData );
588 }
589 
590 
591 int Wallet::writePassword(const QString& key, const QString& value) {
592  return writeEntry( key, value.toUtf8() );
593 }
594 
595 
596 bool Wallet::hasEntry(const QString& key) {
597  const QByteArray serviceName( walletName().toUtf8() );
598  const QByteArray accountName( key.toUtf8() );
599  return !isError( SecKeychainFindGenericPassword( NULL, serviceName.size(), serviceName.constData(), accountName.size(), accountName.constData(), NULL, NULL, NULL ), 0 );
600 }
601 
602 int Wallet::removeEntry(const QString& key) {
603  return removeEntryImplementation( walletName(), key );
604 }
605 
606 
607 Wallet::EntryType Wallet::entryType(const QString& key) {
608 #ifdef OSX_KEYCHAIN_PORT_DISABLED
609  int rc = 0;
610 
611  if (d->handle == -1) {
612  return Wallet::Unknown;
613  }
614 
615  QDBusReply<int> r = walletLauncher->getInterface().entryType(d->handle, d->folder, key, appid());
616  if (r.isValid()) {
617  rc = r;
618  }
619 
620  return static_cast<EntryType>(rc);
621 #else
622  return Wallet::Unknown;
623 #endif
624 }
625 
626 
627 void Wallet::slotFolderUpdated(const QString& wallet, const QString& folder) {
628  if (d->name == wallet) {
629  emit folderUpdated(folder);
630  }
631 }
632 
633 
634 void Wallet::slotFolderListUpdated(const QString& wallet) {
635  if (d->name == wallet) {
636  emit folderListUpdated();
637  }
638 }
639 
640 
641 void Wallet::slotApplicationDisconnected(const QString& wallet, const QString& application) {
642 #ifdef OSX_KEYCHAIN_PORT_DISABLED
643  if (d->handle >= 0
644  && d->name == wallet
645  && application == appid()) {
646  slotWalletClosed(d->handle);
647  }
648 #endif
649 }
650 
651 void Wallet::walletAsyncOpened(int tId, int handle) {
652 #ifdef OSX_KEYCHAIN_PORT_DISABLED
653  // ignore responses to calls other than ours
654  if (d->transactionId != tId || d->handle != -1) {
655  return;
656  }
657 
658  // disconnect the async signal
659  disconnect(this, SLOT(walletAsyncOpened(int,int)));
660 
661  d->handle = handle;
662  emit walletOpened(handle > 0);
663 #endif
664 }
665 
666 void Wallet::emitWalletAsyncOpenError() {
667  emit walletOpened(false);
668 }
669 
670 void Wallet::emitWalletOpened() {
671  emit walletOpened(true);
672 }
673 
674 
675 bool Wallet::folderDoesNotExist(const QString& wallet, const QString& folder)
676 {
677 #ifdef OSX_KEYCHAIN_PORT_DISABLED
678  QDBusReply<bool> r = walletLauncher->getInterface().folderDoesNotExist(wallet, folder);
679  return r;
680 #else
681  return false;
682 #endif
683 }
684 
685 
686 bool Wallet::keyDoesNotExist(const QString& wallet, const QString& folder, const QString& key)
687 {
688 #ifdef OSX_KEYCHAIN_PORT_DISABLED
689  QDBusReply<bool> r = walletLauncher->getInterface().keyDoesNotExist(wallet, folder, key);
690  return r;
691 #else
692  return false;
693 #endif
694 }
695 
696 void Wallet::slotCollectionStatusChanged(int status)
697 {
698 }
699 
700 void Wallet::slotCollectionDeleted()
701 {
702  d->folder.clear();
703  d->name.clear();
704  emit walletClosed();
705 }
706 
707 
708 void Wallet::virtual_hook(int, void*) {
709  //BASE::virtual_hook( id, data );
710 }
711 
712 #include "kwallet.moc"
KWallet::Wallet::hasEntry
virtual bool hasEntry(const QString &key)
Determine if the current folder has they entry key.
Definition: kwallet.cpp:1410
KWallet::Wallet::requestChangePassword
virtual void requestChangePassword(WId w)
Request to the wallet service to change the password of the current wallet.
Definition: kwallet.cpp:677
errorString
static QString errorString(OSStatus s)
Definition: kwallet_mac.cpp:65
KWallet::Wallet::Wallet
Wallet(int handle, const QString &name)
Construct a KWallet object.
Definition: kwallet.cpp:243
KWallet::Wallet::walletName
virtual const QString & walletName() const
The name of the current wallet.
Definition: kwallet.cpp:658
KWallet::Wallet::setFolder
virtual bool setFolder(const QString &f)
Set the current working folder to f.
Definition: kwallet.cpp:879
KWallet::Wallet::Unknown
Definition: kwallet.h:80
KWallet::Wallet::renameEntry
virtual int renameEntry(const QString &oldName, const QString &newName)
Rename the entry oldName to newName.
Definition: kwallet.cpp:1108
kdebug.h
KWallet::appid
static QString appid()
Definition: kwallet.cpp:76
KWallet::Wallet
KDE Wallet.
Definition: kwallet.h:62
KWallet::Wallet::entryType
virtual EntryType entryType(const QString &key)
Determine the type of the entry key in this folder.
Definition: kwallet.cpp:1468
KWallet::Wallet::folderListUpdated
void folderListUpdated()
Emitted when the folder list is changed in this wallet.
T
#define T
KWallet::Wallet::virtual_hook
virtual void virtual_hook(int id, void *data)
Definition: kwallet.cpp:1655
group
KWallet::Wallet::PasswordFolder
static const QString PasswordFolder()
The standardized name of the password folder.
Definition: kwallet.cpp:138
KStandardAction::name
const char * name(StandardAction id)
This will return the internal name of a given standard action.
Definition: kstandardaction.cpp:223
KWallet::Wallet::isEnabled
static bool isEnabled()
Determine if the KDE wallet is enabled.
Definition: kwallet.cpp:352
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:1143
KWallet::Wallet::removeEntry
virtual int removeEntry(const QString &key)
Remove the entry key from the current folder.
Definition: kwallet.cpp:1436
KComponentData::aboutData
const KAboutData * aboutData() const
QString
KWallet::Wallet::readPasswordList
int readPasswordList(const QString &key, QMap< QString, QString > &value)
Read the password entry key from the current folder.
Definition: kwallet.cpp:1274
ktoolinvocation.h
QObject
kDebug
static QDebug kDebug(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
ref
void ref()
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:1385
KWallet::Wallet::walletOpened
void walletOpened(bool success)
Emitted when a wallet is opened in asynchronous mode.
KWallet::Wallet::lockWallet
virtual int lockWallet()
This closes and locks the current wallet.
Definition: kwallet.cpp:621
KWallet::Wallet::hasFolder
virtual bool hasFolder(const QString &f)
Determine if the folder f exists in the wallet.
Definition: kwallet.cpp:817
kglobal.h
KWallet::Wallet::folderUpdated
void folderUpdated(const QString &folder)
Emitted when a folder in this wallet is updated.
KWallet::Wallet::removeFolder
virtual bool removeFolder(const QString &f)
Remove the folder f and all its entries from the wallet.
Definition: kwallet.cpp:914
KWallet::Wallet::readPassword
virtual int readPassword(const QString &key, QString &value)
Read the password entry key from the current folder.
Definition: kwallet.cpp:1233
KWallet::Wallet::entryList
virtual QStringList entryList()
Return the list of keys of all entries in this folder.
Definition: kwallet.cpp:774
QStringList
KWallet::Wallet::readEntryList
int readEntryList(const QString &key, QMap< QString, QByteArray > &value)
Read the entries matching key from the current folder.
Definition: kwallet.cpp:1075
KAboutData
ksharedconfig.h
KComponentData::componentName
QString componentName() const
asQString
static QString asQString(CFStringRef sr)
Definition: kwallet_mac.cpp:61
KWallet::Wallet::FormDataFolder
static const QString FormDataFolder()
The standardized name of the form data folder.
Definition: kwallet.cpp:142
isError
static bool isError(OSStatus s, QString *errMsg)
Definition: kwallet_mac.cpp:70
KWallet::Wallet::walletList
static QStringList walletList()
List all the wallets available.
Definition: kwallet.cpp:299
KWallet::Wallet::disconnectApplication
static bool disconnectApplication(const QString &wallet, const QString &app)
Disconnect the application app from wallet.
Definition: kwallet.cpp:557
KWallet::Wallet::walletClosed
void walletClosed()
Emitted when this wallet is closed.
KWallet::Wallet::readEntry
virtual int readEntry(const QString &key, QByteArray &value)
Read the entry key from the current folder.
Definition: kwallet.cpp:1031
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
KAboutData::programName
QString programName() const
KConfigGroup
writeEntryImplementation
static OSStatus writeEntryImplementation(const QString &walletName, const QString &key, const QByteArray &value)
Definition: kwallet_mac.cpp:551
KWallet::Wallet::users
static QStringList users(const QString &wallet)
List the applications that are using the wallet wallet.
Definition: kwallet.cpp:580
kwallet.h
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:1195
KWallet::Wallet::createFolder
virtual bool createFolder(const QString &f)
Created the folder f.
Definition: kwallet.cpp:846
KWallet::Wallet::sync
virtual int sync()
This syncs the wallet file on disk with what is in memory.
Definition: kwallet.cpp:602
KWallet::Wallet::closeWallet
static int closeWallet(const QString &name, bool force)
Close the wallet name.
Definition: kwallet.cpp:403
KWallet::Wallet::folderList
virtual QStringList folderList()
Obtain the list of all folders contained in the wallet.
Definition: kwallet.cpp:724
KComponentData::isValid
bool isValid() const
KGlobal::mainComponent
const KComponentData & mainComponent()
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:1629
StringStringMap
QMap< QString, QString > StringStringMap
Definition: kwallet_mac.cpp:45
KWallet::Wallet::deleteWallet
static int deleteWallet(const QString &name)
Delete the wallet name.
Definition: kwallet.cpp:426
KWallet::Wallet::NetworkWallet
static const QString NetworkWallet()
The name of the wallet used to store network passwords.
Definition: kwallet.cpp:127
kWarning
static QDebug kWarning(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
KWallet::registerTypes
static void registerTypes()
Definition: kwallet.cpp:91
kaboutdata.h
kcomponentdata.h
KSharedConfig::openConfig
static KSharedConfig::Ptr openConfig(const QString &fileName=QString(), OpenFlags mode=FullConfig, const char *resourceType="config")
KWallet::Wallet::currentFolder
virtual const QString & currentFolder() const
Determine the current working folder in the wallet.
Definition: kwallet.cpp:965
KWallet::Wallet::LocalWallet
static const QString LocalWallet()
The name of the wallet used to store local passwords.
Definition: kwallet.cpp:109
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:1305
KWallet::Wallet::EntryType
EntryType
Definition: kwallet.h:80
KComponentData
KWallet::Wallet::isOpen
virtual bool isOpen() const
Determine if the current wallet is open, and is a valid wallet handle.
Definition: kwallet.cpp:663
QMap< QString, QString >
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:1600
kconfiggroup.h
removeEntryImplementation
static OSStatus removeEntryImplementation(const QString &walletName, const QString &key)
Definition: kwallet_mac.cpp:89
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:1355
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:49:16 by doxygen 1.8.7 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 API Reference

Skip menu "kdelibs 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
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



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