Hello, here is new version of addressbook interface

#ifndef ADDRESSBOOK_INTERFACE
#define ADDRESSBOOK_INTERFACE

#include <QList>
#include <QObject>
#include <QPair>
#include <QString>
#include <QStringList>
#include <QtPlugin>

class AddressbookInterface : public QObject {

    Q_OBJECT

public:
    AddressbookInterface(QObject *parent) : QObject(parent) {}

public slots:
    /**
     * @short Request a list of pairs (name, email) matching contacts and emit 
signal @see completionAvailable when finish
     * @p input is input string
     * @p ignores is list of strings which are NOT included in result
     * @p max is the demanded maximum reply length, negative value means 
"uncapped"
     **/
    virtual void requestCompletion(const QString &input, const QStringList 
&ignores = QStringList(), int max = -1) = 0;

    /**
     * @short Request a list of display names matching the given e-mail address 
and emit signal @see 
prettyNamesForAddressAvailable when finish
     * @p email is e-mail address
     **/
    virtual void requestPrettyNamesForAddress(const QString &email) = 0;

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

    /**
     * @short Open window for specified contact
     * first try to match contact by email, then by name
     * if contact not exist, open window for adding new contact and fill name 
and email strings
     **/
    virtual void openContactWindow(const QString &email, const QString &name) = 
0;

signals:
    /**
     * @short Emitted when @see requestCompletion finish
     **/
    void completionAvailable(const QString &input, const QList < QPair 
<QString, QString> > &completion);

    /**
     * @short Emitted when @see requestPrettyNamesForAddress finish
     **/
    void prettyNamesForAddressAvailable(const QString &email, const QStringList 
&displayNames);

};

class AddressbookFactoryInterface {

public:
    /**
     * @short Return name of plugin
     **/
    virtual QString name() const = 0;

    /**
     * @short Return description of plugin
     **/
    virtual QString description() const = 0;

    /**
     * @short Return true if this plugin is valid and can be used (e.g this 
addressbook is installed and usable)
     **/
    virtual bool isValid() const = 0;

    /**
     * @short Return new AddressbookInterface instance implemented by plugin
     **/
    virtual AddressbookInterface *create(QObject *parent) = 0;

};

Q_DECLARE_INTERFACE(AddressbookFactoryInterface, "AddressbookFactoryInterface");

#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