generate default account name from env username

This commit is contained in:
Jacob Brydolf 2016-10-29 12:13:20 +02:00
parent a3c6c40832
commit b795c4b0d7
No known key found for this signature in database
GPG key ID: DE46246550D2F3C5

View file

@ -120,6 +120,17 @@ int main(int argc, char *argv[])
engine.rootContext()->setContextProperty("moneroAccountsDir", moneroAccountsDir);
}
// Get default account name
QString accountName = qgetenv("USER"); // mac/linux
if (accountName.isEmpty()){
accountName = qgetenv("USERNAME"); // Windows
}
if (accountName.isEmpty()) {
accountName = "My monero Account";
}
engine.rootContext()->setContextProperty("defaultAccountName", accountName);
engine.rootContext()->setContextProperty("applicationDirectory", QApplication::applicationDirPath());
engine.load(QUrl(QStringLiteral("qrc:///main.qml")));
QObject *rootObject = engine.rootObjects().first();