![]() |
Master Core
v0.0.9 - 2abfd2849db8ba7a83957c64eb976b406713c123
|
Qt model of the address book in the core. More...
#include <addresstablemodel.h>
Public Types | |
enum | ColumnIndex { Label = 0, Address = 1 } |
enum | RoleIndex { TypeRole = Qt::UserRole } |
enum | EditStatus { OK, NO_CHANGES, INVALID_ADDRESS, DUPLICATE_ADDRESS, WALLET_UNLOCK_FAILURE, KEY_GENERATION_FAILURE } |
Return status of edit/insert operation. More... | |
Public Slots | |
void | updateEntry (const QString &address, const QString &label, bool isMine, const QString &purpose, int status) |
Public Member Functions | |
AddressTableModel (CWallet *wallet, WalletModel *parent=0) | |
~AddressTableModel () | |
QString | addRow (const QString &type, const QString &label, const QString &address) |
QString | labelForAddress (const QString &address) const |
int | lookupAddress (const QString &address) const |
EditStatus | getEditStatus () const |
Methods overridden from QAbstractTableModel | |
int | rowCount (const QModelIndex &parent) const |
int | columnCount (const QModelIndex &parent) const |
QVariant | data (const QModelIndex &index, int role) const |
bool | setData (const QModelIndex &index, const QVariant &value, int role) |
QVariant | headerData (int section, Qt::Orientation orientation, int role) const |
QModelIndex | index (int row, int column, const QModelIndex &parent) const |
bool | removeRows (int row, int count, const QModelIndex &parent=QModelIndex()) |
Qt::ItemFlags | flags (const QModelIndex &index) const |
Static Public Attributes | |
static const QString | Send = "S" |
Specifies send address. More... | |
static const QString | Receive = "R" |
Specifies receive address. More... | |
Private Member Functions | |
void | emitDataChanged (int index) |
Notify listeners that data changed. More... | |
Private Attributes | |
WalletModel * | walletModel |
CWallet * | wallet |
AddressTablePriv * | priv |
QStringList | columns |
EditStatus | editStatus |
Friends | |
class | AddressTablePriv |
Qt model of the address book in the core.
This allows views to access and modify the address book.
Definition at line 19 of file addresstablemodel.h.
Enumerator | |
---|---|
Label |
User specified label. |
Address |
Bitcoin address. |
Definition at line 27 of file addresstablemodel.h.
Return status of edit/insert operation.
Definition at line 37 of file addresstablemodel.h.
Enumerator | |
---|---|
TypeRole |
Definition at line 32 of file addresstablemodel.h.
|
explicit |
Definition at line 165 of file addresstablemodel.cpp.
References AddressTablePriv, columns, priv, and AddressTablePriv::refreshAddressTable().
AddressTableModel::~AddressTableModel | ( | ) |
Definition at line 173 of file addresstablemodel.cpp.
References priv.
QString AddressTableModel::addRow | ( | const QString & | type, |
const QString & | label, | ||
const QString & | address | ||
) |
Definition at line 343 of file addresstablemodel.cpp.
References CWallet::cs_wallet, DUPLICATE_ADDRESS, editStatus, CPubKey::GetID(), CWallet::GetKeyFromPool(), INVALID_ADDRESS, KEY_GENERATION_FAILURE, LOCK, CWallet::mapAddressBook, OK, Receive, WalletModel::requestUnlock(), Send, CWallet::SetAddressBook(), WalletModel::validateAddress(), wallet, WALLET_UNLOCK_FAILURE, and walletModel.
Referenced by ReceiveCoinsDialog::on_receiveButton_clicked(), and EditAddressDialog::saveCurrentRow().
int AddressTableModel::columnCount | ( | const QModelIndex & | parent | ) | const |
Definition at line 184 of file addresstablemodel.cpp.
References columns.
QVariant AddressTableModel::data | ( | const QModelIndex & | index, |
int | role | ||
) | const |
Definition at line 190 of file addresstablemodel.cpp.
References AddressTableEntry::address, Address, GUIUtil::bitcoinAddressFont(), AddressTableEntry::label, Label, Receive, AddressTableEntry::Receiving, Send, AddressTableEntry::Sending, AddressTableEntry::type, and TypeRole.
Referenced by TransactionView::editLabel(), and index().
|
private |
Notify listeners that data changed.
Definition at line 449 of file addresstablemodel.cpp.
References columns, and index().
Referenced by AddressTablePriv::updateEntry().
Qt::ItemFlags AddressTableModel::flags | ( | const QModelIndex & | index | ) | const |
Definition at line 305 of file addresstablemodel.cpp.
References Label, AddressTableEntry::Receiving, AddressTableEntry::Sending, and AddressTableEntry::type.
|
inline |
Definition at line 75 of file addresstablemodel.h.
References editStatus.
Referenced by EditAddressDialog::accept().
Definition at line 293 of file addresstablemodel.cpp.
References columns.
Definition at line 322 of file addresstablemodel.cpp.
References data(), AddressTablePriv::index(), and priv.
Referenced by TransactionView::editLabel(), emitDataChanged(), lookupAddress(), and AddressBookPage::selectNewAddress().
QString AddressTableModel::labelForAddress | ( | const QString & | address | ) | const |
Definition at line 421 of file addresstablemodel.cpp.
References CWallet::cs_wallet, LOCK, CWallet::mapAddressBook, and wallet.
Referenced by TransactionTableModel::addressColor(), SendCoinsDialog::coinControlChangeEdited(), TransactionTableModel::data(), TransactionTableModel::lookupAddress(), ReceiveCoinsDialog::on_receiveButton_clicked(), SendCoinsEntry::updateLabel(), and CoinControlDialog::updateView().
int AddressTableModel::lookupAddress | ( | const QString & | address | ) | const |
Definition at line 435 of file addresstablemodel.cpp.
References Address, and index().
Referenced by TransactionView::editLabel().
bool AddressTableModel::removeRows | ( | int | row, |
int | count, | ||
const QModelIndex & | parent = QModelIndex() |
||
) |
Definition at line 402 of file addresstablemodel.cpp.
References AddressTableEntry::address, CWallet::cs_wallet, CWallet::DelAddressBook(), AddressTablePriv::index(), LOCK, priv, AddressTableEntry::Receiving, AddressTableEntry::type, and wallet.
int AddressTableModel::rowCount | ( | const QModelIndex & | parent | ) | const |
Definition at line 178 of file addresstablemodel.cpp.
References priv, and AddressTablePriv::size().
bool AddressTableModel::setData | ( | const QModelIndex & | index, |
const QVariant & | value, | ||
int | role | ||
) |
Definition at line 237 of file addresstablemodel.cpp.
References AddressTableEntry::address, Address, CWallet::cs_wallet, CWallet::DelAddressBook(), DUPLICATE_ADDRESS, editStatus, INVALID_ADDRESS, AddressTableEntry::label, Label, LOCK, CWallet::mapAddressBook, NO_CHANGES, OK, AddressTableEntry::Sending, CWallet::SetAddressBook(), AddressTableEntry::type, and wallet.
|
slot |
Definition at line 336 of file addresstablemodel.cpp.
References priv, and AddressTablePriv::updateEntry().
Referenced by WalletModel::updateAddressBook().
|
friend |
Definition at line 92 of file addresstablemodel.h.
Referenced by AddressTableModel().
|
private |
Definition at line 81 of file addresstablemodel.h.
Referenced by AddressTableModel(), columnCount(), emitDataChanged(), and headerData().
|
private |
Definition at line 82 of file addresstablemodel.h.
Referenced by addRow(), getEditStatus(), and setData().
|
private |
Definition at line 80 of file addresstablemodel.h.
Referenced by AddressTableModel(), index(), removeRows(), rowCount(), updateEntry(), and ~AddressTableModel().
|
static |
Specifies receive address.
Definition at line 47 of file addresstablemodel.h.
Referenced by addRow(), data(), TransactionView::editLabel(), ReceiveCoinsDialog::on_receiveButton_clicked(), EditAddressDialog::saveCurrentRow(), and AddressBookPage::setModel().
|
static |
Specifies send address.
Definition at line 46 of file addresstablemodel.h.
Referenced by addRow(), data(), EditAddressDialog::saveCurrentRow(), and AddressBookPage::setModel().
|
private |
Definition at line 79 of file addresstablemodel.h.
Referenced by addRow(), labelForAddress(), removeRows(), and setData().
|
private |
Definition at line 78 of file addresstablemodel.h.
Referenced by addRow().