From 347197f7c8a9cebf81de04525ffa047f0cd814ef Mon Sep 17 00:00:00 2001 From: SergiySW Date: Tue, 27 Jun 2017 00:20:56 +0300 Subject: [PATCH] "Create account" with locked wallet --- rai/qt/qt.cpp | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/rai/qt/qt.cpp b/rai/qt/qt.cpp index 07fb1d3c..6e6e94dc 100755 --- a/rai/qt/qt.cpp +++ b/rai/qt/qt.cpp @@ -176,8 +176,29 @@ wallet (wallet_a) }); QObject::connect (create_account, &QPushButton::released, [this] () { - this->wallet.wallet_m->deterministic_insert (); - refresh (); + rai::transaction transaction (this->wallet.wallet_m->store.environment, nullptr, true); + if (this->wallet.wallet_m->store.valid_password (transaction)) + { + this->wallet.wallet_m->deterministic_insert (transaction); + show_button_success (*create_account); + create_account->setText ("New account was created"); + refresh (); + this->wallet.node.alarm.add (std::chrono::system_clock::now () + std::chrono::seconds (5), [this] () + { + show_button_ok (*create_account); + create_account->setText ("Create account"); + }); + } + else + { + show_button_error (*create_account); + create_account->setText ("Wallet is locked, unlock it to create account"); + this->wallet.node.alarm.add (std::chrono::system_clock::now () + std::chrono::seconds (5), [this] () + { + show_button_ok (*create_account); + create_account->setText ("Create account"); + }); + } }); QObject::connect (import_wallet, &QPushButton::released, [this] () {