Account: Display non-standard port as part of the hostname
authorDaniel Molkentin <danimo@owncloud.com>
Thu, 10 Sep 2015 08:17:16 +0000 (10:17 +0200)
committerDaniel Molkentin <danimo@owncloud.com>
Thu, 10 Sep 2015 08:17:31 +0000 (10:17 +0200)
Addresses #3658

src/gui/accountstate.cpp

index 76314128a21a8ac7d7a70b92000e8102e032e5d3..1dac2ea28cdc81c60b4ade3dc4a0fac230abb350 100644 (file)
@@ -257,10 +257,15 @@ QString AccountState::shortDisplayNameForSettings(int width) const
 {
     QString user = account()->credentials()->user();
     QString host = account()->url().host();
+    int port = account()->url().port();
+    if (port > 0 && port != 80 && port != 443) {
+        host.append(QLatin1Char(':'));
+        host.append(QString::number(port));
+    }
     if (width > 0) {
         QFont f;
         QFontMetrics fm(f);
-        host = fm.elidedText(host, Qt::ElideRight, width);
+        host = fm.elidedText(host, Qt::ElideMiddle, width);
         user = fm.elidedText(user, Qt::ElideRight, width);
     }
     return user + QLatin1String("\n") + host;