Browse Source

newkey signal

cl-refactor
Marek Kotewicz 10 years ago
parent
commit
f4af551548
  1. 12
      alethzero/MainWin.cpp
  2. 1
      alethzero/MainWin.h
  3. 2
      libqethereum/QEthereum.cpp
  4. 1
      libqethereum/QEthereum.h
  5. 1
      libweb3jsonrpc/WebThreeStubServer.cpp

12
alethzero/MainWin.cpp

@ -33,6 +33,7 @@
#include <libserpent/funcs.h>
#include <libserpent/util.h>
#include <libdevcrypto/FileSystem.h>
#include <libdevcore/CommonJS.h>
#include <liblll/Compiler.h>
#include <liblll/CodeFragment.h>
#include <libevm/VM.h>
@ -150,8 +151,8 @@ Main::Main(QWidget *parent) :
m_qwebConnector = new QWebThreeConnector();
m_server = unique_ptr<WebThreeStubServer>(new WebThreeStubServer(m_qwebConnector, *web3(), keysAsVector(m_myKeys)));
m_server->setIdentities(keysAsVector(owned()));
m_server->StartListening();
connect(ui->webView, &QWebView::loadStarted, [this]()
{
@ -164,6 +165,7 @@ Main::Main(QWidget *parent) :
QWebFrame* f = ui->webView->page()->mainFrame();
f->disconnect(SIGNAL(javaScriptWindowObjectCleared()));
connect(f, &QWebFrame::javaScriptWindowObjectCleared, QETH_INSTALL_JS_NAMESPACE(f, this, qweb));
connect(m_qweb, SIGNAL(onNewId(QString)), this, SLOT(addNewId(QString)));
});
connect(ui->webView, &QWebView::loadFinished, [=]()
@ -201,6 +203,14 @@ Main::~Main()
writeSettings();
}
void Main::addNewId(QString _ids)
{
Secret _id = jsToSecret(_ids.toStdString());
KeyPair kp(_id);
m_myIdentities.push_back(kp);
m_server->setIdentities(keysAsVector(owned()));
}
dev::p2p::NetworkPreferences Main::netPrefs() const
{
return NetworkPreferences(ui->port->value(), ui->forceAddress->text().toStdString(), ui->upnp->isChecked(), ui->localNetworking->isChecked());

1
alethzero/MainWin.h

@ -154,6 +154,7 @@ private slots:
void on_newIdentity_triggered();
void refreshWhisper();
void addNewId(QString _ids);
signals:
void poll();

2
libqethereum/QEthereum.cpp

@ -167,6 +167,8 @@ void QWebThree::onDataProcessed(QString _json, QString _addInfo)
m_watches.push_back(f["result"].toInt());
if (!_addInfo.compare("shhNewFilter") && f.contains("result"))
m_shhWatches.push_back(f["result"].toInt());
if (!_addInfo.compare("newIdentity") && f.contains("result"))
emit onNewId(f["result"].toString());
response(formatOutput(f));
}

1
libqethereum/QEthereum.h

@ -47,6 +47,7 @@ public slots:
signals:
void processData(QString _json, QString _addInfo);
void response(QString _json);
void onNewId(QString _id);
private:
std::vector<unsigned> m_watches;

1
libweb3jsonrpc/WebThreeStubServer.cpp

@ -463,7 +463,6 @@ std::string WebThreeStubServer::newGroup(std::string const& _id, std::string con
std::string WebThreeStubServer::newIdentity()
{
KeyPair kp = KeyPair::create();
// emit newId
return toJS(kp.pub());
}

Loading…
Cancel
Save