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 { ShowCode, ShowHtml };
45
46 /**
47 * Indicated if the user wants a signature
48 */
49 [[nodiscard]] bool isSignatureEnabled() const;
50
51 /**
52 * Use this to activate the signature.
53 */
54 void setSignatureEnabled(bool enable);
55
56 /**
57 * This returns the type of the signature,
58 * so that can be Disabled, Inline, fromFile, etc.
59 */
60 [[nodiscard]] Signature::Type signatureType() const;
61
62 /**
63 * Set the signature type to @p type.
64 */
65 void setSignatureType(Signature::Type type);
66
67 /**
68 * Make @p text the text for the signature.
69 */
70 void setInlineText(const QString &text);
71
72 /**
73 * Returns the file url which the user wants
74 * to use as a signature.
75 */
76 [[nodiscard]] QString filePath() const;
77
78 /**
79 * Set @p url for the file url part of the
80 * widget.
81 */
82 void setFileURL(const QString &url);
83
84 /**
85 * Returns the url of the command which the
86 * users wants to use as signature.
87 */
88 [[nodiscard]] QString commandPath() const;
89
90 /**
91 * Sets @p url as the command to execute.
92 */
93 void setCommandURL(const QString &url);
94
95 /**
96 Convenience method.
97 @return a Signature object representing the state of the widgets.
98 **/
99 [[nodiscard]] Signature signature() const;
100
101 /**
102 Convenience method. Sets the widgets according to @p sig
103 @param sig the signature to configure
104 **/
105 void setSignature(const Signature &sig);
106
107 /**
108 * Sets the directory where the images used in the HTML signature will be stored.
109 * Needs to be called before calling setSignature(), as each signature should use
110 * a different location.
111 * The directory needs to exist, it will not be created.
112 * @param path the image location to set
113 * @since 4.4
114 * @sa Signature::setImageLocation
115 */
116 void setImageLocation(const QString &path);
117
118 /**
119 * Sets the image location to the image location of a given identity, which is
120 * emailidentities/<identity-id>/.
121 *
122 * @param identity The identity whose unique ID will be used to determine the image
123 * location.
124 * @since 4.4
125 */
126 void setImageLocation(const KIdentityManagementCore::Identity &identity);
127
128private:
129 KIDENTITYMANAGEMENTWIDGETS_NO_EXPORT void slotUrlChanged();
130 KIDENTITYMANAGEMENTWIDGETS_NO_EXPORT void slotEdit();
131 KIDENTITYMANAGEMENTWIDGETS_NO_EXPORT void slotSetHtml();
132
133 //@cond PRIVATE
134 friend class SignatureConfiguratorPrivate;
135 std::unique_ptr<SignatureConfiguratorPrivate> const d;
136 //@endcond
137};
138}
User identity information.
Definition identity.h:72
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 Tue Mar 26 2024 11:20:09 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.