diff --git a/silentdragon-lite.pro b/silentdragon-lite.pro index 3dec433..5f31054 100644 --- a/silentdragon-lite.pro +++ b/silentdragon-lite.pro @@ -138,7 +138,8 @@ FORMS += \ src/about.ui \ src/confirm.ui \ src/privkey.ui \ - src/memodialog.ui \ + src/memodialog.ui \ + src/verifyseed.ui \ src/startupencryption.ui \ src/viewalladdresses.ui \ src/connection.ui \ diff --git a/src/firsttimewizard.cpp b/src/firsttimewizard.cpp index 6b79eba..652665f 100644 --- a/src/firsttimewizard.cpp +++ b/src/firsttimewizard.cpp @@ -2,12 +2,29 @@ #include "ui_newseed.h" #include "ui_restoreseed.h" +#include "ui_verifyseed.h" #include "ui_newwallet.h" #include "mainwindow.h" #include "DataStore/DataStore.h" #include "../lib/silentdragonlitelib.h" +#ifdef Q_OS_WIN +auto dirwalletfirst = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).filePath("silentdragonlite/silentdragonlite-wallet.dat"); +auto dirwalletencfirst = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).filePath("silentdragonlite/silentdragonlite-wallet-enc.dat"); +auto dirwalletbackupfirst = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).filePath("silentdragonlite/silentdragonlite-wallet.datBackup"); +#endif +#ifdef Q_OS_MACOS +auto dirwalletfirst = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).filePath("silentdragonlite/silentdragonlite-wallet.dat"); +auto dirwalletencfirst = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).filePath("silentdragonlite/silentdragonlite-wallet-enc.dat"); +auto dirwalletbackupfirst = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).filePath("silentdragonlite/silentdragonlite-wallet.datBackup"); +#endif +#ifdef Q_OS_LINUX +auto dirwalletfirst = QDir(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)).filePath(".silentdragonlite/silentdragonlite-wallet.dat"); +auto dirwalletencfirst = QDir(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)).filePath(".silentdragonlite/silentdragonlite-wallet-enc.dat"); +auto dirwalletbackupfirst = QDir(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)).filePath(".silentdragonlite/silentdragonlite-wallet.datBackup"); +#endif + FirstTimeWizard::FirstTimeWizard(bool dangerous, QString server) { @@ -48,6 +65,30 @@ int FirstTimeWizard::nextId() const { } } +QString FirstTimeWizard::getSeed() +{ + + return _seed; +} + +void FirstTimeWizard::setSeed(QString seed) +{ + + _seed = seed; +} + +QString FirstTimeWizard::getBirthday() +{ + + return _birthday; +} + +void FirstTimeWizard::setBirthday(QString birthday) +{ + + _birthday = birthday; +} + NewOrRestorePage::NewOrRestorePage(FirstTimeWizard *parent) : QWizardPage(parent) { setTitle("Create or Restore wallet."); @@ -200,6 +241,8 @@ void NewSeedPage::initializePage() { QString birthday = QString::number(parsed["birthday"].get()); QString seed = QString::fromStdString(parsed["seed"].get()); form.txtSeed->setPlainText(seed); + parent->setSeed(seed); + parent->setBirthday(birthday); form.birthday->setPlainText(birthday); } @@ -209,6 +252,19 @@ void NewSeedPage::initializePage() { // Will be called just before closing. Make sure we can save the seed in the wallet // before we allow the page to be closed bool NewSeedPage::validatePage() { + + Ui_verifyseed verifyseed; + QDialog dialog(this); + verifyseed.setupUi(&dialog); + Settings::saveRestore(&dialog); + + dialog.exec(); + + QString seed = parent->getSeed(); + QString birthday = parent->getBirthday(); + + if ((verifyseed.verifyText->toPlainText() == seed) && (verifyseed.verifyBirthday->toPlainText() == birthday )) + { char* resp = litelib_execute("save", ""); QString reply = litelib_process_response(resp); @@ -222,6 +278,20 @@ bool NewSeedPage::validatePage() { } else { return true; } + }else{ + + qDebug()<<"Falscher Seed"; + QFile file(dirwalletencfirst); + QFile file1(dirwalletfirst); + + file.remove(); + file1.remove(); + QMessageBox::warning(this, tr("Wrong Seed"), + tr("Please try again") + "\n" , + QMessageBox::Ok); + return false; + this->validatePage(); + } } diff --git a/src/firsttimewizard.h b/src/firsttimewizard.h index 324f115..80938c7 100644 --- a/src/firsttimewizard.h +++ b/src/firsttimewizard.h @@ -17,6 +17,12 @@ class FirstTimeWizard: public QWizard public: FirstTimeWizard(bool dangerous, QString server); + QString getSeed(); + void setSeed(QString Seed); + QString _seed; + QString getBirthday(); + void setBirthday(QString Birthday); + QString _birthday; protected: @@ -51,6 +57,7 @@ public: class NewSeedPage: public QWizardPage { public: NewSeedPage(FirstTimeWizard* parent); + protected: virtual void initializePage(); diff --git a/src/verifyseed.ui b/src/verifyseed.ui index fb923db..d21167a 100644 --- a/src/verifyseed.ui +++ b/src/verifyseed.ui @@ -1,51 +1,85 @@ - - - - - Dialog - - + + + verifyseed + + 0 0 - 400 - 300 + 458 + 333 - + Dialog - - - - 30 - 240 - 341 - 32 - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - + + + + + <html><head/><body><p><span style=" font-weight:600; text-decoration: underline;">Please verify, that you have backup your Seed and Birthday. </span></p></body></html> + + + + + + + Please enter your Seed : + + + + + + + + 16777215 + 121 + + + + + + + + Please enter the birthday of the Seed : + + + + + + + + 16777215 + 41 + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + - buttonBox accepted() - Dialog + verifyseed accept() - + 248 254 - + 157 274 @@ -54,14 +88,14 @@ buttonBox rejected() - Dialog + verifyseed reject() - + 316 260 - + 286 274 @@ -69,4 +103,3 @@ -