add account support

Co-authored-by: kenshi84 <kenshi84@protonmail.ch>
This commit is contained in:
selsta
2019-01-14 13:25:59 +01:00
parent 9689fff957
commit bd809abc52
17 changed files with 654 additions and 7 deletions

View File

@@ -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();
}