Messagelib

signaturecontroller.h
1/*
2 * SPDX-FileCopyrightText: 2010 Volker Krause <vkrause@kde.org>
3 *
4 * Based on kmail/kmcomposewin.cpp
5 * SPDX-FileCopyrightText: 2009 Constantin Berzan <exit3219@gmail.com>
6 *
7 * Based on KMail code by:
8 * SPDX-FileCopyrightText: 1997 Markus Wuebben <markus.wuebben@kde.org>
9 *
10 * SPDX-License-Identifier: GPL-2.0-or-later
11 */
12
13#pragma once
14
15#include "messagecomposer_export.h"
16#include <KIdentityManagementCore/Signature>
17#include <QObject>
18
19namespace KIdentityManagementWidgets
20{
21class IdentityCombo;
22}
23
24namespace MessageComposer
25{
26class RichTextComposerNg;
27class 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 */
34class MESSAGECOMPOSER_EXPORT SignatureController : public QObject
35{
36 Q_OBJECT
37public:
38 explicit SignatureController(QObject *parent = nullptr);
39 ~SignatureController() override;
40
41 void setEditor(MessageComposer::RichTextComposerNg *editor);
42 void setIdentityCombo(KIdentityManagementWidgets::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 KIdentityManagementCore::Signature &signature);
52
53public 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
71Q_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
78private:
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 MESSAGECOMPOSER_NO_EXPORT void insertSignatureHelper(KIdentityManagementCore::Signature::Placement placement);
85 MESSAGECOMPOSER_NO_EXPORT void identityChanged(uint id);
86
87 std::unique_ptr<SignatureControllerPrivate> const d;
88};
89}
The RichTextComposerNg class.
The SignatureController class Controls signature (the footer thing, not the crypto thing) operations ...
void enableHtml()
A HTML signature is about to be inserted, so enable HTML support in the editor.
void suspend()
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 18 2024 12:07:24 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.