本文整理汇总了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");
}
}
示例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
}
示例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("");
}
}
示例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();
}
}
示例5: displayLabel
QString SeasidePerson::displayLabel()
{
if (mDisplayLabel.isEmpty()) {
QContactName name = mContact.detail<QContactName>();
mDisplayLabel = name.customLabel();
if (mDisplayLabel.isEmpty())
recalculateDisplayLabel();
}
return mDisplayLabel;
}