summaryrefslogtreecommitdiffstats
path: root/pica-client/contacts.h
blob: f3f76638bd8f98657b804297ccc20f9315f6f7d3 (plain) (blame)
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
#ifndef CONTACTS_H
#define CONTACTS_H

#include <QString>
#include <QtSql>
#include <QSqlDatabase>
#include <QStringList>

class Contacts
{
public:
    struct ContactRecord
    {
        QByteArray id;
        QString name;
    };

    Contacts(QString storage, QByteArray user_account_id);

    void Add(QByteArray id);
    void Delete(QByteArray id);
    QList<ContactRecord> GetContacts();
    QString GetContactCert(QByteArray id);
    QString GetContactName(QByteArray id);
    void SetContactCert(QByteArray id, QString &cert_pem);
    void SetContactName(QByteArray id, QString name);
    QString GetLastError();
    bool isOK();
private:
    QSqlDatabase dbconn;
    QSqlError lasterr;
    QByteArray account_id_;
};

#endif // CONTACTS_H