diff --git a/alethzero/Main.ui b/alethzero/Main.ui
index 32a806fea..a26fb8f2c 100644
--- a/alethzero/Main.ui
+++ b/alethzero/Main.ui
@@ -164,6 +164,7 @@
+
@@ -1394,6 +1395,11 @@ font-size: 14pt
Debug &Pending Transaction
+
+
+ Import Ether &Presale Wallet...
+
+
diff --git a/alethzero/MainWin.cpp b/alethzero/MainWin.cpp
index 05c2667df..995553803 100644
--- a/alethzero/MainWin.cpp
+++ b/alethzero/MainWin.cpp
@@ -1022,6 +1022,28 @@ void Main::on_claimPresale_triggered()
}
}
+void Main::on_importPresale_triggered()
+{
+ QString s = QFileDialog::getOpenFileName(this, "Claim Account Contents", QDir::homePath(), "JSON Files (*.json);;All Files (*)");
+ try
+ {
+ string pass;
+ KeyPair k = m_keyManager.presaleSecret(dev::contentsString(s.toStdString()), [&](bool){ return (pass = QInputDialog::getText(this, "Enter Password", "Enter the wallet's passphrase", QLineEdit::Password).toStdString()); });
+ cnote << k.address();
+ if (!m_keyManager.hasAccount(k.address()))
+ keyManager().import(k.secret(), "Presale wallet (" + s.toStdString() + ")", pass, "Same password as for the presale wallet");
+ else
+ QMessageBox::warning(this, "Already Have Key", "Could not import the secret key: we already own this account.");
+ }
+ catch (dev::eth::PasswordUnknown&) {}
+ catch (...)
+ {
+ cerr << "Unhandled exception!" << endl <<
+ boost::current_exception_diagnostic_information();
+ QMessageBox::warning(this, "Key File Invalid", "Could not find secret key definition. This is probably not an Ethereum key file.");
+ }
+}
+
void Main::on_exportKey_triggered()
{
if (ui->ourAccounts->currentRow() >= 0)
diff --git a/alethzero/MainWin.h b/alethzero/MainWin.h
index dd2e668b8..2bccbde57 100644
--- a/alethzero/MainWin.h
+++ b/alethzero/MainWin.h
@@ -157,6 +157,7 @@ private slots:
void on_reencryptAll_triggered();
void on_importKeyFile_triggered();
void on_claimPresale_triggered();
+ void on_importPresale_triggered();
void on_exportKey_triggered();
// Tools