Port QNetworkSession to QMetaMethod-based connectNotify()
authorKent Hansen <kent.hansen@nokia.com>
Sun, 22 Apr 2012 12:35:56 +0000 (14:35 +0200)
committerQt by Nokia <qt-info@nokia.com>
Mon, 30 Apr 2012 23:18:03 +0000 (01:18 +0200)
The const char *-based API is deprecated and will be removed in Qt5.

Change-Id: I36f6dc761e3b5a087e38db29b761c3e9237958b4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
src/network/bearer/qnetworksession.cpp
src/network/bearer/qnetworksession.h

index 1a3c25a..90bbe1b 100644 (file)
@@ -43,6 +43,7 @@
 #include "qbearerengine_p.h"
 
 #include <QEventLoop>
+#include <QMetaMethod>
 #include <QTimer>
 #include <QThread>
 
@@ -704,7 +705,7 @@ void QNetworkSessionPrivate::setUsagePolicies(QNetworkSession &session, QNetwork
     For more details check the Forced vs ALR roaming section in the QNetworkSession 
     class description.
 */
-void QNetworkSession::connectNotify(const char *signal)
+void QNetworkSession::connectNotify(const QMetaMethod &signal)
 {
     QObject::connectNotify(signal);
 
@@ -713,7 +714,9 @@ void QNetworkSession::connectNotify(const char *signal)
 
     //check for preferredConfigurationChanged() signal connect notification
     //This is not required on all platforms
-    if (qstrcmp(signal, SIGNAL(preferredConfigurationChanged(QNetworkConfiguration,bool))) == 0)
+    static const QMetaMethod preferredConfigurationChangedSignal =
+            QMetaMethod::fromSignal(&QNetworkSession::preferredConfigurationChanged);
+    if (signal == preferredConfigurationChangedSignal)
         d->setALREnabled(true);
 }
 
@@ -725,7 +728,7 @@ void QNetworkSession::connectNotify(const char *signal)
 
     \sa connectNotify()
 */
-void QNetworkSession::disconnectNotify(const char *signal)
+void QNetworkSession::disconnectNotify(const QMetaMethod &signal)
 {
     QObject::disconnectNotify(signal);
 
@@ -734,7 +737,9 @@ void QNetworkSession::disconnectNotify(const char *signal)
 
     //check for preferredConfigurationChanged() signal disconnect notification
     //This is not required on all platforms
-    if (qstrcmp(signal, SIGNAL(preferredConfigurationChanged(QNetworkConfiguration,bool))) == 0)
+    static const QMetaMethod preferredConfigurationChangedSignal =
+            QMetaMethod::fromSignal(&QNetworkSession::preferredConfigurationChanged);
+    if (signal == preferredConfigurationChangedSignal)
         d->setALREnabled(false);
 }
 
index d72fe0e..d713825 100644 (file)
@@ -134,8 +134,8 @@ Q_SIGNALS:
     void usagePoliciesChanged(QNetworkSession::UsagePolicies);
 
 protected:
-    virtual void connectNotify(const char *signal);
-    virtual void disconnectNotify(const char *signal);
+    virtual void connectNotify(const QMetaMethod &signal);
+    virtual void disconnectNotify(const QMetaMethod &signal);
 
 private:
     Q_DISABLE_COPY(QNetworkSession)