Пример #1
0
void QNmDBusHelper::deviceStateChanged(quint32 state)
 {
    QDBusMessage msg = this->message();
    if(state == NM_DEVICE_STATE_ACTIVATED
       || state == NM_DEVICE_STATE_DISCONNECTED
       || state == NM_DEVICE_STATE_UNAVAILABLE
       || state == NM_DEVICE_STATE_FAILED) {
        emit pathForStateChanged(msg.path(), state);
    }
 }
Пример #2
0
bool QNetworkManagerInterfaceDevice::setConnections()
{
    if(!isValid() )
        return false;

    bool allOk = false;
    delete nmDBusHelper;
    nmDBusHelper = new QNmDBusHelper(this);
    connect(nmDBusHelper,SIGNAL(pathForStateChanged(QString,quint32)),
            this, SIGNAL(stateChanged(QString,quint32)));
    if(nmConnection.connect(QLatin1String(NM_DBUS_SERVICE),
                            d->path,
                            QLatin1String(NM_DBUS_INTERFACE_DEVICE),
                            QLatin1String("StateChanged"),
                            nmDBusHelper,SLOT(deviceStateChanged(quint32)))) {
        allOk = true;
    }
    return allOk;
}
Пример #3
0
QNetworkManagerInterface::QNetworkManagerInterface(QObject *parent)
        : QObject(parent)
{
    d = new QNetworkManagerInterfacePrivate();
    d->connectionInterface = new QDBusInterface(QLatin1String(NM_DBUS_SERVICE),
                                                QLatin1String(NM_DBUS_PATH),
                                                QLatin1String(NM_DBUS_INTERFACE),
                                                nmConnection);
    if (!d->connectionInterface->isValid()) {
        d->valid = false;
        return;
    }
    d->valid = true;
    nmDBusHelper = new QNmDBusHelper(this);
    connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(QString,QMap<QString,QVariant>)),
                    this,SIGNAL(propertiesChanged(QString,QMap<QString,QVariant>)));
    connect(nmDBusHelper,SIGNAL(pathForStateChanged(QString,quint32)),
            this, SIGNAL(stateChanged(QString,quint32)));

}