kwallet Library API Documentation

KWallet::Wallet Class Reference

KDE Wallet KDE Wallet Class. More...

#include <kwallet.h>

Inheritance diagram for KWallet::Wallet:

QObject DCOPObject List of all members.

Public Types

enum  EntryType {
  Unknown = 0, Password, Stream, Map,
  Unused = 0xffff
}
enum  OpenType { Synchronous = 0, Asynchronous, Path, OpenTypeUnused = 0xff }

Signals

void walletClosed ()
void folderUpdated (const QString &folder)
void folderListUpdated ()
void folderRemoved (const QString &folder)
void walletOpened (bool success)

DCOP Member Functions

ASYNC slotWalletClosed (int handle)
ASYNC slotFolderUpdated (const QString &wallet, const QString &folder)
ASYNC slotFolderListUpdated (const QString &wallet)
ASYNC slotApplicationDisconnected (const QString &wallet, const QCString &application)
ASYNC walletOpenResult (int rc)

Public Member Functions

virtual ~Wallet ()
virtual int sync ()
virtual int lockWallet ()
virtual const QStringwalletName () const
virtual bool isOpen () const
virtual void requestChangePassword (WId w=0)
virtual QStringList folderList ()
virtual bool hasFolder (const QString &f)
virtual bool setFolder (const QString &f)
virtual bool removeFolder (const QString &f)
virtual bool createFolder (const QString &f)
virtual const QStringcurrentFolder () const
virtual QStringList entryList ()
virtual int renameEntry (const QString &oldName, const QString &newName)
virtual int readEntry (const QString &key, QByteArray &value)
virtual int readMap (const QString &key, QMap< QString, QString > &value)
virtual int readPassword (const QString &key, QString &value)
virtual int writeEntry (const QString &key, const QByteArray &value, EntryType entryType)
virtual int writeEntry (const QString &key, const QByteArray &value)
virtual int writeMap (const QString &key, const QMap< QString, QString > &value)
virtual int writePassword (const QString &key, const QString &value)
virtual bool hasEntry (const QString &key)
virtual int removeEntry (const QString &key)
virtual EntryType entryType (const QString &key)

Static Public Member Functions

QStringList walletList ()
bool isEnabled ()
bool isOpen (const QString &name)
int closeWallet (const QString &name, bool force)
int deleteWallet (const QString &name)
bool disconnectApplication (const QString &wallet, const QCString &app)
WalletopenWallet (const QString &name, WId w=0, OpenType ot=Synchronous)
QStringList users (const QString &wallet)
const QString LocalWallet ()
const QString NetworkWallet ()
const QString PasswordFolder ()
const QString FormDataFolder ()
void changePassword (const QString &name, WId w=0)
bool folderDoesNotExist (const QString &wallet, const QString &folder)
bool keyDoesNotExist (const QString &wallet, const QString &folder, const QString &key)

Protected Member Functions

 Wallet (int handle, const QString &name)
 Wallet (const Wallet &)
virtual void virtual_hook (int id, void *data)

Detailed Description

KDE Wallet KDE Wallet Class.

This class implements a generic system-wide Wallet for KDE. This is the ONLY public interface. The DCOP client is unsupported and considered to be private.

Author:
George Staikos <staikos@kde.org>

Definition at line 44 of file kwallet.h.


Constructor & Destructor Documentation

Wallet::Wallet int  handle,
const QString name
[protected]
 

Construct a KWallet object.

Definition at line 64 of file kwallet.cc.

References DCOPRef::app(), DCOPRef::call(), DCOPObject::connectDCOPSignal(), DCOPRef::dcopClient(), DCOPReply::get(), DCOPReply::isValid(), DCOPRef::obj(), and DCOPClient::setNotifications().

Referenced by openWallet().

KWallet::Wallet::Wallet const Wallet  )  [protected]
 

Copy a KWallet object.

Wallet::~Wallet  )  [virtual]
 

Destroy a KWallet object.

Closes the wallet.Definition at line 95 of file kwallet.cc.

References DCOPRef::call().


Member Function Documentation

QStringList Wallet::walletList  )  [static]
 

List all the wallets available.

Returns:
Returns a list of the names of all wallets that are open.
Definition at line 108 of file kwallet.cc.

References DCOPReply::get(), and DCOPReply::isValid().

bool Wallet::isEnabled  )  [static]
 

Determine if the KDE wallet is enabled.

Normally you do not need to use this because open() will just fail.

