00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
#ifndef _KWALLET_H
00023
#define _KWALLET_H
00024
00025
#include <qglobal.h>
00026
#ifdef Q_OS_UNIX
00027
00028
#include <qstring.h>
00029
#include <qstringlist.h>
00030
#include <qobject.h>
00031
#include <dcopobject.h>
00032
00033
class DCOPRef;
00034
00035
namespace KWallet {
00036
00047
class KIO_EXPORT Wallet :
public QObject,
public DCOPObject {
00048 K_DCOP
00049 Q_OBJECT
00050
protected:
00057 Wallet(
int handle,
const QString& name);
00062 Wallet(
const Wallet&);
00063
00064
public:
00065
enum EntryType { Unknown=0, Password, Stream, Map, Unused=0xffff };
00066
00070
virtual ~Wallet();
00071
00077
static QStringList walletList();
00078
00084
static bool isEnabled();
00085
00091
static bool isOpen(
const QString& name);
00092
00102
static int closeWallet(
const QString& name,
bool force);
00103
00110
static int deleteWallet(
const QString& name);
00111
00118
static bool disconnectApplication(
const QString& wallet,
const QCString& app);
00119
00120
enum OpenType { Synchronous=0, Asynchronous, Path, OpenTypeUnused=0xff };
00121
00138
static Wallet* openWallet(
const QString& name, WId w = 0, 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
00180
static void changePassword(
const QString& name, WId w = 0);
00181
00188
virtual int sync();
00189
00195
virtual int lockWallet();
00196
00200
virtual const QString& walletName() const;
00201
00207 virtual
bool isOpen() const;
00208
00214 virtual
void requestChangePassword(WId w = 0);
00215
00220 virtual
QStringList folderList();
00221
00227 virtual
bool hasFolder(const
QString& f);
00228
00236 virtual
bool setFolder(const
QString& f);
00237
00243 virtual
bool removeFolder(const
QString& f);
00244
00250 virtual
bool createFolder(const
QString& f);
00251
00258 virtual const
QString& currentFolder() const;
00259
00265 virtual
QStringList entryList();
00266
00273 virtual
int renameEntry(const
QString& oldName, const
QString& newName);
00274
00284 virtual
int readEntry(const
QString& key,
QByteArray& value);
00285
00294 virtual
int readMap(const
QString& key,
QMap<
QString,QString>& value);
00295
00304 virtual
int readPassword(const QString& key, QString& value);
00305
00318
int readEntryList(const QString& key,
QMap<QString,
QByteArray>& value);
00319
00331
int readMapList(const QString& key,
QMap<QString,
QMap<QString, QString> >& value);
00332
00344
int readPasswordList(const QString& key,
QMap<QString, QString>& value);
00345
00356 virtual
int writeEntry(const QString& key, const
QByteArray& value, EntryType entryType);
00357
00365 virtual
int writeEntry(const QString& key, const
QByteArray& value);
00366
00373 virtual
int writeMap(const QString& key, const
QMap<QString,QString>& value);
00374
00381 virtual
int writePassword(const QString& key, const QString& value);
00382
00388 virtual
bool hasEntry(const QString& key);
00389
00395 virtual
int removeEntry(const QString& key);
00396
00403 virtual EntryType entryType(const QString& key);
00404
00415 static
bool folderDoesNotExist(const QString& wallet, const QString& folder);
00416
00428 static
bool keyDoesNotExist(const QString& wallet, const QString& folder,
00429 const QString& key);
00430
00431 signals:
00435
void walletClosed();
00436
00441
void folderUpdated(const QString& folder);
00442
00446
void folderListUpdated();
00447
00452
void folderRemoved(const QString& folder);
00453
00458
void walletOpened(
bool success);
00459
00460 private:
00461 k_dcop:
00466 ASYNC slotWalletClosed(
int handle);
00467
00472 ASYNC slotFolderUpdated(const QString& wallet, const QString& folder);
00473
00478 ASYNC slotFolderListUpdated(const QString& wallet);
00479
00484 ASYNC slotApplicationDisconnected(const QString& wallet, const
QCString& application);
00485
00490 ASYNC walletOpenResult(
int rc);
00491
00492 private slots:
00497
void slotAppUnregistered(const
QCString&);
00498
00499 private:
00500 class WalletPrivate;
00501 WalletPrivate *d;
00502 QString _name;
00503 QString _folder;
00504
int _handle;
00505
DCOPRef *_dcopRef;
00506
00507 protected:
00511 virtual
void virtual_hook(
int id,
void *data);
00512 };
00513
00514 }
00515
00516 #endif
00517
00518 #endif
00519