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

Sonnet

  • sources
  • kde-4.14
  • kdelibs
  • 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 
29 K_PLUGIN_FACTORY( ASpellClientFactory, registerPlugin<ASpellClient>(); )
30 K_EXPORT_PLUGIN( ASpellClientFactory( "kspell_aspell" ) )
31 
32 using namespace Sonnet;
33 
34 #ifdef Q_WS_WIN
35 #include <kstandarddirs.h>
36 #define ASPELL_DATA_ROOT "lib/aspell-0.60/"
37 
38 QString aspell_data_dir() {
39  return KStandardDirs::installPath("kdedir") + ASPELL_DATA_ROOT;
40 }
41 #endif
42 
43 ASpellClient::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 
53 ASpellClient::~ASpellClient()
54 {
55  delete_aspell_config( m_config );
56 }
57 
58 SpellerPlugin *ASpellClient::createSpeller(const QString &language)
59 {
60  ASpellDict *ad = new ASpellDict( language );
61  return ad;
62 }
63 
64 QStringList 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"
kdebug.h
kspell_aspellclient.h
ASpellClient::~ASpellClient
~ASpellClient()
Definition: kspell_aspellclient.cpp:53
K_PLUGIN_FACTORY
#define K_PLUGIN_FACTORY(name, pluginRegistrations)
aspell_data_dir
QString aspell_data_dir()
Definition: kspell_aspellclient.cpp:38
QList::append
void append(const T &value)
QObject
kpluginloader.h
kspell_aspelldict.h
QString
ASpellDict
kspell_aspelldict.h
Definition: kspell_aspelldict.h:28
QStringList
KStandardDirs::installPath
static QString installPath(const char *type)
Sonnet::SpellerPlugin
ASPELL_DATA_ROOT
#define ASPELL_DATA_ROOT
Definition: kspell_aspellclient.cpp:36
kstandarddirs.h
kpluginfactory.h
ASpellClient::ASpellClient
ASpellClient(QObject *parent, const QVariantList &)
Definition: kspell_aspellclient.cpp:43
ASpellClient::createSpeller
virtual SpellerPlugin * createSpeller(const QString &language)
Definition: kspell_aspellclient.cpp:58
QObject::parent
QObject * parent() const
ASpellClient::languages
virtual QStringList languages() const
Definition: kspell_aspellclient.cpp:64
K_EXPORT_PLUGIN
#define K_EXPORT_PLUGIN(factory)
Sonnet::Client
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:24:40 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Sonnet

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

kdelibs API Reference

Skip menu "kdelibs 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

Search



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