I have made the following changes intended for : CE:MW:Shared / connman-qt
Please review and accept or decline. BOSS has already run some checks on this request. See the "Messages from BOSS" section below. https://build.pub.meego.com//request/show/8213 Thank You, rojkov [This message was auto-generated] --- Request # 8213: Messages from BOSS: State: review at 2013-03-01T10:20:45 by bossbot Reviews: accepted by bossbot : Prechecks succeeded. new for CE-maintainers : Please replace this text with a review and approve/reject the review (not the SR). BOSS will take care of the rest Changes: submit: home:rojkov:branches:CE:MW:Shared / connman-qt -> CE:MW:Shared / connman-qt changes files: -------------- --- connman-qt.changes +++ connman-qt.changes @@ -0,0 +1,6 @@ +* Fri Mar 01 2013 Dmitry Rozhkov <[email protected]> - 1.0.0 +- bumped version to 1.0.0 +- networkmanager: delete service and technology objects upon connman's death +- technologymodel: update service list upon start +- optimizations in init code + old: ---- 0001-useragent-pass-requested-fields-as-map-instead-of-li.patch connman-qt-0.4.3.2.tar.bz2 new: ---- connman-qt-1.0.0.tar.bz2 spec files: ----------- --- connman-qt.spec +++ connman-qt.spec @@ -9,14 +9,13 @@ # << macros Summary: qt bindings for connman -Version: 0.4.3.2 +Version: 1.0.0 Release: 1 Group: System/GUI/Other License: Apache License URL: https://github.com/nemomobile/libconnman-qt.git Source0: %{name}-%{version}.tar.bz2 Source100: connman-qt.yaml -Patch0: 0001-useragent-pass-requested-fields-as-map-instead-of-li.patch Requires: connman >= 1.10 Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig @@ -67,8 +66,6 @@ %prep %setup -q -n %{name}-%{version} -# 0001-useragent-pass-requested-fields-as-map-instead-of-li.patch -%patch0 -p1 # >> setup # << setup other changes: -------------- ++++++ connman-qt-0.4.3.2.tar.bz2 -> connman-qt-1.0.0.tar.bz2 --- libconnman-qt/networkmanager.cpp +++ libconnman-qt/networkmanager.cpp @@ -102,7 +102,19 @@ delete m_manager; m_manager = NULL; } - // FIXME: should we delete technologies and services? + + foreach (QString skey, m_servicesCache.keys()) { + m_servicesCache.value(skey)->deleteLater(); + m_servicesCache.remove(skey); + } + m_servicesOrder.clear(); + emit servicesChanged(); + + foreach (QString tkey, m_technologiesCache.keys()) { + m_technologiesCache.value(tkey)->deleteLater(); + m_technologiesCache.remove(tkey); + } + emit technologiesChanged(); } @@ -189,8 +201,13 @@ foreach (QDBusObjectPath obj, removed) { Q_EMIT serviceRemoved(obj.path()); - m_servicesCache.value(obj.path())->deleteLater(); - m_servicesCache.remove(obj.path()); + if (m_servicesCache.contains(obj.path())) { + m_servicesCache.value(obj.path())->deleteLater(); + m_servicesCache.remove(obj.path()); + } else { + // connman maintains a virtual "hidden" wifi network and removes it upon init + pr_dbg() << "attempted to remove non-existing service"; + } } ConnmanObject connmanobj; --- libconnman-qt/networkmanager.h +++ libconnman-qt/networkmanager.h @@ -38,6 +38,7 @@ Q_PROPERTY(NetworkService* defaultRoute READ defaultRoute NOTIFY defaultRouteChanged) Q_PROPERTY(bool sessionMode READ sessionMode WRITE setSessionMode NOTIFY sessionModeChanged) + Q_PROPERTY(QString serviceAdded NOTIFY serviceAdded) public: NetworkManager(QObject* parent=0); --- libconnman-qt/networkservice.cpp +++ libconnman-qt/networkservice.cpp @@ -60,8 +60,8 @@ m_path(QString()) { Q_ASSERT(!path.isEmpty()); - setPath(path); m_propertiesCache = properties; + setPath(path); } NetworkService::NetworkService(QObject* parent) @@ -289,6 +289,8 @@ if (m_service) { delete m_service; m_service = 0; + // TODO: After resetting the path iterate through old properties, compare their values + // with new ones and emit corresponding signals if changed. m_propertiesCache.clear(); } m_service = new Service("net.connman", m_path, QDBusConnection::systemBus(), this); @@ -297,11 +299,14 @@ pr_dbg() << "Invalid service: " << m_path; return; } - QDBusPendingReply<QVariantMap> reply = m_service->GetProperties(); - if (reply.isError()) { - qDebug() << Q_FUNC_INFO << reply.error().message(); - } else { - m_propertiesCache = reply.value(); + + if (m_propertiesCache.isEmpty()) { + QDBusPendingReply<QVariantMap> reply = m_service->GetProperties(); + if (reply.isError()) { + qDebug() << Q_FUNC_INFO << reply.error().message(); + } else { + m_propertiesCache = reply.value(); + } } connect(m_service, SIGNAL(PropertyChanged(QString,QDBusVariant)), --- libconnman-qt/networktechnology.cpp +++ libconnman-qt/networktechnology.cpp @@ -47,6 +47,9 @@ if (m_technology) { delete m_technology; m_technology = 0; + // TODO: After resetting the path iterate through old properties, compare their values + // with new ones and emit corresponding signals if changed. + m_propertiesCache.clear(); } m_technology = new Technology("net.connman", path, QDBusConnection::systemBus(), this); @@ -55,11 +58,11 @@ throw -1; // FIXME } -// if (m_propertiesCache.isEmpty()) { + if (m_propertiesCache.isEmpty()) { QDBusReply<QVariantMap> reply; reply = m_technology->GetProperties(); m_propertiesCache = reply.value(); -// } + } connect(m_technology, SIGNAL(PropertyChanged(const QString&, const QDBusVariant&)), --- libconnman-qt/useragent.cpp +++ libconnman-qt/useragent.cpp @@ -35,17 +35,7 @@ void UserAgent::requestUserInput(ServiceRequestData* data) { m_req_data = data; - QVariantList fields; - - foreach (const QString &key, data->fields.keys()) { - QVariantMap field; - - field.insert("name", key); - field.insert("type", data->fields.value(key).toMap().value("Type")); - fields.append(QVariant(field)); - } - - emit userInputRequested(data->objectPath, fields); + emit userInputRequested(data->objectPath, data->fields); } void UserAgent::cancelUserInput() --- libconnman-qt/useragent.h +++ libconnman-qt/useragent.h @@ -52,7 +52,7 @@ void setAgentPath(QString &path); signals: - void userInputRequested(const QString &servicePath, const QVariantList &fields); + void userInputRequested(const QString &servicePath, const QVariantMap &fields); void userInputCanceled(); void errorReported(const QString &error); --- plugin/technologymodel.cpp +++ plugin/technologymodel.cpp @@ -22,25 +22,25 @@ SLOT(finishedScan())); +#define DISCONNECT_TECHNOLOGY_SIGNALS(tech) \ + disconnect(tech, SIGNAL(poweredChanged(bool)), \ + this, SLOT(changedPower(bool))); \ + disconnect(tech, SIGNAL(scanFinished()), \ + this, SLOT(finishedScan())) + + TechnologyModel::TechnologyModel(QAbstractListModel* parent) : QAbstractListModel(parent), m_manager(NULL), - m_tech(NULL) + m_tech(NULL), + m_techname(QString()) { m_manager = NetworkManagerFactory::createInstance(); - // set default value of the "name" property - m_techname = QString("wifi"); - QHash<int, QByteArray> roles; roles[ServiceRole] = "networkService"; setRoleNames(roles); - m_tech = m_manager->getTechnology(m_techname); - if (m_tech) { - CONNECT_TECHNOLOGY_SIGNALS(m_tech); - } - connect(m_manager, SIGNAL(availabilityChanged(bool)), this, SLOT(managerAvailabilityChanged(bool))); @@ -121,10 +121,7 @@ if (m_tech) { oldPowered = m_tech->powered(); - disconnect(m_tech, SIGNAL(poweredChanged(bool)), - this, SLOT(changedPower(bool))); - disconnect(m_tech, SIGNAL(scanFinished()), - this, SLOT(finishedScan())); + DISCONNECT_TECHNOLOGY_SIGNALS(m_tech); } m_tech = m_manager->getTechnology(name); @@ -138,6 +135,7 @@ emit poweredChanged(!oldPowered); } CONNECT_TECHNOLOGY_SIGNALS(m_tech); + updateServiceList(); } } @@ -155,6 +153,7 @@ if ((test = m_manager->getTechnology(m_techname)) == NULL) { // if wifi is set and manager doesn't return a wifi, it means // that wifi was removed + DISCONNECT_TECHNOLOGY_SIGNALS(m_tech); m_tech = NULL; Q_EMIT technologiesChanged(); } @@ -163,7 +162,6 @@ // if wifi is not set and manager returns a wifi, it means // that wifi was added m_tech = test; - CONNECT_TECHNOLOGY_SIGNALS(m_tech); emit technologiesChanged(); } ++++++ connman-qt.yaml --- connman-qt.yaml +++ connman-qt.yaml @@ -1,14 +1,12 @@ Name: connman-qt Summary: qt bindings for connman -Version: 0.4.3.2 +Version: 1.0.0 Release: 1 Group: System/GUI/Other License: Apache License -URL: https://github.com/nemomobile/libconnman-qt.git +URL: https://github.com/nemomobile/libconnman-qt.git Sources: - "%{name}-%{version}.tar.bz2" -Patches: - - 0001-useragent-pass-requested-fields-as-map-instead-of-li.patch Description: | This is a library for working with connman using Qt ++++++ deleted files: --- 0001-useragent-pass-requested-fields-as-map-instead-of-li.patch
