aboutsummaryrefslogtreecommitdiff
path: root/src/libwalletqt/SubaddressAccount.cpp
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2019-02-01 01:04:38 -0600
committerluigi1111 <luigi1111w@gmail.com>2019-02-01 01:04:38 -0600
commit10d8fc01ea1ed6b60b04943138a0c2cbeef62d9c (patch)
tree839b023db51da6aadd95e5beef2a38f5d59a4b1c /src/libwalletqt/SubaddressAccount.cpp
parent443e9c260ddfbcea88166133049540aebdd4f477 (diff)
parentbd809abc52cc8d312c0023cfc9ae2d14e191d0b5 (diff)
downloadmonzero-gui-10d8fc01ea1ed6b60b04943138a0c2cbeef62d9c.tar.gz
monzero-gui-10d8fc01ea1ed6b60b04943138a0c2cbeef62d9c.tar.xz
monzero-gui-10d8fc01ea1ed6b60b04943138a0c2cbeef62d9c.zip
Merge pull request #1905
bd809ab add account support (selsta)
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();
+}