Messagelib

signaturecontroller.h
1 /*
2  * SPDX-FileCopyrightText: 2010 Volker Krause <[email protected]>
3  *
4  * Based on kmail/kmcomposewin.cpp
5  * SPDX-FileCopyrightText: 2009 Constantin Berzan <[email protected]>
6  *
7  * Based on KMail code by:
8  * SPDX-FileCopyrightText: 1997 Markus Wuebben <[email protected]>
9  *
10  * SPDX-License-Identifier: GPL-2.0-or-later
11  */
12 
13 #pragma once
14 
15 #include "messagecomposer_export.h"
16 #include <KIdentityManagement/Signature>
17 #include <QObject>
18 
19 namespace KIdentityManagement
20 {
21 class IdentityCombo;
22 }
23 
24 namespace MessageComposer
25 {
26 class RichTextComposerNg;
27 class SignatureControllerPrivate;
28 /**
29  * @brief The SignatureController class
30  * Controls signature (the footer thing, not the crypto thing) operations
31  * happening on a KMEditor triggered by identity selection or menu actions.
32  * @since 4.5
33  */
34 class MESSAGECOMPOSER_EXPORT SignatureController : public QObject
35 {
36  Q_OBJECT
37 public:
38  explicit SignatureController(QObject *parent = nullptr);
39  ~SignatureController() override;
40 
41  void setEditor(MessageComposer::RichTextComposerNg *editor);
42  void setIdentityCombo(KIdentityManagement::IdentityCombo *combo);
43 
44  /** Temporarily disable identity tracking, useful for initial loading for example. */
45  void suspend();
46  /** Resume identity change tracking after a previous call to suspend(). */
47  void resume();
48 
49  /** Adds the given signature to the editor, taking user preferences into account.
50  */
51  void applySignature(const KIdentityManagement::Signature &signature);
52 
53 public Q_SLOTS:
54  /**
55  * Append signature to the end of the text in the editor.
56  */
57  void appendSignature();
58 
59  /**
60  * Prepend signature at the beginning of the text in the editor.
61  */
62  void prependSignature();
63 
64  /**
65  * Insert signature at the cursor position of the text in the editor.
66  */
67  void insertSignatureAtCursor();
68 
69  void cleanSpace();
70 
71 Q_SIGNALS:
72  /**
73  * A HTML signature is about to be inserted, so enable HTML support in the editor.
74  */
75  void enableHtml();
76  void signatureAdded();
77 
78 private:
79  /**
80  * Helper to insert the signature of the current identity arbitrarily
81  * in the editor, connecting slot functions to KMeditor::insertSignature().
82  * @param placement the position of the signature
83  */
84  void insertSignatureHelper(KIdentityManagement::Signature::Placement placement);
85 
86 private Q_SLOTS:
87  void identityChanged(uint id);
88 
89 private:
90  std::unique_ptr<SignatureControllerPrivate> const d;
91 };
92 }
93 
The RichTextComposerNg class.
The SignatureController class Controls signature (the footer thing, not the crypto thing) operations ...
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-2021 The KDE developers.
Generated on Mon Dec 6 2021 23:04:58 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.