|
|
|
@ -57,7 +57,7 @@ DateValidator::validate(TQString& text, int&) const
|
|
|
|
|
TQValidator::State
|
|
|
|
|
DateValidator::date(const TQString& text, TQDate& d) const
|
|
|
|
|
{
|
|
|
|
|
TQDate tmp = KGlobal::locale()->readDate(text);
|
|
|
|
|
TQDate tmp = TDEGlobal::locale()->readDate(text);
|
|
|
|
|
if (!tmp.isNull())
|
|
|
|
|
{
|
|
|
|
|
d = tmp;
|
|
|
|
@ -96,7 +96,7 @@ DateTable::DateTable(TQWidget *parent, TQDate date_, const char* name, WFlags f)
|
|
|
|
|
|
|
|
|
|
setHScrollBarMode(AlwaysOff);
|
|
|
|
|
setVScrollBarMode(AlwaysOff);
|
|
|
|
|
viewport()->setEraseColor(KGlobalSettings::baseColor());
|
|
|
|
|
viewport()->setEraseColor(TDEGlobalSettings::baseColor());
|
|
|
|
|
setDate(date_); // this initializes firstday, numdays, numDaysPrevMonth
|
|
|
|
|
|
|
|
|
|
colorBackgroundHoliday = TQColor(0, 245, 255, TQColor::Hsv);
|
|
|
|
@ -106,8 +106,8 @@ DateTable::DateTable(TQWidget *parent, TQDate date_, const char* name, WFlags f)
|
|
|
|
|
colorTextHoliday = black;
|
|
|
|
|
colorTextWorkday = black;
|
|
|
|
|
colorLine = black;
|
|
|
|
|
backgroundSelectColor = KGlobalSettings::highlightColor();
|
|
|
|
|
penSelectColor=KGlobalSettings::baseColor();
|
|
|
|
|
backgroundSelectColor = TDEGlobalSettings::highlightColor();
|
|
|
|
|
penSelectColor=TDEGlobalSettings::baseColor();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -116,7 +116,7 @@ void DateTable::paintWeekday(TQPainter *painter, int col) {
|
|
|
|
|
int w=cellWidth();
|
|
|
|
|
int h=cellHeight();
|
|
|
|
|
|
|
|
|
|
TQFont font = KGlobalSettings::generalFont();
|
|
|
|
|
TQFont font = TDEGlobalSettings::generalFont();
|
|
|
|
|
font.setBold(true);
|
|
|
|
|
if (!m_enabled)
|
|
|
|
|
font.setItalic(true);
|
|
|
|
@ -126,10 +126,10 @@ void DateTable::paintWeekday(TQPainter *painter, int col) {
|
|
|
|
|
|
|
|
|
|
//kdDebug()<<k_funcinfo<<" col="<<col<<" day="<<day<<" name="<<daystr<<endl;
|
|
|
|
|
|
|
|
|
|
painter->setBrush(KGlobalSettings::baseColor());
|
|
|
|
|
painter->setPen(KGlobalSettings::baseColor());
|
|
|
|
|
painter->setBrush(TDEGlobalSettings::baseColor());
|
|
|
|
|
painter->setPen(TDEGlobalSettings::baseColor());
|
|
|
|
|
painter->drawRect(0, 0, w, h);
|
|
|
|
|
painter->setPen(KGlobalSettings::textColor());
|
|
|
|
|
painter->setPen(TDEGlobalSettings::textColor());
|
|
|
|
|
|
|
|
|
|
if (m_markedWeekdays.state(day) == Map::Working) {
|
|
|
|
|
painter->setPen(colorBackgroundWorkday);
|
|
|
|
@ -148,7 +148,7 @@ void DateTable::paintWeekday(TQPainter *painter, int col) {
|
|
|
|
|
painter->drawRect(2, 2, w-4, h-4);
|
|
|
|
|
painter->setPen(penSelectColor);
|
|
|
|
|
}
|
|
|
|
|
painter->drawText(0, 0, w, h-1, AlignCenter, KGlobal::locale()->calendar()->weekDayName(day, true), -1, &rect);
|
|
|
|
|
painter->drawText(0, 0, w, h-1, AlignCenter, TDEGlobal::locale()->calendar()->weekDayName(day, true), -1, &rect);
|
|
|
|
|
painter->setPen(colorLine);
|
|
|
|
|
painter->moveTo(0, h-1);
|
|
|
|
|
painter->lineTo(w-1, h-1);
|
|
|
|
@ -164,16 +164,16 @@ void DateTable::paintWeekNumber(TQPainter *painter, int row) {
|
|
|
|
|
int w=cellWidth();
|
|
|
|
|
int h=cellHeight();
|
|
|
|
|
|
|
|
|
|
TQFont font=KGlobalSettings::generalFont();
|
|
|
|
|
TQFont font=TDEGlobalSettings::generalFont();
|
|
|
|
|
font.setBold(true);
|
|
|
|
|
if (!m_enabled)
|
|
|
|
|
font.setItalic(true);
|
|
|
|
|
painter->setFont(font);
|
|
|
|
|
|
|
|
|
|
painter->setBrush(KGlobalSettings::baseColor());
|
|
|
|
|
painter->setPen(KGlobalSettings::baseColor());
|
|
|
|
|
painter->setBrush(TDEGlobalSettings::baseColor());
|
|
|
|
|
painter->setPen(TDEGlobalSettings::baseColor());
|
|
|
|
|
painter->drawRect(0, 0, w, h);
|
|
|
|
|
painter->setPen(KGlobalSettings::textColor());
|
|
|
|
|
painter->setPen(TDEGlobalSettings::textColor());
|
|
|
|
|
|
|
|
|
|
painter->drawText(0, 0, w, h-1, AlignCenter, TQString("%1").arg(m_weeks[row].first), -1, &rect);
|
|
|
|
|
painter->setPen(colorLine);
|
|
|
|
@ -190,7 +190,7 @@ void DateTable::paintDay(TQPainter *painter, int row, int col) {
|
|
|
|
|
int w=cellWidth();
|
|
|
|
|
int h=cellHeight();
|
|
|
|
|
|
|
|
|
|
TQFont font=KGlobalSettings::generalFont();
|
|
|
|
|
TQFont font=TDEGlobalSettings::generalFont();
|
|
|
|
|
font.setPointSize(fontsize);
|
|
|
|
|
if (!m_enabled)
|
|
|
|
|
font.setItalic(true);
|
|
|
|
@ -198,8 +198,8 @@ void DateTable::paintDay(TQPainter *painter, int row, int col) {
|
|
|
|
|
|
|
|
|
|
TQDate d = getDate(position(row, col));
|
|
|
|
|
|
|
|
|
|
painter->setBrush(KGlobalSettings::baseColor());
|
|
|
|
|
painter->setPen(KGlobalSettings::baseColor());
|
|
|
|
|
painter->setBrush(TDEGlobalSettings::baseColor());
|
|
|
|
|
painter->setPen(TDEGlobalSettings::baseColor());
|
|
|
|
|
painter->drawRect(0, 0, w, h);
|
|
|
|
|
|
|
|
|
|
// First paint the dates background
|
|
|
|
@ -238,7 +238,7 @@ void DateTable::paintDay(TQPainter *painter, int row, int col) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// and now the day number
|
|
|
|
|
d.month() == date.month() ? painter->setPen(KGlobalSettings::textColor()) : painter->setPen(gray);
|
|
|
|
|
d.month() == date.month() ? painter->setPen(TDEGlobalSettings::textColor()) : painter->setPen(gray);
|
|
|
|
|
painter->drawText(0, 0, w, h, AlignCenter, TQString().setNum(d.day()), -1, &rect);
|
|
|
|
|
|
|
|
|
|
if(rect.width()>maxCell.width()) maxCell.setWidth(rect.width());
|
|
|
|
@ -252,7 +252,7 @@ void DateTable::paintCell(TQPainter *painter, int row, int col) {
|
|
|
|
|
int w=cellWidth();
|
|
|
|
|
int h=cellHeight();
|
|
|
|
|
painter->setPen(colorLine);
|
|
|
|
|
painter->setBrush(KGlobalSettings::baseColor());
|
|
|
|
|
painter->setBrush(TDEGlobalSettings::baseColor());
|
|
|
|
|
painter->moveTo(w-1, 0);
|
|
|
|
|
painter->lineTo(w-1, h-1);
|
|
|
|
|
painter->lineTo(0, h-1);
|
|
|
|
@ -348,7 +348,7 @@ void DateTable::setFontSize(int size) {
|
|
|
|
|
maxCell.setHeight(0);
|
|
|
|
|
for(count=0; count<7; ++count)
|
|
|
|
|
{
|
|
|
|
|
rect=metrics.boundingRect(KGlobal::locale()->calendar()->weekDayName(count+1, true));
|
|
|
|
|
rect=metrics.boundingRect(TDEGlobal::locale()->calendar()->weekDayName(count+1, true));
|
|
|
|
|
maxCell.setWidth(TQMAX(maxCell.width(), rect.width()));
|
|
|
|
|
maxCell.setHeight(TQMAX(maxCell.height(), rect.height()));
|
|
|
|
|
}
|
|
|
|
@ -507,7 +507,7 @@ bool DateTable::selectDate(const TQDate& date_) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
temp.setYMD(date.year(), date.month(), 1);
|
|
|
|
|
firstday=column(KGlobal::locale()->calendar()->dayOfWeek(temp));
|
|
|
|
|
firstday=column(TDEGlobal::locale()->calendar()->dayOfWeek(temp));
|
|
|
|
|
if(firstday==1) firstday=8; // Reserve row 1 for previous month
|
|
|
|
|
numdays=date.daysInMonth();
|
|
|
|
|
if(date.month()==1) { // set to december of previous year
|
|
|
|
@ -543,9 +543,9 @@ bool DateTable::setDate(const TQDate& date_, bool repaint) {
|
|
|
|
|
//m_selectedDates.clear();
|
|
|
|
|
|
|
|
|
|
temp.setYMD(date.year(), date.month(), 1);
|
|
|
|
|
firstday=column(KGlobal::locale()->calendar()->dayOfWeek(temp));
|
|
|
|
|
firstday=column(TDEGlobal::locale()->calendar()->dayOfWeek(temp));
|
|
|
|
|
if(firstday==1) firstday=8;
|
|
|
|
|
//kdDebug()<<k_funcinfo<<"date="<<temp<<"day="<<(KGlobal::locale()->calendar()->dayOfWeek(temp))<<" firstday="<<firstday<<endl;
|
|
|
|
|
//kdDebug()<<k_funcinfo<<"date="<<temp<<"day="<<(TDEGlobal::locale()->calendar()->dayOfWeek(temp))<<" firstday="<<firstday<<endl;
|
|
|
|
|
numdays=date.daysInMonth();
|
|
|
|
|
if(date.month()==1) { // set to december of previous year
|
|
|
|
|
temp.setYMD(date.year()-1, 12, 1);
|
|
|
|
@ -661,16 +661,16 @@ TQDate DateTable::getDate(int pos) const {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int DateTable::weekday(int col) const {
|
|
|
|
|
int day = col - m_dateStartCol + KGlobal::locale()->weekStartDay();
|
|
|
|
|
int day = col - m_dateStartCol + TDEGlobal::locale()->weekStartDay();
|
|
|
|
|
if (day > 7) day %= 7;
|
|
|
|
|
//kdDebug()<<k_funcinfo<<"col="<<col<<" day="<<day<<" StartCol="<<m_dateStartCol<<" weekStartDay="<<KGlobal::locale()->weekStartDay()<<endl;
|
|
|
|
|
//kdDebug()<<k_funcinfo<<"col="<<col<<" day="<<day<<" StartCol="<<m_dateStartCol<<" weekStartDay="<<TDEGlobal::locale()->weekStartDay()<<endl;
|
|
|
|
|
return day;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int DateTable::column(int weekday) const {
|
|
|
|
|
int col = weekday - KGlobal::locale()->weekStartDay();
|
|
|
|
|
int col = weekday - TDEGlobal::locale()->weekStartDay();
|
|
|
|
|
if (col < 0) col += 7;
|
|
|
|
|
//kdDebug()<<k_funcinfo<<"col="<<col<<" day="<<col<<" StartCol="<<m_dateStartCol<<" weekStartDay="<<KGlobal::locale()->weekStartDay()<<endl;
|
|
|
|
|
//kdDebug()<<k_funcinfo<<"col="<<col<<" day="<<col<<" StartCol="<<m_dateStartCol<<" weekStartDay="<<TDEGlobal::locale()->weekStartDay()<<endl;
|
|
|
|
|
return col + m_dateStartCol;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -720,7 +720,7 @@ DateInternalWeekSelector::DateInternalWeekSelector
|
|
|
|
|
{
|
|
|
|
|
TQFont font;
|
|
|
|
|
// -----
|
|
|
|
|
font=KGlobalSettings::generalFont();
|
|
|
|
|
font=TDEGlobalSettings::generalFont();
|
|
|
|
|
font.setPointSize(fontsize);
|
|
|
|
|
setFont(font);
|
|
|
|
|
setFrameStyle(TQFrame::NoFrame);
|
|
|
|
@ -770,7 +770,7 @@ DateInternalMonthPicker::DateInternalMonthPicker
|
|
|
|
|
// -----
|
|
|
|
|
activeCol = -1;
|
|
|
|
|
activeRow = -1;
|
|
|
|
|
font=KGlobalSettings::generalFont();
|
|
|
|
|
font=TDEGlobalSettings::generalFont();
|
|
|
|
|
font.setPointSize(fontsize);
|
|
|
|
|
setFont(font);
|
|
|
|
|
setHScrollBarMode(AlwaysOff);
|
|
|
|
@ -780,13 +780,13 @@ DateInternalMonthPicker::DateInternalMonthPicker
|
|
|
|
|
setNumCols(3);
|
|
|
|
|
// enable to find drawing failures:
|
|
|
|
|
// setTableFlags(Tbl_clipCellPainting);
|
|
|
|
|
viewport()->setEraseColor(KGlobalSettings::baseColor()); // for consistency with the datepicker
|
|
|
|
|
viewport()->setEraseColor(TDEGlobalSettings::baseColor()); // for consistency with the datepicker
|
|
|
|
|
// ----- find the preferred size
|
|
|
|
|
// (this is slow, possibly, but unfortunatly it is needed here):
|
|
|
|
|
TQFontMetrics metrics(font);
|
|
|
|
|
for(int i=1; i <= 12; ++i)
|
|
|
|
|
{
|
|
|
|
|
rect=metrics.boundingRect(KGlobal::locale()->calendar()->monthName(i, false));
|
|
|
|
|
rect=metrics.boundingRect(TDEGlobal::locale()->calendar()->monthName(i, false));
|
|
|
|
|
if(max.width()<rect.width()) max.setWidth(rect.width());
|
|
|
|
|
if(max.height()<rect.height()) max.setHeight(rect.height());
|
|
|
|
|
}
|
|
|
|
@ -809,7 +809,7 @@ DateInternalMonthPicker::getResult() const
|
|
|
|
|
void
|
|
|
|
|
DateInternalMonthPicker::setupPainter(TQPainter *p)
|
|
|
|
|
{
|
|
|
|
|
p->setPen(KGlobalSettings::textColor());
|
|
|
|
|
p->setPen(TDEGlobalSettings::textColor());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
@ -826,7 +826,7 @@ DateInternalMonthPicker::paintCell(TQPainter* painter, int row, int col)
|
|
|
|
|
TQString text;
|
|
|
|
|
// ----- find the number of the cell:
|
|
|
|
|
index=3*row+col+1;
|
|
|
|
|
text=KGlobal::locale()->calendar()->monthName(index, false);
|
|
|
|
|
text=TDEGlobal::locale()->calendar()->monthName(index, false);
|
|
|
|
|
painter->drawText(0, 0, cellWidth(), cellHeight(), AlignCenter, text);
|
|
|
|
|
if ( activeCol == col && activeRow == row )
|
|
|
|
|
painter->drawRect( 0, 0, cellWidth(), cellHeight() );
|
|
|
|
@ -932,7 +932,7 @@ DateInternalYearSelector::DateInternalYearSelector
|
|
|
|
|
{
|
|
|
|
|
TQFont font;
|
|
|
|
|
// -----
|
|
|
|
|
font=KGlobalSettings::generalFont();
|
|
|
|
|
font=TDEGlobalSettings::generalFont();
|
|
|
|
|
font.setPointSize(fontsize);
|
|
|
|
|
setFont(font);
|
|
|
|
|
setFrameStyle(TQFrame::NoFrame);
|
|
|
|
|