mirror of
https://github.com/feather-wallet/feather.git
synced 2025-03-12 09:37:47 +00:00
AddressBook: add getAddress
This commit is contained in:
parent
75fe3e6614
commit
b9ec26ccef
2 changed files with 15 additions and 4 deletions
|
@ -4,7 +4,7 @@
|
|||
#include "AddressBook.h"
|
||||
#include <QDebug>
|
||||
|
||||
AddressBook::AddressBook(Monero::AddressBook *abImpl,QObject *parent)
|
||||
AddressBook::AddressBook(Monero::AddressBook *abImpl, QObject *parent)
|
||||
: QObject(parent), m_addressBookImpl(abImpl)
|
||||
{
|
||||
getAll();
|
||||
|
@ -127,3 +127,16 @@ QString AddressBook::getDescription(const QString &address) const
|
|||
}
|
||||
return m_rows.value(*it)->description();
|
||||
}
|
||||
|
||||
QString AddressBook::getAddress(const QString &description) const
|
||||
{
|
||||
QReadLocker locker(&m_lock);
|
||||
|
||||
for (const auto &row : m_rows) {
|
||||
if (row->description() == description) {
|
||||
return row->address();
|
||||
}
|
||||
}
|
||||
|
||||
return QString();
|
||||
}
|
|
@ -29,6 +29,7 @@ public:
|
|||
Q_INVOKABLE QString errorString() const;
|
||||
Q_INVOKABLE int errorCode() const;
|
||||
Q_INVOKABLE QString getDescription(const QString &address) const;
|
||||
Q_INVOKABLE QString getAddress(const QString &description) const;
|
||||
|
||||
enum ErrorCode {
|
||||
Status_Ok,
|
||||
|
@ -47,9 +48,6 @@ signals:
|
|||
void refreshFinished() const;
|
||||
void descriptionChanged() const;
|
||||
|
||||
|
||||
public slots:
|
||||
|
||||
private:
|
||||
explicit AddressBook(Monero::AddressBook * abImpl, QObject *parent);
|
||||
friend class Wallet;
|
||||
|
|
Loading…
Reference in a new issue