Esempio n. 1
0
    Contact::Contact(Tp::ContactPtr tp_contact): tp_contact_(tp_contact)
    {
        if (tp_contact.isNull())
            return;
        id_ = tp_contact->id();
        name_ = tp_contact->alias();
        QString avatar = tp_contact->avatarToken();  // todo: use this information

        connect(tp_contact_.data(),
                SIGNAL( simplePresenceChanged(const QString &, uint, const QString &) ),
                SLOT( OnSimplePresenceChanged(const QString &, uint, const QString &) ));
        connect(tp_contact_.data(),
                SIGNAL( subscriptionStateChanged(Tp::Contact::PresenceState) ),
                SLOT( OnContactChanged() ));
        connect(tp_contact_.data(),
                SIGNAL( publishStateChanged(Tp::Contact::PresenceState) ),
                SLOT( OnContactChanged() ));
        connect(tp_contact_.data(),
                SIGNAL( blockStatusChanged(bool) ),
                SLOT( OnContactChanged()) );
    }
void Modem3gppPropertiesTest::testModem3gppProperties()
{
    ModemManager::ModemDevice::Ptr modemDevice = ModemManager::modemDevices().first();
    QVERIFY(modemDevice);
    QVERIFY(modemDevice->hasInterface(ModemManager::ModemDevice::GsmInterface));
    ModemManager::Modem3gpp::Ptr modem3gppInterface = modemDevice->interface(ModemManager::ModemDevice::GsmInterface).objectCast<ModemManager::Modem3gpp>();
    QVERIFY(modem3gppInterface);

    modem3gpp->setEnabledFacilityLocks(MM_MODEM_3GPP_FACILITY_SIM);
    QSignalSpy enabledFacilityLocksChangedSpy(modem3gppInterface.data(), SIGNAL(enabledFacilityLocksChanged(QFlags<MMModem3gppFacility>)));
    QVERIFY(enabledFacilityLocksChangedSpy.wait());
    QCOMPARE(modem3gppInterface->enabledFacilityLocks(), enabledFacilityLocksChangedSpy.at(0).at(0).value<QFlags<MMModem3gppFacility> >());

    modem3gpp->setImei(QLatin1String("IMEI2"));
    QSignalSpy imeiChangedSpy(modem3gppInterface.data(), SIGNAL(imeiChanged(QString)));
    QVERIFY(imeiChangedSpy.wait());
    QCOMPARE(modem3gppInterface->imei(), imeiChangedSpy.at(0).at(0).toString());

    modem3gpp->setOperatorCode(QLatin1String("21025"));
    QSignalSpy operatorCodeChangedSpy(modem3gppInterface.data(), SIGNAL(operatorCodeChanged(QString)));
    QVERIFY(operatorCodeChangedSpy.wait());
    QCOMPARE(modem3gppInterface->operatorCode(), operatorCodeChangedSpy.at(0).at(0).toString());

    modem3gpp->setOperatorName(QLatin1String("op-name2"));
    QSignalSpy operatorNameChangedSpy(modem3gppInterface.data(), SIGNAL(operatorNameChanged(QString)));
    QVERIFY(operatorNameChangedSpy.wait());
    QCOMPARE(modem3gppInterface->operatorName(), operatorNameChangedSpy.at(0).at(0).toString());

    modem3gpp->setRegistrationState(MM_MODEM_3GPP_REGISTRATION_STATE_IDLE);
    QSignalSpy registrationStateChangedSpy(modem3gppInterface.data(), SIGNAL(registrationStateChanged(MMModem3gppRegistrationState)));
    QVERIFY(registrationStateChangedSpy.wait());
    QCOMPARE(modem3gppInterface->registrationState(), registrationStateChangedSpy.at(0).at(0).value<MMModem3gppRegistrationState>());

#if MM_CHECK_VERSION(1, 2, 0)
    modem3gpp->setSubscriptionState(MM_MODEM_3GPP_SUBSCRIPTION_STATE_PROVISIONED);
    QSignalSpy subscriptionStateChangedSpy(modem3gppInterface.data(), SIGNAL(subscriptionStateChanged(MMModem3gppSubscriptionState)));
    QVERIFY(subscriptionStateChangedSpy.wait());
    QCOMPARE(modem3gppInterface->subscriptionState(), subscriptionStateChangedSpy.at(0).at(0).value<MMModem3gppSubscriptionState>());
#endif
}