 |
PRCYCoin
2.0.0.7rc1
P2P Digital Currency
|
Go to the documentation of this file.
62 if (strPurpose ==
"send")
64 else if (strPurpose ==
"receive")
66 else if (strPurpose ==
"unknown" || strPurpose ==
"")
90 QString::fromStdString(item.second.
purpose), fMine);
91 const std::string& strName = item.second.
name;
93 QString::fromStdString(strName),
94 QString::fromStdString(address.
ToString())));
103 void updateEntry(
const QString& address,
const QString& label,
bool isMine,
const QString& purpose,
int status)
106 QList<AddressTableEntry>::iterator lower = std::lower_bound(
108 QList<AddressTableEntry>::iterator upper = std::upper_bound(
112 bool inModel = (lower != upper);
118 qWarning() <<
"AddressTablePriv::updateEntry : Warning: Got CT_NEW, but entry is already in model";
121 parent->beginInsertRows(QModelIndex(), lowerIndex, lowerIndex);
127 qWarning() <<
"AddressTablePriv::updateEntry : Warning: Got CT_UPDATED, but entry is not in model";
130 lower->type = newEntryType;
131 lower->label = label;
136 qWarning() <<
"AddressTablePriv::updateEntry : Warning: Got CT_DELETED, but entry is not in model";
139 parent->beginRemoveRows(QModelIndex(), lowerIndex, upperIndex - 1);
146 void updateEntry(
const QString &pubCoin,
const QString &isUsed,
int status)
169 columns << tr(
"Label") << tr(
"Address");
193 if (!
index.isValid())
198 if (role == Qt::DisplayRole || role == Qt::EditRole) {
199 switch (
index.column()) {
201 if (rec->
label.isEmpty() && role == Qt::DisplayRole) {
202 return tr(
"(no label)");
209 }
else if (role == Qt::FontRole) {
230 if (!
index.isValid())
236 if (role == Qt::EditRole) {
241 if (rec->
label == value.toString()) {
249 if (boost::get<CNoDestination>(&newAddress)) {
254 else if (newAddress == curAddress) {
279 if (orientation == Qt::Horizontal) {
280 if (role == Qt::DisplayRole && section <
columns.size()) {
289 if (!
index.isValid())
293 Qt::ItemFlags retval = Qt::ItemIsSelectable | Qt::ItemIsEnabled;
298 retval |= Qt::ItemIsEditable;
308 return createIndex(row, column,
data);
310 return QModelIndex();
315 const QString& label,
317 const QString& purpose,
335 std::string strLabel = label.toStdString();
336 std::string strAddress = address.toStdString();
377 (type ==
Send ?
"send" :
"receive"));
379 return QString::fromStdString(strAddress);
407 return QString::fromStdString(mi->second.name);
415 QModelIndexList lst = match(
index(0,
Address, QModelIndex()),
416 Qt::EditRole, address, 1, Qt::MatchExactly);
420 return lst.at(0).row();
426 Q_EMIT dataChanged(
index(idx, 0, QModelIndex()),
index(idx,
columns.length() - 1, QModelIndex()));
int columnCount(const QModelIndex &parent) const
isminetype IsMine(const CKeyStore &keystore, const CTxDestination &dest)
QFont bitcoinAddressFont()
AddressTableEntry(Type type, const QString &pubcoin)
int rowCount(const QModelIndex &parent) const
Interface to Bitcoin wallet from Qt view code.
QString addRow(const QString &type, const QString &label, const QString &address)
bool GetKeyFromPool(CPubKey &key)
base58-encoded PRCY addresses.
Qt model of the address book in the core.
QString labelForAddress(const QString &address) const
@ KEY_GENERATION_FAILURE
Generating a new public key for a receiving address failed.
static const QString Receive
Specifies receive address.
std::string ToString() const
bool operator()(const AddressTableEntry &a, const QString &b) const
void emitDataChanged(int index)
Notify listeners that data changed.
QVariant headerData(int section, Qt::Orientation orientation, int role) const
bool SetAddressBook(const CTxDestination &address, const std::string &strName, const std::string &purpose)
WalletModel * walletModel
QVariant data(const QModelIndex &index, int role) const
bool DelAddressBook(const CTxDestination &address)
bool operator()(const AddressTableEntry &a, const AddressTableEntry &b) const
bool validateAddress(const QString &address)
AddressTableEntry * index(int idx)
QModelIndex index(int row, int column, const QModelIndex &parent) const
bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex())
void refreshAddressTable()
AddressTableEntry(Type type, const QString &label, const QString &address)
@ Unlock_Full
Unlock wallet from menu
#define PAIRTYPE(t1, t2)
This is needed because the foreach macro can't get over the comma in pair<t1, t2>
@ Label
User specified label.
int lookupAddress(const QString &address) const
boost::variant< CNoDestination, CKeyID, CScriptID > CTxDestination
A txout script template with a specific destination.
@ WALLET_UNLOCK_FAILURE
Wallet could not be unlocked to create new receiving address.
An encapsulated public key.
AddressTablePriv(CWallet *wallet, AddressTableModel *parent)
@ TypeRole
Type of address (Send or Receive)
QList< AddressTableEntry > cachedAddressTable
AddressTableModel(CWallet *wallet, WalletModel *parent=0)
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances,...
@ INVALID_ADDRESS
Unparseable address.
@ NO_CHANGES
No changes were made during edit operation.
static const QString Send
Specifies send address.
void updateEntry(const QString &address, const QString &label, bool isMine, const QString &purpose, int status)
Qt::ItemFlags flags(const QModelIndex &index) const
void updateEntry(const QString &address, const QString &label, bool isMine, const QString &purpose, int status)
AddressTableModel * parent
CTxDestination Get() const
bool operator()(const QString &a, const AddressTableEntry &b) const
UnlockContext requestUnlock(AskPassphraseDialog::Context context, bool relock=false)
@ DUPLICATE_ADDRESS
Address already in address book.
void updateEntry(const QString &pubCoin, const QString &isUsed, int status)
bool setData(const QModelIndex &index, const QVariant &value, int role)
friend class AddressTablePriv
std::map< CTxDestination, CAddressBookData > mapAddressBook
@ Address
Bitcoin address.
CKeyID GetID() const
Get the KeyID of this public key (hash of its serialization)