Contact.cpp Example File
bbmcontacts/src/Contact.cpp
#include "Contact.hpp"
Contact::Contact(const bb::platform::bbm::Contact &contact) :
m_bbmspContact(contact) {
m_avatar = bb::cascades::Image(QUrl("asset:///images/avatarPlaceholder.png"));
}
Contact::~Contact() {
}
QString Contact::ppid() {
return m_bbmspContact.ppId();
}
QString Contact::handle() {
return m_bbmspContact.handle();
}
QString Contact::appVersion() {
return m_bbmspContact.applicationVersion();
}
QString Contact::platformVersion() {
return QString::number(m_bbmspContact.platformVersion());
}
QString Contact::displayName() {
return m_bbmspContact.displayName();
}
QString Contact::personalMessage() {
return m_bbmspContact.personalMessage();
}
QString Contact::statusMessage() {
return m_bbmspContact.statusMessage();
}
bool Contact::busy() const {
if (m_bbmspContact.status() == bb::platform::bbm::UserStatus::Busy) {
return true;
}
return false;
}
void Contact::avatarUpdated(const QString& handle,
const bb::platform::bbm::ImageType::Type imageType,
const QByteArray& displayPicture) {
Q_UNUSED(imageType);
if (QString::compare(m_bbmspContact.handle(), handle) == 0) {
if(displayPicture.size() != 0) {
setAvatar(displayPicture);
}
}
}
void Contact::setAvatar(const QByteArray &imageData) {
m_avatar = bb::cascades::Image(imageData);
Q_EMIT avatarChanged();
}
QVariant Contact::avatar() {
return QVariant::fromValue(m_avatar);
}