KDEUI
kwallet.h
Go to the documentation of this file.
00001 /* This file is part of the KDE project 00002 * 00003 * Copyright (C) 2002-2004 George Staikos <staikos@kde.org> 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Library General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Library General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Library General Public License 00016 * along with this library; see the file COPYING.LIB. If not, write to 00017 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 * Boston, MA 02110-1301, USA. 00019 */ 00020 00021 00022 #ifndef _KWALLET_H 00023 #define _KWALLET_H 00024 00025 #include <QtCore/QStringList> 00026 #include <QtCore/QObject> 00027 #include <QtGui/qwindowdefs.h> // krazy:exclude=includes (for WId) 00028 00029 #include <kdeui_export.h> 00030 00031 00032 class QDBusError; 00033 00034 namespace KWallet { 00035 00045 class KDEUI_EXPORT Wallet : public QObject 00046 { 00047 Q_OBJECT 00048 protected: 00055 Wallet(int handle, const QString& name); 00060 Wallet(const Wallet&); 00061 00062 public: 00063 enum EntryType { Unknown=0, Password, Stream, Map, Unused=0xffff }; 00064 00068 virtual ~Wallet(); 00069 00075 static QStringList walletList(); 00076 00082 static bool isEnabled(); 00083 00089 static bool isOpen(const QString& name); 00090 00100 static int closeWallet(const QString& name, bool force); 00101 00108 static int deleteWallet(const QString& name); 00109 00116 static bool disconnectApplication(const QString& wallet, const QString& app); 00117 00118 enum OpenType { Synchronous=0, Asynchronous, Path, OpenTypeUnused=0xff }; 00119 00138 static Wallet* openWallet(const QString& name, WId w, OpenType ot = Synchronous); 00139 00146 static QStringList users(const QString& wallet); 00147 00151 static const QString LocalWallet(); 00152 00156 static const QString NetworkWallet(); 00157 00164 static const QString PasswordFolder(); 00165 00172 static const QString FormDataFolder(); 00173 00182 static void changePassword(const QString& name, WId w); 00183 00190 virtual int sync(); 00191 00197 virtual int lockWallet(); 00198 00202 virtual const QString& walletName() const; 00203 00209 virtual bool isOpen() const; 00210 00218 virtual void requestChangePassword(WId w); 00219 00224 virtual QStringList folderList(); 00225 00231 virtual bool hasFolder(const QString& f); 00232 00240 virtual bool setFolder(const QString& f); 00241 00247 virtual bool removeFolder(const QString& f); 00248 00254 virtual bool createFolder(const QString& f); 00255 00262 virtual const QString& currentFolder() const; 00263 00269 virtual QStringList entryList(); 00270 00277 virtual int renameEntry(const QString& oldName, const QString& newName); 00278 00288 virtual int readEntry(const QString& key, QByteArray& value); 00289 00298 virtual int readMap(const QString& key, QMap<QString,QString>& value); 00299 00308 virtual int readPassword(const QString& key, QString& value); 00309 00321 int readEntryList(const QString& key, QMap<QString, QByteArray>& value); 00322 00333 int readMapList(const QString& key, QMap<QString, QMap<QString, QString> >& value); 00334 00345 int readPasswordList(const QString& key, QMap<QString, QString>& value); 00346 00357 virtual int writeEntry(const QString& key, const QByteArray& value, EntryType entryType); 00358 00366 virtual int writeEntry(const QString& key, const QByteArray& value); 00367 00374 virtual int writeMap(const QString& key, const QMap<QString,QString>& value); 00375 00382 virtual int writePassword(const QString& key, const QString& value); 00383 00389 virtual bool hasEntry(const QString& key); 00390 00396 virtual int removeEntry(const QString& key); 00397 00404 virtual EntryType entryType(const QString& key); 00405 00416 static bool folderDoesNotExist(const QString& wallet, const QString& folder); 00417 00429 static bool keyDoesNotExist(const QString& wallet, const QString& folder, 00430 const QString& key); 00431 00432 Q_SIGNALS: 00436 void walletClosed(); 00437 00442 void folderUpdated(const QString& folder); 00443 00447 void folderListUpdated(); 00448 00453 void folderRemoved(const QString& folder); 00454 00459 void walletOpened(bool success); 00460 00461 private Q_SLOTS: 00466 void slotWalletClosed(int handle); 00467 00472 void slotFolderUpdated(const QString& wallet, const QString& folder); 00473 00478 void slotFolderListUpdated(const QString& wallet); 00479 00484 void slotApplicationDisconnected(const QString& wallet, const QString& application); 00485 00492 void walletAsyncOpened(int tId, int handle); 00493 00498 void emitWalletAsyncOpenError(); 00499 00500 private: 00501 class WalletPrivate; 00502 WalletPrivate* const d; 00503 Q_PRIVATE_SLOT(d, void walletServiceUnregistered()) 00504 00505 protected: 00509 virtual void virtual_hook(int id, void *data); 00510 }; 00511 00512 } 00513 00514 #endif //_KWALLET_H 00515
KDE 4.6 API Reference