summaryrefslogtreecommitdiff
path: root/noncore/unsupported/mail2/mainwindowbase.cpp
blob: c55bd909c8a3ea3810be96792839433bf84f2806 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include <qprogressbar.h>
#include <qtoolbutton.h>
#include <qpopupmenu.h>
#include <qaction.h>
#include <qheader.h>
#include <qlabel.h>
#include <qvbox.h>

#include <qpe/qpetoolbar.h>
#include <qpe/resource.h>

#include "mainwindowbase.h"
#include "folderwidget.h"
#include "mailtable.h"

MainWindowBase::MainWindowBase(QWidget *parent, const char *name, WFlags fl)
	: QMainWindow(parent, name, fl)
{
	setCaption(tr("E-Mail"));
	setToolBarsMovable(false);

	toolbar = new QPEToolBar(this);
	addToolBar(toolbar);
	toolbar->setHorizontalStretchable(true);

	compose = new QAction(tr("Compose new mail"), QIconSet(Resource::loadPixmap("mail/newmail")), 0, 0, this);
	compose->addTo(toolbar);

	folders = new QAction(tr("Show/hide folders"), QIconSet(Resource::loadPixmap("mail/folder")), 0, 0, this, 0, true);
	folders->addTo(toolbar);
	connect(folders, SIGNAL(toggled(bool)), SLOT(slotFoldersToggled(bool)));

	findmails = new QAction(tr("Search mails"), QIconSet(Resource::loadPixmap("mail/find")), 0, 0, this); 
	findmails->addTo(toolbar);

	configure = new QAction(tr("Configuration"), QIconSet(Resource::loadPixmap("mail/configure")), 0, 0, this);
	configure->addTo(toolbar);

	QLabel *spacer = new QLabel(toolbar);
	spacer->setBackgroundMode(QWidget::PaletteButton);
	toolbar->setStretchableWidget(spacer);

	stop = new QAction(tr("Abort"), QIconSet(Resource::loadPixmap("mail/abort")), 0, 0, this);
	stop->addTo(toolbar);

	QVBox *view = new QVBox(this);
	setCentralWidget(view);

	folderView = new FolderWidget(view);
	folderView->setMinimumHeight(90);
	folderView->setMaximumHeight(90);
	folderView->hide();

	mailView = new MailTable(view);
	mailView->setMinimumHeight(50);

	QHBox *status = new QHBox(view);

	statusLabel = new QLabel(status);
	QFont tmpFont = statusLabel->font();
	tmpFont.setPixelSize(8);
	statusLabel->setFont(tmpFont);

	statusProgress = new QProgressBar(status);
	statusProgress->setCenterIndicator(true);
	statusProgress->setMaximumHeight(15);
	statusProgress->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
}

void MainWindowBase::slotFoldersToggled(bool toggled)
{
	if (folderView->isHidden() && toggled) folderView->show();
	if (!folderView->isHidden() && !toggled) folderView->hide();
}