Showing the changes to interface/src/scripting/AccountScriptingInterface.cpp (1 of 2 files). Show all
Unified · Split
| @@ -17,7 +17,6 @@ AccountScriptingInterface::AccountScriptingInterface() { · 16 unmodified lines | ||
| 17 | 17 | AccountManager& accountManager = AccountManager::getInstance(); |
| 18 | 18 | connect(&accountManager, &AccountManager::balanceChanged, this, |
| 19 | 19 | &AccountScriptingInterface::updateBalance); |
| 20 | − | |
| 21 | 20 | } |
| 22 | 21 | |
| 23 | 22 | AccountScriptingInterface* AccountScriptingInterface::getInstance() { |
| @@ -39,3 +38,12 @@ void AccountScriptingInterface::updateBalance() { · 15 unmodified lines | ||
| 39 | 38 | AccountManager& accountManager = AccountManager::getInstance(); |
| 40 | 39 | emit balanceChanged(accountManager.getAccountInfo().getBalanceInSatoshis()); |
| 41 | 40 | } |
| 41 | + | |
| 42 | +QString AccountScriptingInterface::getUsername() { | |
| 43 | + AccountManager& accountManager = AccountManager::getInstance(); | |
| 44 | + if (accountManager.isLoggedIn()) { | |
| 45 | + return accountManager.getAccountInfo().getUsername(); | |
| 46 | + } else { | |
| 47 | + return "Unknown user"; | |
| 48 | + } | |
| 49 | +} | |