1
mirror of https://github.com/monero-project/monero-gui synced 2024-12-21 03:45:53 +01:00

wallet directrory in "Documents" for Windows and in "home" for *nix

This commit is contained in:
Ilya Kitaev 2016-02-08 10:58:01 +03:00
parent 16020ae2a8
commit e555631b40
2 changed files with 19 additions and 2 deletions

View File

@ -29,6 +29,7 @@
#include <QApplication> #include <QApplication>
#include <QQmlApplicationEngine> #include <QQmlApplicationEngine>
#include <QtQml> #include <QtQml>
#include <QStandardPaths>
#include "clipboardAdapter.h" #include "clipboardAdapter.h"
#include "filter.h" #include "filter.h"
#include "oscursor.h" #include "oscursor.h"
@ -46,6 +47,20 @@ int main(int argc, char *argv[])
OSCursor cursor; OSCursor cursor;
engine.rootContext()->setContextProperty("globalCursor", &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.rootContext()->setContextProperty("applicationDirectory", QApplication::applicationDirPath());
engine.load(QUrl(QStringLiteral("qrc:///main.qml"))); engine.load(QUrl(QStringLiteral("qrc:///main.qml")));
QObject *rootObject = engine.rootObjects().first(); QObject *rootObject = engine.rootObjects().first();

View File

@ -204,10 +204,12 @@ Item {
color: "#6B0072" color: "#6B0072"
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
selectByMouse: true selectByMouse: true
text: "~/.monero/mywallet/"
text: moneroAccountsDir + "/My Wallet"
onFocusChanged: { onFocusChanged: {
if(focus) { if(focus) {
fileDialog.visible = true fileDialog.folder = text
fileDialog.open()
} }
} }
} }