34 class KEMailSettingsPrivate {
36 KEMailSettingsPrivate() : m_pConfig( 0 ) {}
37 ~KEMailSettingsPrivate() {
delete m_pConfig; }
40 QString m_sDefaultProfile, m_sCurrentProfile;
45 return p->m_sDefaultProfile;
50 KConfigGroup cg( p->m_pConfig, QString(
"PROFILE_")+p->m_sCurrentProfile);
56 case ClientTerminal: {
57 return cg.
readEntry(
"TerminalClient", QVariant(
false)).toString();
68 case ReplyToAddress: {
80 case OutServerLogin: {
89 return cg.
readEntry(
"OutgoingServerType");
92 case OutServerCommand: {
97 return cg.
readEntry(
"OutgoingServerTLS", QVariant(
false)).toString();
104 case InServerLogin: {
113 return cg.
readEntry(
"IncomingServerType");
116 case InServerMBXType: {
117 return cg.
readEntry(
"IncomingServerMBXType");
121 return cg.
readEntry(
"IncomingServerTLS", QVariant(
false)).toString();
129 KConfigGroup cg( p->m_pConfig, QString(
"PROFILE_")+p->m_sCurrentProfile);
131 case ClientProgram: {
135 case ClientTerminal: {
136 cg.
writeEntry(
"TerminalClient", (v ==
"true") );
147 case ReplyToAddress: {
159 case OutServerLogin: {
163 case OutServerPass: {
167 case OutServerType: {
171 case OutServerCommand: {
176 cg.
writeEntry(
"OutgoingServerTLS", (v ==
"true") );
183 case InServerLogin: {
195 case InServerMBXType: {
200 cg.
writeEntry(
"IncomingServerTLS", (v ==
"true") );
209 p->m_pConfig->group(
"Defaults").writeEntry(
"Profile", s);
210 p->m_pConfig->sync();
211 p->m_sDefaultProfile=s;
217 QString groupname=
"PROFILE_";
219 p->m_sCurrentProfile=s;
220 if (!p->m_pConfig->hasGroup(groupname)) {
229 return p->m_sCurrentProfile;
238 :p(new KEMailSettingsPrivate())
240 p->m_sCurrentProfile.clear();
242 p->m_pConfig =
new KConfig(
"emaildefaults");
244 const QStringList groups = p->m_pConfig->groupList();
245 for (QStringList::ConstIterator it = groups.begin(); it != groups.end(); ++it) {
246 if ( (*it).startsWith( QLatin1String(
"PROFILE_" ) ) )
247 p->profiles+= (*it).mid(8, (*it).length());
251 p->m_sDefaultProfile = cg.
readEntry(
"Profile",
i18n(
"Default"));
252 if (!p->m_sDefaultProfile.isNull()) {
253 if (!p->m_pConfig->hasGroup(QString(
"PROFILE_")+p->m_sDefaultProfile))
258 if (p->profiles.count()) {
QString i18n(const char *text)
~KEMailSettings()
Default destructor, nothing to see here.
void writePathEntry(const QString &pKey, const QString &path, WriteConfigFlags pFlags=Normal)
QStringList profiles() const
List of profiles available.
void writeEntry(const QString &key, const QVariant &value, WriteConfigFlags pFlags=Normal)
void setSetting(KEMailSettings::Setting s, const QString &v)
Set one of the predefined "basic" settings.
Setting
The list of settings that I thought of when I wrote this class.
QString defaultProfileName() const
Returns the name of the default profile.
void setProfile(const QString &s)
Change the current profile.
void setDefault(const QString &def)
Sets a new default.
KEMailSettings()
Default constructor, just sets things up.
QString currentProfileName() const
Returns the name of the current profile.
QString getSetting(KEMailSettings::Setting s) const
Get one of the predefined "basic" settings.
T readEntry(const QString &key, const T &aDefault) const