2016-12-10 01:01:04 +00:00
|
|
|
#ifndef ADDRESSBOOK_H
|
|
|
|
#define ADDRESSBOOK_H
|
|
|
|
|
2017-12-08 07:29:28 +00:00
|
|
|
#include <wallet/api/wallet2_api.h>
|
2016-12-10 01:01:04 +00:00
|
|
|
#include <QObject>
|
|
|
|
#include <QList>
|
|
|
|
#include <QDateTime>
|
|
|
|
|
2016-12-14 22:28:20 +00:00
|
|
|
namespace Monero {
|
2016-12-10 01:01:04 +00:00
|
|
|
class AddressBook;
|
|
|
|
}
|
|
|
|
class AddressBookRow;
|
|
|
|
|
|
|
|
class AddressBook : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2016-12-14 22:28:20 +00:00
|
|
|
Q_INVOKABLE QList<Monero::AddressBookRow*> getAll(bool update = false) const;
|
|
|
|
Q_INVOKABLE Monero::AddressBookRow * getRow(int index) const;
|
2016-12-10 01:01:04 +00:00
|
|
|
Q_INVOKABLE bool addRow(const QString &address, const QString &payment_id, const QString &description) const;
|
|
|
|
Q_INVOKABLE bool deleteRow(int rowId) const;
|
|
|
|
quint64 count() const;
|
|
|
|
Q_INVOKABLE QString errorString() const;
|
|
|
|
Q_INVOKABLE int errorCode() const;
|
2016-12-24 16:21:39 +00:00
|
|
|
Q_INVOKABLE int lookupPaymentID(const QString &payment_id) const;
|
2016-12-10 01:01:04 +00:00
|
|
|
|
|
|
|
enum ErrorCode {
|
|
|
|
Status_Ok,
|
|
|
|
General_Error,
|
|
|
|
Invalid_Address,
|
|
|
|
Invalid_Payment_Id
|
|
|
|
};
|
|
|
|
|
|
|
|
Q_ENUM(ErrorCode);
|
|
|
|
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void refreshStarted() const;
|
|
|
|
void refreshFinished() const;
|
|
|
|
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
|
|
|
private:
|
2016-12-14 22:28:20 +00:00
|
|
|
explicit AddressBook(Monero::AddressBook * abImpl, QObject *parent);
|
2016-12-10 01:01:04 +00:00
|
|
|
friend class Wallet;
|
2016-12-14 22:28:20 +00:00
|
|
|
Monero::AddressBook * m_addressBookImpl;
|
|
|
|
mutable QList<Monero::AddressBookRow*> m_rows;
|
2016-12-10 01:01:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // ADDRESSBOOK_H
|