Go to the documentation of this file.
25#include <QtCore/QTextCodec>
32 m_config = new_aspell_config();
33 aspell_config_replace( m_config,
"lang", lang.toLatin1() );
36 aspell_config_replace( m_config,
"encoding",
"utf-8" );
40 aspell_config_replace( m_config,
"data-dir",
aspell_data_dir().toLocal8Bit().data());
41 aspell_config_replace( m_config,
"dict-dir",
aspell_data_dir().toLocal8Bit().data());
44 AspellCanHaveError * possible_err = new_aspell_speller( m_config );
46 if ( aspell_error_number( possible_err ) != 0 )
47 kDebug()<<
"Error : "<< aspell_error_message( possible_err );
49 m_speller = to_aspell_speller( possible_err );
55 delete_aspell_speller( m_speller );
56 delete_aspell_config( m_config );
65 int correct = aspell_speller_check( m_speller, word.toUtf8(), word.toUtf8().length() );
74 QTextCodec *codec = QTextCodec::codecForName(
"utf8");
78 const AspellWordList * suggestions = aspell_speller_suggest( m_speller,
80 word.toUtf8().length() );
82 AspellStringEnumeration * elements = aspell_word_list_elements( suggestions );
87 while ( (cword = aspell_string_enumeration_next( elements )) ) {
90 qsug.append( codec->toUnicode( cword ) );
93 delete_aspell_string_enumeration( elements );
105 return aspell_speller_store_replacement( m_speller,
106 bad.toUtf8(), bad.toUtf8().length(),
107 good.toUtf8(), good.toUtf8().length() );
114 kDebug() <<
"ASpellDict::addToPersonal: word = " << word;
117 aspell_speller_add_to_personal( m_speller, word.toUtf8(),
118 word.toUtf8().length() );
122 return aspell_speller_save_all_word_lists( m_speller );
131 return aspell_speller_add_to_session( m_speller, word.toUtf8(),
132 word.toUtf8().length() );
virtual QStringList suggest(const QString &word) const
virtual bool isCorrect(const QString &word) const
virtual bool addToPersonal(const QString &word)
virtual bool storeReplacement(const QString &bad, const QString &good)
ASpellDict(const QString &lang)
virtual bool addToSession(const QString &word)
SpellerPlugin(const QString &lang)
QString aspell_data_dir()
This file is part of the KDE documentation.
Documentation copyright © 1996-2026 The KDE developers.
Generated on
by
doxygen 1.18.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.