Messagelib

composer.h
1/*
2 SPDX-FileCopyrightText: 2009 Constantin Berzan <exit3219@gmail.com>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "MessageComposer/JobBase"
10#include <Libkleo/Enum>
11
12#include "messagecomposer_export.h"
13#include <QList>
14#include <QStringList>
15
16#include <KMime/Message>
17
18#include <MessageCore/AttachmentPart>
19
20#include <gpgme++/key.h>
21#include <vector>
22
23namespace MessageComposer
24{
25class ComposerPrivate;
26class GlobalPart;
27class InfoPart;
28class TextPart;
29class ItipPart;
30
31/**
32 * @brief The Composer class
33 */
34class MESSAGECOMPOSER_EXPORT Composer : public JobBase
35{
36 Q_OBJECT
37
38public:
39 explicit Composer(QObject *parent = nullptr);
40 ~Composer() override;
41
42 [[nodiscard]] QList<KMime::Message::Ptr> resultMessages() const;
43
44 [[nodiscard]] GlobalPart *globalPart() const;
45 [[nodiscard]] InfoPart *infoPart() const;
46 [[nodiscard]] TextPart *textPart() const;
47 [[nodiscard]] ItipPart *itipPart() const;
48 void clearTextPart();
49 void clearItipPart();
50 [[nodiscard]] MessageCore::AttachmentPart::List attachmentParts() const;
51 void addAttachmentPart(MessageCore::AttachmentPart::Ptr part, bool autoresizeImage = false);
52 void addAttachmentParts(const MessageCore::AttachmentPart::List &parts, bool autoresizeImage = false);
53 void removeAttachmentPart(MessageCore::AttachmentPart::Ptr part);
54
55 // if the message and attachments should not be encrypted regardless of settings
56 void setNoCrypto(bool noCrypto);
57 void setSignAndEncrypt(const bool doSign, const bool doEncrypt);
58 void setCryptoMessageFormat(Kleo::CryptoMessageFormat format);
59 void setSigningKeys(const std::vector<GpgME::Key> &signers);
60 void setEncryptionKeys(const QList<QPair<QStringList, std::vector<GpgME::Key>>> &data);
61
62 void setAutocryptEnabled(bool autocryptEnabled);
63 void setSenderEncryptionKey(const GpgME::Key &senderKey);
64
65 void setGnupgHome(const QString &path);
66 [[nodiscard]] QString gnupgHome() const;
67
68 /// Sets if this message being composed is an auto-saved message
69 /// if so, might need different handling, such as no crypto attachments.
70 void setAutoSave(bool isAutoSave);
71 [[nodiscard]] bool autoSave() const;
72
73 [[nodiscard]] bool finished() const;
74
75public Q_SLOTS:
76 void start() override;
77
78protected Q_SLOTS:
79 void slotResult(KJob *job) override;
80
81private:
82 Q_DECLARE_PRIVATE(Composer)
83
84 Q_PRIVATE_SLOT(d_func(), void doStart())
85 Q_PRIVATE_SLOT(d_func(), void contentJobFinished(KJob *))
86 Q_PRIVATE_SLOT(d_func(), void attachmentsFinished(KJob *))
87};
88}
The Composer class.
Definition composer.h:35
The GlobalPart class.
Definition globalpart.h:20
The InfoPart class contains the message header.
Definition infopart.h:22
The ItipPart class.
Definition itippart.h:21
A dummy abstract class defining some errors pertaining to the Composer.
Definition jobbase.h:25
The TextPart class.
Definition textpart.h:21
Q_SCRIPTABLE Q_NOREPLY void start()
Simple interface that both EncryptJob and SignEncryptJob implement so the composer can extract some e...
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:33:25 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.