void NetworkTechnology::init(const QString &path) { m_path = path; 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); if (!m_technology->isValid()) { pr_dbg() << "Invalid technology: " << path; throw -1; // FIXME } if (m_propertiesCache.isEmpty()) { QDBusReply<QVariantMap> reply; reply = m_technology->GetProperties(); m_propertiesCache = reply.value(); } emit poweredChanged(powered()); emit connectedChanged(connected()); connect(m_technology, SIGNAL(PropertyChanged(const QString&, const QDBusVariant&)), this, SLOT(propertyChanged(const QString&, const QDBusVariant&))); }
int BluetoothDevicesModel::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QAbstractListModel::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 27) qt_static_metacall(this, _c, _id, _a); _id -= 27; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< bool*>(_v) = powered(); break; case 1: *reinterpret_cast< bool*>(_v) = discoverable(); break; case 2: *reinterpret_cast< int*>(_v) = discoverableTimeout(); break; case 3: *reinterpret_cast< bool*>(_v) = adapterPresent(); break; case 4: *reinterpret_cast< bool*>(_v) = connected(); break; } _id -= 5; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: makePowered(*reinterpret_cast< bool*>(_v)); break; case 1: makeDiscoverable(*reinterpret_cast< bool*>(_v)); break; case 2: setDiscoverableTimeout(*reinterpret_cast< int*>(_v)); break; } _id -= 5; } else if (_c == QMetaObject::ResetProperty) { _id -= 5; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 5; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 5; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 5; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 5; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 5; } #endif // QT_NO_PROPERTIES return _id; }