Hello,

I'm sending first version of qt plugin interface for Addressbook. I reused 
src/Gui/AbstractAddressbook.h and I think that Trojita 
GUI only needs additional functions for opening addressbook manager (now called 
from menu: IMAP --> Address Book) and 
function for opening add/edit window for new/existing contact (now called from 
button near "From" and "To" field in email). 
Because KAddressbook has own dialogs/windows, it is better to use native KDE 
application for KDE plugin.

And about interface for password storage, please look at my last email in 
"Using QtKeychain" thread.


#ifndef ADDRESSBOOK_INTERFACE
#define ADDRESSBOOK_INTERFACE

#include <QtPlugin>

class QString;
class QStringList;

class AddressbookInterface {

public:
    virtual ~AddressbookInterface() {}

    /** @short Returns a list of matching contacts in the form "[Name 
<]a...@mail.com[>]"
     *
     * - Matches are case INsensitive
     * - The match aligns to either Name or a...@mail.com, ie. "ja" or "jkt" 
match
     *   "Jan Kundrát <j...@gentoo.org>" but "gentoo" does not
     * - Strings in the ignore list are NOT included in the return, despite 
they may match.
     * - The return can be empty.
     *
     * - @p max defines the demanded maximum reply length
     * It is intended to improve performance in the implementations
     * If you reimplement this, please notice that the return can be longer, 
but the client
     * will not make use of that. Negative values mean "uncapped"
    */
    // A maximum value is sufficient since typing "a" and getting a list with a 
hundred entries which
    // one will then navigate for the address unlikely a real use case - so 
there's no point in presenting
    // more than <place random number here> entries (or look them up, or 
transmit them)
    virtual QStringList complete(const QString &string, const QStringList 
&ignores, int max = -1) const = 0;

    /** @short Return a list of display names matching the given e-mail address 
*/
    virtual QStringList prettyNamesForAddress(const QString &mail) const = 0;

    /** @short Open window for addressbook manager */
    virtual void openAddressbookWindow() const = 0;

    /** @short Open window for edit contact */
    // first try to match contact by mail, then by name
    // if contact not exist, open window for adding new contact and fill name 
and mail strings
    // empty mail and name strings means opening window for adding new contact
    virtual void openEditContactWindow(const QString &mail = QString(), const 
QString &name = QString()) const = 0;

};

Q_DECLARE_INTERFACE(AddressbookInterface, "AddressbookInterface");

#endif //ADDRESSBOOK_INTERFACE


-- 
Pali Rohár
pali.ro...@gmail.com

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to