Returns:
Returns true if the wallet enabled, else false.
Definition at line 123 of file kwallet.cc.

References DCOPReply::get(), and DCOPReply::isValid().

bool Wallet::isOpen const QString name  )  [static]
 

Determine if the wallet name is open by any application.

Parameters:
name The name of the wallet to check.
Returns:
Returns true if the wallet is open, else false.
Definition at line 133 of file kwallet.cc.

References DCOPReply::get(), and DCOPReply::isValid().

int Wallet::closeWallet const QString name,
bool  force
[static]
 

Close the wallet name.

The wallet will only be closed if it is open but not in use (rare), or if it is forced closed.

Parameters:
name The name of the wallet to close.
force Set true to force the wallet closed even if it is in use by others.
Returns:
Returns 0 on success, non-zero on error.
Definition at line 143 of file kwallet.cc.

References DCOPReply::get(), and DCOPReply::isValid().

int Wallet::deleteWallet const QString name  )  [static]
 

Delete the wallet name.

The wallet will be forced closed first.

Parameters:
name The name of the wallet to delete.
Returns:
Returns 0 on success, non-zero on error.
Definition at line 153 of file kwallet.cc.

References DCOPReply::get(), and DCOPReply::isValid().

bool Wallet::disconnectApplication const QString wallet,
const QCString app
[static]
 

Disconnect the application app from wallet.

Parameters:
wallet The name of the wallet to disconnect.
app The name of the application to disconnect.
Returns:
Returns true on success, false on error.
Definition at line 195 of file kwallet.cc.

References DCOPReply::get(), and DCOPReply::isValid().

Wallet * Wallet::openWallet const QString name,
WId  w = 0,
OpenType  ot = Synchronous
[static]
 

Open the wallet name.

The user will be prompted to allow your application to open the wallet, and may be prompted for a password. You are responsible for deleting this object when you are done with it.

Parameters:
name The name of the wallet to open.
ot If Asynchronous, the call will return immediately with a non-null pointer to an invalid wallet. You must immediately connect the walletOpened() signal to a slot so that you will know when it is opened, or when it fails.
w The window id to associate any dialogs with.
Returns:
Returns a pointer to the wallet if successful, or a null pointer on error or if rejected.
Definition at line 163 of file kwallet.cc.

References DCOPReply::get(), DCOPReply::isValid(), DCOPObject::objId(), and Wallet().

QStringList Wallet::users const QString wallet  )  [static]
 

List the applications that are using the wallet wallet.

Parameters:
wallet The wallet to query.
Returns:
Returns a list of all DCOP application IDs using the wallet.
Definition at line 205 of file kwallet.cc.

References DCOPReply::get(), and DCOPReply::isValid().

const QString Wallet::LocalWallet  )  [static]
 

The name of the wallet used to store local passwords.

Definition at line 37 of file kwallet.cc.

const QString Wallet::NetworkWallet  )  [static]
 

The name of the wallet used to store network passwords.

Definition at line 47 of file kwallet.cc.

const QString Wallet::PasswordFolder  )  [static]
 

The standardized name of the password folder.

It is automatically created when a wallet is created, but the user may still delete it so you should check for its existence and recreate it if necessary and desired.Definition at line 54 of file kwallet.cc.

const QString Wallet::FormDataFolder  )  [static]
 

The standardized name of the form data folder.

It is automatically created when a wallet is created, but the user may still delete it so you should check for its existence and recreate it if necessary and desired.Definition at line 58 of file kwallet.cc.

void Wallet::changePassword const QString name,
WId  w = 0
[static]
 

Request to the wallet service to change the password of the wallet name.

Parameters:
name The the wallet to change the password of.
w The window id to associate any dialogs with.
Definition at line 118 of file kwallet.cc.

int Wallet::sync  )  [virtual]
 

This syncs the wallet file on disk with what is in memory.

You don't normally need to use this. It happens automatically on close.

Returns:
Returns 0 on success, non-zero on error.
Definition at line 215 of file kwallet.cc.

References DCOPRef::call().

int Wallet::lockWallet  )  [virtual]
 

This closes and locks the current wallet.

It will disconnect all applications using the wallet.

Returns:
Returns 0 on success, non-zero on error.
Definition at line 225 of file kwallet.cc.

References DCOPRef::call(), DCOPReply::get(), and DCOPReply::isValid().

const QString & Wallet::walletName  )  const [virtual]
 

The name of the current wallet.

Definition at line 243 of file kwallet.cc.

bool Wallet::isOpen  )  const [virtual]
 

