diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
commit | f008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch) | |
tree | 8e9244c4d4957c36be81e15b566b4aa5ea26c982 /kexi/kexidb/drivers/sqlite | |
parent | 1210f27b660efb7b37ff43ec68763e85a403471f (diff) | |
download | koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip |
TQt4 port koffice
This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kexi/kexidb/drivers/sqlite')
-rw-r--r-- | kexi/kexidb/drivers/sqlite/sqlite_common.pro | 2 | ||||
-rw-r--r-- | kexi/kexidb/drivers/sqlite/sqliteadmin.cpp | 8 | ||||
-rw-r--r-- | kexi/kexidb/drivers/sqlite/sqliteadmin.h | 2 | ||||
-rw-r--r-- | kexi/kexidb/drivers/sqlite/sqlitealter.cpp | 10 | ||||
-rw-r--r-- | kexi/kexidb/drivers/sqlite/sqliteconnection.cpp | 76 | ||||
-rw-r--r-- | kexi/kexidb/drivers/sqlite/sqliteconnection.h | 31 | ||||
-rw-r--r-- | kexi/kexidb/drivers/sqlite/sqliteconnection_p.h | 4 | ||||
-rw-r--r-- | kexi/kexidb/drivers/sqlite/sqlitecursor.cpp | 116 | ||||
-rw-r--r-- | kexi/kexidb/drivers/sqlite/sqlitecursor.h | 12 | ||||
-rw-r--r-- | kexi/kexidb/drivers/sqlite/sqlitedriver.cpp | 36 | ||||
-rw-r--r-- | kexi/kexidb/drivers/sqlite/sqlitedriver.h | 21 | ||||
-rw-r--r-- | kexi/kexidb/drivers/sqlite/sqlitepreparedstatement.cpp | 14 | ||||
-rw-r--r-- | kexi/kexidb/drivers/sqlite/sqlitevacuum.cpp | 42 | ||||
-rw-r--r-- | kexi/kexidb/drivers/sqlite/sqlitevacuum.h | 15 |
14 files changed, 196 insertions, 193 deletions
diff --git a/kexi/kexidb/drivers/sqlite/sqlite_common.pro b/kexi/kexidb/drivers/sqlite/sqlite_common.pro index 81fb85b3..7770eb9d 100644 --- a/kexi/kexidb/drivers/sqlite/sqlite_common.pro +++ b/kexi/kexidb/drivers/sqlite/sqlite_common.pro @@ -2,7 +2,7 @@ include( ../common.pro ) DEFINES += MAKE_KEXIDB_SQLITE_DRIVER_LIB -system( bash kmoc ) +system( bash ktqmoc ) SOURCES = \ sqliteconnection.cpp \ diff --git a/kexi/kexidb/drivers/sqlite/sqliteadmin.cpp b/kexi/kexidb/drivers/sqlite/sqliteadmin.cpp index 8bd8085a..14d2217a 100644 --- a/kexi/kexidb/drivers/sqlite/sqliteadmin.cpp +++ b/kexi/kexidb/drivers/sqlite/sqliteadmin.cpp @@ -17,7 +17,7 @@ * Boston, MA 02110-1301, USA. */ -#include <qdir.h> +#include <tqdir.h> #include "sqliteadmin.h" #include <kexidb/drivermanager.h> @@ -36,7 +36,7 @@ SQLiteAdminTools::~SQLiteAdminTools() { } -bool SQLiteAdminTools::vacuum(const KexiDB::ConnectionData& data, const QString& databaseName) +bool SQLiteAdminTools::vacuum(const KexiDB::ConnectionData& data, const TQString& databaseName) { clearError(); #ifdef SQLITE2 @@ -46,12 +46,12 @@ bool SQLiteAdminTools::vacuum(const KexiDB::ConnectionData& data, const QString& #else KexiDB::DriverManager manager; KexiDB::Driver *drv = manager.driver(data.driverName); - QString title( i18n("Could not compact database \"%1\".").arg(QDir::convertSeparators(databaseName)) ); + TQString title( i18n("Could not compact database \"%1\".").tqarg(TQDir::convertSeparators(databaseName)) ); if (!drv) { setError(&manager, title); return false; } - SQLiteVacuum vacuum(data.dbPath()+QDir::separator()+databaseName); + SQLiteVacuum vacuum(data.dbPath()+TQDir::separator()+databaseName); tristate result = vacuum.run(); if (!result) { setError(title); diff --git a/kexi/kexidb/drivers/sqlite/sqliteadmin.h b/kexi/kexidb/drivers/sqlite/sqliteadmin.h index d9f8a6b6..2f9db6c9 100644 --- a/kexi/kexidb/drivers/sqlite/sqliteadmin.h +++ b/kexi/kexidb/drivers/sqlite/sqliteadmin.h @@ -30,7 +30,7 @@ class SQLiteAdminTools : public KexiDB::AdminTools virtual ~SQLiteAdminTools(); /*! Performs vacuum (compacting) for connection \a conn. */ - virtual bool vacuum(const KexiDB::ConnectionData& data, const QString& databaseName); + virtual bool vacuum(const KexiDB::ConnectionData& data, const TQString& databaseName); }; #endif diff --git a/kexi/kexidb/drivers/sqlite/sqlitealter.cpp b/kexi/kexidb/drivers/sqlite/sqlitealter.cpp index cc72e48a..c1903efa 100644 --- a/kexi/kexidb/drivers/sqlite/sqlitealter.cpp +++ b/kexi/kexidb/drivers/sqlite/sqlitealter.cpp @@ -24,7 +24,7 @@ #include <kstaticdeleter.h> -#include <qmap.h> +#include <tqmap.h> using namespace KexiDB; @@ -33,15 +33,15 @@ enum SQLiteTypeAffinity { //as defined here: 2.1 Determination Of Column Affinit }; //! helper for affinityForType() -static KStaticDeleter< QMap<int,int> > KexiDB_SQLite_affinityForType_deleter; -QMap<int,int> *KexiDB_SQLite_affinityForType = 0; +static KStaticDeleter< TQMap<int,int> > KexiDB_SQLite_affinityForType_deleter; +TQMap<int,int> *KexiDB_SQLite_affinityForType = 0; //! \return SQLite type affinity for \a type //! See doc/dev/alter_table_type_conversions.ods, page 2 for more info static SQLiteTypeAffinity affinityForType(Field::Type type) { if (!KexiDB_SQLite_affinityForType) { - KexiDB_SQLite_affinityForType_deleter.setObject( KexiDB_SQLite_affinityForType, new QMap<int,int>() ); + KexiDB_SQLite_affinityForType_deleter.setObject( KexiDB_SQLite_affinityForType, new TQMap<int,int>() ); KexiDB_SQLite_affinityForType->insert(Field::Byte, IntAffinity); KexiDB_SQLite_affinityForType->insert(Field::ShortInteger, IntAffinity); KexiDB_SQLite_affinityForType->insert(Field::Integer, IntAffinity); @@ -60,7 +60,7 @@ static SQLiteTypeAffinity affinityForType(Field::Type type) } tristate SQLiteConnection::drv_changeFieldProperty(TableSchema &table, Field& field, - const QString& propertyName, const QVariant& value) + const TQString& propertyName, const TQVariant& value) { /* if (propertyName=="name") { diff --git a/kexi/kexidb/drivers/sqlite/sqliteconnection.cpp b/kexi/kexidb/drivers/sqlite/sqliteconnection.cpp index 6de41c59..27f190b8 100644 --- a/kexi/kexidb/drivers/sqlite/sqliteconnection.cpp +++ b/kexi/kexidb/drivers/sqlite/sqliteconnection.cpp @@ -33,9 +33,9 @@ #include <kexidb/error.h> #include <kexiutils/utils.h> -#include <qfile.h> -#include <qdir.h> -#include <qregexp.h> +#include <tqfile.h> +#include <tqdir.h> +#include <tqregexp.h> #include <kgenericfactory.h> #include <kdebug.h> @@ -103,8 +103,8 @@ SQLiteConnection::~SQLiteConnection() bool SQLiteConnection::drv_connect(KexiDB::ServerVersionInfo& version) { KexiDBDrvDbg << "SQLiteConnection::connect()" << endl; - version.string = QString(SQLITE_VERSION); //defined in sqlite3.h - QRegExp re("(\\d+)\\.(\\d+)\\.(\\d+)"); + version.string = TQString(SQLITE_VERSION); //defined in sqlite3.h + TQRegExp re("(\\d+)\\.(\\d+)\\.(\\d+)"); if (re.exactMatch(version.string)) { version.major = re.cap(1).toUInt(); version.minor = re.cap(2).toUInt(); @@ -119,21 +119,21 @@ bool SQLiteConnection::drv_disconnect() return true; } -bool SQLiteConnection::drv_getDatabasesList( QStringList &list ) +bool SQLiteConnection::drv_getDatabasesList( TQStringList &list ) { //this is one-db-per-file database list.append( data()->fileName() ); //more consistent than dbFileName() ? return true; } -bool SQLiteConnection::drv_containsTable( const QString &tableName ) +bool SQLiteConnection::drv_containsTable( const TQString &tableName ) { bool success; - return resultExists(QString("select name from sqlite_master where type='table' and name LIKE %1") - .arg(driver()->escapeString(tableName)), success) && success; + return resultExists(TQString("select name from sqlite_master where type='table' and name LIKE %1") + .tqarg(driver()->escapeString(tableName)), success) && success; } -bool SQLiteConnection::drv_getTablesList( QStringList &list ) +bool SQLiteConnection::drv_getTablesList( TQStringList &list ) { KexiDB::Cursor *cursor; m_sql = "select lower(name) from sqlite_master where type='table'"; @@ -154,19 +154,19 @@ bool SQLiteConnection::drv_getTablesList( QStringList &list ) return deleteCursor(cursor); } -bool SQLiteConnection::drv_createDatabase( const QString &dbName ) +bool SQLiteConnection::drv_createDatabase( const TQString &dbName ) { // SQLite creates a new db is it does not exist return drv_useDatabase(dbName); #if 0 - d->data = sqlite_open( QFile::encodeName( data()->fileName() ), 0/*mode: unused*/, + d->data = sqlite_open( TQFile::encodeName( data()->fileName() ), 0/*mode: unused*/, &d->errmsg_p ); d->storeResult(); return d->data != 0; #endif } -bool SQLiteConnection::drv_useDatabase( const QString &dbName, bool *cancelled, +bool SQLiteConnection::drv_useDatabase( const TQString &dbName, bool *cancelled, MessageHandler* msgHandler ) { Q_UNUSED(dbName); @@ -174,7 +174,7 @@ bool SQLiteConnection::drv_useDatabase( const QString &dbName, bool *cancelled, #ifdef SQLITE2 Q_UNUSED(cancelled); Q_UNUSED(msgHandler); - d->data = sqlite_open( QFile::encodeName( data()->fileName() ), 0/*mode: unused*/, + d->data = sqlite_open( TQFile::encodeName( data()->fileName() ), 0/*mode: unused*/, &d->errmsg_p ); d->storeResult(); return d->data != 0; @@ -187,8 +187,8 @@ bool SQLiteConnection::drv_useDatabase( const QString &dbName, bool *cancelled, const bool wasReadOnly = Connection::isReadOnly(); d->res = sqlite3_open( - //QFile::encodeName( data()->fileName() ), - data()->fileName().utf8(), /* unicode expected since SQLite 3.1 */ + //TQFile::encodeName( data()->fileName() ), + data()->fileName().utf8(), /* tqunicode expected since SQLite 3.1 */ &d->data, exclusiveFlag, allowReadonly /* If 1 and locking fails, try opening in read-only mode */ @@ -200,7 +200,7 @@ bool SQLiteConnection::drv_useDatabase( const QString &dbName, bool *cancelled, if (KMessageBox::Continue != askQuestion( i18n("Do you want to open file \"%1\" as read-only?") - .arg(QDir::convertSeparators(data()->fileName())) + .tqarg(TQDir::convertSeparators(data()->fileName())) + "\n\n" + i18n("The file is probably already open on this or another computer.") + " " + i18n("Could not gain exclusive access for writing the file."), @@ -258,21 +258,21 @@ bool SQLiteConnection::drv_closeDatabase() #endif } -bool SQLiteConnection::drv_dropDatabase( const QString &dbName ) +bool SQLiteConnection::drv_dropDatabase( const TQString &dbName ) { Q_UNUSED(dbName); // Each database is one single SQLite file. - const QString filename = data()->fileName(); - if (QFile(filename).exists() && !QDir().remove(filename)) { + const TQString filename = data()->fileName(); + if (TQFile(filename).exists() && !TQDir().remove(filename)) { setError(ERR_ACCESS_RIGHTS, i18n("Could not remove file \"%1\".") - .arg(QDir::convertSeparators(filename)) + " " + .tqarg(TQDir::convertSeparators(filename)) + " " + i18n("Check the file's permissions and whether it is already opened and locked by another application.")); return false; } return true; } -//CursorData* SQLiteConnection::drv_createCursor( const QString& statement ) -Cursor* SQLiteConnection::prepareQuery( const QString& statement, uint cursor_options ) +//CursorData* SQLiteConnection::drv_createCursor( const TQString& statement ) +Cursor* SQLiteConnection::prepareQuery( const TQString& statement, uint cursor_options ) { return new SQLiteCursor( this, statement, cursor_options ); } @@ -282,10 +282,10 @@ Cursor* SQLiteConnection::prepareQuery( QuerySchema& query, uint cursor_options return new SQLiteCursor( this, query, cursor_options ); } -bool SQLiteConnection::drv_executeSQL( const QString& statement ) +bool SQLiteConnection::drv_executeSQL( const TQString& statement ) { // KexiDBDrvDbg << "SQLiteConnection::drv_executeSQL(" << statement << ")" <<endl; -// QCString st(statement.length()*2); +// TQCString st(statement.length()*2); // st = escapeString( statement.local8Bit() ); //? #ifdef SQLITE_UTF8 d->temp_st = statement.utf8(); @@ -294,7 +294,7 @@ bool SQLiteConnection::drv_executeSQL( const QString& statement ) #endif #ifdef KEXI_DEBUG_GUI - KexiUtils::addKexiDBDebug(QString("ExecuteSQL (SQLite): ")+statement); + KexiUtils::addKexiDBDebug(TQString("ExecuteSQL (SQLite): ")+statement); #endif d->res = sqlite_exec( @@ -310,9 +310,9 @@ bool SQLiteConnection::drv_executeSQL( const QString& statement ) return d->res==SQLITE_OK; } -Q_ULLONG SQLiteConnection::drv_lastInsertRowID() +TQ_ULLONG SQLiteConnection::drv_lastInsertRowID() { - return (Q_ULLONG)sqlite_last_insert_rowid(d->data); + return (TQ_ULLONG)sqlite_last_insert_rowid(d->data); } int SQLiteConnection::serverResult() @@ -320,13 +320,13 @@ int SQLiteConnection::serverResult() return d->res==0 ? Connection::serverResult() : d->res; } -QString SQLiteConnection::serverResultName() +TQString SQLiteConnection::serverResultName() { - QString r = + TQString r = #ifdef SQLITE2 - QString::fromLatin1( sqlite_error_string(d->res) ); + TQString::tqfromLatin1( sqlite_error_string(d->res) ); #else //SQLITE3 - QString::null; //fromLatin1( d->result_name ); + TQString(); //tqfromLatin1( d->result_name ); #endif return r.isEmpty() ? Connection::serverResultName() : r; } @@ -343,7 +343,7 @@ void SQLiteConnection::drv_clearServerResult() #endif } -QString SQLiteConnection::serverErrorMsg() +TQString SQLiteConnection::serverErrorMsg() { return d->errmsg.isEmpty() ? Connection::serverErrorMsg() : d->errmsg; } @@ -366,14 +366,14 @@ bool SQLiteConnection::isReadOnly() const } #ifdef SQLITE2 -bool SQLiteConnection::drv_alterTableName(TableSchema& tableSchema, const QString& newName, bool replace) +bool SQLiteConnection::drv_alterTableName(TableSchema& tableSchema, const TQString& newName, bool tqreplace) { - const QString oldTableName = tableSchema.name(); + const TQString oldTableName = tableSchema.name(); const bool destTableExists = this->tableSchema( newName ) != 0; //1. drop the table if (destTableExists) { - if (!replace) + if (!tqreplace) return false; if (!drv_dropTable( newName )) return false; @@ -395,8 +395,8 @@ bool SQLiteConnection::drv_alterTableName(TableSchema& tableSchema, const QStrin //TODO indices, etc.??? // 3. copy all rows to the new table - if (!executeSQL(QString::fromLatin1("INSERT INTO %1 SELECT * FROM %2") - .arg(escapeIdentifier(tableSchema.name())).arg(escapeIdentifier(oldTableName)))) + if (!executeSQL(TQString::tqfromLatin1("INSERT INTO %1 SELECT * FROM %2") + .tqarg(escapeIdentifier(tableSchema.name())).tqarg(escapeIdentifier(oldTableName)))) { drv_alterTableName_ERR; return false; diff --git a/kexi/kexidb/drivers/sqlite/sqliteconnection.h b/kexi/kexidb/drivers/sqlite/sqliteconnection.h index ba0d3b5a..922e8447 100644 --- a/kexi/kexidb/drivers/sqlite/sqliteconnection.h +++ b/kexi/kexidb/drivers/sqlite/sqliteconnection.h @@ -20,7 +20,7 @@ #ifndef KEXIDB_CONN_SQLITE_H #define KEXIDB_CONN_SQLITE_H -#include <qstringlist.h> +#include <tqstringlist.h> #include <kexidb/connection.h> @@ -37,11 +37,12 @@ class Driver; class SQLiteConnection : public Connection { Q_OBJECT + TQ_OBJECT public: virtual ~SQLiteConnection(); - virtual Cursor* prepareQuery( const QString& statement, uint cursor_options = 0 ); + virtual Cursor* prepareQuery( const TQString& statement, uint cursor_options = 0 ); virtual Cursor* prepareQuery( QuerySchema& query, uint cursor_options = 0 ); //#ifndef SQLITE2 //TEMP IFDEF! @@ -57,24 +58,24 @@ class SQLiteConnection : public Connection virtual bool drv_connect(KexiDB::ServerVersionInfo& version); virtual bool drv_disconnect(); - virtual bool drv_getDatabasesList( QStringList &list ); + virtual bool drv_getDatabasesList( TQStringList &list ); //TODO: move this somewhere to low level class (MIGRATION?) - virtual bool drv_getTablesList( QStringList &list ); + virtual bool drv_getTablesList( TQStringList &list ); //TODO: move this somewhere to low level class (MIGRATION?) - virtual bool drv_containsTable( const QString &tableName ); + virtual bool drv_containsTable( const TQString &tableName ); /*! Creates new database using connection. Note: Do not pass \a dbName arg because for file-based engine (that has one database per connection) it is defined during connection. */ - virtual bool drv_createDatabase( const QString &dbName = QString::null ); + virtual bool drv_createDatabase( const TQString &dbName = TQString() ); /*! Opens existing database using connection. Do not pass \a dbName arg because for file-based engine (that has one database per connection) it is defined during connection. If you pass it, database file name will be changed. */ - virtual bool drv_useDatabase( const QString &dbName = QString::null, bool *cancelled = 0, + virtual bool drv_useDatabase( const TQString &dbName = TQString(), bool *cancelled = 0, MessageHandler* msgHandler = 0 ); virtual bool drv_closeDatabase(); @@ -82,21 +83,21 @@ class SQLiteConnection : public Connection /*! Drops database from the server using connection. After drop, database shouldn't be accessible anymore, so database file is just removed. See note from drv_useDatabase(). */ - virtual bool drv_dropDatabase( const QString &dbName = QString::null ); + virtual bool drv_dropDatabase( const TQString &dbName = TQString() ); //virtual bool drv_createTable( const KexiDB::Table& table ); - virtual bool drv_executeSQL( const QString& statement ); -// virtual bool drv_executeQuery( const QString& statement ); + virtual bool drv_executeSQL( const TQString& statement ); +// virtual bool drv_executeQuery( const TQString& statement ); - virtual Q_ULLONG drv_lastInsertRowID(); + virtual TQ_ULLONG drv_lastInsertRowID(); virtual int serverResult(); - virtual QString serverResultName(); - virtual QString serverErrorMsg(); + virtual TQString serverResultName(); + virtual TQString serverErrorMsg(); virtual void drv_clearServerResult(); virtual tristate drv_changeFieldProperty(TableSchema &table, Field& field, - const QString& propertyName, const QVariant& value); + const TQString& propertyName, const TQVariant& value); #ifdef SQLITE2 /*! Alters table's described \a tableSchema name to \a newName. @@ -108,7 +109,7 @@ class SQLiteConnection : public Connection \return true on success. More advanced server backends implement this using "ALTER TABLE .. RENAME TO". */ - virtual bool drv_alterTableName(TableSchema& tableSchema, const QString& newName, bool replace = false); + virtual bool drv_alterTableName(TableSchema& tableSchema, const TQString& newName, bool tqreplace = false); #endif //! for drv_changeFieldProperty() diff --git a/kexi/kexidb/drivers/sqlite/sqliteconnection_p.h b/kexi/kexidb/drivers/sqlite/sqliteconnection_p.h index f295573d..4918c759 100644 --- a/kexi/kexidb/drivers/sqlite/sqliteconnection_p.h +++ b/kexi/kexidb/drivers/sqlite/sqliteconnection_p.h @@ -58,11 +58,11 @@ class SQLiteConnectionInternal : public ConnectionInternal sqlite_struct *data; bool data_owned; //!< true if data pointer should be freed on destruction - QString errmsg; //<! server-specific message of last operation + TQString errmsg; //<! server-specific message of last operation char *errmsg_p; //<! temporary: server-specific message of last operation int res; //<! result code of last operation on server - QCString temp_st; + TQCString temp_st; #ifdef SQLITE3 const char *result_name; #endif diff --git a/kexi/kexidb/drivers/sqlite/sqlitecursor.cpp b/kexi/kexidb/drivers/sqlite/sqlitecursor.cpp index 4b18b437..5239127c 100644 --- a/kexi/kexidb/drivers/sqlite/sqlitecursor.cpp +++ b/kexi/kexidb/drivers/sqlite/sqlitecursor.cpp @@ -33,13 +33,13 @@ #include <kdebug.h> #include <klocale.h> -#include <qptrvector.h> -#include <qdatetime.h> +#include <tqptrvector.h> +#include <tqdatetime.h> using namespace KexiDB; //! safer interpretations of boolean values for SQLite -static bool sqliteStringToBool(const QString& s) +static bool sqliteStringToBool(const TQString& s) { return s.lower()=="yes" || (s.lower()!="no" && s!="0"); } @@ -84,7 +84,7 @@ class KexiDB::SQLiteCursorData : public SQLiteConnectionInternal } #endif*/ - QCString st; + TQCString st; //for sqlite: // sqlite_struct *data; //! taken from SQLiteConnection #ifdef SQLITE2 @@ -95,7 +95,7 @@ class KexiDB::SQLiteCursorData : public SQLiteConnectionInternal char *utail; -// QString errmsg; //<! server-specific message of last operation +// TQString errmsg; //<! server-specific message of last operation // char *errmsg_p; //<! temporary: server-specific message of last operation // int res; //<! result code of last operation on server @@ -112,7 +112,7 @@ class KexiDB::SQLiteCursorData : public SQLiteConnectionInternal uint cols_pointers_mem_size; //! size of record's array of pointers to values int records_in_buf; //! number of records currently stored in the buffer bool buffering_completed; //! true if we have already all records stored in the buffer - QPtrVector<const char*> records; //buffer data + TQPtrVector<const char*> records; //buffer data bool at_buffer; //! true if we already point to the buffer with curr_coldata */ @@ -121,39 +121,39 @@ class KexiDB::SQLiteCursorData : public SQLiteConnectionInternal const char **prev_colname;*/ uint cols_pointers_mem_size; //! size of record's array of pointers to values - QPtrVector<const char*> records;//! buffer data + TQPtrVector<const char*> records;//! buffer data //#ifdef SQLITE3 // bool rowDataReadyToFetch : 1; //#endif #ifdef SQLITE3 - inline QVariant getValue(Field *f, int i) + inline TQVariant getValue(Field *f, int i) { int type = sqlite3_column_type(prepared_st_handle, i); if (type==SQLITE_NULL) { - return QVariant(); + return TQVariant(); } else if (!f || type==SQLITE_TEXT) { //TODO: support for UTF-16 -#define GET_sqlite3_column_text QString::fromUtf8( (const char*)sqlite3_column_text(prepared_st_handle, i) ) +#define GET_sqlite3_column_text TQString::fromUtf8( (const char*)sqlite3_column_text(prepared_st_handle, i) ) if (!f || f->isTextType()) return GET_sqlite3_column_text; else { switch (f->type()) { case Field::Date: - return QDate::fromString( GET_sqlite3_column_text, Qt::ISODate ); + return TQDate::fromString( GET_sqlite3_column_text, Qt::ISODate ); case Field::Time: - //QDateTime - a hack needed because QVariant(QTime) has broken isNull() - return KexiUtils::stringToHackedQTime(GET_sqlite3_column_text); + //TQDateTime - a hack needed because TQVariant(TQTime) has broken isNull() + return KexiUtils::stringToHackedTQTime(GET_sqlite3_column_text); case Field::DateTime: { - QString tmp( GET_sqlite3_column_text ); + TQString tmp( GET_sqlite3_column_text ); tmp[10] = 'T'; //for ISODate compatibility - return QDateTime::fromString( tmp, Qt::ISODate ); + return TQDateTime::fromString( tmp, Qt::ISODate ); } case Field::Boolean: - return QVariant(sqliteStringToBool(GET_sqlite3_column_text), 1); + return TQVariant(sqliteStringToBool(GET_sqlite3_column_text), 1); default: - return QVariant(); //TODO + return TQVariant(); //TODO } } } @@ -162,42 +162,42 @@ class KexiDB::SQLiteCursorData : public SQLiteConnectionInternal case Field::Byte: case Field::ShortInteger: case Field::Integer: - return QVariant( sqlite3_column_int(prepared_st_handle, i) ); + return TQVariant( sqlite3_column_int(prepared_st_handle, i) ); case Field::BigInteger: - return QVariant( (Q_LLONG)sqlite3_column_int64(prepared_st_handle, i) ); + return TQVariant( (TQ_LLONG)sqlite3_column_int64(prepared_st_handle, i) ); case Field::Boolean: - return QVariant( sqlite3_column_int(prepared_st_handle, i)!=0, 1 ); + return TQVariant( sqlite3_column_int(prepared_st_handle, i)!=0, 1 ); default:; } if (f->isFPNumericType()) //WEIRD, YEAH? - return QVariant( (double)sqlite3_column_int(prepared_st_handle, i) ); + return TQVariant( (double)sqlite3_column_int(prepared_st_handle, i) ); else - return QVariant(); //TODO + return TQVariant(); //TODO } else if (type==SQLITE_FLOAT) { if (f && f->isFPNumericType()) - return QVariant( sqlite3_column_double(prepared_st_handle, i) ); + return TQVariant( sqlite3_column_double(prepared_st_handle, i) ); else if (!f || f->isIntegerType()) - return QVariant( (double)sqlite3_column_double(prepared_st_handle, i) ); + return TQVariant( (double)sqlite3_column_double(prepared_st_handle, i) ); else - return QVariant(); //TODO + return TQVariant(); //TODO } else if (type==SQLITE_BLOB) { if (f && f->type()==Field::BLOB) { - QByteArray ba; + TQByteArray ba; //! @todo efficient enough? ba.duplicate((const char*)sqlite3_column_blob(prepared_st_handle, i), sqlite3_column_bytes(prepared_st_handle, i)); return ba; } else - return QVariant(); //TODO + return TQVariant(); //TODO } - return QVariant(); + return TQVariant(); } #endif //SQLITE3 }; -SQLiteCursor::SQLiteCursor(Connection* conn, const QString& statement, uint options) +SQLiteCursor::SQLiteCursor(Connection* conn, const TQString& statement, uint options) : Cursor( conn, statement, options ) , d( new SQLiteCursorData(conn) ) { @@ -328,7 +328,7 @@ void SQLiteCursor::drv_getNextRecord() if (m_result == FetchOK && d->curr_coldata) { for (uint i=0;i<m_fieldCount;i++) { KexiDBDrvDbg<<"col."<< i<<": "<< d->curr_colname[i]<<" "<< d->curr_colname[m_fieldCount+i] - << " = " << (d->curr_coldata[i] ? QString::fromLocal8Bit(d->curr_coldata[i]) : "(NULL)") <<endl; + << " = " << (d->curr_coldata[i] ? TQString::fromLocal8Bit(d->curr_coldata[i]) : "(NULL)") <<endl; } // KexiDBDrvDbg << "SQLiteCursor::drv_getNextRecord(): "<<m_fieldCount<<" col(s) fetched"<<endl; }*/ @@ -363,7 +363,7 @@ void SQLiteCursor::drv_bufferMovePointerPrev() //compute a place in the buffer that contain next record's data //and move internal buffer pointer to that place -void SQLiteCursor::drv_bufferMovePointerTo(Q_LLONG at) +void SQLiteCursor::drv_bufferMovePointerTo(TQ_LLONG at) { d->curr_coldata = d->records.at(at); } @@ -432,17 +432,17 @@ void SQLiteCursor::storeCurrentRow(RowData &data) const if (!m_fieldsExpanded) {//simple version: without types for( uint i=0; i<m_fieldCount; i++ ) { #ifdef SQLITE2 - data[i] = QVariant( *col ); + data[i] = TQVariant( *col ); col++; #else //SQLITE3 - data[i] = QString::fromUtf8( (const char*)sqlite3_column_text(d->prepared_st_handle, i) ); + data[i] = TQString::fromUtf8( (const char*)sqlite3_column_text(d->prepared_st_handle, i) ); #endif } return; } //const uint fieldsExpandedCount = m_fieldsExpanded->count(); - const uint maxCount = QMIN(m_fieldCount, m_fieldsExpanded->count()); + const uint maxCount = TQMIN(m_fieldCount, m_fieldsExpanded->count()); // i - visible field's index, j - physical index for( uint i=0, j=0; i<m_fieldCount; i++, j++ ) { // while (j < m_detailedVisibility.count() && !m_detailedVisibility[j]) //!m_query->isColumnVisible(j)) @@ -459,42 +459,42 @@ void SQLiteCursor::storeCurrentRow(RowData &data) const #ifdef SQLITE2 if (!*col) - data[i] = QVariant(); + data[i] = TQVariant(); else if (f && f->isTextType()) # ifdef SQLITE_UTF8 - data[i] = QString::fromUtf8( *col ); + data[i] = TQString::fromUtf8( *col ); # else - data[i] = QVariant( *col ); //only latin1 + data[i] = TQVariant( *col ); //only latin1 # endif else if (f && f->isFPNumericType()) - data[i] = QVariant( QCString(*col).toDouble() ); + data[i] = TQVariant( TQCString(*col).toDouble() ); else { switch (f ? f->type() : Field::Integer/*ROWINFO*/) { //todo: use short, etc. case Field::Byte: case Field::ShortInteger: case Field::Integer: - data[i] = QVariant( QCString(*col).toInt() ); + data[i] = TQVariant( TQCString(*col).toInt() ); case Field::BigInteger: - data[i] = QVariant( QString::fromLatin1(*col).toLongLong() ); + data[i] = TQVariant( TQString::tqfromLatin1(*col).toLongLong() ); case Field::Boolean: - data[i] = QVariant( sqliteStringToBool(QString::fromLatin1(*col)), 1 ); + data[i] = TQVariant( sqliteStringToBool(TQString::tqfromLatin1(*col)), 1 ); break; case Field::Date: - data[i] = QDate::fromString( QString::fromLatin1(*col), Qt::ISODate ); + data[i] = TQDate::fromString( TQString::tqfromLatin1(*col), Qt::ISODate ); break; case Field::Time: - //QDateTime - a hack needed because QVariant(QTime) has broken isNull() - data[i] = KexiUtils::stringToHackedQTime(QString::fromLatin1(*col)); + //TQDateTime - a hack needed because TQVariant(TQTime) has broken isNull() + data[i] = KexiUtils::stringToHackedTQTime(TQString::tqfromLatin1(*col)); break; case Field::DateTime: { - QString tmp( QString::fromLatin1(*col) ); + TQString tmp( TQString::tqfromLatin1(*col) ); tmp[10] = 'T'; - data[i] = QDateTime::fromString( tmp, Qt::ISODate ); + data[i] = TQDateTime::fromString( tmp, Qt::ISODate ); break; } default: - data[i] = QVariant( *col ); + data[i] = TQVariant( *col ); } } @@ -505,11 +505,11 @@ void SQLiteCursor::storeCurrentRow(RowData &data) const } } -QVariant SQLiteCursor::value(uint i) +TQVariant SQLiteCursor::value(uint i) { // if (i > (m_fieldCount-1+(m_containsROWIDInfo?1:0))) //range checking if (i > (m_fieldCount-1)) //range checking - return QVariant(); + return TQVariant(); //TODO: allow disable range checking! - performance reasons // const KexiDB::Field *f = m_query ? m_query->field(i) : 0; KexiDB::Field *f = (m_fieldsExpanded && i<m_fieldsExpanded->count()) @@ -518,13 +518,13 @@ QVariant SQLiteCursor::value(uint i) //from most to least frequently used types: //(m_logicalFieldCount introduced) if (i==m_fieldCount || f && f->isIntegerType()) if (!f || f->isIntegerType()) - return QVariant( QCString(d->curr_coldata[i]).toInt() ); + return TQVariant( TQCString(d->curr_coldata[i]).toInt() ); else if (!f || f->isTextType()) - return QVariant( d->curr_coldata[i] ); + return TQVariant( d->curr_coldata[i] ); else if (f->isFPNumericType()) - return QVariant( QCString(d->curr_coldata[i]).toDouble() ); + return TQVariant( TQCString(d->curr_coldata[i]).toDouble() ); - return QVariant( d->curr_coldata[i] ); //default + return TQVariant( d->curr_coldata[i] ); //default #else return d->getValue(f, i); //, i==m_logicalFieldCount/*ROWID*/); #endif @@ -532,7 +532,7 @@ QVariant SQLiteCursor::value(uint i) /*! Stores string value taken from field number \a i to \a str. \return false when range checking failed. -bool SQLiteCursor::storeStringValue(uint i, QString &str) +bool SQLiteCursor::storeStringValue(uint i, TQString &str) { if (i > (m_fieldCount-1)) //range checking return false; @@ -545,16 +545,16 @@ int SQLiteCursor::serverResult() return d->res; } -QString SQLiteCursor::serverResultName() +TQString SQLiteCursor::serverResultName() { #ifdef SQLITE2 - return QString::fromLatin1( sqlite_error_string(d->res) ); + return TQString::tqfromLatin1( sqlite_error_string(d->res) ); #else //SQLITE3 - return QString::fromLatin1( d->result_name ); + return TQString::tqfromLatin1( d->result_name ); #endif } -QString SQLiteCursor::serverErrorMsg() +TQString SQLiteCursor::serverErrorMsg() { return d->errmsg; } diff --git a/kexi/kexidb/drivers/sqlite/sqlitecursor.h b/kexi/kexidb/drivers/sqlite/sqlitecursor.h index b7170f67..d5e7c05e 100644 --- a/kexi/kexidb/drivers/sqlite/sqlitecursor.h +++ b/kexi/kexidb/drivers/sqlite/sqlitecursor.h @@ -20,7 +20,7 @@ #ifndef KEXIDB_SQLITECURSOR_H #define KEXIDB_SQLITECURSOR_H -#include <qstring.h> +#include <tqstring.h> #include <kexidb/cursor.h> #include "connection.h" @@ -36,7 +36,7 @@ class SQLiteCursor : public Cursor { public: virtual ~SQLiteCursor(); - virtual QVariant value(uint i); + virtual TQVariant value(uint i); /*! [PROTOTYPE] \return internal buffer data. */ //TODO virtual const char *** bufferData() @@ -48,12 +48,12 @@ class SQLiteCursor : public Cursor // virtual bool save(RowData& data, RowEditBuffer& buf); virtual int serverResult(); - virtual QString serverResultName(); - virtual QString serverErrorMsg(); + virtual TQString serverResultName(); + virtual TQString serverErrorMsg(); protected: /*! Cursor will operate on \a conn, raw \a statement will be used to execute query. */ - SQLiteCursor(Connection* conn, const QString& statement, uint options = NoOptions ); + SQLiteCursor(Connection* conn, const TQString& statement, uint options = NoOptions ); /*! Cursor will operate on \a conn, \a query schema will be used to execute query. */ SQLiteCursor(Connection* conn, QuerySchema& query, @@ -69,7 +69,7 @@ class SQLiteCursor : public Cursor virtual void drv_appendCurrentRecordToBuffer(); virtual void drv_bufferMovePointerNext(); virtual void drv_bufferMovePointerPrev(); - virtual void drv_bufferMovePointerTo(Q_LLONG at); + virtual void drv_bufferMovePointerTo(TQ_LLONG at); //TODO virtual void drv_storeCurrentRecord(); diff --git a/kexi/kexidb/drivers/sqlite/sqlitedriver.cpp b/kexi/kexidb/drivers/sqlite/sqlitedriver.cpp index e2abc246..c5128b63 100644 --- a/kexi/kexidb/drivers/sqlite/sqlitedriver.cpp +++ b/kexi/kexidb/drivers/sqlite/sqlitedriver.cpp @@ -48,9 +48,9 @@ class KexiDB::SQLiteDriverPrivate } }; -//PgSqlDB::PgSqlDB(QObject *parent, const char *name, const QStringList &) -SQLiteDriver::SQLiteDriver( QObject *parent, const char *name, const QStringList &args ) - : Driver( parent, name, args ) +//PgSqlDB::PgSqlDB(TQObject *tqparent, const char *name, const TQStringList &) +SQLiteDriver::SQLiteDriver( TQObject *tqparent, const char *name, const TQStringList &args ) + : Driver( tqparent, name, args ) ,dp( new SQLiteDriverPrivate() ) { d->isFileDriver = true; @@ -66,11 +66,11 @@ SQLiteDriver::SQLiteDriver( QObject *parent, const char *name, const QStringList beh->AUTO_INCREMENT_FIELD_OPTION = ""; //not available beh->AUTO_INCREMENT_TYPE = "INTEGER"; beh->AUTO_INCREMENT_PK_FIELD_OPTION = "PRIMARY KEY"; - beh->AUTO_INCREMENT_REQUIRES_PK = true; + beh->AUTO_INCREMENT_RETQUIRES_PK = true; beh->ROW_ID_FIELD_NAME = "OID"; - beh->_1ST_ROW_READ_AHEAD_REQUIRED_TO_KNOW_IF_THE_RESULT_IS_EMPTY=true; - beh->QUOTATION_MARKS_FOR_IDENTIFIER='"'; - beh->SELECT_1_SUBQUERY_SUPPORTED = true; + beh->_1ST_ROW_READ_AHEAD_RETQUIRED_TO_KNOW_IF_THE_RESULT_IS_EMPTY=true; + beh->TQUOTATION_MARKS_FOR_IDENTIFIER='"'; + beh->SELECT_1_SUBTQUERY_SUPPORTED = true; beh->SQL_KEYWORDS = keywords; initSQLKeywords(29); @@ -110,41 +110,41 @@ SQLiteDriver::drv_createConnection( ConnectionData &conn_data ) return new SQLiteConnection( this, conn_data ); } -bool SQLiteDriver::isSystemObjectName( const QString& n ) const +bool SQLiteDriver::isSystemObjectName( const TQString& n ) const { return Driver::isSystemObjectName(n) || n.lower().startsWith("sqlite_"); } -bool SQLiteDriver::drv_isSystemFieldName( const QString& n ) const +bool SQLiteDriver::drv_isSystemFieldName( const TQString& n ) const { return n.lower()=="_rowid_" || n.lower()=="rowid" || n.lower()=="oid"; } -QString SQLiteDriver::escapeString(const QString& str) const +TQString SQLiteDriver::escapeString(const TQString& str) const { - return QString("'")+QString(str).replace( '\'', "''" ) + "'"; + return TQString("'")+TQString(str).tqreplace( '\'', "''" ) + "'"; } -QCString SQLiteDriver::escapeString(const QCString& str) const +TQCString SQLiteDriver::escapeString(const TQCString& str) const { - return QCString("'")+QCString(str).replace( '\'', "''" )+"'"; + return TQCString("'")+TQCString(str).tqreplace( '\'', "''" )+"'"; } -QString SQLiteDriver::escapeBLOB(const QByteArray& array) const +TQString SQLiteDriver::escapeBLOB(const TQByteArray& array) const { return KexiDB::escapeBLOB(array, KexiDB::BLOBEscapeXHex); } -QString SQLiteDriver::drv_escapeIdentifier( const QString& str) const +TQString SQLiteDriver::drv_escapeIdentifier( const TQString& str) const { - return QString(str).replace( '"', "\"\"" ); + return TQString(str).tqreplace( '"', "\"\"" ); } -QCString SQLiteDriver::drv_escapeIdentifier( const QCString& str) const +TQCString SQLiteDriver::drv_escapeIdentifier( const TQCString& str) const { - return QCString(str).replace( '"', "\"\"" ); + return TQCString(str).tqreplace( '"', "\"\"" ); } AdminTools* SQLiteDriver::drv_createAdminTools() const diff --git a/kexi/kexidb/drivers/sqlite/sqlitedriver.h b/kexi/kexidb/drivers/sqlite/sqlitedriver.h index 66d4d4d2..a388d823 100644 --- a/kexi/kexidb/drivers/sqlite/sqlitedriver.h +++ b/kexi/kexidb/drivers/sqlite/sqlitedriver.h @@ -20,7 +20,7 @@ #ifndef KEXIDB_DRIVER_SQLITE_H #define KEXIDB_DRIVER_SQLITE_H -#include <qstringlist.h> +#include <tqstringlist.h> #include <kexidb/driver.h> @@ -35,31 +35,32 @@ class SQLiteDriverPrivate; class SQLiteDriver : public Driver { Q_OBJECT + TQ_OBJECT KEXIDB_DRIVER public: - SQLiteDriver( QObject *parent, const char *name, const QStringList &args = QStringList() ); + SQLiteDriver( TQObject *tqparent, const char *name, const TQStringList &args = TQStringList() ); virtual ~SQLiteDriver(); /*! \return true if \a n is a system object name; for this driver any object with name prefixed with "sqlite_" is considered as system object. */ - virtual bool isSystemObjectName( const QString& n ) const; + virtual bool isSystemObjectName( const TQString& n ) const; /*! \return false for this driver. */ - virtual bool isSystemDatabaseName( const QString& ) const { return false; } + virtual bool isSystemDatabaseName( const TQString& ) const { return false; } //! Escape a string for use as a value - virtual QString escapeString(const QString& str) const; - virtual QCString escapeString(const QCString& str) const; + virtual TQString escapeString(const TQString& str) const; + virtual TQCString escapeString(const TQCString& str) const; //! Escape BLOB value \a array - virtual QString escapeBLOB(const QByteArray& array) const; + virtual TQString escapeBLOB(const TQByteArray& array) const; protected: - virtual QString drv_escapeIdentifier( const QString& str) const; - virtual QCString drv_escapeIdentifier( const QCString& str) const; + virtual TQString drv_escapeIdentifier( const TQString& str) const; + virtual TQCString drv_escapeIdentifier( const TQCString& str) const; virtual Connection *drv_createConnection( ConnectionData &conn_data ); virtual AdminTools* drv_createAdminTools() const; @@ -67,7 +68,7 @@ class SQLiteDriver : public Driver for this driver fields with name equal "_ROWID_" is considered as system field. */ - virtual bool drv_isSystemFieldName( const QString& n ) const; + virtual bool drv_isSystemFieldName( const TQString& n ) const; SQLiteDriverPrivate *dp; diff --git a/kexi/kexidb/drivers/sqlite/sqlitepreparedstatement.cpp b/kexi/kexidb/drivers/sqlite/sqlitepreparedstatement.cpp index 9103b131..bccfd11b 100644 --- a/kexi/kexidb/drivers/sqlite/sqlitepreparedstatement.cpp +++ b/kexi/kexidb/drivers/sqlite/sqlitepreparedstatement.cpp @@ -93,7 +93,7 @@ bool SQLitePreparedStatement::execute() else assert(0); //impl. error - for (QValueListConstIterator<QVariant> it = m_args.constBegin(); + for (TQValueListConstIterator<TQVariant> it = m_args.constBegin(); (field = itFields.current()); ++it, ++itFields, arg++) { if (it==m_args.constEnd() || (*it).isNull()) {//no value to bind or the value is null: bind NULL @@ -106,7 +106,7 @@ bool SQLitePreparedStatement::execute() } if (field->isTextType()) { //! @todo optimize: make a static copy so SQLITE_STATIC can be used - QCString utf8String((*it).toString().utf8()); + TQCString utf8String((*it).toString().utf8()); res = sqlite3_bind_text(prepared_st_handle, arg, (const char*)utf8String, utf8String.length(), SQLITE_TRANSIENT /*??*/); if (SQLITE_OK != res) { @@ -150,7 +150,7 @@ bool SQLitePreparedStatement::execute() { //! @todo what about unsigned > LLONG_MAX ? bool ok; - Q_LLONG value = (*it).toLongLong(&ok); + TQ_LLONG value = (*it).toLongLong(&ok); if (ok) { res = sqlite3_bind_int64(prepared_st_handle, arg, value); if (SQLITE_OK != res) { @@ -169,7 +169,7 @@ bool SQLitePreparedStatement::execute() } case KexiDB::Field::Boolean: res = sqlite3_bind_text(prepared_st_handle, arg, - QString::number((*it).toBool() ? 1 : 0).latin1(), + TQString::number((*it).toBool() ? 1 : 0).latin1(), 1, SQLITE_TRANSIENT /*??*/); if (SQLITE_OK != res) { //! @todo msg? @@ -178,7 +178,7 @@ bool SQLitePreparedStatement::execute() break; case KexiDB::Field::Time: res = sqlite3_bind_text(prepared_st_handle, arg, - (*it).toTime().toString(Qt::ISODate).latin1(), + TQString((*it).toTime().toString(Qt::ISODate)).latin1(), sizeof("HH:MM:SS"), SQLITE_TRANSIENT /*??*/); if (SQLITE_OK != res) { //! @todo msg? @@ -187,7 +187,7 @@ bool SQLitePreparedStatement::execute() break; case KexiDB::Field::Date: res = sqlite3_bind_text(prepared_st_handle, arg, - (*it).toDate().toString(Qt::ISODate).latin1(), + TQString((*it).toDate().toString(Qt::ISODate)).latin1(), sizeof("YYYY-MM-DD"), SQLITE_TRANSIENT /*??*/); if (SQLITE_OK != res) { //! @todo msg? @@ -205,7 +205,7 @@ bool SQLitePreparedStatement::execute() break; case KexiDB::Field::BLOB: { - const QByteArray byteArray((*it).toByteArray()); + const TQByteArray byteArray((*it).toByteArray()); res = sqlite3_bind_blob(prepared_st_handle, arg, (const char*)byteArray, byteArray.size(), SQLITE_TRANSIENT /*??*/); if (SQLITE_OK != res) { diff --git a/kexi/kexidb/drivers/sqlite/sqlitevacuum.cpp b/kexi/kexidb/drivers/sqlite/sqlitevacuum.cpp index adf8709a..d24d906d 100644 --- a/kexi/kexidb/drivers/sqlite/sqlitevacuum.cpp +++ b/kexi/kexidb/drivers/sqlite/sqlitevacuum.cpp @@ -28,15 +28,15 @@ #include <kmessagebox.h> #include <kio/global.h> -#include <qfileinfo.h> -#include <qdir.h> -#include <qapplication.h> -#include <qprocess.h> -#include <qcursor.h> +#include <tqfileinfo.h> +#include <tqdir.h> +#include <tqapplication.h> +#include <tqprocess.h> +#include <tqcursor.h> #include <unistd.h> -SQLiteVacuum::SQLiteVacuum(const QString& filePath) +SQLiteVacuum::SQLiteVacuum(const TQString& filePath) : m_filePath(filePath) { m_process = 0; @@ -55,35 +55,35 @@ SQLiteVacuum::~SQLiteVacuum() tristate SQLiteVacuum::run() { - const QString ksqlite_app = KStandardDirs::findExe( "ksqlite" ); + const TQString ksqlite_app = KStandardDirs::findExe( "ksqlite" ); if (ksqlite_app.isEmpty()) { m_result = false; return m_result; } - QFileInfo fi(m_filePath); + TQFileInfo fi(m_filePath); if (!fi.isReadable()) { KexiDBDrvWarn << "SQLiteVacuum::run(): No such file" << m_filePath << endl; return false; } const uint origSize = fi.size(); - QStringList args; + TQStringList args; args << ksqlite_app << "-verbose-vacuum" << m_filePath << "vacuum"; - m_process = new QProcess(args, this, "process"); - m_process->setWorkingDirectory( QFileInfo(m_filePath).dir(true) ); - connect( m_process, SIGNAL(readyReadStdout()), this, SLOT(readFromStdout()) ); - connect( m_process, SIGNAL(processExited()), this, SLOT(processExited()) ); + m_process = new TQProcess(args, this, "process"); + m_process->setWorkingDirectory( TQFileInfo(m_filePath).dir(true) ); + connect( m_process, TQT_SIGNAL(readyReadStdout()), this, TQT_SLOT(readFromStdout()) ); + connect( m_process, TQT_SIGNAL(processExited()), this, TQT_SLOT(processExited()) ); if (!m_process->start()) { m_result = false; return m_result; } m_dlg = new KProgressDialog(0, 0, i18n("Compacting database"), "<qt>"+i18n("Compacting database \"%1\"...") - .arg("<nobr>"+QDir::convertSeparators(QFileInfo(m_filePath).fileName())+"</nobr>") + .tqarg("<nobr>"+TQDir::convertSeparators(TQFileInfo(m_filePath).fileName())+"</nobr>") ); m_dlg->adjustSize(); m_dlg->resize(300, m_dlg->height()); - connect(m_dlg, SIGNAL(cancelClicked()), this, SLOT(cancelClicked())); + connect(m_dlg, TQT_SIGNAL(cancelClicked()), this, TQT_SLOT(cancelClicked())); m_dlg->setMinimumDuration(1000); m_dlg->setAutoClose(true); m_dlg->progressBar()->setTotalSteps(100); @@ -95,10 +95,10 @@ tristate SQLiteVacuum::run() delete m_process; m_process = 0; if (m_result == true) { - const uint newSize = QFileInfo(m_filePath).size(); + const uint newSize = TQFileInfo(m_filePath).size(); const uint decrease = 100-100*newSize/origSize; KMessageBox::information(0, i18n("The database has been compacted. Current size decreased by %1% to %2.") - .arg(decrease).arg(KIO::convertSize(newSize))); + .tqarg(decrease).tqarg(KIO::convertSize(newSize))); } return m_result; } @@ -106,7 +106,7 @@ tristate SQLiteVacuum::run() void SQLiteVacuum::readFromStdout() { while (true) { - QString s( m_process->readLineStdout() ); //readStdout(); + TQString s( m_process->readLineStdout() ); //readStdout(); if (s.isEmpty()) break; m_dlg->progressBar()->setProgress(m_percent); @@ -118,7 +118,7 @@ void SQLiteVacuum::readFromStdout() if (s.mid(8,4)=="100%") { m_percent = 100; m_dlg->setAllowCancel(false); - m_dlg->setCursor(QCursor(Qt::WaitCursor)); + m_dlg->setCursor(TQCursor(TQt::WaitCursor)); } else if (s.mid(9,1)=="%") { m_percent = s.mid(8,1).toInt(); @@ -126,7 +126,7 @@ void SQLiteVacuum::readFromStdout() else if (s.mid(10,1)=="%") { m_percent = s.mid(8,2).toInt(); } - m_process->writeToStdin(" "); + m_process->writeToStdin(TQString(" ")); } } } @@ -142,7 +142,7 @@ void SQLiteVacuum::processExited() void SQLiteVacuum::cancelClicked() { if (!m_process->normalExit()) { - m_process->writeToStdin("q"); //quit + m_process->writeToStdin(TQString("q")); //quit m_result = cancelled; } } diff --git a/kexi/kexidb/drivers/sqlite/sqlitevacuum.h b/kexi/kexidb/drivers/sqlite/sqlitevacuum.h index 4424b7fc..27bcc7ef 100644 --- a/kexi/kexidb/drivers/sqlite/sqlitevacuum.h +++ b/kexi/kexidb/drivers/sqlite/sqlitevacuum.h @@ -20,12 +20,12 @@ #ifndef SQLITE_VACUUM_H #define SQLITE_VACUUM_H -#include <qobject.h> -#include <qstring.h> +#include <tqobject.h> +#include <tqstring.h> #include <kexiutils/tristate.h> -class QProcess; +class TQProcess; class KTempFile; class KProgressDialog; @@ -42,11 +42,12 @@ class KProgressDialog; creates a copy of the original database file, and replaces the orginal with the new only on success. */ -class SQLiteVacuum : public QObject +class SQLiteVacuum : public TQObject { Q_OBJECT + TQ_OBJECT public: - SQLiteVacuum(const QString& filePath); + SQLiteVacuum(const TQString& filePath); ~SQLiteVacuum(); /*! Performs compacting procedure. @@ -60,8 +61,8 @@ class SQLiteVacuum : public QObject void cancelClicked(); protected: - QString m_filePath; - QProcess *m_process; + TQString m_filePath; + TQProcess *m_process; KProgressDialog* m_dlg; int m_percent; tristate m_result; |