-rw-r--r-- | microkde/kdatetbl.cpp | 99 |
1 files changed, 53 insertions, 46 deletions
diff --git a/microkde/kdatetbl.cpp b/microkde/kdatetbl.cpp index 353f78d..10dc449 100644 --- a/microkde/kdatetbl.cpp +++ b/microkde/kdatetbl.cpp | |||
@@ -46,2 +46,10 @@ | |||
46 | #include <qdialog.h> | 46 | #include <qdialog.h> |
47 | #include <QDesktopWidget> | ||
48 | //Added by qt3to4: | ||
49 | #include <QResizeEvent> | ||
50 | #include <QFocusEvent> | ||
51 | #include <Q3Frame> | ||
52 | #include <QMouseEvent> | ||
53 | #include <QKeyEvent> | ||
54 | #include <QEvent> | ||
47 | #include <assert.h> | 55 | #include <assert.h> |
@@ -71,3 +79,3 @@ KDateValidator::date(const QString& text, QDate& d) const | |||
71 | } else | 79 | } else |
72 | return Valid; | 80 | return QValidator::Intermediate; |
73 | } | 81 | } |
@@ -80,4 +88,4 @@ KDateValidator::fixup( QString& ) const | |||
80 | 88 | ||
81 | KDateTable::KDateTable(QWidget *parent, QDate date_, const char* name, WFlags f) | 89 | KDateTable::KDateTable(QWidget *parent, QDate date_, const char* name, Qt::WFlags f) |
82 | : QGridView(parent, name, f) | 90 | : Q3GridView(parent, name, f) |
83 | { | 91 | { |
@@ -88,3 +96,3 @@ KDateTable::KDateTable(QWidget *parent, QDate date_, const char* name, WFlags f) | |||
88 | } | 96 | } |
89 | setFocusPolicy( QWidget::StrongFocus ); | 97 | setFocusPolicy( Qt::StrongFocus ); |
90 | setNumRows(7); // 6 weeks max + headline | 98 | setNumRows(7); // 6 weeks max + headline |
@@ -95,3 +103,3 @@ KDateTable::KDateTable(QWidget *parent, QDate date_, const char* name, WFlags f) | |||
95 | #if 0 | 103 | #if 0 |
96 | viewport()->setEraseColor(lightGray); | 104 | viewport()->setEraseColor(Qt::lightGray); |
97 | #endif | 105 | #endif |
@@ -110,3 +118,3 @@ KDateTable::paintCell(QPainter *painter, int row, int col) | |||
110 | int pos; | 118 | int pos; |
111 | QBrush brushBlue(blue); | 119 | QBrush brushBlue(Qt::blue); |
112 | QBrush brushLightblue(QColor(220,245,255)); | 120 | QBrush brushLightblue(QColor(220,245,255)); |
@@ -135,14 +143,13 @@ KDateTable::paintCell(QPainter *painter, int row, int col) | |||
135 | painter->drawRect(0, 0, w, h); | 143 | painter->drawRect(0, 0, w, h); |
136 | painter->setPen(blue); | 144 | painter->setPen(Qt::blue); |
137 | } else { | 145 | } else { |
138 | painter->setPen(blue); | 146 | painter->setPen(Qt::blue); |
139 | painter->setBrush(brushBlue); | 147 | painter->setBrush(brushBlue); |
140 | painter->drawRect(0, 0, w, h); | 148 | painter->drawRect(0, 0, w, h); |
141 | painter->setPen(white); | 149 | painter->setPen(Qt::white); |
142 | } | 150 | } |
143 | painter->drawText(0, 0, w, h-1, AlignCenter, | 151 | painter->drawText(0, 0, w, h-1, Qt::AlignCenter, |
144 | daystr, -1, &rect); | 152 | daystr, -1, &rect); |
145 | painter->setPen(black); | 153 | painter->setPen(Qt::black); |
146 | painter->moveTo(0, h-1); | 154 | painter->drawLine(0, h-1, w-1, h-1); |
147 | painter->lineTo(w-1, h-1); | ||
148 | // ----- draw the weekday: | 155 | // ----- draw the weekday: |
@@ -163,6 +170,6 @@ KDateTable::paintCell(QPainter *painter, int row, int col) | |||
163 | } | 170 | } |
164 | painter->setPen(gray); | 171 | painter->setPen(Qt::gray); |
165 | } else { // paint a day of the current month | 172 | } else { // paint a day of the current month |
166 | text.setNum(pos-firstday+1); | 173 | text.setNum(pos-firstday+1); |
167 | painter->setPen(black); | 174 | painter->setPen(Qt::black); |
168 | } | 175 | } |
@@ -173,12 +180,12 @@ KDateTable::paintCell(QPainter *painter, int row, int col) | |||
173 | if(mMarkCurrent && firstday+QDate::currentDate().day()-1==pos) | 180 | if(mMarkCurrent && firstday+QDate::currentDate().day()-1==pos) |
174 | painter->setPen(green); | 181 | painter->setPen(Qt::green); |
175 | else | 182 | else |
176 | painter->setPen(red); | 183 | painter->setPen(Qt::red); |
177 | if(hasFocus()) | 184 | if(hasFocus()) |
178 | { | 185 | { |
179 | painter->setBrush(darkRed); | 186 | painter->setBrush(Qt::darkRed); |
180 | pen=white; | 187 | pen=QColor(Qt::white); |
181 | } else { | 188 | } else { |
182 | painter->setBrush(darkGray); | 189 | painter->setBrush(Qt::darkGray); |
183 | pen=white; | 190 | pen=QColor(Qt::white); |
184 | } | 191 | } |
@@ -187,5 +194,5 @@ KDateTable::paintCell(QPainter *painter, int row, int col) | |||
187 | { | 194 | { |
188 | painter->setPen(green); | 195 | painter->setPen(Qt::green); |
189 | painter->setBrush(darkGreen); | 196 | painter->setBrush(Qt::darkGreen); |
190 | pen=white; | 197 | pen=QColor(Qt::white); |
191 | } else { | 198 | } else { |
@@ -197,3 +204,3 @@ KDateTable::paintCell(QPainter *painter, int row, int col) | |||
197 | painter->setPen(pen); | 204 | painter->setPen(pen); |
198 | painter->drawText(0, 0, w, h, AlignCenter, text, -1, &rect); | 205 | painter->drawText(0, 0, w, h, Qt::AlignCenter, text, -1, &rect); |
199 | } | 206 | } |
@@ -276,3 +283,3 @@ KDateTable::viewportResizeEvent(QResizeEvent * e) | |||
276 | { | 283 | { |
277 | QGridView::viewportResizeEvent(e); | 284 | Q3GridView::viewportResizeEvent(e); |
278 | 285 | ||
@@ -411,3 +418,3 @@ void KDateTable::focusInEvent( QFocusEvent *e ) | |||
411 | repaintContents(false); | 418 | repaintContents(false); |
412 | QGridView::focusInEvent( e ); | 419 | Q3GridView::focusInEvent( e ); |
413 | } | 420 | } |
@@ -417,3 +424,3 @@ void KDateTable::focusOutEvent( QFocusEvent *e ) | |||
417 | repaintContents(false); | 424 | repaintContents(false); |
418 | QGridView::focusOutEvent( e ); | 425 | Q3GridView::focusOutEvent( e ); |
419 | } | 426 | } |
@@ -434,3 +441,3 @@ KDateInternalMonthPicker::KDateInternalMonthPicker | |||
434 | (QWidget* parent, const char* name) | 441 | (QWidget* parent, const char* name) |
435 | : QGridView(parent, name), | 442 | : Q3GridView(parent, name), |
436 | result(0) // invalid | 443 | result(0) // invalid |
@@ -453,3 +460,3 @@ KDateInternalMonthPicker::KDateInternalMonthPicker | |||
453 | setVScrollBarMode(AlwaysOff); | 460 | setVScrollBarMode(AlwaysOff); |
454 | setFrameStyle(QFrame::NoFrame); | 461 | setFrameStyle(Q3Frame::NoFrame); |
455 | setNumRows(4); | 462 | setNumRows(4); |
@@ -459,3 +466,3 @@ KDateInternalMonthPicker::KDateInternalMonthPicker | |||
459 | #if 0 | 466 | #if 0 |
460 | viewport()->setEraseColor(lightGray); // for consistency with the datepicker | 467 | viewport()->setEraseColor(Qt::lightGray); // for consistency with the datepicker |
461 | #endif | 468 | #endif |
@@ -489,3 +496,3 @@ KDateInternalMonthPicker::setupPainter(QPainter *p) | |||
489 | { | 496 | { |
490 | p->setPen(black); | 497 | p->setPen(Qt::black); |
491 | } | 498 | } |
@@ -507,3 +514,3 @@ KDateInternalMonthPicker::paintCell(QPainter* painter, int row, int col) | |||
507 | text=KGlobal::locale()->monthName(index, false); | 514 | text=KGlobal::locale()->monthName(index, false); |
508 | painter->drawText(0, 0, cellWidth(), cellHeight(), AlignCenter, text); | 515 | painter->drawText(0, 0, cellWidth(), cellHeight(), Qt::AlignCenter, text); |
509 | if ( activeCol == col && activeRow == row ) | 516 | if ( activeCol == col && activeRow == row ) |
@@ -515,3 +522,3 @@ KDateInternalMonthPicker::contentsMousePressEvent(QMouseEvent *e) | |||
515 | { | 522 | { |
516 | if(!isEnabled() || e->button() != LeftButton) | 523 | if(!isEnabled() || e->button() != Qt::LeftButton) |
517 | { | 524 | { |
@@ -542,3 +549,3 @@ KDateInternalMonthPicker::contentsMouseMoveEvent(QMouseEvent *e) | |||
542 | { | 549 | { |
543 | if (e->state() & LeftButton) | 550 | if (e->state() & Qt::LeftButton) |
544 | { | 551 | { |
@@ -616,3 +623,3 @@ KDateInternalYearSelector::KDateInternalYearSelector | |||
616 | #if 0 | 623 | #if 0 |
617 | setFrameStyle(QFrame::NoFrame); | 624 | setFrameStyle(Q3Frame::NoFrame); |
618 | #endif | 625 | #endif |
@@ -663,3 +670,3 @@ KDateInternalYearSelector::setYear(int year) | |||
663 | KPopupFrame::KPopupFrame(QWidget* parent, const char* name) | 670 | KPopupFrame::KPopupFrame(QWidget* parent, const char* name) |
664 | : QFrame(parent, name, WType_Popup), | 671 | : Q3Frame(parent, name, Qt::WType_Popup), |
665 | result(0), // rejected | 672 | result(0), // rejected |
@@ -667,3 +674,3 @@ KPopupFrame::KPopupFrame(QWidget* parent, const char* name) | |||
667 | { | 674 | { |
668 | setFrameStyle(QFrame::Box|QFrame::Raised); | 675 | setFrameStyle(Q3Frame::Box|Q3Frame::Raised); |
669 | setMidLineWidth(2); | 676 | setMidLineWidth(2); |
@@ -674,3 +681,3 @@ KPopupFrame::keyPressEvent(QKeyEvent* e) | |||
674 | { | 681 | { |
675 | if(e->key()==Key_Escape) | 682 | if(e->key()==Qt::Key_Escape) |
676 | { | 683 | { |
@@ -758,3 +765,3 @@ KDateInternalWeekPicker::KDateInternalWeekPicker | |||
758 | (QWidget* parent, const char* name) | 765 | (QWidget* parent, const char* name) |
759 | : QGridView(parent, name), | 766 | : Q3GridView(parent, name), |
760 | result(0) // invalid | 767 | result(0) // invalid |
@@ -775,3 +782,3 @@ KDateInternalWeekPicker::KDateInternalWeekPicker | |||
775 | setVScrollBarMode(AlwaysOff); | 782 | setVScrollBarMode(AlwaysOff); |
776 | setFrameStyle(QFrame::NoFrame); | 783 | setFrameStyle(Q3Frame::NoFrame); |
777 | if ( QApplication::desktop()->height() > 240 ) { | 784 | if ( QApplication::desktop()->height() > 240 ) { |
@@ -786,3 +793,3 @@ KDateInternalWeekPicker::KDateInternalWeekPicker | |||
786 | #if 0 | 793 | #if 0 |
787 | viewport()->setEraseColor(lightGray); // for consistency with the datepicker | 794 | viewport()->setEraseColor(Qt::lightGray); // for consistency with the datepicker |
788 | #endif | 795 | #endif |
@@ -820,3 +827,3 @@ KDateInternalWeekPicker::setupPainter(QPainter *p) | |||
820 | { | 827 | { |
821 | p->setPen(black); | 828 | p->setPen(Qt::black); |
822 | } | 829 | } |
@@ -838,3 +845,3 @@ KDateInternalWeekPicker::paintCell(QPainter* painter, int row, int col) | |||
838 | text=QString::number( index ); | 845 | text=QString::number( index ); |
839 | painter->drawText(0, 0, cellWidth(), cellHeight(), AlignCenter, text); | 846 | painter->drawText(0, 0, cellWidth(), cellHeight(), Qt::AlignCenter, text); |
840 | if ( activeCol == col && activeRow == row ) | 847 | if ( activeCol == col && activeRow == row ) |
@@ -846,3 +853,3 @@ KDateInternalWeekPicker::contentsMousePressEvent(QMouseEvent *e) | |||
846 | { | 853 | { |
847 | if(!isEnabled() || e->button() != LeftButton) | 854 | if(!isEnabled() || e->button() != Qt::LeftButton) |
848 | { | 855 | { |
@@ -873,3 +880,3 @@ KDateInternalWeekPicker::contentsMouseMoveEvent(QMouseEvent *e) | |||
873 | { | 880 | { |
874 | if (e->state() & LeftButton) | 881 | if (e->state() & Qt::LeftButton) |
875 | { | 882 | { |