aboutsummaryrefslogtreecommitdiff
path: root/src/libwalletqt/Wallet.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/Wallet.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/Wallet.cpp')
-rw-r--r--src/libwalletqt/Wallet.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/libwalletqt/Wallet.cpp b/src/libwalletqt/Wallet.cpp
index 85761e0b..e488b635 100644
--- a/src/libwalletqt/Wallet.cpp
+++ b/src/libwalletqt/Wallet.cpp
@@ -4,10 +4,12 @@
#include "TransactionHistory.h"
#include "AddressBook.h"
#include "Subaddress.h"
+#include "SubaddressAccount.h"
#include "model/TransactionHistoryModel.h"
#include "model/TransactionHistorySortFilterModel.h"
#include "model/AddressBookModel.h"
#include "model/SubaddressModel.h"
+#include "model/SubaddressAccountModel.h"
#include "wallet/api/wallet2_api.h"
#include <QFile>
@@ -357,6 +359,7 @@ bool Wallet::refresh()
bool result = m_walletImpl->refresh();
m_history->refresh(currentSubaddressAccount());
m_subaddress->refresh(currentSubaddressAccount());
+ m_subaddressAccount->getAll(true);
if (result)
emit updated();
return result;
@@ -543,6 +546,20 @@ SubaddressModel *Wallet::subaddressModel()
return m_subaddressModel;
}
+SubaddressAccount *Wallet::subaddressAccount() const
+{
+ return m_subaddressAccount;
+}
+
+SubaddressAccountModel *Wallet::subaddressAccountModel() const
+{
+ if (!m_subaddressAccountModel) {
+ Wallet * w = const_cast<Wallet*>(this);
+ m_subaddressAccountModel = new SubaddressAccountModel(w,m_subaddressAccount);
+ }
+ return m_subaddressAccountModel;
+}
+
QString Wallet::generatePaymentId() const
{
return QString::fromStdString(Monero::Wallet::genPaymentId());
@@ -858,6 +875,8 @@ Wallet::Wallet(Monero::Wallet *w, QObject *parent)
, m_addressBookModel(nullptr)
, m_subaddress(nullptr)
, m_subaddressModel(nullptr)
+ , m_subaddressAccount(nullptr)
+ , m_subaddressAccountModel(nullptr)
, m_daemonBlockChainHeight(0)
, m_daemonBlockChainHeightTtl(DAEMON_BLOCKCHAIN_HEIGHT_CACHE_TTL_SECONDS)
, m_daemonBlockChainTargetHeight(0)
@@ -868,6 +887,7 @@ Wallet::Wallet(Monero::Wallet *w, QObject *parent)
m_history = new TransactionHistory(m_walletImpl->history(), this);
m_addressBook = new AddressBook(m_walletImpl->addressBook(), this);
m_subaddress = new Subaddress(m_walletImpl->subaddress(), this);
+ m_subaddressAccount = new SubaddressAccount(m_walletImpl->subaddressAccount(), this);
m_walletListener = new WalletListenerImpl(this);
m_walletImpl->setListener(m_walletListener);
m_connectionStatus = Wallet::ConnectionStatus_Disconnected;
@@ -893,6 +913,8 @@ Wallet::~Wallet()
m_addressBook = NULL;
delete m_subaddress;
m_subaddress = NULL;
+ delete m_subaddressAccount;
+ m_subaddressAccount = NULL;
//Monero::WalletManagerFactory::getWalletManager()->closeWallet(m_walletImpl);
if(status() == Status_Critical)
qDebug("Not storing wallet cache");