本文整理汇总了C++中CContactItemField::SetLabelL方法的典型用法代码示例。如果您正苦于以下问题:C++ CContactItemField::SetLabelL方法的具体用法?C++ CContactItemField::SetLabelL怎么用?C++ CContactItemField::SetLabelL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CContactItemField
的用法示例。
在下文中一共展示了CContactItemField::SetLabelL方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: presenceEncodedText
QList<CContactItemField *> CntTransformPresence::transformDetailL(const QContactDetail &detail)
{
if(detail.definitionName() != QContactPresence::DefinitionName)
User::Leave(KErrArgument);
QList<CContactItemField *> fieldList;
//cast to presence
const QContactPresence &presenceDetail(static_cast<const QContactPresence&>(detail));
HBufC* detailCount = HBufC::NewLC(KMaxDetailCounterLength);
detailCount->Des().AppendNum(m_detailCounter);
// Transform presence informaiton
if(presenceDetail.presenceState() != QContactPresence::PresenceUnknown) {
QString presence = QString::number(presenceDetail.presenceState());
CContactItemField* presenceField = CContactItemField::NewLC(KStorageTypeText);
TPtrC presenceEncodedText(reinterpret_cast<const TUint16*>(presence.utf16()));
presenceField->TextStorage()->SetTextL(presenceEncodedText);
presenceField->AddFieldTypeL(KUidContactFieldPresence);
presenceField->SetLabelL(*detailCount);
fieldList.append(presenceField);
CleanupStack::Pop(presenceField);
}
// Transform statusMessage
TPtrC statusMsgText(reinterpret_cast<const TUint16*>(presenceDetail.presenceStateText().utf16()));
if(statusMsgText.Length()) {
CContactItemField* statusMsgField = CContactItemField::NewLC(KStorageTypeText);
statusMsgField->TextStorage()->SetTextL(statusMsgText);
statusMsgField->AddFieldTypeL(KUidContactFieldStatusMsg);
statusMsgField->SetLabelL(*detailCount);
fieldList.append(statusMsgField);
CleanupStack::Pop(statusMsgField);
}
CleanupStack::PopAndDestroy(detailCount);
if(fieldList.count() > 0) {
m_detailCounter++;
}
return fieldList;
}
示例2: fieldText
QList<CContactItemField *> CntTransformOnlineAccount::transformDetailL(const QContactDetail &detail)
{
if(detail.definitionName() != QContactOnlineAccount::DefinitionName)
User::Leave(KErrArgument);
QList<CContactItemField *> fieldList;
//cast to phonenumber
const QContactOnlineAccount &onlineAccount(static_cast<const QContactOnlineAccount&>(detail));
//get the subType
QStringList subTypes = onlineAccount.subTypes();
//create new field
TPtrC fieldText(reinterpret_cast<const TUint16*>(onlineAccount.accountUri().utf16()));
if(fieldText.Length()) {
HBufC* detailCount = HBufC::NewLC(KMaxDetailCounterLength);
detailCount->Des().AppendNum(m_detailCounter);
CContactItemField* newField = CContactItemField::NewLC(KStorageTypeText);
newField->TextStorage()->SetTextL(fieldText);
//no subtype
if(!subTypes.count())
{
User::LeaveIfError(KErrArgument);
}
// online account
else if (subTypes.contains(QContactOnlineAccount::SubTypeImpp))
{
newField->AddFieldTypeL(KUidContactFieldIMPP);
newField->SetMapping(KUidContactFieldVCardMapUnknown);
}
//internet
else if (subTypes.contains(QContactOnlineAccount::SubTypeSipVoip))
{
newField->AddFieldTypeL(KUidContactFieldSIPID);
newField->SetMapping(KUidContactFieldVCardMapSIPID);
newField->AddFieldTypeL(KUidContactFieldVCardMapVOIP);
}
//share video
else if (subTypes.contains(QContactOnlineAccount::SubTypeVideoShare))
{
newField->AddFieldTypeL(KUidContactFieldSIPID);
newField->SetMapping(KUidContactFieldVCardMapSIPID);
newField->AddFieldTypeL(KUidContactFieldVCardMapSWIS);
}
//sip
else if (subTypes.contains(QContactOnlineAccount::SubTypeSip))
{
newField->AddFieldTypeL(KUidContactFieldSIPID);
newField->SetMapping(KUidContactFieldVCardMapSIPID);
newField->AddFieldTypeL(KUidContactFieldVCardMapSIPID);
}
else
{
User::LeaveIfError(KErrNotSupported);
}
//contexts
setContextsL(onlineAccount, *newField);
newField->SetLabelL(*detailCount);
fieldList.append(newField);
CleanupStack::Pop(newField);
// Transform Service Provider Text
TPtrC ServiceProviderText(reinterpret_cast<const TUint16*>(onlineAccount.serviceProvider().utf16()));
if(ServiceProviderText.Length()) {
CContactItemField* serviceProviderField = CContactItemField::NewLC(KStorageTypeText);
serviceProviderField->TextStorage()->SetTextL(ServiceProviderText);
serviceProviderField->AddFieldTypeL(KUidContactFieldServiceProvider);
serviceProviderField->SetLabelL(*detailCount);
fieldList.append(serviceProviderField);
CleanupStack::Pop(serviceProviderField);
}
CleanupStack::PopAndDestroy(detailCount);
}
if(fieldList.count() > 0) {
m_detailCounter++;
}
return fieldList;
}
示例3: TestRecoverWhenViewReadyL
LOCAL_C void TestRecoverWhenViewReadyL()
{
test.Next(_L("Recover database when view is ready"));
CTestResources* res = CTestResources::NewLC(EFalse);
//Creating a contact to test recovery
_LIT(KPhoneNumLabel,"Phone Number");
_LIT(KPhoneNum, "+440000000000");
CContactCard* contact = CContactCard::NewLC();
CContactItemField* field = CContactItemField::NewLC(KStorageTypeText,KUidContactFieldPhoneNumber);
field->SetLabelL(KPhoneNumLabel());
field->TextStorage()->SetTextL(KPhoneNum());
contact->AddFieldL(*field);
TContactItemId aContactId = res->iDb->AddNewContactL(*contact);
CleanupStack::Pop(field);
// Wait 5 seconds for the view to get ready
TContactViewEvent event;
test(res->iViewEventQueue->ListenForEvent(5,event));
test(event.iEventType == TContactViewEvent::EReady);
// Damage the DB
test.Next(_L("Damage the open database"));
res->iDb->DamageDatabaseL(0x666);
test(res->iDb->IsDamaged());
// Damaging should not send view events
test(!res->iViewEventQueue->ListenForEvent(5,event));
//Attempt to read contact from the damaged database - this should fail with KErrNotReady
test.Next(_L("Attempting to read from damaged database"));
CContactItem* testCard = NULL;
TRAPD(ret,testCard = res->iDb->ReadContactLC(aContactId));
test(ret == KErrNotReady);
// Recover the DB
test.Next(_L("Recover the damaged database"));
res->iDb->RecoverL();
// View should be unavailable here
test(res->iViewEventQueue->ListenForEvent(5,event));
test(event.iEventType == TContactViewEvent::EUnavailable);
//View should now be ready for use again
test(res->iViewEventQueue->ListenForEvent(5,event));
test(event.iEventType == TContactViewEvent::EReady);
//Line below included to fix ARMV5 minor build warnings.
testCard = res->iDb->ReadContactLC(aContactId);
test(testCard != NULL);
CleanupStack::PopAndDestroy(testCard);
CleanupStack::PopAndDestroy(contact);
CleanupStack::PopAndDestroy(res);
}