/*! 
 * Returns a synthesised display label of a contact
 * \a contact to read the data from .
 * \a error On return, contains the possible error.
 * \return synthesised display label 
 */
QString CntDisplayLabel::synthesizedDisplayLabel(const QContact& contact, QContactManager::Error* error)
{
    QString displayLabel;
    *error = QContactManager::NoError;
    
    int value = m_settings->getValue();
    if (value != -1 && value != m_nameOrder) {
        m_nameOrder = value;
        setDisplayLabelDetails();
    }
    //contact
    if(contact.type() == QContactType::TypeContact) {
        displayLabel = generateDisplayLabel(contact, m_contactDisplayLabelDetails);    
    }
    
    //group
    else if (contact.type() == QContactType::TypeGroup) {
        displayLabel = generateDisplayLabel(contact, m_groupDisplayLabelDetails);
    } 
    
    //invalid type
    else {
        *error = QContactManager::InvalidContactTypeError;
    }
    
    return displayLabel;
}
CntDisplayLabel::CntDisplayLabel()
{
#ifdef SYMBIAN_BACKEND_USE_SQLITE
    m_settings = new CntCenrep(KCntNameOrdering, *this);
    m_nameOrder = m_settings->getValue();
#endif
    setDisplayLabelDetails();
}
CntDisplayLabel::CntDisplayLabel()
{
    m_settings = new CntCenrep(*this);
    m_nameOrder = m_settings->getValue();
    setDisplayLabelDetails();
}