Pay payment requests

This commit is contained in:
Aditya Kulkarni
2019-03-22 15:37:21 -07:00
parent c70819be0f
commit e46725f322
9 changed files with 246 additions and 120 deletions

View File

@@ -138,8 +138,14 @@ void TxTableModel::updateAllData() {
if (role == Qt::ToolTipRole) {
switch (index.column()) {
case 0: return modeldata->at(index.row()).type +
(dat.memo.isEmpty() ? "" : " tx memo: \"" + dat.memo + "\"");
case 0: {
if (dat.memo.startsWith("zcash:")) {
return Settings::paymentURIPretty(Settings::parseURI(dat.memo));
} else {
return modeldata->at(index.row()).type +
(dat.memo.isEmpty() ? "" : " tx memo: \"" + dat.memo + "\"");
}
}
case 1: {
auto addr = modeldata->at(index.row()).address;
if (addr.trimmed().isEmpty())
@@ -154,9 +160,15 @@ void TxTableModel::updateAllData() {
if (role == Qt::DecorationRole && index.column() == 0) {
if (!dat.memo.isEmpty()) {
// Return the info pixmap to indicate memo
QIcon icon = QApplication::style()->standardIcon(QStyle::SP_MessageBoxInformation);
return QVariant(icon.pixmap(16, 16));
// If the memo is a Payment URI, then show a payment request icon
if (dat.memo.startsWith("zcash:")) {
QIcon icon(":/icons/res/paymentreq.gif");
return QVariant(icon.pixmap(16, 16));
} else {
// Return the info pixmap to indicate memo
QIcon icon = QApplication::style()->standardIcon(QStyle::SP_MessageBoxInformation);
return QVariant(icon.pixmap(16, 16));
}
} else {
// Empty pixmap to make it align
QPixmap p(16, 16);