~beernarrd/ubuntu-keyboard/slovenian-layout

« back to all changes in this revision

Viewing changes to plugins/westernsupport/spellchecker.cpp

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release
  • Date: 2014-05-27 15:37:47 UTC
  • mto: This revision was merged to the branch mainline in revision 44.
  • Revision ID: package-import@ubuntu.com-20140527153747-1kyarbk91aon0tu6
Tags: upstream-0.99.trunk.phablet2+14.10.20140527
ImportĀ upstreamĀ versionĀ 0.99.trunk.phablet2+14.10.20140527

Show diffs side-by-side

added added

removed removed

Lines of Context:
241
241
    d->ignored_words.insert(word);
242
242
}
243
243
 
244
 
//! \brief Adds a given word to user dictionary.
 
244
//! \brief Adds a given word to user's permanent dictionary.
245
245
//! \param word The word to be added to user dictionary - it will be used for
246
246
//!             spellchecking and suggesting.
247
247
void SpellChecker::addToUserWordlist(const QString &word)
248
248
{
249
249
    Q_D(SpellChecker);
250
250
 
251
 
    if (not enabled()) {
 
251
    if (spell(word)) {
252
252
        return;
253
253
    }
254
254
 
259
259
        stream << word << endl;
260
260
    }
261
261
 
 
262
    updateWord(word);
 
263
}
 
264
 
 
265
//! \brief Adds a new word to the current hunspell instance
 
266
//! \param word The word to be added to the current runtime dictionary
 
267
void SpellChecker::updateWord(const QString &word)
 
268
{
 
269
    Q_D(SpellChecker);
 
270
 
 
271
    if(not enabled()) {
 
272
        return;
 
273
    }
 
274
 
262
275
    // Non-zero return value means some error.
263
276
    if (d->hunspell->add(d->codec->fromUnicode(word))) {
264
277
        qWarning() << __PRETTY_FUNCTION__ << ": Failed to add '" << word << "' to user dictionary.";
292
305
        return false;
293
306
    }
294
307
 
295
 
    d->aff_file = dictPath() + "/" + affMatches[0];
296
 
    d->dic_file = dictPath() + "/" + dicMatches[0];
 
308
    d->aff_file = dictPath() + QDir::separator() + affMatches[0];
 
309
    d->dic_file = dictPath() + QDir::separator() + dicMatches[0];
 
310
    d->user_dictionary_file = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QDir::separator() + language + "_userDictionary.dic";
297
311
 
298
 
    qDebug() << "spellechecker.cpp in setLanguage() aff_file=" << d->aff_file << "dic_file=" << d->dic_file;
 
312
    qDebug() << "spellechecker.cpp in setLanguage() aff_file=" << d->aff_file << "dic_file=" << d->dic_file << "user dictionary=" << d->user_dictionary_file;
299
313
 
300
314
    if (enabled()) {
301
315
        setEnabled(false);