00001 #include "datebookweeklstdayhdr.h"
00002
00003 #include "namespace_hack.h"
00004
00005 DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool ,
00006 QWidget* parent,
00007 const char* name,
00008 WFlags fl )
00009 : DateBookWeekLstDayHdrBase(parent, name, fl) {
00010
00011 date=d;
00012
00013 static const QString wdays=tr("MTWTFSSM", "Week days");
00014 char day=wdays[d.dayOfWeek()-1];
00015
00016
00017 label->setText( QString(QObject::tr(QString(QChar(day)))) + " " +QString::number(d.day()) );
00018
00019 add->setText("+");
00020
00021 if (d == QDate::currentDate()) {
00022 QPalette pal=label->palette();
00023 pal.setColor(QColorGroup::Foreground, QColor(0,0,255));
00024 label->setPalette(pal);
00025
00026
00027
00028
00029
00030
00031
00032 } else if (d.dayOfWeek() == 7) {
00033 QPalette pal=label->palette();
00034 pal.setColor(QColorGroup::Foreground, QColor(255,0,0));
00035 label->setPalette(pal);
00036 }
00037
00038 connect (label, SIGNAL(clicked()), this, SLOT(showDay()));
00039 connect (add, SIGNAL(clicked()), this, SLOT(newEvent()));
00040 }
00041
00042 void DateBookWeekLstDayHdr::showDay() {
00043 emit showDate(date.year(), date.month(), date.day());
00044 }
00045
00046 void DateBookWeekLstDayHdr::newEvent() {
00047 QDateTime start, stop;
00048 start=stop=date;
00049 start.setTime(QTime(10,0));
00050 stop.setTime(QTime(12,0));
00051
00052 emit addEvent(start,stop,"",0);
00053 }