当前位置: 首页>>代码示例>>C++>>正文


C++ QContactPhoneNumber::setSubTypes方法代码示例

本文整理汇总了C++中QContactPhoneNumber::setSubTypes方法的典型用法代码示例。如果您正苦于以下问题:C++ QContactPhoneNumber::setSubTypes方法的具体用法?C++ QContactPhoneNumber::setSubTypes怎么用?C++ QContactPhoneNumber::setSubTypes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QContactPhoneNumber的用法示例。


在下文中一共展示了QContactPhoneNumber::setSubTypes方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setPhoneNumberType

void SeasidePerson::setPhoneNumberType(int which, SeasidePerson::DetailTypes type)
{
    const QList<QContactPhoneNumber> &numbers = mContact.details<QContactPhoneNumber>();
    if (which >= numbers.length()) {
        qWarning() << "Unable to set type for phone number: invalid index specified. Aborting.";
        return;
    }

    QContactPhoneNumber number = numbers.at(which);
    if (type == SeasidePerson::PhoneHomeType) {
        number.setSubTypes(QContactPhoneNumber::SubTypeLandline);
        number.setContexts(QContactDetail::ContextHome);
    }  else if (type == SeasidePerson::PhoneWorkType) {
        number.setSubTypes(QContactPhoneNumber::SubTypeLandline);
        number.setContexts(QContactDetail::ContextWork);
    } else if (type == SeasidePerson::PhoneMobileType) {
        number.setSubTypes(QContactPhoneNumber::SubTypeMobile);
        number.setContexts(QContactDetail::ContextHome);
    } else if (type == SeasidePerson::PhoneFaxType) {
        number.setSubTypes(QContactPhoneNumber::SubTypeFax);
        number.setContexts(QContactDetail::ContextHome);
    } else if (type == SeasidePerson::PhonePagerType) {
        number.setSubTypes(QContactPhoneNumber::SubTypePager);
        number.setContexts(QContactDetail::ContextHome);
    } else {
        qWarning() << "Warning: Could not save phone type '" << type << "'";
    }

    mContact.saveDetail(&number);
    emit phoneNumberTypesChanged();
}
开发者ID:blammit,项目名称:nemo-qml-plugins,代码行数:31,代码来源:seasideperson.cpp

示例2: phonenumberNoMessageSupport

void TestCntActions::phonenumberNoMessageSupport()
{
    QContactPhoneNumber faxNumber;
    faxNumber.setNumber("555111222");
    faxNumber.setSubTypes(QContactPhoneNumber::SubTypeFacsimile);

    QList<QContactActionDescriptor> actionDescriptors = QContactAction::actionDescriptors("message", "symbian");

    QContactAction* contactAction = QContactAction::action(actionDescriptors.first());
    bool isSupportDetail = contactAction->isDetailSupported(faxNumber);
    
    delete contactAction;

    QVERIFY(isSupportDetail == false);
}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:15,代码来源:mt_cntactions.cpp

示例3: phonenumberCallSupport

void TestCntActions::phonenumberCallSupport()
{
    QContact contact;
    
    //Add phonenumber to contact
    QContactPhoneNumber number;
    number.setSubTypes(QContactPhoneNumber::SubTypeMobile);
    number.setNumber("555111222");
    contact.saveDetail(&number);
    m_manager->saveContact(&contact);
    
    //verify that the contact has a phonenumber
    QList<QContactPhoneNumber> numberList = contact.details<QContactPhoneNumber>();
    QVERIFY(numberList.count() >  0);
    
    //get the actions
    QList<QContactActionDescriptor> actionDescriptors = contact.availableActions();
    QStringList actions;
    for (int i = 0;i < actionDescriptors.count();i++)
    {
        QString action = actionDescriptors.at(i).actionName();
        actions << action;
    }
    
    //verify that it includes the actiosn
    QVERIFY(actions.contains("call", Qt::CaseInsensitive));
    
    //verify that the action works
    QList<QContactActionDescriptor> callActionDescriptors = QContactAction::actionDescriptors("call", "symbian");
    QVERIFY(callActionDescriptors.count() == 1);
    QContactAction *callAction = QContactAction::action(callActionDescriptors.at(0));
    QVERIFY(callAction != 0);
    QContactAction::State state = callAction->state();
    QVERIFY(state != QContactAction::InactiveState);
    QVERIFY(callAction->isDetailSupported(numberList.at(0)) == true);
    QList<QContactDetail> supportedDetails = callAction->supportedDetails(contact);
    QVERIFY(supportedDetails.count() != 0);
    QVariantMap variantMap = callAction->metaData();
    QVERIFY(variantMap.count() == 0);
    variantMap = callAction->results();
    QVERIFY(variantMap.count() == 0);
    QSignalSpy spyCallAction(callAction, SIGNAL(stateChanged(QContactAction::State)));
    callAction->invokeAction(contact, numberList.at(0));
    callAction->invokeAction(contact);
    QTRY_COMPARE(spyCallAction.count(), 2); // make sure the signal was emitted exactly one time
    delete callAction;
}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:47,代码来源:mt_cntactions.cpp

示例4: createComplexContacts

