Index: kmess/chat/chatwindow.h
===================================================================
--- kmess/chat/chatwindow.h	(revisione 2202)
+++ kmess/chat/chatwindow.h	(copia locale)
@@ -128,6 +128,8 @@
     void               toggleEmoticons(bool useEmoticons);
     // Called when the "show sidebar" action is called.
     void               toggleSidebar();
+    // Called when the "use spell checking" action is called.
+    void               toggleSpellCheck( bool useSpellCheck );
 
   private: // Private methods
     // Check if the user enabled an auto-reply, and send it
Index: kmess/chat/chatwindowinterface.cpp
===================================================================
--- kmess/chat/chatwindowinterface.cpp	(revisione 2202)
+++ kmess/chat/chatwindowinterface.cpp	(copia locale)
@@ -316,15 +316,18 @@
   settingsMenu = new KPopupMenu( this, "settingsmenu" );
 
   // Create the "settings" menus
-  emoticonAction_ = new KToggleAction( i18n("Show &Emoticons"),            "services", KShortcut(), this, "emoticons" );
-  sidebarAction_  = new KAction      ( i18n("Show/Hide &Contact Sidebar"), "fonts",    KShortcut( QKeySequence( "Ctrl+T" ) ), this, "sidebar"   );
+  spellCheckAction_ = new KToggleAction( i18n("Use &Spell Checking"),        "spellcheck", KShortcut(), this, "spellcheck" );
+  emoticonAction_   = new KToggleAction( i18n("Show &Emoticons"),            "services",   KShortcut(), this, "emoticons" );
+  sidebarAction_    = new KAction      ( i18n("Show/Hide &Contact Sidebar"), "fonts",      KShortcut( QKeySequence( "Ctrl+T" ) ), this, "sidebar"   );
   showToolBar_    = KStdAction::showToolbar  ( this, SLOT( showToolBar() ),   actionCollection() );
   showStatusBar_  = KStdAction::showStatusbar( this, SLOT( showStatusBar() ), actionCollection() );
 
-  connect ( emoticonAction_, SIGNAL(         toggled(bool) ),
-            this,            SLOT  ( toggleEmoticons(bool) ) );
-  connect ( sidebarAction_,  SIGNAL(       activated()     ),
-            this,            SLOT  (   toggleSidebar()     ) );
+  connect ( emoticonAction_,   SIGNAL(          toggled(bool) ),
+            this,              SLOT  (  toggleEmoticons(bool) ) );
+  connect ( sidebarAction_,    SIGNAL(        activated()     ),
+            this,              SLOT  (    toggleSidebar()     ) );
+  connect ( spellCheckAction_, SIGNAL(          toggled(bool) ),
+            this,              SLOT  ( toggleSpellCheck(bool) ) );
 
   // Give the sidebar action a tool tip like the standard actions
   sidebarAction_ ->setToolTip( i18n("Show or hide the contact sidebar") );
@@ -332,10 +335,12 @@
   sidebarAction_->setIcon( "view_right" );
 
   // Plug the items into "settings"
-  emoticonAction_->plug( settingsMenu );
-  showToolBar_->   plug( settingsMenu );
-  showStatusBar_-> plug( settingsMenu );
-  sidebarAction_-> plug( settingsMenu );
+  spellCheckAction_->plug( settingsMenu );
+  settingsMenu->insertSeparator();
+  emoticonAction_  ->plug( settingsMenu );
+  showToolBar_     ->plug( settingsMenu );
+  showStatusBar_   ->plug( settingsMenu );
+  sidebarAction_   ->plug( settingsMenu );
 
   // Plug the menu into the menubar
   menuBar()->insertItem( i18n("&Settings"), settingsMenu );
@@ -472,4 +477,12 @@
 }
 
 
+
+// Called when the "use spell checking" action is called.
+void ChatWindowInterface::toggleSpellCheck( bool /*useSpellCheck*/ )
+{
+  kdDebug() << "ChatWindowInterface::toggleSpellCheck not implemented" << endl;
+}
+
+
 #include "chatwindowinterface.moc"
Index: kmess/chat/chatwindow.cpp
===================================================================
--- kmess/chat/chatwindow.cpp	(revisione 2202)
+++ kmess/chat/chatwindow.cpp	(copia locale)
@@ -26,7 +26,6 @@
 #include <qregexp.h>
 #include <qstylesheet.h>
 #include <qtextcodec.h>
-#include <qtextedit.h>
 #include <qtoolbox.h>
 
 #include <kaction.h>
@@ -42,7 +41,9 @@
 #include <kprocess.h>
 #include <kstatusbar.h>
 #include <ksqueezedtextlabel.h>
+#include <ksyntaxhighlighter.h>
 #include <ktextbrowser.h>
