Messagelib

contactdisplaymessagememento.h
1 /* SPDX-FileCopyrightText: 2012-2023 Laurent Montel <[email protected]>
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 
17 class KJob;
18 namespace Gravatar
19 {
20 class GravatarResolvUrlJob;
21 }
22 
23 namespace Akonadi
24 {
25 class ContactSearchJob;
26 }
27 namespace MessageViewer
28 {
29 class ContactDisplayMessageMemento : public QObject, public MimeTreeParser::Interface::BodyPartMemento
30 {
31  Q_OBJECT
32 public:
33  explicit ContactDisplayMessageMemento(const QString &emailAddress);
34  ~ContactDisplayMessageMemento() override;
35  void processAddress(const KContacts::Addressee &addressee);
36  Q_REQUIRED_RESULT KContacts::Picture photo() const;
37 
38  Q_REQUIRED_RESULT bool finished() const;
39 
40  void detach() override;
41 
42  Q_REQUIRED_RESULT QPixmap gravatarPixmap() const;
43 
44  Q_REQUIRED_RESULT QImage imageFromUrl() const;
45 
46 Q_SIGNALS:
47  // TODO: Factor our update and detach into base class
48  void update(MimeTreeParser::UpdateMode);
49  void changeDisplayMail(Viewer::DisplayFormatMessage displayAsHtml, bool remoteContent);
50 
51 private Q_SLOTS:
52  void slotSearchJobFinished(KJob *job);
53 
54  void slotGravatarResolvUrlFinished(Gravatar::GravatarResolvUrlJob *);
55 
56 private:
57  Q_REQUIRED_RESULT bool searchPhoto(const KContacts::AddresseeList &list);
58  KContacts::Picture mPhoto;
59  QPixmap mGravatarPixmap;
60  QImage mImageFromUrl;
61  const QString mEmailAddress;
62  bool mFinished = false;
64 };
65 }
Q_OBJECTQ_OBJECT
Q_SLOTSQ_SLOTS
interface of classes that implement status for BodyPartFormatters.
Definition: bodypart.h:33
Q_SIGNALSQ_SIGNALS
void update(Part *part, const QByteArray &data, qint64 dataSize)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sat Apr 1 2023 04:01:56 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.