You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tdelibs/tdespell2
Michele Calgaro bba3128085
Replace KDE_[NO_]EXPORT with TDE_[NO_]EXPORT
7 months ago
..
plugins Replace Q_OBJECT with TQ_OBJECT 1 year ago
tests Use new TQ_METHOD, TQ_SIGNAL, TQ_SLOT defines 11 months ago
ui Replace KDE_[NO_]EXPORT with TDE_[NO_]EXPORT 7 months ago
CMakeL10n.txt Desktop file translations: 5 years ago
CMakeLists.txt Simplify CMake rules for desktop file translations. 4 years ago
Makefile.am Drop TQT_NO_COMPAT code 1 year ago
README Replace QObject, QWidget, QImage, QPair, QRgb, QColor, QChar, QString, QIODevice with TQ* version 1 year ago
backgroundchecker.cpp Use new TQ_METHOD, TQ_SIGNAL, TQ_SLOT defines 11 months ago
backgroundchecker.h Replace KDE_[NO_]EXPORT with TDE_[NO_]EXPORT 7 months ago
backgroundengine.cpp Use new TQ_METHOD, TQ_SIGNAL, TQ_SLOT defines 11 months ago
backgroundengine.h Replace Q_OBJECT with TQ_OBJECT 1 year ago
backgroundthread.cpp Rename a number of libraries and executables to avoid conflicts with KDE4 12 years ago
backgroundthread.h Additional k => tde renaming and fixes 11 years ago
broker.cpp Removed code formatting modelines. 4 years ago
broker.h Replace KDE_[NO_]EXPORT with TDE_[NO_]EXPORT 7 months ago
client.cpp Removed code formatting modelines. 4 years ago
client.h Replace KDE_[NO_]EXPORT with TDE_[NO_]EXPORT 7 months ago
defaultdictionary.cpp Use new TQ_METHOD, TQ_SIGNAL, TQ_SLOT defines 11 months ago
defaultdictionary.h Replace Q_OBJECT with TQ_OBJECT 1 year ago
dictionary.h Removed code formatting modelines. 4 years ago
filter.cpp Removed code formatting modelines. 4 years ago
filter.h Replace KDE_[NO_]EXPORT with TDE_[NO_]EXPORT 7 months ago
settings.cpp Removed code formatting modelines. 4 years ago
settings.h Replace KDE_[NO_]EXPORT with TDE_[NO_]EXPORT 7 months ago
tdespellclient.desktop Desktop file translations: 5 years ago
threadevents.h Additional k => tde renaming and fixes 11 years ago

README

This is KSpell 2 beta implementation. KSpell 2 is completely in
process and is plugin based.  

The main class in the KSpell 2 is the KSpell::Broker. Broker is
responsible for loading all the plugins and creating the actual
dictionaries.

Dictionaries are abstracted in the KSpell::Dictionary object which
encapsulates all spell-checking functionality.

You'll notice that the Broker is being created via the 
Broker::Ptr Broker::openBroker( TDESharedConfig *config =0 );
call. The Broker is a shared object and the reason for this construct
is very simple:
- most application would need to have a few Broker objects (one for
the dialog dictionaries, one for the background spell checking, one
for the suggestion dictionaries) and because Broker loads plugins on
creation it would be ineffective to have a few redundant Broker
objects in one application,
- each Broker maps to a configuration file. If one Broker would change
in the application, all others would have to reparse and repopulate
the options, which would be really inefficient.

Due to the above you deal with the broker via the Broker::Ptr
interface. 

Once you have the Broker object in your application, you can ask it
for a Dictionary of some language. If such a dictionary is available
you get it back as a Dictionary class and you use that class to do the
actual spell checking.

Broker on construction checks for available KSpell::Client's which are
loaded as dynamic plugins. It's the actual KSpell::Client that gives
the broker the KSpell::Dictionary. 
One can specify a default client and the default language for a Broker
theough the settings() method and the KSpell::Settings class which it
returns. 

Also note that you can have dictionaries for multiple languages in
your application.
And most importantly the interface to KSpell::Dictionary is
synchronous so once you pass a word to check you don't have to wait
for any signals - you get corrections right back.
Sample usage of KSpell 2 looks like follows:

#include <tdespell_broker.h>
#include <tdespell_dictionary.h>
using namespace KSpell;


Broker::Ptr broker = Broker::openBroker( someKSettingsObject );
Dictionary *enDict = broker->dictionary( "en_US" );
Dictionary *deDict = broker->dictionary( "de_DE" );

void someFunc( const TQString& word )
{
    if ( enDict->check( word ) ) {
        kdDebug()<<"Word \""<<word<<"\" is misspelled." <<endl;
        QStringList suggestion = enDict->suggest( word );	
        kdDebug()<<"Suggestions: "<< suggestions <<endl;
    }

    QStringList suggestions;
    if ( deDict->checkAndSuggest( word, suggestions ) ) {
       kdDebug()<<"Wort \""<<word<<"\" ist fehlbuchstabiert." <<endl;
       kdDebug()<<"Vorschlage: "<< suggestions <<endl;
    }
}

delete enDict;
delete deDict;