зеркало из https://github.com/nextcloud/desktop.git
AccountManager: new method to return AccountStatePtr from the name.
It uses the Account displayName to destinguish.
This commit is contained in:
Родитель
aa38f7a4f2
Коммит
81296fae9d
|
@ -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
|
||||
*/
|
||||
|
|
Загрузка…
Ссылка в новой задаче