9#include "settingsimpl_p.h"
10#include "spellerplugin_p.h"
12#include "core_debug.h"
31 Loader *loader = Loader::openLoader();
32 settings = loader->settings();
40 dict = Loader::openLoader()->cachedSpeller(language);
45 if (settings->modified()) {
47 settings->setModified(
false);
54 Loader::openLoader()->clearSpellerCache();
59 SettingsImpl *settings =
nullptr;
63Speller::Speller(
const QString &lang)
64 : d(new SpellerPrivate)
71 qCDebug(SONNET_LOG_CORE) <<
"deleting" <<
this <<
"for" << d->language;
74Speller::Speller(
const Speller &speller)
75 : d(new SpellerPrivate)
77 d->language = speller.language();
81Speller &Speller::operator=(
const Speller &speller)
83 d->language = speller.language();
88bool Speller::isCorrect(
const QString &word)
const
93 return d->dict->isCorrect(word);
96bool Speller::isMisspelled(
const QString &word)
const
101 return d->dict->isMisspelled(word);
109 return d->dict->suggest(word);
117 return d->dict->checkAndSuggest(word, suggestions);
125 return d->dict->storeReplacement(bad, good);
128bool Speller::addToPersonal(
const QString &word)
133 return d->dict->addToPersonal(word);
136bool Speller::addToSession(
const QString &word)
141 return d->dict->addToSession(word);
149 return d->dict->language();
159void Speller::restore()
162 d->settings->restore();
169 Loader *l = Loader::openLoader();
175 Loader *l = Loader::openLoader();
176 return l->languages();
181 Loader *l = Loader::openLoader();
182 return l->languageNames();
185void Speller::setDefaultLanguage(
const QString &lang)
187 if (d->settings->setDefaultLanguage(lang)) {
192QString Speller::defaultLanguage()
const
194 return d->settings->defaultLanguage();
197void Speller::setDefaultClient(
const QString &client)
199 if (d->settings->setDefaultClient(client)) {
204QString Speller::defaultClient()
const
206 return d->settings->defaultClient();
209void Speller::setAttribute(Attribute attr,
bool b)
213 d->settings->setCheckUppercase(b);
215 case SkipRunTogether:
216 d->settings->setSkipRunTogether(b);
218 case AutoDetectLanguage:
219 d->settings->setAutodetectLanguage(b);
225bool Speller::testAttribute(Attribute attr)
const
229 return d->settings->checkUppercase();
230 case SkipRunTogether:
231 return d->settings->skipRunTogether();
232 case AutoDetectLanguage:
233 return d->settings->autodetectLanguage();
238bool Speller::isValid()
const
251 Loader *l = Loader::openLoader();
255 for (
const QString &tag : lst) {
256 langs.
insert(l->languageNameForCode(tag), tag);
264 Loader *l = Loader::openLoader();
267 for (
const QString &tag : l->settings()->preferredLanguages()) {
268 langs.
insert(l->languageNameForCode(tag), tag);
QMap< QString, QString > preferredDictionaries() const
QMap< QString, QString > availableDictionaries() const
iterator insert(const Key &key, const T &value)
bool isNull() const const
bool isNull() const const