diff options
Diffstat (limited to 'src/sql/tqdatabrowser.cpp')
| -rw-r--r-- | src/sql/tqdatabrowser.cpp | 144 |
1 files changed, 72 insertions, 72 deletions
diff --git a/src/sql/tqdatabrowser.cpp b/src/sql/tqdatabrowser.cpp index a716d8832..b1921204e 100644 --- a/src/sql/tqdatabrowser.cpp +++ b/src/sql/tqdatabrowser.cpp @@ -49,7 +49,7 @@ class TQDataBrowserPrivate { public: - TQDataBrowserPrivate() : boundaryCheck( TRUE ), readOnly( FALSE ) {} + TQDataBrowserPrivate() : boundaryCheck( true ), readOnly( false ) {} TQSqlCursorManager cur; TQSqlFormManager frm; TQDataManager dat; @@ -310,7 +310,7 @@ TQString TQDataBrowser::filter() const /*! Sets the default cursor used by the data browser to \a cursor. If - \a autoDelete is TRUE (the default is FALSE), the data browser + \a autoDelete is true (the default is false), the data browser takes ownership of the \a cursor pointer, which will be deleted when the browser is destroyed, or when setSqlCursor() is called again. To activate the \a cursor use refresh(). The cursor's edit @@ -326,7 +326,7 @@ void TQDataBrowser::setSqlCursor( TQSqlCursor* cursor, bool autoDelete ) d->cur.setCursor( cursor, autoDelete ); d->frm.setRecord( cursor->editBuffer() ); if ( cursor->isReadOnly() ) - setReadOnly( TRUE ); + setReadOnly( true ); } @@ -369,7 +369,7 @@ TQSqlForm* TQDataBrowser::form() \property TQDataBrowser::readOnly \brief whether the browser is read-only - The default is FALSE, i.e. data can be edited. If the data browser + The default is false, i.e. data can be edited. If the data browser is read-only, no database edits will be allowed. */ @@ -392,7 +392,7 @@ void TQDataBrowser::setConfirmEdits( bool confirm ) \property TQDataBrowser::confirmInsert \brief whether the data browser confirms insertions - If this property is TRUE, the browser confirms insertions, + If this property is true, the browser confirms insertions, otherwise insertions happen immediately. \sa confirmCancels() confirmEdits() confirmUpdate() confirmDelete() confirmEdit() @@ -407,7 +407,7 @@ void TQDataBrowser::setConfirmInsert( bool confirm ) \property TQDataBrowser::confirmUpdate \brief whether the browser confirms updates - If this property is TRUE, the browser confirms updates, otherwise + If this property is true, the browser confirms updates, otherwise updates happen immediately. \sa confirmCancels() confirmEdits() confirmInsert() confirmDelete() confirmEdit() @@ -422,7 +422,7 @@ void TQDataBrowser::setConfirmUpdate( bool confirm ) \property TQDataBrowser::confirmDelete \brief whether the browser confirms deletions - If this property is TRUE, the browser confirms deletions, + If this property is true, the browser confirms deletions, otherwise deletions happen immediately. \sa confirmCancels() confirmEdits() confirmUpdate() confirmInsert() confirmEdit() @@ -437,7 +437,7 @@ void TQDataBrowser::setConfirmDelete( bool confirm ) \property TQDataBrowser::confirmEdits \brief whether the browser confirms edits - If this property is TRUE, the browser confirms all edit operations + If this property is true, the browser confirms all edit operations (insertions, updates and deletions), otherwise all edit operations happen immediately. Confirmation is achieved by presenting the user with a message box -- this behavior can be changed by @@ -470,10 +470,10 @@ bool TQDataBrowser::confirmDelete() const \property TQDataBrowser::confirmCancels \brief whether the browser confirms cancel operations - If this property is TRUE, all cancels must be confirmed by the + If this property is true, all cancels must be confirmed by the user through a message box (this behavior can be changed by overriding the confirmCancel() function), otherwise all cancels - occur immediately. The default is FALSE. + occur immediately. The default is false. \sa confirmEdits() confirmCancel() */ @@ -492,13 +492,13 @@ bool TQDataBrowser::confirmCancels() const \property TQDataBrowser::autoEdit \brief whether the browser automatically applies edits - The default value for this property is TRUE. When the user begins + The default value for this property is true. When the user begins an insertion or an update on a form there are two possible outcomes when they navigate to another record: \list - \i the insert or update is is performed -- this occurs if autoEdit is TRUE - \i the insert or update is discarded -- this occurs if autoEdit is FALSE + \i the insert or update is is performed -- this occurs if autoEdit is true + \i the insert or update is discarded -- this occurs if autoEdit is false \endlist */ @@ -657,7 +657,7 @@ void TQDataBrowser::insert() TQSqlCursor* cur = d->cur.cursor(); if ( !buf || !cur ) return; - bool doIns = TRUE; + bool doIns = true; TQSql::Confirm conf = TQSql::Yes; switch ( d->dat.mode() ) { case TQSql::Insert: @@ -671,7 +671,7 @@ void TQDataBrowser::insert() case TQSql::No: break; case TQSql::Cancel: - doIns = FALSE; + doIns = false; break; } } @@ -687,7 +687,7 @@ void TQDataBrowser::insert() case TQSql::No: break; case TQSql::Cancel: - doIns = FALSE; + doIns = false; break; } } @@ -733,7 +733,7 @@ void TQDataBrowser::update() break; case TQSql::No: d->dat.setMode( TQSql::Update ); - cur->editBuffer( TRUE ); + cur->editBuffer( true ); readFields(); break; case TQSql::Cancel: @@ -782,7 +782,7 @@ void TQDataBrowser::del() if ( confirmCancels() ) conf = confirmCancel( TQSql::Insert ); if ( conf == TQSql::Yes ) { - cur->editBuffer( TRUE ); /* restore from cursor */ + cur->editBuffer( true ); /* restore from cursor */ readFields(); d->dat.setMode( TQSql::Update ); } else @@ -809,7 +809,7 @@ void TQDataBrowser::del() Moves the default cursor to the record specified by the index \a i and refreshes the default form to display this record. If there is no default form or no default cursor, nothing happens. If \a - relative is TRUE (the default is FALSE), the cursor is moved + relative is true (the default is false), the cursor is moved relative to its current position. If the data browser successfully navigated to the desired record, the default cursor is primed for update and the primeUpdate() signal is emitted. @@ -823,7 +823,7 @@ bool TQDataBrowser::seek( int i, bool relative ) int b = 0; TQSqlCursor* cur = d->cur.cursor(); if ( !cur ) - return FALSE; + return false; if ( preNav() ) b = cur->seek( i, relative ); postNav( b ); @@ -940,9 +940,9 @@ void TQDataBrowser::clearValues() performs an insert on the default cursor. If there is no default form or no default cursor, nothing happens. If an error occurred during the insert into the database, handleError() is called and - FALSE is returned. If the insert was successfull, the cursor is + false is returned. If the insert was successfull, the cursor is refreshed and relocated to the newly inserted record, the - cursorChanged() signal is emitted, and TRUE is returned. + cursorChanged() signal is emitted, and true is returned. \sa cursorChanged() sqlCursor() form() handleError() */ @@ -950,11 +950,11 @@ void TQDataBrowser::clearValues() bool TQDataBrowser::insertCurrent() { if ( isReadOnly() ) - return FALSE; + return false; TQSqlRecord* buf = d->frm.record(); TQSqlCursor* cur = d->cur.cursor(); if ( !buf || !cur ) - return FALSE; + return false; writeFields(); emit beforeInsert( buf ); int ar = cur->insert(); @@ -967,9 +967,9 @@ bool TQDataBrowser::insertCurrent() d->cur.findBuffer( cur->primaryIndex() ); updateBoundary(); cursorChanged( TQSqlCursor::Insert ); - return TRUE; + return true; } - return FALSE; + return false; } @@ -978,9 +978,9 @@ bool TQDataBrowser::insertCurrent() performs an update on the default cursor. If there is no default form or no default cursor, nothing happens. If an error occurred during the update on the database, handleError() is called and - FALSE is returned. If the update was successfull, the cursor is + false is returned. If the update was successfull, the cursor is refreshed and relocated to the updated record, the cursorChanged() - signal is emitted, and TRUE is returned. + signal is emitted, and true is returned. \sa cursor() form() handleError() */ @@ -988,11 +988,11 @@ bool TQDataBrowser::insertCurrent() bool TQDataBrowser::updateCurrent() { if ( isReadOnly() ) - return FALSE; + return false; TQSqlRecord* buf = d->frm.record(); TQSqlCursor* cur = d->cur.cursor(); if ( !buf || !cur ) - return FALSE; + return false; writeFields(); emit beforeUpdate( buf ); int ar = cur->update(); @@ -1004,12 +1004,12 @@ bool TQDataBrowser::updateCurrent() refresh(); d->cur.findBuffer( cur->primaryIndex() ); updateBoundary(); - cur->editBuffer( TRUE ); + cur->editBuffer( true ); cursorChanged( TQSqlCursor::Update ); readFields(); - return TRUE; + return true; } - return FALSE; + return false; } @@ -1018,10 +1018,10 @@ bool TQDataBrowser::updateCurrent() default form and updates the default form. If there is no default form or no default cursor, nothing happens. If the deletion was successful, the cursor is repositioned to the nearest record and - TRUE is returned. The nearest record is the next record if there + true is returned. The nearest record is the next record if there is one otherwise the previous record if there is one. If an error occurred during the deletion from the database, handleError() is - called and FALSE is returned. + called and false is returned. \sa cursor() form() handleError() */ @@ -1029,11 +1029,11 @@ bool TQDataBrowser::updateCurrent() bool TQDataBrowser::deleteCurrent() { if ( isReadOnly() ) - return FALSE; + return false; TQSqlRecord* buf = d->frm.record(); TQSqlCursor* cur = d->cur.cursor(); if ( !buf || !cur ) - return FALSE; + return false; writeFields(); int n = cur->at(); emit beforeDelete( buf ); @@ -1045,12 +1045,12 @@ bool TQDataBrowser::deleteCurrent() if ( !cur->seek( n ) ) last(); if ( cur->isValid() ) { - cur->editBuffer( TRUE ); + cur->editBuffer( true ); readFields(); } else { clearValues(); } - return TRUE; + return true; } else { if ( !cur->isActive() ) { handleError( cur->lastError() ); @@ -1058,13 +1058,13 @@ bool TQDataBrowser::deleteCurrent() updateBoundary(); } } - return FALSE; + return false; } /*! - Returns TRUE if the form's edit buffer differs from the current - cursor buffer; otherwise returns FALSE. + Returns true if the form's edit buffer differs from the current + cursor buffer; otherwise returns false. */ bool TQDataBrowser::currentEdited() @@ -1072,15 +1072,15 @@ bool TQDataBrowser::currentEdited() TQSqlRecord* buf = d->frm.record(); TQSqlCursor* cur = d->cur.cursor(); if ( !buf || !cur ) - return FALSE; + return false; if ( !cur->isActive() || !cur->isValid() ) - return FALSE; + return false; writeFields(); for ( uint i = 0; i < cur->count(); ++i ) { if ( cur->value(i) != buf->value(i) ) - return TRUE; + return true; } - return FALSE; + return false; } /*! \internal @@ -1093,10 +1093,10 @@ bool TQDataBrowser::preNav() TQSqlRecord* buf = d->frm.record(); TQSqlCursor* cur = d->cur.cursor(); if ( !buf || !cur ) - return FALSE; + return false; if ( !isReadOnly() && autoEdit() && currentEdited() ) { - bool ok = TRUE; + bool ok = true; TQSql::Confirm conf = TQSql::Yes; switch ( d->dat.mode() ){ case TQSql::Insert: @@ -1111,7 +1111,7 @@ bool TQDataBrowser::preNav() d->dat.setMode( TQSql::Update ); break; case TQSql::Cancel: - return FALSE; + return false; } break; default: @@ -1124,12 +1124,12 @@ bool TQDataBrowser::preNav() case TQSql::No: break; case TQSql::Cancel: - return FALSE; + return false; } } return ok; } - return TRUE; + return true; } /*! \internal @@ -1169,7 +1169,7 @@ void TQDataBrowser::nav( Nav nav ) } /*! - If boundaryChecking() is TRUE, checks the boundary of the current + If boundaryChecking() is true, checks the boundary of the current default cursor and emits signals which indicate the position of the cursor. */ @@ -1181,38 +1181,38 @@ void TQDataBrowser::updateBoundary() switch ( bound ) { case Unknown: case None: - emit firstRecordAvailable( TRUE ); - emit prevRecordAvailable( TRUE ); - emit nextRecordAvailable( TRUE ); - emit lastRecordAvailable( TRUE ); + emit firstRecordAvailable( true ); + emit prevRecordAvailable( true ); + emit nextRecordAvailable( true ); + emit lastRecordAvailable( true ); break; case BeforeBeginning: - emit firstRecordAvailable( FALSE ); - emit prevRecordAvailable( FALSE ); - emit nextRecordAvailable( TRUE ); - emit lastRecordAvailable( TRUE ); + emit firstRecordAvailable( false ); + emit prevRecordAvailable( false ); + emit nextRecordAvailable( true ); + emit lastRecordAvailable( true ); break; case Beginning: - emit firstRecordAvailable( FALSE ); - emit prevRecordAvailable( FALSE ); - emit nextRecordAvailable( TRUE ); - emit lastRecordAvailable( TRUE ); + emit firstRecordAvailable( false ); + emit prevRecordAvailable( false ); + emit nextRecordAvailable( true ); + emit lastRecordAvailable( true ); break; case End: - emit firstRecordAvailable( TRUE ); - emit prevRecordAvailable( TRUE ); - emit nextRecordAvailable( FALSE ); - emit lastRecordAvailable( FALSE ); + emit firstRecordAvailable( true ); + emit prevRecordAvailable( true ); + emit nextRecordAvailable( false ); + emit lastRecordAvailable( false ); break; case AfterEnd: - emit firstRecordAvailable( TRUE ); - emit prevRecordAvailable( TRUE ); - emit nextRecordAvailable( FALSE ); - emit lastRecordAvailable( FALSE ); + emit firstRecordAvailable( true ); + emit prevRecordAvailable( true ); + emit nextRecordAvailable( false ); + emit lastRecordAvailable( false ); break; } } |
