Bitcoin Core  27.99.0
P2P Digital Currency
Public Types | Public Member Functions | Static Public Attributes | 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 Member Functions

 AddressTableModel (WalletModel *parent=nullptr, bool pk_hash_only=false)
 
 ~AddressTableModel ()
 

Static Public Attributes

static const QString Send = "S"
 Specifies send address. More...
 
static const QString Receive = "R"
 Specifies receive address. More...
 

Methods overridden from QAbstractTableModel

WalletModel *const walletModel
 
AddressTablePrivpriv = nullptr
 
QStringList columns
 
EditStatus editStatus = OK
 
class AddressTablePriv
 
int rowCount (const QModelIndex &parent) const override
 
int columnCount (const QModelIndex &parent) const override
 
QVariant data (const QModelIndex &index, int role) const override
 
bool setData (const QModelIndex &index, const QVariant &value, int role) override
 
QVariant headerData (int section, Qt::Orientation orientation, int role) const override
 
QModelIndex index (int row, int column, const QModelIndex &parent) const override
 
bool removeRows (int row, int count, const QModelIndex &parent=QModelIndex()) override
 
Qt::ItemFlags flags (const QModelIndex &index) const override
 
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...
 
std::optional< wallet::AddressPurposepurposeForAddress (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
 
QString GetWalletDisplayName () const
 
bool getAddressData (const QString &address, std::string *name, wallet::AddressPurpose *purpose) const
 Look up address book data given an address string. More...
 
void emitDataChanged (int index)
 Notify listeners that data changed. More...
 
void updateEntry (const QString &address, const QString &label, bool isMine, wallet::AddressPurpose purpose, int status)
 

Detailed Description

Qt model of the address book in the core.

This allows views to access and modify the address book.

Definition at line 28 of file addresstablemodel.h.

Member Enumeration Documentation

◆ ColumnIndex

Enumerator
Label 

User specified label.

Address 

Bitcoin address.

Definition at line 36 of file addresstablemodel.h.

◆ EditStatus

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 46 of file addresstablemodel.h.

◆ RoleIndex

Enumerator
TypeRole 

Type of address (Send or Receive)

Definition at line 41 of file addresstablemodel.h.

Constructor & Destructor Documentation

◆ AddressTableModel()

AddressTableModel::AddressTableModel ( WalletModel parent = nullptr,
bool  pk_hash_only = false 
)
explicit

Definition at line 164 of file addresstablemodel.cpp.

Here is the call graph for this function:

◆ ~AddressTableModel()

AddressTableModel::~AddressTableModel ( )

Definition at line 172 of file addresstablemodel.cpp.

Member Function Documentation

◆ addRow()

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

Definition at line 342 of file addresstablemodel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ columnCount()

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

Definition at line 185 of file addresstablemodel.cpp.

◆ data()

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

Definition at line 193 of file addresstablemodel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ emitDataChanged()

void AddressTableModel::emitDataChanged ( int  index)
private

Notify listeners that data changed.

Definition at line 450 of file addresstablemodel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ flags()

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

Definition at line 304 of file addresstablemodel.cpp.

Here is the call graph for this function:

◆ getAddressData()

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

Look up address book data given an address string.

Definition at line 427 of file addresstablemodel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetDefaultAddressType()

OutputType AddressTableModel::GetDefaultAddressType ( ) const

Definition at line 448 of file addresstablemodel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getEditStatus()

EditStatus AddressTableModel::getEditStatus ( ) const
inline

Definition at line 86 of file addresstablemodel.h.

Here is the caller graph for this function:

◆ GetWalletDisplayName()

QString AddressTableModel::GetWalletDisplayName ( ) const

Definition at line 455 of file addresstablemodel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ headerData()

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

Definition at line 292 of file addresstablemodel.cpp.

◆ index()

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

Definition at line 321 of file addresstablemodel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ labelForAddress()

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

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

Definition at line 409 of file addresstablemodel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lookupAddress()

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

Definition at line 434 of file addresstablemodel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ purposeForAddress()

std::optional< wallet::AddressPurpose > AddressTableModel::purposeForAddress ( const QString &  address) const

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

Definition at line 418 of file addresstablemodel.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeRows()

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

Definition at line 395 of file addresstablemodel.cpp.

Here is the call graph for this function:

◆ rowCount()

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

Definition at line 177 of file addresstablemodel.cpp.

Here is the call graph for this function:

◆ setData()

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

Definition at line 236 of file addresstablemodel.cpp.

Here is the call graph for this function:

◆ updateEntry

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

Definition at line 335 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

◆ AddressTablePriv

friend class AddressTablePriv
friend

Definition at line 109 of file addresstablemodel.h.

Member Data Documentation

◆ columns

QStringList AddressTableModel::columns
private

Definition at line 95 of file addresstablemodel.h.

◆ editStatus

EditStatus AddressTableModel::editStatus = OK
private

Definition at line 96 of file addresstablemodel.h.

◆ priv

AddressTablePriv* AddressTableModel::priv = nullptr
private

Definition at line 94 of file addresstablemodel.h.

◆ Receive

const QString AddressTableModel::Receive = "R"
static

Specifies receive address.

Definition at line 56 of file addresstablemodel.h.

◆ Send

const QString AddressTableModel::Send = "S"
static

Specifies send address.

Definition at line 55 of file addresstablemodel.h.

◆ walletModel

WalletModel* const AddressTableModel::walletModel
private

Definition at line 93 of file addresstablemodel.h.


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