33#include <QtCore/QMutableStringListIterator>
37class Settings::Private
51 int disablePercentage;
57Settings::Settings(Loader *loader)
63 d->checkerEnabledByDefault =
false;
71void Settings::setDefaultLanguage(
const QString &lang)
74 if (
cs.indexOf(lang) != -1 &&
75 d->defaultLanguage != lang) {
76 d->defaultLanguage = lang;
85 return d->defaultLanguage;
88void Settings::setDefaultClient(
const QString &client)
93 if (d->loader->clients().contains(client)) {
94 d->defaultClient = client;
102 return d->defaultClient;
105void Settings::setCheckUppercase(
bool check)
107 if (d->checkUppercase != check) {
109 d->checkUppercase = check;
113bool Settings::checkUppercase()
const
115 return d->checkUppercase;
118void Settings::setSkipRunTogether(
bool skip)
120 if (d->skipRunTogether != skip) {
122 d->skipRunTogether = skip;
126bool Settings::skipRunTogether()
const
128 return d->skipRunTogether;
131void Settings::setCheckerEnabledByDefault(
bool check)
133 if (d->checkerEnabledByDefault != check) {
135 d->checkerEnabledByDefault = check;
139bool Settings::checkerEnabledByDefault()
const
141 return d->checkerEnabledByDefault;
144void Settings::setBackgroundCheckerEnabled(
bool enable)
146 if (d->backgroundCheckerEnabled != enable) {
148 d->backgroundCheckerEnabled = enable;
152bool Settings::backgroundCheckerEnabled()
const
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();
177void Settings::addWordToIgnore(
const QString &word)
179 if (!d->ignore.contains(word)) {
181 d->ignore.insert( word,
true );
187 return d->ignore.contains( word );
193 const QString ignoreEntry = QString::fromLatin1(
"ignore_%1" ).arg(d->defaultLanguage);
195 setQuietIgnoreList(ignores);
198int Settings::disablePercentageWordError()
const
200 return d->disablePercentage;
203int Settings::disableWordErrorCount()
const
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);
217 QString defaultLanguage = QString::fromLatin1(
"ignore_%1" ).arg(d->defaultLanguage);
218 if(conf.
hasKey(defaultLanguage) && d->ignore.isEmpty())
220 else if(!d->ignore.isEmpty())
221 conf.
writeEntry(defaultLanguage, d->ignore.keys());
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);
254bool Settings::modified()
const
259void Settings::setModified(
bool modified)
261 d->modified = modified;
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.
QString defaultClient() const
bool checkUppercase() const
QString defaultLanguage() const
bool ignore(const QString &word)
bool backgroundCheckerEnabled() const
bool skipRunTogether() const
bool checkerEnabledByDefault() const
static Qt::CaseSensitivity cs
KLocale * locale()
Returns the global locale object.
KSharedConfigPtr config()
Returns the general config object.