-rw-r--r-- | korganizer/ktimeedit.cpp | 89 |
1 files changed, 46 insertions, 43 deletions
diff --git a/korganizer/ktimeedit.cpp b/korganizer/ktimeedit.cpp index df9b2fc..e2ae4a6 100644 --- a/korganizer/ktimeedit.cpp +++ b/korganizer/ktimeedit.cpp @@ -23,3 +23,3 @@ -#include <qkeycode.h> +#include <qnamespace.h> #include <qcombobox.h> @@ -27,4 +27,7 @@ #include <qlineedit.h> -#include <qlistbox.h> +#include <q3listbox.h> #include <qapplication.h> +#include <QDesktopWidget> +//Added by qt3to4: +#include <QKeyEvent> @@ -47,3 +50,3 @@ KOTimeEdit::KOTimeEdit(QWidget *parent, QTime qt, const char *name) - : QComboBox(TRUE, parent, name) + : Q3ComboBox(TRUE, parent, name) { @@ -66,3 +69,3 @@ KOTimeEdit::KOTimeEdit(QWidget *parent, QTime qt, const char *name) timeEntry = timeEntry.addSecs(60*15); - } while (!timeEntry.isNull()); + } while ( !( timeEntry.hour() || timeEntry.minute() ) ); // Add end of day. @@ -71,3 +74,3 @@ KOTimeEdit::KOTimeEdit(QWidget *parent, QTime qt, const char *name) updateText(); - setFocusPolicy(QWidget::StrongFocus); + setFocusPolicy(Qt::StrongFocus); @@ -210,4 +213,4 @@ void KOTimeEdit::keyPressEvent(QKeyEvent *e) // Tap -> Focus Next Widget - if ( e->key() == Key_Tab ) { - QComboBox::keyPressEvent(e); + if ( e->key() == Qt::Key_Tab ) { + Q3ComboBox::keyPressEvent(e); return; @@ -222,8 +225,8 @@ void KOTimeEdit::keyPressEvent(QKeyEvent *e) switch(e->key()) { - case Key_Escape: + case Qt::Key_Escape: lineEdit()->deselect(); - case Key_Tab: - QComboBox::keyPressEvent(e); + case Qt::Key_Tab: + Q3ComboBox::keyPressEvent(e); break; - case Key_Up: + case Qt::Key_Up: if ( e->state () == Qt::ControlButton ) { @@ -269,3 +272,3 @@ void KOTimeEdit::keyPressEvent(QKeyEvent *e) break; - case Key_Down: + case Qt::Key_Down: if ( e->state () == Qt::ControlButton ) { @@ -312,3 +315,3 @@ void KOTimeEdit::keyPressEvent(QKeyEvent *e) // set cursor to correct place - case Key_Left: + case Qt::Key_Left: if ( cpos == 3 ) @@ -323,3 +326,3 @@ void KOTimeEdit::keyPressEvent(QKeyEvent *e) // set cursor to correct place - case Key_Right: + case Qt::Key_Right: if ( cpos == 1 ) @@ -332,9 +335,9 @@ void KOTimeEdit::keyPressEvent(QKeyEvent *e) // rest - case Key_Prior: + case Qt::Key_Prior: subTime(QTime(1,0,0)); break; - case Key_Next: + case Qt::Key_Next: addTime(QTime(1,0,0)); break; - case Key_Backspace: + case Qt::Key_Backspace: if ( cpos > 0) { @@ -344,3 +347,3 @@ void KOTimeEdit::keyPressEvent(QKeyEvent *e) cpos = 5; - text.at( cpos-1 ) = '0'; + text[ cpos-1 ] = '0'; lineEdit()->setText( text ); @@ -354,3 +357,3 @@ void KOTimeEdit::keyPressEvent(QKeyEvent *e) // if cursor at string end, alltext market and keyEvent don't ArrowLeft -> deselect and cpos - if( cpos > 4 && lineEdit()->markedText().length() == 5 && e->key() != Key_Left ) { + if( cpos > 4 && lineEdit()->markedText().length() == 5 && e->key() != Qt::Key_Left ) { lineEdit()->deselect(); @@ -369,4 +372,4 @@ void KOTimeEdit::keyPressEvent(QKeyEvent *e) switch(e->key()) { - case Key_Delete: - text.at( cpos ) = '0'; + case Qt::Key_Delete: + text[ cpos ] = '0'; lineEdit()->setText( text ); @@ -376,6 +379,6 @@ void KOTimeEdit::keyPressEvent(QKeyEvent *e) break; - case Key_9: - case Key_8: - case Key_7: - case Key_6: + case Qt::Key_9: + case Qt::Key_8: + case Qt::Key_7: + case Qt::Key_6: if ( !(cpos == 1 || cpos == 4) ) @@ -383,6 +386,6 @@ void KOTimeEdit::keyPressEvent(QKeyEvent *e) if ( cpos == 1 && text.at( 0 ) > '1') - text.at( 0 ) = '1'; - case Key_5: - case Key_4: - case Key_3: + text[ 0 ] = '1'; + case Qt::Key_5: + case Qt::Key_4: + case Qt::Key_3: if ( cpos < 1 ) @@ -391,3 +394,3 @@ void KOTimeEdit::keyPressEvent(QKeyEvent *e) return; - case Key_2: + case Qt::Key_2: if ( hour12Format && cpos == 0 ) @@ -395,12 +398,12 @@ void KOTimeEdit::keyPressEvent(QKeyEvent *e) if ( cpos == 0 && text.at( 1 ) > '3') - text.at( 1 ) = '3'; - case Key_1: - case Key_0: + text[ 1 ] = '3'; + case Qt::Key_1: + case Qt::Key_0: if ( hour12Format ) { - if ( e->key() == Key_0 && cpos == 1 && text.at( 0 ) == '0' ) + if ( e->key() == Qt::Key_0 && cpos == 1 && text.at( 0 ) == '0' ) return; - if ( e->key() == Key_0 && cpos == 0 && text.at( 1 ) == '0' ) - text.at( 1 ) = '1'; + if ( e->key() == Qt::Key_0 && cpos == 0 && text.at( 1 ) == '0' ) + text[ 1 ] = '1'; } - text.at( cpos ) = QChar ( e->key() ); + text[ cpos ] = QChar ( e->key() ); lineEdit()->setText( text ); @@ -413,3 +416,3 @@ void KOTimeEdit::keyPressEvent(QKeyEvent *e) break; - case Key_Home: + case Qt::Key_Home: lineEdit()->setCursorPosition(0); @@ -417,3 +420,3 @@ void KOTimeEdit::keyPressEvent(QKeyEvent *e) break; - case Key_End: + case Qt::Key_End: lineEdit()->setCursorPosition(5); @@ -427,4 +430,4 @@ void KOTimeEdit::keyPressEvent(QKeyEvent *e) if ( hour12Format ) { - if ( e->key() == Key_A ) { - text.at( 5 ) = 'a'; + if ( e->key() == Qt::Key_A ) { + text[ 5 ] = 'a'; lineEdit()->setText( text ); @@ -432,4 +435,4 @@ void KOTimeEdit::keyPressEvent(QKeyEvent *e) - } else if ( e->key() == Key_P ) { - text.at( 5 ) = 'p'; + } else if ( e->key() == Qt::Key_P ) { + text[ 5 ] = 'p'; lineEdit()->setText( text ); |