#include <QStringList>
class AddressTablePriv;
+class CWallet;
class AddressTableModel : public QAbstractTableModel
{
Q_OBJECT
public:
- explicit AddressTableModel(QObject *parent = 0);
+ explicit AddressTableModel(CWallet *wallet, QObject *parent = 0);
~AddressTableModel();
enum ColumnIndex {
Label = 0, /* User specified label */
- Address = 1 /* Bitcoin address */
+ Address = 1, /* Bitcoin address */
+ IsDefaultAddress = 2 /* Is default address? */
};
enum {
/* Add an address to the model.
Returns the added address on success, and an empty string otherwise.
*/
- QString addRow(const QString &type, const QString &label, const QString &address);
+ QString addRow(const QString &type, const QString &label, const QString &address, bool setAsDefault);
+
+ /* Set and get default address */
+ QString getDefaultAddress() const;
+ void setDefaultAddress(const QString &defaultAddress);
/* Update address list from core. Invalidates any indices.
*/
void updateList();
+
private:
+ CWallet *wallet;
AddressTablePriv *priv;
QStringList columns;
+
signals:
+ void defaultAddressChanged(const QString &address);
public slots:
-
+ void update();
};
#endif // ADDRESSTABLEMODEL_H