-rw-r--r-- | libkdepim/kdateedit.cpp | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/libkdepim/kdateedit.cpp b/libkdepim/kdateedit.cpp index bf38479..28c88d4 100644 --- a/libkdepim/kdateedit.cpp +++ b/libkdepim/kdateedit.cpp @@ -27,6 +27,9 @@ #include <qlineedit.h> #include <qpixmap.h> #include <qpushbutton.h> +//Added by qt3to4: +#include <Q3Frame> +#include <QKeyEvent> #include <kdatepicker.h> #include <kdebug.h> @@ -36,12 +39,13 @@ #include <kmessagebox.h> #include <knotifyclient.h> #include <qpalette.h> +#include <QDesktopWidget> #include "kdateedit.h" //#include "kdateedit.moc" KDateEdit::KDateEdit(QWidget *parent, const char *name, bool withoutDP ) - : QHBox(parent, name) + : Q3HBox(parent, name) { dateFormShort = true; withoutDp = withoutDP; @@ -72,9 +76,9 @@ KDateEdit::KDateEdit(QWidget *parent, const char *name, bool withoutDP ) QPushButton* nowButton = new QPushButton(this); nowButton->setPixmap(pixmap2); - mDateFrame = new QVBox(0,0,WType_Popup); + mDateFrame = new Q3VBox(0,0,Qt::WType_Popup); // mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); - mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); + mDateFrame->setFrameStyle( Q3Frame::WinPanel |Q3Frame::Raised ); mDateFrame->setLineWidth(3); mDateFrame->hide(); @@ -86,7 +90,7 @@ KDateEdit::KDateEdit(QWidget *parent, const char *name, bool withoutDP ) connect(mDatePicker,SIGNAL(dateSelected(QDate)),mDateFrame,SLOT(hide())); connect(mDateButton,SIGNAL(clicked()),SLOT(toggleDatePicker())); connect(nowButton,SIGNAL(clicked()),SLOT(goToNow())); - mDateButton->setFocusPolicy( QWidget::NoFocus ); + mDateButton->setFocusPolicy( Qt::NoFocus ); mDateButton->setAutoDefault( false ); //mDateFrame->resize( 400, 300 ); @@ -225,10 +229,10 @@ void KDateEdit::setDate( QDate date,int *cpos,const int key ,const bool dateForm case 'd': case 'a': case 'A': - if(key == Key_Up) { + if(key == Qt::Key_Up) { setDate( date.addDays( 1 ) ); } - else if(key == Key_Down) { + else if(key == Qt::Key_Down) { setDate( date.addDays( -1 ) ); } maxDay = readDate().day(); @@ -236,12 +240,12 @@ void KDateEdit::setDate( QDate date,int *cpos,const int key ,const bool dateForm case 'm': case 'b': case 'B': - if(key == Key_Up) { + if(key == Qt::Key_Up) { int year = ((date.month()+1)>12)?date.year()+1:date.year(); int month = ((date.month()+1)>12)?1:date.month()+1; int day = (QDate(year,month,1).daysInMonth()<maxDay)?QDate(year,month,1).daysInMonth():maxDay; setDate( QDate( year, month, day ) ); - } else if(key == Key_Down) { + } else if(key == Qt::Key_Down) { int year = ((date.month()-1)<1)?date.year()-1:date.year(); int month = ((date.month()-1)<1)?12:date.month()-1; int day = (QDate(year,month,1).daysInMonth()<maxDay)?QDate(year,month,1).daysInMonth():maxDay; @@ -250,10 +254,10 @@ void KDateEdit::setDate( QDate date,int *cpos,const int key ,const bool dateForm break; case 'y': case 'Y': - if(key == Key_Up) { + if(key == Qt::Key_Up) { setDate( QDate( date.year() + 1, date.month() , date.day()) ); } - else if(key == Key_Down) { + else if(key == Qt::Key_Down) { setDate( QDate( date.year() - 1, date.month() , date.day()) ); } break; @@ -344,12 +348,12 @@ void KDateEdit::keyPressEvent(QKeyEvent *e) switch(e->key()) { - case Key_Escape: + case Qt::Key_Escape: mDateEdit->deselect(); - case Key_Tab: - QHBox::keyPressEvent(e); + case Qt::Key_Tab: + Q3HBox::keyPressEvent(e); break; - case Key_Up: + case Qt::Key_Up: // when date invalid then set to currend and return if(!date.isValid()) { date = QDate::currentDate(); @@ -360,9 +364,9 @@ void KDateEdit::keyPressEvent(QKeyEvent *e) KMessageBox::information( 0, text ); return; } - setDate(date, &cpos, Key_Up, dateFormShort); + setDate(date, &cpos, Qt::Key_Up, dateFormShort); break; - case Key_Down: + case Qt::Key_Down: // when date invalid then set to current and return if(!date.isValid()) { date = QDate::currentDate(); @@ -373,10 +377,10 @@ void KDateEdit::keyPressEvent(QKeyEvent *e) KMessageBox::information( 0, text ); return; } - setDate(date, &cpos, Key_Down, dateFormShort); + setDate(date, &cpos, Qt::Key_Down, dateFormShort); break; default: - QHBox::keyPressEvent(e); + Q3HBox::keyPressEvent(e); break; } // switch mDateEdit->setCursorPosition(cpos); |