Ticket #105: spell-checker.patch
| File spell-checker.patch, 8.2 KB (added by amroth, 4 years ago) |
|---|
-
kmess/chat/chatwindow.h
128 128 void toggleEmoticons(bool useEmoticons); 129 129 // Called when the "show sidebar" action is called. 130 130 void toggleSidebar(); 131 // Called when the "use spell checking" action is called. 132 void toggleSpellCheck( bool useSpellCheck ); 131 133 132 134 private: // Private methods 133 135 // Check if the user enabled an auto-reply, and send it -
kmess/chat/chatwindowinterface.cpp
316 316 settingsMenu = new KPopupMenu( this, "settingsmenu" ); 317 317 318 318 // Create the "settings" menus 319 emoticonAction_ = new KToggleAction( i18n("Show &Emoticons"), "services", KShortcut(), this, "emoticons" ); 320 sidebarAction_ = new KAction ( i18n("Show/Hide &Contact Sidebar"), "fonts", KShortcut( QKeySequence( "Ctrl+T" ) ), this, "sidebar" ); 319 spellCheckAction_ = new KToggleAction( i18n("Use &Spell Checking"), "spellcheck", KShortcut(), this, "spellcheck" ); 320 emoticonAction_ = new KToggleAction( i18n("Show &Emoticons"), "services", KShortcut(), this, "emoticons" ); 321 sidebarAction_ = new KAction ( i18n("Show/Hide &Contact Sidebar"), "fonts", KShortcut( QKeySequence( "Ctrl+T" ) ), this, "sidebar" ); 321 322 showToolBar_ = KStdAction::showToolbar ( this, SLOT( showToolBar() ), actionCollection() ); 322 323 showStatusBar_ = KStdAction::showStatusbar( this, SLOT( showStatusBar() ), actionCollection() ); 323 324 324 connect ( emoticonAction_, SIGNAL( toggled(bool) ), 325 this, SLOT ( toggleEmoticons(bool) ) ); 326 connect ( sidebarAction_, SIGNAL( activated() ), 327 this, SLOT ( toggleSidebar() ) ); 325 connect ( emoticonAction_, SIGNAL( toggled(bool) ), 326 this, SLOT ( toggleEmoticons(bool) ) ); 327 connect ( sidebarAction_, SIGNAL( activated() ), 328 this, SLOT ( toggleSidebar() ) ); 329 connect ( spellCheckAction_, SIGNAL( toggled(bool) ), 330 this, SLOT ( toggleSpellCheck(bool) ) ); 328 331 329 332 // Give the sidebar action a tool tip like the standard actions 330 333 sidebarAction_ ->setToolTip( i18n("Show or hide the contact sidebar") ); … … 332 335 sidebarAction_->setIcon( "view_right" ); 333 336 334 337 // Plug the items into "settings" 335 emoticonAction_->plug( settingsMenu ); 336 showToolBar_-> plug( settingsMenu ); 337 showStatusBar_-> plug( settingsMenu ); 338 sidebarAction_-> plug( settingsMenu ); 338 spellCheckAction_->plug( settingsMenu ); 339 settingsMenu->insertSeparator(); 340 emoticonAction_ ->plug( settingsMenu ); 341 showToolBar_ ->plug( settingsMenu ); 342 showStatusBar_ ->plug( settingsMenu ); 343 sidebarAction_ ->plug( settingsMenu ); 339 344 340 345 // Plug the menu into the menubar 341 346 menuBar()->insertItem( i18n("&Settings"), settingsMenu ); … … 472 477 } 473 478 474 479 480 481 // Called when the "use spell checking" action is called. 482 void ChatWindowInterface::toggleSpellCheck( bool /*useSpellCheck*/ ) 483 { 484 kdDebug() << "ChatWindowInterface::toggleSpellCheck not implemented" << endl; 485 } 486 487 475 488 #include "chatwindowinterface.moc" -
kmess/chat/chatwindow.cpp
26 26 #include <qregexp.h> 27 27 #include <qstylesheet.h> 28 28 #include <qtextcodec.h> 29 #include <qtextedit.h>30 29 #include <qtoolbox.h> 31 30 32 31 #include <kaction.h> … … 42 41 #include <kprocess.h> 43 42 #include <kstatusbar.h> 44 43 #include <ksqueezedtextlabel.h> 44 #include <ksyntaxhighlighter.h> 45 45 #include <ktextbrowser.h> 46 #include <ktextedit.h> 46 47 #include <ktoolbarbutton.h> 47 48 48 49 #include "../actions/accountaction.h" … … 1048 1049 kdDebug() << "ChatWindow::readProperties() - Reading saved properties." << endl; 1049 1050 #endif 1050 1051 1052 // First save the general interface settings 1051 1053 ChatWindowInterface::readProperties( config ); 1052 1054 1053 // Decomment should we need to read or save something again 1054 // config->setGroup("Chat Window"); 1055 // Start saving our stuff 1056 config->setGroup( "Chat Window" ); 1057 1058 // Save the spell checking preference 1059 toggleSpellCheck( config->readBoolEntry("UseSpellCheck", false) ); 1060 1055 1061 } 1056 1062 1057 1063 … … 1289 1295 kdDebug() << "ChatWindow - Saving properties." << endl; 1290 1296 #endif 1291 1297 1298 // First save the general interface settings 1299 ChatWindowInterface::saveProperties( config ); 1300 1301 1302 // Start saving our stuff 1303 config->setGroup( "Chat Window" ); 1304 1305 // Save the spell checking preference 1306 config->writeEntry( "UseSpellCheck", chatView_->messageEdit_->checkSpellingEnabled() ); 1307 1292 1308 // Also save ChatView's settings 1293 1309 chatView_->saveProperties( config ); 1294 1295 ChatWindowInterface::saveProperties( config );1296 1297 // Decomment should we need to read or save something again1298 // config->setGroup( "Chat Window" );1299 1310 } 1300 1311 1301 1312 … … 1656 1667 1657 1668 1658 1669 1670 // Called when the "use spell checking" action is called. 1671 void ChatWindow::toggleSpellCheck( bool useSpellCheck ) 1672 { 1673 // Don't crash if the chat view isn't available 1674 if( KMESS_NULL(chatView_) ) return; 1675 1676 #ifdef KMESSDEBUG_CHATWINDOW_GENERAL 1677 kdDebug() << "ChatWindow::toggleSpellCheck() - Spell checking is now " << useSpellCheck << endl; 1678 #endif 1679 1680 // Access the spell checker 1681 QSyntaxHighlighter *syntax = chatView_->messageEdit_->syntaxHighlighter(); 1682 KDictSpellingHighlighter *spell = dynamic_cast<KDictSpellingHighlighter*>( syntax ); 1683 1684 if( spell ) 1685 { 1686 // Put it to work 1687 spell->setAutomatic( useSpellCheck ); 1688 spell->setActive( useSpellCheck ); 1689 } 1690 #ifdef KMESSDEBUG_CHATWINDOW_GENERAL 1691 else 1692 { 1693 kdDebug() << "ChatWindow::toggleSpellCheck() - Spell checking unavailable." << endl; 1694 } 1695 #endif 1696 1697 // Enable the spell check for the message editor 1698 chatView_->messageEdit_->setCheckSpellingEnabled( useSpellCheck ); 1699 } 1700 1701 1702 1659 1703 // Called when the "show sidebar" action is called. 1660 1704 void ChatWindow::toggleSidebar() 1661 1705 { -
kmess/chat/chatview.cpp
27 27 #include <qstringlist.h> 28 28 #include <qtextbrowser.h> 29 29 #include <qtextcodec.h> 30 #include <qtextedit.h>31 30 #include <qtoolbox.h> 32 31 33 32 #include <kaction.h> … … 42 41 #include <krun.h> 43 42 #include <kstddirs.h> 44 43 #include <ktextbrowser.h> 44 #include <ktextedit.h> 45 45 #include <kurl.h> 46 46 47 47 #include "chatmessage.h" -
kmess/chat/chatviewinterface.ui
192 192 </spacer> 193 193 </vbox> 194 194 </widget> 195 <widget class=" QTextEdit" row="0" column="0">195 <widget class="KTextEdit" row="0" column="0"> 196 196 <property name="name"> 197 197 <cstring>messageEdit_</cstring> 198 198 </property> -
kmess/chat/chatwindowinterface.h
79 79 virtual void toggleEmoticons(bool useEmoticons); 80 80 // Called when the "show sidebar" action is called. 81 81 virtual void toggleSidebar(); 82 // Called when the "use spell checking" action is called. 83 virtual void toggleSpellCheck(bool useSpellCheck); 82 84 // Send a nudge 83 85 virtual void slotSendNudge(); 84 86 // Send a file to a contact. … … 99 101 KToggleAction *showStatusBar_, *showToolBar_; 100 102 // The sidebar toggle 101 103 KAction *sidebarAction_; 104 // The spell checking toggle 105 KToggleAction *spellCheckAction_; 102 106 103 107 104 108 private: // Private methods
