-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathKeyStore.hpp
50 lines (34 loc) · 1.32 KB
/
KeyStore.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef KEYSTORE_HPP
#define KEYSTORE_HPP
#include "AccountKeys.hpp"
#include <QObject>
#include <QQmlObjectListModel.h>
class KeyStore : public QObject
{
Q_OBJECT
QML_OBJMODEL_PROPERTY(AccountKeys, accountList)
Q_PROPERTY(QString password READ password WRITE setPassword NOTIFY passwordChanged)
Q_PROPERTY(bool hasPersistedData READ hasPersistedData NOTIFY hasPersistedDataChanged)
QString m_password;
public:
explicit KeyStore(QObject *parent = 0);
/// Determines whether the provided account is supported or not. If unsupported, the human-readable reason is
/// returned. If supported, the null string is returned.
Q_INVOKABLE QString accountUnsupportedReason(QVariantMap account);
Q_INVOKABLE AccountKeys* findAccount(QString accountName);
Q_INVOKABLE AccountKeys* addAccount(QVariantMap account);
Q_INVOKABLE bool hasPersistedData();
Q_INVOKABLE bool restore();
/// Because QML can't make them on its own...
Q_INVOKABLE static KeyPair* makeKeyPair() { return new KeyPair(); }
QString password() const { return m_password; }
public slots:
void persist();
void resetPersistence();
void setPassword(QString password);
signals:
void passwordChanged(QString password);
void hasPersistedDataChanged(bool);
void restored();
};
#endif // KEYSTORE_HPP