File indexing completed on 2024-05-12 15:34:12
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. Any extra settings thought of later can be accessed 0035 * easily with getExtendedSetting and setExtendedSetting. 0036 * @see getSetting() 0037 * @see setSetting() 0038 * @see getExtendedSetting() 0039 * @see setExtendedSetting() 0040 **/ 0041 enum Setting { 0042 ClientProgram, 0043 ClientTerminal, 0044 RealName, 0045 EmailAddress, 0046 ReplyToAddress, 0047 Organization, 0048 OutServer, 0049 OutServerLogin, 0050 OutServerPass, 0051 #if KCONFIGCORE_ENABLE_DEPRECATED_SINCE(5, 0) 0052 /** 0053 * @deprecated since 5.0 0054 */ 0055 OutServerType KCONFIGCORE_ENUMERATOR_DEPRECATED_VERSION_BELATED(5, 82, 5, 0, "No known users"), 0056 /** 0057 * @deprecated since 5.0 0058 */ 0059 OutServerCommand KCONFIGCORE_ENUMERATOR_DEPRECATED_VERSION_BELATED(5, 82, 5, 0, "No known users"), 0060 /** 0061 * @deprecated since 5.0 0062 */ 0063 OutServerTLS KCONFIGCORE_ENUMERATOR_DEPRECATED_VERSION_BELATED(5, 82, 5, 0, "No known users"), 0064 #else 0065 OutServerType_DEPRECATED_DO_NOT_USE, 0066 OutServerCommand_DEPRECATED_DO_NOT_USE, 0067 OutServerTLS_DEPRECATED_DO_NOT_USE, 0068 #endif 0069 InServer, 0070 InServerLogin, 0071 InServerPass, 0072 #if KCONFIGCORE_ENABLE_DEPRECATED_SINCE(5, 0) 0073 /** 0074 * @deprecated since 5.0 0075 */ 0076 InServerType KCONFIGCORE_ENUMERATOR_DEPRECATED_VERSION_BELATED(5, 82, 5, 0, "No known users"), 0077 /** 0078 * @deprecated since 5.0 0079 */ 0080 InServerMBXType KCONFIGCORE_ENUMERATOR_DEPRECATED_VERSION_BELATED(5, 82, 5, 0, "No known users"), 0081 /** 0082 * @deprecated since 5.0 0083 */ 0084 InServerTLS KCONFIGCORE_ENUMERATOR_DEPRECATED_VERSION_BELATED(5, 82, 5, 0, "No known users") 0085 #endif 0086 }; 0087 0088 /** 0089 * The various extensions allowed. 0090 **/ 0091 enum Extension { 0092 POP3, 0093 SMTP, 0094 OTHER, 0095 }; 0096 0097 /** 0098 * Default constructor, just sets things up and sets the default profile 0099 * as the current profile 0100 **/ 0101 KEMailSettings(); 0102 0103 KEMailSettings(const KEMailSettings &) = delete; 0104 KEMailSettings &operator=(const KEMailSettings &) = delete; 0105 0106 /** 0107 * Default destructor, nothing to see here. 0108 **/ 0109 ~KEMailSettings(); 0110 0111 /** 0112 * List of profiles available. 0113 * @return the list of profiles 0114 **/ 0115 QStringList profiles() const; 0116 0117 #if KCONFIGCORE_ENABLE_DEPRECATED_SINCE(5, 0) 0118 /** 0119 * Returns the name of the current profile. 0120 * @returns what profile we're currently using 0121 * @deprecated Since 5.0 0122 **/ 0123 KCONFIGCORE_DEPRECATED_VERSION(5, 0, "API planned to be changed") 0124 QString currentProfileName() const; 0125 // see https://git.reviewboard.kde.org/r/111910/ 0126 #endif 0127 0128 /** 0129 * Change the current profile. 0130 * @param s the name of the new profile 0131 **/ 0132 void setProfile(const QString &s); 0133 0134 /** 0135 * Returns the name of the default profile. 0136 * @returns the name of the one that's currently default QString() if none 0137 **/ 0138 QString defaultProfileName() const; 0139 0140 /** 0141 * Sets a new default. 0142 * @param def the new default 0143 **/ 0144 void setDefault(const QString &def); 0145 0146 /** 0147 * Get one of the predefined "basic" settings. 0148 * @param s the setting to get 0149 * @return the value of the setting, or QString() if not 0150 * set 0151 **/ 0152 QString getSetting(KEMailSettings::Setting s) const; 0153 0154 /** 0155 * Set one of the predefined "basic" settings. 0156 * @param s the setting to set 0157 * @param v the new value of the setting, or QString() to 0158 * unset 0159 **/ 0160 void setSetting(KEMailSettings::Setting s, const QString &v); 0161 0162 private: 0163 KEMailSettingsPrivate *const p; 0164 }; 0165 0166 #endif