diff --git a/get_libwallet_api.sh b/get_libwallet_api.sh
index 34c2e6b3..c9f67ff8 100755
--- a/get_libwallet_api.sh
+++ b/get_libwallet_api.sh
@@ -13,6 +13,9 @@ BITMONERO_DIR=$ROOT_DIR/bitmonero
if [ ! -d $BITMONERO_DIR ]; then
git clone --depth=1 $BITMONERO_URL $BITMONERO_DIR
+else
+ cd $BITMONERO_DIR;
+ git pull;
fi
rm -fr $BITMONERO_DIR/build
diff --git a/lang/languages.xml b/lang/languages.xml
index efb84c9c..449d415c 100644
--- a/lang/languages.xml
+++ b/lang/languages.xml
@@ -1,13 +1,13 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
diff --git a/main.cpp b/main.cpp
index 6c529ed0..39e4635d 100644
--- a/main.cpp
+++ b/main.cpp
@@ -33,10 +33,13 @@
#include "clipboardAdapter.h"
#include "filter.h"
#include "oscursor.h"
+#include "oshelper.h"
#include "WalletManager.h"
#include "Wallet.h"
+
+
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
@@ -51,6 +54,9 @@ int main(int argc, char *argv[])
OSCursor cursor;
engine.rootContext()->setContextProperty("globalCursor", &cursor);
+ OSHelper osHelper;
+ engine.rootContext()->setContextProperty("oshelper", &osHelper);
+
engine.rootContext()->setContextProperty("walletManager", WalletManager::instance());
// export to QML monero accounts root directory
diff --git a/monero-core.pro b/monero-core.pro
index f521c9ec..8ce4a16a 100644
--- a/monero-core.pro
+++ b/monero-core.pro
@@ -18,7 +18,8 @@ HEADERS += \
src/libwalletqt/Wallet.h \
src/libwalletqt/PendingTransaction.h \
src/libwalletqt/TransactionHistory.h \
- src/libwalletqt/TransactionInfo.h
+ src/libwalletqt/TransactionInfo.h \
+ oshelper.h
SOURCES += main.cpp \
@@ -29,7 +30,8 @@ SOURCES += main.cpp \
src/libwalletqt/Wallet.cpp \
src/libwalletqt/PendingTransaction.cpp \
src/libwalletqt/TransactionHistory.cpp \
- src/libwalletqt/TransactionInfo.cpp
+ src/libwalletqt/TransactionInfo.cpp \
+ oshelper.cpp
lupdate_only {
SOURCES = *.qml \
diff --git a/oshelper.cpp b/oshelper.cpp
new file mode 100644
index 00000000..cecae38e
--- /dev/null
+++ b/oshelper.cpp
@@ -0,0 +1,24 @@
+#include "oshelper.h"
+#include
+#include
+
+OSHelper::OSHelper(QObject *parent) : QObject(parent)
+{
+
+}
+
+QString OSHelper::temporaryFilename() const
+{
+ QString tempFileName;
+ {
+ QTemporaryFile f;
+ f.open();
+ tempFileName = f.fileName();
+ }
+ return tempFileName;
+}
+
+QString OSHelper::temporaryPath() const
+{
+ return QDir::tempPath();
+}
diff --git a/oshelper.h b/oshelper.h
new file mode 100644
index 00000000..809058cb
--- /dev/null
+++ b/oshelper.h
@@ -0,0 +1,22 @@
+#ifndef OSHELPER_H
+#define OSHELPER_H
+
+#include
+/**
+ * @brief The OSHelper class - exports to QML some OS-related functions
+ */
+class OSHelper : public QObject
+{
+ Q_OBJECT
+public:
+ explicit OSHelper(QObject *parent = 0);
+
+ Q_INVOKABLE QString temporaryFilename() const;
+ Q_INVOKABLE QString temporaryPath() const;
+
+signals:
+
+public slots:
+};
+
+#endif // OSHELPER_H
diff --git a/wizard/WizardCreateWallet.qml b/wizard/WizardCreateWallet.qml
index 346627dc..653db251 100644
--- a/wizard/WizardCreateWallet.qml
+++ b/wizard/WizardCreateWallet.qml
@@ -40,18 +40,23 @@ Item {
onOpacityChanged: visible = opacity !== 0
- function saveSettings(settingsObject) {
+ //! function called each time we display this page
+
+ function onPageClosed(settingsObject) {
settingsObject['account_name'] = uiItem.accountNameText
settingsObject['words'] = uiItem.wordsTexttext
settingsObject['wallet_path'] = uiItem.walletPath
+ // put wallet files to the subdirectory with the same name as
+ // wallet name
var new_wallet_filename = settingsObject.wallet_path + "/"
+ + settingsObject.account_name + "/"
+ settingsObject.account_name;
// moving wallet files to the new destination, if user changed it
if (new_wallet_filename !== settingsObject.wallet_filename) {
// using previously saved wallet;
- settingsObject.wallet.rename(new_wallet_filename);
+ settingsObject.wallet.store(new_wallet_filename);
//walletManager.moveWallet(settingsObject.wallet_filename, new_wallet_filename);
}
@@ -59,10 +64,18 @@ Item {
settingsObject['wallet_filename'] = new_wallet_filename;
}
+ //! function called each time we hide this page
+ //
+
+
function createWallet(settingsObject) {
- var wallet_filename = uiItem.walletPath + "/" + uiItem.accountNameText
+ // TODO: create wallet in temporary filename and a) move it to the path specified by user after the final
+ // page submitted or b) delete it when program closed before reaching final page
+
+ var wallet_filename = oshelper.temporaryFilename();
if (typeof settingsObject.wallet === 'undefined') {
- var wallet = walletManager.createWallet(wallet_filename, "", settingsObject.locale)
+ //var wallet = walletManager.createWallet(wallet_filename, "", settingsObject.language)
+ var wallet = walletManager.createWallet(wallet_filename, "", settingsObject.wallet_language)
uiItem.wordsTextItem.memoText = wallet.seed
// saving wallet in "global" settings object
// TODO: wallet should have a property pointing to the file where it stored or loaded from
@@ -70,10 +83,12 @@ Item {
} else {
print("wallet already created. we just stepping back");
}
-
settingsObject.wallet_filename = wallet_filename
}
+
+
+
WizardManageWalletUI {
id: uiItem
titleText: qsTr("A new wallet has been created for you")
diff --git a/wizard/WizardDonation.qml b/wizard/WizardDonation.qml
index d42c266e..51a28029 100644
--- a/wizard/WizardDonation.qml
+++ b/wizard/WizardDonation.qml
@@ -38,7 +38,7 @@ Item {
onOpacityChanged: visible = opacity !== 0
- function saveSettings(settingsObject) {
+ function onPageClosed(settingsObject) {
settingsObject['auto_donations_enabled'] = enableAutoDonationCheckBox.checked;
settingsObject['auto_donations_amount'] = autoDonationAmountText.text;
settingsObject['allow_background_mining'] = allowBackgroundMiningCheckBox.checked;
diff --git a/wizard/WizardMain.qml b/wizard/WizardMain.qml
index 51e0baf3..a19c622c 100644
--- a/wizard/WizardMain.qml
+++ b/wizard/WizardMain.qml
@@ -49,8 +49,8 @@ Rectangle {
function switchPage(next) {
// save settings for current page;
- if (typeof pages[currentPage].saveSettings !== 'undefined') {
- pages[currentPage].saveSettings(settings);
+ if (typeof pages[currentPage].onPageClosed !== 'undefined') {
+ pages[currentPage].onPageClosed(settings);
}
print ("switchpage: start: currentPage: ", currentPage);
@@ -61,7 +61,6 @@ Rectangle {
pages[currentPage].opacity = 1;
handlePageChanged();
}
-
}
function handlePageChanged() {
@@ -91,9 +90,9 @@ Rectangle {
nextButton.enabled = true
}
-
}
+
function openCreateWalletPage() {
print ("show create wallet page");
pages[currentPage].opacity = 0;
diff --git a/wizard/WizardManageWalletUI.qml b/wizard/WizardManageWalletUI.qml
index ce035f0a..58f4e59a 100644
--- a/wizard/WizardManageWalletUI.qml
+++ b/wizard/WizardManageWalletUI.qml
@@ -206,7 +206,7 @@ Item {
verticalAlignment: Text.AlignVCenter
selectByMouse: true
- text: moneroAccountsDir + "/My Wallet"
+ text: moneroAccountsDir + "/"
onFocusChanged: {
if(focus) {
fileDialog.folder = text
diff --git a/wizard/WizardPassword.qml b/wizard/WizardPassword.qml
index 1bcc6213..aca45d4d 100644
--- a/wizard/WizardPassword.qml
+++ b/wizard/WizardPassword.qml
@@ -43,7 +43,7 @@ Item {
onOpacityChanged: visible = opacity !== 0
- function saveSettings(settingsObject) {
+ function onPageClosed(settingsObject) {
settingsObject.wallet.setPassword(passwordItem.password)
}
diff --git a/wizard/WizardRecoveryWallet.qml b/wizard/WizardRecoveryWallet.qml
index 572d776b..e7fd6c0d 100644
--- a/wizard/WizardRecoveryWallet.qml
+++ b/wizard/WizardRecoveryWallet.qml
@@ -40,7 +40,7 @@ Item {
onOpacityChanged: visible = opacity !== 0
- function saveSettings(settingsObject) {
+ function onPageClosed(settingsObject) {
settingsObject['account_name'] = uiItem.accountNameText
settingsObject['words'] = uiItem.wordsTexttext
settingsObject['wallet_path'] = uiItem.walletPath
diff --git a/wizard/WizardWelcome.qml b/wizard/WizardWelcome.qml
index 208a7994..bdd88b70 100644
--- a/wizard/WizardWelcome.qml
+++ b/wizard/WizardWelcome.qml
@@ -36,8 +36,11 @@ Item {
onOpacityChanged: visible = opacity !== 0
- function saveSettings(settingsObject) {
- settingsObject['language'] = languagesModel.get(gridView.currentIndex).name
+ function onPageClosed(settingsObject) {
+ var lang = languagesModel.get(gridView.currentIndex);
+ settingsObject['language'] = lang.display_name;
+ settingsObject['wallet_language'] = lang.wallet_name;
+ settingsObject['locale'] = lang.locale;
}
Column {
@@ -78,7 +81,9 @@ Item {
source: "/lang/languages.xml"
query: "/languages/language"
- XmlRole { name: "name"; query: "@name/string()" }
+ XmlRole { name: "display_name"; query: "@display_name/string()" }
+ XmlRole { name: "locale"; query: "@locale/string()" }
+ XmlRole { name: "wallet_name"; query: "@wallet_name/string()" }
XmlRole { name: "flag"; query: "@flag/string()" }
// TODO: XmlListModel is read only, we should store current language somewhere else
// and set current language accordingly
@@ -126,7 +131,7 @@ Item {
font.bold: gridView.currentIndex === index
elide: Text.ElideRight
color: "#3F3F3F"
- text: name
+ text: display_name
}
MouseArea {
id: delegateArea