本文整理汇总了C++中CContactItemField::TextStorage方法的典型用法代码示例。如果您正苦于以下问题:C++ CContactItemField::TextStorage方法的具体用法?C++ CContactItemField::TextStorage怎么用?C++ CContactItemField::TextStorage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CContactItemField
的用法示例。
在下文中一共展示了CContactItemField::TextStorage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateAndUpdateMultipleContactsL
/** Create Multiple Contact Item with field and Add all contact
* Item to Contact database. Update the multiple contact item field value and
* verify field is being updated.
* aValue - field value
* @param aStorageType - Storage type of each field
* @param aContFieldUid - Uid of Contact field
* @param avCardMapUid - Uid of vCard
* @return - void
*/
void CTestUpdateMultipleContactsStep::CreateAndUpdateMultipleContactsL(TPtrC aValue, TInt aStorageType,TUid aContFieldUid, TUid avCardMap)
{
TPtrC value, updateVal, getUpdateValue;
CContactDatabase *dBase = NULL;
_LIT(KTestDbName, "c:contactmultiple.cdb");
TInt year, month, day,noOfCI;
TContactItemId id = 0;
RArray <TInt> idArray;
CleanupClosePushL(idArray);
//replace existing database name
dBase = CContactDatabase::ReplaceL(KTestDbName);
//Get the number of contact item from ini file
GetIntFromConfig(ConfigSection(), KNoOfContactItem, noOfCI);
//Get the int value
GetIntFromConfig(ConfigSection(), KIniYear, year);
GetIntFromConfig(ConfigSection(), KIniMonth, month);
GetIntFromConfig(ConfigSection(), KIniDay, day);
// Create contact item and add field to it
for(TInt range=0;range<noOfCI;range++)
{
CContactItem* item = CContactCard::NewLC();
CContactItemField* field = CContactItemField::NewL(aStorageType, aContFieldUid);
CleanupStack::PushL(field);
field->SetMapping(avCardMap);
if(aStorageType==KStorageTypeDateTime)
{
TDateTime date(year,(TMonth)month,day,0,0,0,0);
field->DateTimeStorage()->SetTime(date);
}
else
{
field->TextStorage()->SetTextL(aValue);
}
item->AddFieldL(*field);
CleanupStack::Pop(field);
// add contact item to database
id = dBase->AddNewContactL(*item);
idArray.Append(id);
CleanupStack::PopAndDestroy(item);
}
dBase->CloseContactL(id);
// Get the value from ini file for update
GetStringFromConfig(ConfigSection(), KIniUpdatedvalue, updateVal);
GetIntFromConfig(ConfigSection(), KIniUpdateYear, year);
GetIntFromConfig(ConfigSection(), KIniUpdateMonth, month);
GetIntFromConfig(ConfigSection(), KIniUpdateDay, day);
// update multiple contact item field value
CContactItem *readItem = NULL;
for(TInt readContact=0;readContact<noOfCI;readContact++)
{
readItem = dBase->ReadContactLC(idArray[readContact]);
CContactItemFieldSet& ContactFieldSet = readItem->CardFields();
TInt pos = ContactFieldSet.Find(aContFieldUid, avCardMap);
if(pos != KErrNotFound)
{
if(aStorageType==KStorageTypeDateTime)
{
// update the field value
TDateTime date(year,(TMonth)month,day,0,0,0,0);
ContactFieldSet[pos].DateTimeStorage()->SetTime(date);
ContactFieldSet.UpdateFieldL(ContactFieldSet[pos],pos);
// verify the updated field value
TInt upadtePos = ContactFieldSet.Find(aContFieldUid, avCardMap);
TDateTime result=ContactFieldSet[upadtePos].DateTimeStorage()->Time().DateTime();
if((result.Year() == year) && (result.Month() == (TMonth)month) && (result.Day() == day))
{
SetTestStepResult(EPass);
}
else
{
SetTestStepResult(EFail);
}
}
else
{
// Update the field value
ContactFieldSet[pos].TextStorage()->SetTextL(updateVal);
ContactFieldSet.UpdateFieldL(ContactFieldSet[pos],pos);
// verify the field is being updated
TInt upadtePos = ContactFieldSet.Find(aContFieldUid, avCardMap);
getUpdateValue.Set(ContactFieldSet[upadtePos].TextStorage()->Text());
//.........这里部分代码省略.........