QVariant PersonsModel::dataForAddressee(const QString &personId, const KABC::Addressee &person, int role) const { Q_D(const PersonsModel); switch(role) { case FormattedNameRole: return person.formattedName(); case PhotoRole: if (!person.photo().data().isNull()) { return person.photo().data(); } else if (!person.photo().url().isEmpty()) { return QPixmap(person.photo().url()); } else { return QPixmap(d->genericAvatarImagePath); } case PersonIdRole: return personId; case PersonVCardRole: return QVariant::fromValue<KABC::Addressee>(person); case ContactsVCardRole: return QVariant::fromValue<KABC::AddresseeList>(d->metacontacts[d->personIndex[personId].row()].contacts()); case GroupsRole: return person.categories(); } return QVariant(); }
void CategoriesEditWidget::loadContact( const KABC::Addressee &contact ) { QVector<Nepomuk2::Tag> tags; const QStringList categories = contact.categories(); foreach ( const QString &category, categories ) { tags.append( Nepomuk2::Tag( category ) ); }