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

Sonnet

  • sonnet
  • plugins
  • hunspell
kspell_hunspelldict.cpp
Go to the documentation of this file.
1
21#include "kspell_hunspelldict.h"
22#include <QFileInfo>
23
24#include <kdebug.h>
25
26#include <QtCore/QTextCodec>
27
28using namespace Sonnet;
29
30HunspellDict::HunspellDict( const QString& lang )
31 : SpellerPlugin(lang), m_speller(0)
32{
33 kDebug()<<" HunspellDict::HunspellDict( const QString& lang ):"<<lang;
34 QString dic=QString("/usr/share/myspell/%1.dic").arg(lang);
35 if (QFileInfo(dic).exists())
36 m_speller = new Hunspell(QString("/usr/share/myspell/%1.aff").arg(lang).toUtf8().constData(),dic.toUtf8().constData());
37 else
38 m_speller = 0;
39 kDebug()<<" dddddd "<<m_speller;
40
41}
42
43HunspellDict::~HunspellDict()
44{
45 delete m_speller;
46}
47
48bool HunspellDict::isCorrect(const QString &word) const
49{
50 kDebug()<<" isCorrect :"<<word;
51 if(!m_speller)
52 return false;
53 int result = m_speller->spell(word.toUtf8());
54 kDebug()<<" result :"<<result;
55 return (result != 0) ;
56}
57
58QStringList HunspellDict::suggest(const QString &word) const
59{
60 if(!m_speller)
61 return QStringList();
62 char ** selection;
63 QStringList lst;
64 int nbWord = m_speller->suggest(&selection, word.toUtf8());
65 for(int i = 0; i <nbWord;++i)
66 {
67 lst << QString::fromUtf8(selection[i]);
68 }
69 m_speller->free_list(&selection, nbWord);
70 return lst;
71}
72
73
74bool HunspellDict::storeReplacement( const QString& bad,
75 const QString& good )
76{
77 if (!m_speller)
78 return false;
79 kDebug()<<"HunspellDict::storeReplacement not implemented";
80 return false;
81}
82
83bool HunspellDict::addToPersonal( const QString& word )
84{
85 if (!m_speller)
86 return false;
87 m_speller->add(word.toUtf8());
88 return false;
89}
90
91bool HunspellDict::addToSession( const QString& word )
92{
93 if (!m_speller)
94 return false;
95 kDebug()<<" bool HunspellDict::addToSession not implemented";
96 return false;
97}
HunspellDict::isCorrect
virtual bool isCorrect(const QString &word) const
Definition: kspell_hunspelldict.cpp:48
HunspellDict::suggest
virtual QStringList suggest(const QString &word) const
Definition: kspell_hunspelldict.cpp:58
HunspellDict::~HunspellDict
~HunspellDict()
Definition: kspell_hunspelldict.cpp:43
HunspellDict::storeReplacement
virtual bool storeReplacement(const QString &bad, const QString &good)
Definition: kspell_hunspelldict.cpp:74
HunspellDict::addToPersonal
virtual bool addToPersonal(const QString &word)
Definition: kspell_hunspelldict.cpp:83
HunspellDict::addToSession
virtual bool addToSession(const QString &word)
Definition: kspell_hunspelldict.cpp:91
HunspellDict::HunspellDict
HunspellDict(const QString &lang)
Definition: kspell_hunspelldict.cpp:30
Sonnet::SpellerPlugin
kDebug
#define kDebug
kdebug.h
kspell_hunspelldict.h
Sonnet
kspell_aspellclient.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Sonnet

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

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • 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
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal