-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 | |||
@@ -3,33 +3,34 @@ | |||
3 | #include <qlabel.h> | 3 | #include <qlabel.h> |
4 | #include <qvbox.h> | 4 | #include <qvbox.h> |
5 | #include <qheader.h> | 5 | #include <qheader.h> |
6 | #include <qtimer.h> | 6 | #include <qtimer.h> |
7 | #include <qlayout.h> | 7 | #include <qlayout.h> |
8 | //#include <kdialog.h> | 8 | //#include <kdialog.h> |
9 | #include <kiconloader.h> | 9 | #include <kiconloader.h> |
10 | #include <kapplication.h> | 10 | #include <kapplication.h> |
11 | 11 | ||
12 | #ifdef DESKTOP_VERSION | 12 | #ifdef DESKTOP_VERSION |
13 | #include <qapplication.h> | 13 | #include <qapplication.h> |
14 | #include <qstatusbar.h> | 14 | #include <qstatusbar.h> |
15 | #include <kabc/stdaddressbook.h> | ||
15 | extern QStatusBar* globalSstatusBarMainWindow; | 16 | extern QStatusBar* globalSstatusBarMainWindow; |
16 | #else | 17 | #else |
17 | #include <qpe/qpeapplication.h> | 18 | #include <qpe/qpeapplication.h> |
18 | #endif | 19 | #endif |
19 | #include "defines.h" | 20 | #include "defines.h" |
20 | #include "mainwindow.h" | 21 | #include "mainwindow.h" |
21 | #include <KDGanttMinimizeSplitter.h> | 22 | #include <KDGanttMinimizeSplitter.h> |
22 | 23 | ||
23 | #include <kabc/stdaddressbook.h> | 24 | #include "koprefs.h" |
24 | 25 | ||
25 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) | 26 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) |
26 | : QMainWindow( parent, name ) //, flags ) | 27 | : QMainWindow( parent, name ) //, flags ) |
27 | { | 28 | { |
28 | #ifdef DESKTOP_VERSION | 29 | #ifdef DESKTOP_VERSION |
29 | globalSstatusBarMainWindow = statusBar(); | 30 | globalSstatusBarMainWindow = statusBar(); |
30 | #endif | 31 | #endif |
31 | setCaption( i18n( "KOpieMail/Pi" ) ); | 32 | setCaption( i18n( "KOpieMail/Pi" ) ); |
32 | setToolBarsMovable( false ); | 33 | setToolBarsMovable( false ); |
33 | //KABC::StdAddressBook::self(); | 34 | //KABC::StdAddressBook::self(); |
34 | toolBar = new QToolBar( this ); | 35 | toolBar = new QToolBar( this ); |
35 | menuBar = new QPEMenuBar( toolBar ); | 36 | menuBar = new QPEMenuBar( toolBar ); |
@@ -90,25 +91,32 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) | |||
90 | deleteMails->addTo( mailMenu ); | 91 | deleteMails->addTo( mailMenu ); |
91 | connect( deleteMails, SIGNAL( activated() ), | 92 | connect( deleteMails, SIGNAL( activated() ), |
92 | SLOT( slotDeleteMail() ) ); | 93 | SLOT( slotDeleteMail() ) ); |
93 | 94 | ||
94 | editSettings = new QAction( i18n( "Edit settings" ), SmallIcon("SettingsIcon") , | 95 | editSettings = new QAction( i18n( "Edit settings" ), SmallIcon("SettingsIcon") , |
95 | 0, 0, this ); | 96 | 0, 0, this ); |
96 | editSettings->addTo( settingsMenu ); | 97 | editSettings->addTo( settingsMenu ); |
97 | connect( editSettings, SIGNAL( activated() ), | 98 | connect( editSettings, SIGNAL( activated() ), |
98 | SLOT( slotEditSettings() ) ); | 99 | SLOT( slotEditSettings() ) ); |
99 | editAccounts = new QAction( i18n( "Configure accounts" ), SmallIcon("editaccounts") , | 100 | editAccounts = new QAction( i18n( "Configure accounts" ), SmallIcon("editaccounts") , |
100 | 0, 0, this ); | 101 | 0, 0, this ); |
101 | editAccounts->addTo( settingsMenu ); | 102 | editAccounts->addTo( settingsMenu ); |
102 | 103 | codecMenu = new QPopupMenu( menuBar ); | |
104 | codecMenu->insertItem( "Western (iso-8859-1)",0,0); | ||
105 | codecMenu->insertItem( "Cyrillic (iso-8859-5)",1,1); | ||
106 | codecMenu->insertItem( "Western (iso-8859-15)",2,2); | ||
107 | codecMenu->insertItem( "Chinese (big-5)",3,3); | ||
108 | codecMenu->insertItem( "Unicode (utf-8)",4,4); | ||
109 | codecMenu->insertItem( "Userdefined ("+KOPrefs::instance()->mSendCodec+")",5,5); | ||
110 | settingsMenu->insertItem( i18n("Codec for new mails"), codecMenu); | ||
103 | //setCentralWidget( view ); | 111 | //setCentralWidget( view ); |
104 | 112 | ||
105 | QVBox* wrapperBox = new QVBox( this ); | 113 | QVBox* wrapperBox = new QVBox( this ); |
106 | setCentralWidget( wrapperBox ); | 114 | setCentralWidget( wrapperBox ); |
107 | 115 | ||
108 | // QWidget *view = new QWidget( wrapperBox ); | 116 | // QWidget *view = new QWidget( wrapperBox ); |
109 | KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox); | 117 | KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox); |
110 | split->setMinimizeDirection( KDGanttMinimizeSplitter::Left); | 118 | split->setMinimizeDirection( KDGanttMinimizeSplitter::Left); |
111 | //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight ); | 119 | //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight ); |
112 | 120 | ||
113 | folderView = new AccountView( split ); | 121 | folderView = new AccountView( split ); |
114 | folderView->header()->hide(); | 122 | folderView->header()->hide(); |
@@ -174,33 +182,66 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) | |||
174 | 182 | ||
175 | QPopupMenu* helpMenu = new QPopupMenu( menuBar ); | 183 | QPopupMenu* helpMenu = new QPopupMenu( menuBar ); |
176 | menuBar->insertItem( i18n( "Help" ), helpMenu ); | 184 | menuBar->insertItem( i18n( "Help" ), helpMenu ); |
177 | QAction* li = new QAction(i18n("About"), QPixmap(), 0, 0, this); | 185 | QAction* li = new QAction(i18n("About"), QPixmap(), 0, 0, this); |
178 | connect( li, SIGNAL( activated() ), SLOT( showAbout()) ); | 186 | connect( li, SIGNAL( activated() ), SLOT( showAbout()) ); |
179 | li->addTo(helpMenu); | 187 | li->addTo(helpMenu); |
180 | li = new QAction(i18n("Licence"),QPixmap(), 0, 0, this); | 188 | li = new QAction(i18n("Licence"),QPixmap(), 0, 0, this); |
181 | connect( li, SIGNAL( activated() ), SLOT( showLicence()) ); | 189 | connect( li, SIGNAL( activated() ), SLOT( showLicence()) ); |
182 | li->addTo(helpMenu); | 190 | li->addTo(helpMenu); |
183 | li = new QAction(i18n("LibEtPan Licence"), QPixmap(), 0, 0, this); | 191 | li = new QAction(i18n("LibEtPan Licence"), QPixmap(), 0, 0, this); |
184 | connect( li, SIGNAL( activated() ), SLOT( showEtpanLicence()) ); | 192 | connect( li, SIGNAL( activated() ), SLOT( showEtpanLicence()) ); |
185 | li->addTo(helpMenu); | 193 | li->addTo(helpMenu); |
194 | connect( codecMenu, SIGNAL( activated(int) ), this, SLOT( slotSetCodec( int )) ); | ||
195 | slotSetCodec( KOPrefs::instance()->mCurrentCodec ); | ||
186 | #ifdef DESKTOP_VERSION | 196 | #ifdef DESKTOP_VERSION |
187 | resize ( 640, 480 ); | 197 | resize ( 640, 480 ); |
188 | #endif | 198 | #endif |
189 | } | 199 | } |
190 | 200 | ||
191 | MainWindow::~MainWindow() | 201 | MainWindow::~MainWindow() |
192 | { | 202 | { |
193 | } | 203 | } |
194 | 204 | ||
205 | void MainWindow::slotSetCodec( int codec ) | ||
206 | { | ||
207 | codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, false ); | ||
208 | //qDebug("codec %d ", codec); | ||
209 | KOPrefs::instance()->mCurrentCodec = codec; | ||
210 | KOPrefs::instance()->isDirty = true; | ||
211 | QString name; | ||
212 | switch ( codec ) { | ||
213 | case 0: | ||
214 | name = "iso-8859-1"; | ||
215 | break; | ||
216 | case 1: | ||
217 | name = "iso-8859-5"; | ||
218 | break; | ||
219 | case 2: | ||
220 | name = "iso-8859-15"; | ||
221 | break; | ||
222 | case 3: | ||
223 | name = "big-5"; | ||
224 | break; | ||
225 | case 4: | ||
226 | name = "utf-8"; | ||
227 | break; | ||
228 | case 5: | ||
229 | name = KOPrefs::instance()->mSendCodec.lower(); | ||
230 | break; | ||
231 | } | ||
232 | KOPrefs::instance()->mCurrentCodeName = name ; | ||
233 | codecMenu->changeItem ( 5, "Userdefined ("+KOPrefs::instance()->mSendCodec+")"); | ||
234 | codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, true ); | ||
235 | } | ||
195 | void MainWindow::showLicence() | 236 | void MainWindow::showLicence() |
196 | { | 237 | { |
197 | KApplication::showLicence(); | 238 | KApplication::showLicence(); |
198 | } | 239 | } |
199 | void MainWindow::showAbout() | 240 | void MainWindow::showAbout() |
200 | { | 241 | { |
201 | QString version; | 242 | QString version; |
202 | #include <../version> | 243 | #include <../version> |
203 | 244 | ||
204 | QString cap = "About KOpieMail/Pi"; | 245 | QString cap = "About KOpieMail/Pi"; |
205 | QString text =i18n("KOpieMail/Platform-independent\n") + | 246 | QString text =i18n("KOpieMail/Platform-independent\n") + |
206 | "(OM/Pi) " + version + " - " | 247 | "(OM/Pi) " + version + " - " |