32 #include <QtCore/QMap>
33 #include <QtCore/QMutableStringListIterator>
37 class Settings::Private
51 int disablePercentage;
57 Settings::Settings(Loader *loader)
63 d->checkerEnabledByDefault =
false;
71 void Settings::setDefaultLanguage(
const QString &lang)
75 d->defaultLanguage != lang) {
76 d->defaultLanguage = lang;
85 return d->defaultLanguage;
88 void Settings::setDefaultClient(
const QString &client)
93 if (d->loader->clients().contains(client)) {
94 d->defaultClient = client;
102 return d->defaultClient;
105 void Settings::setCheckUppercase(
bool check)
107 if (d->checkUppercase != check) {
109 d->checkUppercase = check;
113 bool Settings::checkUppercase()
const
115 return d->checkUppercase;
118 void Settings::setSkipRunTogether(
bool skip)
120 if (d->skipRunTogether != skip) {
122 d->skipRunTogether = skip;
126 bool Settings::skipRunTogether()
const
128 return d->skipRunTogether;
131 void Settings::setCheckerEnabledByDefault(
bool check)
133 if (d->checkerEnabledByDefault != check) {
135 d->checkerEnabledByDefault = check;
139 bool Settings::checkerEnabledByDefault()
const
141 return d->checkerEnabledByDefault;
144 void Settings::setBackgroundCheckerEnabled(
bool enable)
146 if (d->backgroundCheckerEnabled != enable) {
148 d->backgroundCheckerEnabled = enable;
152 bool Settings::backgroundCheckerEnabled()
const
154 return d->backgroundCheckerEnabled;
159 setQuietIgnoreList(ignores);
163 void Settings::setQuietIgnoreList(
const QStringList &ignores)
167 itr != ignores.
end(); ++itr) {
168 d->ignore.
insert(*itr,
true);
174 return d->ignore.keys();
177 void Settings::addWordToIgnore(
const QString &word)
179 if (!d->ignore.contains(word)) {
181 d->ignore.
insert( word,
true );
187 return d->ignore.contains( word );
195 setQuietIgnoreList(ignores);
198 int Settings::disablePercentageWordError()
const
200 return d->disablePercentage;
203 int 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);
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);
250 readIgnoreList(config);
254 bool Settings::modified()
const
259 void Settings::setModified(
bool modified)
261 d->modified = modified;
bool checkUppercase() const
static Qt::CaseSensitivity cs
QString defaultLanguage() const
bool checkerEnabledByDefault() const
void writeEntry(const QString &key, const QVariant &value, WriteConfigFlags pFlags=Normal)
Writes a value to the configuration object.
bool skipRunTogether() const
KSharedConfigPtr config()
Returns the general config object.
void deleteEntry(const QString &pKey, WriteConfigFlags pFlags=Normal)
Deletes the entry specified by pKey in the current group.
bool hasKey(const QString &key) const
Checks whether the key has an entry in this group.
KLocale * locale()
Returns the global locale object.
A class for one specific group in a KConfig object.
The central class of the KDE configuration data system.
void insert(int i, const T &value)
QString defaultClient() const
bool ignore(const QString &word)
QString fromLatin1(const char *str, int size)
bool backgroundCheckerEnabled() const
int indexOf(const QRegExp &rx, int from) const
iterator insert(const Key &key, const T &value)
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
T readEntry(const QString &key, const T &aDefault) const
Reads the value of an entry specified by pKey in the current group.