00001 #include <qtextbrowser.h>
00002 #include <qlistview.h>
00003 #include <qaction.h>
00004 #include <qlabel.h>
00005 #include <qvbox.h>
00006 #include <qpopupmenu.h>
00007
00008 #include <qtoolbar.h>
00009 #include <qmenubar.h>
00010 #include <qpe/resource.h>
00011
00012 #include "viewmailbase.h"
00013 #include "opendiag.h"
00014
00015 ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl)
00016 : QMainWindow(parent, name, fl)
00017 {
00018 setCaption(tr("E-Mail by %1"));
00019 setToolBarsMovable(false);
00020
00021 toolbar = new QToolBar(this);
00022 menubar = new QMenuBar( toolbar );
00023 mailmenu = new QPopupMenu( menubar );
00024 menubar->insertItem( tr( "Mail" ), mailmenu );
00025
00026 toolbar->setHorizontalStretchable(true);
00027 addToolBar(toolbar);
00028
00029 QLabel *spacer = new QLabel(toolbar);
00030 spacer->setBackgroundMode(QWidget::PaletteButton);
00031 toolbar->setStretchableWidget(spacer);
00032
00033 reply = new QAction(tr("Reply"), QIconSet(Resource::loadPixmap("mail/reply")), 0, 0, this);
00034 reply->addTo(toolbar);
00035 reply->addTo(mailmenu);
00036
00037 forward = new QAction(tr("Forward"), QIconSet(Resource::loadPixmap("mail/forward")), 0, 0, this);
00038 forward->addTo(toolbar);
00039 forward->addTo(mailmenu);
00040
00041 attachbutton = new QAction(tr("Attachments"), QIconSet(Resource::loadPixmap("mail/attach")), 0, 0, this, 0, true);
00042 attachbutton->addTo(toolbar);
00043 attachbutton->addTo(mailmenu);
00044 connect(attachbutton, SIGNAL(toggled(bool)), SLOT(slotChangeAttachview(bool)));
00045
00046 deleteMail = new QAction(tr("Delete Mail"), QIconSet(Resource::loadPixmap("mail/delete")), 0, 0, this);
00047 deleteMail->addTo(toolbar);
00048 deleteMail->addTo(mailmenu);
00049
00050 QVBox *view = new QVBox(this);
00051 setCentralWidget(view);
00052
00053 attachments = new QListView(view);
00054 attachments->setMinimumHeight(90);
00055 attachments->setMaximumHeight(90);
00056 attachments->setAllColumnsShowFocus(true);
00057 attachments->addColumn("Mime Type", 100);
00058 attachments->addColumn("Filename", 100);
00059 attachments->addColumn("Description", 100);
00060 attachments->hide();
00061
00062 browser = new QTextBrowser(view);
00063
00064 openDiag = new OpenDiag(view);
00065 openDiag->hide();
00066
00067 }
00068
00069 void ViewMailBase::slotChangeAttachview(bool state)
00070 {
00071 if (state) attachments->show();
00072 else attachments->hide();
00073 }
00074
00075