2017-07-03 09:30:10 +02:00
|
|
|
/*!
|
|
|
|
* \brief Model implementation for the CV certificate description.
|
|
|
|
*
|
2018-03-28 15:10:51 +02:00
|
|
|
* \copyright Copyright (c) 2016-2018 Governikus GmbH & Co. KG, Germany
|
2017-07-03 09:30:10 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QAbstractListModel>
|
|
|
|
#include <QPair>
|
|
|
|
#include <QSharedPointer>
|
|
|
|
#include <QString>
|
|
|
|
#include <QVector>
|
|
|
|
|
|
|
|
namespace governikus
|
|
|
|
{
|
|
|
|
|
|
|
|
class AuthContext;
|
|
|
|
struct CertificateDescription;
|
|
|
|
struct cvcertificate_st;
|
|
|
|
|
|
|
|
|
|
|
|
class CertificateDescriptionModel
|
|
|
|
: public QAbstractListModel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
Q_PROPERTY(QString subjectName READ getSubjectName NOTIFY fireChanged)
|
|
|
|
Q_PROPERTY(QString purpose READ getPurpose NOTIFY fireChanged)
|
|
|
|
|
|
|
|
QVector<QPair<QString, QString> > mData;
|
|
|
|
QSharedPointer<AuthContext> mContext;
|
|
|
|
|
|
|
|
enum UserRoles
|
|
|
|
{
|
|
|
|
LABEL = Qt::UserRole + 1,
|
|
|
|
TEXT
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2017-12-20 14:54:05 +01:00
|
|
|
inline QSharedPointer<const CertificateDescription> getCertificateDescription() const;
|
2017-07-03 09:30:10 +02:00
|
|
|
inline QString getValidity() const;
|
2017-12-20 14:54:05 +01:00
|
|
|
void initModelData(const QSharedPointer<const CertificateDescription>& pCertDescription);
|
2017-07-03 09:30:10 +02:00
|
|
|
|
|
|
|
private Q_SLOTS:
|
|
|
|
void onDidAuthenticateEac1Changed();
|
|
|
|
|
|
|
|
public:
|
|
|
|
CertificateDescriptionModel(QObject* pParent = nullptr);
|
|
|
|
|
2017-07-03 09:33:28 +02:00
|
|
|
void resetContext(const QSharedPointer<AuthContext>& pContext = QSharedPointer<AuthContext>());
|
2017-07-03 09:30:10 +02:00
|
|
|
|
|
|
|
QString getSubjectName() const;
|
|
|
|
QString getSubjectUrl() const;
|
|
|
|
QString getPurpose() const;
|
|
|
|
|
|
|
|
int rowCount(const QModelIndex& = QModelIndex()) const override;
|
|
|
|
QVariant data(const QModelIndex& pIndex, int pRole = Qt::DisplayRole) const override;
|
|
|
|
QHash<int, QByteArray> roleNames() const override;
|
|
|
|
|
|
|
|
Q_SIGNALS:
|
|
|
|
void fireChanged();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} /* namespace governikus */
|