本文整理汇总了C++中QContactDetail类的典型用法代码示例。如果您正苦于以下问题:C++ QContactDetail类的具体用法?C++ QContactDetail怎么用?C++ QContactDetail使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QContactDetail类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CntCommonDetailViewItem
HbWidget* CntEmailEditorViewItem::createCustomWidget()
{
mItem = new CntCommonDetailViewItem(this);
mItem->editor()->setMaxLength( CNT_EMAIL_EDITOR_MAXLENGTH );
mItem->editor()->setInputMethodHints(Qt::ImhPreferLowercase);
HbDataFormModel* model = static_cast<HbDataFormModel*>(itemView()->model());
CntDetailModelItem* item = static_cast<CntDetailModelItem*>( model->itemFromIndex(modelIndex()) );
QContactDetail detail = item->detail();
mItem->editor()->setInputMethodHints( Qt::ImhEmailCharactersOnly );
constructSubTypeModel( detail.contexts() );
QContactEmailAddress address = detail;
QString d = address.emailAddress();
mItem->editor()->setText( address.emailAddress() );
connect( mItem->comboBox(), SIGNAL(currentIndexChanged(int)), this, SLOT(indexChanged(int)) );
connect( mItem->editor(), SIGNAL(textChanged(QString)),this, SLOT(textChanged(QString)) );
// Naming UI components for automation testability
QString editorObjName = detail.definitionName() + " line edit %1";
mItem->editor()->setObjectName(editorObjName.arg(modelIndex().row()));
QString comboBoxObjName = detail.definitionName() + " combo box %1";
mItem->comboBox()->setObjectName(comboBoxObjName.arg(modelIndex().row()));
return mItem;
}
示例2: transfer
template <class T> static void
transfer(const T &key, const QContactDetail &source, QContactDetail &target)
{
QVariant value(source.variantValue(key));
if (not value.isNull()) {
target.setValue(key, value);
}
}
示例3: keys
void tst_QContactDetail::keys()
{
QContactDetail d;
QContactDetail d2;
QVERIFY(d.key() != d2.key());
d = d2;
QVERIFY(d.key() == d2.key());
d.resetKey();
QVERIFY(d.key() != d2.key());
}
示例4: if
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();
//no subtype
if(!subTypes.count())
{
User::LeaveIfError(KErrArgument);
}
else if (subTypes.contains(QContactOnlineAccount::SubTypeSipVoip)) {
//internet
transformToTextFieldL(onlineAccount, fieldList, onlineAccount.accountUri(), KUidContactFieldSIPID, KUidContactFieldVCardMapVOIP, false);
} else if (subTypes.contains(QContactOnlineAccount::SubTypeVideoShare)) {
//share video
transformToTextFieldL( onlineAccount, fieldList, onlineAccount.accountUri(), KUidContactFieldSIPID, KUidContactFieldVCardMapSWIS, false);
} else if (subTypes.contains(QContactOnlineAccount::SubTypeSip)) {
//sip
transformToTextFieldL( onlineAccount, fieldList, onlineAccount.accountUri(), KUidContactFieldSIPID, KUidContactFieldVCardMapSIPID, false);
}
else
{
User::LeaveIfError(KErrNotSupported);
}
return fieldList;
}
示例5:
bool MobExample2Action::isDetailSupported(const QContactDetail &detail, const QContact &contact) const
{
if(QContactPhoneNumber::DefinitionName == detail.definitionName())
{
return true;
}
else
{
return false;
}
}
示例6: isDetailSupported
bool MobExampleAction::isDetailSupported(const QContactDetail &detail, const QContact &contact) const
{
if(QContactOnlineAccount::DefinitionName == detail.definitionName())
{
return true;
}
else
{
return false;
}
}
示例7: isDetailSupported
bool CntMessageAction::isDetailSupported(const QContactDetail &detail, const QContact &/*contact*/) const
{
if (detail.definitionName() == QContactPhoneNumber::DefinitionName
&& !static_cast<QContactPhoneNumber>(detail).subTypes().isEmpty())
{
return (static_cast<QContactPhoneNumber>(detail).subTypes().first() == QContactPhoneNumber::SubTypeMobile);
}
else
{
return false;
}
}
示例8: displayLabel
/*!
* Generate the display label
* \a contact to read the data from .
* \a detailList contains the details to be read from the contact
* \return synthesised display label
*/
QString CntDisplayLabel::generateDisplayLabel( const QContact &contact, const QList<QList<QPair<QLatin1String, QLatin1String> > > detailList) const
{
// Default to empty display label. It is up to the client to create a
// localised presentation of a contact without a name.
QString displayLabel("");
//loop through the details and create display label
for(int i = 0; i < detailList.count() && displayLabel.isEmpty(); i++ )
{
QList<QPair<QLatin1String, QLatin1String> > detailPairList = detailList.at(i);
QContactDetail contactDetail;
for(int j = 0; j < detailPairList.count(); j++)
{
contactDetail = contact.detail(detailPairList.at(j).first);
if(displayLabel.isEmpty()){ //read the value and set it as display label
displayLabel = contactDetail.value(detailPairList.at(j).second);
}
else{ //read the value and append it to the display label
QString label = contactDetail.value(detailPairList.at(j).second);
if(!label.isEmpty())
{
#ifdef SYMBIAN_BACKEND_USE_SQLITE
// Inlcude a comma if needed in the display label
if (m_nameOrder == CntOrderLastCommaFirst)
displayLabel.append(comma());
#endif
displayLabel.append(delimiter());
displayLabel.append(label);
}
}
}
}
return displayLabel;
}
示例9: transformToTextFieldL
QList<CContactItemField *> CntTransformGender::transformDetailL(const QContactDetail &detail)
{
if(detail.definitionName() != QContactGender::DefinitionName)
User::Leave(KErrArgument);
QList<CContactItemField *> fieldList;
//cast to gender
const QContactGender &gender(static_cast<const QContactGender&>(detail));
//create new field without contexts
transformToTextFieldL(gender, fieldList, gender.gender(), KUidContactFieldGender, KUidContactFieldVCardMapUnknown, false);
return fieldList;
}
示例10: 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;
}
示例11: dateTime
QList<CContactItemField *> CntTransformBirthday::transformDetailL(const QContactDetail &detail)
{
if(detail.definitionName() != QContactBirthday::DefinitionName)
User::Leave(KErrArgument);
QList<CContactItemField *> fieldList;
//cast to birthday
const QContactBirthday &birthday(static_cast<const QContactUrl&>(detail));
//create new field
TDateTime dateTime(birthday.date().year(), TMonth(birthday.date().month() - 1), birthday.date().day() - 1, 0, 0, 0, 0);
CContactItemField* newField = CContactItemField::NewLC(KStorageTypeDateTime, KUidContactFieldBirthday);
newField->DateTimeStorage()->SetTime(dateTime);
newField->SetMapping(KUidContactFieldVCardMapBDAY);
fieldList.append(newField);
CleanupStack::Pop(newField);
return fieldList;
}
示例12: fieldText
QList<CContactItemField *> CntTransformAvatar::transformDetailL(const QContactDetail &detail)
{
if(detail.definitionName() != QContactAvatar::DefinitionName)
User::Leave(KErrArgument);
QList<CContactItemField *> fieldList;
//cast to avatar
const QContactAvatar &avatar(static_cast<const QContactAvatar&>(detail));
//create new field
QString urlString = avatar.imageUrl().toString();
TPtrC fieldText(reinterpret_cast<const TUint16*>(urlString.utf16()));
//copy filename and replace slash with a backslash
TFileName filename;
for(TInt i(0); i < fieldText.Length(); ++i) {
if(i >= filename.MaxLength())
User::Leave(KErrTooBig);
if(fieldText[i] == '/') {
filename.Append('\\');
} else {
filename.Append(fieldText[i]);
}
}
if(filename.Length()) {
TUid uid(KUidContactFieldCodImage);
CContactItemField* newField = CContactItemField::NewLC(KStorageTypeText, uid);
newField->SetMapping(KUidContactFieldVCardMapUnknown);
newField->TextStorage()->SetTextL(filename);
fieldList.append(newField);
CleanupStack::Pop(newField);
}
return fieldList;
}
示例13: qDebug
void MainWindow::on_pushButton_3_clicked()
{
// qDebug() << "The default manager for the platform is:" << cm.managerName();
// qDebug() << "It" << (cm.isRelationshipTypeSupported(QContactRelationship::HasAssistant) ? "supports" : "does not support") << "assistant relationships.";
// qDebug() << "It" << (cm.supportedContactTypes().contains(QContactType::TypeGroup) ? "supports" : "does not support") << "groups.";
// qDebug() << "It" << (cm.hasFeature(QContactManager::MutableDefinitions) ? "supports" : "does not support") << "mutable detail definitions.";
QList<QContactLocalId> contactIds = cm.contactIds();
QContact a = cm.contact(contactIds.first());
qDebug() << "Viewing the details of" << a.displayLabel();
QList<QContactDetail> allDetails = a.details();
for (int i = 0; i < allDetails.size(); i++) {
QContactDetail detail = allDetails.at(i);
QContactDetailDefinition currentDefinition = cm.detailDefinition(detail.definitionName());
QMap<QString, QContactDetailFieldDefinition> fields = currentDefinition.fields();
qDebug("\tDetail #%d (%s):", i, detail.definitionName().toAscii().constData());
foreach (const QString& fieldKey, fields.keys()) {
qDebug() << "\t\t" << fieldKey << "(" << fields.value(fieldKey).dataType() << ") =" << detail.value(fieldKey);
}
qDebug();
}
QContact b;
QContactDetail de;
foreach (const QContactLocalId& ids, contactIds )
{
b = cm.contact(ids);
de = b.detail("PhoneNumber");
bool s = de.hasValue("PhoneNumber");
qDebug()<< " has Value PhoneNumber key"<<s<<"|"<<de.value("PhoneNumber");
QString show;
show = b.displayLabel();
show.append("\t");
show.append(de.value("PhoneNumber"));
ui->listWidget_2->addItem(show);
}
示例14: dateTime
QList<CContactItemField *> CntTransformAnniversarySimple::transformDetailL(const QContactDetail &detail)
{
if(detail.definitionName() != QContactAnniversary::DefinitionName)
User::Leave(KErrArgument);
QList<CContactItemField *> fieldList;
//cast to anniversary
const QContactAnniversary &anniversary(static_cast<const QContactAnniversary&>(detail));
//create new field
TDateTime dateTime(anniversary.originalDate().year(),
TMonth(anniversary.originalDate().month() - 1),
anniversary.originalDate().day() - 1, 0, 0, 0, 0);
CContactItemField* newField = CContactItemField::NewLC(KStorageTypeDateTime, KUidContactFieldAnniversary);
newField->DateTimeStorage()->SetTime(dateTime);
newField->SetMapping(KUidContactFieldVCardMapAnniversary);
fieldList.append(newField);
CleanupStack::Pop(newField);
return fieldList;
}
示例15: 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;
}