From 2234a6f1926d8a7480444b1c6b61610530f6f772 Mon Sep 17 00:00:00 2001 From: Lorn Potter Date: Wed, 4 Aug 2010 06:00:03 +1000 Subject: new icons for cell and bt networks. --- examples/network/bearercloud/bluetooth.svg | 24 ++++ examples/network/bearercloud/cell.svg | 25 ++++ examples/network/bearercloud/cloud.cpp | 11 ++ examples/network/bearercloud/gprs.svg | 199 +++++++++++++++++++++++++ examples/network/bearercloud/icons.qrc | 4 + examples/network/bearercloud/lan.svg | 109 +++++--------- examples/network/bearercloud/umts.svg | 200 ++++++++++++++++++++++++++ src/plugins/bearer/connman/qconnmanengine.cpp | 53 ++++--- 8 files changed, 529 insertions(+), 96 deletions(-) create mode 100644 examples/network/bearercloud/bluetooth.svg create mode 100644 examples/network/bearercloud/cell.svg create mode 100644 examples/network/bearercloud/gprs.svg mode change 100644 => 100755 examples/network/bearercloud/lan.svg create mode 100644 examples/network/bearercloud/umts.svg diff --git a/examples/network/bearercloud/bluetooth.svg b/examples/network/bearercloud/bluetooth.svg new file mode 100644 index 0000000..7ded90a --- /dev/null +++ b/examples/network/bearercloud/bluetooth.svg @@ -0,0 +1,24 @@ + + + + +]> + + + + + + + + + + + + + + diff --git a/examples/network/bearercloud/cell.svg b/examples/network/bearercloud/cell.svg new file mode 100644 index 0000000..d4ca57b --- /dev/null +++ b/examples/network/bearercloud/cell.svg @@ -0,0 +1,25 @@ + + + + +]> + + + + + + + + + + + + + + + + + + diff --git a/examples/network/bearercloud/cloud.cpp b/examples/network/bearercloud/cloud.cpp index 8deaab3..6019d9b 100644 --- a/examples/network/bearercloud/cloud.cpp +++ b/examples/network/bearercloud/cloud.cpp @@ -323,6 +323,17 @@ void Cloud::newConfigurationActivated() case QNetworkConfiguration::BearerEthernet: renderer = new QSvgRenderer(QLatin1String(":lan.svg")); break; + case QNetworkConfiguration::Bearer2G: + renderer = new QSvgRenderer(QLatin1String(":cell.svg")); + break; + case QNetworkConfiguration::BearerBluetooth: + renderer = new QSvgRenderer(QLatin1String(":bluetooth.svg")); + break; + case QNetworkConfiguration::BearerCDMA2000: + case QNetworkConfiguration::BearerWCDMA: + case QNetworkConfiguration::BearerHSPA: + renderer = new QSvgRenderer(QLatin1String(":umts.svg")); + break; default: renderer = new QSvgRenderer(QLatin1String(":unknown.svg")); } diff --git a/examples/network/bearercloud/gprs.svg b/examples/network/bearercloud/gprs.svg new file mode 100644 index 0000000..4a992c1 --- /dev/null +++ b/examples/network/bearercloud/gprs.svg @@ -0,0 +1,199 @@ + + +image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/network/bearercloud/icons.qrc b/examples/network/bearercloud/icons.qrc index 84a8939..7dea1f2 100644 --- a/examples/network/bearercloud/icons.qrc +++ b/examples/network/bearercloud/icons.qrc @@ -3,5 +3,9 @@ wlan.svg lan.svg unknown.svg + bluetooth.svg + cell.svg + gprs.svg + umts.svg diff --git a/examples/network/bearercloud/lan.svg b/examples/network/bearercloud/lan.svg old mode 100644 new mode 100755 index 3cce805..b8ee999 --- a/examples/network/bearercloud/lan.svg +++ b/examples/network/bearercloud/lan.svg @@ -1,76 +1,33 @@ - - - - - - - - - - - image/svg+xml - - - - - - LAN - - + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/network/bearercloud/umts.svg b/examples/network/bearercloud/umts.svg new file mode 100644 index 0000000..c1b372e --- /dev/null +++ b/examples/network/bearercloud/umts.svg @@ -0,0 +1,200 @@ + + +image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/plugins/bearer/connman/qconnmanengine.cpp b/src/plugins/bearer/connman/qconnmanengine.cpp index ed5c3c6..a1e7d37 100644 --- a/src/plugins/bearer/connman/qconnmanengine.cpp +++ b/src/plugins/bearer/connman/qconnmanengine.cpp @@ -149,7 +149,6 @@ void QConnmanEngine::getNetworkListing() } - void QConnmanEngine::doRequestUpdate() { connmanManager->requestScan(""); @@ -312,6 +311,9 @@ QString QConnmanEngine::getServiceForNetwork(const QString &netPath) QMutexLocker locker(&mutex); QConnmanNetworkInterface network(netPath, this); foreach(QString service,connmanManager->getServices()) { + + QString devicePath = netPath.section("/",5,5); + QConnmanServiceInterface serv(service,this); if(serv.getName() == network.getName() && network.getSignalStrength() == serv.getSignalStrength()) { @@ -354,17 +356,6 @@ void QConnmanEngine::propertyChangedContext(const QString &path,const QString &i technologies.insert(listPath, tech); } } - - foreach(const QString old, oldtech.keys()) { - if(!newlist.contains(old)) { - QConnmanTechnologyInterface *tech = oldtech.value(old); - disconnect(tech,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), - this,SLOT(technologyPropertyChangedContext(QString,QString,QDBusVariant))); - - technologies.remove(old); - getNetworkListing(); - } - } } } if(item == "State") { @@ -385,15 +376,21 @@ void QConnmanEngine::servicePropertyChangedContext(const QString &path,const QSt } } -void QConnmanEngine::networkPropertyChangedContext(const QString &/*path*/,const QString &/*item*/, const QDBusVariant &/*value*/) +void QConnmanEngine::networkPropertyChangedContext(const QString &path,const QString &item, const QDBusVariant &value) { QMutexLocker locker(&mutex); +// qDebug() << __FUNCTION__ << path << item << value.variant(); } void QConnmanEngine::devicePropertyChangedContext(const QString &devpath,const QString &item,const QDBusVariant &value) { +// qDebug() << __FUNCTION__ << devpath << item << value.variant(); QMutexLocker locker(&mutex); if(item == "Networks") { + + QConnmanNetworkInterface network(devpath, this); + + QDBusArgument arg = qvariant_cast(value.variant()); QStringList remainingNetworks = qdbus_cast(arg); QString devicetype; @@ -431,6 +428,7 @@ void QConnmanEngine::devicePropertyChangedContext(const QString &devpath,const Q void QConnmanEngine::technologyPropertyChangedContext(const QString & path, const QString &item, const QDBusVariant &value) { +// qDebug() << __FUNCTION__ << path << item << value.variant(); if(item == "Devices") { QDBusArgument arg = qvariant_cast(value.variant()); QStringList list = qdbus_cast(arg); @@ -452,6 +450,12 @@ void QConnmanEngine::technologyPropertyChangedContext(const QString & path, cons } if(value.variant().toString() == "offline") { deviceMap.remove(path); + QConnmanTechnologyInterface tech(path); + disconnect(&tech,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), + this,SLOT(technologyPropertyChangedContext(QString,QString,QDBusVariant))); + + technologies.remove(path); + getNetworkListing(); } } } @@ -523,7 +527,7 @@ QNetworkConfiguration::BearerType QConnmanEngine::typeToBearer(const QString &ty if (type == "bluetooth") return QNetworkConfiguration::BearerBluetooth; if (type == "cellular") { - return QNetworkConfiguration::BearerUnknown; + return QNetworkConfiguration::Bearer2G; // not handled: CDMA2000 HSPA } if (type == "wimax") @@ -646,6 +650,9 @@ void QConnmanEngine::addNetworkConfiguration(const QString &networkPath) { QMutexLocker locker(&mutex); + if(networkPath.isNull()) + return; + QConnmanNetworkInterface *network; network = new QConnmanNetworkInterface(networkPath, this); QString servicePath = getServiceForNetwork(networkPath); @@ -661,9 +668,10 @@ void QConnmanEngine::addNetworkConfiguration(const QString &networkPath) serv = new QConnmanServiceInterface(servicePath,this); connect(serv,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), this,SLOT(servicePropertyChangedContext(QString,QString, QDBusVariant))); + } - if (!accessPointConfigurations.contains(id)) { + if (!id.isEmpty() && !accessPointConfigurations.contains(id)) { knownNetworks[device.getType()].append(networkPath); @@ -684,22 +692,25 @@ void QConnmanEngine::addNetworkConfiguration(const QString &networkPath) if(servicePath.isEmpty()) { QString devicePath = networkPath.section("/",0,5); + QConnmanDeviceInterface device(devicePath,this); bearerType = typeToBearer(device.getType()); } else { bearerType = typeToBearer(serv->getType()); } - if (bearerType == QNetworkConfiguration::BearerUnknown) { + if (bearerType == QNetworkConfiguration::Bearer2G) { QString mode = serv->getMode(); if (mode == "gprs" || mode == "edge") { bearerType = QNetworkConfiguration::Bearer2G; } else if (mode == "umts") { bearerType = QNetworkConfiguration::BearerWCDMA; } - networkName = serv->getAPN(); - if(networkName.isEmpty()) { - networkName = serv->getName(); + if(servicePath.isEmpty()) { + networkName = serv->getAPN(); + if(networkName.isEmpty()) { + networkName = serv->getName(); + } } } @@ -729,7 +740,9 @@ void QConnmanEngine::addNetworkConfiguration(const QString &networkPath) emit configurationAdded(ptr); locker.relock(); emit updateCompleted(); - } + } /*else { + qDebug() << "Not added~~~~~~~~~~~"; + }*/ } bool QConnmanEngine::requiresPolling() const -- cgit v0.12