diff options
Diffstat (limited to 'kspell2/plugins/aspell')
-rw-r--r-- | kspell2/plugins/aspell/CMakeLists.txt | 44 | ||||
-rw-r--r-- | kspell2/plugins/aspell/Makefile.am | 17 | ||||
-rw-r--r-- | kspell2/plugins/aspell/kspell_aspell.desktop | 21 | ||||
-rw-r--r-- | kspell2/plugins/aspell/kspell_aspellclient.cpp | 66 | ||||
-rw-r--r-- | kspell2/plugins/aspell/kspell_aspellclient.h | 57 | ||||
-rw-r--r-- | kspell2/plugins/aspell/kspell_aspelldict.cpp | 125 | ||||
-rw-r--r-- | kspell2/plugins/aspell/kspell_aspelldict.h | 50 |
7 files changed, 0 insertions, 380 deletions
diff --git a/kspell2/plugins/aspell/CMakeLists.txt b/kspell2/plugins/aspell/CMakeLists.txt deleted file mode 100644 index 6d1e1ac9b..000000000 --- a/kspell2/plugins/aspell/CMakeLists.txt +++ /dev/null @@ -1,44 +0,0 @@ -################################################# -# -# (C) 2010 Serghei Amelian -# serghei (DOT) amelian (AT) gmail.com -# -# Improvements and feedback are welcome -# -# This file is released under GPL >= 2 -# -################################################# - -include_directories( - ${TQT_INCLUDE_DIRS} - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_BINARY_DIR}/tdecore - ${CMAKE_SOURCE_DIR}/kspell2 - ${CMAKE_SOURCE_DIR}/tdecore - ${ASPELL_INCLUDE_DIRS} -) - -link_directories( - ${TQT_LIBRARY_DIRS} - ${ASPELL_LIBRARY_DIRS} -) - - -##### other data ################################ - -install( FILES kspell_aspell.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) - - -#### kspell_aspell ############################## - -set( target kspell_aspell ) - -set( ${target}_SRCS - kspell_aspellclient.cpp kspell_aspelldict.cpp -) - -tde_add_kpart( ${target} SHARED AUTOMOC - SOURCES ${${target}_SRCS} - LINK kspell2-shared ${ASPELL_LIBRARIES} - DESTINATION ${PLUGIN_INSTALL_DIR} -) diff --git a/kspell2/plugins/aspell/Makefile.am b/kspell2/plugins/aspell/Makefile.am deleted file mode 100644 index b3eb64f33..000000000 --- a/kspell2/plugins/aspell/Makefile.am +++ /dev/null @@ -1,17 +0,0 @@ -METASOURCES = AUTO - -AM_CPPFLAGS = -I$(top_srcdir)/kspell2 -I$(top_srcdir) $(all_includes) - -# For the future: examine if condensing the tons of *_LDFLAGS variables -# into $(all_libraries) isn't better -AM_LDFLAGS = $(LDFLAGS_AS_NEEDED) $(LDFLAGS_NEW_DTAGS) - -kde_module_LTLIBRARIES = kspell_aspell.la - -kspell_aspell_la_SOURCES = kspell_aspellclient.cpp kspell_aspelldict.cpp - -kspell_aspell_la_LDFLAGS = -module -no-undefined $(KDE_PLUGIN) -kspell_aspell_la_LIBADD = ../../ui/libkspell2.la -laspell $(LIB_QT) $(LIB_TDECORE) - -service_DATA = kspell_aspell.desktop -servicedir = $(kde_servicesdir) diff --git a/kspell2/plugins/aspell/kspell_aspell.desktop b/kspell2/plugins/aspell/kspell_aspell.desktop deleted file mode 100644 index 3b66458de..000000000 --- a/kspell2/plugins/aspell/kspell_aspell.desktop +++ /dev/null @@ -1,21 +0,0 @@ -[Desktop Entry] -Type=Service -ServiceTypes=KSpell/Client -X-TDE-Library=kspell_aspell -X-TDE-PluginInfo-Author=Zack Rusin -X-TDE-PluginInfo-Email=zack@kde.org -X-TDE-PluginInfo-Name=kspell_aspell -X-TDE-PluginInfo-Version=0.0.1 -X-TDE-PluginInfo-Website=http://www.kde.org -X-TDE-PluginInfo-Category=Clients -X-TDE-PluginInfo-Depends= -X-TDE-PluginInfo-License=LGPL -X-TDE-PluginInfo-EnabledByDefault=true -Name=ASpell -Name[bn]=এ-স্পেল -Name[hi]=आ-स्पैल -Name[it]=Aspell -Name[ne]=ए स्पेल -Name[sv]=Aspell -Name[ta]=psதேர்ந்தெடு -Name[te]=ఏస్పెల్ diff --git a/kspell2/plugins/aspell/kspell_aspellclient.cpp b/kspell2/plugins/aspell/kspell_aspellclient.cpp deleted file mode 100644 index 3577dd795..000000000 --- a/kspell2/plugins/aspell/kspell_aspellclient.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * kspell_aspellclient.cpp - * - * Copyright (C) 2003 Zack Rusin <zack@kde.org> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301 USA - */ -#include "kspell_aspellclient.h" - -#include "kspell_aspelldict.h" - -#include <kgenericfactory.h> -#include <kdebug.h> - -typedef KGenericFactory<ASpellClient> ASpellClientFactory; -K_EXPORT_COMPONENT_FACTORY( kspell_aspell, ASpellClientFactory( "kspell_aspell" ) ) - -using namespace KSpell2; - -ASpellClient::ASpellClient( TQObject *parent, const char *name, const TQStringList& /* args */ ) - : Client( parent, name ) -{ - m_config = new_aspell_config(); -} - -ASpellClient::~ASpellClient() -{ - delete_aspell_config( m_config ); -} - -Dictionary* ASpellClient::dictionary( const TQString& language ) -{ - ASpellDict *ad = new ASpellDict( language ); - return ad; -} - -TQStringList ASpellClient::languages() const -{ - AspellDictInfoList *l = get_aspell_dict_info_list( m_config ); - AspellDictInfoEnumeration *el = aspell_dict_info_list_elements( l ); - - TQStringList langs; - const AspellDictInfo *di = 0; - while ( ( di = aspell_dict_info_enumeration_next( el ) ) ) { - langs.append( di->name ); - } - - delete_aspell_dict_info_enumeration( el ); - - return langs; -} - -#include "kspell_aspellclient.moc" diff --git a/kspell2/plugins/aspell/kspell_aspellclient.h b/kspell2/plugins/aspell/kspell_aspellclient.h deleted file mode 100644 index f2439989c..000000000 --- a/kspell2/plugins/aspell/kspell_aspellclient.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * kspell_aspellclient.h - * - * Copyright (C) 2003 Zack Rusin <zack@kde.org> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301 USA - */ -#ifndef KSPELL_ASPELLCLIENT_H -#define KSPELL_ASPELLCLIENT_H - -#include "client.h" -#include <tqobject.h> - -#include "aspell.h" - -namespace KSpell2 { - class Dictionary; -} -using KSpell2::Dictionary; - -class ASpellClient : public KSpell2::Client -{ - Q_OBJECT -public: - ASpellClient( TQObject *parent, const char *name, const TQStringList & /* args */ ); - ~ASpellClient(); - - virtual int reliability() const { - return 20; - } - - virtual Dictionary* dictionary( const TQString& language ); - - virtual TQStringList languages() const; - - virtual TQString name() const { - return "ASpell"; - } -private: - AspellConfig *m_config; - -}; - -#endif diff --git a/kspell2/plugins/aspell/kspell_aspelldict.cpp b/kspell2/plugins/aspell/kspell_aspelldict.cpp deleted file mode 100644 index 6687f2106..000000000 --- a/kspell2/plugins/aspell/kspell_aspelldict.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/** - * kspell_aspelldict.cpp - * - * Copyright (C) 2003 Zack Rusin <zack@kde.org> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301 USA - */ -#include "kspell_aspelldict.h" - -#include <kdebug.h> - -#include <tqtextcodec.h> - -using namespace KSpell2; - -ASpellDict::ASpellDict( const TQString& lang ) - : Dictionary( lang ) -{ - m_config = new_aspell_config(); - aspell_config_replace( m_config, "lang", lang.latin1() ); - /* All communication with Aspell is done in UTF-8 */ - /* For reference, please look at BR#87250 */ - aspell_config_replace( m_config, "encoding", "utf-8" ); - - AspellCanHaveError * possible_err = new_aspell_speller( m_config ); - - if ( aspell_error_number( possible_err ) != 0 ) - kdDebug()<< "Error : "<< aspell_error_message( possible_err ) <<endl; - else - m_speller = to_aspell_speller( possible_err ); - -} - -ASpellDict::~ASpellDict() -{ - delete_aspell_speller( m_speller ); - delete_aspell_config( m_config ); -} - -bool ASpellDict::check( const TQString& word ) -{ - /* ASpell is expecting length of a string in char representation */ - /* word.length() != word.utf8().length() for nonlatin strings */ - int correct = aspell_speller_check( m_speller, word.utf8(), word.utf8().length() ); - return correct; -} - -TQStringList ASpellDict::suggest( const TQString& word ) -{ - /* Needed for Unicode conversion */ - TQTextCodec *codec = TQTextCodec::codecForName("utf8"); - - /* ASpell is expecting length of a string in char representation */ - /* word.length() != word.utf8().length() for nonlatin strings */ - const AspellWordList * suggestions = aspell_speller_suggest( m_speller, - word.utf8(), - word.utf8().length() ); - - AspellStringEnumeration * elements = aspell_word_list_elements( suggestions ); - - TQStringList qsug; - const char * cword; - - while ( (cword = aspell_string_enumeration_next( elements )) ) { - /* Since while creating the class ASpellDict the encoding is set */ - /* to utf-8, one has to convert output from Aspell to Unicode */ - qsug.append( codec->toUnicode( cword ) ); - } - - delete_aspell_string_enumeration( elements ); - return qsug; -} - -bool ASpellDict::checkAndSuggest( const TQString& word, - TQStringList& suggestions ) -{ - bool c = check( word ); - if ( c ) - suggestions = suggest( word ); - return c; -} - -bool ASpellDict::storeReplacement( const TQString& bad, - const TQString& good ) -{ - /* ASpell is expecting length of a string in char representation */ - /* word.length() != word.utf8().length() for nonlatin strings */ - return aspell_speller_store_replacement( m_speller, - bad.utf8(), bad.utf8().length(), - good.utf8(), good.utf8().length() ); -} - -bool ASpellDict::addToPersonal( const TQString& word ) -{ - kdDebug() << "ASpellDict::addToPersonal: word = " << word << endl; - /* ASpell is expecting length of a string in char representation */ - /* word.length() != word.utf8().length() for nonlatin strings */ - aspell_speller_add_to_personal( m_speller, word.utf8(), - word.utf8().length() ); - /* Add is not enough, one has to save it. This is not documented */ - /* in ASpell's API manual. I found it in */ - /* aspell-0.60.2/example/example-c.c */ - return aspell_speller_save_all_word_lists( m_speller ); -} - -bool ASpellDict::addToSession( const TQString& word ) -{ - /* ASpell is expecting length of a string in char representation */ - /* word.length() != word.utf8().length() for nonlatin strings */ - return aspell_speller_add_to_session( m_speller, word.utf8(), - word.utf8().length() ); -} diff --git a/kspell2/plugins/aspell/kspell_aspelldict.h b/kspell2/plugins/aspell/kspell_aspelldict.h deleted file mode 100644 index 2ff51c056..000000000 --- a/kspell2/plugins/aspell/kspell_aspelldict.h +++ /dev/null @@ -1,50 +0,0 @@ -/** - * kspell_aspelldict.h - * - * Copyright (C) 2003 Zack Rusin <zack@kde.org> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301 USA - */ -#ifndef KSPELL_ASPELLDICT_H -#define KSPELL_ASPELLDICT_H - -#include "dictionary.h" - -#include "aspell.h" - -class ASpellDict : public KSpell2::Dictionary -{ -public: - ASpellDict( const TQString& lang ); - ~ASpellDict(); - virtual bool check( const TQString& word ); - - virtual TQStringList suggest( const TQString& word ); - - virtual bool checkAndSuggest( const TQString& word, - TQStringList& suggestions ) ; - - virtual bool storeReplacement( const TQString& bad, - const TQString& good ); - - virtual bool addToPersonal( const TQString& word ); - virtual bool addToSession( const TQString& word ); -private: - AspellConfig *m_config; - AspellSpeller *m_speller; -}; - -#endif |