diff options
author | Lorn Potter <lorn.potter@nokia.com> | 2010-11-09 01:23:37 (GMT) |
---|---|---|
committer | Lorn Potter <lorn.potter@nokia.com> | 2010-11-09 01:23:37 (GMT) |
commit | 6b8a95b2521d843ec2b3f7c787c15b92e4ea686f (patch) | |
tree | 346bc8925d83b2729f485d1259729fca931de07d /src/plugins/bearer | |
parent | bb8f085611f4cb91b7bde7220d407948edcc572c (diff) | |
parent | e00af84cc9230df411981d2f3b9296b61d5d1c50 (diff) | |
download | Qt-6b8a95b2521d843ec2b3f7c787c15b92e4ea686f.zip Qt-6b8a95b2521d843ec2b3f7c787c15b92e4ea686f.tar.gz Qt-6b8a95b2521d843ec2b3f7c787c15b92e4ea686f.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7
Diffstat (limited to 'src/plugins/bearer')
-rw-r--r-- | src/plugins/bearer/connman/qconnmanengine.cpp | 83 | ||||
-rw-r--r-- | src/plugins/bearer/connman/qconnmanengine.h | 27 | ||||
-rw-r--r-- | src/plugins/bearer/connman/qconnmanservice_linux.cpp | 15 | ||||
-rw-r--r-- | src/plugins/bearer/connman/qofonoservice_linux.cpp | 12 | ||||
-rw-r--r-- | src/plugins/bearer/icd/maemo_icd.cpp | 2 | ||||
-rw-r--r-- | src/plugins/bearer/icd/qnetworksession_impl.cpp | 2 | ||||
-rw-r--r-- | src/plugins/bearer/symbian/qnetworksession_impl.cpp | 2 | ||||
-rw-r--r-- | src/plugins/bearer/symbian/symbian.pri | 2 | ||||
-rw-r--r-- | src/plugins/bearer/symbian/symbianengine.cpp | 2 |
9 files changed, 39 insertions, 108 deletions
diff --git a/src/plugins/bearer/connman/qconnmanengine.cpp b/src/plugins/bearer/connman/qconnmanengine.cpp index a8b8911..184ceb4 100644 --- a/src/plugins/bearer/connman/qconnmanengine.cpp +++ b/src/plugins/bearer/connman/qconnmanengine.cpp @@ -170,13 +170,26 @@ bool QConnmanEngine::hasIdentifier(const QString &id) void QConnmanEngine::connectToId(const QString &id) { QMutexLocker locker(&mutex); - QConnmanConnectThread *thread; - thread = new QConnmanConnectThread(this); - thread->setServicePath(serviceFromId(id)); - thread->setIdentifier(id); - connect(thread,SIGNAL(connectionError(QString,QBearerEngineImpl::ConnectionError)), - this,SIGNAL(connectionError(QString,QBearerEngineImpl::ConnectionError))); - thread->start(); + QString servicePath = serviceFromId(id); + QConnmanServiceInterface serv(servicePath); + if(!serv.isValid()) { + emit connectionError(id, QBearerEngineImpl::InterfaceLookupError); + } else { + if(serv.getType() != "cellular") { + + serv.connect(); + } else { + QOfonoManagerInterface ofonoManager(0); + QString modemPath = ofonoManager.currentModem().path(); + QOfonoDataConnectionManagerInterface dc(modemPath,0); + foreach(const QDBusObjectPath dcPath,dc.getPrimaryContexts()) { + if(dcPath.path().contains(servicePath.section("_",-1))) { + QOfonoPrimaryDataContextInterface primaryContext(dcPath.path(),0); + primaryContext.setActive(true); + } + } + } + } } void QConnmanEngine::disconnectFromId(const QString &id) @@ -791,62 +804,6 @@ bool QConnmanEngine::requiresPolling() const return false; } - -QConnmanConnectThread::QConnmanConnectThread(QObject *parent) - :QThread(parent), - servicePath(), identifier() -{ -} - -QConnmanConnectThread::~QConnmanConnectThread() -{ -} - -void QConnmanConnectThread::stop() -{ - if(currentThread() != this) { - QMetaObject::invokeMethod(this, "quit", - Qt::QueuedConnection); - } else { - quit(); - } - wait(); -} - -void QConnmanConnectThread::run() -{ - QConnmanServiceInterface serv(servicePath); - if(!serv.isValid()) { - emit connectionError(identifier, QBearerEngineImpl::InterfaceLookupError); - } else { - if(serv.getType() != "cellular") { - serv.connect(); - } else { - QOfonoManagerInterface ofonoManager(0); - QString modemPath = ofonoManager.currentModem().path(); - QOfonoDataConnectionManagerInterface dc(modemPath,0); - foreach(const QDBusObjectPath dcPath,dc.getPrimaryContexts()) { - if(dcPath.path().contains(servicePath.section("_",-1))) { - QOfonoPrimaryDataContextInterface primaryContext(dcPath.path(),0); - primaryContext.setActive(true); - } - } - } - } -} - -void QConnmanConnectThread::setServicePath(const QString &path) -{ - QMutexLocker locker(&mutex); - servicePath = path; -} - -void QConnmanConnectThread::setIdentifier(const QString &id) -{ - QMutexLocker locker(&mutex); - identifier = id; -} - QT_END_NAMESPACE #endif // QT_NO_DBUS diff --git a/src/plugins/bearer/connman/qconnmanengine.h b/src/plugins/bearer/connman/qconnmanengine.h index 569bbc7..2a2308f 100644 --- a/src/plugins/bearer/connman/qconnmanengine.h +++ b/src/plugins/bearer/connman/qconnmanengine.h @@ -59,14 +59,12 @@ #include <QMap> #include <QVariant> -#include <QtCore/qthread.h> #ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_DBUS QT_BEGIN_NAMESPACE -class QConnmanConnectThread; class QConnmanEngine : public QBearerEngineImpl { Q_OBJECT @@ -141,33 +139,8 @@ private: bool isRoamingAllowed(const QString &context); protected: bool requiresPolling() const; - QConnmanConnectThread *connThread; }; -class QConnmanConnectThread : public QThread -{ - Q_OBJECT - -public: - QConnmanConnectThread(QObject *parent = 0); - ~QConnmanConnectThread(); - bool keepRunning; - void stop(); - void setServicePath(const QString &path); - void setIdentifier(const QString &id); - -Q_SIGNALS: - void connectionError(const QString &id, QBearerEngineImpl::ConnectionError error); - -protected: - void run(); - QString servicePath; - QString identifier; - -private: - QMutex mutex; - -}; QT_END_NAMESPACE diff --git a/src/plugins/bearer/connman/qconnmanservice_linux.cpp b/src/plugins/bearer/connman/qconnmanservice_linux.cpp index 549a07a..952a444 100644 --- a/src/plugins/bearer/connman/qconnmanservice_linux.cpp +++ b/src/plugins/bearer/connman/qconnmanservice_linux.cpp @@ -106,7 +106,7 @@ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) { QObject::connect(helper,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)), - this,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &))); + this,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)), Qt::UniqueConnection); } } @@ -338,7 +338,7 @@ void QConnmanNetworkInterface::connectNotify(const char *signal) this->path(), QLatin1String(CONNMAN_NETWORK_INTERFACE), QLatin1String("PropertyChanged"), - this,SIGNAL(propertyChanged(QString,QDBusVariant))) ) { + this,SIGNAL(propertyChanged(QString,QDBusVariant)))) { qWarning() << "network properties not connected"; } } @@ -353,7 +353,7 @@ void QConnmanNetworkInterface::connectNotify(const char *signal) helper,SLOT(propertyChanged(QString,QDBusVariant))); QObject::connect(helper,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)), - this,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &))); + this,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)), Qt::UniqueConnection); } } @@ -538,7 +538,7 @@ void QConnmanServiceInterface::connectNotify(const char *signal) helper,SLOT(propertyChanged(QString,QDBusVariant))); QObject::connect(helper,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)), - this,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &))); + this,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)), Qt::UniqueConnection); } } @@ -569,10 +569,9 @@ QVariant QConnmanServiceInterface::getProperty(const QString &property) return var; } -// clearProperty void QConnmanServiceInterface::connect() { - QDBusReply<QVariantMap> reply = this->call(QLatin1String("Connect")); + this->asyncCall(QLatin1String("Connect")); } void QConnmanServiceInterface::disconnect() @@ -866,7 +865,7 @@ void QConnmanTechnologyInterface::connectNotify(const char *signal) helper,SLOT(propertyChanged(QString,QDBusVariant))); QObject::connect(helper,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)), - this,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &))); + this,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)), Qt::UniqueConnection); } } @@ -1031,7 +1030,7 @@ void QConnmanDeviceInterface::connectNotify(const char *signal) helper,SLOT(propertyChanged(QString,QDBusVariant))); QObject::connect(helper,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)), - this,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &))); + this,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)), Qt::UniqueConnection); } } diff --git a/src/plugins/bearer/connman/qofonoservice_linux.cpp b/src/plugins/bearer/connman/qofonoservice_linux.cpp index 955f4b1..52f596b 100644 --- a/src/plugins/bearer/connman/qofonoservice_linux.cpp +++ b/src/plugins/bearer/connman/qofonoservice_linux.cpp @@ -262,7 +262,7 @@ void QOfonoModemInterface::connectNotify(const char *signal) QObject::connect(helper,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)), - this,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &))); + this,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)), Qt::UniqueConnection); }} void QOfonoModemInterface::disconnectNotify(const char *signal) @@ -385,7 +385,7 @@ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) { QObject::connect(helper,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)), - this,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &))); + this,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)), Qt::UniqueConnection); } } @@ -483,7 +483,7 @@ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) { QObject::connect(helper,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)), - this,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &))); + this,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)), Qt::UniqueConnection); } } @@ -586,7 +586,7 @@ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) { QObject::connect(helper,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)), - this,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &))); + this,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)), Qt::UniqueConnection); } } @@ -675,7 +675,7 @@ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) { QObject::connect(helper,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)), - this,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &))); + this,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)), Qt::UniqueConnection); } } @@ -794,7 +794,7 @@ if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) { QObject::connect(helper,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)), - this,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &))); + this,SIGNAL(propertyChangedContext(const QString &,const QString &,const QDBusVariant &)), Qt::UniqueConnection); } } diff --git a/src/plugins/bearer/icd/maemo_icd.cpp b/src/plugins/bearer/icd/maemo_icd.cpp index 4f879e3..57ab0a8 100644 --- a/src/plugins/bearer/icd/maemo_icd.cpp +++ b/src/plugins/bearer/icd/maemo_icd.cpp @@ -508,6 +508,7 @@ uint IcdPrivate::state(QList<IcdStateResult>& state_results) mInterface.clear(); while ((time(0)<=(started+timeout_secs)) && mInterface.isEmpty()) { mDBus->synchronousDispatch(1000); + QCoreApplication::sendPostedEvents(icd, QEvent::MetaCall); } if (time(0)>(started+timeout_secs)) { @@ -685,6 +686,7 @@ uint IcdPrivate::addrinfo(QList<IcdAddressInfoResult>& addr_results) mInterface.clear(); while ((time(0)<=(started+timeout_secs)) && mInterface.isEmpty()) { mDBus->synchronousDispatch(1000); + QCoreApplication::sendPostedEvents(icd, QEvent::MetaCall); } if (time(0)>(started+timeout_secs)) { diff --git a/src/plugins/bearer/icd/qnetworksession_impl.cpp b/src/plugins/bearer/icd/qnetworksession_impl.cpp index 37434e3..8d0f587 100644 --- a/src/plugins/bearer/icd/qnetworksession_impl.cpp +++ b/src/plugins/bearer/icd/qnetworksession_impl.cpp @@ -679,7 +679,7 @@ void QNetworkSessionPrivateImpl::open() if (serviceConfig.isValid()) { lastError = QNetworkSession::OperationNotSupportedError; emit QNetworkSessionPrivate::error(lastError); - } else if (!isOpen) { + } else if (!opened) { if (publicConfig.type() == QNetworkConfiguration::UserChoice) { /* Caller is trying to connect to default IAP. * At this time we will not know the IAP details so we just diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.cpp b/src/plugins/bearer/symbian/qnetworksession_impl.cpp index 7f81397..85723ce 100644 --- a/src/plugins/bearer/symbian/qnetworksession_impl.cpp +++ b/src/plugins/bearer/symbian/qnetworksession_impl.cpp @@ -760,7 +760,7 @@ void QNetworkSessionPrivateImpl::Error(TInt /*aError*/) { #ifdef QT_BEARERMGMT_SYMBIAN_DEBUG qDebug() << "QNS this : " << QString::number((uint)this) << " - " - << "roaming Error() occured, isOpen is: " << isOpen; + << "roaming Error() occurred, isOpen is: " << isOpen; #endif if (isOpen) { isOpen = false; diff --git a/src/plugins/bearer/symbian/symbian.pri b/src/plugins/bearer/symbian/symbian.pri index e874945..8d92f57 100644 --- a/src/plugins/bearer/symbian/symbian.pri +++ b/src/plugins/bearer/symbian/symbian.pri @@ -1,7 +1,7 @@ TARGET = qsymbianbearer include(../../qpluginbase.pri) -QT += network +QT = core network HEADERS += ../symbianengine.h \ ../qnetworksession_impl.h diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp index ef273c1..b4dfc4d 100644 --- a/src/plugins/bearer/symbian/symbianengine.cpp +++ b/src/plugins/bearer/symbian/symbianengine.cpp @@ -976,7 +976,7 @@ void SymbianEngine::RunL() QMutexLocker locker(&mutex); if (iStatus != KErrCancel) { - // By default, start relistening notifications. Stop only if interesting event occured. + // By default, start relistening notifications. Stop only if interesting event occurred. iWaitingCommsDatabaseNotifications = true; RDbNotifier::TEvent event = STATIC_CAST(RDbNotifier::TEvent, iStatus.Int()); switch (event) { |