+#include <ktextedit.h>
 #include <ktoolbarbutton.h>
 
 #include "../actions/accountaction.h"
@@ -1048,10 +1049,15 @@
   kdDebug() << "ChatWindow::readProperties() - Reading saved properties." << endl;
 #endif
 
+  // First save the general interface settings
   ChatWindowInterface::readProperties( config );
 
-// Decomment should we need to read or save something again
-//  config->setGroup("Chat Window");
+  // Start saving our stuff
+  config->setGroup( "Chat Window" );
+
+  // Save the spell checking preference
+  toggleSpellCheck( config->readBoolEntry("UseSpellCheck", false) );
+
 }
 
 
@@ -1289,13 +1295,18 @@
   kdDebug() << "ChatWindow - Saving properties." << endl;
 #endif
 
+  // First save the general interface settings
+  ChatWindowInterface::saveProperties( config );
+
+
+  // Start saving our stuff
+  config->setGroup( "Chat Window" );
+
+  // Save the spell checking preference
+  config->writeEntry( "UseSpellCheck", chatView_->messageEdit_->checkSpellingEnabled() );
+
   // Also save ChatView's settings
   chatView_->saveProperties( config );
-
-  ChatWindowInterface::saveProperties( config );
-
-// Decomment should we need to read or save something again
-//   config->setGroup( "Chat Window" );
 }
 
 
@@ -1656,6 +1667,39 @@
 
 
 
+// Called when the "use spell checking" action is called.
+void ChatWindow::toggleSpellCheck( bool useSpellCheck )
+{
+  // Don't crash if the chat view isn't available
+  if( KMESS_NULL(chatView_) ) return;
+
+#ifdef KMESSDEBUG_CHATWINDOW_GENERAL
+  kdDebug() << "ChatWindow::toggleSpellCheck() - Spell checking is now " << useSpellCheck << endl;
+#endif
+
+  // Access the spell checker
+  QSyntaxHighlighter       *syntax = chatView_->messageEdit_->syntaxHighlighter();
+  KDictSpellingHighlighter *spell  = dynamic_cast<KDictSpellingHighlighter*>( syntax );
+
+  if( spell )
+  {
+    // Put it to work
+    spell->setAutomatic( useSpellCheck );
+    spell->setActive( useSpellCheck );
+  }
+#ifdef KMESSDEBUG_CHATWINDOW_GENERAL
+  else
+  {
+    kdDebug() << "ChatWindow::toggleSpellCheck() - Spell checking unavailable." << endl;
+  }
+#endif
+
+  // Enable the spell check for the message editor
+  chatView_->messageEdit_->setCheckSpellingEnabled( useSpellCheck );
+}
+
+
+
 // Called when the "show sidebar" action is called.
 void ChatWindow::toggleSidebar()
 {
Index: kmess/chat/chatview.cpp
===================================================================
--- kmess/chat/chatview.cpp	(revisione 2202)
+++ kmess/chat/chatview.cpp	(copia locale)
@@ -27,7 +27,6 @@
 #include <qstringlist.h>
 #include <qtextbrowser.h>
 #include <qtextcodec.h>
-#include <qtextedit.h>
 #include <qtoolbox.h>
 
 #include <kaction.h>
@@ -42,6 +41,7 @@
 #include <krun.h>
 #include <kstddirs.h>
 #include <ktextbrowser.h>
+#include <ktextedit.h>
 #include <kurl.h>
 
 #include "chatmessage.h"
Index: kmess/chat/chatviewinterface.ui
===================================================================
--- kmess/chat/chatviewinterface.ui	(revisione 2202)
+++ kmess/chat/chatviewinterface.ui	(copia locale)
@@ -192,7 +192,7 @@
                                 </spacer>
                             </vbox>
                         </widget>
-                        <widget class="QTextEdit" row="0" column="0">
+                        <widget class="KTextEdit" row="0" column="0">
                             <property name="name">
                                 <cstring>messageEdit_</cstring>
                             </property>
Index: kmess/chat/chatwindowinterface.h
===================================================================
--- kmess/chat/chatwindowinterface.h	(revisione 2202)
+++ kmess/chat/chatwindowinterface.h	(copia locale)
@@ -79,6 +79,8 @@
     virtual void     toggleEmoticons(bool useEmoticons);
     // Called when the "show sidebar" action is called.
     virtual void     toggleSidebar();
+    // Called when the "use spell checking" action is called.
+    virtual void     toggleSpellCheck(bool useSpellCheck);
     // Send a nudge
     virtual void     slotSendNudge();
     // Send a file to a contact.
@@ -99,6 +101,8 @@
     KToggleAction   *showStatusBar_, *showToolBar_;
     // The sidebar toggle
     KAction         *sidebarAction_;
+    // The spell checking toggle
+    KToggleAction   *spellCheckAction_;
 
 
   private: // Private methods

