1 #ifndef ADDRESSTABLEMODEL_H
2 #define ADDRESSTABLEMODEL_H
4 #include <QAbstractTableModel>
7 class AddressTablePriv;
10 class AddressTableModel : public QAbstractTableModel
14 explicit AddressTableModel(CWallet *wallet, QObject *parent = 0);
18 Label = 0, /* User specified label */
19 Address = 1, /* Bitcoin address */
20 IsDefaultAddress = 2 /* Is default address? */
24 TypeRole = Qt::UserRole
27 static const QString Send; /* Send addres */
28 static const QString Receive; /* Receive address */
30 /* Overridden methods from QAbstractTableModel */
31 int rowCount(const QModelIndex &parent) const;
32 int columnCount(const QModelIndex &parent) const;
33 QVariant data(const QModelIndex &index, int role) const;
34 bool setData(const QModelIndex & index, const QVariant & value, int role);
35 QVariant headerData(int section, Qt::Orientation orientation, int role) const;
36 QModelIndex index(int row, int column, const QModelIndex & parent) const;
37 bool removeRows(int row, int count, const QModelIndex & parent = QModelIndex());
39 /* Add an address to the model.
40 Returns the added address on success, and an empty string otherwise.
42 QString addRow(const QString &type, const QString &label, const QString &address, bool setAsDefault);
44 /* Set and get default address */
45 QString getDefaultAddress() const;
46 void setDefaultAddress(const QString &defaultAddress);
48 /* Update address list from core. Invalidates any indices.
54 AddressTablePriv *priv;
58 void defaultAddressChanged(const QString &address);
64 #endif // ADDRESSTABLEMODEL_H