示例#1
0
NetworkManager::WirelessNetworkPrivate::WirelessNetworkPrivate(WirelessNetwork *q, WirelessDevice *device)
    : q_ptr(q)
    , wirelessNetworkInterface(device)
{
    QObject::connect(device, SIGNAL(accessPointAppeared(QString)),
                     q, SLOT(accessPointAppeared(QString)));
    QObject::connect(device, SIGNAL(accessPointDisappeared(QString)),
                     q, SLOT(accessPointDisappeared(QString)));
}
void Solid::Control::WirelessNetworkInterfaceNm09::makeConnections(QObject * source)
{
    connect(source, SIGNAL(accessPointAppeared(QString)),
            this, SLOT(_k_accessPointAdded(QString)));
    connect(source, SIGNAL(accessPointDisappeared(QString)),
            this, SLOT(_k_accessPointRemoved(QString)));
    connect(source, SIGNAL(bitRateChanged(int)),
            this, SIGNAL(bitRateChanged(int)));
    connect(source, SIGNAL(activeAccessPointChanged(QString)),
            this, SIGNAL(activeAccessPointChanged(QString)));
    connect(source, SIGNAL(modeChanged(Solid::Control::WirelessNetworkInterfaceNm09::OperationMode)),
            this, SIGNAL(modeChanged(Solid::Control::WirelessNetworkInterfaceNm09::OperationMode)));
}
void Solid::Control::WirelessNetworkInterfaceNm09::_k_accessPointAdded(const QString & uni)
{
    Q_D(WirelessNetworkInterfaceNm09);
    AccessPointNm09Map::Iterator mapIt = d->apMap.find(uni);

    if (mapIt != d->apMap.end())
    {
        // Oops, I'm not sure it should happen...
        // But for an unknown reason it does
        // We were deleting the existing items here, which caused problems later
        // when the client calls find AccessPoint and gets a frontend object with a
        // null private object - dangling pointer
    } else {
        mapIt = d->apMap.insert(uni, AccessPointNm09Pair(0, 0));
    }

    emit accessPointAppeared(uni);
}