class KSpell


Definition#include <kspell.h>
InheritsQObject (kdecore)
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Types

Public Methods

Signals

Public Static Methods

Protected Methods

Protected Slots

Protected Members

enum spellStatus {Starting = 0, Running, Cleaning, Finished, Error, Crashed }

Possible states of the spell checker.

The following error states exist:

 KSpell (QWidget *_parent, QString _caption, QObject *obj, const char *slot, KSpellConfig *_kcs=0, bool _progressbar = TRUE, bool _modal = FALSE )

Start spellchecker.

KSpell emits ready() when it has verified that ISpell/ASpell is working properly. Pass the name of a slot -- do not pass zero! Be sure to call cleanUp() when you are done with KSpell.

If KSpell could not be started correctly, death() is emitted.

Parameters:
_parentParent of KSpellConfig dialg..
_captionCaption of KSpellConfig dialog.
_receiverReceiver.
_slotReceivers SLOT.
_kcsConfiguration for KSpell.
_progressbarIndicates if progress bar should be shown.
_modalIndicates modal or non-modal dialog.

spellStatus  status ()

Returns the status of KSpell.

void  cleanUp ()

[virtual]

Clean up ISpell.

Write out the personal dictionary and close ISpell's stdin.. A death() signal will be emitted when the cleanup is complete, but this method will return immediately.

void  setAutoDelete (bool _autoDelete)

Auto delete the KSpell object after emitting death().

bool  check (const QString &_buffer)

[virtual]

Spell check a buffer of many words in plain text format.

The _buffer is not modified. The signal done() will be sent when check() is finished and the argument will be a spell-corrected version of _buffer.

The spell check may be stopped by the user before the entire buffer has been checked. You can check lastPosition() to see how far in _buffer check() reached before stopping.

inline int  lastPosition ()

Retrieve the position (for check()) or word number (for checkList()) of the last word checked.

bool  checkList (QStringList *_wordlist)

[virtual]

Spellcheck a list of words.

checkList() is more flexible than check(). You could parse any type of document (HTML, TeX, etc.) into a list of spell-checkable words and send the list to checkList(). Sending a marked-up document to check() would result in the mark-up tags being spell checked.

bool  checkWord (QString _buffer, bool usedialog=FALSE)

[virtual]

Spell check a single word.

checkWord() is the most flexible function. Some applications might need this flexibility but will sacrifice speed. Consider checkList() for checking many words. Use this method for implementing "online" spellchecking.

checkWord () returns false if buffer is not a word, otherwise it returns true;

If usedialog is set to @true, KSpell will put up the standard dialog if the word is not found. The dialog results can be queried by using dlgResult() and replacement().

The signal corrected() is emitted when the check is complete. You can look at suggestions() to see what the suggested replacements were.

void  hide ()

Hide the dialog box.

You'll need to do this when you are done with checkWord();

inline QStringListsuggestions ()

Retrieve list of suggested word replacements.

After calling checkWord() (an in response to a misspelled() signal you can use this to get the list of suggestions (if any were available)

inline int  dlgResult ()

Get the result code of the dialog box.

After calling checkWord, you can use this to get the dialog box's result code. The possible values are (from kspelldlg.h):

void  moveDlg (int x, int y)

Move the dialog.

If the dialog is not currently visible, it will be placed at this position when it becomes visible. Use this to get the dialog out of the way of a highlighted misspelled word in a document.

inline int  heightDlg ()

Retrieve the height of the dialog box.

inline int  widthDlg ()

Retrieve the width of the dialog box.

const QStringintermediateBuffer ()

Retrieve the partially spellchecked buffer.

You might want the full buffer in its partially-checked state.

bool  ignore (QString word)

[virtual]

Tell ISpell/ASpell to ignore this word for the life of this KSpell instance.

ignore() returns false if word is not a word or there was an error communicating with ISpell/ASpell.

bool  addPersonal (QString word)

[virtual]

Add a word to the user's personal dictionary.

Returns false if word is not a word or there was an error communicating with ISpell/ASpell.

KSpellConfig  ksConfig ()

[const]

Retrieve the KSpellConfig object being used by this KSpell instance.

void  setProgressResolution (unsigned res)

Set the resolution (in percent) of the progress() signals.

E.g. setProgressResolution (10) instructs KSpell to send progress signals (at most) every 10% (10%, 20%, 30%...). The default is 10%.

KSpell ()

[virtual]

The destructor instructs ISpell/ASpell to write out the personal dictionary and then terminates ISpell/ASpell.

int  modalCheck ( QString& text )

[static]

Perform a sychronous spellcheck.

This method does not return until spellchecking is done or canceled.

void  misspelling (QString originalword, QStringList *suggestions, unsigned pos)

[signal]

Emitted whenever a misspelled word is found by check() or by checkWord(). If it is emitted by checkWord(), pos=0. If it is emitted by check(), then pos indicates the position of the misspelled word in the (original) _buffer. (The first position is zero.) If it is emitted by checkList(), pos is the index to the misspelled word in the QStringList passed to checkList().

These are called _before_ the dialog is opened, so that the calling program's GUI may be updated. (e.g. the misspelled word may be highlighted).

void  corrected (QString originalword, QString newword, unsigned pos)

[signal]

Emitted after the dialog is closed, or if the word was corrected without calling the dialog (i.e., the user previously chose "Replace All" for this word).

Results from the dialog may be checked with dlgResult() and replacement()

void  ready (KSpell *)

[signal]

Emitted after KSpell has verified that ISpell/ASpell is running and working properly.

void  progress (unsigned int i)

[signal]

Emitted during a check(). i is between 1 and 100.

void  done (const QString &buffer)

[signal]

Emitted when check() is done.

Be sure to copy the results of buffer if you need them. You can only rely on the contents of buffer for the life of the slot which was signaled by done().

void  done (bool)

[signal]

Emitted when checkList() is done.

If the argument is true, then you should update your text from the wordlist, otherwise not.

void  death ( )

[signal]

Emitted on terminal errors and after clean up.

You can delete the KSpell object in this signal.

You can check status() to see what caused the death:

bool modaldlg

[protected]

Used for modalCheck.


Generated by: root@porky.devel.redhat.com on Wed May 10 08:57:10 2000, using kdoc 2.0a35.