From 758bad95b7e7e3e5052b33c85c7fa4781cd3f7c2 Mon Sep 17 00:00:00 2001 From: Montel Laurent Date: Wed, 31 Dec 2014 08:36:00 +0100 Subject: [PATCH] Move sonnect::dictionary to composerviewbase. Start to create autotest --- editor/kmcomposewin.cpp | 23 ++++++++++++----------- editor/kmcomposewin.h | 5 ----- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/editor/kmcomposewin.cpp b/editor/kmcomposewin.cpp index 3856ff215..faa642509 100644 --- a/editor/kmcomposewin.cpp +++ b/editor/kmcomposewin.cpp @@ -285,8 +285,9 @@ KMComposeWin::KMComposeWin( const KMime::Message::Ptr &aMsg, bool lastSignState, sigController->setIdentityCombo( identity ); sigController->suspend(); // we have to do identity change tracking ourselves due to the template code - mDictionaryCombo = new DictionaryComboBox( mHeadersArea ); - mDictionaryCombo->setToolTip( i18n( "Select the dictionary to use when spell-checking this message" ) ); + Sonnet::DictionaryComboBox *dictionaryCombo = new DictionaryComboBox( mHeadersArea ); + dictionaryCombo->setToolTip( i18n( "Select the dictionary to use when spell-checking this message" ) ); + mComposerBase->setDictionary(dictionaryCombo); mFccFolder = new MailCommon::FolderRequester( mHeadersArea ); mFccFolder->setNotAllowToCreateNewFolder( true ); @@ -376,7 +377,7 @@ KMComposeWin::KMComposeWin( const KMime::Message::Ptr &aMsg, bool lastSignState, editor->setAcceptDrops( true ); connect(sigController, SIGNAL(signatureAdded()), mComposerBase->editor(), SLOT(startExternalEditor())); - connect( mDictionaryCombo, SIGNAL(dictionaryChanged(QString)), + connect( mComposerBase->dictionary(), SIGNAL(dictionaryChanged(QString)), this, SLOT(slotSpellCheckingLanguage(QString)) ); connect( editor, SIGNAL(languageChanged(QString)), @@ -637,9 +638,9 @@ void KMComposeWin::readConfig( bool reload /* = false */ ) if ( mBtnDictionary->isChecked() ) { - mDictionaryCombo->setCurrentByDictionaryName( GlobalSettings::self()->previousDictionary() ); + mComposerBase->dictionary()->setCurrentByDictionaryName( GlobalSettings::self()->previousDictionary() ); } else { - mDictionaryCombo->setCurrentByDictionaryName( ident.dictionary() ); + mComposerBase->dictionary()->setCurrentByDictionaryName( ident.dictionary() ); } QString fccName; @@ -664,7 +665,7 @@ void KMComposeWin::writeConfig( void ) GlobalSettings::self()->setPreviousIdentity( mComposerBase->identityCombo()->currentIdentity() ); } GlobalSettings::self()->setPreviousFcc( QString::number(mFccFolder->collection().id()) ); - GlobalSettings::self()->setPreviousDictionary( mDictionaryCombo->currentDictionaryName() ); + GlobalSettings::self()->setPreviousDictionary( mComposerBase->dictionary()->currentDictionaryName() ); GlobalSettings::self()->setAutoSpellChecking( mAutoSpellCheckingAction->isChecked() ); MessageViewer::GlobalSettings::self()->setUseFixedFont( mFixedFontAction->isChecked() ); @@ -841,7 +842,7 @@ void KMComposeWin::rethinkFields( bool fromSlot ) mDictionaryAction->setChecked( abs( mShowHeaders )&HDR_DICTIONARY ); } rethinkHeaderLine( showHeaders,HDR_DICTIONARY, row, mDictionaryLabel, - mDictionaryCombo, mBtnDictionary ); + mComposerBase->dictionary(), mBtnDictionary ); if ( !fromSlot ) { mFccAction->setChecked( abs( mShowHeaders )&HDR_FCC ); @@ -1726,7 +1727,7 @@ void KMComposeWin::setMessage( const KMime::Message::Ptr &newMsg, bool lastSignS dictionary = ident.dictionary(); } - mDictionaryCombo->setCurrentByDictionaryName( dictionary ); + mComposerBase->dictionary()->setCurrentByDictionaryName( dictionary ); } mEdtReplyTo->setText( mMsg->replyTo()->asUnicodeString() ); @@ -3229,9 +3230,9 @@ void KMComposeWin::slotIdentityChanged( uint uoid, bool initalChange ) if ( !mBtnDictionary->isChecked() && !mIgnoreStickyFields ) { - mDictionaryCombo->setCurrentByDictionaryName( ident.dictionary() ); + mComposerBase->dictionary()->setCurrentByDictionaryName( ident.dictionary() ); } - slotSpellCheckingLanguage( mDictionaryCombo->currentDictionary() ); + slotSpellCheckingLanguage( mComposerBase->dictionary()->currentDictionary() ); if ( !mBtnFcc->isChecked() && !mPreventFccOverwrite ) { setFcc( ident.fcc() ); } @@ -3409,7 +3410,7 @@ void KMComposeWin::updateSignatureAndEncryptionStateIndicators() void KMComposeWin::slotLanguageChanged( const QString &language ) { - mDictionaryCombo->setCurrentByDictionary( language ); + mComposerBase->dictionary()->setCurrentByDictionary( language ); } diff --git a/editor/kmcomposewin.h b/editor/kmcomposewin.h index 1cebadd34..7e632d80f 100644 --- a/editor/kmcomposewin.h +++ b/editor/kmcomposewin.h @@ -75,10 +75,6 @@ namespace boost { template class shared_ptr; } -namespace Sonnet { -class DictionaryComboBox; -} - namespace KPIMIdentities { class Identity; } @@ -607,7 +603,6 @@ private: private: int validateLineWrapWidth(); QWidget *mMainWidget; - Sonnet::DictionaryComboBox *mDictionaryCombo; MessageComposer::ComposerLineEdit *mEdtFrom, *mEdtReplyTo; PimCommon::LineEditWithAutoCorrection *mEdtSubject; QLabel *mLblIdentity, *mLblTransport, *mLblFcc;