File indexing completed on 2024-05-12 03:54:27
0001 /* 0002 SPDX-FileCopyrightText: 2000 Alex Zepeda <zipzippy@sonic.net> 0003 0004 SPDX-License-Identifier: BSD-2-Clause 0005 */ 0006 0007 #ifndef _KEMAILSETTINGS_H 0008 #define _KEMAILSETTINGS_H 0009 0010 #include <QCoreApplication> // Q_DECLARE_TR_FUNCTIONS 0011 #include <QStringList> 0012 0013 #include <kconfigcore_export.h> 0014 0015 class KEMailSettingsPrivate; 0016 0017 /** 0018 * \class KEMailSettings kemailsettings.h <KEMailSettings> 0019 * 0020 * This is just a small class to facilitate accessing e-mail settings in 0021 * a sane way, and allowing any program to manage multiple e-mail 0022 * profiles effortlessly 0023 * 0024 * The default profile is automatically selected in the constructor. 0025 * 0026 * @author Alex Zepeda zipzippy@sonic.net 0027 **/ 0028 class KCONFIGCORE_EXPORT KEMailSettings 0029 { 0030 Q_DECLARE_TR_FUNCTIONS(KEMailSettings) 0031 public: 0032 /** 0033 * The list of settings that I thought of when I wrote this 0034 * class. 0035 * @see getSetting() 0036 * @see setSetting() 0037 **/ 0038 enum Setting { 0039 ClientProgram, 0040 ClientTerminal, 0041 RealName, 0042 EmailAddress, 0043 ReplyToAddress, 0044 Organization, 0045 }; 0046 0047 /** 0048 * Default constructor, just sets things up and sets the default profile 0049 * as the current profile 0050 **/ 0051 KEMailSettings(); 0052 0053 KEMailSettings(const KEMailSettings &) = delete; 0054 KEMailSettings &operator=(const KEMailSettings &) = delete; 0055 0056 /** 0057 * Default destructor, nothing to see here. 0058 **/ 0059 ~KEMailSettings(); 0060 0061 /** 0062 * List of profiles available. 0063 * @return the list of profiles 0064 **/ 0065 QStringList profiles() const; 0066 0067 /** 0068 * Change the current profile. 0069 * @param s the name of the new profile 0070 **/ 0071 void setProfile(const QString &s); 0072 0073 /** 0074 * Returns the name of the default profile. 0075 * @returns the name of the one that's currently default QString() if none 0076 **/ 0077 QString defaultProfileName() const; 0078 0079 /** 0080 * Sets a new default. 0081 * @param def the new default 0082 **/ 0083 void setDefault(const QString &def); 0084 0085 /** 0086 * Get one of the predefined "basic" settings. 0087 * @param s the setting to get 0088 * @return the value of the setting, or QString() if not 0089 * set 0090 **/ 0091 QString getSetting(KEMailSettings::Setting s) const; 0092 0093 /** 0094 * Set one of the predefined "basic" settings. 0095 * @param s the setting to set 0096 * @param v the new value of the setting, or QString() to 0097 * unset 0098 **/ 0099 void setSetting(KEMailSettings::Setting s, const QString &v); 0100 0101 private: 0102 KEMailSettingsPrivate *const p; 0103 }; 0104 0105 #endif