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

Sonnet

kspell_aspellclient.cpp

Go to the documentation of this file.
00001 
00021 #include "kspell_aspellclient.h"
00022 
00023 #include "kspell_aspelldict.h"
00024 
00025 #include <kpluginfactory.h>
00026 #include <kpluginloader.h>
00027 #include <kdebug.h>
00028 
00029 K_PLUGIN_FACTORY( ASpellClientFactory, registerPlugin<ASpellClient>(); )
00030 K_EXPORT_PLUGIN( ASpellClientFactory( "kspell_aspell" ) )
00031 
00032 using namespace Sonnet;
00033 
00034 #ifdef Q_WS_WIN
00035 #include <kstandarddirs.h>
00036 #define ASPELL_DATA_ROOT "lib/aspell-0.60/"
00037 
00038 QString aspell_data_dir() {
00039     return KStandardDirs::installPath("kdedir") + ASPELL_DATA_ROOT;        
00040 }
00041 #endif
00042 
00043 ASpellClient::ASpellClient( QObject *parent, const QVariantList& /* args */  )
00044     : Client( parent )
00045 {
00046     m_config = new_aspell_config();
00047 #ifdef Q_WS_WIN
00048     aspell_config_replace( m_config, "data-dir", aspell_data_dir().toLocal8Bit().data());
00049     aspell_config_replace( m_config, "dict-dir", aspell_data_dir().toLocal8Bit().data());
00050 #endif
00051 }
00052 
00053 ASpellClient::~ASpellClient()
00054 {
00055     delete_aspell_config( m_config );
00056 }
00057 
00058 SpellerPlugin *ASpellClient::createSpeller(const QString &language)
00059 {
00060     ASpellDict *ad = new ASpellDict( language );
00061     return ad;
00062 }
00063 
00064 QStringList ASpellClient::languages() const
00065 {
00066     AspellDictInfoList *l = get_aspell_dict_info_list( m_config );
00067     AspellDictInfoEnumeration *el = aspell_dict_info_list_elements( l );
00068 
00069     QStringList langs;
00070     const AspellDictInfo *di = 0;
00071     while ( ( di = aspell_dict_info_enumeration_next( el ) ) ) {
00072         langs.append( di->name );
00073     }
00074 
00075     delete_aspell_dict_info_enumeration( el );
00076 
00077     return langs;
00078 }
00079 
00080 #include "kspell_aspellclient.moc"

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
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
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