From 613bc8eb31d8a80b43aa045ab2040b7cb7e0eadf Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Thu, 29 Jul 2010 16:35:30 +1000 Subject: Rename QNetworkConfiguration::bearerName() function. bearerName() -> bearerTypeName(). bearerName() is deprecated and converted into an inline function which calls bearerTypeName(). This is required to keep existing code source compatible between Qt Mobility 1.0.x and Qt 4.7. Task-number: QTBUG-12378 Reviewed-by: Alex --- examples/network/bearercloud/cloud.cpp | 22 +++++++++++----------- examples/network/bearermonitor/sessionwidget.cpp | 4 ++-- src/network/bearer/qnetworkconfiguration.cpp | 24 ++++++++++++++++-------- src/network/bearer/qnetworkconfiguration.h | 6 +++++- 4 files changed, 34 insertions(+), 22 deletions(-) diff --git a/examples/network/bearercloud/cloud.cpp b/examples/network/bearercloud/cloud.cpp index 980efbf..f45ae0d 100644 --- a/examples/network/bearercloud/cloud.cpp +++ b/examples/network/bearercloud/cloud.cpp @@ -261,9 +261,9 @@ void Cloud::stateChanged(QNetworkSession::State state) tooltip += tr("
Id: %1").arg(configuration.identifier()); #endif - const QString bearerName = configuration.bearerName(); - if (!bearerName.isEmpty()) - tooltip += tr("
Bearer: %1").arg(bearerName); + const QString bearerTypeName = configuration.bearerTypeName(); + if (!bearerTypeName.isEmpty()) + tooltip += tr("
Bearer: %1").arg(bearerTypeName); QString s = tr("
State: %1 (%2)"); switch (state) { @@ -313,17 +313,17 @@ void Cloud::stateChanged(QNetworkSession::State state) //! [1] void Cloud::newConfigurationActivated() { - const QString bearerName = configuration.bearerName(); - if (!svgCache.contains(bearerName)) { - if (bearerName == QLatin1String("WLAN")) - svgCache.insert(bearerName, new QSvgRenderer(QLatin1String(":wlan.svg"))); - else if (bearerName == QLatin1String("Ethernet")) - svgCache.insert(bearerName, new QSvgRenderer(QLatin1String(":lan.svg"))); + const QString bearerTypeName = configuration.bearerTypeName(); + if (!svgCache.contains(bearerTypeName)) { + if (bearerTypeName == QLatin1String("WLAN")) + svgCache.insert(bearerTypeName, new QSvgRenderer(QLatin1String(":wlan.svg"))); + else if (bearerTypeName == QLatin1String("Ethernet")) + svgCache.insert(bearerTypeName, new QSvgRenderer(QLatin1String(":lan.svg"))); else - svgCache.insert(bearerName, new QSvgRenderer(QLatin1String(":unknown.svg"))); + svgCache.insert(bearerTypeName, new QSvgRenderer(QLatin1String(":unknown.svg"))); } - icon->setSharedRenderer(svgCache[bearerName]); + icon->setSharedRenderer(svgCache[bearerTypeName]); if (configuration.name().isEmpty()) { text->setPlainText(tr("HIDDEN NETWORK")); diff --git a/examples/network/bearermonitor/sessionwidget.cpp b/examples/network/bearermonitor/sessionwidget.cpp index 8b5693a..ecc2a93 100644 --- a/examples/network/bearermonitor/sessionwidget.cpp +++ b/examples/network/bearermonitor/sessionwidget.cpp @@ -111,11 +111,11 @@ void SessionWidget::updateSession() killTimer(statsTimer); if (session->configuration().type() == QNetworkConfiguration::InternetAccessPoint) - bearer->setText(session->configuration().bearerName()); + bearer->setText(session->configuration().bearerTypeName()); else { QNetworkConfigurationManager mgr; QNetworkConfiguration c = mgr.configurationFromIdentifier(session->sessionProperty("ActiveConfiguration").toString()); - bearer->setText(c.bearerName()); + bearer->setText(c.bearerTypeName()); } #ifndef QT_NO_NETWORKINTERFACE diff --git a/src/network/bearer/qnetworkconfiguration.cpp b/src/network/bearer/qnetworkconfiguration.cpp index d7fceba..b939342 100644 --- a/src/network/bearer/qnetworkconfiguration.cpp +++ b/src/network/bearer/qnetworkconfiguration.cpp @@ -383,12 +383,20 @@ QList QNetworkConfiguration::children() const } /*! - Returns the type of bearer. The string is not translated and - therefore can not be shown to the user. The subsequent table presents the currently known - bearer types: + \fn QString QNetworkConfiguration::bearerName() const + \deprecated + + This function is deprecated. It is equivalent to calling bearerTypeName(). +*/ + +/*! + Returns the type of bearer used by this network configuration as a string. + + The string is not translated and therefore can not be shown to the user. The subsequent table + presents the currently known bearer types: \table - \header + \header \o Value \o Description \row @@ -403,7 +411,7 @@ QList QNetworkConfiguration::children() const \row \o 2G \o The session uses CSD, GPRS, HSCSD, EDGE or cdmaOne. - \row + \row \o CDMA2000 \o The session uses CDMA. \row @@ -420,11 +428,11 @@ QList QNetworkConfiguration::children() const \o The session uses WiMAX. \endtable - This function returns an empty string if this is an invalid configuration, - a network configuration of type \l QNetworkConfiguration::ServiceNetwork or + This function returns an empty string if this is an invalid configuration, a network + configuration of type \l QNetworkConfiguration::ServiceNetwork or \l QNetworkConfiguration::UserChoice. */ -QString QNetworkConfiguration::bearerName() const +QString QNetworkConfiguration::bearerTypeName() const { if (!isValid()) return QString(); diff --git a/src/network/bearer/qnetworkconfiguration.h b/src/network/bearer/qnetworkconfiguration.h index dce39eb..42e8b6a 100644 --- a/src/network/bearer/qnetworkconfiguration.h +++ b/src/network/bearer/qnetworkconfiguration.h @@ -106,7 +106,11 @@ public: StateFlags state() const; Type type() const; Purpose purpose() const; - QString bearerName() const; + + // Required to maintain source compatibility with Qt Mobility. + QT_DEPRECATED inline QString bearerName() const { return bearerTypeName(); } + QString bearerTypeName() const; + QString identifier() const; bool isRoamingAvailable() const; QList children() const; -- cgit v0.12