-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 @@ -28,4 +28,7 @@ #include <qpixmap.h> #include <qpushbutton.h> +//Added by qt3to4: +#include <Q3Frame> +#include <QKeyEvent> #include <kdatepicker.h> @@ -37,4 +40,5 @@ #include <knotifyclient.h> #include <qpalette.h> +#include <QDesktopWidget> #include "kdateedit.h" @@ -42,5 +46,5 @@ KDateEdit::KDateEdit(QWidget *parent, const char *name, bool withoutDP ) - : QHBox(parent, name) + : Q3HBox(parent, name) { dateFormShort = true; @@ -73,7 +77,7 @@ KDateEdit::KDateEdit(QWidget *parent, const char *name, bool withoutDP ) 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(); @@ -87,5 +91,5 @@ KDateEdit::KDateEdit(QWidget *parent, const char *name, bool withoutDP ) 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 ); @@ -226,8 +230,8 @@ void KDateEdit::setDate( QDate date,int *cpos,const int key ,const bool dateForm 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 ) ); } @@ -237,10 +241,10 @@ void KDateEdit::setDate( QDate date,int *cpos,const int key ,const bool dateForm 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; @@ -251,8 +255,8 @@ void KDateEdit::setDate( QDate date,int *cpos,const int key ,const bool dateForm 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()) ); } @@ -345,10 +349,10 @@ 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()) { @@ -361,7 +365,7 @@ void KDateEdit::keyPressEvent(QKeyEvent *e) 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()) { @@ -374,8 +378,8 @@ void KDateEdit::keyPressEvent(QKeyEvent *e) return; } - setDate(date, &cpos, Key_Down, dateFormShort); + setDate(date, &cpos, Qt::Key_Down, dateFormShort); break; default: - QHBox::keyPressEvent(e); + Q3HBox::keyPressEvent(e); break; } // switch |