KIdentityManagement

signatureconfigurator.h
1/* -*- c++ -*-
2 SPDX-FileCopyrightText: 2008 Thomas McGuire <Thomas.McGuire@gmx.net>
3 SPDX-FileCopyrightText: 2008 Edwin Schepers <yez@familieschepers.nl>
4 SPDX-FileCopyrightText: 2008 Tom Albers <tomalbers@kde.nl>
5 SPDX-FileCopyrightText: 2004 Marc Mutz <mutz@kde.org>
6
7 SPDX-License-Identifier: LGPL-2.1-or-later
8*/
9
10#pragma once
11
12#include "kidentitymanagementwidgets_export.h"
13#include <KIdentityManagementCore/Signature> // for Signature::Type
14#include <QWidget>
15#include <memory>
16
18
19namespace KIdentityManagementWidgets
20{
21class SignatureConfiguratorPrivate;
22/**
23 * This widget gives an interface so users can edit their signature.
24 * You can set a signature via setSignature(), let the user edit the
25 * signature and when done, read the signature back.
26 */
27class KIDENTITYMANAGEMENTWIDGETS_EXPORT SignatureConfigurator : public QWidget
28{
29 Q_OBJECT
30public:
31 /**
32 * Constructor
33 */
34 explicit SignatureConfigurator(QWidget *parent = nullptr);
35
36 /**
37 * destructor
38 */
40
41 /**
42 * Enum for the different viewmodes.
43 */
44 enum ViewMode {
45 ShowCode,
46 ShowHtml
47 };
48
49 /**
50 * Indicated if the user wants a signature
51 */
52 [[nodiscard]] bool isSignatureEnabled() const;
53
54 /**
55 * Use this to activate the signature.
56 */
57 void setSignatureEnabled(bool enable);
58
59 /**
60 * This returns the type of the signature,
61 * so that can be Disabled, Inline, fromFile, etc.
62 */
63 [[nodiscard]] Signature::Type signatureType() const;
64
65 /**
66 * Set the signature type to @p type.
67 */
68 void setSignatureType(Signature::Type type);
69
70 /**
71 * Make @p text the text for the signature.
72 */
73 void setInlineText(const QString &text);
74
75 /**
76 * Returns the file url which the user wants
77 * to use as a signature.
78 */
79 [[nodiscard]] QString filePath() const;
80
81 /**
82 * Set @p url for the file url part of the
83 * widget.
84 */
85 void setFileURL(const QString &url);
86
87 /**
88 * Returns the url of the command which the
89 * users wants to use as signature.
90 */
91 [[nodiscard]] QString commandPath() const;
92
93 /**
94 * Sets @p url as the command to execute.
95 */
96 void setCommandURL(const QString &url);
97
98 /**
99 Convenience method.
100 @return a Signature object representing the state of the widgets.
101 **/
102 [[nodiscard]] Signature signature() const;
103
104 /**
105 Convenience method. Sets the widgets according to @p sig
106 @param sig the signature to configure
107 **/
108 void setSignature(const Signature &sig);
109
110 /**
111 * Sets the directory where the images used in the HTML signature will be stored.
112 * Needs to be called before calling setSignature(), as each signature should use
113 * a different location.
114 * The directory needs to exist, it will not be created.
115 * @param path the image location to set
116 * @since 4.4
117 * @sa Signature::setImageLocation
118 */
119 void setImageLocation(const QString &path);
120
121 /**
122 * Sets the image location to the image location of a given identity, which is
123 * emailidentities/<identity-id>/.
124 *
125 * @param identity The identity whose unique ID will be used to determine the image
126 * location.
127 * @since 4.4
128 */
129 void setImageLocation(const KIdentityManagementCore::Identity &identity);
130
131private:
132 KIDENTITYMANAGEMENTWIDGETS_NO_EXPORT void slotUrlChanged();
133 KIDENTITYMANAGEMENTWIDGETS_NO_EXPORT void slotEdit();
134 KIDENTITYMANAGEMENTWIDGETS_NO_EXPORT void slotSetHtml();
135
136 //@cond PRIVATE
137 friend class SignatureConfiguratorPrivate;
138 std::unique_ptr<SignatureConfiguratorPrivate> const d;
139 //@endcond
140};
141}
User identity information.
Definition identity.h:74
Abstraction of a signature (aka "footer").
Definition signature.h:61
This widget gives an interface so users can edit their signature.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 6 2024 12:11:25 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.