mirror of
https://github.com/feather-wallet/feather.git
synced 2024-12-23 03:59:29 +00:00
WindowManager: only setNewWallet if wallet is actually new
This commit is contained in:
parent
217a413bf8
commit
43d4a7afcc
4 changed files with 10 additions and 6 deletions
|
@ -282,7 +282,7 @@ bool WindowManager::autoOpenWallet() {
|
||||||
// ######################## WALLET CREATION ########################
|
// ######################## WALLET CREATION ########################
|
||||||
|
|
||||||
void WindowManager::tryCreateWallet(Seed seed, const QString &path, const QString &password, const QString &seedLanguage,
|
void WindowManager::tryCreateWallet(Seed seed, const QString &path, const QString &password, const QString &seedLanguage,
|
||||||
const QString &seedOffset, const QString &subaddressLookahead) {
|
const QString &seedOffset, const QString &subaddressLookahead, bool newWallet) {
|
||||||
if(Utils::fileExists(path)) {
|
if(Utils::fileExists(path)) {
|
||||||
auto err = QString("Failed to write wallet to path: \"%1\"; file already exists.").arg(path);
|
auto err = QString("Failed to write wallet to path: \"%1\"; file already exists.").arg(path);
|
||||||
this->handleWalletError(err);
|
this->handleWalletError(err);
|
||||||
|
@ -309,7 +309,10 @@ void WindowManager::tryCreateWallet(Seed seed, const QString &path, const QStrin
|
||||||
|
|
||||||
wallet->setCacheAttribute("feather.seed", seed.mnemonic.join(" "));
|
wallet->setCacheAttribute("feather.seed", seed.mnemonic.join(" "));
|
||||||
wallet->setCacheAttribute("feather.seedoffset", seedOffset);
|
wallet->setCacheAttribute("feather.seedoffset", seedOffset);
|
||||||
wallet->setNewWallet();
|
|
||||||
|
if (newWallet) {
|
||||||
|
wallet->setNewWallet();
|
||||||
|
}
|
||||||
|
|
||||||
this->onWalletOpened(wallet);
|
this->onWalletOpened(wallet);
|
||||||
}
|
}
|
||||||
|
@ -368,7 +371,6 @@ void WindowManager::onWalletCreated(Wallet *wallet) {
|
||||||
// Currently only called when a wallet is created from device.
|
// Currently only called when a wallet is created from device.
|
||||||
auto state = wallet->status();
|
auto state = wallet->status();
|
||||||
if (state != Wallet::Status_Ok) {
|
if (state != Wallet::Status_Ok) {
|
||||||
wallet->setNewWallet();
|
|
||||||
qDebug() << Q_FUNC_INFO << QString("Wallet open error: %1").arg(wallet->errorString());
|
qDebug() << Q_FUNC_INFO << QString("Wallet open error: %1").arg(wallet->errorString());
|
||||||
this->displayWalletErrorMessage(wallet->errorString());
|
this->displayWalletErrorMessage(wallet->errorString());
|
||||||
m_splashDialog->hide();
|
m_splashDialog->hide();
|
||||||
|
|
|
@ -55,7 +55,7 @@ private slots:
|
||||||
void onChangeTheme(const QString &themeName);
|
void onChangeTheme(const QString &themeName);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void tryCreateWallet(Seed seed, const QString &path, const QString &password, const QString &seedLanguage, const QString &seedOffset, const QString &subaddressLookahead);
|
void tryCreateWallet(Seed seed, const QString &path, const QString &password, const QString &seedLanguage, const QString &seedOffset, const QString &subaddressLookahead, bool newWallet);
|
||||||
void tryCreateWalletFromDevice(const QString &path, const QString &password, const QString &deviceName, int restoreHeight, const QString &subaddressLookahead);
|
void tryCreateWalletFromDevice(const QString &path, const QString &password, const QString &deviceName, int restoreHeight, const QString &subaddressLookahead);
|
||||||
void tryCreateWalletFromKeys(const QString &path, const QString &password, const QString &address, const QString &viewkey, const QString &spendkey, quint64 restoreHeight, const QString &subaddressLookahead);
|
void tryCreateWalletFromKeys(const QString &path, const QString &password, const QString &address, const QString &viewkey, const QString &spendkey, quint64 restoreHeight, const QString &subaddressLookahead);
|
||||||
|
|
||||||
|
|
|
@ -135,5 +135,7 @@ void WalletWizard::onCreateWallet() {
|
||||||
m_wizardFields.seed.setRestoreHeight(m_wizardFields.restoreHeight);
|
m_wizardFields.seed.setRestoreHeight(m_wizardFields.restoreHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
emit createWallet(m_wizardFields.seed, walletPath, m_wizardFields.password, m_wizardFields.seedLanguage, m_wizardFields.seedOffsetPassphrase, m_wizardFields.subaddressLookahead);
|
bool newWallet = m_wizardFields.mode == WizardMode::CreateWallet;
|
||||||
|
|
||||||
|
emit createWallet(m_wizardFields.seed, walletPath, m_wizardFields.password, m_wizardFields.seedLanguage, m_wizardFields.seedOffsetPassphrase, m_wizardFields.subaddressLookahead, newWallet);
|
||||||
}
|
}
|
|
@ -97,7 +97,7 @@ signals:
|
||||||
|
|
||||||
void createWalletFromDevice(const QString &path, const QString &password, const QString &deviceName, int restoreHeight, const QString &subaddressLookahead);
|
void createWalletFromDevice(const QString &path, const QString &password, const QString &deviceName, int restoreHeight, const QString &subaddressLookahead);
|
||||||
void createWalletFromKeys(const QString &path, const QString &password, const QString &address, const QString &viewkey, const QString &spendkey, quint64 restoreHeight, const QString subaddressLookahead = "");
|
void createWalletFromKeys(const QString &path, const QString &password, const QString &address, const QString &viewkey, const QString &spendkey, quint64 restoreHeight, const QString subaddressLookahead = "");
|
||||||
void createWallet(Seed seed, const QString &path, const QString &password, const QString &seedLanguage, const QString &seedOffset = "", const QString &subaddressLookahead = "");
|
void createWallet(Seed seed, const QString &path, const QString &password, const QString &seedLanguage, const QString &seedOffset, const QString &subaddressLookahead, bool newWallet);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onCreateWallet();
|
void onCreateWallet();
|
||||||
|
|
Loading…
Reference in a new issue