diff --git a/alethzero/Main.ui b/alethzero/Main.ui index dbc4bb144..5c0f50a6d 100644 --- a/alethzero/Main.ui +++ b/alethzero/Main.ui @@ -130,6 +130,8 @@ &Network + + @@ -141,15 +143,12 @@ T&ools - + - - - @@ -191,7 +190,17 @@ + + + &View + + + + + + + @@ -507,8 +516,7 @@ false - - + @@ -1521,7 +1529,7 @@ font-size: 14pt true - &Preview + &Preview Pending Transactions @@ -1740,6 +1748,16 @@ font-size: 14pt Enable Local Addresses + + + Import Key &File... + + + + + Go! + + diff --git a/alethzero/MainWin.cpp b/alethzero/MainWin.cpp index b4bbb8ca7..3e7df750b 100644 --- a/alethzero/MainWin.cpp +++ b/alethzero/MainWin.cpp @@ -570,6 +570,26 @@ void Main::on_importKey_triggered() QMessageBox::warning(this, "Invalid Entry", "Could not import the secret key; invalid key entered. Make sure it is 64 hex characters (0-9 or A-F)."); } +void Main::on_importKeyFile_triggered() +{ + QString s = QFileDialog::getOpenFileName(this, "Import Account", QDir::homePath(), "JSON Files (*.json);;All Files (*)"); + bytes b = fromHex(s.toStdString()); + if (b.size() == 32) + { + auto k = KeyPair(h256(b)); + if (std::find(m_myKeys.begin(), m_myKeys.end(), k) == m_myKeys.end()) + { + m_myKeys.append(k); + m_keysChanged = true; + update(); + } + else + QMessageBox::warning(this, "Already Have Key", "Could not import the secret key: we already own this account."); + } + else + QMessageBox::warning(this, "Invalid Entry", "Could not import the secret key; invalid key entered. Make sure it is 64 hex characters (0-9 or A-F)."); +} + void Main::on_exportKey_triggered() { if (ui->ourAccounts->currentRow() >= 0 && ui->ourAccounts->currentRow() < m_myKeys.size()) @@ -1689,6 +1709,12 @@ void Main::on_dumpTraceStorage_triggered() } } +void Main::on_go_triggered() +{ + ui->net->setChecked(true); + web3()->connect(Host::pocHost()); +} + void Main::on_callStack_currentItemChanged() { updateDebugger(); diff --git a/alethzero/MainWin.h b/alethzero/MainWin.h index ce1a9b670..eab135133 100644 --- a/alethzero/MainWin.h +++ b/alethzero/MainWin.h @@ -144,6 +144,8 @@ private slots: void on_usePrivate_triggered(); void on_enableOptimizer_triggered(); void on_turboMining_triggered(); + void on_go_triggered(); + void on_importKeyFile_triggered(); signals: void poll();