Exemplo n.º 1
0
bool Netctl::updateSourceEvent(const QString &source)
{
    if (debug) qDebug() << PDEBUG;
    if (debug) qDebug() << PDEBUG << ":" << "Source name" << source;

    QString value = QString("N\\A");
    if (source == QString("active")) {
        value = getStatus(configuration[QString("NETCTLCMD")],
                          configuration[QString("NETCTLAUTOCMD")]);
    } else if (source == QString("current")) {
        value = getCurrentProfile(configuration[QString("NETCTLCMD")],
                                  configuration[QString("NETCTLAUTOCMD")])
                .join(QChar('|'));
        current = value;
    } else if (source == QString("extip4")) {
        if (configuration[QString("EXTIP4")] == QString("true"))
            value = getExtIp(configuration[QString("EXTIP4CMD")]);
    } else if (source == QString("extip6")) {
        if (configuration[QString("EXTIP6")] == QString("true"))
            value = getExtIp(configuration[QString("EXTIP6CMD")]);
    } else if (source == QString("info")) {
        value = getInfo();
    } else if (source == QString("interfaces")) {
        value = getInterfaceList().join(QChar(','));
    } else if (source == QString("intip4")) {
        value = getIntIp(QAbstractSocket::IPv4Protocol);
    } else if (source == QString("intip6")) {
        value = getIntIp(QAbstractSocket::IPv6Protocol);
    } else if (source == QString("netctlauto")) {
        value = getNetctlAutoStatus(configuration[QString("NETCTLAUTOCMD")]);
    } else if (source == QString("profiles")) {
        value = getProfileList(configuration[QString("NETCTLCMD")],
                               configuration[QString("NETCTLAUTOCMD")])
                .join(QChar(','));
    } else if (source == QString("status")) {
        value = getProfileStringStatus(configuration[QString("NETCTLCMD")],
                                       configuration[QString("NETCTLAUTOCMD")])
                .join(QChar('|'));
        status = value;
    }
    setData(source, QString("value"), value);

    return true;
}
Exemplo n.º 2
0
bool Netctl::updateSourceEvent(const QString &source)
{
    if (debug) qDebug() << "[DE]" << "[updateSourceEvent]";
    if (debug) qDebug() << "[DE]" << "[updateSourceEvent]" << ":" << "Source name" << source;

    QString key = QString("value");
    QString value = QString("");
    if (source == QString("currentProfile")) {
        value = getCurrentProfile(configuration[QString("NETCTLAUTOCMD")]);
        if (value.isEmpty())
            value = getCurrentProfile(configuration[QString("CMD")]);
    }
    else if (source == QString("extIp")) {
        if (configuration[QString("EXTIP")] == QString("true"))
            value = getExtIp(configuration[QString("EXTIPCMD")]);
    }
    else if (source == QString("interfaces")) {
        value = getInterfaceList(configuration[QString("NETDIR")]).join(QChar(','));
    }
    else if (source == QString("intIp")) {
        value = getIntIp(configuration[QString("IPCMD")], configuration[QString("NETDIR")]);
    }
    else if (source == QString("profiles")) {
        value = getProfileList(configuration[QString("NETCTLAUTOCMD")]).join(QChar(','));
        if (value.isEmpty())
            value = getProfileList(configuration[QString("CMD")]).join(QChar(','));
    }
    else if (source == QString("statusBool")) {
        if (getProfileStatus(configuration[QString("NETCTLAUTOCMD")]))
            value = QString("true");
        else if (getProfileStatus(configuration[QString("CMD")]))
            value = QString("true");
        else
            value = QString("false");
    }
    else if (source == QString("statusString")) {
        value = getProfileStringStatus(configuration[QString("CMD")],
                configuration[QString("NETCTLAUTOCMD")]);
    }
    setData(source, key, value);

    return true;
}