- Make it possible to easily change the dictionary which is used for as-you-type spell-checking. This also makes it possible to use different dictionaries in different composer windows.

- Add identity-dependant spell-checking dictionary.

Note that you need an up-to-date kdelibs/kdeui in order to compile this.

svn path=/trunk/kdepim/; revision=262136
wilder-work
Ingo Klcker 23 years ago
parent 3521b4e4a3
commit 659c03fca1
  1. 2
      Makefile.am
  2. 12
      identitydialog.cpp
  3. 4
      identitydialog.h
  4. 3
      kmcomposerui.rc
  5. 53
      kmcomposewin.cpp
  6. 9
      kmcomposewin.h
  7. 3
      kmglobal.h
  8. 21
      kmidentity.cpp
  9. 8
      kmidentity.h

@ -82,7 +82,7 @@ libkmailprivate_la_SOURCES = kmmessage.cpp kmmainwin.cpp configuredialog.cpp \
folderIface.cpp folderIface.skel mailserviceimpl.cpp \
attachmentlistview.cpp ssllabel.cpp \
iobserver.cpp isubject.cpp bodyvisitor.cpp \
urlhandlermanager.cpp
urlhandlermanager.cpp dictionarycombobox.cpp
kmail_SOURCES = main.cpp

@ -1,4 +1,4 @@
/* -*- c-basic-offset: 2 -*-
/* -*- mode: C++; c-file-style: "gnu" -*-
identitydialog.cpp
This file is part of KMail, the KDE mail client.
@ -37,6 +37,7 @@
#include "kmfoldermgr.h"
#include "transportmanager.h"
#include "kmkernel.h"
#include "dictionarycombobox.h"
// other kdenetwork headers:
@ -194,6 +195,13 @@ namespace KMail {
glay->addWidget( label, row, 0 );
glay->addWidget( mPgpKeyRequester, row, 1 );
// "Dictionary" combo box and label:
++row;
mDictionaryCombo = new DictionaryComboBox( tab );
glay->addWidget( mDictionaryCombo, row, 1 );
glay->addWidget( new QLabel( mDictionaryCombo, i18n("D&ictionary:"), tab ),
row, 0 );
// "Sent-mail Folder" combo box and label:
++row;
mFccCombo = new KMFolderComboBox( tab );
@ -269,6 +277,7 @@ namespace KMail {
mTransportCheck->setChecked( !ident.transport().isEmpty() );
mTransportCombo->setEditText( ident.transport() );
mTransportCombo->setEnabled( !ident.transport().isEmpty() );
mDictionaryCombo->setCurrentByDictionary( ident.dictionary() );
if ( ident.fcc().isEmpty() ||
!checkFolderExists( ident.fcc(),
@ -324,6 +333,7 @@ namespace KMail {
ident.setBcc( mBccEdit->text() );
ident.setTransport( ( mTransportCheck->isChecked() ) ?
mTransportCombo->currentText() : QString::null );
ident.setDictionary( mDictionaryCombo->currentDictionary() );
ident.setFcc( mFccCombo->getFolder() ?
mFccCombo->getFolder()->idString() : QString::null );
ident.setDrafts( mDraftsCombo->getFolder() ?

@ -1,4 +1,4 @@
/* -*- c++ -*-
/* -*- mode: C++; c-file-style: "gnu" -*-
identitydialog.h
This file is part of KMail, the KDE mail client.
@ -46,6 +46,7 @@ namespace Kpgp {
}
namespace KMail {
class SignatureConfigurator;
class DictionaryComboBox;
}
namespace KMail {
@ -75,6 +76,7 @@ namespace KMail {
QLineEdit *mReplyToEdit;
QLineEdit *mBccEdit;
Kpgp::SecretKeyRequester *mPgpKeyRequester;
KMail::DictionaryComboBox *mDictionaryCombo;
KMFolderComboBox *mFccCombo;
KMFolderComboBox *mDraftsCombo;
QCheckBox *mTransportCheck;

@ -1,4 +1,4 @@
<!DOCTYPE kpartgui ><kpartgui version="15" name="kmcomposer" >
<!DOCTYPE kpartgui ><kpartgui version="16" name="kmcomposer" >
<MenuBar>
<Menu noMerge="1" name="file" >
<text>&amp;Message</text>
@ -41,6 +41,7 @@
<Action name="show_all_fields" />
<Separator/>
<Action name="show_identity" />
<Action name="show_dictionary" />
<Action name="show_fcc" />
<Action name="show_transport" />
<Separator/>

@ -35,6 +35,8 @@
#include "kmkernel.h"
#include "attachmentlistview.h"
using KMail::AttachmentListView;
#include "dictionarycombobox.h"
using KMail::DictionaryComboBox;
#include "addressesdialog.h"
using KPIM::AddressesDialog;
#include <maillistdrag.h>
@ -96,6 +98,7 @@ using KRecentAddress::RecentAddresses;
//-----------------------------------------------------------------------------
KMComposeWin::KMComposeWin( KMMessage *aMsg, uint id )
: MailComposerIface(), KMTopLevelWidget("kmail-composer#"),
mMsg( 0 ),
mAutoRequestMDN( false ),
mId( id ), mNeverSign( false ), mNeverEncrypt( false )
{
@ -108,6 +111,7 @@ KMComposeWin::KMComposeWin( KMMessage *aMsg, uint id )
mSelectedCryptPlug = kmkernel->cryptPlugList() ? kmkernel->cryptPlugList()->active() : 0;
mIdentity = new IdentityCombo(mMainWidget);
mDictionaryCombo = new DictionaryComboBox( mMainWidget );
mFcc = new KMFolderComboBox(mMainWidget);
mFcc->showOutboxFolder( FALSE );
mTransport = new QComboBox(true, mMainWidget);
@ -118,6 +122,7 @@ KMComposeWin::KMComposeWin( KMMessage *aMsg, uint id )
mEdtBcc = new KMLineEdit(this,true,mMainWidget);
mEdtSubject = new KMLineEditSpell(this,false,mMainWidget, "subjectLine");
mLblIdentity = new QLabel(mMainWidget);
mDictionaryLabel = new QLabel( mMainWidget );
mLblFcc = new QLabel(mMainWidget);
mLblTransport = new QLabel(mMainWidget);
mLblFrom = new QLabel(mMainWidget);
@ -147,9 +152,10 @@ KMComposeWin::KMComposeWin( KMMessage *aMsg, uint id )
mFolder = 0;
mAutoCharset = TRUE;
mFixedFontAction = 0;
mEditor = new KMEdit(mMainWidget, this);
mEditor = new KMEdit( mMainWidget, this, mDictionaryCombo->spellConfig() );
mEditor->setTextFormat(Qt::PlainText);
mEditor->setAcceptDrops( true );
mDisableBreaking = false;
QString tip = i18n("Select email address(es)");
QToolTip::add( mBtnTo, tip );
@ -505,6 +511,12 @@ void KMComposeWin::readConfig(void)
mIdentity->setCurrentIdentity( mId );
kdDebug(5006) << "KMComposeWin::readConfig. " << mIdentity->currentIdentityName() << endl;
const KMIdentity & ident =
kmkernel->identityManager()->identityForUoid( mIdentity->currentIdentity() );
mDictionaryCombo->setCurrentByDictionary( ident.dictionary() );
mTransport->clear();
mTransport->insertStringList( KMTransportInfo::availableTransports() );
while (mTransportHistory.count() > (uint)maxTransportItems)
@ -520,9 +532,6 @@ void KMComposeWin::readConfig(void)
if ( !mBtnFcc->isChecked() )
{
kdDebug(5006) << "KMComposeWin::readConfig. " << mIdentity->currentIdentityName() << endl;
const KMIdentity & ident =
kmkernel->identityManager()->identityForUoid( mIdentity->currentIdentity() );
kdDebug(5006) << "KMComposeWin::readConfig: identity.fcc()='"
<< ident.fcc() << "'" << endl;
if ( ident.fcc().isEmpty() )
@ -644,6 +653,8 @@ void KMComposeWin::slotView(void)
id = HDR_SUBJECT;
else if (act == mFccAction)
id = HDR_FCC;
else if ( act == mDictionaryAction )
id = HDR_DICTIONARY;
else
{
id = 0;
@ -701,8 +712,11 @@ void KMComposeWin::rethinkFields(bool fromSlot)
if (!fromSlot) mIdentityAction->setChecked(abs(mShowHeaders)&HDR_IDENTITY);
rethinkHeaderLine(showHeaders,HDR_IDENTITY, row, i18n("&Identity:"),
mLblIdentity, mIdentity, mBtnIdentity);
if (!fromSlot) mDictionaryAction->setChecked(abs(mShowHeaders)&HDR_DICTIONARY);
rethinkHeaderLine(showHeaders,HDR_DICTIONARY, row, i18n("&Dictionary:"),
mDictionaryLabel, mDictionaryCombo, 0 );
if (!fromSlot) mFccAction->setChecked(abs(mShowHeaders)&HDR_FCC);
rethinkHeaderLine(showHeaders,HDR_FCC, row, i18n("Sent-Mail fol&der:"),
rethinkHeaderLine(showHeaders,HDR_FCC, row, i18n("Se&nt-Mail folder:"),
mLblFcc, mFcc, mBtnFcc);
if (!fromSlot) mTransportAction->setChecked(abs(mShowHeaders)&HDR_TRANSPORT);
rethinkHeaderLine(showHeaders,HDR_TRANSPORT, row, i18n("Mai&l transport:"),
@ -741,6 +755,7 @@ void KMComposeWin::rethinkFields(bool fromSlot)
slotUpdateAttachActions();
mIdentityAction->setEnabled(!mAllFieldsAction->isChecked());
mDictionaryAction->setEnabled( !mAllFieldsAction->isChecked() );
mTransportAction->setEnabled(!mAllFieldsAction->isChecked());
mFromAction->setEnabled(!mAllFieldsAction->isChecked());
mReplyToAction->setEnabled(!mAllFieldsAction->isChecked());
@ -809,16 +824,19 @@ void KMComposeWin::rethinkHeaderLine(int aValue, int aMask, int& aRow,
aCbx->setMinimumSize(100, aLbl->height()+2);
mGrid->addWidget(aCbx, aRow, 1);
mGrid->addWidget(aChk, aRow, 2);
aChk->setFixedSize(aChk->sizeHint().width(), aLbl->height());
aChk->show();
if ( aChk ) {
mGrid->addWidget(aChk, aRow, 2);
aChk->setFixedSize(aChk->sizeHint().width(), aLbl->height());
aChk->show();
}
aRow++;
}
else
{
aLbl->hide();
aCbx->hide();
aChk->hide();
if ( aChk )
aChk->hide();
}
}
@ -937,6 +955,9 @@ void KMComposeWin::setupActions(void)
mIdentityAction = new KToggleAction (i18n("&Identity"), 0, this,
SLOT(slotView()),
actionCollection(), "show_identity");
mDictionaryAction = new KToggleAction (i18n("&Dictionary"), 0, this,
SLOT(slotView()),
actionCollection(), "show_dictionary");
mFccAction = new KToggleAction (i18n("Sent-Mail F&older"), 0, this,
SLOT(slotView()),
actionCollection(), "show_fcc");
@ -1314,6 +1335,8 @@ void KMComposeWin::setMsg(KMMessage* newMsg, bool mayAutoSign,
setFcc(ident.fcc());
}
mDictionaryCombo->setCurrentByDictionary( ident.dictionary() );
num = mMsg->numBodyParts();
if (num > 0)
@ -5034,6 +5057,7 @@ void KMComposeWin::slotSpellcheckDoneClearStatus()
statusBar()->changeItem("", 0);
}
//-----------------------------------------------------------------------------
void KMComposeWin::focusNextPrevEdit(const QWidget* aCur, bool aNext)
{
@ -5103,6 +5127,8 @@ void KMComposeWin::slotIdentityChanged(uint uoid)
}
}
mDictionaryCombo->setCurrentByDictionary( ident.dictionary() );
if ( !mBtnFcc->isChecked() )
{
if ( ident.fcc().isEmpty() )
@ -5644,6 +5670,7 @@ void KMLineEditSpell::spellCheckerCorrected( const QString &old, const QString &
//
//=============================================================================
KMEdit::KMEdit(QWidget *parent, KMComposeWin* composer,
KSpellConfig* autoSpellConfig,
const char *name)
: KEdit( parent, name ),
mComposer( composer ),
@ -5660,11 +5687,11 @@ KMEdit::KMEdit(QWidget *parent, KMComposeWin* composer,
installEventFilter(this);
KCursor::setAutoHideCursor( this, true, true );
initializeAutoSpellChecking();
initializeAutoSpellChecking( autoSpellConfig );
}
//-----------------------------------------------------------------------------
void KMEdit::initializeAutoSpellChecking()
void KMEdit::initializeAutoSpellChecking( KSpellConfig* autoSpellConfig )
{
KConfigGroup readerConfig( KMKernel::config(), "Reader" );
QColor defaultColor1( 0x00, 0x80, 0x00 ); // defaults from kmreaderwin.cpp
@ -5682,7 +5709,8 @@ void KMEdit::initializeAutoSpellChecking()
/*autoEnabled*/ false,
/*spellColor*/ misspelled,
/*colorQuoting*/ true,
col1, col2, col3, col4 );
col1, col2, col3, col4,
autoSpellConfig );
connect( mSpellChecker, SIGNAL(activeChanged(const QString &)),
mComposer, SLOT(slotStatusMessage(const QString &)));
connect( mSpellChecker, SIGNAL(newSuggestions(const QString&, const QStringList&, unsigned int)),
@ -5877,6 +5905,7 @@ void KMEdit::slotAutoSpellCheckingToggled( bool on )
mSpellChecker->setActive( on );
}
//-----------------------------------------------------------------------------
void KMEdit::slotExternalEditorTempFileChanged( const QString & fileName ) {
if ( !mExtEditorTempFile )

@ -70,7 +70,8 @@ class SpellingFilter;
class CryptPlugWrapperList;
namespace KMail {
class AttachmentListView;
class AttachmentListView;
class DictionaryComboBox;
}
typedef QPtrList<KMMessagePart> KMMsgPartList;
@ -82,6 +83,7 @@ class KMEdit: public KEdit
Q_OBJECT
public:
KMEdit(QWidget *parent=0,KMComposeWin* composer=0,
KSpellConfig* spellConfig = 0,
const char *name=0);
virtual ~KMEdit();
@ -143,7 +145,7 @@ private slots:
private:
void killExternalEditor();
void initializeAutoSpellChecking();
void initializeAutoSpellChecking( KSpellConfig* autoSpellConfig );
private:
KSpell *mKSpell;
@ -736,12 +738,14 @@ private:
protected:
QWidget *mMainWidget;
QComboBox *mTransport;
KMail::DictionaryComboBox *mDictionaryCombo;
IdentityCombo *mIdentity;
KMFolderComboBox *mFcc;
KMLineEdit *mEdtFrom, *mEdtReplyTo, *mEdtTo, *mEdtCc, *mEdtBcc;
KMLineEditSpell *mEdtSubject;
QLabel *mLblIdentity, *mLblTransport, *mLblFcc;
QLabel *mLblFrom, *mLblReplyTo, *mLblTo, *mLblCc, *mLblBcc, *mLblSubject;
QLabel *mDictionaryLabel;
QCheckBox *mBtnIdentity, *mBtnTransport, *mBtnFcc;
QPushButton *mBtnTo, *mBtnCc, *mBtnBcc, *mBtnFrom, *mBtnReplyTo;
bool mSpellCheckInProgress;
@ -796,6 +800,7 @@ protected:
KToggleAction *mSubjectAction;
KToggleAction *mIdentityAction, *mTransportAction, *mFccAction;
KToggleAction *mWordWrapAction, *mFixedFontAction, *mAutoSpellCheckingAction;
KToggleAction *mDictionaryAction;
KSelectAction *mEncodingAction;
KSelectAction *mCryptoModuleAction;

@ -64,7 +64,8 @@ typedef enum {
#define HDR_IDENTITY 0x100
#define HDR_TRANSPORT 0x200
#define HDR_FCC 0x400
#define HDR_ALL 0x7ff
#define HDR_DICTIONARY 0x800
#define HDR_ALL 0xfff
#define HDR_STANDARD (HDR_SUBJECT|HDR_TO|HDR_CC)

@ -1,3 +1,4 @@
// -*- mode: C++; c-file-style: "gnu" -*-
// kmidentity.cpp
#include "kmidentity.h"
@ -225,7 +226,8 @@ bool KMIdentity::isNull() const {
mOrganization.isNull() && mReplyToAddr.isNull() && mBcc.isNull() &&
mVCardFile.isNull() &&
mPgpIdentity.isNull() && mFcc.isNull() && mDrafts.isNull() &&
mTransport.isNull() && mSignature.type() == Signature::Disabled;
mTransport.isNull() && mDictionary.isNull() &&
mSignature.type() == Signature::Disabled;
}
bool KMIdentity::operator==( const KMIdentity & other ) const {
@ -236,7 +238,7 @@ bool KMIdentity::operator==( const KMIdentity & other ) const {
mVCardFile == other.mVCardFile &&
mPgpIdentity == other.mPgpIdentity && mFcc == other.mFcc &&
mDrafts == other.mDrafts && mTransport == other.mTransport &&
mSignature == other.mSignature;
mDictionary == other.mDictionary && mSignature == other.mSignature;
}
KMIdentity::KMIdentity( const QString & id, const QString & fullName,
@ -273,6 +275,7 @@ void KMIdentity::readConfig( const KConfigBase * config )
if( mDrafts.isEmpty() )
mDrafts = "drafts";
mTransport = config->readEntry("Transport");
mDictionary = config->readEntry( "Dictionary" );
mSignature.readConfig( config );
kdDebug(5006) << "KMIdentity::readConfig(): UOID = " << mUoid
@ -295,6 +298,7 @@ void KMIdentity::writeConfig( KConfigBase * config ) const
config->writeEntry("Transport", mTransport);
config->writeEntry("Fcc", mFcc);
config->writeEntry("Drafts", mDrafts);
config->writeEntry( "Dictionary", mDictionary );
mSignature.writeConfig( config );
}
@ -312,7 +316,8 @@ QDataStream & operator<<( QDataStream & stream, const KMIdentity & i ) {
<< i.transport()
<< i.fcc()
<< i.drafts()
<< i.mSignature;
<< i.mSignature
<< i.dictionary();
}
QDataStream & operator>>( QDataStream & stream, KMIdentity & i ) {
@ -335,7 +340,8 @@ QDataStream & operator>>( QDataStream & stream, KMIdentity & i ) {
>> i.mTransport
>> i.mFcc
>> i.mDrafts
>> i.mSignature;
>> i.mSignature
>> i.mDictionary;
}
//-----------------------------------------------------------------------------
@ -458,6 +464,13 @@ void KMIdentity::setDrafts(const QString &str)
}
//-----------------------------------------------------------------------------
void KMIdentity::setDictionary( const QString &str )
{
mDictionary = str;
}
//-----------------------------------------------------------------------------
QString KMIdentity::signatureText( bool * ok ) const
{

@ -1,4 +1,5 @@
/* User identity information -*- c++ -*-
/* -*- mode: C++; c-file-style: "gnu" -*-
* User identity information
*
* Author: Stefan Taferner <taferner@kde.org>
* This code is under GPL
@ -239,6 +240,10 @@ public:
QString drafts() const { return mDrafts; }
void setDrafts(const QString&);
/** dictionary which should be used for spell checking */
QString dictionary() const { return mDictionary; }
void setDictionary( const QString& );
static KMIdentity null;
bool isNull() const;
protected:
@ -253,6 +258,7 @@ protected:
QString mVCardFile;
QCString mPgpIdentity;
QString mFcc, mDrafts, mTransport;
QString mDictionary;
Signature mSignature;
bool mIsDefault;
};

Loading…
Cancel
Save