Somewhat confident now, tested on GNOME+KDE, with all types of transactions. Next...
[novacoin.git] / src / qt / addresstablemodel.h
1 #ifndef ADDRESSTABLEMODEL_H
2 #define ADDRESSTABLEMODEL_H
3
4 #include <QAbstractTableModel>
5 #include <QStringList>
6
7 class AddressTablePriv;
8
9 class AddressTableModel : public QAbstractTableModel
10 {
11     Q_OBJECT
12 public:
13     explicit AddressTableModel(QObject *parent = 0);
14     ~AddressTableModel();
15
16     enum ColumnIndex {
17         Label = 0,   /* User specified label */
18         Address = 1  /* Bitcoin address */
19     };
20
21     enum {
22         TypeRole = Qt::UserRole
23     } RoleIndex;
24
25     static const QString Send; /* Send addres */
26     static const QString Receive; /* Receive address */
27
28     /* Overridden methods from QAbstractTableModel */
29     int rowCount(const QModelIndex &parent) const;
30     int columnCount(const QModelIndex &parent) const;
31     QVariant data(const QModelIndex &index, int role) const;
32     bool setData(const QModelIndex & index, const QVariant & value, int role);
33     QVariant headerData(int section, Qt::Orientation orientation, int role) const;
34     QModelIndex index(int row, int column, const QModelIndex & parent) const;
35     bool removeRows(int row, int count, const QModelIndex & parent = QModelIndex());
36
37     /* Add an address to the model.
38        Returns the added address on success, and an empty string otherwise.
39      */
40     QString addRow(const QString &type, const QString &label, const QString &address);
41
42     /* Update address list from core. Invalidates any indices.
43      */
44     void updateList();
45 private:
46     AddressTablePriv *priv;
47     QStringList columns;
48 signals:
49
50 public slots:
51
52 };
53
54 #endif // ADDRESSTABLEMODEL_H