Browse Source

Presale import in AZ.

cl-refactor
Gav Wood 10 years ago
parent
commit
15e9979cbc
  1. 6
      alethzero/Main.ui
  2. 22
      alethzero/MainWin.cpp
  3. 1
      alethzero/MainWin.h

6
alethzero/Main.ui

@ -164,6 +164,7 @@
<addaction name="newTransaction"/>
<addaction name="importKey"/>
<addaction name="importKeyFile"/>
<addaction name="importPresale"/>
<addaction name="claimPresale"/>
<addaction name="exportKey"/>
<addaction name="reencryptAll"/>
@ -1394,6 +1395,11 @@ font-size: 14pt</string>
<string>Debug &amp;Pending Transaction</string>
</property>
</action>
<action name="importPresale">
<property name="text">
<string>Import Ether &amp;Presale Wallet...</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>

22
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)

1
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

Loading…
Cancel
Save