Commit 33e7455c authored by Rinigus Saar's avatar Rinigus Saar
Browse files

drop common prefixes from displayed url

parent 39d7b0c1
......@@ -52,6 +52,16 @@ QString UrlUtils::urlHostPort(const QString &url)
{
QUrl u(url);
QString r = u.host();
QStringList common = { QLatin1String("www."),
QLatin1String("m."),
QLatin1String("mobile.") };
for (const auto &i: common) {
if (r.startsWith(i) && r.length() > i.length()) {
r.remove(0, i.length());
break; // strip prefix only once
}
}
int p = u.port(-1);
if (p > 0)
r = QStringLiteral("%1:%2").arg(r).arg(p);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment