Messagelib

contactdisplaymessagememento.h
1/* SPDX-FileCopyrightText: 2012-2024 Laurent Montel <montel@kde.org>
2 *
3 * SPDX-License-Identifier: LGPL-2.0-or-later
4 */
5
6#pragma once
7
8#include "interfaces/bodypart.h"
9#include "messageviewer/viewer.h"
10
11#include <KContacts/Addressee>
12#include <KContacts/Picture>
13
14#include <QObject>
15#include <QPointer>
16
17class KJob;
18namespace Gravatar
19{
20class GravatarResolvUrlJob;
21}
22
23namespace Akonadi
24{
25class ContactSearchJob;
26}
27namespace MessageViewer
28{
29class ContactDisplayMessageMemento : public QObject, public MimeTreeParser::Interface::BodyPartMemento
30{
32public:
33 explicit ContactDisplayMessageMemento(const QString &emailAddress);
34 ~ContactDisplayMessageMemento() override;
35 void processAddress(const KContacts::Addressee &addressee);
36 [[nodiscard]] KContacts::Picture photo() const;
37
38 [[nodiscard]] bool finished() const;
39
40 void detach() override;
41
42 [[nodiscard]] QPixmap gravatarPixmap() const;
43
44 [[nodiscard]] QImage imageFromUrl() const;
45
47 // TODO: Factor our update and detach into base class
48 void update(MimeTreeParser::UpdateMode);
49 void changeDisplayMail(Viewer::DisplayFormatMessage displayAsHtml, bool remoteContent);
50
51private:
52 void slotGravatarResolvUrlFinished(Gravatar::GravatarResolvUrlJob *);
53 void slotSearchJobFinished(KJob *job);
54 [[nodiscard]] bool searchPhoto(const KContacts::AddresseeList &list);
55 KContacts::Picture mPhoto;
56 QPixmap mGravatarPixmap;
57 QImage mImageFromUrl;
58 const QString mEmailAddress;
59 bool mFinished = false;
61};
62}
interface of classes that implement status for BodyPartFormatters.
Definition bodypart.h:34
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
T qobject_cast(QObject *object)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sun Feb 25 2024 18:37:31 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.