Fabcoin Core  0.16.2
P2P Digital Currency
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 FABCOIN_QT_ADDRESSTABLEMODEL_H
6 #define FABCOIN_QT_ADDRESSTABLEMODEL_H
7 
8 #include <QAbstractTableModel>
9 #include <QStringList>
10 
11 class AddressTablePriv;
12 class WalletModel;
13 
14 class CWallet;
15 
19 class AddressTableModel : public QAbstractTableModel
20 {
21  Q_OBJECT
22 
23 public:
24  explicit AddressTableModel(CWallet *wallet, WalletModel *parent = 0);
26 
27  enum ColumnIndex {
28  Label = 0,
29  Address = 1
30  };
31 
32  enum RoleIndex {
33  TypeRole = Qt::UserRole
34  };
35 
37  enum EditStatus {
38  OK,
44  };
45 
46  static const QString Send;
47  static const QString Receive;
51  int rowCount(const QModelIndex &parent) const;
52  int columnCount(const QModelIndex &parent) const;
53  QVariant data(const QModelIndex &index, int role) const;
54  bool setData(const QModelIndex &index, const QVariant &value, int role);
55  QVariant headerData(int section, Qt::Orientation orientation, int role) const;
56  QModelIndex index(int row, int column, const QModelIndex &parent) const;
57  bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
58  Qt::ItemFlags flags(const QModelIndex &index) const;
61  /* Add an address to the model.
62  Returns the added address on success, and an empty string otherwise.
63  */
64  QString addRow(const QString &type, const QString &label, const QString &address);
65 
66  /* Look up label for address in address book, if not found return empty string.
67  */
68  QString labelForAddress(const QString &address) const;
69 
70  /* Look up row index of an address in the model.
71  Return -1 if not found.
72  */
73  int lookupAddress(const QString &address) const;
74 
75  EditStatus getEditStatus() const { return editStatus; }
76 
77 private:
81  QStringList columns;
83 
85  void emitDataChanged(int index);
86 
87 public Q_SLOTS:
88  /* Update address list from core.
89  */
90  void updateEntry(const QString &address, const QString &label, bool isMine, const QString &purpose, int status);
91 
92  friend class AddressTablePriv;
93 };
94 
95 #endif // FABCOIN_QT_ADDRESSTABLEMODEL_H
AddressTableModel(CWallet *wallet, WalletModel *parent=0)
QModelIndex index(int row, int column, const QModelIndex &parent) const
Generating a new public key for a receiving address failed.
WalletModel * walletModel
int lookupAddress(const QString &address) const
size_t count
Definition: ExecStats.cpp:37
Address already in address book.
static const QString Send
Specifies send address.
Wallet could not be unlocked to create new receiving address.
EditStatus
Return status of edit/insert operation.
int rowCount(const QModelIndex &parent) const
Qt model of the address book in the core.
EditStatus getEditStatus() const
QString addRow(const QString &type, const QString &label, const QString &address)
bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex())
QString labelForAddress(const QString &address) const
PlatformStyle::TableColorType type
Definition: rpcconsole.cpp:61
QVariant data(const QModelIndex &index, int role) const
AddressTablePriv * priv
Interface to Fabcoin wallet from Qt view code.
Definition: walletmodel.h:103
static const QString Receive
Specifies receive address.
QVariant headerData(int section, Qt::Orientation orientation, int role) const
void emitDataChanged(int index)
Notify listeners that data changed.
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances...
Definition: wallet.h:672
bool setData(const QModelIndex &index, const QVariant &value, int role)
struct evm_uint160be address(struct evm_env *env)
Definition: capi.c:13
No changes were made during edit operation.
User specified label.
Qt::ItemFlags flags(const QModelIndex &index) const
void updateEntry(const QString &address, const QString &label, bool isMine, const QString &purpose, int status)
Type of address (Send or Receive)
int columnCount(const QModelIndex &parent) const