mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-12-14 04:16:33 +02:00
Merge pull request #357
eff31f0
History: print address book description if available (moneromooo.monero)
This commit is contained in:
commit
e482135ded
@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
import moneroComponents.Clipboard 1.0
|
import moneroComponents.Clipboard 1.0
|
||||||
|
import moneroComponents.AddressBookModel 1.0
|
||||||
|
|
||||||
|
|
||||||
ListView {
|
ListView {
|
||||||
@ -36,6 +37,7 @@ ListView {
|
|||||||
boundsBehavior: ListView.StopAtBounds
|
boundsBehavior: ListView.StopAtBounds
|
||||||
property var previousItem
|
property var previousItem
|
||||||
property int rowSpacing: 12
|
property int rowSpacing: 12
|
||||||
|
property var addressBookModel: null
|
||||||
|
|
||||||
function buildTxDetailsString(tx_id, paymentId, tx_key,tx_note, destinations) {
|
function buildTxDetailsString(tx_id, paymentId, tx_key,tx_note, destinations) {
|
||||||
var trStart = '<tr><td width="85" style="padding-top:5px"><b>',
|
var trStart = '<tr><td width="85" style="padding-top:5px"><b>',
|
||||||
@ -52,6 +54,15 @@ ListView {
|
|||||||
+ translationManager.emptyString;
|
+ translationManager.emptyString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function lookupPaymentID(paymentId) {
|
||||||
|
if (!addressBookModel)
|
||||||
|
return ""
|
||||||
|
var idx = addressBookModel.lookupPaymentID(paymentId)
|
||||||
|
if (idx < 0)
|
||||||
|
return ""
|
||||||
|
idx = addressBookModel.index(idx, 0)
|
||||||
|
return addressBookModel.data(idx, AddressBookModel.AddressBookDescriptionRole)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
footer: Rectangle {
|
footer: Rectangle {
|
||||||
@ -207,6 +218,21 @@ ListView {
|
|||||||
text: paymentId
|
text: paymentId
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// Address book lookup
|
||||||
|
TextEdit {
|
||||||
|
readOnly: true
|
||||||
|
selectByMouse: true
|
||||||
|
id: addressBookLookupValue
|
||||||
|
width: 136
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
//elide: Text.ElideRight
|
||||||
|
font.family: "Arial"
|
||||||
|
font.pixelSize:13
|
||||||
|
font.letterSpacing: -1
|
||||||
|
color: "#545454"
|
||||||
|
text: "(" + lookupPaymentID(paymentId) + ")"
|
||||||
|
visible: text !== "()"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Row {
|
Row {
|
||||||
// block height row
|
// block height row
|
||||||
|
@ -540,6 +540,11 @@ Rectangle {
|
|||||||
anchors.rightMargin: 14
|
anchors.rightMargin: 14
|
||||||
onContentYChanged: flickableScroll.flickableContentYChanged()
|
onContentYChanged: flickableScroll.flickableContentYChanged()
|
||||||
model: root.model
|
model: root.model
|
||||||
|
addressBookModel: null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onPageCompleted() {
|
||||||
|
table.addressBookModel = appWindow.currentWallet ? appWindow.currentWallet.addressBookModel : null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,3 +68,8 @@ quint64 AddressBook::count() const
|
|||||||
{
|
{
|
||||||
return m_rows.size();
|
return m_rows.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int AddressBook::lookupPaymentID(const QString &payment_id) const
|
||||||
|
{
|
||||||
|
return m_addressBookImpl->lookupPaymentID(payment_id.toStdString());
|
||||||
|
}
|
||||||
|
@ -22,6 +22,7 @@ public:
|
|||||||
quint64 count() const;
|
quint64 count() const;
|
||||||
Q_INVOKABLE QString errorString() const;
|
Q_INVOKABLE QString errorString() const;
|
||||||
Q_INVOKABLE int errorCode() const;
|
Q_INVOKABLE int errorCode() const;
|
||||||
|
Q_INVOKABLE int lookupPaymentID(const QString &payment_id) const;
|
||||||
|
|
||||||
enum ErrorCode {
|
enum ErrorCode {
|
||||||
Status_Ok,
|
Status_Ok,
|
||||||
|
@ -63,6 +63,11 @@ bool AddressBookModel::deleteRow(int row)
|
|||||||
m_addressBook->deleteRow(row);
|
m_addressBook->deleteRow(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int AddressBookModel::lookupPaymentID(const QString &payment_id) const
|
||||||
|
{
|
||||||
|
return m_addressBook->lookupPaymentID(payment_id);
|
||||||
|
}
|
||||||
|
|
||||||
QHash<int, QByteArray> AddressBookModel::roleNames() const
|
QHash<int, QByteArray> AddressBookModel::roleNames() const
|
||||||
{
|
{
|
||||||
QHash<int, QByteArray> roleNames = QAbstractListModel::roleNames();
|
QHash<int, QByteArray> roleNames = QAbstractListModel::roleNames();
|
||||||
|
@ -24,6 +24,7 @@ public:
|
|||||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||||
Q_INVOKABLE bool deleteRow(int row);
|
Q_INVOKABLE bool deleteRow(int row);
|
||||||
|
Q_INVOKABLE int lookupPaymentID(const QString &payment_id) const;
|
||||||
virtual QHash<int, QByteArray> roleNames() const override;
|
virtual QHash<int, QByteArray> roleNames() const override;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
Loading…
Reference in New Issue
Block a user