当前位置: 首页>>代码示例>>C++>>正文


C++ QContact::detail方法代码示例

本文整理汇总了C++中QContact::detail方法的典型用法代码示例。如果您正苦于以下问题:C++ QContact::detail方法的具体用法?C++ QContact::detail怎么用?C++ QContact::detail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QContact的用法示例。


在下文中一共展示了QContact::detail方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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("");
    }
}
开发者ID:bavanisp,项目名称:qtmobility-1.1.0,代码行数:11,代码来源:cntsymbiansimengine.cpp

示例2: QString

/* Synthesise the display label of a contact */
QString QContactMaemo5Engine::synthesizedDisplayLabel(const QContact& contact, QContactManager::Error* error) const
{
  QString label;
  
  // Try to get the display name from the OSSO-ABook Contact
  label = d->m_abook->getDisplayName(contact);
  
  // Synthesise the display label for not saved contacts
  // A. FirstName + LastName
  if (label.isEmpty()){
    QContactName name = contact.detail(QContactName::DefinitionName);
    QStringList nameList;
    
    nameList << name.firstName();
    if (name.lastName().count()){
      nameList << name.lastName();
    }
    
    label = nameList.join(QString(' '));
  }
  
  // B. Email
  if (label.isEmpty()){
    QContactEmailAddress email = contact.detail(QContactEmailAddress::DefinitionName);
    label = email.emailAddress();
  }
  
  // 
  if (label.isEmpty()){
    *error = QContactManager::UnspecifiedError;
    return QString("No name");
  }
  
  *error = QContactManager::NoError;
  return label;
}
开发者ID:KDE,项目名称:android-qt-mobility,代码行数:37,代码来源:qcontactmaemo5backend.cpp

示例3: 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);
        }
开发者ID:guoqingkong,项目名称:QT_code,代码行数:40,代码来源:mainwindow.cpp

示例4: generateDisplayLabel

/*! 
 * 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;
}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:44,代码来源:cntdisplaylabel.cpp


注:本文中的QContact::detail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。