qtmobility/plugins/contacts/symbian/src/cntdisplaylabel.cpp
changeset 4 90517678cc4f
parent 1 2b40d63a9c3d
child 11 06b8e2af4411
equal deleted inserted replaced
1:2b40d63a9c3d 4:90517678cc4f
    72 
    72 
    73     //Display label details
    73     //Display label details
    74     //Contact
    74     //Contact
    75     //Preferred details
    75     //Preferred details
    76     QList<QPair<QLatin1String, QLatin1String> > contactPrefferedDisplayLabelDetails;
    76     QList<QPair<QLatin1String, QLatin1String> > contactPrefferedDisplayLabelDetails;
    77     contactPrefferedDisplayLabelDetails.append(qMakePair(QLatin1String(QContactName::DefinitionName), QLatin1String(QContactName::FieldFirst)));
    77     contactPrefferedDisplayLabelDetails.append(qMakePair(QLatin1String(QContactName::DefinitionName), QLatin1String(QContactName::FieldFirstName)));
    78     contactPrefferedDisplayLabelDetails.append(qMakePair(QLatin1String(QContactName::DefinitionName), QLatin1String(QContactName::FieldLast)));
    78     contactPrefferedDisplayLabelDetails.append(qMakePair(QLatin1String(QContactName::DefinitionName), QLatin1String(QContactName::FieldLastName)));
    79     m_contactDisplayLabelDetails.append(contactPrefferedDisplayLabelDetails);
    79     m_contactDisplayLabelDetails.append(contactPrefferedDisplayLabelDetails);
    80 
    80 
    81     //if preferred details doesn't exist use these
    81     //if preferred details doesn't exist use these
    82     QList<QPair<QLatin1String, QLatin1String> > contactSecondaryDisplayLabelDetails;
    82     QList<QPair<QLatin1String, QLatin1String> > contactSecondaryDisplayLabelDetails;
    83     contactSecondaryDisplayLabelDetails.append(qMakePair(QLatin1String(QContactOrganization::DefinitionName), QLatin1String(QContactOrganization::FieldName)));
    83     contactSecondaryDisplayLabelDetails.append(qMakePair(QLatin1String(QContactOrganization::DefinitionName), QLatin1String(QContactOrganization::FieldName)));
    93  * Returns a synthesised display label of a contact
    93  * Returns a synthesised display label of a contact
    94  * \a contact to read the data from .
    94  * \a contact to read the data from .
    95  * \a error On return, contains the possible error.
    95  * \a error On return, contains the possible error.
    96  * \return synthesised display label 
    96  * \return synthesised display label 
    97  */
    97  */
    98 QString CntDisplayLabel::synthesizedDisplayLabel(const QContact& contact, QContactManager::Error& error) const
    98 QString CntDisplayLabel::synthesizedDisplayLabel(const QContact& contact, QContactManager::Error* error) const
    99 {
    99 {
   100     QString displayLabel;
   100     QString displayLabel;
   101     error = QContactManager::NoError;
   101     *error = QContactManager::NoError;
   102     
   102     
   103     //contact
   103     //contact
   104     if(contact.type() == QContactType::TypeContact) {
   104     if(contact.type() == QContactType::TypeContact) {
   105         displayLabel = generateDisplayLabel(contact, m_contactDisplayLabelDetails);    
   105         displayLabel = generateDisplayLabel(contact, m_contactDisplayLabelDetails);    
   106     }
   106     }
   110         displayLabel = generateDisplayLabel(contact, m_groupDisplayLabelDetails);
   110         displayLabel = generateDisplayLabel(contact, m_groupDisplayLabelDetails);
   111     } 
   111     } 
   112     
   112     
   113     //invalid type
   113     //invalid type
   114     else {
   114     else {
   115         error = QContactManager::InvalidContactTypeError;
   115         *error = QContactManager::InvalidContactTypeError;
   116     }
   116     }
   117     
   117     
   118     return displayLabel;
   118     return displayLabel;
   119 }
   119 }
   120 
   120