本文整理汇总了C++中CContactDatabase::SetFieldAsSpeedDialL方法的典型用法代码示例。如果您正苦于以下问题:C++ CContactDatabase::SetFieldAsSpeedDialL方法的具体用法?C++ CContactDatabase::SetFieldAsSpeedDialL怎么用?C++ CContactDatabase::SetFieldAsSpeedDialL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CContactDatabase
的用法示例。
在下文中一共展示了CContactDatabase::SetFieldAsSpeedDialL方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AssignSpeedDialL
void AssignSpeedDialL( TInt aContact, TInt aSpeedDialID, CContactDatabase& database )
{
CContactItem* item = NULL;
item = database.OpenContactL( aContact );
CleanupStack::PushL( item );
if ( ContactIsASpeedDial( *item ) )
{
g_test.Printf( _L("Contact is a speed dial !!! \n") );
}
else
{
g_test.Printf( _L("Contact is NOT A SPEED DIAL \n") );
}
CContactItemFieldSet &fieldSet = item->CardFields();
for(TInt index = fieldSet.Count() - 1; index > 0; --index)
{
if(fieldSet[index].StorageType() == KStorageTypeText)
{
//set the last text field from the fieldset as speeddial field.
database.SetFieldAsSpeedDialL(*item, index, aSpeedDialID );
break;
}
}
g_test.Next( _L("Contact changed to speed dial") );
g_test(ContactIsASpeedDial( *item ));
CleanupStack::PopAndDestroy( item );
}
示例2: LongNumSpeedDialTestsL
LOCAL_C void LongNumSpeedDialTestsL()
{
_LIT(KLongNumSpeedDialTest, "Long Phone Number Speed Dial Test");
g_test.Start(KLongNumSpeedDialTest);
// create default, empty database
CContactDatabase* db = CContactDatabase::ReplaceL(KLongNumSpeedDialDbName);
CleanupStack::PushL(db);
// create a contact and add it to the db
CContactItem* contact = CContactCard::NewLC();
CContactItemField* fname = CContactItemField::NewLC(KStorageTypeText,
KUidContactFieldGivenName);
_LIT(KFname, "James");
fname->TextStorage()->SetTextL(KFname() );
contact->AddFieldL(*fname);
CleanupStack::Pop(fname);
CContactItemField* phone = CContactItemField::NewLC(KStorageTypeText,
KUidContactFieldPhoneNumber);
_LIT(KPhoneNum, "01234567890123456789012345678901234567890123456789012345678901234567890123456789"); // 80 chars
phone->TextStorage()->SetTextL(KPhoneNum() );
contact->AddFieldL(*phone);
CleanupStack::Pop(phone);
const TContactItemId KContactId = db->AddNewContactL(*contact);
CleanupStack::PopAndDestroy(contact);
contact = NULL;
// retrieve contact and assign its number to speed dial #1
contact = db->OpenContactL(KContactId);
CleanupStack::PushL(contact);
const TInt KSpeedDial1(1);
const TInt KPhoneNumIndex = contact->CardFields().Find(KUidContactFieldPhoneNumber);
db->SetFieldAsSpeedDialL(*contact, KPhoneNumIndex, KSpeedDial1);
TBuf<100> speedDialNumberText;
TContactItemId speedDialId = db->GetSpeedDialFieldL(KSpeedDial1, speedDialNumberText);
_LIT(KOutputFormat, "retrieved speed dial id: %d;\nretrieved speed dial phone number: ...\n%S\n");
g_test.Printf(KOutputFormat, speedDialId, &speedDialNumberText);
db->CloseContactL(KContactId);
// cleanup
CleanupStack::PopAndDestroy(2, db); // and contact
CContactDatabase::DeleteDatabaseL(KLongNumSpeedDialDbName);
// Since PDEF121954, long phone numbers set as speed dial are truncated to
// the length of KSpeedDialPhoneLength. So, we need to get the truncated
// version of the phone number for comparison with the speed dial value.
TPtrC phoneNum(KPhoneNum().Mid(0, KSpeedDialPhoneLength));
g_test(speedDialId == KContactId && speedDialNumberText.CompareC(phoneNum) == 0);
g_test.End();
g_test.Close();
}
示例3: UpdateSpeedDialL
void UpdateSpeedDialL(TInt aContact, TInt aSpeedDialID, CContactDatabase& database )
{
CContactItem* item = NULL;
item = database.OpenContactL( aContact );
CleanupStack::PushL( item );
if ( ContactIsASpeedDial( *item ) )
{
g_test.Printf( _L("Contact is a speed dial !!! \n") );
database.SetFieldAsSpeedDialL(*item, item->Id(), aSpeedDialID );
}
else
{
g_test.Printf( _L("Contact is NOT A SPEED DIAL \n") );
}
CleanupStack::PopAndDestroy( item );
}