Determine if the current wallet is open, and is a valid wallet handle.

Returns:
Returns true if the wallet handle is valid and open.
Definition at line 248 of file kwallet.cc.

void Wallet::requestChangePassword WId  w = 0  )  [virtual]
 

Request to the wallet service to change the password of the current wallet.

Parameters:
w The window id to associate any dialogs with.
Definition at line 253 of file kwallet.cc.

References DCOPRef::send().

QStringList Wallet::folderList  )  [virtual]
 

Obtain the list of all folders contained in the wallet.

Returns:
Returns an empty list if the wallet is not open.
Definition at line 272 of file kwallet.cc.

References DCOPRef::call(), DCOPReply::get(), and DCOPReply::isValid().

bool Wallet::hasFolder const QString f  )  [virtual]
 

Determine if the folder f exists in the wallet.

Parameters:
f the name of the folder to check for
Returns:
Returns true if the folder exists in the wallet.
Definition at line 304 of file kwallet.cc.

References DCOPRef::call(), DCOPReply::get(), and DCOPReply::isValid().

Referenced by createFolder(), and setFolder().

bool Wallet::setFolder const QString f  )  [virtual]
 

Set the current working folder to f.

The folder must exist, or this call will fail. Create a folder with createFolder().

Parameters:
f the name of the folder to make the working folder
Returns:
Returns true if the folder was successfully set.
Definition at line 338 of file kwallet.cc.

References hasFolder().

Referenced by removeFolder().

bool Wallet::removeFolder const QString f  )  [virtual]
 

Remove the folder f and all its entries from the wallet.

Parameters:
f the name of the folder to remove
Returns:
Returns true if the folder was successfully removed.
Definition at line 361 of file kwallet.cc.

References DCOPRef::call(), DCOPReply::get(), DCOPReply::isValid(), and setFolder().

bool Wallet::createFolder const QString f  )  [virtual]
 

Created the folder f.

Parameters:
f the name of the folder to create
Returns:
Returns true if the folder was successfully created.
Definition at line 320 of file kwallet.cc.

References DCOPRef::call(), DCOPReply::get(), hasFolder(), and DCOPReply::isValid().

const QString & Wallet::currentFolder  )  const [virtual]
 

Determine the current working folder in the wallet.

If the folder name is empty, it is working in the global folder, which is valid but discouraged.

Returns:
Returns the current working folder.
Definition at line 381 of file kwallet.cc.

QStringList Wallet::entryList  )  [virtual]
 

Return the list of keys of all entries in this folder.

Returns:
Returns an empty list if the wallet is not open, or if the folder is empty.
Definition at line 288 of file kwallet.cc.

References DCOPRef::call(), DCOPReply::get(), and DCOPReply::isValid().

int Wallet::renameEntry const QString oldName,
const QString newName
[virtual]
 

Rename the entry oldName to newName.

Parameters:
oldName The original key of the entry.
newName The new key of the entry.
Returns:
Returns 0 on success, non-zero on error.
Definition at line 403 of file kwallet.cc.

References DCOPRef::call(), DCOPReply::get(), and DCOPReply::isValid().

int Wallet::readEntry const QString key,
QByteArray value
[virtual]
 

Read the entry key from the current folder.

The entry format is unknown except that it is either a QByteArray or a QDataStream, which effectively means that it is anything.

Parameters:
key The key of the entry to read.
value A buffer to fill with the value.
Returns:
Returns 0 on success, non-zero on error.
Definition at line 386 of file kwallet.cc.

References DCOPRef::call(), DCOPReply::get(), and DCOPReply::isValid().

int Wallet::readMap const QString key,
QMap< QString, QString > &  value
[virtual]
 

Read the map entry key from the current folder.

Parameters:
key The key of the entry to read.
value A map buffer to fill with the value.
Returns:
Returns 0 on success, non-zero on error. Will return an error if the key was not originally written as a map.
Definition at line 419 of file kwallet.cc.

References DCOPRef::call(), DCOPReply::get(), and DCOPReply::isValid().

int Wallet::readPassword const QString key,
QString value
[virtual]
 

Read the password entry key from the current folder.

Parameters:
key The key of the entry to read.
value A password buffer to fill with the value.
Returns:
Returns 0 on success, non-zero on error. Will return an error if the key was not originally written as a password.
Definition at line 441 of file kwallet.cc.

References DCOPRef::call(), DCOPReply::get(), and DCOPReply::isValid().

