-rw-r--r-- | kmicromail/mainwindow.cpp | 45 |
1 files changed, 43 insertions, 2 deletions
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp index 98eb9a5..3013931 100644 --- a/kmicromail/mainwindow.cpp +++ b/kmicromail/mainwindow.cpp @@ -13,4 +13,5 @@ #include <qapplication.h> #include <qstatusbar.h> +#include <kabc/stdaddressbook.h> extern QStatusBar* globalSstatusBarMainWindow; #else @@ -21,5 +22,5 @@ extern QStatusBar* globalSstatusBarMainWindow; #include <KDGanttMinimizeSplitter.h> -#include <kabc/stdaddressbook.h> +#include "koprefs.h" MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) @@ -100,5 +101,12 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) 0, 0, this ); editAccounts->addTo( settingsMenu ); - + codecMenu = new QPopupMenu( menuBar ); + codecMenu->insertItem( "Western (iso-8859-1)",0,0); + codecMenu->insertItem( "Cyrillic (iso-8859-5)",1,1); + codecMenu->insertItem( "Western (iso-8859-15)",2,2); + codecMenu->insertItem( "Chinese (big-5)",3,3); + codecMenu->insertItem( "Unicode (utf-8)",4,4); + codecMenu->insertItem( "Userdefined ("+KOPrefs::instance()->mSendCodec+")",5,5); + settingsMenu->insertItem( i18n("Codec for new mails"), codecMenu); //setCentralWidget( view ); @@ -184,4 +192,6 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) connect( li, SIGNAL( activated() ), SLOT( showEtpanLicence()) ); li->addTo(helpMenu); + connect( codecMenu, SIGNAL( activated(int) ), this, SLOT( slotSetCodec( int )) ); + slotSetCodec( KOPrefs::instance()->mCurrentCodec ); #ifdef DESKTOP_VERSION resize ( 640, 480 ); @@ -193,4 +203,35 @@ MainWindow::~MainWindow() } +void MainWindow::slotSetCodec( int codec ) +{ + codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, false ); + //qDebug("codec %d ", codec); + KOPrefs::instance()->mCurrentCodec = codec; + KOPrefs::instance()->isDirty = true; + QString name; + switch ( codec ) { + case 0: + name = "iso-8859-1"; + break; + case 1: + name = "iso-8859-5"; + break; + case 2: + name = "iso-8859-15"; + break; + case 3: + name = "big-5"; + break; + case 4: + name = "utf-8"; + break; + case 5: + name = KOPrefs::instance()->mSendCodec.lower(); + break; + } + KOPrefs::instance()->mCurrentCodeName = name ; + codecMenu->changeItem ( 5, "Userdefined ("+KOPrefs::instance()->mSendCodec+")"); + codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, true ); +} void MainWindow::showLicence() { |