diff options
Diffstat (limited to 'libtdeedu/extdate/extdatetimeedit.cpp')
-rw-r--r-- | libtdeedu/extdate/extdatetimeedit.cpp | 334 |
1 files changed, 166 insertions, 168 deletions
diff --git a/libtdeedu/extdate/extdatetimeedit.cpp b/libtdeedu/extdate/extdatetimeedit.cpp index 21e74809..4a7527aa 100644 --- a/libtdeedu/extdate/extdatetimeedit.cpp +++ b/libtdeedu/extdate/extdatetimeedit.cpp @@ -27,10 +27,8 @@ #ifndef TQT_NO_DATETIMEEDIT -//#include "../kernel/tqinternal_p.h" -//#include "../kernel/tqrichtext_p.h" -#include <tqinternal_p.h> -#include <tqrichtext_p.h> +#include <private/tqinternal_p.h> +#include <private/tqrichtext_p.h> #include <tqrangecontrol.h> #include <tqapplication.h> #include <tqpixmap.h> @@ -44,7 +42,7 @@ static TQString *lDateSep = 0; static TQString *lTimeSep = 0; -static bool lAMPM = FALSE; +static bool lAMPM = false; static TQString *lAM = 0; static TQString *lPM = 0; static ExtDateEdit::Order lOrder = ExtDateEdit::YMD; @@ -112,7 +110,7 @@ static void readLocaleSettings() *lDateSep = "-"; *lTimeSep = ":"; #endif - TQString d = ExtDate( 1999, 11, 22 ).toString( Qt::LocalDate ); + TQString d = ExtDate( 1999, 11, 22 ).toString( TQt::LocalDate ); dpos = d.find( "22" ); mpos = d.find( "11" ); ypos = d.find( "99" ); @@ -142,7 +140,7 @@ static void readLocaleSettings() } #ifndef TQ_WS_WIN - TQString t = TQTime( 11, 22, 33 ).toString( Qt::LocalDate ); + TQString t = TQTime( 11, 22, 33 ).toString( TQt::LocalDate ); dpos = t.find( "11" ); mpos = t.find( "22" ); ypos = t.find( "33" ); @@ -181,11 +179,11 @@ class ExtDateTimeEditorPrivate { public: ExtDateTimeEditorPrivate() - : frm( TRUE ), - parag( new TQTextParagraph( 0, 0, 0, FALSE ) ), + : frm( true ), + parag( new TQTextParagraph( 0, 0, 0, false ) ), focusSec(0) { - parag->formatter()->setWrapEnabled( FALSE ); + parag->formatter()->setWrapEnabled( false ); cursor = new TQTextCursor( 0 ); cursor->setParagraph( parag ); offset = 0; @@ -242,13 +240,13 @@ public: bool setFocusSection( int idx ) { if ( idx > (int)sections.count()-1 || idx < 0 ) - return FALSE; + return false; if ( idx != focusSec ) { focusSec = idx; applyFocusSelection(); - return TRUE; + return true; } - return FALSE; + return false; } bool inSectionSelection( int idx ) @@ -256,9 +254,9 @@ public: for ( uint i = 0; i < sections.count(); ++i ) { if ( idx >= sections[i].selectionStart() && idx <= sections[i].selectionEnd() ) - return TRUE; + return true; } - return FALSE; + return false; } void paint( const TQString& txt, bool focus, TQPainter& p, @@ -304,7 +302,7 @@ public: yoff = 0; p.translate( xoff, yoff ); - parag->paint( p, cg, 0, TRUE ); + parag->paint( p, cg, 0, true ); if ( frm ) p.translate( -xoff, -yoff ); } @@ -372,7 +370,7 @@ void ExtDateTimeEditor::init() setBackgroundMode( PaletteBase ); setFocusSection( -1 ); installEventFilter( this ); - setFocusPolicy( TQ_WheelFocus ); + setFocusPolicy( TQWidget::WheelFocus ); } @@ -465,7 +463,7 @@ void ExtDateTimeEditor::mousePressEvent( TQMouseEvent *e ) int sec = sectionAt( p ); if ( sec != -1 ) { cw->setFocusSection( sec ); - repaint( rect(), FALSE ); + repaint( rect(), false ); } } @@ -474,71 +472,71 @@ void ExtDateTimeEditor::mousePressEvent( TQMouseEvent *e ) */ bool ExtDateTimeEditor::eventFilter( TQObject *o, TQEvent *e ) { - if ( TQT_BASE_OBJECT(o) == TQT_BASE_OBJECT(this) ) { + if ( o == this ) { if ( e->type() == TQEvent::KeyPress ) { TQKeyEvent *ke = (TQKeyEvent*)e; switch ( ke->key() ) { case Key_Right: if ( d->focusSection() < (int)d->sectionCount()-1 ) { if ( cw->setFocusSection( focusSection()+1 ) ) - repaint( rect(), FALSE ); + repaint( rect(), false ); } - return TRUE; + return true; case Key_Left: if ( d->focusSection() > 0 ) { if ( cw->setFocusSection( focusSection()-1 ) ) - repaint( rect(), FALSE ); + repaint( rect(), false ); } - return TRUE; + return true; case Key_Up: cw->stepUp(); - return TRUE; + return true; case Key_Down: cw->stepDown(); - return TRUE; + return true; case Key_Backspace: - if ( ::tqqt_cast<ExtDateEdit*>(cw) ) + if ( ::tqt_cast<ExtDateEdit*>(cw) ) ((ExtDateEdit*)cw)->removeFirstNumber( d->focusSection() ); - else if ( ::tqqt_cast<TQTimeEdit*>(cw) ) + else if ( ::tqt_cast<TQTimeEdit*>(cw) ) ((TQTimeEdit*)cw)->removeFirstNumber( d->focusSection() ); - return TRUE; + return true; case Key_Delete: cw->removeLastNumber( d->focusSection() ); - return TRUE; + return true; case Key_Tab: case Key_BackTab: { if ( ke->state() == TQt::ControlButton ) - return FALSE; + return false; TQWidget *w = this; - bool hadDateEdit = FALSE; + bool hadDateEdit = false; while ( w ) { - if ( ::tqqt_cast<ExtDateTimeSpinWidget*>(w) && qstrcmp( w->name(), "qt_spin_widget" ) != 0 || - ::tqqt_cast<ExtDateTimeEdit*>(w) ) + if ( ::tqt_cast<ExtDateTimeSpinWidget*>(w) && qstrcmp( w->name(), "qt_spin_widget" ) != 0 || + ::tqt_cast<ExtDateTimeEdit*>(w) ) break; - hadDateEdit = hadDateEdit || ::tqqt_cast<ExtDateEdit*>(w); + hadDateEdit = hadDateEdit || ::tqt_cast<ExtDateEdit*>(w); w = w->parentWidget(); } if ( w ) { - if ( !::tqqt_cast<ExtDateTimeEdit*>(w) ) { + if ( !::tqt_cast<ExtDateTimeEdit*>(w) ) { w = w->parentWidget(); } else { ExtDateTimeEdit *ed = (ExtDateTimeEdit*)w; if ( hadDateEdit && ke->key() == Key_Tab ) { ed->timeEdit()->setFocus(); - return TRUE; + return true; } else if ( !hadDateEdit && ke->key() == Key_BackTab ) { ed->dateEdit()->setFocus(); - return TRUE; + return true; } else { - while ( w && !::tqqt_cast<ExtDateTimeEdit*>(w) ) + while ( w && !::tqt_cast<ExtDateTimeEdit*>(w) ) w = w->parentWidget(); } } tqApp->sendEvent( w, e ); - return TRUE; + return true; } } break; default: @@ -547,10 +545,10 @@ bool ExtDateTimeEditor::eventFilter( TQObject *o, TQEvent *e ) // do the same thing as KEY_RIGHT when the user presses the separator key if ( d->focusSection() < 2 ) { if ( cw->setFocusSection( focusSection()+1 ) ) - repaint( rect(), FALSE ); + repaint( rect(), false ); } - return TRUE; - } else if ( !txt.isEmpty() && ::tqqt_cast<TQTimeEdit*>(cw) && focusSection() == (int) d->sectionCount()-1 ) { + return true; + } else if ( !txt.isEmpty() && ::tqt_cast<TQTimeEdit*>(cw) && focusSection() == (int) d->sectionCount()-1 ) { // the first character of the AM/PM indicator toggles if the section has focus TQTimeEdit *te = (TQTimeEdit*)cw; TQTime time = te->time(); @@ -568,12 +566,12 @@ bool ExtDateTimeEditor::eventFilter( TQObject *o, TQEvent *e ) int num = txt[0].digitValue(); if ( num != -1 ) { cw->addNumber( d->focusSection(), num ); - return TRUE; + return true; } } } } - return FALSE; + return false; } @@ -744,13 +742,13 @@ public: dateEdit->setRange( ExtDate::currentDate().addDays( -365 ), ExtDate::currentDate().addDays( 365 ) ); dateEdit->setOrder( ExtDateEdit::MDY ); - dateEdit->setAutoAdvance( TRUE ); + dateEdit->setAutoAdvance( true ); \endcode Here we've created a new ExtDateEdit object initialised with today's date and restricted the valid date range to today plus or minus 365 days. We've set the order to month, day, year. If the auto - advance property is TRUE (as we've set it here) when the user + advance property is true (as we've set it here) when the user completes a section of the date, e.g. enters two digits for the month, they are automatically taken to the next section. @@ -830,10 +828,10 @@ void ExtDateEdit::init() d->ed = new ExtDateTimeEditor( this, "date editor" ); d->controls->setEditWidget( d->ed ); setFocusProxy( d->ed ); - connect( d->controls, TQT_SIGNAL( stepUpPressed() ), TQT_SLOT( stepUp() ) ); - connect( d->controls, TQT_SIGNAL( stepDownPressed() ), TQT_SLOT( stepDown() ) ); - connect( this, TQT_SIGNAL( valueChanged(const ExtDate&) ), - TQT_SLOT( updateButtons() ) ); + connect( d->controls, TQ_SIGNAL( stepUpPressed() ), TQ_SLOT( stepUp() ) ); + connect( d->controls, TQ_SIGNAL( stepDownPressed() ), TQ_SLOT( stepDown() ) ); + connect( this, TQ_SIGNAL( valueChanged(const ExtDate&) ), + TQ_SLOT( updateButtons() ) ); d->ed->appendSection( TQNumberSection( 0,4 ) ); d->ed->appendSection( TQNumberSection( 5,7 ) ); d->ed->appendSection( TQNumberSection( 8,10 ) ); @@ -848,13 +846,13 @@ void ExtDateEdit::init() d->dayCache = 0; setOrder( localOrder() ); setFocusSection( 0 ); - d->overwrite = TRUE; - d->adv = FALSE; + d->overwrite = true; + d->adv = false; d->timerId = 0; - d->typing = FALSE; + d->typing = false; d->min = ExtDate( -50000, 1, 1 ); d->max = ExtDate( 50000, 12, 31 ); - d->changed = FALSE; + d->changed = false; setSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::Fixed ); @@ -1133,7 +1131,7 @@ void ExtDateEdit::setOrder( ExtDateEdit::Order order ) } if ( isVisible() ) - d->ed->repaint( d->ed->rect(), FALSE ); + d->ed->repaint( d->ed->rect(), false ); } @@ -1149,29 +1147,29 @@ ExtDateEdit::Order ExtDateEdit::order() const void ExtDateEdit::stepUp() { int sec = d->ed->focusSection(); - bool accepted = FALSE; + bool accepted = false; if ( sec == d->yearSection ) { if ( !outOfRange( d->y+1, d->m, d->d ) ) { - accepted = TRUE; + accepted = true; setYear( d->y+1 ); } } else if ( sec == d->monthSection ) { if ( !outOfRange( d->y, d->m+1, d->d ) ) { - accepted = TRUE; + accepted = true; setMonth( d->m+1 ); } } else if ( sec == d->daySection ) { if ( !outOfRange( d->y, d->m, d->d+1 ) ) { - accepted = TRUE; + accepted = true; setDay( d->d+1 ); } } if ( accepted ) { - d->changed = TRUE; + d->changed = true; emit valueChanged( date() ); } - d->ed->repaint( d->ed->rect(), FALSE ); + d->ed->repaint( d->ed->rect(), false ); } @@ -1183,29 +1181,29 @@ void ExtDateEdit::stepUp() void ExtDateEdit::stepDown() { int sec = d->ed->focusSection(); - bool accepted = FALSE; + bool accepted = false; if ( sec == d->yearSection ) { if ( !outOfRange( d->y-1, d->m, d->d ) ) { - accepted = TRUE; + accepted = true; setYear( d->y-1 ); } } else if ( sec == d->monthSection ) { if ( !outOfRange( d->y, d->m-1, d->d ) ) { - accepted = TRUE; + accepted = true; setMonth( d->m-1 ); } } else if ( sec == d->daySection ) { if ( !outOfRange( d->y, d->m, d->d-1 ) ) { - accepted = TRUE; + accepted = true; setDay( d->d-1 ); } } if ( accepted ) { - d->changed = TRUE; + d->changed = true; emit valueChanged( date() ); } - d->ed->repaint( d->ed->rect(), FALSE ); + d->ed->repaint( d->ed->rect(), false ); } /*! @@ -1291,8 +1289,8 @@ void ExtDateEdit::setDate( const ExtDate& date ) d->dayCache = d->d; emit valueChanged( date ); } - d->changed = FALSE; - d->ed->repaint( d->ed->rect(), FALSE ); + d->changed = false; + d->ed->repaint( d->ed->rect(), false ); } ExtDate ExtDateEdit::date() const @@ -1304,8 +1302,8 @@ ExtDate ExtDateEdit::date() const /*! \internal - Returns TRUE if \a y, \a m, \a d is out of range, otherwise returns - FALSE. + Returns true if \a y, \a m, \a d is out of range, otherwise returns + false. \sa setRange() @@ -1317,11 +1315,11 @@ bool ExtDateEdit::outOfRange( int y, int m, int d ) const ExtDate currentDate( y, m, d ); if ( currentDate > maxValue() || currentDate < minValue() ) { //## outOfRange should set overwrite? - return TRUE; + return true; } - return FALSE; + return false; } - return FALSE; /* assume ok */ + return false; /* assume ok */ } /*! \reimp @@ -1333,25 +1331,25 @@ void ExtDateEdit::addNumber( int sec, int num ) if ( sec == -1 ) return; killTimer( d->timerId ); - bool overwrite = FALSE; - bool accepted = FALSE; - d->typing = TRUE; + bool overwrite = false; + bool accepted = false; + d->typing = true; TQString txt; if ( sec == d->yearSection ) { if ( d->overwrite ) { d->y = num; - d->overwrite = FALSE; - accepted = TRUE; + d->overwrite = false; + accepted = true; } else { txt = TQString::number( 10*d->y + num ); if ( txt.length() > 5 ) txt = txt.mid(1); d->y = txt.toInt(); - accepted = TRUE; + accepted = true; } /* txt = TQString::number( d->y ); if ( d->overwrite || txt.length() == 4 ) { - accepted = TRUE; + accepted = true; d->y = num; } else { txt += TQString::number( num ); @@ -1364,23 +1362,23 @@ void ExtDateEdit::addNumber( int sec, int num ) else if ( outOfRange( val, d->m, d->d ) ) txt = TQString::number( d->y ); else { - accepted = TRUE; + accepted = true; d->y = val; } } else { - accepted = TRUE; + accepted = true; d->y = txt.toInt(); } if ( d->adv && txt.length() == 4 ) { d->ed->setFocusSection( d->ed->focusSection()+1 ); - overwrite = TRUE; + overwrite = true; } } */ } else if ( sec == d->monthSection ) { txt = TQString::number( d->m ); if ( d->overwrite || txt.length() == 2 ) { - accepted = TRUE; + accepted = true; d->m = num; } else { txt += TQString::number( num ); @@ -1390,18 +1388,18 @@ void ExtDateEdit::addNumber( int sec, int num ) if ( outOfRange( d->y, temp, d->d ) ) txt = TQString::number( d->m ); else { - accepted = TRUE; + accepted = true; d->m = temp; } if ( d->adv && txt.length() == 2 ) { d->ed->setFocusSection( d->ed->focusSection()+1 ); - overwrite = TRUE; + overwrite = true; } } } else if ( sec == d->daySection ) { txt = TQString::number( d->d ); if ( d->overwrite || txt.length() == 2 ) { - accepted = TRUE; + accepted = true; d->d = num; d->dayCache = d->d; } else { @@ -1412,23 +1410,23 @@ void ExtDateEdit::addNumber( int sec, int num ) if ( outOfRange( d->y, d->m, temp ) ) txt = TQString::number( d->d ); else { - accepted = TRUE; + accepted = true; d->d = temp; d->dayCache = d->d; } if ( d->adv && txt.length() == 2 ) { d->ed->setFocusSection( d->ed->focusSection()+1 ); - overwrite = TRUE; + overwrite = true; } } } if ( accepted ) { - d->changed = TRUE; + d->changed = true; emit valueChanged( date() ); } d->overwrite = overwrite; d->timerId = startTimer( tqApp->doubleClickInterval()*4 ); - d->ed->repaint( d->ed->rect(), FALSE ); + d->ed->repaint( d->ed->rect(), false ); } @@ -1440,8 +1438,8 @@ bool ExtDateEdit::setFocusSection( int s ) { if ( s != d->ed->focusSection() ) { killTimer( d->timerId ); - d->overwrite = TRUE; - d->typing = FALSE; + d->overwrite = true; + d->typing = false; fix(); // will emit valueChanged if necessary } return d->ed->setFocusSection( s ); @@ -1466,13 +1464,13 @@ bool ExtDateEdit::setFocusSection( int s ) void ExtDateEdit::fix() { - bool changed = FALSE; + bool changed = false; ExtDate test = ExtDate( d->y, d->m, 1 ); if ( d->d > test.daysInMonth() ) { d->d = test.daysInMonth(); - changed = TRUE; + changed = true; } int currentYear = ExtDate::currentDate().year(); @@ -1488,11 +1486,11 @@ void ExtDateEdit::fix() if ( year >= currentYear + 30 ) year -= 100; } - changed = TRUE; + changed = true; } else if ( year < 1000 ) { int currentMillennium = currentYear / 10; year += currentMillennium * 10; - changed = TRUE; + changed = true; } */ if ( changed && outOfRange( year, d->m, d->d ) ) { @@ -1513,7 +1511,7 @@ void ExtDateEdit::fix() if ( changed ) { // emit valueChanged( date() ); -// d->changed = FALSE; +// d->changed = false; } } @@ -1525,8 +1523,8 @@ void ExtDateEdit::fix() bool ExtDateEdit::event( TQEvent *e ) { if( e->type() == TQEvent::FocusOut ) { - d->typing = FALSE; - d->overwrite = TRUE; + d->typing = false; + d->overwrite = true; // the following can't be done in fix() because fix() called // from all over the place and it will break the old behaviour if ( !ExtDate::isValid( d->y, d->m, d->d ) ) { @@ -1537,12 +1535,12 @@ bool ExtDateEdit::event( TQEvent *e ) if ( ExtDate::isValid( d->y, d->m, d->d ) ) break; } - d->changed = TRUE; + d->changed = true; } if ( d->changed ) { fix(); emit valueChanged( date() ); - d->changed = FALSE; + d->changed = false; } } else if ( e->type() == TQEvent::LocaleChange ) { readLocaleSettings(); @@ -1581,7 +1579,7 @@ void ExtDateEdit::removeFirstNumber( int sec ) d->d = txt.toInt(); d->dayCache = d->d; } - d->ed->repaint( d->ed->rect(), FALSE ); + d->ed->repaint( d->ed->rect(), false ); } /*! \reimp @@ -1607,7 +1605,7 @@ void ExtDateEdit::removeLastNumber( int sec ) d->d = txt.toInt(); d->dayCache = d->d; } - d->ed->repaint( d->ed->rect(), FALSE ); + d->ed->repaint( d->ed->rect(), false ); } /*! @@ -1615,9 +1613,9 @@ void ExtDateEdit::removeLastNumber( int sec ) \brief whether the editor automatically advances to the next section - If autoAdvance is TRUE, the editor will automatically advance + If autoAdvance is true, the editor will automatically advance focus to the next date section if a user has completed a section. - The default is FALSE. + The default is false. */ void ExtDateEdit::setAutoAdvance( bool advance ) @@ -1636,7 +1634,7 @@ bool ExtDateEdit::autoAdvance() const void ExtDateEdit::timerEvent( TQTimerEvent * ) { - d->overwrite = TRUE; + d->overwrite = true; } /*! @@ -1740,12 +1738,12 @@ public: // d->controls = new ExtDateTimeSpinWidget( this, qstrcmp( name(), "qt_datetime_timeedit" ) == 0 ? "qt_spin_widget" : "time edit controls" ); // d->controls->setEditWidget( d->ed ); // setFocusProxy( d->ed ); -// connect( d->controls, TQT_SIGNAL( stepUpPressed() ), TQT_SLOT( stepUp() ) ); -// connect( d->controls, TQT_SIGNAL( stepDownPressed() ), TQT_SLOT( stepDown() ) ); +// connect( d->controls, TQ_SIGNAL( stepUpPressed() ), TQ_SLOT( stepUp() ) ); +// connect( d->controls, TQ_SIGNAL( stepDownPressed() ), TQ_SLOT( stepDown() ) ); // -// d->ed->appendSection( TQNumberSection( 0,0, TRUE, 0 ) ); -// d->ed->appendSection( TQNumberSection( 0,0, TRUE, 1 ) ); -// d->ed->appendSection( TQNumberSection( 0,0, TRUE, 2 ) ); +// d->ed->appendSection( TQNumberSection( 0,0, true, 0 ) ); +// d->ed->appendSection( TQNumberSection( 0,0, true, 1 ) ); +// d->ed->appendSection( TQNumberSection( 0,0, true, 2 ) ); // d->ed->setSeparator( localTimeSep() ); // // d->h = 0; @@ -1754,15 +1752,15 @@ public: // d->display = Hours | Minutes | Seconds; // if ( lAMPM ) { // d->display |= AMPM; -// d->ed->appendSection( TQNumberSection( 0,0, FALSE, 3 ) ); +// d->ed->appendSection( TQNumberSection( 0,0, false, 3 ) ); // } -// d->adv = FALSE; -// d->overwrite = TRUE; +// d->adv = false; +// d->overwrite = true; // d->timerId = 0; -// d->typing = FALSE; +// d->typing = false; // d->min = TQTime( 0, 0, 0 ); // d->max = TQTime( 23, 59, 59 ); -// d->changed = FALSE; +// d->changed = false; // // setSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::Fixed ); // @@ -1842,13 +1840,13 @@ public: // d->ed->clearSections(); // d->display = display; // if ( d->display & Hours ) -// d->ed->appendSection( TQNumberSection( 0,0, TRUE, 0 ) ); +// d->ed->appendSection( TQNumberSection( 0,0, true, 0 ) ); // if ( d->display & Minutes ) -// d->ed->appendSection( TQNumberSection( 0,0, TRUE, 1 ) ); +// d->ed->appendSection( TQNumberSection( 0,0, true, 1 ) ); // if ( d->display & Seconds ) -// d->ed->appendSection( TQNumberSection( 0,0, TRUE, 2 ) ); +// d->ed->appendSection( TQNumberSection( 0,0, true, 2 ) ); // if ( d->display & AMPM ) -// d->ed->appendSection( TQNumberSection( 0,0, FALSE, 3 ) ); +// d->ed->appendSection( TQNumberSection( 0,0, false, 3 ) ); // // d->ed->setFocusSection( 0 ); // d->ed->update(); @@ -1881,8 +1879,8 @@ public: // d->s = time.second(); // emit valueChanged( time ); // } -// d->changed = FALSE; -// d->ed->repaint( d->ed->rect(), FALSE ); +// d->changed = false; +// d->ed->repaint( d->ed->rect(), false ); // } // // TQTime TQTimeEdit::time() const @@ -1897,9 +1895,9 @@ public: // \brief whether the editor automatically advances to the next // section // -// If autoAdvance is TRUE, the editor will automatically advance +// If autoAdvance is true, the editor will automatically advance // focus to the next time section if a user has completed a section. -// The default is FALSE. +// The default is false. // */ // // void TQTimeEdit::setAutoAdvance( bool advance ) @@ -1946,10 +1944,10 @@ public: // bool TQTimeEdit::event( TQEvent *e ) // { // if ( e->type() == TQEvent::FocusOut ) { -// d->typing = FALSE; +// d->typing = false; // if ( d->changed ) { // emit valueChanged( time() ); -// d->changed = FALSE; +// d->changed = false; // } // } else if ( e->type() == TQEvent::LocaleChange ) { // readLocaleSettings(); @@ -1964,7 +1962,7 @@ public: // // void TQTimeEdit::timerEvent( TQTimerEvent * ) // { -// d->overwrite = TRUE; +// d->overwrite = true; // } // // @@ -1975,7 +1973,7 @@ public: // void TQTimeEdit::stepUp() // { // int sec = d->ed->mapSection( d->ed->focusSection() ); -// bool accepted = TRUE; +// bool accepted = true; // switch( sec ) { // case 0: // if ( !outOfRange( d->h+1, d->m, d->s ) ) @@ -2002,17 +2000,17 @@ public: // setHour( d->h-12 ); // break; // default: -// accepted = FALSE; +// accepted = false; // #ifdef TQT_CHECK_RANGE // tqWarning( "TQTimeEdit::stepUp: Focus section out of range!" ); // #endif // break; // } // if ( accepted ) { -// d->changed = TRUE; +// d->changed = true; // emit valueChanged( time() ); // } -// d->ed->repaint( d->ed->rect(), FALSE ); +// d->ed->repaint( d->ed->rect(), false ); // } // // @@ -2024,7 +2022,7 @@ public: // { // int sec = d->ed->mapSection( d->ed->focusSection() ); // -// bool accepted = TRUE; +// bool accepted = true; // switch( sec ) { // case 0: // if ( !outOfRange( d->h-1, d->m, d->s ) ) @@ -2051,17 +2049,17 @@ public: // setHour( d->h+12 ); // break; // default: -// accepted = FALSE; +// accepted = false; // #ifdef TQT_CHECK_RANGE // tqWarning( "TQTimeEdit::stepDown: Focus section out of range!" ); // #endif // break; // } // if ( accepted ) { -// d->changed = TRUE; +// d->changed = true; // emit valueChanged( time() ); // } -// d->ed->repaint( d->ed->rect(), FALSE ); +// d->ed->repaint( d->ed->rect(), false ); // } // // @@ -2094,15 +2092,15 @@ public: // { // if ( sec != d->ed->focusSection() ) { // killTimer( d->timerId ); -// d->overwrite = TRUE; -// d->typing = FALSE; +// d->overwrite = true; +// d->typing = false; // TQString txt = sectionText( sec ); // txt = txt.rightJustify( 2, EXTDATETIMEEDIT_HIDDEN_CHAR ); // int offset = sec*2+sec*separator().length() + txt.length(); // d->ed->setSectionSelection( sec, offset - txt.length(), offset ); // if ( d->changed ) { // emit valueChanged( time() ); -// d->changed = FALSE; +// d->changed = false; // } // } // return d->ed->setFocusSection( sec ); @@ -2203,7 +2201,7 @@ public: // // // /*! \internal -// Returns TRUE if \a h, \a m, and \a s are out of range. +// Returns true if \a h, \a m, and \a s are out of range. // */ // // bool TQTimeEdit::outOfRange( int h, int m, int s ) const @@ -2212,11 +2210,11 @@ public: // TQTime currentTime( h, m, s ); // if ( currentTime > maxValue() || // currentTime < minValue() ) -// return TRUE; +// return true; // else -// return FALSE; +// return false; // } -// return TRUE; +// return true; // } // // /*! \reimp @@ -2229,9 +2227,9 @@ public: // return; // sec = d->ed->mapSection( sec ); // killTimer( d->timerId ); -// bool overwrite = FALSE; -// bool accepted = FALSE; -// d->typing = TRUE; +// bool overwrite = false; +// bool accepted = false; +// d->typing = true; // TQString txt; // // switch( sec ) { @@ -2245,7 +2243,7 @@ public: // if ( d->display & AMPM && d->h > 11 ) // num += 12; // if ( !outOfRange( num, d->m, d->s ) ) { -// accepted = TRUE; +// accepted = true; // d->h = num; // } // } else { @@ -2257,19 +2255,19 @@ public: // if ( d->h < 12 ) { // temp = 0; // } -// accepted = TRUE; +// accepted = true; // } else if ( outOfRange( temp + 12, d->m, d->s ) ) { // txt = TQString::number( d->h ); // } else { // if ( d->h > 11 ) { // temp += 12; // } -// accepted = TRUE; +// accepted = true; // } // } else if ( !(d->display & AMPM) && outOfRange( temp, d->m, d->s ) ) { // txt = TQString::number( d->h ); // } else { -// accepted = TRUE; +// accepted = true; // } // // if ( accepted ) @@ -2277,7 +2275,7 @@ public: // // if ( d->adv && txt.length() == 2 ) { // setFocusSection( d->ed->focusSection()+1 ); -// overwrite = TRUE; +// overwrite = true; // } // } // break; @@ -2286,7 +2284,7 @@ public: // txt = TQString::number( d->m ); // if ( d->overwrite || txt.length() == 2 ) { // if ( !outOfRange( d->h, num, d->s ) ) { -// accepted = TRUE; +// accepted = true; // d->m = num; // } // } else { @@ -2297,12 +2295,12 @@ public: // if ( outOfRange( d->h, temp, d->s ) ) // txt = TQString::number( d->m ); // else { -// accepted = TRUE; +// accepted = true; // d->m = temp; // } // if ( d->adv && txt.length() == 2 ) { // setFocusSection( d->ed->focusSection()+1 ); -// overwrite = TRUE; +// overwrite = true; // } // } // break; @@ -2311,7 +2309,7 @@ public: // txt = TQString::number( d->s ); // if ( d->overwrite || txt.length() == 2 ) { // if ( !outOfRange( d->h, d->m, num ) ) { -// accepted = TRUE; +// accepted = true; // d->s = num; // } // } else { @@ -2322,12 +2320,12 @@ public: // if ( outOfRange( d->h, d->m, temp ) ) // txt = TQString::number( d->s ); // else { -// accepted = TRUE; +// accepted = true; // d->s = temp; // } // if ( d->adv && txt.length() == 2 ) { // setFocusSection( d->ed->focusSection()+1 ); -// overwrite = TRUE; +// overwrite = true; // } // } // break; @@ -2343,7 +2341,7 @@ public: // emit valueChanged( time() ); // d->overwrite = overwrite; // d->timerId = startTimer( tqApp->doubleClickInterval()*4 ); -// d->ed->repaint( d->ed->rect(), FALSE ); +// d->ed->repaint( d->ed->rect(), false ); // } // // @@ -2383,7 +2381,7 @@ public: // d->s = txt.toInt(); // break; // } -// d->ed->repaint( d->ed->rect(), FALSE ); +// d->ed->repaint( d->ed->rect(), false ); // } // // /*! \reimp @@ -2418,7 +2416,7 @@ public: // d->s = txt.toInt(); // break; // } -// d->ed->repaint( d->ed->rect(), FALSE ); +// d->ed->repaint( d->ed->rect(), false ); // } // // /*! \reimp @@ -2609,11 +2607,11 @@ void ExtDateTimeEdit::init() d = new ExtDateTimeEditPrivate(); de = new ExtDateEdit( this, "qt_datetime_dateedit" ); te = new TQTimeEdit( this, "qt_datetime_timeedit" ); - d->adv = FALSE; - connect( de, TQT_SIGNAL( valueChanged( const ExtDate& ) ), - this, TQT_SLOT( newValue( const ExtDate& ) ) ); - connect( te, TQT_SIGNAL( valueChanged( const TQTime& ) ), - this, TQT_SLOT( newValue( const TQTime& ) ) ); + d->adv = false; + connect( de, TQ_SIGNAL( valueChanged( const ExtDate& ) ), + this, TQ_SLOT( newValue( const ExtDate& ) ) ); + connect( te, TQ_SIGNAL( valueChanged( const TQTime& ) ), + this, TQ_SLOT( newValue( const TQTime& ) ) ); setFocusProxy( de ); setSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::Fixed ); } @@ -2684,7 +2682,7 @@ void ExtDateTimeEdit::newValue( const TQTime& ) /*! Sets the auto advance property of the editor to \a advance. If set - to TRUE, the editor will automatically advance focus to the next + to true, the editor will automatically advance focus to the next date or time section if the user has completed a section. */ @@ -2695,7 +2693,7 @@ void ExtDateTimeEdit::setAutoAdvance( bool advance ) } /*! - Returns TRUE if auto-advance is enabled, otherwise returns FALSE. + Returns true if auto-advance is enabled, otherwise returns false. \sa setAutoAdvance() */ |