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

List:       kde-commits
Subject:    make_it_cool: kdenetwork/kmail
From:       Don Sanders <don () sanders ! org>
Date:       2003-01-27 15:23:40
[Download RAW message or body]

CVS commit by sanders: 

Syntax highlighter optimizations.


  M +10 -2     kmcomposewin.cpp   1.586.2.44
  M +15 -0     kmsyntaxhighlighter.cpp   1.1.2.2
  M +3 -1      kmsyntaxhighlighter.h   1.1.2.2


--- kdenetwork/kmail/kmsyntaxhighlighter.h  #1.1.2.1:1.1.2.2
@@ -73,7 +73,9 @@ public:
 
     virtual bool isMisspelled( const QString& word );
+    static void reset();
 
 protected slots:
      void slotMisspelling (const QString & originalword, const QStringList & \
suggestions, unsigned int pos); +    void slotRehighlight();
 
 private:

--- kdenetwork/kmail/kmsyntaxhighlighter.cpp  #1.1.2.1:1.1.2.2
@@ -22,4 +22,5 @@
 #include <qregexp.h>
 #include <qsyntaxhighlighter.h>
+#include <qtimer.h>
 #include <kconfig.h>
 #include <kdebug.h>
@@ -191,4 +192,18 @@ void DictSpellChecker::slotMisspelling (
 
     // this is slow but since kspell is async this will have to do for now
+    QTimer::singleShot(0, this, SLOT(slotRehighlight()));
+}
+
+void DictSpellChecker::reset()
+{
+    dict.clear();
+    //need to emit a signal that all dictspellcheck objects
+    //can connect to rehighlight. This will mean all open
+    //composers will be updated when manual spell checking
+    //finishes.
+}
+
+void DictSpellChecker::slotRehighlight()
+{
     rehighlight();
 }

--- kdenetwork/kmail/kmcomposewin.cpp  #1.586.2.43:1.586.2.44
@@ -5618,6 +5618,13 @@ void KMEdit::slotSpellResult(const QStri
     setModified(mWasModifiedBeforeSpellCheck);
   }
-
   mKSpell->cleanUp();
+  if (mSpellChecker) {
+    DictSpellChecker::reset();
+    delete mSpellChecker;
+    delete mIncSpell;
+    mIncSpell = new KSpell(this, i18n("Incremental Spellcheck - KMail"), this,
+                           SLOT(slotIncrementalSpellCheckReady(KSpell*)));
+  }
+  
   emit spellcheck_done( dlgResult );
 }
@@ -5651,3 +5658,4 @@ void KMEdit::slotIncrementalSpellCheckRe
 {
   mSpellChecker = new DictSpellChecker( this, spell );  
+  mSpellChecker->rehighlight();
 }


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

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