kspell_aspellclient.cpp00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "kspell_aspellclient.h"
00022
00023 #include "kspell_aspelldict.h"
00024
00025 #include <kgenericfactory.h>
00026 #include <kdebug.h>
00027
00028 typedef KGenericFactory<ASpellClient> ASpellClientFactory;
00029 K_EXPORT_COMPONENT_FACTORY( kspell_aspell, ASpellClientFactory( "kspell_aspell" ) )
00030
00031 using namespace KSpell2;
00032
00033 ASpellClient::ASpellClient( QObject *parent, const char *name, const QStringList& )
00034 : Client( parent, name )
00035 {
00036 m_config = new_aspell_config();
00037 }
00038
00039 ASpellClient::~ASpellClient()
00040 {
00041 delete_aspell_config( m_config );
00042 }
00043
00044 Dictionary* ASpellClient::dictionary( const QString& language )
00045 {
00046 ASpellDict *ad = new ASpellDict( language );
00047 return ad;
00048 }
00049
00050 QStringList ASpellClient::languages() const
00051 {
00052 AspellDictInfoList *l = get_aspell_dict_info_list( m_config );
00053 AspellDictInfoEnumeration *el = aspell_dict_info_list_elements( l );
00054
00055 QStringList langs;
00056 const AspellDictInfo *di = 0;
00057 while ( ( di = aspell_dict_info_enumeration_next( el ) ) ) {
00058 langs.append( di->name );
00059 }
00060
00061 delete_aspell_dict_info_enumeration( el );
00062
00063 return langs;
00064 }
00065
00066 #include "kspell_aspellclient.moc"
|