summaryrefslogtreecommitdiffstats
path: root/src/plugins/bearer
diff options
context:
space:
mode:
authorAaron McCarthy <aaron.mccarthy@nokia.com>2010-04-20 05:35:29 (GMT)
committerAaron McCarthy <aaron.mccarthy@nokia.com>2010-04-20 07:02:46 (GMT)
commitc4c75ebd65454fd27bffefb4a3468ece20990c86 (patch)
tree3cf53f960be45c31005371a602fe297671c994a5 /src/plugins/bearer
parentb64a309f78b684bf3acb49bc6d0e9b93aa2138c5 (diff)
downloadQt-c4c75ebd65454fd27bffefb4a3468ece20990c86.zip
Qt-c4c75ebd65454fd27bffefb4a3468ece20990c86.tar.gz
Qt-c4c75ebd65454fd27bffefb4a3468ece20990c86.tar.bz2
Remove redundant network configuration updates on startup.
The initial list of network configurations was being fetched twice when the bearer management plugins are loaded.
Diffstat (limited to 'src/plugins/bearer')
-rw-r--r--src/plugins/bearer/corewlan/qcorewlanengine.h2
-rw-r--r--src/plugins/bearer/corewlan/qcorewlanengine.mm6
-rw-r--r--src/plugins/bearer/generic/qgenericengine.cpp5
-rw-r--r--src/plugins/bearer/generic/qgenericengine.h1
-rw-r--r--src/plugins/bearer/icd/qicdengine.cpp8
-rw-r--r--src/plugins/bearer/icd/qicdengine.h2
-rw-r--r--src/plugins/bearer/nativewifi/qnativewifiengine.cpp7
-rw-r--r--src/plugins/bearer/nativewifi/qnativewifiengine.h1
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp6
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerengine.h3
-rw-r--r--src/plugins/bearer/symbian/symbianengine.cpp7
-rw-r--r--src/plugins/bearer/symbian/symbianengine.h1
12 files changed, 33 insertions, 16 deletions
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.h b/src/plugins/bearer/corewlan/qcorewlanengine.h
index 854dcea..3c24c54 100644
--- a/src/plugins/bearer/corewlan/qcorewlanengine.h
+++ b/src/plugins/bearer/corewlan/qcorewlanengine.h
@@ -73,6 +73,7 @@ public:
void connectToId(const QString &id);
void disconnectFromId(const QString &id);
+ Q_INVOKABLE void initialize();
Q_INVOKABLE void requestUpdate();
QNetworkSession::State sessionStateForId(const QString &id);
@@ -86,7 +87,6 @@ public:
bool requiresPolling() const;
private Q_SLOTS:
- void init();
void doRequestUpdate();
void networksChanged();
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm
index f78fc76..02079d6 100644
--- a/src/plugins/bearer/corewlan/qcorewlanengine.mm
+++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm
@@ -415,8 +415,6 @@ QCoreWlanEngine::QCoreWlanEngine(QObject *parent)
scanThread = new QScanThread(this);
connect(scanThread, SIGNAL(networksChanged()),
this, SLOT(networksChanged()));
-
- QTimer::singleShot(0,this,SLOT(init()));
}
QCoreWlanEngine::~QCoreWlanEngine()
@@ -427,8 +425,10 @@ QCoreWlanEngine::~QCoreWlanEngine()
[listener release];
}
-void QCoreWlanEngine::init()
+void QCoreWlanEngine::initialize()
{
+ QMutexLocker locker(&mutex);
+
if([[CWInterface supportedInterfaces] count] > 0 && !listener) {
listener = [[QNSListener alloc] init];
listener.engine = this;
diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp
index 41ff3e0..652fe4a 100644
--- a/src/plugins/bearer/generic/qgenericengine.cpp
+++ b/src/plugins/bearer/generic/qgenericengine.cpp
@@ -177,6 +177,11 @@ void QGenericEngine::disconnectFromId(const QString &id)
emit connectionError(id, OperationNotSupported);
}
+void QGenericEngine::initialize()
+{
+ doRequestUpdate();
+}
+
void QGenericEngine::requestUpdate()
{
doRequestUpdate();
diff --git a/src/plugins/bearer/generic/qgenericengine.h b/src/plugins/bearer/generic/qgenericengine.h
index 82d22af..cdbbc9d 100644
--- a/src/plugins/bearer/generic/qgenericengine.h
+++ b/src/plugins/bearer/generic/qgenericengine.h
@@ -70,6 +70,7 @@ public:
void connectToId(const QString &id);
void disconnectFromId(const QString &id);
+ Q_INVOKABLE void initialize();
Q_INVOKABLE void requestUpdate();
QNetworkSession::State sessionStateForId(const QString &id);
diff --git a/src/plugins/bearer/icd/qicdengine.cpp b/src/plugins/bearer/icd/qicdengine.cpp
index fc9b469..9d1bfab 100644
--- a/src/plugins/bearer/icd/qicdengine.cpp
+++ b/src/plugins/bearer/icd/qicdengine.cpp
@@ -225,8 +225,6 @@ QIcdEngine::QIcdEngine(QObject *parent)
: QBearerEngine(parent), iapMonitor(new IapMonitor), m_dbusInterface(0),
firstUpdate(true), m_scanGoingOn(false)
{
- QMetaObject::invokeMethod(this, "doRequestUpdate", Qt::QueuedConnection);
- init();
}
QIcdEngine::~QIcdEngine()
@@ -243,8 +241,10 @@ QNetworkConfigurationManager::Capabilities QIcdEngine::capabilities() const
QNetworkConfigurationManager::NetworkSessionRequired;
}
-void QIcdEngine::init()
+void QIcdEngine::initialize()
{
+ QMutexLocker locker(&mutex);
+
// Setup DBus Interface for ICD
m_dbusInterface = new QDBusInterface(ICD_DBUS_API_INTERFACE,
ICD_DBUS_API_PATH,
@@ -272,6 +272,8 @@ void QIcdEngine::init()
QNetworkConfigurationPrivatePointer ptr(cpPriv);
userChoiceConfigurations.insert(cpPriv->id, ptr);
+
+ doRequestUpdate();
}
static inline QString network_attrs_to_security(uint network_attrs)
diff --git a/src/plugins/bearer/icd/qicdengine.h b/src/plugins/bearer/icd/qicdengine.h
index 841874f..2f9f8ed 100644
--- a/src/plugins/bearer/icd/qicdengine.h
+++ b/src/plugins/bearer/icd/qicdengine.h
@@ -91,6 +91,7 @@ public:
bool hasIdentifier(const QString &id);
+ Q_INVOKABLE void initialize();
Q_INVOKABLE void requestUpdate();
QNetworkConfigurationManager::Capabilities capabilities() const;
@@ -123,7 +124,6 @@ public:
emit configurationChanged(ptr);
}
- void init();
void cleanup();
void addConfiguration(QString &iap_id);
diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp
index e796df3..9b6ffa0 100644
--- a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp
+++ b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp
@@ -100,8 +100,6 @@ QNativeWifiEngine::QNativeWifiEngine(QObject *parent)
if (result != ERROR_SUCCESS)
qDebug("%s: WlanRegisterNotification failed with error %ld\n", __FUNCTION__, result);
#endif
-
- scanComplete();
}
QNativeWifiEngine::~QNativeWifiEngine()
@@ -472,6 +470,11 @@ void QNativeWifiEngine::disconnectFromId(const QString &id)
}
}
+void QNativeWifiEngine::initialize()
+{
+ scanComplete();
+}
+
void QNativeWifiEngine::requestUpdate()
{
QMutexLocker locker(&mutex);
diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.h b/src/plugins/bearer/nativewifi/qnativewifiengine.h
index 77764e4..3b21985 100644
--- a/src/plugins/bearer/nativewifi/qnativewifiengine.h
+++ b/src/plugins/bearer/nativewifi/qnativewifiengine.h
@@ -80,6 +80,7 @@ public:
void connectToId(const QString &id);
void disconnectFromId(const QString &id);
+ Q_INVOKABLE void initialize();
Q_INVOKABLE void requestUpdate();
QNetworkSession::State sessionStateForId(const QString &id);
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
index 13b2252..3ebc356 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
@@ -93,16 +93,16 @@ QNetworkManagerEngine::QNetworkManagerEngine(QObject *parent)
userSettings->setConnections();
connect(userSettings, SIGNAL(newConnection(QDBusObjectPath)),
this, SLOT(newConnection(QDBusObjectPath)));
-
- QMetaObject::invokeMethod(this, "init", Qt::QueuedConnection);
}
QNetworkManagerEngine::~QNetworkManagerEngine()
{
}
-void QNetworkManagerEngine::init()
+void QNetworkManagerEngine::initialize()
{
+ QMutexLocker locker(&mutex);
+
// Get current list of access points.
foreach (const QDBusObjectPath &devicePath, interface->getDevices())
deviceAdded(devicePath);
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h
index 7f8badb..8e95a2c 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h
@@ -73,8 +73,6 @@ public:
QNetworkManagerEngine(QObject *parent = 0);
~QNetworkManagerEngine();
- Q_INVOKABLE void init();
-
bool networkManagerAvailable() const;
QString getInterfaceFromId(const QString &id);
@@ -85,6 +83,7 @@ public:
void connectToId(const QString &id);
void disconnectFromId(const QString &id);
+ Q_INVOKABLE void initialize();
Q_INVOKABLE void requestUpdate();
QNetworkSession::State sessionStateForId(const QString &id);
diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp
index c629d02..8e9675e 100644
--- a/src/plugins/bearer/symbian/symbianengine.cpp
+++ b/src/plugins/bearer/symbian/symbianengine.cpp
@@ -137,7 +137,12 @@ SymbianEngine::SymbianEngine(QObject *parent)
return;
}
#endif
-
+}
+
+void SymbianEngine::initialize()
+{
+ QMutexLocker locker(&mutex);
+
SymbianNetworkConfigurationPrivate *cpPriv = new SymbianNetworkConfigurationPrivate;
cpPriv->name = "UserChoice";
cpPriv->bearer = SymbianNetworkConfigurationPrivate::BearerUnknown;
diff --git a/src/plugins/bearer/symbian/symbianengine.h b/src/plugins/bearer/symbian/symbianengine.h
index dfd12bd..afb37de 100644
--- a/src/plugins/bearer/symbian/symbianengine.h
+++ b/src/plugins/bearer/symbian/symbianengine.h
@@ -110,6 +110,7 @@ public:
bool hasIdentifier(const QString &id);
+ Q_INVOKABLE void initialize();
Q_INVOKABLE void requestUpdate();
QNetworkConfigurationManager::Capabilities capabilities() const;