aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcryptochangements34 <bevanoffr@gmail.com>2018-05-14 17:43:52 -0400
committercryptochangements34 <bevanoffr@gmail.com>2018-05-14 17:43:52 -0400
commitda93fc4a86cf5b930b62aedf58f06ab1dff22330 (patch)
tree8b26a6bc8d0721bdd034542ac41b30a1e8eace98
parent06fdf27be236bf5160112a8c69003adf6807fb5b (diff)
downloadmonzero-gui-da93fc4a86cf5b930b62aedf58f06ab1dff22330.tar.gz
monzero-gui-da93fc4a86cf5b930b62aedf58f06ab1dff22330.tar.xz
monzero-gui-da93fc4a86cf5b930b62aedf58f06ab1dff22330.zip
export/import key images
-rw-r--r--pages/Transfer.qml53
-rw-r--r--src/libwalletqt/Wallet.cpp10
-rw-r--r--src/libwalletqt/Wallet.h4
3 files changed, 67 insertions, 0 deletions
diff --git a/pages/Transfer.qml b/pages/Transfer.qml
index 8a029deb..5aa26c35 100644
--- a/pages/Transfer.qml
+++ b/pages/Transfer.qml
@@ -539,6 +539,30 @@ Rectangle {
submitTxDialog.open();
}
}
+
+ StandardButton {
+ id: exportKeyImagesButton
+ text: qsTr("Export key images") + translationManager.emptyString
+ small: true
+ visible: !appWindow.viewOnly
+ enabled: pageRoot.enabled
+ onClicked: {
+ console.log("Transfer: export key images clicked")
+ exportKeyImagesDialog.open();
+ }
+ }
+
+ StandardButton {
+ id: importKeyImagesButton
+ text: qsTr("Import key images") + translationManager.emptyString
+ small: true
+ visible: appWindow.viewOnly && walletManager.isDaemonLocal(appWindow.currentDaemonAddress)
+ enabled: pageRoot.enabled
+ onClicked: {
+ console.log("Transfer: import key images clicked")
+ importKeyImagesDialog.open();
+ }
+ }
}
}
@@ -630,6 +654,35 @@ Rectangle {
}
}
+
+ //ExportKeyImagesDialog
+ FileDialog {
+ id: exportKeyImagesDialog
+ selectMultiple: false
+ selectExisting: false
+ onAccepted: {
+ console.log(walletManager.urlToLocalPath(exportKeyImagesDialog.fileUrl))
+ currentWallet.exportKeyImages(walletManager.urlToLocalPath(exportKeyImagesDialog.fileUrl));
+ }
+ onRejected: {
+ console.log("Canceled");
+ }
+ }
+
+ //ImportKeyImagesDialog
+ FileDialog {
+ id: importKeyImagesDialog
+ selectMultiple: false
+ selectExisting: true
+ title: qsTr("Please choose a file") + translationManager.emptyString
+ onAccepted: {
+ console.log(walletManager.urlToLocalPath(importKeyImagesDialog.fileUrl))
+ currentWallet.importKeyImages(walletManager.urlToLocalPath(importKeyImagesDialog.fileUrl));
+ }
+ onRejected: {
+ console.log("Canceled");
+ }
+ }
diff --git a/src/libwalletqt/Wallet.cpp b/src/libwalletqt/Wallet.cpp
index 7643f379..0047f8dd 100644
--- a/src/libwalletqt/Wallet.cpp
+++ b/src/libwalletqt/Wallet.cpp
@@ -336,6 +336,16 @@ quint64 Wallet::daemonBlockChainTargetHeight() const
return m_daemonBlockChainTargetHeight;
}
+bool Wallet::exportKeyImages(const QString& path)
+{
+ return m_walletImpl->exportKeyImages(path.toStdString());
+}
+
+bool Wallet::importKeyImages(const QString& path)
+{
+ return m_walletImpl->importKeyImages(path.toStdString());
+}
+
bool Wallet::refresh()
{
bool result = m_walletImpl->refresh();
diff --git a/src/libwalletqt/Wallet.h b/src/libwalletqt/Wallet.h
index f37d556d..df413363 100644
--- a/src/libwalletqt/Wallet.h
+++ b/src/libwalletqt/Wallet.h
@@ -159,6 +159,10 @@ public:
//! returns daemon's blockchain target height
Q_INVOKABLE quint64 daemonBlockChainTargetHeight() const;
+ //! export/import key images
+ Q_INVOKABLE bool exportKeyImages(const QString& path);
+ Q_INVOKABLE bool importKeyImages(const QString& path);
+
//! refreshes the wallet
Q_INVOKABLE bool refresh();