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

Sonnet

  • sonnet
  • plugins
  • aspell
kspell_aspellclient.cpp
Go to the documentation of this file.
1
21#include "kspell_aspellclient.h"
22
23#include "kspell_aspelldict.h"
24
25#include <kpluginfactory.h>
26#include <kpluginloader.h>
27#include <kdebug.h>
28
29K_PLUGIN_FACTORY( ASpellClientFactory, registerPlugin<ASpellClient>(); )
30K_EXPORT_PLUGIN( ASpellClientFactory( "kspell_aspell" ) )
31
32using namespace Sonnet;
33
34#ifdef Q_WS_WIN
35#include <kstandarddirs.h>
36#define ASPELL_DATA_ROOT "lib/aspell-0.60/"
37
38QString aspell_data_dir() {
39 return KStandardDirs::installPath("kdedir") + ASPELL_DATA_ROOT;
40}
41#endif
42
43ASpellClient::ASpellClient( QObject *parent, const QVariantList& /* args */ )
44 : Client( parent )
45{
46 m_config = new_aspell_config();
47#ifdef Q_WS_WIN
48 aspell_config_replace( m_config, "data-dir", aspell_data_dir().toLocal8Bit().data());
49 aspell_config_replace( m_config, "dict-dir", aspell_data_dir().toLocal8Bit().data());
50#endif
51}
52
53ASpellClient::~ASpellClient()
54{
55 delete_aspell_config( m_config );
56}
57
58SpellerPlugin *ASpellClient::createSpeller(const QString &language)
59{
60 ASpellDict *ad = new ASpellDict( language );
61 return ad;
62}
63
64QStringList ASpellClient::languages() const
65{
66 AspellDictInfoList *l = get_aspell_dict_info_list( m_config );
67 AspellDictInfoEnumeration *el = aspell_dict_info_list_elements( l );
68
69 QStringList langs;
70 const AspellDictInfo *di = 0;
71 while ( ( di = aspell_dict_info_enumeration_next( el ) ) ) {
72 langs.append( di->name );
73 }
74
75 delete_aspell_dict_info_enumeration( el );
76
77 return langs;
78}
79
80#include "kspell_aspellclient.moc"
ASpellClient::~ASpellClient
~ASpellClient()
Definition: kspell_aspellclient.cpp:53
ASpellClient::createSpeller
virtual SpellerPlugin * createSpeller(const QString &language)
Definition: kspell_aspellclient.cpp:58
ASpellClient::ASpellClient
ASpellClient(QObject *parent, const QVariantList &)
Definition: kspell_aspellclient.cpp:43
ASpellClient::languages
virtual QStringList languages() const
Definition: kspell_aspellclient.cpp:64
ASpellDict
kspell_aspelldict.h
Definition: kspell_aspelldict.h:29
K_PLUGIN_FACTORY
#define K_PLUGIN_FACTORY(name, pluginRegistrations)
K_EXPORT_PLUGIN
#define K_EXPORT_PLUGIN(factory)
KStandardDirs::installPath
static QString installPath(const char *type)
QObject
Sonnet::Client
Sonnet::SpellerPlugin
kdebug.h
kpluginfactory.h
kpluginloader.h
aspell_data_dir
QString aspell_data_dir()
Definition: kspell_aspellclient.cpp:38
ASPELL_DATA_ROOT
#define ASPELL_DATA_ROOT
Definition: kspell_aspellclient.cpp:36
kspell_aspellclient.h
kspell_aspelldict.h
kstandarddirs.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