00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _TDEWALLET_H
00023 #define _TDEWALLET_H
00024
00025 #include <tqglobal.h>
00026
00027 #ifdef Q_MOC_RUN
00028 #define Q_OS_UNIX
00029 #endif // Q_MOC_RUN
00030
00031 #ifdef Q_OS_UNIX
00032
00033 #include <tqstring.h>
00034 #include <tqstringlist.h>
00035 #include <tqobject.h>
00036 #include <dcopobject.h>
00037
00038 class DCOPRef;
00039
00041 namespace TDEWallet {
00042
00053 class TDEIO_EXPORT Wallet : public TQObject, public DCOPObject {
00054 K_DCOP
00055 Q_OBJECT
00056 protected:
00063 Wallet(int handle, const TQString& name);
00068 Wallet(const Wallet&);
00069
00070 public:
00071 enum EntryType { Unknown=0, Password, Stream, Map, Unused=0xffff };
00072
00076 virtual ~Wallet();
00077
00083 static TQStringList walletList();
00084
00090 static bool isEnabled();
00091
00097 static bool isOpen(const TQString& name);
00098
00108 static int closeWallet(const TQString& name, bool force);
00109
00116 static int deleteWallet(const TQString& name);
00117
00124 static bool disconnectApplication(const TQString& wallet, const TQCString& app);
00125
00126 enum OpenType { Synchronous=0, Asynchronous, Path, OpenTypeUnused=0xff };
00127
00144 static Wallet* openWallet(const TQString& name, WId w = 0, OpenType ot = Synchronous);
00145
00152 static TQStringList users(const TQString& wallet);
00153
00157 static const TQString LocalWallet();
00158
00162 static const TQString NetworkWallet();
00163
00170 static const TQString PasswordFolder();
00171
00178 static const TQString FormDataFolder();
00179
00186 static void changePassword(const TQString& name, WId w = 0);
00187
00194 virtual int sync();
00195
00201 virtual int lockWallet();
00202
00206 virtual const TQString& walletName() const;
00207
00213 virtual bool isOpen() const;
00214
00220 virtual void requestChangePassword(WId w = 0);
00221
00226 virtual TQStringList folderList();
00227
00233 virtual bool hasFolder(const TQString& f);
00234
00242 virtual bool setFolder(const TQString& f);
00243
00249 virtual bool removeFolder(const TQString& f);
00250
00256 virtual bool createFolder(const TQString& f);
00257
00264 virtual const TQString& currentFolder() const;
00265
00271 virtual TQStringList entryList();
00272
00279 virtual int renameEntry(const TQString& oldName, const TQString& newName);
00280
00290 virtual int readEntry(const TQString& key, TQByteArray& value);
00291
00300 virtual int readMap(const TQString& key, TQMap<TQString,TQString>& value);
00301
00310 virtual int readPassword(const TQString& key, TQString& value);
00311
00324 int readEntryList(const TQString& key, TQMap<TQString, TQByteArray>& value);
00325
00337 int readMapList(const TQString& key, TQMap<TQString, TQMap<TQString, TQString> >& value);
00338
00350 int readPasswordList(const TQString& key, TQMap<TQString, TQString>& value);
00351
00362 virtual int writeEntry(const TQString& key, const TQByteArray& value, EntryType entryType);
00363
00371 virtual int writeEntry(const TQString& key, const TQByteArray& value);
00372
00379 virtual int writeMap(const TQString& key, const TQMap<TQString,TQString>& value);
00380
00387 virtual int writePassword(const TQString& key, const TQString& value);
00388
00394 virtual bool hasEntry(const TQString& key);
00395
00401 virtual int removeEntry(const TQString& key);
00402
00409 virtual EntryType entryType(const TQString& key);
00410
00421 static bool folderDoesNotExist(const TQString& wallet, const TQString& folder);
00422
00434 static bool keyDoesNotExist(const TQString& wallet, const TQString& folder,
00435 const TQString& key);
00436
00437 signals:
00441 void walletClosed();
00442
00447 void folderUpdated(const TQString& folder);
00448
00452 void folderListUpdated();
00453
00458 void folderRemoved(const TQString& folder);
00459
00464 void walletOpened(bool success);
00465
00466 private:
00467 k_dcop:
00472 ASYNC slotWalletClosed(int handle);
00473
00478 ASYNC slotFolderUpdated(const TQString& wallet, const TQString& folder);
00479
00484 ASYNC slotFolderListUpdated(const TQString& wallet);
00485
00490 ASYNC slotApplicationDisconnected(const TQString& wallet, const TQCString& application);
00491
00496 ASYNC walletOpenResult(int rc);
00497
00498 private slots:
00503 void slotAppUnregistered(const TQCString&);
00504
00505 private:
00506 class WalletPrivate;
00507 WalletPrivate *d;
00508 TQString _name;
00509 TQString _folder;
00510 int _handle;
00511 DCOPRef *_dcopRef;
00512
00513 protected:
00517 virtual void virtual_hook(int id, void *data);
00518 };
00519
00520 }
00521
00522 #endif //Q_OS_UNIX
00523
00524 #endif //_TDEWALLET_H
00525