1 | /* |
2 | SPDX-FileCopyrightText: 2000 Alex Zepeda <zipzippy@sonic.net> |
3 | |
4 | SPDX-License-Identifier: BSD-2-Clause |
5 | */ |
6 | |
7 | #ifndef _KEMAILSETTINGS_H |
8 | #define _KEMAILSETTINGS_H |
9 | |
10 | #include <QCoreApplication> // Q_DECLARE_TR_FUNCTIONS |
11 | #include <QStringList> |
12 | |
13 | #include <kconfigcore_export.h> |
14 | |
15 | class KEMailSettingsPrivate; |
16 | |
17 | /*! |
18 | * \class KEMailSettings |
19 | * \inmodule KConfigCore |
20 | * |
21 | * \brief Access to e-mail settings. |
22 | * |
23 | * This is just a small class to facilitate accessing e-mail settings in |
24 | * a sane way, and allowing any program to manage multiple e-mail |
25 | * profiles effortlessly |
26 | * |
27 | * The default profile is automatically selected in the constructor. |
28 | **/ |
29 | class KCONFIGCORE_EXPORT KEMailSettings |
30 | { |
31 | Q_DECLARE_TR_FUNCTIONS(KEMailSettings) |
32 | public: |
33 | /*! |
34 | * The list of settings that I thought of when I wrote this |
35 | * class. |
36 | * |
37 | * \value ClientProgram |
38 | * \value ClientTerminal |
39 | * \value RealName |
40 | * \value EmailAddress |
41 | * \value ReplyToAddress |
42 | * \value Organization |
43 | * |
44 | * \sa getSetting() |
45 | * \sa setSetting() |
46 | **/ |
47 | enum Setting { |
48 | ClientProgram, |
49 | ClientTerminal, |
50 | RealName, |
51 | EmailAddress, |
52 | ReplyToAddress, |
53 | Organization, |
54 | }; |
55 | |
56 | /*! |
57 | * Default constructor, just sets things up and sets the default profile |
58 | * as the current profile |
59 | **/ |
60 | KEMailSettings(); |
61 | |
62 | KEMailSettings(const KEMailSettings &) = delete; |
63 | KEMailSettings &operator=(const KEMailSettings &) = delete; |
64 | |
65 | ~KEMailSettings(); |
66 | |
67 | /*! |
68 | * Returns the list of profiles available. |
69 | **/ |
70 | QStringList profiles() const; |
71 | |
72 | /*! |
73 | * Change the current profile. |
74 | * |
75 | * \a s the name of the new profile |
76 | **/ |
77 | void setProfile(const QString &s); |
78 | |
79 | /*! |
80 | * Returns the name of the default profile. |
81 | **/ |
82 | QString defaultProfileName() const; |
83 | |
84 | /*! |
85 | * Sets a new default. |
86 | * |
87 | * \a def the new default |
88 | **/ |
89 | void setDefault(const QString &def); |
90 | |
91 | /*! |
92 | * Get one of the predefined "basic" settings. |
93 | * |
94 | * \a s the setting to get |
95 | * |
96 | * Returns the value of the setting, or QString() if not |
97 | * set |
98 | **/ |
99 | QString getSetting(KEMailSettings::Setting s) const; |
100 | |
101 | /*! |
102 | * Set one of the predefined "basic" settings. |
103 | * |
104 | * \a s the setting to set |
105 | * |
106 | * \a v the new value of the setting, or QString() to unset |
107 | **/ |
108 | void setSetting(KEMailSettings::Setting s, const QString &v); |
109 | |
110 | private: |
111 | KEMailSettingsPrivate *const p; |
112 | }; |
113 | |
114 | #endif |
115 | |