Fix T-addresses not showing up in dropdown (#169)

* Add upto 20 addresses to the taddr dropdown

* View All Addresses dialog box

* Add balances to view all addresses

* Add export all keys

* Add translations + copy address
This commit is contained in:
Arjun
2019-07-23 15:00:57 -07:00
committed by adityapk00
parent f90796cb4f
commit bd1edf9f0c
7 changed files with 219 additions and 9 deletions

38
src/viewalladdresses.cpp Normal file
View File

@@ -0,0 +1,38 @@
#include "viewalladdresses.h"
#include "settings.h"
ViewAllAddressesModel::ViewAllAddressesModel(QTableView *parent, QList<QString> taddrs, RPC* rpc)
: QAbstractTableModel(parent) {
headers << tr("Address") << tr("Balance (%1)").arg(Settings::getTokenName());
addresses = taddrs;
this->rpc = rpc;
}
int ViewAllAddressesModel::rowCount(const QModelIndex&) const {
return addresses.size();
}
int ViewAllAddressesModel::columnCount(const QModelIndex&) const {
return headers.size();
}
QVariant ViewAllAddressesModel::data(const QModelIndex &index, int role) const {
QString address = addresses.at(index.row());
if (role == Qt::DisplayRole) {
switch(index.column()) {
case 0: return address;
case 1: return rpc->getAllBalances()->value(address, 0.0);
}
}
return QVariant();
}
QVariant ViewAllAddressesModel::headerData(int section, Qt::Orientation orientation, int role) const {
if (role == Qt::DisplayRole && orientation == Qt::Horizontal) {
return headers.at(section);
}
return QVariant();
}