I'm sending new password interface. Now instead of type enum, plugin should emit one of result signal (with this pointer). Also I removed private variables which are not needed anymore.
#ifndef PASSWORD_INTERFACE
#define PASSWORD_INTERFACE
#include <QObject>
#include <QString>
#include <QtPlugin>
class PasswordJob : public QObject {
Q_OBJECT
public:
enum Error {
UnknownError,
Stopped,
NoPassword
};
public slots:
/**
* @short Start job
* when finish it will emit just one signal from this class (depends on job
type)
**/
virtual void start() = 0;
/**
* @short Stop job and emit error signal Stopped
**/
virtual void stop() = 0;
signals:
/**
* @short Emitted when password is available
**/
void passwordAvailable(PasswordJob *job, const QString &password);
/**
* @short Emitted when job finish storing password
**/
void passwordStored(PasswordJob *job);
/**
* @short Emitted when job finish deleting password
**/
void passwordDeleted(PasswordJob *job);
/**
* @short Emitted when job finish unsuccessfull with error
**/
void error(PasswordJob *job, PasswordJob::Error error);
protected:
PasswordJob(QObject *parent) : QObject(parent) {}
};
class PasswordInterface : public QObject {
Q_OBJECT
public slots:
/**
* @short Request password associated with accountId and accountType and
return PasswordJob
**/
virtual PasswordJob *requestPassword(const QString &accountId, const
QString &accountType) = 0;
/**
* @short Save password for accountId and accountType and return PasswordJob
**/
virtual PasswordJob *storePassword(const QString &accountId, const QString
&accountType, const QString &password) = 0;
/**
* @short Delete password for accountId and accountType and return
PasswordJob
**/
virtual PasswordJob *deletePassword(const QString &accountId, const QString
&accountType) = 0;
protected:
PasswordInterface(QObject *parent) : QObject(parent) {}
};
class PasswordFactoryInterface {
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
password storage is available)
**/
virtual bool isValid() const = 0;
/**
* @short Return new PasswordInterface instance implemented by plugin
**/
virtual PasswordInterface *create(QObject *parent) = 0;
};
Q_DECLARE_INTERFACE(PasswordFactoryInterface, "PasswordFactoryInterface");
#endif //PASSWORD_INTERFACE
--
Pali Rohár
[email protected]
signature.asc
Description: This is a digitally signed message part.
