From 13e6ead66ec7f032746e742540555353d73c4a7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Fri, 4 Mar 2011 16:22:23 +0100 Subject: [PATCH] do not show hostname in titlebar if it's FQDN of localhost --- utils.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/utils.cpp b/utils.cpp index 20d2ad0e00..92a89e5b1c 100644 --- a/utils.cpp +++ b/utils.cpp @@ -421,6 +421,13 @@ bool isLocalMachine(const QByteArray& host) *dot = '\0'; if (host == hostnamebuf) return true; + } else { // e.g. LibreOffice likes to give FQDN, even if gethostname() doesn't include domain + QByteArray h = hostnamebuf; + if( getdomainname( hostnamebuf, sizeof hostnamebuf ) >= 0 ) { + hostnamebuf[sizeof(hostnamebuf)-1] = 0; + if( host == h + '.' + QByteArray( hostnamebuf )) + return true; + } } } return false;