diff options
Diffstat (limited to 'tools/spell')
-rw-r--r-- | tools/spell/Makefile.am | 24 | ||||
-rw-r--r-- | tools/spell/kspelltool.desktop | 135 | ||||
-rw-r--r-- | tools/spell/main.cc | 137 | ||||
-rw-r--r-- | tools/spell/main.h | 36 | ||||
-rw-r--r-- | tools/spell/uninstall.desktop | 2 |
5 files changed, 334 insertions, 0 deletions
diff --git a/tools/spell/Makefile.am b/tools/spell/Makefile.am new file mode 100644 index 00000000..80f2f78a --- /dev/null +++ b/tools/spell/Makefile.am @@ -0,0 +1,24 @@ +# This tool is disabled. Not useful and not ported to kspell2. + +#INCLUDES = -I$(srcdir)/../../lib/kofficecore $(all_includes) +#libkspelltool_la_LIBADD = ../../lib/kofficecore/libkofficecore.la + +####### Files + +#kde_module_LTLIBRARIES = libkspelltool.la + +#libkspelltool_la_SOURCES = main.cc + +#libkspelltool_la_LDFLAGS = $(all_libraries) -avoid-version -module -no-undefined + +#noinst_HEADERS = main.h + +#libkspelltool_la_METASOURCES = main.moc + +#service_DATA = kspelltool.desktop +#servicedir = $(kde_servicesdir) + +install-data-local: uninstall.desktop + $(mkinstalldirs) $(DESTDIR)$(kde_servicesdir) + $(INSTALL_DATA) $(srcdir)/uninstall.desktop $(DESTDIR)$(kde_servicesdir)/kspelltool.desktop + diff --git a/tools/spell/kspelltool.desktop b/tools/spell/kspelltool.desktop new file mode 100644 index 00000000..f756f140 --- /dev/null +++ b/tools/spell/kspelltool.desktop @@ -0,0 +1,135 @@ +[Desktop Entry] +Name=Spell Checker Tool +Name[af]=Spel Toetser Program +Name[ar]=أداة المُدَقِّق الإملائيّ +Name[az]=İmla Yoxlama Proqramı +Name[bg]=Проверка на правописа +Name[br]=Ostilh Gwiriekaat ar Skritur +Name[bs]=Alat za provjeru pravopisa +Name[ca]=Eina de comprovació d'ortografia +Name[cs]=Nástroj pro kontrolu pravopisu +Name[cy]=Erfyn Cywiro Sillafu +Name[da]=Stavekontrolværktøj +Name[de]=Rechtschreibprüfung +Name[el]=Εργαλείο ορθογραφικού ελέγχου +Name[eo]=Literumilo +Name[es]=Corrector ortográfico +Name[et]=Õigekirja kontroll +Name[eu]=Egiaztapen ortografikorako tresna +Name[fa]=ابزار غلطگیر +Name[fi]=Oikolukutyökalu +Name[fo]=Rættstavari +Name[fr]=Vérificateur orthographique +Name[fy]=Staveringshifker +Name[gl]=Verificador Ortográfico +Name[he]=כלי בדיקת איות +Name[hi]=वर्तनी शोधक औजार +Name[hr]=Alat za provjeru pravopisa +Name[hu]=Helyesírás-ellenőrző +Name[id]=Program Bantu Cek Spelling +Name[is]=Stafsetningarleiðrétting +Name[it]=Correttore ortografico +Name[ja]=スペルチェックツール +Name[km]=ឧបករណ៍ពិនិត្យអក្ខរាវិរុទ្ធ +Name[lo]=ເຄື່ອງມືກວດຄໍາສິກົດ +Name[lt]=Rašybos tikrinimo įrankis +Name[lv]=Pareizrakstības pārbaudes rīks +Name[mk]=Проверка на спелување +Name[ms]=Alat Penyemak Eja +Name[mt]=Għodda Spell Checker +Name[nb]=Stavekontrollverktøy +Name[nds]=Klookschriever +Name[ne]=हिज्जे परीक्षक उपकरण +Name[nl]=Spellingcontrole +Name[nn]=Stavekontrollverktøy +Name[pl]=Narzędzie sprawdzania pisowni +Name[pt]=Verificador Ortográfico +Name[pt_BR]=Ferramenta de Verificação Ortográfica +Name[ro]=Utilitar verificare ortografie +Name[ru]=Проверка правописания +Name[se]=Čállindárkkistanreaidu +Name[sk]=Kontrola pravopisu +Name[sl]=Orodje za preverjanje črkovanja +Name[sr]=Алат за проверу правописа +Name[sr@Latn]=Alat za proveru pravopisa +Name[sv]=Rättstavningsverktyg +Name[ta]=எழுத்துப்பிழை திருத்தற் கருவி +Name[tg]=Хизмати Санҷиши Имло +Name[th]=เครื่องมือตรวจคำสะกด +Name[tr]=İmla Denetim Aracı +Name[uk]=Утиліта перевірки правопису +Name[uz]=Imloni tekshiruvchi vosita +Name[uz@cyrillic]=Имлони текширувчи восита +Name[ven]=Tshishumiswa tshau sedza zwipelini +Name[wa]=Coridjrece ortografike +Name[xh]=Isixhobo Sokukhangela Upelo +Name[zh_CN]=拼写检查工具 +Name[zh_TW]=拼字檢查工具 +Name[zu]=Ithuluzi Lokubhekisisa Kokubhalwa Kwamagama +X-KDE-Library=libkspelltool +Type=Service +Commands=spellcheck +Comment=Check this Word's Spelling +Comment[af]=Bevestig hierdie Woord se Spelling +Comment[ar]=التَّدقيق في إملاء هذه الكلمة +Comment[bg]=Проверка на правописа +Comment[bs]=Provjeri pravopis ove riječi +Comment[ca]=Comprova l'ortografia d'aquesta paraula +Comment[cs]=Zkontrolovat pravopis tohoto slova +Comment[cy]=Cywiro Sillafu'r Gair Yma +Comment[da]=Kontrollér dette ords stavning +Comment[de]=Die Schreibweise des ausgewählten Wortes überprüfen +Comment[el]=Ορθογραφικός έλεγχος αυτής της λέξης +Comment[eo]=Kontrolu la literumadon de tiu vorto +Comment[es]=Comprobar la ortografía de esta palabra +Comment[et]=Selle sõna õigekirja kontrollimine +Comment[eu]=Egiaztatu hitz honen ortografia +Comment[fa]=بررسی هجی این واژه +Comment[fi]=Tarkista tämän sanan kirjoitusasu +Comment[fo]=Kanna um orðið er stavað rætt +Comment[fr]=Vérifier l'orthographe de ce mot +Comment[fy]=Hifkje de stavering fan dit wurd +Comment[gl]=Verifica a Ortografía desta Palabra +Comment[he]=בדוק את האיות של מילה זו +Comment[hi]=इस शब्द की वर्तनी जाँचें +Comment[hr]=Provjeri pravopis ove riječi +Comment[hu]=A szó helyesírásának ellenőrzése +Comment[is]=Athuga stafsetningu þessa orðs +Comment[it]=Controlla l'ortografia di questa parola +Comment[ja]=単語のスペルチェック +Comment[km]=ពិនិត្យអក្ខរាវិរុទ្ធរបស់ពាក្យនេះ +Comment[lo]=ກວດສອບຄໍາສະກົດຂອງຄໍານີ້ +Comment[lt]=Patikrinti šio žodžio rašybą +Comment[lv]=Pārbaudīt šī vārda pareizrakstību +Comment[ms]=Semak Ejaan Kata ini +Comment[mt]=Iċċekkja kif tispelli dil-kelma +Comment[nb]=Sjekk stavingen av dette ordet +Comment[nds]=Dit Woort op Schrieffehlers kuntrulleren +Comment[ne]=यो शब्दको हिज्जे जाँच गर्नुहोस् +Comment[nl]=Controleer de spelling van dit woord +Comment[nn]=Sjekk stavinga av dette ordet +Comment[pl]=Sprawdź poprawność pisowni tego słowa +Comment[pt]=Verificar a ortografia desta palavra +Comment[pt_BR]=Verificar a Ortografia Desta Palavra +Comment[ru]=Проверка правописания этого слова +Comment[se]=Dárkkis dán sáni riektačállima +Comment[sk]=Kontrola pravopisu tohto slova +Comment[sl]=Preveri črkovanje te besede +Comment[sr]=Проверава се да ли је ова реч исправно написана +Comment[sr@Latn]=Proverava se da li je ova reč ispravno napisana +Comment[sv]=Kontrollera det här ordets stavning +Comment[tg]=Тафтиш кардани ин Навиштани Калима +Comment[th]=ตรวจสอบคำสะกดของคำนี้ +Comment[tr]=Bu Kelimenin İmla Denetimini Yap +Comment[uk]=Перевірити правопис цього слова +Comment[uz]=Shu soʻzning imlosini tekshirish +Comment[uz@cyrillic]=Шу сўзнинг имлосини текшириш +Comment[wa]=Coridjî l' ortografeye di ç' mot ci... +Comment[xh]=Khangela olu Pelo Magama +Comment[zh_CN]=检查该词拼写 +Comment[zh_TW]=拼字檢查 +ServiceTypes=KDataTool +Icon=spellcheck +# This tool should only appear for single words. +DataType=QString +DataMimeTypes=application/x-singleword diff --git a/tools/spell/main.cc b/tools/spell/main.cc new file mode 100644 index 00000000..166b8a9e --- /dev/null +++ b/tools/spell/main.cc @@ -0,0 +1,137 @@ +/* This file is part of the KDE project + Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> + Copyright (C) 2002 Laurent Montel <lmontel@mandrakesoft.com> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. +*/ + +#include "main.h" +#include <kmessagebox.h> +#include <klocale.h> +#include <kdebug.h> +#include <kinstance.h> +#include <kconfig.h> +#include <kgenericfactory.h> +#include <klibloader.h> + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +/*************************************************** + * + * Factory + * + ***************************************************/ + +K_EXPORT_COMPONENT_FACTORY( libkspelltool, KGenericFactory<SpellChecker> ) + +/*************************************************** + * + * Spellchecker + * + ***************************************************/ + +SpellChecker::SpellChecker( QObject* parent, const char* name, const QStringList & ) + : KDataTool( parent, name ) +{ +} + +bool SpellChecker::run( const QString& command, void* data, const QString& datatype, const QString& mimetype ) +{ + if ( command != "spellcheck" ) + { + kdDebug(31000) << "SpellChecker does only accept the command 'spellcheck'" << endl; + kdDebug(31000) << " The commands " << command << " is not accepted" << endl; + return FALSE; + } + + // Check wether we can accept the data + if ( datatype != "QString" ) + { + kdDebug(31000) << "SpellChecker only accepts datatype QString" << endl; + return FALSE; + } + + if ( mimetype != "text/plain" && mimetype != "application/x-singleword" ) + { + kdDebug(31000) << "SpellChecker only accepts mimetype text/plain and application/x-singleword" << endl; + return FALSE; + } + + // Get data + QString buffer = *((QString *)data); + buffer = buffer.stripWhiteSpace(); + + if ( instance() ) + { + KConfig * config = instance()->config(); + QCString gn( "KSpell " ); + gn += instance()->instanceName(); // for compat reasons, and to avoid finding the group in kdeglobals (hmm...) + QString groupName = QString::fromLatin1( gn ); + //kdDebug() << "Group: " << groupName << endl; + if ( config->hasGroup( groupName ) ) + { + //kdDebug() << "SpellChecker::run - group found -" << endl; + config->setGroup( groupName ); +#if 0 + kosconfig.setNoRootAffix(config->readNumEntry ("KSpell_NoRootAffix", 0)); + kosconfig.setRunTogether(config->readNumEntry ("KSpell_RunTogether", 0)); + kosconfig.setDictionary(config->readEntry ("KSpell_Dictionary", "")); + kosconfig.setDictFromList(config->readNumEntry ("KSpell_DictFromList", FALSE)); + kosconfig.setEncoding(config->readNumEntry ("KSpell_Encoding", KOS_E_ASCII)); + kosconfig.setClient(config->readNumEntry ("KSpell_Client", KOS_CLIENT_ISPELL)); + kosconfig.setNoRootAffix(config->readNumEntry ("KSpell_NoRootAffix", 0)); + kosconfig.setRunTogether(config->readNumEntry ("KSpell_RunTogether", 0)); + kosconfig.setDictionary(config->readEntry ("KSpell_Dictionary", "")); + kosconfig.setDictFromList(config->readNumEntry ("KSpell_DictFromList", FALSE)); + + kosconfig.setIgnoreCase( config->readNumEntry( "KSpell_IgnoreCase", 0)); + kosconfig.setIgnoreAccent( config->readNumEntry( "KSpell_IgnoreAccent", 0)); + kosconfig.setDontCheckUpperWord(config->readBoolEntry("KSpell_dont_check_upper_word",false)); + kosconfig.setDontCheckTitleCase(config->readBoolEntry("KSpell_dont_check_title_case",false)); + kosconfig.setSpellWordWithNumber( config->readNumEntry("KSpell_SpellWordWithNumber", false)); +#endif + } + } +#if 0 //PORT to kspell2 + // Call the spell checker + KOSpell::modalCheck( buffer, &kosconfig ); + *((QString*)data) = buffer; +#endif +#if 0 //fixme + // Call the spell checker + KSpell::spellStatus status=(KSpell::spellStatus)KSpell::modalCheck( buffer, &ksconfig ); + + if (status == KSpell::Error) + { + KMessageBox::sorry(0L, i18n("KSpell could not be started.\n" + "Please make sure you have ISpell or ASpell properly configured and in your PATH.")); + } + else if (status == KSpell::Crashed) + { + KMessageBox::sorry(0L, i18n("KSpell seems to have crashed.")); + } + else + { + // Set data + *((QString*)data) = buffer; + } +#endif + return TRUE; +} + +#include "main.moc" diff --git a/tools/spell/main.h b/tools/spell/main.h new file mode 100644 index 00000000..b096d08a --- /dev/null +++ b/tools/spell/main.h @@ -0,0 +1,36 @@ +/* This file is part of the KDE project + Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. +*/ + +#ifndef __main_h__ +#define __main_h__ + +#include <qobject.h> +#include <kdatatool.h> +#include <klibloader.h> + +class SpellChecker : public KDataTool +{ + Q_OBJECT + +public: + SpellChecker( QObject* parent, const char* name, const QStringList & ); + virtual bool run( const QString& command, void* data, const QString& datatype, const QString& mimetype); +}; + +#endif diff --git a/tools/spell/uninstall.desktop b/tools/spell/uninstall.desktop new file mode 100644 index 00000000..e1e3e173 --- /dev/null +++ b/tools/spell/uninstall.desktop @@ -0,0 +1,2 @@ +[Desktop Entry] +Hidden=true |