mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-28 19:58:56 +03:00
Add ability to fetch remote server avatars in usermodel avatar ImageResponse
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
c38a51079e
commit
bc74c5a887
1 changed files with 19 additions and 0 deletions
|
@ -1642,6 +1642,25 @@ public:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (id.startsWith("user-id=")) {
|
||||||
|
// Format is "image://avatars/user-id=avatar-requested-user/local-user-id:0"
|
||||||
|
const auto userIdsString = id.split('=');
|
||||||
|
const auto userIds = userIdsString.last().split("/local-account:");
|
||||||
|
const auto avatarUserId = userIds.first();
|
||||||
|
const auto accountString = userIds.last();
|
||||||
|
const auto accountState = AccountManager::instance()->account(accountString);
|
||||||
|
Q_ASSERT(accountState);
|
||||||
|
if (!accountState) {
|
||||||
|
qCWarning(lcActivity) << "Account not found:" << accountString;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const auto avatarJob = new AvatarJob(accountState->account(), avatarUserId, requestedSize.width());
|
||||||
|
connect(avatarJob, &AvatarJob::avatarPixmap, this, [&](const QImage &avatarImg) {
|
||||||
|
handleDone(AvatarJob::makeCircularAvatar(avatarImg));
|
||||||
|
});
|
||||||
|
avatarJob->start();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
handleDone(UserModel::instance()->avatarById(id.toInt()));
|
handleDone(UserModel::instance()->avatarById(id.toInt()));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue