From e555631b40972b0264962f5bbd780ddd3aef5a7c Mon Sep 17 00:00:00 2001 From: Ilya Kitaev Date: Mon, 8 Feb 2016 10:58:01 +0300 Subject: [PATCH] wallet directrory in "Documents" for Windows and in "home" for *nix --- main.cpp | 15 +++++++++++++++ wizard/WizardManageWalletUI.qml | 6 ++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index ecc8b626..af429df3 100644 --- a/main.cpp +++ b/main.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include "clipboardAdapter.h" #include "filter.h" #include "oscursor.h" @@ -46,6 +47,20 @@ int main(int argc, char *argv[]) OSCursor cursor; engine.rootContext()->setContextProperty("globalCursor", &cursor); +// export to QML monero accounts root directory +// wizard is talking about where +// to save the wallet file (.keys, .bin), they have to be user-accessible for +// backups - I reckon we save that in My Documents\Monero Accounts\ on +// Windows, ~/Monero Accounts/ on nix / osx +#ifdef Q_OS_WIN + QStringList moneroAccountsRootDir = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation); +#elif defined(Q_OS_UNIX) + QStringList moneroAccountsRootDir = QStandardPaths::standardLocations(QStandardPaths::HomeLocation); +#endif + if (!moneroAccountsRootDir.empty()) { + engine.rootContext()->setContextProperty("moneroAccountsDir", moneroAccountsRootDir.at(0) + "/Monero Accounts"); + } + engine.rootContext()->setContextProperty("applicationDirectory", QApplication::applicationDirPath()); engine.load(QUrl(QStringLiteral("qrc:///main.qml"))); QObject *rootObject = engine.rootObjects().first(); diff --git a/wizard/WizardManageWalletUI.qml b/wizard/WizardManageWalletUI.qml index 651c7081..6ea9ea44 100644 --- a/wizard/WizardManageWalletUI.qml +++ b/wizard/WizardManageWalletUI.qml @@ -204,10 +204,12 @@ Item { color: "#6B0072" verticalAlignment: Text.AlignVCenter selectByMouse: true - text: "~/.monero/mywallet/" + + text: moneroAccountsDir + "/My Wallet" onFocusChanged: { if(focus) { - fileDialog.visible = true + fileDialog.folder = text + fileDialog.open() } } }