diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:56:07 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:56:07 +0000 |
commit | d6f8bbb45b267065a6907e71ff9c98bb6d161241 (patch) | |
tree | d109539636691d7b03036ca1c0ed29dbae6577cf /languages/sql/sqloutputwidget.cpp | |
parent | 3331a47a9cad24795c7440ee8107143ce444ef34 (diff) | |
download | tdevelop-d6f8bbb45b267065a6907e71ff9c98bb6d161241.tar.gz tdevelop-d6f8bbb45b267065a6907e71ff9c98bb6d161241.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1157658 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'languages/sql/sqloutputwidget.cpp')
-rw-r--r-- | languages/sql/sqloutputwidget.cpp | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/languages/sql/sqloutputwidget.cpp b/languages/sql/sqloutputwidget.cpp index a0d7368d..f7d84fde 100644 --- a/languages/sql/sqloutputwidget.cpp +++ b/languages/sql/sqloutputwidget.cpp @@ -9,16 +9,16 @@ * * ***************************************************************************/ -#include <qsqldatabase.h> -#include <qsqlerror.h> -#include <qsqlcursor.h> -#include <qsqldriver.h> -#include <qsqlrecord.h> -#include <qwidgetstack.h> -#include <qdatatable.h> -#include <qtextedit.h> -#include <qlayout.h> -#include <qstylesheet.h> +#include <tqsqldatabase.h> +#include <tqsqlerror.h> +#include <tqsqlcursor.h> +#include <tqsqldriver.h> +#include <tqsqlrecord.h> +#include <tqwidgetstack.h> +#include <tqdatatable.h> +#include <tqtextedit.h> +#include <tqlayout.h> +#include <tqstylesheet.h> #include <klocale.h> @@ -27,56 +27,56 @@ class QCustomSqlCursor: public QSqlCursor { public: - QCustomSqlCursor( const QString & query = QString::null, bool autopopulate = TRUE, QSqlDatabase* db = 0 ) : - QSqlCursor( QString::null, autopopulate, db ) + QCustomSqlCursor( const TQString & query = TQString::null, bool autopopulate = TRUE, TQSqlDatabase* db = 0 ) : + TQSqlCursor( TQString::null, autopopulate, db ) { exec( query ); if ( isSelect() && autopopulate ) { - QSqlRecordInfo inf = ((QSqlQuery*)this)->driver()->recordInfo( *(QSqlQuery*)this ); - for ( QSqlRecordInfo::iterator it = inf.begin(); it != inf.end(); ++it ) { + TQSqlRecordInfo inf = ((TQSqlQuery*)this)->driver()->recordInfo( *(TQSqlQuery*)this ); + for ( TQSqlRecordInfo::iterator it = inf.begin(); it != inf.end(); ++it ) { append( *it ); } } - setMode( QSqlCursor::ReadOnly ); + setMode( TQSqlCursor::ReadOnly ); } - QCustomSqlCursor( const QCustomSqlCursor & other ): QSqlCursor( other ) {} - bool select( const QString & /*filter*/, const QSqlIndex & /*sort*/ = QSqlIndex() ) + QCustomSqlCursor( const QCustomSqlCursor & other ): TQSqlCursor( other ) {} + bool select( const TQString & /*filter*/, const TQSqlIndex & /*sort*/ = TQSqlIndex() ) { return exec( lastQuery() ); } - QSqlIndex primaryIndex( bool /*prime*/ = TRUE ) const - { return QSqlIndex(); } + TQSqlIndex primaryIndex( bool /*prime*/ = TRUE ) const + { return TQSqlIndex(); } int insert( bool /*invalidate*/ = TRUE ) { return FALSE; } int update( bool /*invalidate*/ = TRUE ) { return FALSE; } int del( bool /*invalidate*/ = TRUE ) { return FALSE; } - void setName( const QString& /*name*/, bool /*autopopulate*/ = TRUE ) {} + void setName( const TQString& /*name*/, bool /*autopopulate*/ = TRUE ) {} }; -SqlOutputWidget::SqlOutputWidget ( QWidget* parent, const char* name ) : - QWidget( parent, name ) +SqlOutputWidget::SqlOutputWidget ( TQWidget* parent, const char* name ) : + TQWidget( parent, name ) { - m_stack = new QWidgetStack( this ); - m_table = new QDataTable( this ); - m_textEdit = new QTextEdit( this ); + m_stack = new TQWidgetStack( this ); + m_table = new TQDataTable( this ); + m_textEdit = new TQTextEdit( this ); - m_textEdit->setTextFormat( QTextEdit::RichText ); + m_textEdit->setTextFormat( TQTextEdit::RichText ); m_textEdit->setReadOnly( true ); m_stack->addWidget( m_textEdit ); m_stack->addWidget( m_table ); - QVBoxLayout* layout = new QVBoxLayout( this ); + TQVBoxLayout* layout = new TQVBoxLayout( this ); layout->addWidget( m_stack ); } SqlOutputWidget::~SqlOutputWidget() {} -void SqlOutputWidget::showQuery( const QString& connectionName, const QString& query ) +void SqlOutputWidget::showQuery( const TQString& connectionName, const TQString& query ) { - QSqlDatabase* db = QSqlDatabase::database( connectionName, true ); + TQSqlDatabase* db = TQSqlDatabase::database( connectionName, true ); if ( !db ) { showError( i18n("No such connection: %1").arg( connectionName ) ); return; @@ -86,12 +86,12 @@ void SqlOutputWidget::showQuery( const QString& connectionName, const QString& q return; } - QSqlCursor* cur = new QCustomSqlCursor( query, true, db ); + TQSqlCursor* cur = new QCustomSqlCursor( query, true, db ); if ( !cur->isActive() ) { showError( cur->lastError() ); } else if ( cur->isSelect() ) { m_table->setSqlCursor( cur, true, true ); - m_table->refresh( QDataTable::RefreshAll ); + m_table->refresh( TQDataTable::RefreshAll ); m_stack->raiseWidget( m_table ); } else { showSuccess( cur->numRowsAffected() ); @@ -105,21 +105,21 @@ void SqlOutputWidget::showSuccess( int rowsAffected ) m_stack->raiseWidget( m_textEdit ); } -void SqlOutputWidget::showError( const QString& message ) +void SqlOutputWidget::showError( const TQString& message ) { m_textEdit->clear(); m_textEdit->setText( "<p><b>" + i18n("An error occurred:") + "</b></p>\n" + message ); m_stack->raiseWidget( m_textEdit ); } -void SqlOutputWidget::showError( const QSqlError& message ) +void SqlOutputWidget::showError( const TQSqlError& message ) { m_textEdit->clear(); m_textEdit->setText( "<p><b>" + i18n("An error occurred:") + "</b></p>\n<p><i>" + i18n("Driver") + "</i>: " + - QStyleSheet::escape( message.driverText() ) + + TQStyleSheet::escape( message.driverText() ) + "<br><i>" + i18n("Database") + ":</i>: " + - QStyleSheet::escape( message.databaseText() ) ); + TQStyleSheet::escape( message.databaseText() ) ); m_stack->raiseWidget( m_textEdit ); } |