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 */
23 TypeRole = Qt::UserRole
26 static const QString Send; /* Send addres */
27 static const QString Receive; /* Receive address */
29 /* Overridden methods from QAbstractTableModel */
30 int rowCount(const QModelIndex &parent) const;
31 int columnCount(const QModelIndex &parent) const;
32 QVariant data(const QModelIndex &index, int role) const;
33 bool setData(const QModelIndex & index, const QVariant & value, int role);
34 QVariant headerData(int section, Qt::Orientation orientation, int role) const;
35 QModelIndex index(int row, int column, const QModelIndex & parent) const;
36 bool removeRows(int row, int count, const QModelIndex & parent = QModelIndex());
37 Qt::ItemFlags flags(const QModelIndex & index) const;
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);
44 /* Update address list from core. Invalidates any indices.
48 /* Check address for validity
50 bool validateAddress(const QString &address);
54 AddressTablePriv *priv;
58 void defaultAddressChanged(const QString &address);
64 #endif // ADDRESSTABLEMODEL_H