Skip to content

Commit 35f3d46

Browse files
committed
Use prettyName more widely, instead of duplicating fallback string code
Signed-off-by: Claudio Cambra <claudio.cambra@gmail.com>
1 parent e3b60ab commit 35f3d46

3 files changed

Lines changed: 3 additions & 14 deletions

File tree

src/gui/accountsettings.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,10 +1110,7 @@ void AccountSettings::slotAccountStateChanged()
11101110
Utility::escape(safeUrl.toString()));
11111111
QString serverWithUser = server;
11121112
if (AbstractCredentials *cred = account->credentials()) {
1113-
QString user = account->davDisplayName();
1114-
if (user.isEmpty()) {
1115-
user = cred->user();
1116-
}
1113+
QString user = account->prettyName();
11171114
serverWithUser = tr("%1 as %2").arg(server, Utility::escape(user));
11181115
}
11191116

src/gui/settingsdialog.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,7 @@ const float buttonSizeRatio = 1.618f; // golden ratio
5757
*/
5858
QString shortDisplayNameForSettings(OCC::Account *account, int width)
5959
{
60-
QString user = account->davDisplayName();
61-
if (user.isEmpty()) {
62-
user = account->credentials()->user();
63-
}
60+
QString user = account->prettyName();
6461
QString host = account->url().host();
6562
int port = account->url().port();
6663
if (port > 0 && port != 80 && port != 443) {

src/gui/tray/usermodel.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -733,12 +733,7 @@ void User::logout() const
733733

734734
QString User::name() const
735735
{
736-
// If davDisplayName is empty (can be several reasons, simplest is missing login at startup), fall back to username
737-
QString name = _account->account()->davDisplayName();
738-
if (name == "") {
739-
name = _account->account()->credentials()->user();
740-
}
741-
return name;
736+
return _account->account()->prettyName();
742737
}
743738

744739
QString User::server(bool shortened) const

0 commit comments

Comments
 (0)