Skip to content

Commit

Permalink
[libcommhistory] Add a contact avatar URL property to recipients. Con…
Browse files Browse the repository at this point in the history
…tributes to JB#50910
  • Loading branch information
adenexter committed Sep 11, 2020
1 parent d3653dc commit ac9e410
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion rpm/libcommhistory-qt5.spec
Expand Up @@ -12,7 +12,7 @@ BuildRequires: pkgconfig(Qt5Qml)
BuildRequires: pkgconfig(Qt5DBus)
BuildRequires: pkgconfig(Qt5Test)
BuildRequires: pkgconfig(qtcontacts-sqlite-qt5-extensions) >= 0.1.41
BuildRequires: pkgconfig(contactcache-qt5) >= 0.0.17
BuildRequires: pkgconfig(contactcache-qt5) >= 0.2.12
BuildRequires: libphonenumber-devel

%{!?qtc_qmake5:%define qtc_qmake5 %qmake5}
Expand Down
2 changes: 1 addition & 1 deletion src/contactfetcher.cpp
Expand Up @@ -67,7 +67,7 @@ ContactFetcherPrivate::ContactFetcherPrivate(ContactFetcher *parent)
, m_resolver(0)
, m_fetching(false)
{
SeasideCache::registerChangeListener(this);
SeasideCache::registerChangeListener(this, SeasideCache::FetchAvatar);
}

ContactFetcherPrivate::~ContactFetcherPrivate()
Expand Down
2 changes: 1 addition & 1 deletion src/contactlistener.cpp
Expand Up @@ -101,7 +101,7 @@ ContactListenerPrivate::ContactListenerPrivate(ContactListener *q)
, retryResolver(0)
, q_ptr(q)
{
SeasideCache::registerChangeListener(this);
SeasideCache::registerChangeListener(this, SeasideCache::FetchAvatar);
}

ContactListenerPrivate::~ContactListenerPrivate()
Expand Down
5 changes: 5 additions & 0 deletions src/recipient.cpp
Expand Up @@ -281,6 +281,11 @@ QString Recipient::contactName() const
return d->item ? d->item->displayLabel : QString();
}

QUrl Recipient::contactAvatarUrl() const
{
return d->item ? SeasideCache::filteredAvatarUrl(d->item->contact) : QUrl();
}

bool Recipient::isContactResolved() const
{
return d->isResolved;
Expand Down
1 change: 1 addition & 0 deletions src/recipient.h
Expand Up @@ -97,6 +97,7 @@ class LIBCOMMHISTORY_EXPORT Recipient

int contactId() const;
QString contactName() const;
QUrl contactAvatarUrl() const;
bool isContactResolved() const;

/* Update the resolved contact for this recipient
Expand Down

0 comments on commit ac9e410

Please sign in to comment.