diff --git a/configuredialog.cpp b/configuredialog.cpp
index 4ce7d32e5..968809342 100644
--- a/configuredialog.cpp
+++ b/configuredialog.cpp
@@ -2173,6 +2173,7 @@ void AppearancePage::ReaderTab::load() {
QVBoxLayout *vlay = new QVBoxLayout( this, KDialog::marginHint(), KDialog::spacingHint() );
+ // Fallback Character Encoding
QHBoxLayout *hlay = new QHBoxLayout( vlay ); // inherits spacing
mCharsetCombo = new QComboBox( this );
QStringList encodings = KMMsgBase::supportedEncodings( false );
@@ -2204,12 +2205,46 @@ void AppearancePage::ReaderTab::load() {
hlay->addWidget( label );
hlay->addWidget( mCharsetCombo );
+ // Override Character Encoding
+ hlay = new QHBoxLayout( vlay ); // inherits spacing
+ mOverrideCharsetCombo = new QComboBox( this );
+ encodings.prepend( i18n( "Auto" ) );
+ mOverrideCharsetCombo->insertStringList( encodings );
+ mOverrideCharsetCombo->setCurrentItem(0);
+
+ it = encodings.begin();
+ QString currentOverrideEncoding = GlobalSettings::overrideCharacterEncoding();
+ i = 1;
+ for( ; it != end; ++it)
+ {
+ if( KGlobal::charsets()->encodingForName(*it) == currentOverrideEncoding )
+ {
+ mOverrideCharsetCombo->setCurrentItem( i );
+ break;
+ }
+ i++;
+ }
+ connect( mOverrideCharsetCombo, SIGNAL( activated( int ) ),
+ this, SLOT( slotEmitChanged( void ) ) );
+
+ QString overrideCharsetWhatsThis =
+ i18n( GlobalSettings::self()->overrideCharacterEncodingItem()->whatsThis().utf8() );
+ QWhatsThis::add( mOverrideCharsetCombo, overrideCharsetWhatsThis );
+
+ label = new QLabel( i18n("&Override Character Encoding"), this );
+ label->setBuddy( mOverrideCharsetCombo );
+
+ hlay->addWidget( label );
+ hlay->addWidget( mOverrideCharsetCombo );
+
vlay->addStretch( 100 ); // spacer
}
void AppearancePage::ReaderTab::save() {
GlobalSettings::setFallbackCharacterEncoding(
KGlobal::charsets()->encodingForName( mCharsetCombo->currentText() ) );
+ GlobalSettings::setOverrideCharacterEncoding(
+ KGlobal::charsets()->encodingForName( mOverrideCharsetCombo->currentText() ) );
}
diff --git a/configuredialog_p.h b/configuredialog_p.h
index 512ad5b2d..c473b3c33 100644
--- a/configuredialog_p.h
+++ b/configuredialog_p.h
@@ -489,6 +489,7 @@ public:
private: // data
QComboBox *mCharsetCombo;
+ QComboBox *mOverrideCharsetCombo;
};
diff --git a/kmail.kcfg b/kmail.kcfg
index 9cc53d816..b3210e5ec 100644
--- a/kmail.kcfg
+++ b/kmail.kcfg
@@ -369,7 +369,13 @@
QCString(QTextCodec::codecForLocale()->name()).lower() == "eucjp"? "jis7" : QCString(QTextCodec::codecForLocale()->name()).lower()
Some emails, especially those generated automatically, do not specify the character encoding which needs to be used to properly display them. In such cases a fallback character encoding will be used, which you can configure here. Set it to the character encoding most commonly used in your part of the world. As a default the encoding configured for the whole system is used.
-
+
+
+
+
+
+ Changing this from its default 'Auto' will force the use of the specified encoding for all emails, regardless of what they specify themselves.
+
diff --git a/kmmainwidget.cpp b/kmmainwidget.cpp
index a9592b77a..4cc5f61e7 100644
--- a/kmmainwidget.cpp
+++ b/kmmainwidget.cpp
@@ -221,7 +221,6 @@ void KMMainWidget::readPreConfig(void)
const KConfigGroup general( KMKernel::config(), "General" );
mLongFolderList = geometry.readEntry( "FolderList", "long" ) != "short";
- mEncodingStr = general.readEntry("encoding", "").latin1();
mReaderWindowActive = geometry.readEntry( "readerWindowMode", "below" ) != "hide";
mReaderWindowBelow = geometry.readEntry( "readerWindowMode", "below" ) == "below";
}
@@ -443,8 +442,6 @@ void KMMainWidget::writeConfig(void)
// save the state of the unread/total-columns
geometry.writeEntry( "UnreadColumn", mFolderTree->unreadIndex() );
geometry.writeEntry( "TotalColumn", mFolderTree->totalIndex() );
-
- general.writeEntry("encoding", QString(mEncodingStr));
}
@@ -522,8 +519,8 @@ void KMMainWidget::createWidgets(void)
accel->connectItem(accel->insertItem(SHIFT+Key_Right),
mHeaders, SLOT(selectNextMessage()));
- if (!mEncodingStr.isEmpty())
- mCodec = KMMsgBase::codecForName(mEncodingStr);
+ if (!GlobalSettings::overrideCharacterEncoding().isEmpty())
+ mCodec = KMMsgBase::codecForName( GlobalSettings::overrideCharacterEncoding().latin1() );
else mCodec = 0;
if (mReaderWindowActive) {
@@ -677,14 +674,15 @@ void KMMainWidget::activatePanners(void)
//-----------------------------------------------------------------------------
void KMMainWidget::slotSetEncoding()
{
- mEncodingStr = KGlobal::charsets()->encodingForName(mEncoding->currentText()).latin1();
+ GlobalSettings::setOverrideCharacterEncoding(
+ KGlobal::charsets()->encodingForName( mEncoding->currentText()).latin1() );
if (mEncoding->currentItem() == 0) // Auto
{
mCodec = 0;
- mEncodingStr = "";
+ GlobalSettings::setOverrideCharacterEncoding( "" );
}
else
- mCodec = KMMsgBase::codecForName( mEncodingStr );
+ mCodec = KMMsgBase::codecForName( GlobalSettings::overrideCharacterEncoding().latin1() );
if (mMsgView)
mMsgView->setOverrideCodec(mCodec);
return;
@@ -2386,7 +2384,7 @@ void KMMainWidget::setupActions()
int i = 0;
for( it = encodings.begin(); it != encodings.end(); ++it)
{
- if ( KGlobal::charsets()->encodingForName(*it ) == QString(mEncodingStr) )
+ if ( KGlobal::charsets()->encodingForName(*it ) == GlobalSettings::overrideCharacterEncoding() )
{
mEncoding->setCurrentItem( i );
break;
diff --git a/kmmainwidget.h b/kmmainwidget.h
index 41c7c2dee..667be6da5 100644
--- a/kmmainwidget.h
+++ b/kmmainwidget.h
@@ -429,7 +429,6 @@ private:
QPopupMenu *mViewMenu, *mBodyPartsMenu;
KSelectAction *mEncoding;
KAction *mlistFilterAction;
- QCString mEncodingStr;
bool mIntegrated;
bool mBeepOnNew;
bool mConfirmEmpty;