• Skip to content
  • Skip to link menu
KDE 4.6 API Reference
  • KDE API Reference
  • kdelibs
  • KDE Home
  • Contact Us
 

Sonnet

kspell_hunspelldict.cpp

Go to the documentation of this file.
00001 
00021 #include "kspell_hunspelldict.h"
00022 #include <QFileInfo>
00023 
00024 #include <kdebug.h>
00025 
00026 #include <QtCore/QTextCodec>
00027 
00028 using namespace Sonnet;
00029 
00030 HunspellDict::HunspellDict( const QString& lang )
00031     : SpellerPlugin(lang), m_speller(0)
00032 {
00033     kDebug()<<" HunspellDict::HunspellDict( const QString& lang ):"<<lang;
00034         QString dic=QString("/usr/share/myspell/dicts/%1.dic").arg(lang);
00035     if (QFileInfo(dic).exists())
00036         m_speller = new Hunspell(QString("/usr/share/myspell/dicts/%1.aff").arg(lang).toUtf8().constData(),dic.toUtf8().constData());
00037     else
00038         m_speller = 0;
00039     kDebug()<<" dddddd "<<m_speller;
00040 
00041 }
00042 
00043 HunspellDict::~HunspellDict()
00044 {
00045     delete m_speller;
00046 }
00047 
00048 bool HunspellDict::isCorrect(const QString &word) const
00049 {
00050     kDebug()<<" isCorrect :"<<word;
00051     if(!m_speller)
00052         return false;
00053     int result = m_speller->spell(word.toUtf8());
00054     kDebug()<<" result :"<<result;
00055     return (result != 0) ;
00056 }
00057 
00058 QStringList HunspellDict::suggest(const QString &word) const
00059 {
00060     if(!m_speller)
00061         return QStringList();
00062     char ** selection;
00063     QStringList lst;
00064     int nbWord = m_speller->suggest(&selection, word.toUtf8());
00065     for(int i = 0; i <nbWord;++i)
00066     {
00067         lst << QString::fromUtf8(selection[i]);
00068     }
00069     m_speller->free_list(&selection, nbWord);
00070     return lst;
00071 }
00072 
00073 
00074 bool HunspellDict::storeReplacement( const QString& bad,
00075                                    const QString& good )
00076 {
00077     if (!m_speller)
00078         return false;
00079     kDebug()<<"HunspellDict::storeReplacement not implemented";
00080     return false;
00081 }
00082 
00083 bool HunspellDict::addToPersonal( const QString& word )
00084 {
00085     if (!m_speller)
00086         return false;
00087     m_speller->add(word.toUtf8());
00088     return false;
00089 }
00090 
00091 bool HunspellDict::addToSession( const QString& word )
00092 {
00093     if (!m_speller)
00094         return false;
00095     kDebug()<<" bool HunspellDict::addToSession not implemented";
00096     return false;
00097 }

Sonnet

Skip menu "Sonnet"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.7.3
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal