Account creation refresh in qt wallet (#2318)

This commit is contained in:
cryptocode 2019-09-27 16:58:43 +02:00 committed by GitHub
commit c293678173
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -189,31 +189,33 @@ wallet (wallet_a)
this->wallet.pop_main_stack (); this->wallet.pop_main_stack ();
}); });
QObject::connect (create_account, &QPushButton::released, [this]() { QObject::connect (create_account, &QPushButton::released, [this]() {
auto transaction (this->wallet.wallet_m->wallets.tx_begin_write ());
if (this->wallet.wallet_m->store.valid_password (transaction))
{ {
this->wallet.wallet_m->deterministic_insert (transaction); auto transaction (this->wallet.wallet_m->wallets.tx_begin_write ());
show_button_success (*create_account); if (this->wallet.wallet_m->store.valid_password (transaction))
create_account->setText ("New account was created"); {
refresh (); this->wallet.wallet_m->deterministic_insert (transaction);
this->wallet.node.alarm.add (std::chrono::steady_clock::now () + std::chrono::seconds (5), [this]() { show_button_success (*create_account);
this->wallet.application.postEvent (&this->wallet.processor, new eventloop_event ([this]() { create_account->setText ("New account was created");
show_button_ok (*create_account); this->wallet.node.alarm.add (std::chrono::steady_clock::now () + std::chrono::seconds (5), [this]() {
create_account->setText ("Create account"); this->wallet.application.postEvent (&this->wallet.processor, new eventloop_event ([this]() {
})); show_button_ok (*create_account);
}); create_account->setText ("Create account");
} }));
else });
{ }
show_button_error (*create_account); else
create_account->setText ("Wallet is locked, unlock it to create account"); {
this->wallet.node.alarm.add (std::chrono::steady_clock::now () + std::chrono::seconds (5), [this]() { show_button_error (*create_account);
this->wallet.application.postEvent (&this->wallet.processor, new eventloop_event ([this]() { create_account->setText ("Wallet is locked, unlock it to create account");
show_button_ok (*create_account); this->wallet.node.alarm.add (std::chrono::steady_clock::now () + std::chrono::seconds (5), [this]() {
create_account->setText ("Create account"); this->wallet.application.postEvent (&this->wallet.processor, new eventloop_event ([this]() {
})); show_button_ok (*create_account);
}); create_account->setText ("Create account");
}));
});
}
} }
refresh ();
}); });
QObject::connect (import_wallet, &QPushButton::released, [this]() { QObject::connect (import_wallet, &QPushButton::released, [this]() {
this->wallet.push_main_stack (this->wallet.import.window); this->wallet.push_main_stack (this->wallet.import.window);