예제 #1
0
void NetworkService::propertyChanged(const QString &name, const QDBusVariant &value)
{
    qDebug() << "NetworkService: property " << name << " changed to " << value.variant();
    m_propertiesCache[name] = value.variant();

    if (name == Name) {
        emit nameChanged(m_propertiesCache[name].toString());
    } else if (name == State) {
        emit stateChanged(m_propertiesCache[name].toString());
    } else if (name == Security) {
        emit securityChanged(m_propertiesCache[name].toStringList());
    } else if (name == Strength) {
        emit strengthChanged(m_propertiesCache[name].toUInt());
    } else if (name == Favorite) {
        emit favoriteChanged(m_propertiesCache[name].toBool());
    } else if (name == IPv4) {
        emit ipv4Changed(qdbus_cast<QVariantMap>(m_propertiesCache.value(IPv4)));
    } else if (name == IPv4Config) {
        emit ipv4ConfigChanged(qdbus_cast<QVariantMap>(m_propertiesCache.value(IPv4Config)));
    } else if (name == Nameservers) {
        emit nameserversChanged(m_propertiesCache[name].toStringList());
    } else if (name == NameserversConfig) {
        emit nameserversConfigChanged(m_propertiesCache[name].toStringList());
    } else if (name == Domains) {
        emit domainsChanged(m_propertiesCache[name].toStringList());
    } else if (name == DomainsConfig) {
        emit domainsConfigChanged(m_propertiesCache[name].toStringList());
    } else if (name == Proxy) {
        emit proxyChanged(qdbus_cast<QVariantMap>(m_propertiesCache.value(Proxy)));
    } else if (name == ProxyConfig) {
        emit proxyConfigChanged(qdbus_cast<QVariantMap>(m_propertiesCache.value(ProxyConfig)));
    }
}
예제 #2
0
void NetworkService::propertyChanged(const QString &name, const QDBusVariant &value)
{
    QVariant tmp = value.variant();

    Q_ASSERT(m_service);

    pr_dbg() << m_service->path() << "property" << name << "changed from"
             << m_propertiesCache[name].toString() << "to" << tmp.toString();

    m_propertiesCache[name] = tmp;

    if (name == Name) {
        emit nameChanged(tmp.toString());
    } else if (name == State) {
        emit stateChanged(tmp.toString());
    } else if (name == Security) {
        emit securityChanged(tmp.toStringList());
    } else if (name == Strength) {
        emit strengthChanged(tmp.toUInt());
    } else if (name == Favorite) {
        emit favoriteChanged(tmp.toBool());
    } else if (name == IPv4) {
        emit ipv4Changed(qdbus_cast<QVariantMap>(m_propertiesCache.value(IPv4)));
    } else if (name == IPv4Config) {
        emit ipv4ConfigChanged(qdbus_cast<QVariantMap>(m_propertiesCache.value(IPv4Config)));
    } else if (name == IPv6) {
        emit ipv6Changed(qdbus_cast<QVariantMap>(m_propertiesCache.value(IPv6)));
    } else if (name == IPv6Config) {
        emit ipv6ConfigChanged(qdbus_cast<QVariantMap>(m_propertiesCache.value(IPv6Config)));
    } else if (name == Nameservers) {
        emit nameserversChanged(tmp.toStringList());
    } else if (name == NameserversConfig) {
        emit nameserversConfigChanged(tmp.toStringList());
    } else if (name == Domains) {
        emit domainsChanged(tmp.toStringList());
    } else if (name == DomainsConfig) {
        emit domainsConfigChanged(tmp.toStringList());
    } else if (name == Proxy) {
        emit proxyChanged(qdbus_cast<QVariantMap>(m_propertiesCache.value(Proxy)));
    } else if (name == ProxyConfig) {
        emit proxyConfigChanged(qdbus_cast<QVariantMap>(m_propertiesCache.value(ProxyConfig)));
    } else if (name == Ethernet) {
        emit ethernetChanged(qdbus_cast<QVariantMap>(m_propertiesCache.value(Ethernet)));
    }
}