[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/lib/kotext
From:       David Faure <faure () kde ! org>
Date:       2006-01-04 10:39:23
Message-ID: 1136371163.177276.27837.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 494210 by dfaure:

Fix no spell checking happening on paragraphs that were created by insert(), e.g. \
when pasting a large amount of plain text. The fix is basically implementing a TODO \
in insert(), and adding a '!' in KoBgSpellCheck::slotParagraphCreated, the rest is \
just cleanup.


 M  +1 -2      KoBgSpellCheck.cpp  
 M  +0 -6      KoBgSpellCheck.h  
 M  +7 -7      KoSpell.cpp  
 M  +1 -7      KoSpell.h  
 M  +1 -1      KoTextIterator.cpp  
 M  +7 -3      KoTextObject.cpp  


--- trunk/koffice/lib/kotext/KoBgSpellCheck.cpp #494209:494210
@@ -193,7 +193,7 @@
 
 void KoBgSpellCheck::slotParagraphCreated( KoTextParag* parag )
 {
-    if ( d->backSpeller->check( parag ) ) {
+    if ( !d->backSpeller->check( parag ) ) {
         d->paragCache.insert( parag, parag );
     }
 }
@@ -201,7 +201,6 @@
 void KoBgSpellCheck::slotParagraphModified( KoTextParag* parag, int \
/*ParagModifyType*/,  int pos, int length )
 {
-    //kdDebug()<<"here 1 "<<endl;
     if ( d->backSpeller->checking() ) {
         d->paragCache.insert( parag, parag );
         return;
--- trunk/koffice/lib/kotext/KoBgSpellCheck.h #494209:494210
@@ -20,11 +20,6 @@
 #ifndef KOBGSPELLCHECK_H
 #define KOBGSPELLCHECK_H
 
-/// OK including config.h in public headers is bad practice - to be removed once \
                kspell2 is required
-#include <config.h>
-
-#ifdef HAVE_LIBKSPELL2
-
 #include <kspell2/broker.h>
 #include <qobject.h>
 #include <qstringlist.h>
@@ -76,4 +71,3 @@
     Private *d;
 };
 #endif
-#endif
--- trunk/koffice/lib/kotext/KoSpell.cpp #494209:494210
@@ -20,7 +20,6 @@
 */
 
 #include "config.h"
-#ifdef HAVE_LIBKSPELL2
 #include "KoSpell.h"
 
 #include "KoTextObject.h"
@@ -36,6 +35,8 @@
 
 #include <qtimer.h>
 
+//#define DEBUG_SPELL
+
 using namespace KSpell2;
 
 class KoSpell::Private
@@ -114,7 +115,7 @@
     foundWord = w.word;
     start = w.start;
 #ifdef DEBUG_SPELL
-    kdDebug()<<"XXXXX WORD IS " << w.word << ", pos = "<< pos
+    kdDebug()<<"KoSpell: WORD IS " << w.word << ", pos = "<< pos
              << ", start = "<< w.start <<endl;
 #endif
     return checkWord( w.word );
@@ -123,7 +124,7 @@
 QString KoSpell::getMoreText()
 {
 #ifdef DEBUG_SPELL
-    kdDebug()<<"here 1 dialog = " << d->dialog << ", itr = "
+    kdDebug()<<"getMoreText: dialog = " << d->dialog << ", itr = "
              << d->itr << ", atEnd = "
              << ( ( d->itr ) ? d->itr->atEnd() : true )
              << endl;
@@ -212,9 +213,9 @@
 bool KoSpell::checking() const
 {
 #ifdef DEBUG_SPELL
-    kdDebug()<< d->itr << ", "
-             << ( ( d->itr ) ? d->itr->atEnd() : false ) << ", "
-             << filter()->atEnd()
+    kdDebug()<< "KoSpell::checking: itr=" << d->itr
+             << ", atEnd=" << ( ( d->itr ) ? d->itr->atEnd() : false )
+             << ", filter()->atEnd()=" << filter()->atEnd()
              << endl;
 #endif
     if ( d->itr ) {
@@ -238,4 +239,3 @@
 }
 
 #include "KoSpell.moc"
-#endif
--- trunk/koffice/lib/kotext/KoSpell.h #494209:494210
@@ -19,11 +19,6 @@
 #ifndef KOSPELL_H
 #define KOSPELL_H
 
-/// OK including config.h in public headers is bad practice - to be removed once \
                kspell2 is required
-#include <config.h>
-
-#ifdef HAVE_LIBKSPELL2
-
 #include <qobject.h>
 #include <qstringlist.h>
 #include <qstring.h>
@@ -69,7 +64,7 @@
      * Spellchecks a buffer of many words in plain text
      * format.
      *
-     * The @p _buffer is not modified.  The signal done() will be
+     * The buffer is not modified.  The signal done() will be
      * sent when @ref check() is finished.
      */
     virtual bool check( KoTextIterator *itr, bool dialog = false );
@@ -108,4 +103,3 @@
     Private *d;
 };
 #endif
-#endif
--- trunk/koffice/lib/kotext/KoTextIterator.cpp #494209:494210
@@ -1,5 +1,5 @@
 /* This file is part of the KDE project
-   Copyright (C) 2002 David Faure <faure@kde.org>
+   Copyright (C) 2002-2006 David Faure <faure@kde.org>
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
--- trunk/koffice/lib/kotext/KoTextObject.cpp #494209:494210
@@ -718,9 +718,13 @@
 
     // Notifications
     emit paragraphModified( oldCursor.parag(), AddChar, cursor->index(), \
                txt.length() );
-    // TODO
-    // if (checkNewLine)
-    //     emit paragraphCreated for every paragraph from oldCursor->parag()->next() \
until cursor->parag() +    if (checkNewLine) {
+        KoTextParag* p = oldCursor.parag()->next();
+        while ( p && p != cursor->parag() ) {
+            emit paragraphCreated( p );
+            p = p->next();
+        }
+    }
 }
 
 void KoTextObject::pasteText( KoTextCursor * cursor, const QString & text, \
KoTextFormat * currentFormat, bool removeSelected )


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic