Wallet Class Reference
from PyKDE4.kdeui import *
Inherits: QObject
Namespace: KWallet.Wallet
Detailed Description
KDE Wallet
This class implements a generic system-wide Wallet for KDE. This is the ONLY public interface.
KDE Wallet Class
Enumerations | |
EntryType | { Unknown, Password, Stream, Map, Unused } |
OpenType | { Synchronous, Asynchronous, Path, OpenTypeUnused } |
Signals | |
folderListUpdated () | |
folderRemoved (, QString folder) | |
folderUpdated (, QString folder) | |
walletClosed () | |
walletOpened (, bool success) | |
Methods | |
__init__ (self, int handle, QString name) | |
QString | FormDataFolder (self) |
QString | LocalWallet (self) |
QString | NetworkWallet (self) |
QString | PasswordFolder (self) |
changePassword (self, QString name, WId w) | |
int | closeWallet (self, QString name, bool force) |
bool | createFolder (self, QString f) |
QString | currentFolder (self) |
int | deleteWallet (self, QString name) |
bool | disconnectApplication (self, QString wallet, QString app) |
QStringList | entryList (self) |
KWallet.Wallet.EntryType | entryType (self, QString key) |
bool | folderDoesNotExist (self, QString wallet, QString folder) |
QStringList | folderList (self) |
folderListUpdated (self) | |
folderRemoved (self, QString folder) | |
folderUpdated (self, QString folder) | |
bool | hasEntry (self, QString key) |
bool | hasFolder (self, QString f) |
bool | isEnabled (self) |
bool | isOpen (self, QString name) |
bool | isOpen (self) |
bool | keyDoesNotExist (self, QString wallet, QString folder, QString key) |
int | lockWallet (self) |
KWallet.Wallet | openWallet (self, QString name, WId w, KWallet.Wallet.OpenType ot=KWallet.Wallet.Synchronous) |
int, QByteArray value | readEntry (self, QString key) |
int, QMap | readEntryList (self, QString key) |
int, QMap | readMap (self, QString key) |
int, QString value | readPassword (self, QString key) |
int, QMap | readPasswordList (self, QString key) |
int | removeEntry (self, QString key) |
bool | removeFolder (self, QString f) |
int | renameEntry (self, QString oldName, QString newName) |
requestChangePassword (self, WId w) | |
bool | setFolder (self, QString f) |
int | sync (self) |
QStringList | users (self, QString wallet) |
walletClosed (self) | |
QStringList | walletList (self) |
QString | walletName (self) |
walletOpened (self, bool success) | |
int | writeEntry (self, QString key, QByteArray value, KWallet.Wallet.EntryType entryType) |
int | writeEntry (self, QString key, QByteArray value) |
int | writeMap (self, QString key, QMap |
int | writePassword (self, QString key, QString value) |
Method Documentation
__init__ | ( | self, | ||
int | handle, | |||
QString | name | |||
) |
Construct a KWallet object.
- Internal:
- Parameters:
-
handle The handle for the wallet. name The name of the wallet.
QString FormDataFolder | ( | self ) |
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.
QString LocalWallet | ( | self ) |
The name of the wallet used to store local passwords.
QString NetworkWallet | ( | self ) |
The name of the wallet used to store network passwords.
QString PasswordFolder | ( | self ) |
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.
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. You can pass 0 if you don't have a window the password dialog should associate with.
int closeWallet | ( | self, | ||
QString | name, | |||
bool | force | |||
) |
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.
bool createFolder | ( | self, | ||
QString | f | |||
) |
Created the folder f.
- Parameters:
-
f the name of the folder to create
- Returns:
- Returns true if the folder was successfully created.
QString currentFolder | ( | self ) |
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.
int deleteWallet | ( | self, | ||
QString | name | |||
) |
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.
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.
QStringList entryList | ( | self ) |
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.
KWallet.Wallet.EntryType entryType | ( | self, | ||
QString | key | |||
) |
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.
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.
QStringList folderList | ( | self ) |
Obtain the list of all folders contained in the wallet.
- Returns:
- Returns an empty list if the wallet is not open.
folderListUpdated | ( | self ) |
Emitted when the folder list is changed in this wallet.
- Signal syntax:
QObject.connect(source, SIGNAL("folderListUpdated()"), target_slot)
folderRemoved | ( | self, | ||
QString | folder | |||
) |
Emitted when a folder in this wallet is removed.
- Parameters:
-
folder The folder that was removed.
- Signal syntax:
QObject.connect(source, SIGNAL("folderRemoved(const QString&)"), target_slot)
folderUpdated | ( | self, | ||
QString | folder | |||
) |
Emitted when a folder in this wallet is updated.
- Parameters:
-
folder The folder that was updated.
- Signal syntax:
QObject.connect(source, SIGNAL("folderUpdated(const QString&)"), target_slot)
bool hasEntry | ( | self, | ||
QString | key | |||
) |
Determine if the current folder has they entry key.
- Parameters:
-
key The key to search for.
- Returns:
- Returns true if the folder contains key.
bool hasFolder | ( | self, | ||
QString | f | |||
) |
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.
bool isEnabled | ( | self ) |
Determine if the KDE wallet is enabled. Normally you do not need to use this because openWallet() will just fail.
- Returns:
- Returns true if the wallet enabled, else false.
bool isOpen | ( | self, | ||
QString | name | |||
) |
Determine if the current wallet is open, and is a valid wallet handle.
- Returns:
- Returns true if the wallet handle is valid and open.
bool isOpen | ( | self ) |
Determine if the current wallet is open, and is a valid wallet handle.
- Returns:
- Returns true if the wallet handle is valid and open.
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.
int lockWallet | ( | self ) |
This closes and locks the current wallet. It will disconnect all applications using the wallet.
- Returns:
- Returns 0 on success, non-zero on error.
KWallet.Wallet openWallet | ( | self, | ||
QString | name, | |||
WId | w, | |||
KWallet.Wallet.OpenType | ot=KWallet.Wallet.Synchronous | |||
) |
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. You can pass 0 if you don't have a window the password dialog should associate with.
- Returns:
- Returns a pointer to the wallet if successful, or a null pointer on error or if rejected.
int, QByteArray value readEntry | ( | self, | ||
QString | key | |||
) |
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.
int, QMap |
( | self, | ||
QString | key | |||
) |
Read the entries matching 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. Wildcards are supported. value A buffer to fill with the value. The key in the map is the entry key.
- Returns:
- Returns 0 on success, non-zero on error.
int, QMap |
( | self, | ||
QString | key | |||
) |
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.
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.
int, QMap |
( | self, | ||
QString | key | |||
) |
Read the password entry key from the current folder.
- Parameters:
-
key The key of the entry to read. Wildcards are supported. value A buffer to fill with the value. The key in the map is the entry key.
- Returns:
- Returns 0 on success, non-zero on error. Will return an error if the key was not originally written as a password.
int removeEntry | ( | self, | ||
QString | key | |||
) |
Remove the entry key from the current folder.
- Parameters:
-
key The key to remove.
- Returns:
- Returns 0 on success, non-zero on error.
bool removeFolder | ( | self, | ||
QString | f | |||
) |
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.
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.
requestChangePassword | ( | self, | ||
WId | w | |||
) |
Request to the wallet service to change the password of the current wallet.
- Parameters:
-
w The window id to associate any dialogs with. You can pass 0 if you don't have a window the password dialog should associate with.
bool setFolder | ( | self, | ||
QString | f | |||
) |
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.
int sync | ( | self ) |
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.
QStringList users | ( | self, | ||
QString | wallet | |||
) |
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.
walletClosed | ( | self ) |
Emitted when this wallet is closed.
- Signal syntax:
QObject.connect(source, SIGNAL("walletClosed()"), target_slot)
QStringList walletList | ( | self ) |
List all the wallets available.
- Returns:
- Returns a list of the names of all wallets that are open.
QString walletName | ( | self ) |
The name of the current wallet.
walletOpened | ( | self, | ||
bool | success | |||
) |
Emitted when a wallet is opened in asynchronous mode.
- Parameters:
-
success True if the wallet was opened successfully.
- Signal syntax:
QObject.connect(source, SIGNAL("walletOpened(bool)"), target_slot)
int writeEntry | ( | self, | ||
QString | key, | |||
QByteArray | value, | |||
KWallet.Wallet.EntryType | entryType | |||
) |
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.
int writeEntry | ( | self, | ||
QString | key, | |||
QByteArray | value | |||
) |
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.
int writeMap | ( | self, | ||
QString | key, | |||
QMap |
value | |||
) |
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.
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.
Enumeration Documentation
EntryType |
- Enumerator:
-
Unknown = 0 Password Stream Map Unused = 0xffff
OpenType |
- Enumerator:
-
Synchronous = 0 Asynchronous Path OpenTypeUnused = 0xff