Bitcoin Core  0.15.99
P2P Digital Currency
Public Types | Public Slots | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Friends | List of all members
AddressTableModel Class Reference

Qt model of the address book in the core. More...

#include <addresstablemodel.h>

Inheritance diagram for AddressTableModel:
[legend]
Collaboration diagram for AddressTableModel:
[legend]

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 (WalletModel *parent=0)
 
 ~AddressTableModel ()
 
QString addRow (const QString &type, const QString &label, const QString &address, const OutputType address_type)
 
QString labelForAddress (const QString &address) const
 Look up label for address in address book, if not found return empty string. More...
 
QString purposeForAddress (const QString &address) const
 Look up purpose for address in address book, if not found return empty string. More...
 
int lookupAddress (const QString &address) const
 
EditStatus getEditStatus () const
 
OutputType GetDefaultAddressType () 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

bool getAddressData (const QString &address, std::string *name, std::string *purpose) const
 Look up address book data given an address string. More...
 
void emitDataChanged (int index)
 Notify listeners that data changed. More...
 

Private Attributes

WalletModel *const walletModel
 
AddressTablePrivpriv = nullptr
 
QStringList columns
 
EditStatus editStatus = OK
 

Friends

class AddressTablePriv
 

Detailed Description

Qt model of the address book in the core.

This allows views to access and modify the address book.

Definition at line 23 of file addresstablemodel.h.

Member Enumeration Documentation

Enumerator
Label 

User specified label.

Address 

Bitcoin address.

Definition at line 31 of file addresstablemodel.h.

Return status of edit/insert operation.

Enumerator
OK 

Everything ok.

NO_CHANGES 

No changes were made during edit operation.

INVALID_ADDRESS 

Unparseable address.

DUPLICATE_ADDRESS 

Address already in address book.

WALLET_UNLOCK_FAILURE 

Wallet could not be unlocked to create new receiving address.

KEY_GENERATION_FAILURE 

Generating a new public key for a receiving address failed.

Definition at line 41 of file addresstablemodel.h.

Enumerator
TypeRole 

Type of address (Send or Receive)

Definition at line 36 of file addresstablemodel.h.

Constructor & Destructor Documentation

AddressTableModel::AddressTableModel ( WalletModel parent = 0)
explicit

Definition at line 161 of file addresstablemodel.cpp.

Here is the call graph for this function:

AddressTableModel::~AddressTableModel ( )

Definition at line 169 of file addresstablemodel.cpp.

Member Function Documentation

QString AddressTableModel::addRow ( const QString &  type,
const QString &  label,
const QString &  address,
const OutputType  address_type 
)

Definition at line 339 of file addresstablemodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int AddressTableModel::columnCount ( const QModelIndex &  parent) const

Definition at line 180 of file addresstablemodel.cpp.

QVariant AddressTableModel::data ( const QModelIndex &  index,
int  role 
) const

Definition at line 186 of file addresstablemodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void AddressTableModel::emitDataChanged ( int  index)
private

Notify listeners that data changed.

Definition at line 451 of file addresstablemodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Qt::ItemFlags AddressTableModel::flags ( const QModelIndex &  index) const

Definition at line 301 of file addresstablemodel.cpp.

bool AddressTableModel::getAddressData ( const QString &  address,
std::string *  name,
std::string *  purpose 
) const
private

Look up address book data given an address string.

Definition at line 428 of file addresstablemodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

OutputType AddressTableModel::GetDefaultAddressType ( ) const

Definition at line 449 of file addresstablemodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

EditStatus AddressTableModel::getEditStatus ( ) const
inline

Definition at line 81 of file addresstablemodel.h.

Here is the caller graph for this function:

QVariant AddressTableModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role 
) const

Definition at line 289 of file addresstablemodel.cpp.

QModelIndex AddressTableModel::index ( int  row,
int  column,
const QModelIndex &  parent 
) const

Definition at line 318 of file addresstablemodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

QString AddressTableModel::labelForAddress ( const QString &  address) const

Look up label for address in address book, if not found return empty string.

Definition at line 410 of file addresstablemodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int AddressTableModel::lookupAddress ( const QString &  address) const

Definition at line 435 of file addresstablemodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

QString AddressTableModel::purposeForAddress ( const QString &  address) const

Look up purpose for address in address book, if not found return empty string.

Definition at line 419 of file addresstablemodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool AddressTableModel::removeRows ( int  row,
int  count,
const QModelIndex &  parent = QModelIndex() 
)

Definition at line 396 of file addresstablemodel.cpp.

Here is the call graph for this function:

int AddressTableModel::rowCount ( const QModelIndex &  parent) const

Definition at line 174 of file addresstablemodel.cpp.

Here is the call graph for this function:

bool AddressTableModel::setData ( const QModelIndex &  index,
const QVariant &  value,
int  role 
)

Definition at line 233 of file addresstablemodel.cpp.

Here is the call graph for this function:

void AddressTableModel::updateEntry ( const QString &  address,
const QString &  label,
bool  isMine,
const QString &  purpose,
int  status 
)
slot

Definition at line 332 of file addresstablemodel.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Friends And Related Function Documentation

friend class AddressTablePriv
friend

Definition at line 102 of file addresstablemodel.h.

Member Data Documentation

QStringList AddressTableModel::columns
private

Definition at line 88 of file addresstablemodel.h.

EditStatus AddressTableModel::editStatus = OK
private

Definition at line 89 of file addresstablemodel.h.

AddressTablePriv* AddressTableModel::priv = nullptr
private

Definition at line 87 of file addresstablemodel.h.

const QString AddressTableModel::Receive = "R"
static

Specifies receive address.

Definition at line 51 of file addresstablemodel.h.

const QString AddressTableModel::Send = "S"
static

Specifies send address.

Definition at line 50 of file addresstablemodel.h.

WalletModel* const AddressTableModel::walletModel
private

Definition at line 86 of file addresstablemodel.h.


The documentation for this class was generated from the following files: