00001
00002
00003
00004
00005
00006 #include <config.h>
00007
00008 #include "kmedit.h"
00009 #include "kmlineeditspell.h"
00010
00011 #define REALLY_WANT_KMCOMPOSEWIN_H
00012 #include "kmcomposewin.h"
00013 #undef REALLY_WANT_KMCOMPOSEWIN_H
00014 #include "kmmsgdict.h"
00015 #include "kmfolder.h"
00016 #include "kmcommands.h"
00017
00018 #include <maillistdrag.h>
00019 using KPIM::MailListDrag;
00020
00021 #include <libkdepim/kfileio.h>
00022 #include <libemailfunctions/email.h>
00023
00024 #include <kcursor.h>
00025 #include <kprocess.h>
00026
00027 #include <kpopupmenu.h>
00028 #include <kdebug.h>
00029 #include <kmessagebox.h>
00030 #include <kurldrag.h>
00031
00032 #include <ktempfile.h>
00033 #include <klocale.h>
00034 #include <kapplication.h>
00035 #include <kdirwatch.h>
00036 #include <kiconloader.h>
00037
00038 #include "globalsettings.h"
00039 #include "replyphrases.h"
00040
00041 #include <kspell.h>
00042 #include <kspelldlg.h>
00043 #include <spellingfilter.h>
00044 #include <ksyntaxhighlighter.h>
00045
00046 #include <qregexp.h>
00047 #include <qbuffer.h>
00048 #include <qevent.h>
00049
00050 #include <sys/stat.h>
00051 #include <sys/types.h>
00052 #include <stdlib.h>
00053 #include <unistd.h>
00054 #include <errno.h>
00055 #include <fcntl.h>
00056 #include <assert.h>
00057
00058
00059 void KMEdit::contentsDragEnterEvent(QDragEnterEvent *e)
00060 {
00061 if (e->provides(MailListDrag::format()))
00062 e->accept(true);
00063 else
00064 return KEdit::contentsDragEnterEvent(e);
00065 }
00066
00067 void KMEdit::contentsDragMoveEvent(QDragMoveEvent *e)
00068 {
00069 if (e->provides(MailListDrag::format()))
00070 e->accept();
00071 else
00072 return KEdit::contentsDragMoveEvent(e);
00073 }
00074
00075 void KMEdit::keyPressEvent( QKeyEvent* e )
00076 {
00077 if( e->key() == Key_Return ) {
00078 int line, col;
00079 getCursorPosition( &line, &col );
00080 QString lineText = text( line );
00081
00082 lineText.truncate( lineText.length() - 1 );
00083
00084
00085 if( ( col > 0 ) && ( col < int( lineText.length() ) ) ) {
00086 bool isQuotedLine = false;
00087 uint bot = 0;
00088 while( bot < lineText.length() ) {
00089 if( ( lineText[bot] == '>' ) || ( lineText[bot] == '|' ) ) {
00090 isQuotedLine = true;
00091 ++bot;
00092 }
00093 else if( lineText[bot].isSpace() ) {
00094 ++bot;
00095 }
00096 else {
00097 break;
00098 }
00099 }
00100
00101 KEdit::keyPressEvent( e );
00102
00103
00104
00105
00106 if( isQuotedLine
00107 && ( bot != lineText.length() )
00108 && ( col >= int( bot ) ) ) {
00109
00110
00111
00112 getCursorPosition( &line, &col );
00113 QString newLine = text( line );
00114
00115
00116 unsigned int leadingWhiteSpaceCount = 0;
00117 while( ( leadingWhiteSpaceCount < newLine.length() )
00118 && newLine[leadingWhiteSpaceCount].isSpace() ) {
00119 ++leadingWhiteSpaceCount;
00120 }
00121 newLine = newLine.replace( 0, leadingWhiteSpaceCount,
00122 lineText.left( bot ) );
00123 removeParagraph( line );
00124 insertParagraph( newLine, line );
00125
00126
00127
00128 setCursorPosition( line, 0 );
00129 }
00130 }
00131 else
00132 KEdit::keyPressEvent( e );
00133 }
00134 else
00135 KEdit::keyPressEvent( e );
00136 }
00137
00138 void KMEdit::contentsDropEvent(QDropEvent *e)
00139 {
00140 if (e->provides(MailListDrag::format())) {
00141
00142 QByteArray serNums;
00143 MailListDrag::decode( e, serNums );
00144 QBuffer serNumBuffer(serNums);
00145 serNumBuffer.open(IO_ReadOnly);
00146 QDataStream serNumStream(&serNumBuffer);
00147 unsigned long serNum;
00148 KMFolder *folder = 0;
00149 int idx;
00150 QPtrList<KMMsgBase> messageList;
00151 while (!serNumStream.atEnd()) {
00152 KMMsgBase *msgBase = 0;
00153 serNumStream >> serNum;
00154 KMMsgDict::instance()->getLocation(serNum, &folder, &idx);
00155 if (folder)
00156 msgBase = folder->getMsgBase(idx);
00157 if (msgBase)
00158 messageList.append( msgBase );
00159 }
00160 serNumBuffer.close();
00161 uint identity = folder ? folder->identity() : 0;
00162 KMCommand *command =
00163 new KMForwardAttachedCommand(mComposer, messageList,
00164 identity, mComposer);
00165 command->start();
00166 }
00167 else if( KURLDrag::canDecode( e ) ) {
00168 KURL::List urlList;
00169 if( KURLDrag::decode( e, urlList ) ) {
00170 KPopupMenu p;
00171 p.insertItem( i18n("Add as Text"), 0 );
00172 p.insertItem( i18n("Add as Attachment"), 1 );
00173 int id = p.exec( mapToGlobal( e->pos() ) );
00174 switch ( id) {
00175 case 0:
00176 for ( KURL::List::Iterator it = urlList.begin();
00177 it != urlList.end(); ++it ) {
00178 insert( (*it).url() );
00179 }
00180 break;
00181 case 1:
00182 for ( KURL::List::Iterator it = urlList.begin();
00183 it != urlList.end(); ++it ) {
00184 mComposer->addAttach( *it );
00185 }
00186 break;
00187 }
00188 }
00189 else if ( QTextDrag::canDecode( e ) ) {
00190 QString s;
00191 if ( QTextDrag::decode( e, s ) )
00192 insert( s );
00193 }
00194 else
00195 kdDebug(5006) << "KMEdit::contentsDropEvent, unable to add dropped object" << endl;
00196 }
00197 else {
00198 return KEdit::contentsDropEvent(e);
00199 }
00200 }
00201
00202 KMEdit::KMEdit(QWidget *parent, KMComposeWin* composer,
00203 KSpellConfig* autoSpellConfig,
00204 const char *name)
00205 : KEdit( parent, name ),
00206 mComposer( composer ),
00207 mKSpell( 0 ),
00208 mSpellConfig( autoSpellConfig ),
00209 mSpellingFilter( 0 ),
00210 mExtEditorTempFile( 0 ),
00211 mExtEditorTempFileWatcher( 0 ),
00212 mExtEditorProcess( 0 ),
00213 mUseExtEditor( false ),
00214 mWasModifiedBeforeSpellCheck( false ),
00215 mSpellChecker( 0 ),
00216 mSpellLineEdit( false )
00217 {
00218 installEventFilter(this);
00219 KCursor::setAutoHideCursor( this, true, true );
00220 setOverwriteEnabled( true );
00221 }
00222
00223
00224 void KMEdit::initializeAutoSpellChecking()
00225 {
00226 if ( mSpellChecker )
00227 return;
00228 QColor defaultColor1( 0x00, 0x80, 0x00 );
00229 QColor defaultColor2( 0x00, 0x70, 0x00 );
00230 QColor defaultColor3( 0x00, 0x60, 0x00 );
00231 QColor defaultForeground( kapp->palette().active().text() );
00232
00233 QColor c = Qt::red;
00234 KConfigGroup readerConfig( KMKernel::config(), "Reader" );
00235 QColor col1;
00236 if ( !readerConfig.readBoolEntry( "defaultColors", true ) )
00237 col1 = readerConfig.readColorEntry( "ForegroundColor", &defaultForeground );
00238 else
00239 col1 = defaultForeground;
00240 QColor col2 = readerConfig.readColorEntry( "QuotedText3", &defaultColor3 );
00241 QColor col3 = readerConfig.readColorEntry( "QuotedText2", &defaultColor2 );
00242 QColor col4 = readerConfig.readColorEntry( "QuotedText1", &defaultColor1 );
00243 QColor misspelled = readerConfig.readColorEntry( "MisspelledColor", &c );
00244 mSpellChecker = new KDictSpellingHighlighter( this, true,
00245 false,
00246 misspelled,
00247 true,
00248 col1, col2, col3, col4,
00249 mSpellConfig );
00250
00251 connect( mSpellChecker, SIGNAL(activeChanged(const QString &)),
00252 mComposer, SLOT(slotStatusMessage(const QString &)));
00253 connect( mSpellChecker, SIGNAL(newSuggestions(const QString&, const QStringList&, unsigned int)),
00254 this, SLOT(addSuggestion(const QString&, const QStringList&, unsigned int)) );
00255 }
00256
00257
00258 QPopupMenu *KMEdit::createPopupMenu( const QPoint& pos )
00259 {
00260 enum { IdUndo, IdRedo, IdSep1, IdCut, IdCopy, IdPaste, IdClear, IdSep2, IdSelectAll };
00261
00262 QPopupMenu *menu = KEdit::createPopupMenu( pos );
00263 if ( !QApplication::clipboard()->image().isNull() ) {
00264 int id = menu->idAt(0);
00265 menu->setItemEnabled( id - IdPaste, true);
00266 }
00267
00268 return menu;
00269 }
00270
00271 void KMEdit::deleteAutoSpellChecking()
00272 {
00273 delete mSpellChecker;
00274 mSpellChecker =0;
00275 }
00276
00277 void KMEdit::addSuggestion(const QString& text, const QStringList& lst, unsigned int )
00278 {
00279 mReplacements[text] = lst;
00280 }
00281
00282 void KMEdit::setSpellCheckingActive(bool spellCheckingActive)
00283 {
00284 if ( mSpellChecker ) {
00285 mSpellChecker->setActive(spellCheckingActive);
00286 }
00287 }
00288
00289
00290 KMEdit::~KMEdit()
00291 {
00292 removeEventFilter(this);
00293
00294 delete mKSpell;
00295 delete mSpellChecker;
00296 mSpellChecker = 0;
00297
00298 }
00299
00300
00301
00302 QString KMEdit::brokenText()
00303 {
00304 QString temp, line;
00305
00306 int num_lines = numLines();
00307 for (int i = 0; i < num_lines; ++i)
00308 {
00309 int lastLine = 0;
00310 line = textLine(i);
00311 for (int j = 0; j < (int)line.length(); ++j)
00312 {
00313 if (lineOfChar(i, j) > lastLine)
00314 {
00315 lastLine = lineOfChar(i, j);
00316 temp += '\n';
00317 }
00318 temp += line[j];
00319 }
00320 if (i + 1 < num_lines) temp += '\n';
00321 }
00322
00323 return temp;
00324 }
00325
00326
00327 unsigned int KMEdit::lineBreakColumn() const
00328 {
00329 unsigned int lineBreakColumn = 0;
00330 unsigned int numlines = numLines();
00331 while ( numlines-- ) {
00332 lineBreakColumn = QMAX( lineBreakColumn, textLine( numlines ).length() );
00333 }
00334 return lineBreakColumn;
00335 }
00336
00337
00338 bool KMEdit::eventFilter(QObject*o, QEvent* e)
00339 {
00340 if (o == this)
00341 KCursor::autoHideEventFilter(o, e);
00342
00343 if (e->type() == QEvent::KeyPress)
00344 {
00345 QKeyEvent *k = (QKeyEvent*)e;
00346
00347 if (mUseExtEditor) {
00348 if (k->key() == Key_Up)
00349 {
00350 emit focusUp();
00351 return TRUE;
00352 }
00353
00354
00355 if ( (k->key() == Key_Shift) || (k->key() == Key_Control) ||
00356 (k->key() == Key_Meta) || (k->key() == Key_Alt) )
00357 return true;
00358 if (mExtEditorTempFile) return TRUE;
00359 QString sysLine = mExtEditor;
00360 mExtEditorTempFile = new KTempFile();
00361
00362 mExtEditorTempFile->setAutoDelete(true);
00363
00364 (*mExtEditorTempFile->textStream()) << text();
00365
00366 mExtEditorTempFile->close();
00367
00368 sysLine.replace( "%f", mExtEditorTempFile->name() );
00369 mExtEditorProcess = new KProcess();
00370 mExtEditorProcess->setUseShell( true );
00371 sysLine += " ";
00372 while (!sysLine.isEmpty())
00373 {
00374 *mExtEditorProcess << sysLine.left(sysLine.find(" ")).local8Bit();
00375 sysLine.remove(0, sysLine.find(" ") + 1);
00376 }
00377 connect(mExtEditorProcess, SIGNAL(processExited(KProcess*)),
00378 SLOT(slotExternalEditorDone(KProcess*)));
00379 if (!mExtEditorProcess->start())
00380 {
00381 KMessageBox::error( topLevelWidget(),
00382 i18n("Unable to start external editor.") );
00383 killExternalEditor();
00384 } else {
00385 mExtEditorTempFileWatcher = new KDirWatch( this, "mExtEditorTempFileWatcher" );
00386 connect( mExtEditorTempFileWatcher, SIGNAL(dirty(const QString&)),
00387 SLOT(slotExternalEditorTempFileChanged(const QString&)) );
00388 mExtEditorTempFileWatcher->addFile( mExtEditorTempFile->name() );
00389 }
00390 return TRUE;
00391 } else {
00392
00393
00394 if (k->key() == Key_Up && k->state() != ShiftButton && currentLine() == 0
00395 && lineOfChar(0, currentColumn()) == 0)
00396 {
00397 deselect();
00398 emit focusUp();
00399 return TRUE;
00400 }
00401
00402
00403 if (k->key() == Key_Backtab && k->state() == ShiftButton)
00404 {
00405 deselect();
00406 emit focusUp();
00407 return TRUE;
00408 }
00409
00410 }
00411 } else if ( e->type() == QEvent::ContextMenu ) {
00412 QContextMenuEvent *event = (QContextMenuEvent*) e;
00413
00414 int para = 1, charPos, firstSpace, lastSpace;
00415
00416
00417 charPos = charAt( viewportToContents(event->pos()), ¶ );
00418 QString paraText = text( para );
00419
00420 if( !paraText.at(charPos).isSpace() )
00421 {
00422
00423 const QRegExp wordBoundary( "[\\s\\W]" );
00424 firstSpace = paraText.findRev( wordBoundary, charPos ) + 1;
00425 lastSpace = paraText.find( wordBoundary, charPos );
00426 if( lastSpace == -1 )
00427 lastSpace = paraText.length();
00428 QString word = paraText.mid( firstSpace, lastSpace - firstSpace );
00429
00430 if( !word.isEmpty() && mReplacements.contains( word ) )
00431 {
00432 KPopupMenu p;
00433 p.insertTitle( i18n("Suggestions") );
00434
00435
00436 QStringList reps = mReplacements[word];
00437 if( reps.count() > 0 )
00438 {
00439 int listPos = 0;
00440 for ( QStringList::Iterator it = reps.begin(); it != reps.end(); ++it ) {
00441 p.insertItem( *it, listPos );
00442 listPos++;
00443 }
00444 }
00445 else
00446 {
00447 p.insertItem( QString::fromLatin1("No Suggestions"), -2 );
00448 }
00449
00450
00451 int id = p.exec( mapToGlobal( event->pos() ) );
00452
00453 if( id > -1 )
00454 {
00455
00456 int parIdx = 1, txtIdx = 1;
00457 getCursorPosition(&parIdx, &txtIdx);
00458 setSelection(para, firstSpace, para, lastSpace);
00459 insert(mReplacements[word][id]);
00460
00461
00462 if ( para == parIdx && txtIdx >= lastSpace )
00463 txtIdx += mReplacements[word][id].length() - word.length();
00464 setCursorPosition(parIdx, txtIdx);
00465 }
00466
00467 return true;
00468 }
00469 }
00470 } else if ( e->type() == QEvent::FocusIn || e->type() == QEvent::FocusOut ) {
00471 QFocusEvent *fe = static_cast<QFocusEvent*>(e);
00472 if(! (fe->reason() == QFocusEvent::ActiveWindow || fe->reason() == QFocusEvent::Popup) )
00473 emit focusChanged( fe->gotFocus() );
00474 }
00475
00476 return KEdit::eventFilter(o, e);
00477 }
00478
00479
00480 int KMEdit::autoSpellChecking( bool on )
00481 {
00482 if ( textFormat() == Qt::RichText ) {
00483
00484 if ( on )
00485 KMessageBox::sorry(this, i18n("Automatic spellchecking is not possible on text with markup."));
00486 return -1;
00487 }
00488 if ( mSpellChecker ) {
00489
00490 mSpellChecker->setAutomatic( on );
00491 mSpellChecker->setActive( on );
00492 }
00493 return 1;
00494 }
00495
00496
00497 void KMEdit::slotExternalEditorTempFileChanged( const QString & fileName ) {
00498 if ( !mExtEditorTempFile )
00499 return;
00500 if ( fileName != mExtEditorTempFile->name() )
00501 return;
00502
00503 setAutoUpdate(false);
00504 clear();
00505
00506 insertLine(QString::fromLocal8Bit(KPIM::kFileToString( fileName, true, false )), -1);
00507 setAutoUpdate(true);
00508 repaint();
00509 }
00510
00511 void KMEdit::slotExternalEditorDone( KProcess * proc ) {
00512 assert(proc == mExtEditorProcess);
00513
00514 slotExternalEditorTempFileChanged( mExtEditorTempFile->name() );
00515 killExternalEditor();
00516 }
00517
00518 void KMEdit::killExternalEditor() {
00519 delete mExtEditorTempFileWatcher; mExtEditorTempFileWatcher = 0;
00520 delete mExtEditorTempFile; mExtEditorTempFile = 0;
00521 delete mExtEditorProcess; mExtEditorProcess = 0;
00522 }
00523
00524
00525 bool KMEdit::checkExternalEditorFinished() {
00526 if ( !mExtEditorProcess )
00527 return true;
00528 switch ( KMessageBox::warningYesNoCancel( topLevelWidget(),
00529 i18n("The external editor is still running.\n"
00530 "Abort the external editor or leave it open?"),
00531 i18n("External Editor"),
00532 i18n("Abort Editor"), i18n("Leave Editor Open") ) ) {
00533 case KMessageBox::Yes:
00534 killExternalEditor();
00535 return true;
00536 case KMessageBox::No:
00537 return true;
00538 default:
00539 return false;
00540 }
00541 }
00542
00543 void KMEdit::spellcheck()
00544 {
00545 if ( mKSpell )
00546 return;
00547 mWasModifiedBeforeSpellCheck = isModified();
00548 mSpellLineEdit = !mSpellLineEdit;
00549
00550
00551
00552
00553
00554
00555
00556 mKSpell = new KSpell(this, i18n("Spellcheck - KMail"), this,
00557 SLOT(slotSpellcheck2(KSpell*)));
00558
00559
00560 QStringList l = KSpellingHighlighter::personalWords();
00561 for ( QStringList::Iterator it = l.begin(); it != l.end(); ++it ) {
00562 mKSpell->addPersonal( *it );
00563 }
00564 connect (mKSpell, SIGNAL( death()),
00565 this, SLOT (slotSpellDone()));
00566 connect (mKSpell, SIGNAL (misspelling (const QString &, const QStringList &, unsigned int)),
00567 this, SLOT (slotMisspelling (const QString &, const QStringList &, unsigned int)));
00568 connect (mKSpell, SIGNAL (corrected (const QString &, const QString &, unsigned int)),
00569 this, SLOT (slotCorrected (const QString &, const QString &, unsigned int)));
00570 connect (mKSpell, SIGNAL (done(const QString &)),
00571 this, SLOT (slotSpellResult (const QString&)));
00572 }
00573
00574 void KMEdit::cut()
00575 {
00576 KEdit::cut();
00577 if ( textFormat() != Qt::RichText && mSpellChecker )
00578 mSpellChecker->restartBackgroundSpellCheck();
00579 }
00580
00581 void KMEdit::clear()
00582 {
00583 KEdit::clear();
00584 if ( textFormat() != Qt::RichText && mSpellChecker )
00585 mSpellChecker->restartBackgroundSpellCheck();
00586 }
00587
00588 void KMEdit::del()
00589 {
00590 KEdit::del();
00591 if ( textFormat() != Qt::RichText && mSpellChecker )
00592 mSpellChecker->restartBackgroundSpellCheck();
00593 }
00594
00595 void KMEdit::paste()
00596 {
00597 if ( ! QApplication::clipboard()->image().isNull() ) {
00598 emit pasteImage();
00599 }
00600 else
00601 KEdit::paste();
00602 }
00603
00604 void KMEdit::slotMisspelling(const QString &text, const QStringList &lst, unsigned int pos)
00605 {
00606 kdDebug(5006)<<"void KMEdit::slotMisspelling(const QString &text, const QStringList &lst, unsigned int pos) : "<<text <<endl;
00607 if( mSpellLineEdit )
00608 mComposer->sujectLineWidget()->spellCheckerMisspelling( text, lst, pos);
00609 else
00610 misspelling(text, lst, pos);
00611 }
00612
00613 void KMEdit::slotCorrected (const QString &oldWord, const QString &newWord, unsigned int pos)
00614 {
00615 kdDebug(5006)<<"slotCorrected (const QString &oldWord, const QString &newWord, unsigned int pos) : "<<oldWord<<endl;
00616 if( mSpellLineEdit )
00617 mComposer->sujectLineWidget()->spellCheckerCorrected( oldWord, newWord, pos);
00618 else {
00619 unsigned int l = 0;
00620 unsigned int cnt = 0;
00621 bool _bold,_underline,_italic;
00622 QColor _color;
00623 QFont _font;
00624 posToRowCol (pos, l, cnt);
00625 setCursorPosition(l, cnt+1);
00626 _bold = bold();
00627 _underline = underline();
00628 _italic = italic();
00629 _color = color();
00630 _font = currentFont();
00631 corrected(oldWord, newWord, pos);
00632 setSelection (l, cnt, l, cnt+newWord.length());
00633 setBold(_bold);
00634 setItalic(_italic);
00635 setUnderline(_underline);
00636 setColor(_color);
00637 setCurrentFont(_font);
00638 }
00639
00640 }
00641
00642 void KMEdit::slotSpellcheck2(KSpell*)
00643 {
00644 if( !mSpellLineEdit)
00645 {
00646 spellcheck_start();
00647
00648 QString quotePrefix;
00649 if(mComposer && mComposer->msg())
00650 {
00651 int languageNr = GlobalSettings::self()->replyCurrentLanguage();
00652 ReplyPhrases replyPhrases( QString::number(languageNr) );
00653 replyPhrases.readConfig();
00654
00655 quotePrefix = mComposer->msg()->formatString(
00656 replyPhrases.indentPrefix() );
00657 }
00658
00659 kdDebug(5006) << "spelling: new SpellingFilter with prefix=\"" << quotePrefix << "\"" << endl;
00660 QTextEdit plaintext;
00661 plaintext.setText(text());
00662 plaintext.setTextFormat(Qt::PlainText);
00663 mSpellingFilter = new SpellingFilter(plaintext.text(), quotePrefix, SpellingFilter::FilterUrls,
00664 SpellingFilter::FilterEmailAddresses);
00665
00666 mKSpell->check(mSpellingFilter->filteredText());
00667 }
00668 else if( mComposer )
00669 mKSpell->check( mComposer->sujectLineWidget()->text());
00670 }
00671
00672 void KMEdit::slotSpellResult(const QString &s)
00673 {
00674 if( !mSpellLineEdit)
00675 spellcheck_stop();
00676
00677 int dlgResult = mKSpell->dlgResult();
00678 if ( dlgResult == KS_CANCEL )
00679 {
00680 if( mSpellLineEdit)
00681 {
00682
00683 mSpellLineEdit = false;
00684 QString tmpText( s );
00685 tmpText = tmpText.remove('\n');
00686
00687 if( tmpText != mComposer->sujectLineWidget()->text() )
00688 mComposer->sujectLineWidget()->setText( tmpText );
00689 }
00690 else
00691 {
00692 setModified(true);
00693 }
00694 }
00695 mKSpell->cleanUp();
00696 KDictSpellingHighlighter::dictionaryChanged();
00697
00698 emit spellcheck_done( dlgResult );
00699 }
00700
00701 void KMEdit::slotSpellDone()
00702 {
00703 kdDebug(5006)<<" void KMEdit::slotSpellDone()\n";
00704 KSpell::spellStatus status = mKSpell->status();
00705 delete mKSpell;
00706 mKSpell = 0;
00707
00708 kdDebug(5006) << "spelling: delete SpellingFilter" << endl;
00709 delete mSpellingFilter;
00710 mSpellingFilter = 0;
00711 mComposer->sujectLineWidget()->deselect();
00712 if (status == KSpell::Error)
00713 {
00714 KMessageBox::sorry( topLevelWidget(),
00715 i18n("ISpell/Aspell could not be started. Please "
00716 "make sure you have ISpell or Aspell properly "
00717 "configured and in your PATH.") );
00718 emit spellcheck_done( KS_CANCEL );
00719 }
00720 else if (status == KSpell::Crashed)
00721 {
00722 spellcheck_stop();
00723 KMessageBox::sorry( topLevelWidget(),
00724 i18n("ISpell/Aspell seems to have crashed.") );
00725 emit spellcheck_done( KS_CANCEL );
00726 }
00727 else
00728 {
00729 if( mSpellLineEdit )
00730 spellcheck();
00731 else if( !mComposer->subjectTextWasSpellChecked() && status == KSpell::FinishedNoMisspellingsEncountered )
00732 KMessageBox::information( topLevelWidget(),
00733 i18n("No misspellings encountered.") );
00734 }
00735 }
00736
00737 #include "kmedit.moc"