From 023e0e82dd8bf6421d12492a2dd25534fc43ad31 Mon Sep 17 00:00:00 2001 From: zautrix Date: Sat, 06 Nov 2004 23:30:02 +0000 Subject: many ompi fixes --- (limited to 'kmicromail/mainwindow.cpp') diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp index 98eb9a5..3013931 100644 --- a/kmicromail/mainwindow.cpp +++ b/kmicromail/mainwindow.cpp @@ -12,6 +12,7 @@ #ifdef DESKTOP_VERSION #include #include +#include extern QStatusBar* globalSstatusBarMainWindow; #else #include @@ -20,7 +21,7 @@ extern QStatusBar* globalSstatusBarMainWindow; #include "mainwindow.h" #include -#include +#include "koprefs.h" MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) : QMainWindow( parent, name ) //, flags ) @@ -99,7 +100,14 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) editAccounts = new QAction( i18n( "Configure accounts" ), SmallIcon("editaccounts") , 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 ); QVBox* wrapperBox = new QVBox( this ); @@ -183,6 +191,8 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) li = new QAction(i18n("LibEtPan Licence"), QPixmap(), 0, 0, this); 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 ); #endif @@ -192,6 +202,37 @@ 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() { KApplication::showLicence(); -- cgit v0.9.0.2