[PATCH] Sonnet::Highlighter API additions

Thomas McGuire thomas.mcguire at gmx.net
Fri May 2 15:18:19 BST 2008


Hi,

attached is a patch that makes some changes to the Sonnet highlighter.

The reason why this patch is needed is that the current method of suggesting 
replacements for a misspelled word is horribly inefficient: When a misspelled 
word is detected, the highlighter emits newSuggestions(QString,QStringList), 
which has the wrong word and a list of suggestions as parameters. The client 
(KMail in this case) then has to store a map of wrong words and their 
replacement suggestions. With long texts, this map can get quite big, 
especially because words are marked wrong when writing them, so the signal is 
emitted for word-fragments as well (for example, "ex", "exa", etc for 
"example").

This patch adds 2 new functions, isWordMisspelled() and suggestionsForWord(), 
which eliminate the need for that map.
The old newSuggestions() signal is deprecated.

While I was at it, I added ignoreWord() and newSuggestions(), so that a "Add 
to Dictionary" and "Ignore" actions are finally possible within context-menus.

I also removed some tabs.

Is it OK to commit this?

Regards,
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: highlighter.diff
Type: text/x-patch
Size: 6087 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20080502/be393e3a/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 194 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20080502/be393e3a/attachment.sig>


More information about the kde-core-devel mailing list