Exemplo n.º 1
0
/*! 
 * 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;
}
Exemplo n.º 2
0
void SeasidePerson::recalculateDisplayLabel()
{
    QString oldDisplayLabel = displayLabel();
    QString newDisplayLabel = generateDisplayLabel(mContact);

    // TODO: would be lovely if mobility would let us store this somehow
    if (oldDisplayLabel != newDisplayLabel) {
        mDisplayLabel = newDisplayLabel;
        emit displayLabelChanged();
    }
}
void SeasidePerson::recalculateDisplayLabel(SeasideCache::DisplayLabelOrder order) const
{
    QString oldDisplayLabel = mDisplayLabel;
    QString newDisplayLabel = generateDisplayLabel(*mContact, order);

    if (oldDisplayLabel != newDisplayLabel) {
        mDisplayLabel = newDisplayLabel;
        emit const_cast<SeasidePerson*>(this)->displayLabelChanged();

        // TODO: If required, store this to the contact backend to prevent later recalculation
    }
}
Exemplo n.º 4
0
void SeasidePerson::recalculateDisplayLabel(SeasideProxyModel::DisplayLabelOrder order)
{
    QString oldDisplayLabel = mDisplayLabel;
    QString newDisplayLabel = generateDisplayLabel(mContact, order);

    if (oldDisplayLabel != newDisplayLabel) {
        // Save the display label as the custom label.
        QContactName name = mContact.detail<QContactName>();
        name.setCustomLabel(newDisplayLabel);
        mContact.saveDetail(&name);

        mDisplayLabel = newDisplayLabel;
        emit displayLabelChanged();
    }
}