Messagelib

mdnadvicehelper.h
1 /*
2  SPDX-FileCopyrightText: 2020-2023 Laurent Montel <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #pragma once
8 #include "messagecomposer_export.h"
9 #include <Akonadi/MDNStateAttribute>
10 #include <MessageComposer/MessageFactoryNG>
11 #include <QObject>
12 
13 namespace MessageComposer
14 {
15 class MESSAGECOMPOSER_EXPORT MDNAdviceHelper : public QObject
16 {
17  Q_OBJECT
18 public:
19  static MDNAdviceHelper *instance()
20  {
21  if (!s_instance) {
22  s_instance = new MDNAdviceHelper;
23  }
24 
25  return s_instance;
26  }
27 
28  /**
29  * Checks the MDN headers to see if the user needs to be asked for any
30  * confirmations. Will ask the user if action is required.
31  *
32  * Returns whether to send an MDN or not, and the sending mode for the MDN
33  * to be created.
34  *
35  * Will also set the Akonadi::MDNStateAttribute on the given item
36  * to what the user has selected.
37  */
38  Q_REQUIRED_RESULT QPair<bool, KMime::MDN::SendingMode> checkAndSetMDNInfo(const Akonadi::Item &item, KMime::MDN::DispositionType d, bool forceSend = false);
39 
40  Q_REQUIRED_RESULT static Akonadi::MDNStateAttribute::MDNSentState dispositionToSentState(KMime::MDN::DispositionType d);
41 
42  Q_REQUIRED_RESULT QPair<QString, bool> mdnMessageText(const char *what);
43 
44 private:
45  MESSAGECOMPOSER_NO_EXPORT explicit MDNAdviceHelper(QObject *parent = nullptr)
46  : QObject(parent)
47  {
48  }
49 
50  ~MDNAdviceHelper() override = default;
51 
52  Q_REQUIRED_RESULT MESSAGECOMPOSER_NO_EXPORT int requestAdviceOnMDN(const char *what);
53  MESSAGECOMPOSER_NO_EXPORT MessageComposer::MDNAdvice questionIgnoreSend(const QString &text, bool canDeny);
54 
55  static MDNAdviceHelper *s_instance;
56 };
57 }
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-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.