aboutsummaryrefslogtreecommitdiff
path: root/src/libwalletqt/SubaddressAccount.cpp
diff options
context:
space:
mode:
authorselsta <selsta@sent.at>2019-01-14 13:25:59 +0100
committerselsta <selsta@sent.at>2019-01-22 23:07:30 +0100
commitbd809abc52cc8d312c0023cfc9ae2d14e191d0b5 (patch)
tree0fa88add33f5c5aea7ebd492ce32f3a03ae07a40 /src/libwalletqt/SubaddressAccount.cpp
parent9689fff957ba994b619a2a7fb881598a997f66c2 (diff)
downloadmonzero-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.cpp56
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();
+}