2022-09-05 15:22:18 +00:00
|
|
|
#include "Status/Wallet/SavedAddressesController.h"
|
2022-09-06 15:26:06 +00:00
|
|
|
#include "Helpers/helpers.h"
|
2022-09-05 15:22:18 +00:00
|
|
|
|
|
|
|
namespace Status::Wallet
|
|
|
|
{
|
|
|
|
|
|
|
|
SavedAddressesController::SavedAddressesController(QObject* parent)
|
|
|
|
: QObject(parent)
|
2022-09-06 15:26:06 +00:00
|
|
|
, m_savedAddresses(Helpers::makeSharedQObject<SavedAddressesModel>(
|
|
|
|
/* TODO: std::move(getWalletAccounts()), */"savedAddress"))
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
QAbstractListModel* SavedAddressesController::savedAddresses() const
|
|
|
|
{
|
|
|
|
return m_savedAddresses.get();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SavedAddressesController::saveAddress(const QString &address, const QString &name)
|
|
|
|
{
|
|
|
|
// TODO: check present addresses
|
|
|
|
// {
|
|
|
|
// emit error(AddressAlreadyPresentError);
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
|
|
|
|
auto item = Helpers::makeSharedQObject<SavedAddress>(address, name);
|
|
|
|
m_savedAddresses->push_back(item);
|
|
|
|
}
|
|
|
|
|
2022-09-05 15:22:18 +00:00
|
|
|
} // namespace Status::Wallet
|