mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-23 05:25:50 +03:00
AccountManager: new method to return AccountStatePtr from the name.
It uses the Account displayName to destinguish.
This commit is contained in:
parent
aa38f7a4f2
commit
81296fae9d
2 changed files with 15 additions and 0 deletions
|
@ -215,6 +215,16 @@ AccountPtr AccountManager::load(QSettings& settings)
|
|||
return acc;
|
||||
}
|
||||
|
||||
AccountStatePtr AccountManager::account(const QString& name)
|
||||
{
|
||||
foreach (const auto& acc, _accounts) {
|
||||
if (acc->account()->displayName() == name) {
|
||||
return acc;
|
||||
}
|
||||
}
|
||||
return AccountStatePtr();
|
||||
}
|
||||
|
||||
AccountState *AccountManager::addAccount(const AccountPtr& newAccount)
|
||||
{
|
||||
auto id = newAccount->id();
|
||||
|
|
|
@ -58,6 +58,11 @@ public:
|
|||
*/
|
||||
QList<AccountStatePtr> accounts() { return _accounts; }
|
||||
|
||||
/**
|
||||
* Return the account state pointer for an account identified by its display name
|
||||
*/
|
||||
AccountStatePtr account(const QString& name);
|
||||
|
||||
/**
|
||||
* Delete the AccountState
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue