QtNetwork: Standardize error message about IPv6 addresses for nameservers.

Add a const char * message with QDnsLookupRunnable's translation
context and use that for untranslated warnings and errorString.

Change-Id: I1b6c9fb259fb9ff824a0c3829b2c00c36aaecdfa
Reviewed-by: Richard J. Moore <rich@kde.org>
This commit is contained in:
Friedemann Kleint 2015-12-11 12:50:45 +01:00 committed by Simon Hausmann
parent 980fd570cd
commit adb914f4b9
4 changed files with 9 additions and 4 deletions

View File

@ -148,6 +148,9 @@ static void qt_qdnsservicerecord_sort(QList<QDnsServiceRecord> &records)
} }
} }
const char *QDnsLookupPrivate::msgNoIpV6NameServerAdresses =
QT_TRANSLATE_NOOP("QDnsLookupRunnable", "IPv6 addresses for nameservers are currently not supported");
/*! /*!
\class QDnsLookup \class QDnsLookup
\brief The QDnsLookup class represents a DNS lookup. \brief The QDnsLookup class represents a DNS lookup.

View File

@ -89,6 +89,8 @@ public:
void _q_lookupFinished(const QDnsLookupReply &reply); void _q_lookupFinished(const QDnsLookupReply &reply);
static const char *msgNoIpV6NameServerAdresses;
bool isFinished; bool isFinished;
QString name; QString name;
QDnsLookup::Type type; QDnsLookup::Type type;

View File

@ -166,9 +166,9 @@ void QDnsLookupRunnable::query(const int requestType, const QByteArray &requestN
ns->sin6_addr.s6_addr[i] = ipv6Address[i]; ns->sin6_addr.s6_addr[i] = ipv6Address[i];
} }
#else #else
qWarning("IPv6 addresses for nameservers is currently not supported"); qWarning("%s", QDnsLookupPrivate::msgNoIpV6NameServerAdresses);
reply->error = QDnsLookup::ResolverError; reply->error = QDnsLookup::ResolverError;
reply->errorString = tr("IPv6 addresses for nameservers is currently not supported"); reply->errorString = tr(QDnsLookupPrivate::msgNoIpV6NameServerAdresses);
return; return;
#endif #endif
} }

View File

@ -60,9 +60,9 @@ void QDnsLookupRunnable::query(const int requestType, const QByteArray &requestN
// For supoprting IPv6 nameserver addresses, we'll need to switch // For supoprting IPv6 nameserver addresses, we'll need to switch
// from DnsQuey() to DnsQueryEx() as it supports passing an IPv6 // from DnsQuey() to DnsQueryEx() as it supports passing an IPv6
// address in the nameserver list // address in the nameserver list
qWarning("IPv6 addresses for nameservers are currently not supported"); qWarning("%s", QDnsLookupPrivate::msgNoIpV6NameServerAdresses);
reply->error = QDnsLookup::ResolverError; reply->error = QDnsLookup::ResolverError;
reply->errorString = tr("IPv6 addresses for nameservers are currently not supported"); reply->errorString = tr(QDnsLookupPrivate::msgNoIpV6NameServerAdresses);
return; return;
} }
} }