// -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; -*- /** * Copyright 2006 Zack Rusin * * 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 "enchantclient.h" #include "enchantdict.h" #include #include #include K_PLUGIN_FACTORY(EnchantClientFactory, registerPlugin();) K_EXPORT_PLUGIN(EnchantClientFactory("kspell_enchant")) using namespace Sonnet; static void enchantDictDescribeFn(const char * const lang_tag, const char * const provider_name, const char * const provider_desc, const char * const provider_file, void * user_data) { QSpellEnchantClient *client = reinterpret_cast(user_data); //qDebug()<addLanguage(QString::fromLatin1(lang_tag)); } QSpellEnchantClient::QSpellEnchantClient(QObject *parent, const QVariantList& /* args */) : Client(parent) { m_broker = enchant_broker_init(); enchant_broker_list_dicts(m_broker, enchantDictDescribeFn, this); } QSpellEnchantClient::~QSpellEnchantClient() { enchant_broker_free(m_broker); } SpellerPlugin *QSpellEnchantClient::createSpeller( const QString &language) { EnchantDict *dict = enchant_broker_request_dict(m_broker, language.toUtf8()); if (!dict) { #ifndef NDEBUG const char *err = enchant_broker_get_error(m_broker); qDebug()<<"Couldn't create speller for"<