Merge pull request #702

f31b27d add wallet view/spend keys to seed dialog requires #2012 (Jaquee)
This commit is contained in:
Riccardo Spagni 2017-05-05 11:48:03 +02:00
commit 58f24efd39
No known key found for this signature in database
GPG key ID: 55432DF31CCD4FCD
2 changed files with 37 additions and 6 deletions

View file

@ -116,7 +116,7 @@ Rectangle {
shadowPressedColor: "#B32D00" shadowPressedColor: "#B32D00"
releasedColor: "#FF6C3C" releasedColor: "#FF6C3C"
pressedColor: "#FF4304" pressedColor: "#FF4304"
text: qsTr("Show seed") + translationManager.emptyString text: qsTr("Show seed & keys") + translationManager.emptyString
onClicked: { onClicked: {
settingsPasswordDialog.open(); settingsPasswordDialog.open();
} }
@ -413,11 +413,17 @@ Rectangle {
onAccepted: { onAccepted: {
if(appWindow.password === settingsPasswordDialog.password){ if(appWindow.password === settingsPasswordDialog.password){
informationPopup.title = qsTr("Wallet mnemonic seed") + translationManager.emptyString; seedPopup.title = qsTr("Wallet seed & keys") + translationManager.emptyString;
informationPopup.text = currentWallet.seed seedPopup.text = "<b>Wallet Mnemonic seed</b> <br>" + currentWallet.seed
informationPopup.open() + "<br><br> <b>" + qsTr("Secret view key") + ":</b> " + currentWallet.secretViewKey
informationPopup.onCloseCallback = function() { + "<br><b>" + qsTr("Public view key") + ":</b> " + currentWallet.publicViewKey
informationPopup.text = "" + "<br><b>" + qsTr("Secret spend key") + ":</b> " + currentWallet.secretSpendKey
+ "<br><b>" + qsTr("Public spend key") + ":</b> " + currentWallet.publicSpendKey
seedPopup.open()
seedPopup.width = 600
seedPopup.height = 300
seedPopup.onCloseCallback = function() {
seedPopup.text = ""
} }
} else { } else {
@ -437,6 +443,21 @@ Rectangle {
} }
StandardDialog {
id: seedPopup
cancelVisible: false
okVisible: true
width:600
height:400
property var onCloseCallback
onAccepted: {
if (onCloseCallback) {
onCloseCallback()
}
}
}
// fires on every page load // fires on every page load
function onPageCompleted() { function onPageCompleted() {
console.log("Settings page loaded"); console.log("Settings page loaded");

View file

@ -41,6 +41,10 @@ class Wallet : public QObject
Q_PROPERTY(AddressBookModel * addressBookModel READ addressBookModel) Q_PROPERTY(AddressBookModel * addressBookModel READ addressBookModel)
Q_PROPERTY(AddressBook * addressBook READ addressBook) Q_PROPERTY(AddressBook * addressBook READ addressBook)
Q_PROPERTY(bool viewOnly READ viewOnly) Q_PROPERTY(bool viewOnly READ viewOnly)
Q_PROPERTY(QString secretViewKey READ getSecretViewKey)
Q_PROPERTY(QString publicViewKey READ getPublicViewKey)
Q_PROPERTY(QString secretSpendKey READ getSecretSpendKey)
Q_PROPERTY(QString publicSpendKey READ getPublicSpendKey)
public: public:
@ -231,6 +235,12 @@ public:
// check if fork rules should be used // check if fork rules should be used
Q_INVOKABLE bool useForkRules(quint8 version, quint64 earlyBlocks = 0) const; Q_INVOKABLE bool useForkRules(quint8 version, quint64 earlyBlocks = 0) const;
//! Get wallet keys
QString getSecretViewKey() const {return QString::fromStdString(m_walletImpl->secretViewKey());}
QString getPublicViewKey() const {return QString::fromStdString(m_walletImpl->publicViewKey());}
QString getSecretSpendKey() const {return QString::fromStdString(m_walletImpl->secretSpendKey());}
QString getPublicSpendKey() const {return QString::fromStdString(m_walletImpl->publicSpendKey());}
// TODO: setListenter() when it implemented in API // TODO: setListenter() when it implemented in API
signals: signals:
// emitted on every event happened with wallet // emitted on every event happened with wallet