diff options
| author | selsta <selsta@sent.at> | 2019-01-14 13:25:59 +0100 |
|---|---|---|
| committer | selsta <selsta@sent.at> | 2019-01-22 23:07:30 +0100 |
| commit | bd809abc52cc8d312c0023cfc9ae2d14e191d0b5 (patch) | |
| tree | 0fa88add33f5c5aea7ebd492ce32f3a03ae07a40 /src/libwalletqt/SubaddressAccount.cpp | |
| parent | 9689fff957ba994b619a2a7fb881598a997f66c2 (diff) | |
| download | monzero-gui-bd809abc52cc8d312c0023cfc9ae2d14e191d0b5.tar.gz monzero-gui-bd809abc52cc8d312c0023cfc9ae2d14e191d0b5.tar.xz monzero-gui-bd809abc52cc8d312c0023cfc9ae2d14e191d0b5.zip | |
add account support
Co-authored-by: kenshi84 <kenshi84@protonmail.ch>
Diffstat (limited to 'src/libwalletqt/SubaddressAccount.cpp')
| -rw-r--r-- | src/libwalletqt/SubaddressAccount.cpp | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/libwalletqt/SubaddressAccount.cpp b/src/libwalletqt/SubaddressAccount.cpp new file mode 100644 index 00000000..83557141 --- /dev/null +++ b/src/libwalletqt/SubaddressAccount.cpp @@ -0,0 +1,56 @@ +#include "SubaddressAccount.h" +#include <QDebug> + +SubaddressAccount::SubaddressAccount(Monero::SubaddressAccount *subaddressAccountImpl, QObject *parent) + : QObject(parent), m_subaddressAccountImpl(subaddressAccountImpl) +{ + qDebug(__FUNCTION__); + getAll(); +} + +QList<Monero::SubaddressAccountRow*> SubaddressAccount::getAll(bool update) const +{ + qDebug(__FUNCTION__); + + emit refreshStarted(); + + if(update) + m_rows.clear(); + + if (m_rows.empty()){ + for (auto &row: m_subaddressAccountImpl->getAll()) { + m_rows.append(row); + } + } + + emit refreshFinished(); + return m_rows; +} + +Monero::SubaddressAccountRow * SubaddressAccount::getRow(int index) const +{ + return m_rows.at(index); +} + +void SubaddressAccount::addRow(const QString &label) const +{ + m_subaddressAccountImpl->addRow(label.toStdString()); + getAll(true); +} + +void SubaddressAccount::setLabel(quint32 accountIndex, const QString &label) const +{ + m_subaddressAccountImpl->setLabel(accountIndex, label.toStdString()); + getAll(true); +} + +void SubaddressAccount::refresh() const +{ + m_subaddressAccountImpl->refresh(); + getAll(true); +} + +quint64 SubaddressAccount::count() const +{ + return m_rows.size(); +} |