int Wallet::writeEntry const QString key,
const QByteArray value,
EntryType  entryType
[virtual]
 

Write key = value as a binary entry to the current folder.

Be careful with this, it could cause inconsistency in the future since you can put an arbitrary entry type in place.

Parameters:
key The key of the new entry.
value The value of the entry.
entryType The type of the entry.
Returns:
Returns 0 on success, non-zero on error.
Definition at line 458 of file kwallet.cc.

References DCOPRef::call(), DCOPReply::get(), and DCOPReply::isValid().

int Wallet::writeEntry const QString key,
const QByteArray value
[virtual]
 

Write key = value as a binary entry to the current folder.

Parameters:
key The key of the new entry.
value The value of the entry.
Returns:
Returns 0 on success, non-zero on error.
Definition at line 474 of file kwallet.cc.

References DCOPRef::call(), DCOPReply::get(), and DCOPReply::isValid().

int Wallet::writeMap const QString key,
const QMap< QString, QString > &  value
[virtual]
 

Write key = value as a map to the current folder.

Parameters:
key The key of the new entry.
value The value of the map.
Returns:
Returns 0 on success, non-zero on error.
Definition at line 490 of file kwallet.cc.

References DCOPRef::call(), DCOPReply::get(), and DCOPReply::isValid().

int Wallet::writePassword const QString key,
const QString value
[virtual]
 

Write key = value as a password to the current folder.

Parameters:
key The key of the new entry.
value The value of the password.
Returns:
Returns 0 on success, non-zero on error.
Definition at line 509 of file kwallet.cc.

References DCOPRef::call(), DCOPReply::get(), and DCOPReply::isValid().

bool Wallet::hasEntry const QString key  )  [virtual]
 

Determine if the current folder has they entry key.

Parameters:
key The key to search for.
Returns:
Returns true if the folder contains key.
Definition at line 525 of file kwallet.cc.

References DCOPRef::call(), DCOPReply::get(), and DCOPReply::isValid().

int Wallet::removeEntry const QString key  )  [virtual]
 

Remove the entry key from the current folder.

Parameters:
key The key to remove.
Returns:
Returns 0 on success, non-zero on error.
Definition at line 541 of file kwallet.cc.

References DCOPRef::call(), DCOPReply::get(), and DCOPReply::isValid().

Wallet::EntryType Wallet::entryType const QString key  )  [virtual]
 

Determine the type of the entry key in this folder.

Parameters:
key The key to look up.
Returns:
Returns an enumerated type representing the type of the entry.
Definition at line 557 of file kwallet.cc.

References DCOPRef::call(), DCOPReply::get(), and DCOPReply::isValid().

bool Wallet::folderDoesNotExist const QString wallet,
const QString folder
[static]
 

Determine if a folder does not exist in a wallet.

This does not require decryption of the wallet. This is a handy optimization to avoid prompting the user if your data is certainly not in the wallet.

Parameters:
wallet The wallet to look in.
folder The folder to look up.
Returns:
Returns true if the folder does NOT exist in the wallet, or the wallet does not exist.
Definition at line 618 of file kwallet.cc.

References DCOPReply::get(), and DCOPReply::isValid().

bool Wallet::keyDoesNotExist const QString wallet,
const QString folder,
const QString key
[static]
 

Determine if an entry in a folder does not exist in a wallet.

This does not require decryption of the wallet. This is a handy optimization to avoid prompting the user if your data is certainly not in the wallet.

Parameters:
wallet The wallet to look in.
folder The folder to look in.
key The key to look up.
Returns:
Returns true if the key does NOT exist in the wallet, or the folder or wallet does not exist.
Definition at line 628 of file kwallet.cc.

References DCOPReply::get(), and DCOPReply::isValid().

void KWallet::Wallet::walletClosed  )  [signal]
 

Emitted when this wallet is closed.

void KWallet::Wallet::folderUpdated const QString folder  )  [signal]
 

Emitted when a folder in this wallet is updated.

Parameters:
folder The folder that was updated.

void KWallet::Wallet::folderListUpdated  )  [signal]
 

Emitted when the folder list is changed in this wallet.

void KWallet::Wallet::folderRemoved const QString folder  )  [signal]
 

Emitted when a folder in this wallet is removed.

Parameters:
folder The folder that was removed.

void KWallet::Wallet::walletOpened bool  success  )  [signal]
 

Emitted when a wallet is opened in asynchronous mode.

Parameters:
success True if the wallet was opened successfully.


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kwallet Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Sep 29 09:43:41 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003