summaryrefslogtreecommitdiffabout
path: root/kmicromail/mainwindow.cpp
Unidiff
Diffstat (limited to 'kmicromail/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/mainwindow.cpp39
1 files changed, 37 insertions, 2 deletions
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp
index 875ab77..250d114 100644
--- a/kmicromail/mainwindow.cpp
+++ b/kmicromail/mainwindow.cpp
@@ -11,24 +11,25 @@
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 "mainwindow.h" 22#include "mainwindow.h"
23#include "mailistviewitem.h"
23#include <KDGanttMinimizeSplitter.h> 24#include <KDGanttMinimizeSplitter.h>
24 25
25#include "koprefs.h" 26#include "koprefs.h"
26 27
27MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) 28MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
28 : QMainWindow( parent, name ) //, flags ) 29 : QMainWindow( parent, name ) //, flags )
29{ 30{
30#ifdef DESKTOP_VERSION 31#ifdef DESKTOP_VERSION
31 globalSstatusBarMainWindow = statusBar(); 32 globalSstatusBarMainWindow = statusBar();
32#endif 33#endif
33 setCaption( i18n( "KOpieMail/Pi" ) ); 34 setCaption( i18n( "KOpieMail/Pi" ) );
34 setToolBarsMovable( false ); 35 setToolBarsMovable( false );
@@ -107,28 +108,38 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
107 codecMenu->insertItem( "Western (iso-8859-15)",2,2); 108 codecMenu->insertItem( "Western (iso-8859-15)",2,2);
108 codecMenu->insertItem( "Chinese (big-5)",3,3); 109 codecMenu->insertItem( "Chinese (big-5)",3,3);
109 codecMenu->insertItem( "Unicode (utf-8)",4,4); 110 codecMenu->insertItem( "Unicode (utf-8)",4,4);
110 codecMenu->insertItem( "Userdefined ("+KOPrefs::instance()->mSendCodec+")",5,5); 111 codecMenu->insertItem( "Userdefined ("+KOPrefs::instance()->mSendCodec+")",5,5);
111 //disabled 112 //disabled
112 //settingsMenu->insertItem( i18n("Codec for new mails"), codecMenu); 113 //settingsMenu->insertItem( i18n("Codec for new mails"), codecMenu);
113 //setCentralWidget( view ); 114 //setCentralWidget( view );
114 115
115 QVBox* wrapperBox = new QVBox( this ); 116 QVBox* wrapperBox = new QVBox( this );
116 setCentralWidget( wrapperBox ); 117 setCentralWidget( wrapperBox );
117 118
118 // QWidget *view = new QWidget( wrapperBox ); 119 // QWidget *view = new QWidget( wrapperBox );
119 KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox); 120 KDGanttMinimizeSplitter* splithor = new KDGanttMinimizeSplitter( Qt::Vertical, wrapperBox);
121 splithor->setMinimizeDirection( KDGanttMinimizeSplitter::Down);
122 KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, splithor);
120 split->setMinimizeDirection( KDGanttMinimizeSplitter::Left); 123 split->setMinimizeDirection( KDGanttMinimizeSplitter::Left);
121 //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight ); 124 //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight );
122 125 QWidget* infoBox = new QWidget( splithor );
126 QGridLayout *griLay = new QGridLayout( infoBox, 2,2);
127 griLay->addWidget( new QLabel ( i18n("Su:"), infoBox ),0,0 );
128 griLay->addWidget( new QLabel ( i18n("Fr:"), infoBox ),1,0 );
129 griLay->addWidget( new QLabel ( i18n("To:"), infoBox ),2,0 );
130 griLay->addWidget( subLE = new QLineEdit( infoBox ),0,1) ;
131 griLay->addWidget( fromLE = new QLineEdit( infoBox ),1,1) ;
132 griLay->addWidget( toLE = new QLineEdit( infoBox ),2,1) ;
133 infoBox->setMaximumHeight( infoBox->sizeHint().height() );
123 folderView = new AccountView( split ); 134 folderView = new AccountView( split );
124 folderView->header()->hide(); 135 folderView->header()->hide();
125 folderView->setRootIsDecorated( false ); 136 folderView->setRootIsDecorated( false );
126 folderView->addColumn( i18n( "Mailbox" ) ); 137 folderView->addColumn( i18n( "Mailbox" ) );
127 138
128 //layout->addWidget( folderView ); 139 //layout->addWidget( folderView );
129 140
130 mailView = new QListView( split ); 141 mailView = new QListView( split );
131 mailView->addColumn( i18n( " " ) ); 142 mailView->addColumn( i18n( " " ) );
132 mailView->addColumn( i18n( "Subject" ),QListView::Manual ); 143 mailView->addColumn( i18n( "Subject" ),QListView::Manual );
133 mailView->addColumn( i18n( "Sender" ),QListView::Manual ); 144 mailView->addColumn( i18n( "Sender" ),QListView::Manual );
134 mailView->addColumn( i18n( "Size" ),QListView::Manual); 145 mailView->addColumn( i18n( "Size" ),QListView::Manual);
@@ -140,33 +151,40 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
140 mailView->setRootIsDecorated( false ); 151 mailView->setRootIsDecorated( false );
141 statusWidget = new StatusWidget( wrapperBox ); 152 statusWidget = new StatusWidget( wrapperBox );
142 statusWidget->hide(); 153 statusWidget->hide();
143 154
144 //layout->addWidget( mailView ); 155 //layout->addWidget( mailView );
145 //layout->setStretchFactor( folderView, 1 ); 156 //layout->setStretchFactor( folderView, 1 );
146 //layout->setStretchFactor( mailView, 2 ); 157 //layout->setStretchFactor( mailView, 2 );
147 158
148 slotAdjustLayout(); 159 slotAdjustLayout();
149#ifndef DESKTOP_VERSION 160#ifndef DESKTOP_VERSION
150 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); 161 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold);
151 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); 162 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold);
163 QPEApplication::setStylusOperation( subLE ,QPEApplication::RightOnHold);
164 QPEApplication::setStylusOperation( fromLE ,QPEApplication::RightOnHold);
165 QPEApplication::setStylusOperation( toLE ,QPEApplication::RightOnHold);
152#endif 166#endif
153 connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this, 167 connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this,
154 SLOT( mailLeftClicked(QListViewItem*) ) ); 168 SLOT( mailLeftClicked(QListViewItem*) ) );
155 connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this, 169 connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this,
156 SLOT( mailLeftClicked(QListViewItem*) ) ); 170 SLOT( mailLeftClicked(QListViewItem*) ) );
157 connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, 171 connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this,
158 SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); 172 SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) );
159 connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), 173 connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)),
160 this,SLOT(refreshMailView(const QValueList<RecMailP>&))); 174 this,SLOT(refreshMailView(const QValueList<RecMailP>&)));
175
176 connect( mailView, SIGNAL( currentChanged (QListViewItem* )),this,
177 SLOT( setInfoFields(QListViewItem*) ) );
178
161 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); 179 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) );
162 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); 180 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) );
163// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); 181// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) );
164 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); 182 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) );
165 //mailView->setMultiSelection ( true ); 183 //mailView->setMultiSelection ( true );
166 mailView->setSelectionMode( QListView::Extended ); 184 mailView->setSelectionMode( QListView::Extended );
167 QValueList<int> list; 185 QValueList<int> list;
168 int fw = 100; 186 int fw = 100;
169 if ( QApplication::desktop()->width() > 320 ) 187 if ( QApplication::desktop()->width() > 320 )
170 fw = 50; 188 fw = 50;
171 list.append( fw ); 189 list.append( fw );
172 list.append( 100 ); 190 list.append( 100 );
@@ -197,24 +215,41 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
197 li->addTo(helpMenu); 215 li->addTo(helpMenu);
198 connect( codecMenu, SIGNAL( activated(int) ), this, SLOT( slotSetCodec( int )) ); 216 connect( codecMenu, SIGNAL( activated(int) ), this, SLOT( slotSetCodec( int )) );
199 slotSetCodec( KOPrefs::instance()->mCurrentCodec ); 217 slotSetCodec( KOPrefs::instance()->mCurrentCodec );
200#ifdef DESKTOP_VERSION 218#ifdef DESKTOP_VERSION
201 resize ( 640, 480 ); 219 resize ( 640, 480 );
202#endif 220#endif
203} 221}
204 222
205MainWindow::~MainWindow() 223MainWindow::~MainWindow()
206{ 224{
207} 225}
208 226
227void MainWindow::setInfoFields(QListViewItem* item )
228{
229 if ( item == 0) {
230 subLE->setText("");
231 fromLE->setText("");
232 toLE->setText("");
233 return;
234 }
235 RecMailP mail = ((MailListViewItem*)item)->data();
236 subLE->setText(mail->getSubject());
237 fromLE->setText(mail->getFrom());
238 toLE->setText(mail->To().join(";" ));
239 subLE->setCursorPosition(0);
240 fromLE->setCursorPosition(0);
241 toLE->setCursorPosition(0);
242
243}
209void MainWindow::slotSetCodec( int codec ) 244void MainWindow::slotSetCodec( int codec )
210{ 245{
211 codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, false ); 246 codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, false );
212 //qDebug("codec %d ", codec); 247 //qDebug("codec %d ", codec);
213 KOPrefs::instance()->mCurrentCodec = codec; 248 KOPrefs::instance()->mCurrentCodec = codec;
214 KOPrefs::instance()->isDirty = true; 249 KOPrefs::instance()->isDirty = true;
215 QString name; 250 QString name;
216 switch ( codec ) { 251 switch ( codec ) {
217 case 0: 252 case 0:
218 name = "iso-8859-1"; 253 name = "iso-8859-1";
219 break; 254 break;
220 case 1: 255 case 1: