Fetch and store user info for accounts in file provider settings controller

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2023-09-26 17:29:34 +08:00
parent 7d229b569f
commit f68965a241
No known key found for this signature in database
GPG key ID: C839200C384636B0
2 changed files with 16 additions and 0 deletions

View file

@ -19,6 +19,8 @@
namespace OCC {
class UserInfo;
namespace Mac {
class FileProviderSettingsController : public QObject
@ -50,6 +52,8 @@ private:
class MacImplementation;
std::unique_ptr<MacImplementation> d;
QHash<QString, UserInfo*> _userInfos;
};
} // Mac

View file

@ -264,6 +264,18 @@ FileProviderSettingsController::FileProviderSettingsController(QObject *parent)
: QObject{parent}
{
d = std::make_unique<FileProviderSettingsController::MacImplementation>(this);
const auto accManager = AccountManager::instance();
const auto accountsList = accManager->accounts();
for (const auto &accountState : accountsList) {
const auto userInfo = new UserInfo(accountState.data(), false, false, this);
const auto account = accountState->account();
const auto accountUserIdAtHost = account->userIdAtHostWithPort();
_userInfos.insert(accountUserIdAtHost, userInfo);
userInfo->setActive(true);
}
}
QQuickWidget *FileProviderSettingsController::settingsViewWidget(const QString &accountUserIdAtHost,