void SymbianPluginPerfomance::createComplexContacts()
{
    // Create N contacts
    QList<QContact> contactsList;
    for(int i=0; i<NO_OF_CONTACTS; i++) {
        QContact alice;

        // Contact details
        QString c = QString::number(i);
        QString first("Alice");
        QString last("Jones");

        QContactName aliceName;
        aliceName.setFirstName(first.append(c));
        aliceName.setLastName(last.append(c));
        alice.saveDetail(&aliceName);

        QContactPhoneNumber number;
        number.setContexts("Home");
        number.setSubTypes("Mobile");
        number.setNumber("12345678");
        alice.saveDetail(&number);
        alice.setPreferredDetail("DialAction", number);

        QContactPhoneNumber number2;
        number2.setContexts("Work");
        number2.setSubTypes("Landline");
        number2.setNumber("555-4444");
        alice.saveDetail(&number2);

        QContactAddress add;
        add.setStreet("Leeds West Yorkshire");
        add.setPostcode("10087");
        add.setRegion("New York");
        add.setCountry("United States");
        alice.saveDetail(&add);

        /* Commented out to ensure compatibility with pre-10.1 platforms
        QContactGender gender;
        gender.setGender("Female");
        alice.saveDetail(&gender);
        */

        QContactBirthday bday;
        bday.setDate(QDate(25,10,1978));
        alice.saveDetail(&bday);

        /* Commented out to ensure compatibility with pre-10.1 platforms
        QContactOnlineAccount acc;
        acc.setAccountUri("sips:[email protected]");
        acc.setSubTypes(QContactOnlineAccount::SubTypeSip);
        alice.saveDetail(&acc);
        */

        QContactEmailAddress email;
        email.setEmailAddress("mailto:[email protected]");
        alice.saveDetail(&email);

        QContactOrganization org;
        org.setDepartment(QStringList("Services"));
        org.setTitle("Assistant Manager");
        // Commented out to ensure compatibility with pre-10.1 platforms
        //org.setLocation("Nokia Cyber Park");
        alice.saveDetail(&org);

        contactsList.append(alice);
    }
    // Save the contacts
    mTime.restart();
    QMap<int, QContactManager::Error> errors;
    mCntMng->saveContacts(&contactsList, &errors);
    foreach(QContactManager::Error error, errors) {
        QCOMPARE(error, QContactManager::NoError);
    }
开发者ID:bavanisp,项目名称:qtmobility-1.1.0,代码行数:74,代码来源:performance.cpp

示例5: testRequestInfo

void TestCntPresenceInfoProvider::testRequestInfo()
{
    PrcPresenceWriter *writer = PrcPresenceWriter::createWriter();
    
    PrcPresenceBuddyInfoQt *buddy = PrcPresenceBuddyInfoQt::createInstance();
    buddy->setIdentity("sip:[email protected]");
    buddy->setAvailability(PrcPresenceBuddyInfoQt::PrcNotAvailable, "meh");
    writer->writePresence(*buddy);
    
    QContactManager manager("symbian");
    
    QContact c;
    QContactName name;
    name.setFirstName("firstname");
    name.setLastName("lastname");
    c.saveDetail(&name);
    QContactPhoneNumber number;
    number.setNumber("1234567");
    number.setContexts(QContactDetail::ContextHome);
    number.setSubTypes(QContactPhoneNumber::SubTypeMobile);
    c.saveDetail(&number);
    manager.saveContact(&c);
    
    ContactInfoFields fields;
    fields = ContactInfoTextField;
    
    QSignalSpy spy(mCntPresenceInfoProvider, SIGNAL(infoFieldReady(CntInfoProvider*, int, ContactInfoField, const QString&)));
    
    mCntPresenceInfoProvider->requestInfo(c, fields);
    QCOMPARE(spy.count(), 0);
    QVERIFY(mCntPresenceInfoProvider->mBuddyMap.isEmpty());
    
    fields = ContactInfoIcon2Field;
    
    mCntPresenceInfoProvider->requestInfo(c, fields);
    QCOMPARE(spy.count(), 0);
    QVERIFY(mCntPresenceInfoProvider->mBuddyMap.isEmpty());
    
    QContactOnlineAccount account;
    account.setSubTypes(QStringList() << QContactOnlineAccount::SubTypeSip);
    account.setServiceProvider("sip");
    account.setAccountUri("[email protected]");
    c.saveDetail(&account);
    QContactOnlineAccount account2;
    account2.setSubTypes(QStringList() << QContactOnlineAccount::SubTypeSipVoip);
    account.setServiceProvider("sip");
    account2.setAccountUri("[email protected]");
    c.saveDetail(&account2);
    QContactOnlineAccount account3;
    account3.setSubTypes(QStringList() << QContactOnlineAccount::SubTypeSip);
    account3.setAccountUri("malformatted");
    c.saveDetail(&account3);
    manager.saveContact(&c);
    
    mCntPresenceInfoProvider->requestInfo(c, fields);
    QCOMPARE(spy.count(), 0);
    QCOMPARE(mCntPresenceInfoProvider->mBuddyMap.count(), 1);
    
    delete mCntPresenceInfoProvider;
    mCntPresenceInfoProvider = NULL;
    
    buddy->setAvailability(PrcPresenceBuddyInfoQt::PrcAvailable, "meh");
    writer->writePresence(*buddy);
    
    mCntPresenceInfoProvider = new CntPresenceInfoProvider();
    
    QSignalSpy spy2(mCntPresenceInfoProvider, SIGNAL(infoFieldReady(CntInfoProvider*, int, ContactInfoField, const QString&)));
    mCntPresenceInfoProvider->requestInfo(c, fields);
    QCOMPARE(spy2.count(), 1);
    QCOMPARE(mCntPresenceInfoProvider->mBuddyMap.count(), 1);
    
    delete buddy;
    delete writer;
}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:74,代码来源:ut_cntpresenceinfoprovider.cpp


注:本文中的QContactPhoneNumber::setSubTypes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。