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 kemailsettings.h <KEMailSettings> |
19 | * |
20 | * This is just a small class to facilitate accessing e-mail settings in |
21 | * a sane way, and allowing any program to manage multiple e-mail |
22 | * profiles effortlessly |
23 | * |
24 | * The default profile is automatically selected in the constructor. |
25 | * |
26 | * @author Alex Zepeda zipzippy@sonic.net |
27 | **/ |
28 | class KCONFIGCORE_EXPORT KEMailSettings |
29 | { |
30 | Q_DECLARE_TR_FUNCTIONS(KEMailSettings) |
31 | public: |
32 | /** |
33 | * The list of settings that I thought of when I wrote this |
34 | * class. |
35 | * @see getSetting() |
36 | * @see setSetting() |
37 | **/ |
38 | enum Setting { |
39 | ClientProgram, |
40 | ClientTerminal, |
41 | RealName, |
42 | EmailAddress, |
43 | ReplyToAddress, |
44 | Organization, |
45 | }; |
46 | |
47 | /** |
48 | * Default constructor, just sets things up and sets the default profile |
49 | * as the current profile |
50 | **/ |
51 | KEMailSettings(); |
52 | |
53 | KEMailSettings(const KEMailSettings &) = delete; |
54 | KEMailSettings &operator=(const KEMailSettings &) = delete; |
55 | |
56 | /** |
57 | * Default destructor, nothing to see here. |
58 | **/ |
59 | ~KEMailSettings(); |
60 | |
61 | /** |
62 | * List of profiles available. |
63 | * @return the list of profiles |
64 | **/ |
65 | QStringList profiles() const; |
66 | |
67 | /** |
68 | * Change the current profile. |
69 | * @param s the name of the new profile |
70 | **/ |
71 | void setProfile(const QString &s); |
72 | |
73 | /** |
74 | * Returns the name of the default profile. |
75 | * @returns the name of the one that's currently default QString() if none |
76 | **/ |
77 | QString defaultProfileName() const; |
78 | |
79 | /** |
80 | * Sets a new default. |
81 | * @param def the new default |
82 | **/ |
83 | void setDefault(const QString &def); |
84 | |
85 | /** |
86 | * Get one of the predefined "basic" settings. |
87 | * @param s the setting to get |
88 | * @return the value of the setting, or QString() if not |
89 | * set |
90 | **/ |
91 | QString getSetting(KEMailSettings::Setting s) const; |
92 | |
93 | /** |
94 | * Set one of the predefined "basic" settings. |
95 | * @param s the setting to set |
96 | * @param v the new value of the setting, or QString() to |
97 | * unset |
98 | **/ |
99 | void setSetting(KEMailSettings::Setting s, const QString &v); |
100 | |
101 | private: |
102 | KEMailSettingsPrivate *const p; |
103 | }; |
104 | |
105 | #endif |
106 | |