Merge pull request #5453 from nextcloud/bugfix/account-settings-avatars

Fix avatars not showing up in settings dialog account actions until clicked on
This commit is contained in:
Claudio Cambra 2023-02-28 19:14:23 +01:00 committed by GitHub
commit e58045edce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -234,16 +234,8 @@ void SettingsDialog::accountAdded(AccountState *s)
auto height = _toolBar->sizeHint().height();
bool brandingSingleAccount = !Theme::instance()->multiAccount();
QAction *accountAction = nullptr;
QImage avatar = s->account()->avatar();
const QString actionText = brandingSingleAccount ? tr("Account") : s->account()->displayName();
if (avatar.isNull()) {
accountAction = createColorAwareAction(QLatin1String(":/client/theme/account.svg"),
actionText);
} else {
QIcon icon(QPixmap::fromImage(AvatarJob::makeCircularAvatar(avatar)));
accountAction = createActionWithIcon(icon, actionText);
}
const auto actionText = brandingSingleAccount ? tr("Account") : s->account()->displayName();
const auto accountAction = createColorAwareAction(QLatin1String(":/client/theme/account.svg"), actionText);
if (!brandingSingleAccount) {
accountAction->setToolTip(s->account()->displayName());
@ -271,6 +263,15 @@ void SettingsDialog::accountAdded(AccountState *s)
// Connect styleChanged event, to adapt (Dark-/Light-Mode switching)
connect(this, &SettingsDialog::styleChanged, accountSettings, &AccountSettings::slotStyleChanged);
const auto userInfo = new UserInfo(s, false, true, this);
connect(userInfo, &UserInfo::fetchedLastInfo, this, [userInfo](const UserInfo *fetchedInfo) {
// UserInfo will go and update the account avatar
Q_UNUSED(fetchedInfo);
userInfo->deleteLater();
});
userInfo->setActive(true);
userInfo->slotFetchInfo();
}
void SettingsDialog::slotAccountAvatarChanged()