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 ASpellClient::ASpellClient( QObject *parent, const QVariantList& /* args */ ) 00035 : Client( parent ) 00036 { 00037 m_config = new_aspell_config(); 00038 } 00039 00040 ASpellClient::~ASpellClient() 00041 { 00042 delete_aspell_config( m_config ); 00043 } 00044 00045 SpellerPlugin *ASpellClient::createSpeller(const QString &language) 00046 { 00047 ASpellDict *ad = new ASpellDict( language ); 00048 return ad; 00049 } 00050 00051 QStringList ASpellClient::languages() const 00052 { 00053 AspellDictInfoList *l = get_aspell_dict_info_list( m_config ); 00054 AspellDictInfoEnumeration *el = aspell_dict_info_list_elements( l ); 00055 00056 QStringList langs; 00057 const AspellDictInfo *di = 0; 00058 while ( ( di = aspell_dict_info_enumeration_next( el ) ) ) { 00059 langs.append( di->name ); 00060 } 00061 00062 delete_aspell_dict_info_enumeration( el ); 00063 00064 return langs; 00065 } 00066 00067 #include "kspell_aspellclient.moc"