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


C++ QContactName::customLabel方法代码示例

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


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

示例1: synthesizedDisplayLabel

/* Synthesise the display label of a contact */
QString QContactWinCEEngine::synthesizedDisplayLabel(const QContact& contact, QContactManager::Error* error) const
{
    Q_UNUSED(error)
    // The POOM API (well, lack thereof) makes this a bit strange.
    // It's basically just "Last, First" or "Company", if "FileAs" is not set.
    QContactName name = contact.detail<QContactName>();
    QContactOrganization org = contact.detail<QContactOrganization>();

    // Basically we ignore any existing labels for this contact, since we're being
    // asked what the synthesized label would be

    // XXX For greatest accuracy we might be better off converting this contact to
    // a real item (but don't save it), and then retrieve it...
    if (!name.customLabel().isEmpty()) {
        return name.customLabel();
    }
    else if (!name.lastName().isEmpty()) {
        if (!name.firstName().isEmpty()) {
            return QString(QLatin1String("%1, %2")).arg(name.lastName()).arg(name.firstName());
        } else {
            // Just last
            return name.lastName();
        }
    } else if (!name.firstName().isEmpty()) {
        return name.firstName();
    } else if (!org.name().isEmpty()) {
        return org.name();
    } else {
        // XXX grargh.
        return QLatin1String("Unnamed");
    }
}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:33,代码来源:qcontactwincebackend.cpp

示例2: generateDisplayLabel

// small helper to avoid inconvenience
QString SeasidePerson::generateDisplayLabel(const QContact &mContact, SeasideProxyModel::DisplayLabelOrder order)
{
    //REVISIT: Move this or parts of this to localeutils.cpp
    QString displayLabel;
    QContactName name = mContact.detail<QContactName>();

    QString nameStr1;
    QString nameStr2;
    if (order == SeasideProxyModel::LastNameFirst) {
        nameStr1 = name.lastName();
        nameStr2 = name.firstName();
    } else {
        nameStr1 = name.firstName();
        nameStr2 = name.lastName();
    }

    if (!nameStr1.isNull())
        displayLabel.append(nameStr1);

    if (!nameStr2.isNull()) {
        if (!displayLabel.isEmpty())
            displayLabel.append(" ");
        displayLabel.append(nameStr2);
    }

    if (!displayLabel.isEmpty())
        return displayLabel;

    foreach (const QContactOnlineAccount& account, mContact.details<QContactOnlineAccount>()) {
        if (!account.accountUri().isNull())
            return account.accountUri();
    }

    foreach (const QContactEmailAddress& email, mContact.details<QContactEmailAddress>()) {
        if (!email.emailAddress().isNull())
            return email.emailAddress();
    }

    QContactOrganization company = mContact.detail<QContactOrganization>();
    if (!company.name().isNull())
        return company.name();

    foreach (const QContactPhoneNumber& phone, mContact.details<QContactPhoneNumber>()) {
        if (!phone.number().isNull())
            return phone.number();
    }

    // This is last because the custom label is often source from this function, so we want to
    // overwrite that value in many cases.
    if (!name.customLabel().isNull())
        return name.customLabel();


    return "(Unnamed)"; // TODO: localisation
}
开发者ID:pgerdt,项目名称:nemo-qml-plugins,代码行数:56,代码来源:seasideperson.cpp

示例3: synthesizedDisplayLabel

QString CntSymbianSimEngine::synthesizedDisplayLabel(const QContact& contact, QContactManager::Error* error) const
{
    Q_UNUSED(error);

    QContactName name = contact.detail(QContactName::DefinitionName);
    if(!name.customLabel().isEmpty()) {
        return name.customLabel();
    } else {
        return QString("");
    }
}
开发者ID:bavanisp,项目名称:qtmobility-1.1.0,代码行数:11,代码来源:cntsymbiansimengine.cpp

示例4: contactsAvailable

void SeasideCache::contactsAvailable()
{
    if (m_fetchFilter == SeasideFilteredModel::FilterFavorites
            || m_fetchFilter == SeasideFilteredModel::FilterOnline
            || m_fetchFilter == SeasideFilteredModel::FilterAll) {
        // Part of an initial query.
        appendContacts(m_fetchRequest.contacts());
    } else {
        // An update.
        const QList<QContact> contacts = m_fetchRequest.contacts();

        for (int i = m_resultsRead; i < contacts.count(); ++i) {
            QContact contact = contacts.at(i);
            SeasideCacheItem &item = m_people[contact.localId()];
            QContactName oldName = item.contact.detail<QContactName>();
            QContactName newName = contact.detail<QContactName>();

            if (newName.customLabel().isEmpty()) {
                newName.setCustomLabel(oldName.customLabel());
                contact.saveDetail(&newName);
            }

            const bool roleDataChanged = newName != oldName
                    || contact.detail<QContactAvatar>().imageUrl() != item.contact.detail<QContactAvatar>().imageUrl();

            item.contact = contact;
            item.hasCompleteContact = true;
            if (item.person) {
                item.person->setContact(contact);
                item.person->setComplete(true);
            }

             QList<QContactPhoneNumber> phoneNumbers = contact.details<QContactPhoneNumber>();
             for (int j = 0; j < phoneNumbers.count(); ++j) {
                 m_phoneNumberIds[phoneNumbers.at(j).number()] = contact.localId();
             }

             if (roleDataChanged) {
                instance->updateContactData(contact.localId(), SeasideFilteredModel::FilterFavorites);
                instance->updateContactData(contact.localId(), SeasideFilteredModel::FilterOnline);
                instance->updateContactData(contact.localId(), SeasideFilteredModel::FilterAll);
             }
        }
        m_resultsRead = contacts.count();
    }
}
开发者ID:VDVsx,项目名称:nemo-qml-plugins,代码行数:46,代码来源:seasidecache.cpp

示例5: displayLabel

QString SeasidePerson::displayLabel()
{
    if (mDisplayLabel.isEmpty()) {
        QContactName name = mContact.detail<QContactName>();
        mDisplayLabel = name.customLabel();
        if (mDisplayLabel.isEmpty())
            recalculateDisplayLabel();
    }

    return mDisplayLabel;
}
开发者ID:pgerdt,项目名称:nemo-qml-plugins,代码行数:11,代码来源:seasideperson.cpp


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