summaryrefslogtreecommitdiffabout
path: root/kmicromail/mainwindow.cpp
Unidiff
Diffstat (limited to 'kmicromail/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/mainwindow.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp
index 9a52d1b..e3c5ec3 100644
--- a/kmicromail/mainwindow.cpp
+++ b/kmicromail/mainwindow.cpp
@@ -1,416 +1,429 @@
1 1
2// CHANGED 2004-08-06 Lutz Rogowski 2// CHANGED 2004-08-06 Lutz Rogowski
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#include <kabc/stdaddressbook.h>
16extern QStatusBar* globalSstatusBarMainWindow; 16extern QStatusBar* globalSstatusBarMainWindow;
17#else 17#else
18#include <qpe/qpeapplication.h> 18#include <qpe/qpeapplication.h>
19#include <klocale.h> 19#include <klocale.h>
20#endif 20#endif
21#include "defines.h" 21#include "defines.h"
22#include "koprefs.h" 22#include "koprefs.h"
23#include "mainwindow.h" 23#include "mainwindow.h"
24#include "mailistviewitem.h" 24#include "mailistviewitem.h"
25#include <KDGanttMinimizeSplitter.h> 25#include <KDGanttMinimizeSplitter.h>
26 26
27#include "koprefs.h" 27#include "koprefs.h"
28 28
29MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) 29MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
30 : QMainWindow( parent, name ) //, flags ) 30 : QMainWindow( parent, name ) //, flags )
31{ 31{
32#ifdef DESKTOP_VERSION 32#ifdef DESKTOP_VERSION
33 globalSstatusBarMainWindow = statusBar(); 33 globalSstatusBarMainWindow = statusBar();
34#endif 34#endif
35 setCaption( i18n( "KOpieMail/Pi" ) ); 35 setCaption( i18n( "KOpieMail/Pi" ) );
36 setToolBarsMovable( false ); 36 setToolBarsMovable( false );
37 //KABC::StdAddressBook::self(); 37 //KABC::StdAddressBook::self();
38 toolBar = new QToolBar( this ); 38 toolBar = new QToolBar( this );
39 menuBar = new QPEMenuBar( toolBar ); 39 menuBar = new QPEMenuBar( toolBar );
40 mailMenu = new QPopupMenu( menuBar ); 40 mailMenu = new QPopupMenu( menuBar );
41 menuBar->insertItem( i18n( "Mail" ), mailMenu ); 41 menuBar->insertItem( i18n( "Mail" ), mailMenu );
42 settingsMenu = new QPopupMenu( menuBar ); 42 settingsMenu = new QPopupMenu( menuBar );
43 menuBar->insertItem( i18n( "Settings" ), settingsMenu ); 43 menuBar->insertItem( i18n( "Settings" ), settingsMenu );
44 44
45 addToolBar( toolBar ); 45 addToolBar( toolBar );
46 toolBar->setHorizontalStretchable( true ); 46 toolBar->setHorizontalStretchable( true );
47 QAction* getMail = new QAction( i18n( "Get all new mails" ), SmallIcon("enter"), 47 QAction* getMail = new QAction( i18n( "Get all new mails" ), SmallIcon("enter"),
48 0, 0, this ); 48 0, 0, this );
49 connect(getMail, SIGNAL( activated() ), 49 connect(getMail, SIGNAL( activated() ),
50 SLOT( slotGetAllMail() ) ); 50 SLOT( slotGetAllMail() ) );
51 getMail->addTo( mailMenu ); 51 getMail->addTo( mailMenu );
52 52
53 getMail = new QAction( i18n( "Get new messages" ), SmallIcon("add"), 53 getMail = new QAction( i18n( "Get new messages" ), SmallIcon("add"),
54 0, 0, this ); 54 0, 0, this );
55 getMail->addTo( toolBar ); 55 getMail->addTo( toolBar );
56 getMail->addTo( mailMenu ); 56 getMail->addTo( mailMenu );
57 connect(getMail, SIGNAL( activated() ), 57 connect(getMail, SIGNAL( activated() ),
58 SLOT( slotGetMail() ) ); 58 SLOT( slotGetMail() ) );
59 59
60 composeMail = new QAction( i18n( "Compose new mail" ), SmallIcon("composemail"), 60 composeMail = new QAction( i18n( "Compose new mail" ), SmallIcon("composemail"),
61 0, 0, this ); 61 0, 0, this );
62 composeMail->addTo( toolBar ); 62 composeMail->addTo( toolBar );
63 composeMail->addTo( mailMenu ); 63 composeMail->addTo( mailMenu );
64 64
65 sendQueued = new QAction( i18n( "Send queued mails" ), SmallIcon("sendqueued") , 65 sendQueued = new QAction( i18n( "Send queued mails" ), SmallIcon("sendqueued") ,
66 0, 0, this ); 66 0, 0, this );
67 sendQueued->addTo( toolBar ); 67 sendQueued->addTo( toolBar );
68 sendQueued->addTo( mailMenu ); 68 sendQueued->addTo( mailMenu );
69 69
70 /* 70 /*
71 syncFolders = new QAction( i18n( "Sync mailfolders" ), ICON_SYNC, 71 syncFolders = new QAction( i18n( "Sync mailfolders" ), ICON_SYNC,
72 0, 0, this ); 72 0, 0, this );
73 syncFolders->addTo( toolBar ); 73 syncFolders->addTo( toolBar );
74 syncFolders->addTo( mailMenu ); 74 syncFolders->addTo( mailMenu );
75 */ 75 */
76 76
77 showFolders = new QAction( i18n( "Show/Hide folders" ), SmallIcon("showfolders") , 77 showFolders = new QAction( i18n( "Show/Hide folders" ), SmallIcon("showfolders") ,
78 0, 0, this, 0, true ); 78 0, 0, this, 0, true );
79 showFolders->addTo( toolBar ); 79 showFolders->addTo( toolBar );
80 showFolders->addTo( mailMenu ); 80 showFolders->addTo( mailMenu );
81 showFolders->setOn( true ); 81 showFolders->setOn( true );
82 connect(showFolders, SIGNAL( toggled(bool) ), 82 connect(showFolders, SIGNAL( toggled(bool) ),
83 SLOT( slotShowFolders(bool) ) ); 83 SLOT( slotShowFolders(bool) ) );
84 84
85 /* 85 /*
86 searchMails = new QAction( i18n( "Search mails" ), SmallIcon("find") ), 86 searchMails = new QAction( i18n( "Search mails" ), SmallIcon("find") ),
87 0, 0, this ); 87 0, 0, this );
88 searchMails->kopddTo( toolBar ); 88 searchMails->kopddTo( toolBar );
89 searchMails->addTo( mailMenu ); 89 searchMails->addTo( mailMenu );
90 */ 90 */
91 91
92 deleteMails = new QAction(i18n("Delete Mail"), SmallIcon("trash"), 0, 0, this); 92 deleteMails = new QAction(i18n("Delete Mail"), SmallIcon("trash"), 0, 0, this);
93 deleteMails->addTo( toolBar ); 93 deleteMails->addTo( toolBar );
94 deleteMails->addTo( mailMenu ); 94 deleteMails->addTo( mailMenu );
95 connect( deleteMails, SIGNAL( activated() ), 95 connect( deleteMails, SIGNAL( activated() ),
96 SLOT( slotDeleteAllMail() ) ); 96 SLOT( slotDeleteAllMail() ) );
97 97
98 editSettings = new QAction( i18n( "Edit settings" ), SmallIcon("SettingsIcon") , 98 editSettings = new QAction( i18n( "Configure OM/Pi..." ), SmallIcon("SettingsIcon") ,
99 0, 0, this ); 99 0, 0, this );
100 editSettings->addTo( settingsMenu ); 100 editSettings->addTo( settingsMenu );
101 connect( editSettings, SIGNAL( activated() ), 101 connect( editSettings, SIGNAL( activated() ),
102 SLOT( slotEditSettings() ) ); 102 SLOT( slotEditSettings() ) );
103
104
105 QAction * editSettings2 = new QAction( i18n( "Global Settings..." ), SmallIcon("SettingsIcon") ,
106 0, 0, this );
107 editSettings2->addTo( settingsMenu );
108 connect( editSettings2, SIGNAL( activated() ),
109 SLOT( slotEditGlobalSettings() ) );
110
111
112
103 editAccounts = new QAction( i18n( "Configure accounts" ), SmallIcon("editaccounts") , 113 editAccounts = new QAction( i18n( "Configure accounts" ), SmallIcon("editaccounts") ,
104 0, 0, this ); 114 0, 0, this );
105 editAccounts->addTo( settingsMenu ); 115 editAccounts->addTo( settingsMenu );
106 codecMenu = new QPopupMenu( menuBar ); 116 codecMenu = new QPopupMenu( menuBar );
107 codecMenu->insertItem( "Western (iso-8859-1)",0,0); 117 codecMenu->insertItem( "Western (iso-8859-1)",0,0);
108 codecMenu->insertItem( "Cyrillic (iso-8859-5)",1,1); 118 codecMenu->insertItem( "Cyrillic (iso-8859-5)",1,1);
109 codecMenu->insertItem( "Western (iso-8859-15)",2,2); 119 codecMenu->insertItem( "Western (iso-8859-15)",2,2);
110 codecMenu->insertItem( "Chinese (big-5)",3,3); 120 codecMenu->insertItem( "Chinese (big-5)",3,3);
111 codecMenu->insertItem( "Unicode (utf-8)",4,4); 121 codecMenu->insertItem( "Unicode (utf-8)",4,4);
112 codecMenu->insertItem( "Userdefined ("+KOPrefs::instance()->mSendCodec+")",5,5); 122 codecMenu->insertItem( "Userdefined ("+KOPrefs::instance()->mSendCodec+")",5,5);
113 //disabled 123 //disabled
114 //settingsMenu->insertItem( i18n("Codec for new mails"), codecMenu); 124 //settingsMenu->insertItem( i18n("Codec for new mails"), codecMenu);
115 //setCentralWidget( view ); 125 //setCentralWidget( view );
116 126
117 QVBox* wrapperBox = new QVBox( this ); 127 QVBox* wrapperBox = new QVBox( this );
118 setCentralWidget( wrapperBox ); 128 setCentralWidget( wrapperBox );
119 129
120 // QWidget *view = new QWidget( wrapperBox ); 130 // QWidget *view = new QWidget( wrapperBox );
121 KDGanttMinimizeSplitter* splithor = new KDGanttMinimizeSplitter( Qt::Vertical, wrapperBox); 131 KDGanttMinimizeSplitter* splithor = new KDGanttMinimizeSplitter( Qt::Vertical, wrapperBox);
122 splithor->setMinimizeDirection( KDGanttMinimizeSplitter::Down); 132 splithor->setMinimizeDirection( KDGanttMinimizeSplitter::Down);
123 KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, splithor); 133 KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, splithor);
124 split->setMinimizeDirection( KDGanttMinimizeSplitter::Left); 134 split->setMinimizeDirection( KDGanttMinimizeSplitter::Left);
125 //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight ); 135 //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight );
126 subLE = 0; 136 subLE = 0;
127 fromLE = 0; 137 fromLE = 0;
128 toLE = 0; 138 toLE = 0;
129 if ( KOPrefs::instance()->mShowInfoSub || KOPrefs::instance()->mShowInfoFrom || KOPrefs::instance()->mShowInfoTo ) { 139 if ( KOPrefs::instance()->mShowInfoSub || KOPrefs::instance()->mShowInfoFrom || KOPrefs::instance()->mShowInfoTo ) {
130 QWidget* infoBox = new QWidget( splithor ); 140 QWidget* infoBox = new QWidget( splithor );
131 QGridLayout *griLay = new QGridLayout( infoBox, 2,2); 141 QGridLayout *griLay = new QGridLayout( infoBox, 2,2);
132 if ( KOPrefs::instance()->mShowInfoSub ) { 142 if ( KOPrefs::instance()->mShowInfoSub ) {
133 griLay->addWidget( new QLabel ( i18n("Su:"), infoBox ),0,0 ); 143 griLay->addWidget( new QLabel ( i18n("Su:"), infoBox ),0,0 );
134 griLay->addWidget( subLE = new QLineEdit( infoBox ),0,1) ; 144 griLay->addWidget( subLE = new QLineEdit( infoBox ),0,1) ;
135 } 145 }
136 if ( KOPrefs::instance()->mShowInfoFrom ) { 146 if ( KOPrefs::instance()->mShowInfoFrom ) {
137 griLay->addWidget( new QLabel ( i18n("Fr:"), infoBox ),1,0 ); 147 griLay->addWidget( new QLabel ( i18n("Fr:"), infoBox ),1,0 );
138 griLay->addWidget( fromLE = new QLineEdit( infoBox ),1,1) ; 148 griLay->addWidget( fromLE = new QLineEdit( infoBox ),1,1) ;
139 } 149 }
140 if ( KOPrefs::instance()->mShowInfoTo ) { 150 if ( KOPrefs::instance()->mShowInfoTo ) {
141 griLay->addWidget( new QLabel ( i18n("To:"), infoBox ),2,0 ); 151 griLay->addWidget( new QLabel ( i18n("To:"), infoBox ),2,0 );
142 griLay->addWidget( toLE = new QLineEdit( infoBox ),2,1) ; 152 griLay->addWidget( toLE = new QLineEdit( infoBox ),2,1) ;
143 } 153 }
144 infoBox->setMaximumHeight( infoBox->sizeHint().height() ); 154 infoBox->setMaximumHeight( infoBox->sizeHint().height() );
145 if ( !KOPrefs::instance()->mShowInfoStart ) { 155 if ( !KOPrefs::instance()->mShowInfoStart ) {
146 QTimer::singleShot( 1,splithor, SLOT ( toggle() ) ); 156 QTimer::singleShot( 1,splithor, SLOT ( toggle() ) );
147 } 157 }
148 } 158 }
149 159
150 160
151 folderView = new AccountView( split ); 161 folderView = new AccountView( split );
152 folderView->header()->hide(); 162 folderView->header()->hide();
153 folderView->setRootIsDecorated( false ); 163 folderView->setRootIsDecorated( false );
154 folderView->addColumn( i18n( "Mailbox" ) ); 164 folderView->addColumn( i18n( "Mailbox" ) );
155 165
156 //layout->addWidget( folderView ); 166 //layout->addWidget( folderView );
157 167
158 mailView = new QListView( split ); 168 mailView = new QListView( split );
159 mailView->addColumn( i18n( " " ) ); 169 mailView->addColumn( i18n( " " ) );
160 mailView->addColumn( i18n( "Subject" ),QListView::Manual ); 170 mailView->addColumn( i18n( "Subject" ),QListView::Manual );
161 mailView->addColumn( i18n( "Sender" ),QListView::Manual ); 171 mailView->addColumn( i18n( "Sender" ),QListView::Manual );
162 mailView->addColumn( i18n( "Size" ),QListView::Manual); 172 mailView->addColumn( i18n( "Size" ),QListView::Manual);
163 mailView->addColumn( i18n( "Date" ),QListView::Manual); 173 mailView->addColumn( i18n( "Date" ),QListView::Manual);
164 if ( KOPrefs::instance()->mShowToField ) 174 if ( KOPrefs::instance()->mShowToField )
165 mailView->addColumn( i18n( "To" ),QListView::Manual); 175 mailView->addColumn( i18n( "To" ),QListView::Manual);
166 mailView->setAllColumnsShowFocus(true); 176 mailView->setAllColumnsShowFocus(true);
167 //mailView->setSorting(-1); 177 //mailView->setSorting(-1);
168 mailView->setRootIsDecorated( false ); 178 mailView->setRootIsDecorated( false );
169 statusWidget = new StatusWidget( wrapperBox ); 179 statusWidget = new StatusWidget( wrapperBox );
170 statusWidget->hide(); 180 statusWidget->hide();
171 181
172 //layout->addWidget( mailView ); 182 //layout->addWidget( mailView );
173 //layout->setStretchFactor( folderView, 1 ); 183 //layout->setStretchFactor( folderView, 1 );
174 //layout->setStretchFactor( mailView, 2 ); 184 //layout->setStretchFactor( mailView, 2 );
175 185
176 slotAdjustLayout(); 186 slotAdjustLayout();
177#ifndef DESKTOP_VERSION 187#ifndef DESKTOP_VERSION
178 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); 188 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold);
179 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); 189 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold);
180 if ( subLE ) 190 if ( subLE )
181 QPEApplication::setStylusOperation( subLE ,QPEApplication::RightOnHold); 191 QPEApplication::setStylusOperation( subLE ,QPEApplication::RightOnHold);
182 if ( fromLE ) 192 if ( fromLE )
183 QPEApplication::setStylusOperation( fromLE ,QPEApplication::RightOnHold); 193 QPEApplication::setStylusOperation( fromLE ,QPEApplication::RightOnHold);
184 if ( toLE ) 194 if ( toLE )
185 QPEApplication::setStylusOperation( toLE ,QPEApplication::RightOnHold); 195 QPEApplication::setStylusOperation( toLE ,QPEApplication::RightOnHold);
186#endif 196#endif
187 connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this, 197 connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this,
188 SLOT( mailLeftClicked(QListViewItem*) ) ); 198 SLOT( mailLeftClicked(QListViewItem*) ) );
189 connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this, 199 connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this,
190 SLOT( mailLeftClicked(QListViewItem*) ) ); 200 SLOT( mailLeftClicked(QListViewItem*) ) );
191 connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, 201 connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this,
192 SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); 202 SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) );
193 connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), 203 connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)),
194 this,SLOT(refreshMailView(const QValueList<RecMailP>&))); 204 this,SLOT(refreshMailView(const QValueList<RecMailP>&)));
195 205
196 connect( mailView, SIGNAL( currentChanged (QListViewItem* )),this, 206 connect( mailView, SIGNAL( currentChanged (QListViewItem* )),this,
197 SLOT( setInfoFields(QListViewItem*) ) ); 207 SLOT( setInfoFields(QListViewItem*) ) );
198 208
199 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); 209 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) );
200 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); 210 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) );
201// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); 211// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) );
202 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); 212 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) );
203 //mailView->setMultiSelection ( true ); 213 //mailView->setMultiSelection ( true );
204 mailView->setSelectionMode( QListView::Extended ); 214 mailView->setSelectionMode( QListView::Extended );
205 QValueList<int> list; 215 QValueList<int> list;
206 int fw = 100; 216 int fw = 100;
207 if ( QApplication::desktop()->width() > 320 ) 217 if ( QApplication::desktop()->width() > 320 )
208 fw = 50; 218 fw = 50;
209 list.append( fw ); 219 list.append( fw );
210 list.append( 100 ); 220 list.append( 100 );
211 split->setSizes( list ); 221 split->setSizes( list );
212 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); 222 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) );
213 mailView->setShowSortIndicator ( true ); 223 mailView->setShowSortIndicator ( true );
214 QLabel *spacer = new QLabel( toolBar ); 224 QLabel *spacer = new QLabel( toolBar );
215 spacer->setBackgroundMode( QWidget::PaletteButton ); 225 spacer->setBackgroundMode( QWidget::PaletteButton );
216 toolBar->setStretchableWidget( spacer ); 226 toolBar->setStretchableWidget( spacer );
217 227
218 QAction* closeMail = new QAction(i18n("Close"),SmallIcon("exit"), 0, 0, this); 228 QAction* closeMail = new QAction(i18n("Close"),SmallIcon("exit"), 0, 0, this);
219 connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); 229 connect( closeMail, SIGNAL( activated() ), SLOT( close() ) );
220 if ( QApplication::desktop()->width() > 320 ) 230 if ( QApplication::desktop()->width() > 320 )
221 closeMail->addTo(toolBar); 231 closeMail->addTo(toolBar);
222 closeMail->addTo(mailMenu); 232 closeMail->addTo(mailMenu);
223 233
224 234
225 QPopupMenu* helpMenu = new QPopupMenu( menuBar ); 235 QPopupMenu* helpMenu = new QPopupMenu( menuBar );
226 menuBar->insertItem( i18n( "Help" ), helpMenu ); 236 menuBar->insertItem( i18n( "Help" ), helpMenu );
227 QAction* li = new QAction(i18n("About"), QPixmap(), 0, 0, this); 237 QAction* li = new QAction(i18n("About"), QPixmap(), 0, 0, this);
228 connect( li, SIGNAL( activated() ), SLOT( showAbout()) ); 238 connect( li, SIGNAL( activated() ), SLOT( showAbout()) );
229 li->addTo(helpMenu); 239 li->addTo(helpMenu);
230 li = new QAction(i18n("Licence"),QPixmap(), 0, 0, this); 240 li = new QAction(i18n("Licence"),QPixmap(), 0, 0, this);
231 connect( li, SIGNAL( activated() ), SLOT( showLicence()) ); 241 connect( li, SIGNAL( activated() ), SLOT( showLicence()) );
232 li->addTo(helpMenu); 242 li->addTo(helpMenu);
233 li = new QAction(i18n("LibEtPan Licence"), QPixmap(), 0, 0, this); 243 li = new QAction(i18n("LibEtPan Licence"), QPixmap(), 0, 0, this);
234 connect( li, SIGNAL( activated() ), SLOT( showEtpanLicence()) ); 244 connect( li, SIGNAL( activated() ), SLOT( showEtpanLicence()) );
235 li->addTo(helpMenu); 245 li->addTo(helpMenu);
236 connect( codecMenu, SIGNAL( activated(int) ), this, SLOT( slotSetCodec( int )) ); 246 connect( codecMenu, SIGNAL( activated(int) ), this, SLOT( slotSetCodec( int )) );
237 slotSetCodec( KOPrefs::instance()->mCurrentCodec ); 247 slotSetCodec( KOPrefs::instance()->mCurrentCodec );
238 menuBar->setMaximumWidth( menuBar->sizeHint().width()); 248 menuBar->setMaximumWidth( menuBar->sizeHint().width());
239 //menuBar->setMaximumSize( menuBar->sizeHint()); 249 //menuBar->setMaximumSize( menuBar->sizeHint());
240#ifdef DESKTOP_VERSION 250#ifdef DESKTOP_VERSION
241 resize ( 640, 480 ); 251 resize ( 640, 480 );
242#endif 252#endif
243} 253}
244 254
245MainWindow::~MainWindow() 255MainWindow::~MainWindow()
246{ 256{
247} 257}
248 258
249void MainWindow::setInfoFields(QListViewItem* item ) 259void MainWindow::setInfoFields(QListViewItem* item )
250{ 260{
251 if ( item == 0) { 261 if ( item == 0) {
252 if ( subLE ) subLE->setText(""); 262 if ( subLE ) subLE->setText("");
253 if ( fromLE ) fromLE->setText(""); 263 if ( fromLE ) fromLE->setText("");
254 if ( toLE ) toLE->setText(""); 264 if ( toLE ) toLE->setText("");
255 return; 265 return;
256 } 266 }
257 RecMailP mail = ((MailListViewItem*)item)->data(); 267 RecMailP mail = ((MailListViewItem*)item)->data();
258 if ( subLE ) subLE->setText(mail->getSubject()); 268 if ( subLE ) subLE->setText(mail->getSubject());
259 if ( fromLE ) fromLE->setText(mail->getFrom()); 269 if ( fromLE ) fromLE->setText(mail->getFrom());
260 if ( toLE ) toLE->setText(mail->To().join(";" )); 270 if ( toLE ) toLE->setText(mail->To().join(";" ));
261 if ( subLE ) subLE->setCursorPosition(0); 271 if ( subLE ) subLE->setCursorPosition(0);
262 if ( fromLE ) fromLE->setCursorPosition(0); 272 if ( fromLE ) fromLE->setCursorPosition(0);
263 if ( toLE ) toLE->setCursorPosition(0); 273 if ( toLE ) toLE->setCursorPosition(0);
264 274
265} 275}
266void MainWindow::slotSetCodec( int codec ) 276void MainWindow::slotSetCodec( int codec )
267{ 277{
268 codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, false ); 278 codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, false );
269 //qDebug("codec %d ", codec); 279 //qDebug("codec %d ", codec);
270 KOPrefs::instance()->mCurrentCodec = codec; 280 KOPrefs::instance()->mCurrentCodec = codec;
271 KOPrefs::instance()->isDirty = true; 281 KOPrefs::instance()->isDirty = true;
272 QString name; 282 QString name;
273 switch ( codec ) { 283 switch ( codec ) {
274 case 0: 284 case 0:
275 name = "iso-8859-1"; 285 name = "iso-8859-1";
276 break; 286 break;
277 case 1: 287 case 1:
278 name = "iso-8859-5"; 288 name = "iso-8859-5";
279 break; 289 break;
280 case 2: 290 case 2:
281 name = "iso-8859-15"; 291 name = "iso-8859-15";
282 break; 292 break;
283 case 3: 293 case 3:
284 name = "big-5"; 294 name = "big-5";
285 break; 295 break;
286 case 4: 296 case 4:
287 name = "utf-8"; 297 name = "utf-8";
288 break; 298 break;
289 case 5: 299 case 5:
290 name = KOPrefs::instance()->mSendCodec.lower(); 300 name = KOPrefs::instance()->mSendCodec.lower();
291 break; 301 break;
292 } 302 }
293 KOPrefs::instance()->mCurrentCodeName = name ; 303 KOPrefs::instance()->mCurrentCodeName = name ;
294 codecMenu->changeItem ( 5, "Userdefined ("+KOPrefs::instance()->mSendCodec+")"); 304 codecMenu->changeItem ( 5, "Userdefined ("+KOPrefs::instance()->mSendCodec+")");
295 codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, true ); 305 codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, true );
296} 306}
297void MainWindow::showLicence() 307void MainWindow::showLicence()
298{ 308{
299 KApplication::showLicence(); 309 KApplication::showLicence();
300} 310}
301void MainWindow::showAbout() 311void MainWindow::showAbout()
302{ 312{
303 QString version; 313 QString version;
304#include <../version> 314#include <../version>
305 315
306 QString cap = "About KOpieMail/Pi"; 316 QString cap = "About KOpieMail/Pi";
307 QString text =i18n("KOpieMail/Platform-independent\n") + 317 QString text =i18n("KOpieMail/Platform-independent\n") +
308 "(OM/Pi) " + version + " - " 318 "(OM/Pi) " + version + " - "
309 319
310#ifdef DESKTOP_VERSION 320#ifdef DESKTOP_VERSION
311 "Desktop Edition\n" 321 "Desktop Edition\n"
312#else 322#else
313 "PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n" 323 "PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n"
314#endif 324#endif
315 "www.pi-sync.info\n\n" 325 "www.pi-sync.info\n\n"
316 326
317 327
318 328
319"Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.info>\n" 329"Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.info>\n"
320 "KOpieMail/Pi is based on Opie Mail\n" 330 "KOpieMail/Pi is based on Opie Mail\n"
321 "Copyright (c) Rajko Albrecht and the Opie team\n" 331 "Copyright (c) Rajko Albrecht and the Opie team\n"
322 "KOpieMail/Pi is licensed under the GPL\n" 332 "KOpieMail/Pi is licensed under the GPL\n"
323 "\n" 333 "\n"
324 "KOpieMail/Pi uses LibEtPan - a mail stuff library\n" 334 "KOpieMail/Pi uses LibEtPan - a mail stuff library\n"
325 "Copyright (C) 2001, 2002 - DINH Viet Hoa\n" 335 "Copyright (C) 2001, 2002 - DINH Viet Hoa\n"
326 "libEtPan has its own licence - see LibEtPan licence\n"; 336 "libEtPan has its own licence - see LibEtPan licence\n";
327 337
328 KApplication::showText( cap, text ); 338 KApplication::showText( cap, text );
329} 339}
330void MainWindow::showEtpanLicence() 340void MainWindow::showEtpanLicence()
331{ 341{
332 KApplication::showFile( "LibEtPan licence", "kdepim/kopiemail/COPYRIGHTlibetpan" ); 342 KApplication::showFile( "LibEtPan licence", "kdepim/kopiemail/COPYRIGHTlibetpan" );
333 343
334} 344}
335void MainWindow::appMessage(const QCString &, const QByteArray &) 345void MainWindow::appMessage(const QCString &, const QByteArray &)
336{ 346{
337 qDebug("appMessage implemented by subclass"); 347 qDebug("appMessage implemented by subclass");
338} 348}
339 349
340void MainWindow::slotAdjustLayout() { 350void MainWindow::slotAdjustLayout() {
341 351
342 /* 352 /*
343 QWidget *d = QApplication::desktop(); 353 QWidget *d = QApplication::desktop();
344 354
345 if ( d->width() < d->height() ) { 355 if ( d->width() < d->height() ) {
346 layout->setDirection( QBoxLayout::TopToBottom ); 356 layout->setDirection( QBoxLayout::TopToBottom );
347 } else { 357 } else {
348 layout->setDirection( QBoxLayout::LeftToRight ); 358 layout->setDirection( QBoxLayout::LeftToRight );
349 } 359 }
350 */ 360 */
351} 361}
352 362
353void MainWindow::slotAdjustColumns() 363void MainWindow::slotAdjustColumns()
354{ 364{
355 bool hidden = folderView->isHidden(); 365 bool hidden = folderView->isHidden();
356 if ( hidden ) folderView->show(); 366 if ( hidden ) folderView->show();
357 folderView->setColumnWidth( 0, folderView->visibleWidth() ); 367 folderView->setColumnWidth( 0, folderView->visibleWidth() );
358 if ( hidden ) folderView->hide(); 368 if ( hidden ) folderView->hide();
359 369
360 mailView->setColumnWidth( 0, 10 ); 370 mailView->setColumnWidth( 0, 10 );
361 mailView->setColumnWidth( 1, 100 ); 371 mailView->setColumnWidth( 1, 100 );
362 mailView->setColumnWidth( 2, 100 ); 372 mailView->setColumnWidth( 2, 100 );
363 mailView->setColumnWidth( 3, 50 ); 373 mailView->setColumnWidth( 3, 50 );
364 mailView->setColumnWidth( 4, 120 ); 374 mailView->setColumnWidth( 4, 120 );
365 if ( KOPrefs::instance()->mShowToField ) 375 if ( KOPrefs::instance()->mShowToField )
366 mailView->setColumnWidth( 5, 100 ); 376 mailView->setColumnWidth( 5, 100 );
367} 377}
368 378
369void MainWindow::slotEditSettings() 379void MainWindow::slotEditSettings()
370{ 380{
371} 381}
382void MainWindow::slotEditGlobalSettings()
383{
384}
372 385
373void MainWindow::slotShowFolders( bool ) 386void MainWindow::slotShowFolders( bool )
374{ 387{
375 qDebug("not implemented: "); 388 qDebug("not implemented: ");
376} 389}
377 390
378void MainWindow::refreshMailView(const QValueList<RecMailP>&) 391void MainWindow::refreshMailView(const QValueList<RecMailP>&)
379{ 392{
380 qDebug("not implemented: "); 393 qDebug("not implemented: ");
381} 394}
382 395
383void MainWindow::mailLeftClicked(QListViewItem * ) 396void MainWindow::mailLeftClicked(QListViewItem * )
384{ 397{
385 qDebug("not implemented: "); 398 qDebug("not implemented: ");
386} 399}
387 400
388void MainWindow::displayMail() 401void MainWindow::displayMail()
389{ 402{
390 qDebug("not implemented: "); 403 qDebug("not implemented: ");
391} 404}
392 405
393void MainWindow::slotDeleteMail() 406void MainWindow::slotDeleteMail()
394{ 407{
395 qDebug("not implemented: "); 408 qDebug("not implemented: ");
396} 409}
397 410
398void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int ) 411void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int )
399{ 412{
400 qDebug("not implemented: "); 413 qDebug("not implemented: ");
401} 414}
402 415
403void MainWindow::slotSendQueued() 416void MainWindow::slotSendQueued()
404{ 417{
405 qDebug("not implemented: "); 418 qDebug("not implemented: ");
406} 419}
407 420
408void MainWindow::slotEditAccounts() 421void MainWindow::slotEditAccounts()
409{ 422{
410 qDebug("not implemented: "); 423 qDebug("not implemented: ");
411} 424}
412 425
413void MainWindow::slotComposeMail() 426void MainWindow::slotComposeMail()
414{ 427{
415 qDebug("not implemented: "); 428 qDebug("not implemented: ");
416} 429}