TDE core libraries
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
tpearson 6e21bc798b rename the following methods: před 8 roky
..
plugins Finished remaining porting to new TQt API před 8 roky
tests Initial conversion for TQt for Qt4 3.4.0 TP2 před 8 roky
ui rename the following methods: před 8 roky
CMakeLists.txt Fix kspell compilation před 8 roky
Makefile.am kdelibs update to Trinity v3.5.11 před 10 roky
README Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. před 10 roky
backgroundchecker.cpp Trinity Qt initial conversion před 9 roky
backgroundchecker.h Initial conversion for TQt for Qt4 3.4.0 TP2 před 8 roky
backgroundengine.cpp Trinity Qt initial conversion před 9 roky
backgroundengine.h Initial conversion for TQt for Qt4 3.4.0 TP2 před 8 roky
backgroundthread.cpp Trinity Qt initial conversion před 9 roky
backgroundthread.h Initial conversion for TQt for Qt4 3.4.0 TP2 před 8 roky
broker.cpp rename the following methods: před 8 roky
broker.h TQt conversion fixes před 9 roky
client.cpp Trinity Qt initial conversion před 9 roky
client.h Initial conversion for TQt for Qt4 3.4.0 TP2 před 8 roky
defaultdictionary.cpp Trinity Qt initial conversion před 9 roky
defaultdictionary.h Trinity Qt initial conversion před 9 roky
dictionary.h Revert automated changes před 8 roky
filter.cpp Revert automated changes před 8 roky
filter.h Revert automated changes před 8 roky
kspellclient.desktop Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. před 10 roky
settings.cpp rename the following methods: před 8 roky
settings.h Trinity Qt initial conversion před 9 roky
threadevents.h Initial conversion for TQt for Qt4 3.4.0 TP2 před 8 roky

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( KSharedConfig *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 <kspell_broker.h>
#include <kspell_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 QString& 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;