Settings dialog: Move more common hostname prefixes in toolbar
authorMarkus Goetz <markus@woboq.com>
Mon, 17 Aug 2015 10:38:04 +0000 (12:38 +0200)
committerMarkus Goetz <markus@woboq.com>
Mon, 17 Aug 2015 10:39:32 +0000 (12:39 +0200)
For #3577

src/gui/accountstate.cpp

index e7006f38dab07cfb156342c986303f56ac76ab68..925669321a14cfbd6a8065670286a42978ab06fd 100644 (file)
@@ -259,9 +259,14 @@ QString AccountState::shortDisplayNameForSettings() const
         userWithoutMailHost = userWithoutMailHost.left(userWithoutMailHost.lastIndexOf('@'));
     }
     QString hostWithoutTld = account()->url().host();
-    if (hostWithoutTld.contains('.')) {
+    if (hostWithoutTld.contains('.') && !hostWithoutTld.at(0).isDigit()) {
         hostWithoutTld = hostWithoutTld.left(hostWithoutTld.lastIndexOf('.'));
         hostWithoutTld = hostWithoutTld.replace(QLatin1String("www."), QLatin1String(""));
+        hostWithoutTld = hostWithoutTld.replace(QLatin1String("cloud."), QLatin1String(""));
+        hostWithoutTld = hostWithoutTld.replace(QLatin1String("sync."), QLatin1String(""));
+        hostWithoutTld = hostWithoutTld.replace(QLatin1String("drive."), QLatin1String(""));
+        hostWithoutTld = hostWithoutTld.replace(QLatin1String("share."), QLatin1String(""));
+        hostWithoutTld = hostWithoutTld.replace(QLatin1String("web."), QLatin1String(""));
     }
 
     return userWithoutMailHost + QLatin1String("\n") + hostWithoutTld;