Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

datebookweeklstdayhdr.cpp

Go to the documentation of this file.
00001 #include "datebookweeklstdayhdr.h"
00002 
00003 #include "namespace_hack.h"
00004 
00005 DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /* onM */,
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     //dont use dayOfWeek() to save space !
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         QFont f=label->font();
00028         f.setItalic(true);
00029         label->setFont(f);
00030         label->setPalette(QPalette(QColor(0,0,255),label->backgroundColor()));
00031         */
00032     } else if (d.dayOfWeek() == 7) { // FIXME: Match any holiday
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 }

Generated on Sat Nov 5 16:15:49 2005 for OPIE by  doxygen 1.4.2