Use prettyName more widely, instead of duplicating fallback string code

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2022-10-06 19:47:39 +02:00
parent 359627007b
commit 8de5b0ffa5
No known key found for this signature in database
GPG key ID: C839200C384636B0
2 changed files with 2 additions and 10 deletions

View file

@ -57,10 +57,7 @@ const float buttonSizeRatio = 1.618f; // golden ratio
*/
QString shortDisplayNameForSettings(OCC::Account *account, int width)
{
QString user = account->davDisplayName();
if (user.isEmpty()) {
user = account->credentials()->user();
}
QString user = account->prettyName();
QString host = account->url().host();
int port = account->url().port();
if (port > 0 && port != 80 && port != 443) {

View file

@ -733,12 +733,7 @@ void User::logout() const
QString User::name() const
{
// If davDisplayName is empty (can be several reasons, simplest is missing login at startup), fall back to username
QString name = _account->account()->davDisplayName();
if (name == "") {
name = _account->account()->credentials()->user();
}
return name;
return _account->account()->prettyName();
}
QString User::server(bool shortened) const