|
|
The class KabAPI provides a public interface to access the users address database created using kab. The complete functionality regarding database operations provided by kab is available using an object of this class.
The class is derived from the class KDialogBase, thus objects can be used as a KDE dialog where the user may select a person out of the entries in his personal database. The following code may be used to let the user select an address:
KabAPI kabapi(this); if(dialog.init()!=KabAPI::NoError) { ... error handling } AddressBook::Entry entry; if(kabapi.exec()) { if(!kabapi.getEntry(entry)) { // ... the database is empty } else { // ... use the entry } } ... |
Some methods declared here return keys of entries. The keys are of the datatype KabKey. Every key is (of course) unique and identifying. If you store it, you can access the entry it represents with it. Be careful that the entry may have been deleted by another program instance meanwhile! <tt>Please be careful to test for the return code NotImplemented as long the kab API is not completely finished.</tt>
See also: KDialogBase, KDialogBase
|
The constructor creates a KabAPI object, but it does not load the database itselfes, as you could not query if this could be done without failures. Thus you have to call init before you can use the database.
Parameters:
AddressBook::ErrorCode |
You must call init before accessing the database. init opens the database file (usually $HOME/.kde/share/apps/kab/addressbook.database) and loads its contents.
Returns: NoError if all succeeded or a valid ErrorCode.
AddressBook* |
Get the addressbook object of this API. This is probably the most powerful method in the KabAPI since it allows you to access the database backend itselfes. If the API has not been initialized (using #init) before, zero is returned.
AddressBook::ErrorCode |
Save the database to the file. This method is used to force the database to save its contents. If force is true, the method will try to get writing permissions to the file if the database is opened readonly. After finishing saving, the r/o state is reset. This allows easier file sharing, since by default, all files are opened readonly aand closed after all read accesses.
AddressBook::ErrorCode |
The method getEntry returns the selected entry.
Parameters:
Returns: NoError if all succeeded or a valid ErrorCode.
AddressBook::ErrorCode |
Using the method getEntries, the caller will get a copy of all entries in the database. This might seem unneeded, but the address database can be used by multiple instances of the kab API at the same time, so that, if the programmer wants, for example, print a letter header for all persons, the database might change during the operation. That is why she can retrieve the whole database in one operation. It is required that the referenced list is empty. Note that the function returns NoEntry if the database is empty.
Parameters:
Returns: NoError or a valid error code.
AddressBook::ErrorCode |
The method requires that the database is not opened readonly.
Parameters:
Returns: NoError if all succeeded or a valid ErrorCode, especially PermDenied.
AddressBook::ErrorCode |
If the preferences of kab say to query before deleting, the user has to click "yes" on a message box that appeares. If called for a read only database, the method will return PermDenied.
Parameters:
Returns: NoEntry if there is no entry with this key or another ErrorCode.
AddressBook::ErrorCode |
Use getEntryByName to find entries that look like the name given. The name might be incomplete or diffuse.
Parameters:
Returns: NoError if an entry is found or NoEntry.
AddressBook::ErrorCode |
This method also searches for close matches to the pattern, but it compares the whole entry given. This way you can search for, for example, nearly similar email addresses. Empty parts of the entry are not considered as criteria.
Parameters:
Returns: NoError if an entry is found or NoEntry.
int |
Execute this dialog. This overloads QDialog::exec to fill the list box before showing.
AddressBook* |
[protected]
This is our backend to the users address database.
KListBox* |
[protected]
This displays the overview over the addresses in the dialog.
int |
[protected]
The index of the selected entry. This value is only valid after the KabAPI dialog has been executed and accepted by the user.
void |
[protected slot]
Capture selections in the dialog (listbox).
void |
[protected slot]
Capture status messages from book.
void |
[signal]
Send status messages.