Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

addresstablemodel.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2015 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #ifndef BITCOIN_QT_ADDRESSTABLEMODEL_H
6 #define BITCOIN_QT_ADDRESSTABLEMODEL_H
7 
8 #include <base58.h>
9 
10 #include <QAbstractTableModel>
11 #include <QStringList>
12 
13 class AddressTablePriv;
14 class WalletModel;
15 
16 class CWallet;
17 
21 class AddressTableModel : public QAbstractTableModel
22 {
23  Q_OBJECT
24 
25 public:
26  explicit AddressTableModel(CWallet *wallet, WalletModel *parent = 0);
28 
29  enum ColumnIndex {
30  Label = 0,
31  Address = 1
32  };
33 
34  enum RoleIndex {
35  TypeRole = Qt::UserRole
36  };
37 
39  enum EditStatus {
40  OK,
46  };
47 
48  static const QString Send;
49  static const QString Receive;
53  int rowCount(const QModelIndex &parent) const;
54  int columnCount(const QModelIndex &parent) const;
55  QVariant data(const QModelIndex &index, int role) const;
56  bool setData(const QModelIndex &index, const QVariant &value, int role);
57  QVariant headerData(int section, Qt::Orientation orientation, int role) const;
58  QModelIndex index(int row, int column, const QModelIndex &parent) const;
59  bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
60  Qt::ItemFlags flags(const QModelIndex &index) const;
63  /* Add an address to the model.
64  Returns the added address on success, and an empty string otherwise.
65  */
66  QString addRow(const QString &type, const QString &label, const QString &address);
67 
68  /* Look up label for address in address book, if not found return empty string.
69  */
70  QString labelForAddress(const QString &address) const;
71  QString labelForDestination(const CTxDestination &dest) const;
72 
73  /* Look up row index of an address in the model.
74  Return -1 if not found.
75  */
76  int lookupAddress(const QString &address) const;
77 
78  EditStatus getEditStatus() const { return editStatus; }
79 
80 private:
84  QStringList columns;
86 
88  void emitDataChanged(int index);
89 
90 public Q_SLOTS:
91  /* Update address list from core.
92  */
93  void updateEntry(const QString &address, const QString &label, bool isMine, const QString &purpose, int status);
94 
95  friend class AddressTablePriv;
96 };
97 
98 #endif // BITCOIN_QT_ADDRESSTABLEMODEL_H
AddressTableModel(CWallet *wallet, WalletModel *parent=0)
Generating a new public key for a receiving address failed.
boost::variant< CNoDestination, CKeyID, CScriptID > CTxDestination
A txout script template with a specific destination.
Definition: standard.h:80
QModelIndex index(int row, int column, const QModelIndex &parent) const
int lookupAddress(const QString &address) const
Qt::ItemFlags flags(const QModelIndex &index) const
WalletModel * walletModel
Address already in address book.
QVariant headerData(int section, Qt::Orientation orientation, int role) const
static const QString Send
Specifies send address.
int rowCount(const QModelIndex &parent) const
int columnCount(const QModelIndex &parent) const
Wallet could not be unlocked to create new receiving address.
EditStatus
Return status of edit/insert operation.
QString labelForAddress(const QString &address) const
Qt model of the address book in the core.
QString addRow(const QString &type, const QString &label, const QString &address)
bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex())
AddressTablePriv * priv
Interface to Bitcoin wallet from Qt view code.
Definition: walletmodel.h:100
static const QString Receive
Specifies receive address.
void emitDataChanged(int index)
Notify listeners that data changed.
QVariant data(const QModelIndex &index, int role) const
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances...
Definition: wallet.h:715
static int count
Definition: tests.c:45
QString labelForDestination(const CTxDestination &dest) const
bool setData(const QModelIndex &index, const QVariant &value, int role)
No changes were made during edit operation.
EditStatus getEditStatus() const
User specified label.
void updateEntry(const QString &address, const QString &label, bool isMine, const QString &purpose, int status)
Type of address (Send or Receive)
Released under the MIT license