-rw-r--r-- | kmicromail/mainwindow.cpp | 44 |
1 files changed, 32 insertions, 12 deletions
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp index 250d114..0794e00 100644 --- a/kmicromail/mainwindow.cpp +++ b/kmicromail/mainwindow.cpp @@ -14,16 +14,17 @@ #include <qstatusbar.h> #include <kabc/stdaddressbook.h> extern QStatusBar* globalSstatusBarMainWindow; #else #include <qpe/qpeapplication.h> #include <klocale.h> #endif #include "defines.h" +#include "koprefs.h" #include "mainwindow.h" #include "mailistviewitem.h" #include <KDGanttMinimizeSplitter.h> #include "koprefs.h" MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) : QMainWindow( parent, name ) //, flags ) @@ -79,17 +80,17 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) showFolders->addTo( mailMenu ); showFolders->setOn( true ); connect(showFolders, SIGNAL( toggled(bool) ), SLOT( slotShowFolders(bool) ) ); /* searchMails = new QAction( i18n( "Search mails" ), SmallIcon("find") ), 0, 0, this ); - searchMails->addTo( toolBar ); + searchMails->kopddTo( toolBar ); searchMails->addTo( mailMenu ); */ deleteMails = new QAction(i18n("Delete Mail"), SmallIcon("trash"), 0, 0, this); deleteMails->addTo( toolBar ); deleteMails->addTo( mailMenu ); connect( deleteMails, SIGNAL( activated() ), SLOT( slotDeleteAllMail() ) ); @@ -117,25 +118,41 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) setCentralWidget( wrapperBox ); // QWidget *view = new QWidget( wrapperBox ); KDGanttMinimizeSplitter* splithor = new KDGanttMinimizeSplitter( Qt::Vertical, wrapperBox); splithor->setMinimizeDirection( KDGanttMinimizeSplitter::Down); KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, splithor); split->setMinimizeDirection( KDGanttMinimizeSplitter::Left); //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight ); + subLE = 0; + fromLE = 0; + toLE = 0; + if ( KOPrefs::instance()->mShowInfoSub || KOPrefs::instance()->mShowInfoFrom || KOPrefs::instance()->mShowInfoTo ) { QWidget* infoBox = new QWidget( splithor ); QGridLayout *griLay = new QGridLayout( infoBox, 2,2); + if ( KOPrefs::instance()->mShowInfoSub ) { griLay->addWidget( new QLabel ( i18n("Su:"), infoBox ),0,0 ); - griLay->addWidget( new QLabel ( i18n("Fr:"), infoBox ),1,0 ); - griLay->addWidget( new QLabel ( i18n("To:"), infoBox ),2,0 ); griLay->addWidget( subLE = new QLineEdit( infoBox ),0,1) ; + } + if ( KOPrefs::instance()->mShowInfoFrom ) { + griLay->addWidget( new QLabel ( i18n("Fr:"), infoBox ),1,0 ); griLay->addWidget( fromLE = new QLineEdit( infoBox ),1,1) ; + } + if ( KOPrefs::instance()->mShowInfoTo ) { + griLay->addWidget( new QLabel ( i18n("To:"), infoBox ),2,0 ); griLay->addWidget( toLE = new QLineEdit( infoBox ),2,1) ; + } infoBox->setMaximumHeight( infoBox->sizeHint().height() ); + if ( !KOPrefs::instance()->mShowInfoStart ) { + QTimer::singleShot( 1,splithor, SLOT ( toggle() ) ); + } + } + + folderView = new AccountView( split ); folderView->header()->hide(); folderView->setRootIsDecorated( false ); folderView->addColumn( i18n( "Mailbox" ) ); //layout->addWidget( folderView ); mailView = new QListView( split ); @@ -155,18 +172,21 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) //layout->addWidget( mailView ); //layout->setStretchFactor( folderView, 1 ); //layout->setStretchFactor( mailView, 2 ); slotAdjustLayout(); #ifndef DESKTOP_VERSION QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); + if ( subLE ) QPEApplication::setStylusOperation( subLE ,QPEApplication::RightOnHold); + if ( fromLE ) QPEApplication::setStylusOperation( fromLE ,QPEApplication::RightOnHold); + if ( toLE ) QPEApplication::setStylusOperation( toLE ,QPEApplication::RightOnHold); #endif connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this, SLOT( mailLeftClicked(QListViewItem*) ) ); connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this, SLOT( mailLeftClicked(QListViewItem*) ) ); connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); @@ -222,28 +242,28 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) MainWindow::~MainWindow() { } void MainWindow::setInfoFields(QListViewItem* item ) { if ( item == 0) { - subLE->setText(""); - fromLE->setText(""); - toLE->setText(""); + if ( subLE ) subLE->setText(""); + if ( fromLE ) fromLE->setText(""); + if ( toLE ) toLE->setText(""); return; } RecMailP mail = ((MailListViewItem*)item)->data(); - subLE->setText(mail->getSubject()); - fromLE->setText(mail->getFrom()); - toLE->setText(mail->To().join(";" )); - subLE->setCursorPosition(0); - fromLE->setCursorPosition(0); - toLE->setCursorPosition(0); + if ( subLE ) subLE->setText(mail->getSubject()); + if ( fromLE ) fromLE->setText(mail->getFrom()); + if ( toLE ) toLE->setText(mail->To().join(";" )); + if ( subLE ) subLE->setCursorPosition(0); + if ( fromLE ) fromLE->setCursorPosition(0); + if ( toLE ) toLE->setCursorPosition(0); } void MainWindow::slotSetCodec( int codec ) { codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, false ); //qDebug("codec %d ", codec); KOPrefs::instance()->mCurrentCodec = codec; KOPrefs::instance()->isDirty = true; |