33#include <QtCore/QMutableStringListIterator>
37class Settings::Private
43 QString defaultLanguage;
44 QString defaultClient;
48 bool backgroundCheckerEnabled;
49 bool checkerEnabledByDefault;
51 int disablePercentage;
54 QMap<QString, bool> ignore;
57Settings::Settings(
Loader *loader)
63 d->checkerEnabledByDefault =
false;
74 if (
cs.indexOf(lang) != -1 &&
75 d->defaultLanguage != lang) {
76 d->defaultLanguage = lang;
85 return d->defaultLanguage;
93 if (d->loader->clients().contains(client)) {
94 d->defaultClient = client;
102 return d->defaultClient;
107 if (d->checkUppercase != check) {
109 d->checkUppercase = check;
115 return d->checkUppercase;
120 if (d->skipRunTogether != skip) {
122 d->skipRunTogether = skip;
128 return d->skipRunTogether;
133 if (d->checkerEnabledByDefault != check) {
135 d->checkerEnabledByDefault = check;
141 return d->checkerEnabledByDefault;
146 if (d->backgroundCheckerEnabled != enable) {
148 d->backgroundCheckerEnabled = enable;
154 return d->backgroundCheckerEnabled;
159 setQuietIgnoreList(ignores);
163void Settings::setQuietIgnoreList(
const QStringList &ignores)
166 for (QStringList::const_iterator itr = ignores.begin();
167 itr != ignores.end(); ++itr) {
168 d->ignore.insert(*itr,
true);
174 return d->ignore.keys();
179 if (!d->ignore.contains(word)) {
181 d->ignore.insert( word,
true );
187 return d->ignore.contains( word );
190void Settings::readIgnoreList(
KConfig *config)
193 const QString ignoreEntry = QString::fromLatin1(
"ignore_%1" ).arg(d->defaultLanguage);
195 setQuietIgnoreList(ignores);
200 return d->disablePercentage;
205 return d->disableWordCount;
211 conf.
writeEntry(
"defaultClient", d->defaultClient);
212 conf.
writeEntry(
"defaultLanguage", d->defaultLanguage);
213 conf.
writeEntry(
"checkUppercase", d->checkUppercase);
214 conf.
writeEntry(
"skipRunTogether", d->skipRunTogether);
215 conf.
writeEntry(
"backgroundCheckerEnabled", d->backgroundCheckerEnabled);
216 conf.
writeEntry(
"checkerEnabledByDefault", d->checkerEnabledByDefault);
220 else if(!d->ignore.isEmpty())
229 d->defaultClient = conf.
readEntry(
"defaultClient",
236 "checkUppercase",
true);
239 "skipRunTogether",
true);
241 d->backgroundCheckerEnabled = conf.
readEntry(
242 "backgroundCheckerEnabled",
true);
244 d->checkerEnabledByDefault = conf.
readEntry(
245 "checkerEnabledByDefault",
false);
247 d->disablePercentage = conf.
readEntry(
"Sonnet_AsYouTypeDisablePercentage", 42);
248 d->disableWordCount = conf.
readEntry(
"Sonnet_AsYouTypeDisableWordCount", 100);
250 readIgnoreList(config);
A class for one specific group in a KConfig object.
T readEntry(const QString &key, const T &aDefault) const
Reads the value of an entry specified by pKey in the current group.
bool hasKey(const QString &key) const
Checks whether the key has an entry in this group.
void writeEntry(const QString &key, const QVariant &value, WriteConfigFlags pFlags=Normal)
Writes a value to the configuration object.
void deleteEntry(const QString &pKey, WriteConfigFlags pFlags=Normal)
Deletes the entry specified by pKey in the current group.
The central class of the KDE configuration data system.
Class used to deal with dictionaries.
void setSkipRunTogether(bool)
QString defaultClient() const
void setDefaultLanguage(const QString &lang)
bool checkUppercase() const
void setDefaultClient(const QString &client)
void setBackgroundCheckerEnabled(bool)
void save(KConfig *config)
QStringList currentIgnoreList() const
QString defaultLanguage() const
bool ignore(const QString &word)
void setModified(bool modified)
int disablePercentageWordError() const
bool backgroundCheckerEnabled() const
void setCheckerEnabledByDefault(bool)
void restore(KConfig *config)
void setCurrentIgnoreList(const QStringList &ignores)
void setCheckUppercase(bool)
void addWordToIgnore(const QString &word)
bool skipRunTogether() const
int disableWordErrorCount() const
bool checkerEnabledByDefault() const
static Qt::CaseSensitivity cs
KLocale * locale()
Returns the global locale object.