PRCYCoin  2.0.0.7rc1
P2P Digital Currency
entermnemonics.cpp
Go to the documentation of this file.
1 #include "entermnemonics.h"
2 #include "ui_entermnemonics.h"
3 
4 #include "allocators.h"
5 #include "guiconstants.h"
6 #include "walletmodel.h"
7 #include "wallet/walletdb.h"
8 
9 #include <QDateTime>
10 #include <QMessageBox>
11 
12 EnterMnemonics::EnterMnemonics(QWidget* parent) : QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint),
13  ui(new Ui::EnterMnemonics)
14 {
15  ui->setupUi(this);
16  connect(ui->btnNext, SIGNAL(clicked()), this, SLOT(on_next()));
17 }
18 
20 {
21  delete ui;
22 }
23 
25 {
26  std::string phrase = ui->mnemonics->toPlainText().trimmed().toStdString();
27  try {
29  QMessageBox::information(this, "Recovery Phrase Import Successful", "Your mnemonics have been successfully imported into the wallet. Rescanning will be scheduled to recover all your funds.", QMessageBox::Ok);
32  CWalletDB(pwalletMain->strWalletFile).WriteScannedBlockHeight(0); //reschedule to rescan entire chain to recover all funds and history
33  accept();
34  } catch (const std::exception& ex) {
35  QMessageBox::warning(this, "Recovery Phrase Invalid", "Recovery phrase is invalid. Please try again and double check all words.", QMessageBox::Ok);
36  }
37 }
EnterMnemonics::on_next
void on_next()
Definition: entermnemonics.cpp:24
chainActive
CChain chainActive
The currently-connected chain of blocks.
Definition: main.cpp:70
walletmodel.h
entermnemonics.h
CWallet::SetBestChain
void SetBestChain(const CBlockLocator &loc)
Definition: wallet.cpp:710
CWallet::GenerateNewHDChain
void GenerateNewHDChain(std::string *phrase=NULL)
Definition: wallet.cpp:317
CWalletDB
Access to the wallet database (wallet.dat)
Definition: walletdb.h:80
allocators.h
EnterMnemonics::EnterMnemonics
EnterMnemonics(QWidget *parent=0)
Definition: entermnemonics.cpp:12
Ui
Definition: 2faconfirmdialog.h:7
guiconstants.h
EnterMnemonics::~EnterMnemonics
~EnterMnemonics()
Definition: entermnemonics.cpp:19
CChain::GetLocator
CBlockLocator GetLocator(const CBlockIndex *pindex=NULL) const
Return a CBlockLocator that refers to a block in this chain (by default the tip).
Definition: chain.cpp:25
walletdb.h
CBlockLocator
Describes a place in the block chain to another node such that if the other node doesn't have the sam...
Definition: block.h:249
CWallet::strWalletFile
std::string strWalletFile
Definition: wallet.h:305
pwalletMain
CWallet * pwalletMain
Definition: wallet.cpp:49
CWalletDB::WriteScannedBlockHeight
bool WriteScannedBlockHeight(int height)
Definition: walletdb.cpp:304
EnterMnemonics
Definition: entermnemonics.h:13
EnterMnemonics::ui
Ui::EnterMnemonics * ui
Definition: entermnemonics.h:24