29 #include "tdeemailsettings.h"
31 #include <tdeconfig.h>
32 #include <tdelocale.h>
35 class KEMailSettingsPrivate {
37 KEMailSettingsPrivate() : m_pConfig( 0 ) {}
38 ~KEMailSettingsPrivate() {
delete m_pConfig; }
40 TQStringList profiles;
41 TQString m_sDefaultProfile, m_sCurrentProfile;
46 return p->m_sDefaultProfile;
51 p->m_pConfig->setGroup(TQString(
"PROFILE_")+p->m_sCurrentProfile);
54 return p->m_pConfig->readEntry(
"EmailClient");
57 case ClientTerminal: {
58 return ((p->m_pConfig->readBoolEntry(
"TerminalClient")) ? TQString(
"true") : TQString(
"false") );
62 return p->m_pConfig->readEntry(
"FullName");
66 return p->m_pConfig->readEntry(
"EmailAddress");
69 case ReplyToAddress: {
70 return p->m_pConfig->readEntry(
"ReplyAddr");
74 return p->m_pConfig->readEntry(
"Organization");
78 return p->m_pConfig->readEntry(
"OutgoingServer");
81 case OutServerLogin: {
82 return p->m_pConfig->readEntry(
"OutgoingUserName");
86 return p->m_pConfig->readEntry(
"OutgoingPassword");
90 return p->m_pConfig->readEntry(
"OutgoingServerType");
93 case OutServerCommand: {
94 return p->m_pConfig->readEntry(
"OutgoingCommand");
98 return ((p->m_pConfig->readBoolEntry(
"OutgoingServerTLS")) ? TQString(
"true") : TQString(
"false") );
102 return p->m_pConfig->readEntry(
"IncomingServer");
105 case InServerLogin: {
106 return p->m_pConfig->readEntry(
"IncomingUserName");
110 return p->m_pConfig->readEntry(
"IncomingPassword");
114 return p->m_pConfig->readEntry(
"IncomingServerType");
117 case InServerMBXType: {
118 return p->m_pConfig->readEntry(
"IncomingServerMBXType");
122 return ((p->m_pConfig->readBoolEntry(
"IncomingServerTLS")) ? TQString(
"true") : TQString(
"false") );
126 return TQString::null;
130 p->m_pConfig->setGroup(TQString(
"PROFILE_")+p->m_sCurrentProfile);
132 case ClientProgram: {
133 p->m_pConfig->writePathEntry(
"EmailClient", v);
136 case ClientTerminal: {
137 p->m_pConfig->writeEntry(
"TerminalClient", (v ==
"true") ?
true :
false );
141 p->m_pConfig->writeEntry(
"FullName", v);
145 p->m_pConfig->writeEntry(
"EmailAddress", v);
148 case ReplyToAddress: {
149 p->m_pConfig->writeEntry(
"ReplyAddr", v);
153 p->m_pConfig->writeEntry(
"Organization", v);
157 p->m_pConfig->writeEntry(
"OutgoingServer", v);
160 case OutServerLogin: {
161 p->m_pConfig->writeEntry(
"OutgoingUserName", v);
164 case OutServerPass: {
165 p->m_pConfig->writeEntry(
"OutgoingPassword", v);
168 case OutServerType: {
169 p->m_pConfig->writeEntry(
"OutgoingServerType", v);
172 case OutServerCommand: {
173 p->m_pConfig->writeEntry(
"OutgoingCommand", v);
177 p->m_pConfig->writeEntry(
"OutgoingServerTLS", (v ==
"true") ?
true :
false );
181 p->m_pConfig->writeEntry(
"IncomingServer", v);
184 case InServerLogin: {
185 p->m_pConfig->writeEntry(
"IncomingUserName", v);
189 p->m_pConfig->writeEntry(
"IncomingPassword", v);
193 p->m_pConfig->writeEntry(
"IncomingServerType", v);
196 case InServerMBXType: {
197 p->m_pConfig->writeEntry(
"IncomingServerMBXType", v);
201 p->m_pConfig->writeEntry(
"IncomingServerTLS", (v ==
"true") ?
true :
false );
205 p->m_pConfig->sync();
210 p->m_pConfig->setGroup(
"Defaults");
211 p->m_pConfig->writeEntry(
"Profile", s);
212 p->m_pConfig->sync();
213 p->m_sDefaultProfile=s;
219 TQString groupname=
"PROFILE_";
221 p->m_sCurrentProfile=s;
222 if (!p->m_pConfig->hasGroup(groupname)) {
223 p->m_pConfig->setGroup(groupname);
224 p->m_pConfig->writeEntry(
"ServerType", TQString::null);
225 p->m_pConfig->sync();
232 return p->m_sCurrentProfile;
242 p =
new KEMailSettingsPrivate();
243 p->m_sCurrentProfile=TQString::null;
245 p->m_pConfig =
new TDEConfig(
"emaildefaults");
247 TQStringList groups = p->m_pConfig->groupList();
248 for (TQStringList::Iterator it = groups.begin(); it != groups.end(); ++it) {
249 if ( (*it).left(8) ==
"PROFILE_" )
250 p->profiles+= (*it).mid(8, (*it).length());
253 p->m_pConfig->setGroup(
"Defaults");
254 p->m_sDefaultProfile=p->m_pConfig->readEntry(
"Profile", i18n(
"Default"));
255 if (!p->m_sDefaultProfile.isNull()) {
256 if (!p->m_pConfig->hasGroup(TQString(
"PROFILE_")+p->m_sDefaultProfile))
261 if (p->profiles.count()) {
void setDefault(const TQString &def)
Sets a new default.
void setSetting(KEMailSettings::Setting s, const TQString &v)
Set one of the predefined "basic" settings.
TQString getSetting(KEMailSettings::Setting s)
Get one of the predefined "basic" settings.
TQString currentProfileName() const
Returns the name of the current profile.
TQStringList profiles() const
List of profiles available.
void setProfile(const TQString &s)
Change the current profile.
KEMailSettings()
Default constructor, just sets things up.
TQString defaultProfileName() const
Returns the name of the default profile.
~KEMailSettings()
Default destructor, nothing to see here.
Setting
The list of settings that I thought of when I wrote this class.