diff options
Diffstat (limited to 'kdevdesigner/designer/project.cpp')
-rw-r--r-- | kdevdesigner/designer/project.cpp | 524 |
1 files changed, 262 insertions, 262 deletions
diff --git a/kdevdesigner/designer/project.cpp b/kdevdesigner/designer/project.cpp index 2a261d20..0ab960ea 100644 --- a/kdevdesigner/designer/project.cpp +++ b/kdevdesigner/designer/project.cpp @@ -33,25 +33,25 @@ #include "dbconnectionimpl.h" #endif #include "resource.h" -#include <qwidgetfactory.h> +#include <tqwidgetfactory.h> #include "outputwindow.h" -#include <qfile.h> -#include <qtextstream.h> -#include <qurl.h> -#include <qobjectlist.h> -#include <qfeatures.h> -#include <qtextcodec.h> -#include <qdom.h> -#include <qmessagebox.h> -#include <qapplication.h> +#include <tqfile.h> +#include <tqtextstream.h> +#include <tqurl.h> +#include <tqobjectlist.h> +#include <tqfeatures.h> +#include <tqtextcodec.h> +#include <tqdom.h> +#include <tqmessagebox.h> +#include <tqapplication.h> #include "mainwindow.h" -#include <qworkspace.h> +#include <tqworkspace.h> #ifndef QT_NO_SQL -#include <qsqldatabase.h> -#include <qsqlrecord.h> -#include <qdatatable.h> +#include <tqsqldatabase.h> +#include <tqsqlrecord.h> +#include <tqdatatable.h> #endif #include <stdlib.h> @@ -74,11 +74,11 @@ bool DatabaseConnection::refreshCatalog() return TRUE; if ( !open() ) return FALSE; - tbls = conn->tables( QSql::TableType( QSql::Tables | QSql::Views ) ); + tbls = conn->tables( TQSql::TableType( TQSql::Tables | TQSql::Views ) ); flds.clear(); - for ( QStringList::Iterator it = tbls.begin(); it != tbls.end(); ++it ) { - QSqlRecord fil = conn->record( *it ); - QStringList lst; + for ( TQStringList::Iterator it = tbls.begin(); it != tbls.end(); ++it ) { + TQSqlRecord fil = conn->record( *it ); + TQStringList lst; for ( uint j = 0; j < fil.count(); ++j ) lst << fil.field( j )->name(); flds.insert( *it, lst ); @@ -95,9 +95,9 @@ bool DatabaseConnection::refreshCatalog() void DatabaseConnection::remove() { if ( nm == "(default)" ) - QSqlDatabase::removeDatabase( QSqlDatabase::defaultConnection ); + TQSqlDatabase::removeDatabase( TQSqlDatabase::defaultConnection ); else - QSqlDatabase::removeDatabase( nm ); + TQSqlDatabase::removeDatabase( nm ); // the above will effectively delete the current connection conn = 0; } @@ -108,15 +108,15 @@ bool DatabaseConnection::open( bool suppressDialog ) #ifndef QT_NO_SQL // register our name, if nec if ( nm == "(default)" ) { - if ( !QSqlDatabase::contains() ) // default doesn't exists? - conn = QSqlDatabase::addDatabase( drv ); + if ( !TQSqlDatabase::contains() ) // default doesn't exists? + conn = TQSqlDatabase::addDatabase( drv ); else - conn = QSqlDatabase::database(); + conn = TQSqlDatabase::database(); } else { - if ( !QSqlDatabase::contains( nm ) ) - conn = QSqlDatabase::addDatabase( drv, nm ); + if ( !TQSqlDatabase::contains( nm ) ) + conn = TQSqlDatabase::addDatabase( drv, nm ); else - conn = QSqlDatabase::database( nm ); + conn = TQSqlDatabase::database( nm ); } conn->setDatabaseName( dbName ); conn->setUserName( uname ); @@ -129,10 +129,10 @@ bool DatabaseConnection::open( bool suppressDialog ) if ( !success ) { DatabaseConnectionEditor dia( this, 0 , 0 , TRUE ); switch( dia.exec() ) { - case QDialog::Accepted: + case TQDialog::Accepted: done = FALSE; break; - case QDialog::Rejected: + case TQDialog::Rejected: done = TRUE; break; } @@ -145,14 +145,14 @@ bool DatabaseConnection::open( bool suppressDialog ) conn->setPort( prt ); success = conn->open(); if ( !success ) { - switch( QMessageBox::warning( project->messageBoxParent(), i18n( "Connection" ), + switch( TQMessageBox::warning( project->messageBoxParent(), i18n( "Connection" ), i18n( "Could not connect to the database.\n" "Press 'OK' to continue or 'Cancel' to " "specify different\nconnection information.\n" ) - + QString( "[" + conn->lastError().driverText() + "\n" + + + TQString( "[" + conn->lastError().driverText() + "\n" + conn->lastError().databaseText() + "]\n" ), i18n( "&OK" ), - i18n( "&Cancel" ), QString::null, 0, 1 ) ) { + i18n( "&Cancel" ), TQString::null, 0, 1 ) ) { case 0: // OK or Enter continue; case 1: // Cancel or Escape @@ -201,9 +201,9 @@ bool Project::isDummy() const return isDummyProject; } -Project::Project( const QString &fn, const QString &pName, +Project::Project( const TQString &fn, const TQString &pName, QPluginManager<ProjectSettingsInterface> *pm, bool isDummy, - const QString &l ) + const TQString &l ) : proName( pName ), projectSettingsPluginManager( pm ), isDummyProject( isDummy ) { modified = TRUE; @@ -237,7 +237,7 @@ void Project::setModified( bool b ) } #ifndef QT_NO_SQL -DatabaseConnection *Project::databaseConnection( const QString &name ) +DatabaseConnection *Project::databaseConnection( const TQString &name ) { for ( DatabaseConnection *conn = dbConnections.first(); conn; @@ -249,32 +249,32 @@ DatabaseConnection *Project::databaseConnection( const QString &name ) } #endif -void Project::setFileName( const QString &fn, bool doClear ) +void Project::setFileName( const TQString &fn, bool doClear ) { if ( fn == filename ) return; if ( singleProjectMode() ) { - QString qsa = QString( getenv( "HOME" ) ) + QString( "/.qsa" ); - if ( !QFile::exists( qsa ) ) { - QDir d; + TQString qsa = TQString( getenv( "HOME" ) ) + TQString( "/.qsa" ); + if ( !TQFile::exists( qsa ) ) { + TQDir d; d.mkdir( qsa ); } if ( fn == singleProFileName ) return; singleProFileName = fn; static int counter = 0; - QString str_counter = QString::number( counter++ ); + TQString str_counter = TQString::number( counter++ ); str_counter = "/.qsa/" + str_counter; LanguageInterface *iface = MetaDataBase::languageInterface( language() ); - filename = QString( getenv( "HOME" ) + str_counter + QString( "tmp_" ) + - QFileInfo( fn ).baseName() + "/" + QFileInfo( fn ).baseName() + ".pro" ); + filename = TQString( getenv( "HOME" ) + str_counter + TQString( "tmp_" ) + + TQFileInfo( fn ).baseName() + "/" + TQFileInfo( fn ).baseName() + ".pro" ); removeTempProject(); if ( iface && iface->supports( LanguageInterface::CompressProject ) ) { filename = iface->uncompressProject( makeAbsolute( singleProFileName ), - QString( getenv( "HOME" ) + - str_counter + QString( "tmp_" ) + - QFileInfo( fn ).baseName() ) ); + TQString( getenv( "HOME" ) + + str_counter + TQString( "tmp_" ) + + TQFileInfo( fn ).baseName() ) ); proName = makeAbsolute( singleProFileName ); } } else { @@ -291,34 +291,34 @@ void Project::setFileName( const QString &fn, bool doClear ) if ( !doClear ) return; clear(); - if ( QFile::exists( filename ) ) + if ( TQFile::exists( filename ) ) parse(); } -QString Project::fileName( bool singlePro ) const +TQString Project::fileName( bool singlePro ) const { if ( singlePro ) return singleProFileName; return filename; } -QString Project::databaseDescription() const +TQString Project::databaseDescription() const { return dbFile; } -QString Project::projectName() const +TQString Project::projectName() const { return proName; } -static QString parse_part( const QString &part ) +static TQString parse_part( const TQString &part ) { - QString res; + TQString res; bool inName = FALSE; - QString currName; + TQString currName; for ( int i = 0; i < (int)part.length(); ++i ) { - QChar c = part[ i ]; + TQChar c = part[ i ]; if ( !inName ) { if ( c != ' ' && c != '\t' && c != '\n' && c != '=' && c != '\\' && c != '+' ) inName = TRUE; @@ -334,16 +334,16 @@ static QString parse_part( const QString &part ) return res; } -QStringList parse_multiline_part( const QString &contents, const QString &key, int *start = 0 ) +TQStringList parse_multiline_part( const TQString &contents, const TQString &key, int *start = 0 ) { if ( start ) *start = -1; - QString lastWord; + TQString lastWord; // Account for things like win32: SOURCES int extraWhiteSpaceCount = 0; int braceCount = 0; for ( int i = 0; i < (int)contents.length(); ++i ) { - QChar c( contents[ i ] ); + TQChar c( contents[ i ] ); switch ( c ) { case '{': braceCount++; @@ -372,9 +372,9 @@ QStringList parse_multiline_part( const QString &contents, const QString &key, i if ( lastWord == key && braceCount == 0 ) { if ( start ) *start = i - lastWord.length() - extraWhiteSpaceCount + 1; - QStringList lst; + TQStringList lst; bool inName = FALSE; - QString currName; + TQString currName; bool hadEqual = FALSE; for ( ; i < (int)contents.length(); ++i ) { c = contents[ i ]; @@ -389,7 +389,7 @@ QStringList parse_multiline_part( const QString &contents, const QString &key, i c == '$' || c == '-' || c == '(' || c == ')' || c == ':' || c == '+' || c == ',' || c == '~' ) && c != ' ' && c != '\t' && c != '\n' ) { if ( !inName ) - currName = QString::null; + currName = TQString::null; if ( c != '\\' || contents[i+1] != '\n' ) { currName += c; inName = TRUE; @@ -408,27 +408,27 @@ QStringList parse_multiline_part( const QString &contents, const QString &key, i } } - return QStringList(); + return TQStringList(); } void Project::parse() { - QFile f( filename ); + TQFile f( filename ); if ( !f.exists() || !f.open( IO_ReadOnly ) ) return; - QTextStream ts( &f ); - QString contents = ts.read(); + TQTextStream ts( &f ); + TQString contents = ts.read(); f.close(); - proName = QFileInfo( filename ).baseName(); + proName = TQFileInfo( filename ).baseName(); - QStringList::ConstIterator it; + TQStringList::ConstIterator it; int i = contents.find( "LANGUAGE" ); if ( i != -1 ) { lang = ""; is_cpp = FALSE; - QString part = contents.mid( i + QString( "LANGUAGE" ).length() ); + TQString part = contents.mid( i + TQString( "LANGUAGE" ).length() ); lang = parse_part( part ); is_cpp = lang == "C++"; } @@ -436,11 +436,11 @@ void Project::parse() i = contents.find( "DBFILE" ); if ( i != -1 ) { dbFile = ""; - QString part = contents.mid( i + QString( "DBFILE" ).length() ); + TQString part = contents.mid( i + TQString( "DBFILE" ).length() ); dbFile = parse_part( part ); } - QStringList uifiles = parse_multiline_part( contents, "FORMS" ); + TQStringList uifiles = parse_multiline_part( contents, "FORMS" ); uifiles += parse_multiline_part( contents, "INTERFACES" ); // compatibility for ( it = uifiles.begin(); it != uifiles.end(); ++it ) { if ( (*it).startsWith( "__APPOBJ" ) ) @@ -452,7 +452,7 @@ void Project::parse() i = contents.find( "TEMPLATE" ); if ( i != -1 ) { templ = ""; - QString part = contents.mid( i + QString( "TEMPLATE" ).length() ); + TQString part = contents.mid( i + TQString( "TEMPLATE" ).length() ); templ = parse_part( part ); } @@ -465,11 +465,11 @@ void Project::parse() LanguageInterface *iface = MetaDataBase::languageInterface( lang ); if ( iface ) { - QStringList sourceKeys; + TQStringList sourceKeys; iface->sourceProjectKeys( sourceKeys ); - for ( QStringList::Iterator it = sourceKeys.begin(); it != sourceKeys.end(); ++it ) { - QStringList lst = parse_multiline_part( contents, *it ); - for ( QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) + for ( TQStringList::Iterator it = sourceKeys.begin(); it != sourceKeys.end(); ++it ) { + TQStringList lst = parse_multiline_part( contents, *it ); + for ( TQStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) (void) new SourceFile( *it, FALSE, this ); } } @@ -479,8 +479,8 @@ void Project::parse() for ( it = csList.begin(); it != csList.end(); ++it ) { i = contents.find( *it ); if ( i != -1 ) { - QString val = ""; - QString part = contents.mid( i + QString( *it ).length() ); + TQString val = ""; + TQString part = contents.mid( i + TQString( *it ).length() ); val = parse_part( part ); customSettings.replace( *it, val ); } @@ -488,17 +488,17 @@ void Project::parse() loadConnections(); - QStringList images = parse_multiline_part( contents, "IMAGES" ); + TQStringList images = parse_multiline_part( contents, "IMAGES" ); // ### remove that for the final - this is beta-compatibility - if ( images.isEmpty() && QDir( QFileInfo( filename ).dirPath( TRUE ) + "/images" ).exists() ) { - images = QDir( QFileInfo( filename ).dirPath( TRUE ) + "/images" ).entryList(); + if ( images.isEmpty() && TQDir( TQFileInfo( filename ).dirPath( TRUE ) + "/images" ).exists() ) { + images = TQDir( TQFileInfo( filename ).dirPath( TRUE ) + "/images" ).entryList(); for ( int i = 0; i < (int)images.count(); ++i ) images[ i ].prepend( "images/" ); modified = TRUE; } - for ( QStringList::ConstIterator pit = images.begin(); pit != images.end(); ++pit ) + for ( TQStringList::ConstIterator pit = images.begin(); pit != images.end(); ++pit ) pixCollection->load( *pit ); } @@ -521,17 +521,17 @@ bool Project::removeSourceFile( SourceFile *sf ) return TRUE; } -void Project::setDatabaseDescription( const QString &db ) +void Project::setDatabaseDescription( const TQString &db ) { dbFile = db; } -void Project::setDescription( const QString &s ) +void Project::setDescription( const TQString &s ) { desc = s; } -QString Project::description() const +TQString Project::description() const { return desc; } @@ -546,28 +546,28 @@ bool Project::isValid() const return TRUE; } -QString Project::makeAbsolute( const QString &f ) +TQString Project::makeAbsolute( const TQString &f ) { if ( isDummy() ) return f; - QString encodedUrl = QFileInfo( filename ).dirPath( TRUE ); - QUrl::encode( encodedUrl ); - QUrl u( encodedUrl, f ); + TQString encodedUrl = TQFileInfo( filename ).dirPath( TRUE ); + TQUrl::encode( encodedUrl ); + TQUrl u( encodedUrl, f ); return u.path(); } -QString Project::makeRelative( const QString &f ) +TQString Project::makeRelative( const TQString &f ) { if ( isDummy() ) return f; - QString p = QFileInfo( filename ).dirPath( TRUE ); - QString f2 = f; + TQString p = TQFileInfo( filename ).dirPath( TRUE ); + TQString f2 = f; if ( f2.left( p.length() ) == p ) f2.remove( 0, p.length() + 1 ); return f2; } -static void remove_contents( QString &contents, const QString &s ) +static void remove_contents( TQString &contents, const TQString &s ) { int i = contents.find( s ); if ( i != -1 ) { @@ -579,7 +579,7 @@ static void remove_contents( QString &contents, const QString &s ) } } -static void remove_multiline_contents( QString &contents, const QString &s, int *strt = 0 ) +static void remove_multiline_contents( TQString &contents, const TQString &s, int *strt = 0 ) { int i = contents.find( s ); if ( strt ) @@ -631,13 +631,13 @@ void Project::save( bool onlyProjectFile ) return; } - QFile f( filename ); - QString original = ""; + TQFile f( filename ); + TQString original = ""; // read the existing file bool hasPreviousContents = FALSE; if ( f.open( IO_ReadOnly ) ) { - QTextStream ts( &f ); + TQTextStream ts( &f ); original = ts.read(); f.close(); hasPreviousContents = TRUE; @@ -654,12 +654,12 @@ void Project::save( bool onlyProjectFile ) remove_multiline_contents( original, "FORMS" ); remove_multiline_contents( original, "INTERFACES" ); // compatibility remove_multiline_contents( original, "IMAGES" ); - for ( QStringList::Iterator it = csList.begin(); it != csList.end(); ++it ) + for ( TQStringList::Iterator it = csList.begin(); it != csList.end(); ++it ) remove_contents( original, *it ); } // the contents of the saved file - QString contents; + TQString contents; // template contents += "TEMPLATE\t= " + templ + "\n"; @@ -672,9 +672,9 @@ void Project::save( bool onlyProjectFile ) writePlatformSettings( contents, "CONFIG", cfg ); LanguageInterface *iface = MetaDataBase::languageInterface( lang ); if ( iface ) { - QStringList sourceKeys; + TQStringList sourceKeys; iface->sourceProjectKeys( sourceKeys ); - for ( QStringList::Iterator spit = sourceKeys.begin(); spit != sourceKeys.end(); ++spit ) + for ( TQStringList::Iterator spit = sourceKeys.begin(); spit != sourceKeys.end(); ++spit ) remove_multiline_contents( contents, *spit ); } contents += "\n"; @@ -699,19 +699,19 @@ void Project::save( bool onlyProjectFile ) // sources if ( !sourcefiles.isEmpty() && iface ) { - QMap<QString, QStringList> sourceToKey; + TQMap<TQString, TQStringList> sourceToKey; for ( SourceFile *f = sourcefiles.first(); f; f = sourcefiles.next() ) { - QString key = iface->projectKeyForExtension( QFileInfo( f->fileName() ).extension() ); - QStringList lst = sourceToKey[ key ]; + TQString key = iface->projectKeyForExtension( TQFileInfo( f->fileName() ).extension() ); + TQStringList lst = sourceToKey[ key ]; lst << makeRelative( f->fileName() ); sourceToKey.replace( key, lst ); } - for ( QMap<QString, QStringList>::Iterator skit = sourceToKey.begin(); + for ( TQMap<TQString, TQStringList>::Iterator skit = sourceToKey.begin(); skit != sourceToKey.end(); ++skit ) { - QString part = skit.key() + "\t+= "; - QStringList lst = *skit; - for ( QStringList::Iterator sit = lst.begin(); sit != lst.end(); ++sit ) { + TQString part = skit.key() + "\t+= "; + TQStringList lst = *skit; + for ( TQStringList::Iterator sit = lst.begin(); sit != lst.end(); ++sit ) { part += *sit; part += ++sit != lst.end() ? " \\\n\t" : ""; --sit; @@ -724,7 +724,7 @@ void Project::save( bool onlyProjectFile ) // forms and interfaces if ( !formfiles.isEmpty() ) { contents += "FORMS\t= "; - for ( QPtrListIterator<FormFile> fit = formfiles; fit.current(); ++fit ) { + for ( TQPtrListIterator<FormFile> fit = formfiles; fit.current(); ++fit ) { contents += fit.current()->fileName() + (fit != formfiles.last() ? " \\\n\t" : ""); } @@ -734,8 +734,8 @@ void Project::save( bool onlyProjectFile ) // images if ( !pixCollection->isEmpty() ) { contents += "IMAGES\t= "; - QValueList<PixmapCollection::Pixmap> pixmaps = pixCollection->pixmaps(); - for ( QValueList<PixmapCollection::Pixmap>::Iterator it = pixmaps.begin(); + TQValueList<PixmapCollection::Pixmap> pixmaps = pixCollection->pixmaps(); + for ( TQValueList<PixmapCollection::Pixmap>::Iterator it = pixmaps.begin(); it != pixmaps.end(); ++it ) { contents += makeRelative( (*it).absname ); contents += ++it != pixmaps.end() ? " \\\n\t" : ""; @@ -750,19 +750,19 @@ void Project::save( bool onlyProjectFile ) contents += "\n"; // custom settings - for ( QStringList::Iterator it = csList.begin(); it != csList.end(); ++it ) { - QString val = *customSettings.find( *it ); + for ( TQStringList::Iterator it = csList.begin(); it != csList.end(); ++it ) { + TQString val = *customSettings.find( *it ); if ( !val.isEmpty() ) contents += *it + "\t= " + val + "\n"; } if ( !f.open( IO_WriteOnly | IO_Translate ) ) { - QMessageBox::warning( messageBoxParent(), + TQMessageBox::warning( messageBoxParent(), "Save Project Failed", "Couldn't write project file " + filename ); return; } - QTextStream os( &f ); + TQTextStream os( &f ); os << contents; if (hasPreviousContents) os << original; @@ -779,14 +779,14 @@ void Project::save( bool onlyProjectFile ) } #ifndef QT_NO_SQL -QPtrList<DatabaseConnection> Project::databaseConnections() const +TQPtrList<DatabaseConnection> Project::databaseConnections() const { return dbConnections; } #endif #ifndef QT_NO_SQL -void Project::setDatabaseConnections( const QPtrList<DatabaseConnection> &lst ) +void Project::setDatabaseConnections( const TQPtrList<DatabaseConnection> &lst ) { dbConnections = lst; } @@ -801,7 +801,7 @@ void Project::addDatabaseConnection( DatabaseConnection *conn ) #endif #ifndef QT_NO_SQL -void Project::removeDatabaseConnection( const QString &c ) +void Project::removeDatabaseConnection( const TQString &c ) { for ( DatabaseConnection *conn = dbConnections.first(); conn; conn = dbConnections.next() ) { if ( conn->name() == c ) { @@ -815,9 +815,9 @@ void Project::removeDatabaseConnection( const QString &c ) #endif #ifndef QT_NO_SQL -QStringList Project::databaseConnectionList() +TQStringList Project::databaseConnectionList() { - QStringList lst; + TQStringList lst; for ( DatabaseConnection *conn = dbConnections.first(); conn; conn = dbConnections.next() ) lst << conn->name(); return lst; @@ -825,37 +825,37 @@ QStringList Project::databaseConnectionList() #endif #ifndef QT_NO_SQL -QStringList Project::databaseTableList( const QString &connection ) +TQStringList Project::databaseTableList( const TQString &connection ) { DatabaseConnection *conn = databaseConnection( connection ); if ( !conn ) { - return QStringList(); + return TQStringList(); } return conn->tables(); } #endif #ifndef QT_NO_SQL -QStringList Project::databaseFieldList( const QString &connection, const QString &table ) +TQStringList Project::databaseFieldList( const TQString &connection, const TQString &table ) { DatabaseConnection *conn = databaseConnection( connection ); if ( !conn ) - return QStringList(); + return TQStringList(); return conn->fields( table ); } #endif #ifndef QT_NO_SQL -static QString makeIndent( int indent ) +static TQString makeIndent( int indent ) { - QString s; + TQString s; s.fill( ' ', indent * 4 ); return s; } #endif #ifndef QT_NO_SQL -static void saveSingleProperty( QTextStream &ts, const QString& name, const QString& value, int indent ) +static void saveSingleProperty( TQTextStream &ts, const TQString& name, const TQString& value, int indent ) { ts << makeIndent( indent ) << "<property name=\"" << name << "\">" << endl; ++indent; @@ -869,11 +869,11 @@ void Project::saveConnections() { #ifndef QT_NO_SQL if ( dbFile.isEmpty() ) { - QFileInfo fi( fileName() ); + TQFileInfo fi( fileName() ); setDatabaseDescription( fi.baseName() + ".db" ); } - QFile f( makeAbsolute( dbFile ) ); + TQFile f( makeAbsolute( dbFile ) ); if ( dbConnections.isEmpty() ) { if ( f.exists() ) @@ -885,8 +885,8 @@ void Project::saveConnections() /* .db xml */ if ( f.open( IO_WriteOnly | IO_Translate ) ) { - QTextStream ts( &f ); - ts.setCodec( QTextCodec::codecForName( "UTF-8" ) ); + TQTextStream ts( &f ); + ts.setCodec( TQTextCodec::codecForName( "UTF-8" ) ); ts << "<!DOCTYPE DB><DB version=\"1.0\">" << endl; /* db connections */ @@ -899,19 +899,19 @@ void Project::saveConnections() saveSingleProperty( ts, "database", conn->database(), indent ); saveSingleProperty( ts, "username", conn->username(), indent ); saveSingleProperty( ts, "hostname", conn->hostname(), indent ); - saveSingleProperty( ts, "port", QString::number( conn->port() ), indent ); + saveSingleProperty( ts, "port", TQString::number( conn->port() ), indent ); /* connection tables */ - QStringList tables = conn->tables(); - for ( QStringList::Iterator it = tables.begin(); + TQStringList tables = conn->tables(); + for ( TQStringList::Iterator it = tables.begin(); it != tables.end(); ++it ) { ts << makeIndent( indent ) << "<table>" << endl; ++indent; saveSingleProperty( ts, "name", (*it), indent ); /* tables fields */ - QStringList fields = conn->fields( *it ); - for ( QStringList::Iterator it2 = fields.begin(); + TQStringList fields = conn->fields( *it ); + for ( TQStringList::Iterator it2 = fields.begin(); it2 != fields.end(); ++it2 ) { ts << makeIndent( indent ) << "<field>" << endl; ++indent; @@ -935,9 +935,9 @@ void Project::saveConnections() } #ifndef QT_NO_SQL -static QDomElement loadSingleProperty( QDomElement e, const QString& name ) +static TQDomElement loadSingleProperty( TQDomElement e, const TQString& name ) { - QDomElement n; + TQDomElement n; for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) { @@ -951,31 +951,31 @@ static QDomElement loadSingleProperty( QDomElement e, const QString& name ) void Project::loadConnections() { #ifndef QT_NO_SQL - if ( dbFile.isEmpty() || !QFile::exists( makeAbsolute( dbFile ) ) ) + if ( dbFile.isEmpty() || !TQFile::exists( makeAbsolute( dbFile ) ) ) return; - QFile f( makeAbsolute( dbFile ) ); + TQFile f( makeAbsolute( dbFile ) ); if ( f.open( IO_ReadOnly ) ) { - QDomDocument doc; - QString errMsg; + TQDomDocument doc; + TQString errMsg; int errLine; if ( doc.setContent( &f, &errMsg, &errLine ) ) { - QDomElement e; + TQDomElement e; e = doc.firstChild().toElement(); /* connections */ - QDomNodeList connections = e.toElement().elementsByTagName( "connection" ); + TQDomNodeList connections = e.toElement().elementsByTagName( "connection" ); for ( uint i = 0; i < connections.length(); i++ ) { - QDomElement connection = connections.item(i).toElement(); - QDomElement connectionName = loadSingleProperty( connection, "name" ); - QDomElement connectionDriver = loadSingleProperty( connection, "driver" ); - QDomElement connectionDatabase = loadSingleProperty( connection, + TQDomElement connection = connections.item(i).toElement(); + TQDomElement connectionName = loadSingleProperty( connection, "name" ); + TQDomElement connectionDriver = loadSingleProperty( connection, "driver" ); + TQDomElement connectionDatabase = loadSingleProperty( connection, "database" ); - QDomElement connectionUsername = loadSingleProperty( connection, + TQDomElement connectionUsername = loadSingleProperty( connection, "username" ); - QDomElement connectionHostname = loadSingleProperty( connection, + TQDomElement connectionHostname = loadSingleProperty( connection, "hostname" ); - QDomElement connectionPort = loadSingleProperty( connection, + TQDomElement connectionPort = loadSingleProperty( connection, "port" ); DatabaseConnection *conn = new DatabaseConnection( this ); @@ -984,21 +984,21 @@ void Project::loadConnections() conn->setDatabase( connectionDatabase.firstChild().firstChild().toText().data() ); conn->setUsername( connectionUsername.firstChild().firstChild().toText().data() ); conn->setHostname( connectionHostname.firstChild().firstChild().toText().data() ); - conn->setPort( QString( connectionPort.firstChild().firstChild().toText().data() ).toInt() ); + conn->setPort( TQString( connectionPort.firstChild().firstChild().toText().data() ).toInt() ); /* connection tables */ - QDomNodeList tables = connection.toElement().elementsByTagName( "table" ); + TQDomNodeList tables = connection.toElement().elementsByTagName( "table" ); for ( uint j = 0; j < tables.length(); j++ ) { - QDomElement table = tables.item(j).toElement(); - QDomElement tableName = loadSingleProperty( table, "name" ); + TQDomElement table = tables.item(j).toElement(); + TQDomElement tableName = loadSingleProperty( table, "name" ); conn->addTable( tableName.firstChild().firstChild().toText().data() ); /* table fields */ - QStringList fieldList; - QDomNodeList fields = table.toElement().elementsByTagName( "field" ); + TQStringList fieldList; + TQDomNodeList fields = table.toElement().elementsByTagName( "field" ); for ( uint k = 0; k < fields.length(); k++ ) { - QDomElement field = fields.item(k).toElement(); - QDomElement fieldName = loadSingleProperty( field, "name" ); + TQDomElement field = fields.item(k).toElement(); + TQDomElement fieldName = loadSingleProperty( field, "name" ); fieldList.append( fieldName.firstChild().firstChild().toText().data() ); } conn->setFields( tableName.firstChild().firstChild().toText().data(), @@ -1008,7 +1008,7 @@ void Project::loadConnections() dbConnections.append( conn ); } } else { - qDebug( QString("Parse error: ") + errMsg + QString(" in line %d"), errLine ); + qDebug( TQString("Parse error: ") + errMsg + TQString(" in line %d"), errLine ); } f.close(); } @@ -1019,7 +1019,7 @@ void Project::loadConnections() can be closed again with closeDatabase(). */ -bool Project::openDatabase( const QString &connection, bool suppressDialog ) +bool Project::openDatabase( const TQString &connection, bool suppressDialog ) { #ifndef QT_NO_SQL DatabaseConnection *conn = databaseConnection( connection ); @@ -1038,7 +1038,7 @@ bool Project::openDatabase( const QString &connection, bool suppressDialog ) /*! Closes the database \a connection. */ -void Project::closeDatabase( const QString &connection ) +void Project::closeDatabase( const TQString &connection ) { #ifndef QT_NO_SQL DatabaseConnection *conn = databaseConnection( connection ); @@ -1057,16 +1057,16 @@ void Project::closeDatabase( const QString &connection ) // formWindows.remove( fw ); // } -QObjectList *Project::formList( bool resolveFakeObjects ) const +TQObjectList *Project::formList( bool resolveFakeObjects ) const { - QObjectList *l = new QObjectList; - for ( QPtrListIterator<FormFile> forms(formfiles); forms.current(); ++forms ) { + TQObjectList *l = new QObjectList; + for ( TQPtrListIterator<FormFile> forms(formfiles); forms.current(); ++forms ) { FormFile* f = forms.current(); if ( f->formWindow() ) { if ( resolveFakeObjects && f->formWindow()->isFake() ) l->append( objectForFakeForm( f->formWindow() ) ); else - l->append( f->formWindow()->child( 0, "QWidget" ) ); + l->append( f->formWindow()->child( 0, "TQWidget" ) ); } else if ( f->isFake() ) { l->append( objectForFakeFormFile( f ) ); } @@ -1081,7 +1081,7 @@ DesignerProject *Project::iFace() return iface; } -void Project::setLanguage( const QString &l ) +void Project::setLanguage( const TQString &l ) { if ( l == lang ) return; @@ -1091,19 +1091,19 @@ void Project::setLanguage( const QString &l ) modified = TRUE; } -QString Project::language() const +TQString Project::language() const { return lang; } -void Project::setCustomSetting( const QString &key, const QString &value ) +void Project::setCustomSetting( const TQString &key, const TQString &value ) { customSettings.remove( key ); customSettings.insert( key, value ); modified = TRUE; } -QString Project::customSetting( const QString &key ) const +TQString Project::customSetting( const TQString &key ) const { return *customSettings.find( key ); } @@ -1144,9 +1144,9 @@ void Project::addSourceFile( SourceFile *sf ) } -SourceFile* Project::findSourceFile( const QString& filename, SourceFile *ignore ) const +SourceFile* Project::findSourceFile( const TQString& filename, SourceFile *ignore ) const { - QPtrListIterator<SourceFile> it(sourcefiles); + TQPtrListIterator<SourceFile> it(sourcefiles); while ( it.current() ) { if ( it.current() != ignore && it.current()->fileName() == filename ) return it.current(); @@ -1155,9 +1155,9 @@ SourceFile* Project::findSourceFile( const QString& filename, SourceFile *ignore return 0; } -FormFile* Project::findFormFile( const QString& filename, FormFile *ignore ) const +FormFile* Project::findFormFile( const TQString& filename, FormFile *ignore ) const { - QPtrListIterator<FormFile> it(formfiles); + TQPtrListIterator<FormFile> it(formfiles); while ( it.current() ) { if ( it.current() != ignore && it.current()->fileName() == filename ) return it.current(); @@ -1166,7 +1166,7 @@ FormFile* Project::findFormFile( const QString& filename, FormFile *ignore ) con return 0; } -void Project::setIncludePath( const QString &platform, const QString &path ) +void Project::setIncludePath( const TQString &platform, const TQString &path ) { if ( inclPath[platform] == path ) return; @@ -1174,98 +1174,98 @@ void Project::setIncludePath( const QString &platform, const QString &path ) modified = TRUE; } -void Project::setLibs( const QString &platform, const QString &path ) +void Project::setLibs( const TQString &platform, const TQString &path ) { lbs.replace( platform, path ); } -void Project::setDefines( const QString &platform, const QString &path ) +void Project::setDefines( const TQString &platform, const TQString &path ) { defs.replace( platform, path ); } -void Project::setConfig( const QString &platform, const QString &config ) +void Project::setConfig( const TQString &platform, const TQString &config ) { cfg.replace( platform, config ); } -QString Project::config( const QString &platform ) const +TQString Project::config( const TQString &platform ) const { return cfg[ platform ]; } -QString Project::libs( const QString &platform ) const +TQString Project::libs( const TQString &platform ) const { return lbs[ platform ]; } -QString Project::defines( const QString &platform ) const +TQString Project::defines( const TQString &platform ) const { return defs[ platform ]; } -QString Project::includePath( const QString &platform ) const +TQString Project::includePath( const TQString &platform ) const { return inclPath[ platform ]; } -QString Project::templte() const +TQString Project::templte() const { return templ; } -void Project::setTemplate( const QString &t ) +void Project::setTemplate( const TQString &t ) { templ = t; } -void Project::readPlatformSettings( const QString &contents, - const QString &setting, - QMap<QString, QString> &res ) +void Project::readPlatformSettings( const TQString &contents, + const TQString &setting, + TQMap<TQString, TQString> &res ) { - const QString platforms[] = { "", "win32", "unix", "mac", QString::null }; - for ( int i = 0; platforms[ i ] != QString::null; ++i ) { - QString p = platforms[ i ]; + const TQString platforms[] = { "", "win32", "unix", "mac", TQString::null }; + for ( int i = 0; platforms[ i ] != TQString::null; ++i ) { + TQString p = platforms[ i ]; if ( !p.isEmpty() ) p += ":"; - QStringList lst = parse_multiline_part( contents, p + setting ); - QString s = lst.join( " " ); - QString key = platforms[ i ]; + TQStringList lst = parse_multiline_part( contents, p + setting ); + TQString s = lst.join( " " ); + TQString key = platforms[ i ]; if ( key.isEmpty() ) key = "(all)"; res.replace( key, s ); } } -void Project::removePlatformSettings( QString &contents, const QString &setting ) +void Project::removePlatformSettings( TQString &contents, const TQString &setting ) { - const QString platforms[] = { "win32", "unix", "mac", "", QString::null }; - for ( int i = 0; platforms[ i ] != QString::null; ++i ) { - QString p = platforms[ i ]; + const TQString platforms[] = { "win32", "unix", "mac", "", TQString::null }; + for ( int i = 0; platforms[ i ] != TQString::null; ++i ) { + TQString p = platforms[ i ]; if ( !p.isEmpty() ) p += ":"; remove_multiline_contents( contents, p + setting ); } } -void Project::writePlatformSettings( QString &contents, const QString &setting, - const QMap<QString, QString> &input ) +void Project::writePlatformSettings( TQString &contents, const TQString &setting, + const TQMap<TQString, TQString> &input ) { - const QString platforms[] = { "", "win32", "unix", "mac", QString::null }; + const TQString platforms[] = { "", "win32", "unix", "mac", TQString::null }; int i; LanguageInterface *iface = MetaDataBase::languageInterface( lang ); if (iface && (setting == "SOURCES" || setting == "HEADERS")) // The (all) part will be saved later on i = 1; else i = 0; - for (; platforms[ i ] != QString::null; ++i ) { - QString p = platforms[ i ]; + for (; platforms[ i ] != TQString::null; ++i ) { + TQString p = platforms[ i ]; if ( !p.isEmpty() ) p += ":"; - QString key = platforms[ i ]; + TQString key = platforms[ i ]; if ( key.isEmpty() ) key = "(all)"; - QMap<QString, QString>::ConstIterator it = input.find( key ); + TQMap<TQString, TQString>::ConstIterator it = input.find( key ); if ( it == input.end() || (*it).isEmpty() ) continue; contents += p + setting + "\t+= " + *it + "\n"; @@ -1291,29 +1291,29 @@ bool Project::removeFormFile( FormFile *ff ) return TRUE; } -void Project::addObject( QObject *o ) +void Project::addObject( TQObject *o ) { bool wasModified = modified; objs.append( o ); FormFile *ff = new FormFile( "", FALSE, this, "qt_fakewindow" ); - ff->setFileName( "__APPOBJ" + QString( o->name() ) + ".ui" ); + ff->setFileName( "__APPOBJ" + TQString( o->name() ) + ".ui" ); fakeFormFiles.insert( (void*)o, ff ); MetaDataBase::addEntry( o ); if ( hasGUI() ) { - QWidget *parent = MainWindow::self ? MainWindow::self->qWorkspace() : 0; + TQWidget *parent = MainWindow::self ? MainWindow::self->qWorkspace() : 0; FormWindow *fw = new FormWindow( ff, MainWindow::self, parent, "qt_fakewindow" ); fw->setProject( this ); - if ( QFile::exists( ff->absFileName() ) ) + if ( TQFile::exists( ff->absFileName() ) ) Resource::loadExtraSource( ff, ff->absFileName(), MetaDataBase::languageInterface( language() ), FALSE ); if ( MainWindow::self ) fw->setMainWindow( MainWindow::self ); if ( MainWindow::self ) { - QApplication::sendPostedEvents( MainWindow::self->qWorkspace(), QEvent::ChildInserted ); + TQApplication::sendPostedEvents( MainWindow::self->qWorkspace(), TQEvent::ChildInserted ); connect( fw, - SIGNAL( undoRedoChanged( bool, bool, const QString &, const QString & ) ), + TQT_SIGNAL( undoRedoChanged( bool, bool, const TQString &, const TQString & ) ), MainWindow::self, - SLOT( updateUndoRedo( bool, bool, const QString &, const QString & ) ) + TQT_SLOT( updateUndoRedo( bool, bool, const TQString &, const TQString & ) ) ); } if ( fw->parentWidget() ) { @@ -1321,7 +1321,7 @@ void Project::addObject( QObject *o ) fw->show(); } } else { - if ( QFile::exists( ff->absFileName() ) ) + if ( TQFile::exists( ff->absFileName() ) ) Resource::loadExtraSource( ff, ff->absFileName(), MetaDataBase::languageInterface( language() ), FALSE ); } @@ -1329,13 +1329,13 @@ void Project::addObject( QObject *o ) modified = wasModified; } -void Project::setObjects( const QObjectList &ol ) +void Project::setObjects( const TQObjectList &ol ) { - for ( QObjectListIt it( ol ); it.current(); ++it ) + for ( TQObjectListIt it( ol ); it.current(); ++it ) addObject( it.current() ); } -void Project::removeObject( QObject *o ) +void Project::removeObject( TQObject *o ) { bool wasModified = modified; objs.removeRef( o ); @@ -1345,31 +1345,31 @@ void Project::removeObject( QObject *o ) modified = wasModified; } -QObjectList Project::objects() const +TQObjectList Project::objects() const { return objs; } -FormFile *Project::fakeFormFileFor( QObject *o ) const +FormFile *Project::fakeFormFileFor( TQObject *o ) const { return fakeFormFiles.find( (void*)o ); } -QObject *Project::objectForFakeForm( FormWindow *fw ) const +TQObject *Project::objectForFakeForm( FormWindow *fw ) const { - for ( QPtrDictIterator<FormFile> it( fakeFormFiles ); it.current(); ++it ) { + for ( TQPtrDictIterator<FormFile> it( fakeFormFiles ); it.current(); ++it ) { if ( it.current()->formWindow() == fw || it.current() == fw->formFile() ) - return (QObject*)it.currentKey(); + return (TQObject*)it.currentKey(); } return 0; } -QObject *Project::objectForFakeFormFile( FormFile *ff ) const +TQObject *Project::objectForFakeFormFile( FormFile *ff ) const { - for ( QPtrDictIterator<FormFile> it( fakeFormFiles ); it.current(); ++it ) { + for ( TQPtrDictIterator<FormFile> it( fakeFormFiles ); it.current(); ++it ) { if ( it.current() == ff ) - return (QObject*)it.currentKey(); + return (TQObject*)it.currentKey(); } return 0; } @@ -1378,45 +1378,45 @@ void Project::removeTempProject() { if ( !singleProjectMode() ) return; - QDir d( QFileInfo( filename ).dirPath() ); - if ( !d.exists( QFileInfo( filename ).dirPath() ) ) + TQDir d( TQFileInfo( filename ).dirPath() ); + if ( !d.exists( TQFileInfo( filename ).dirPath() ) ) return; - QStringList files = d.entryList( QDir::Files ); - QStringList::Iterator it; + TQStringList files = d.entryList( TQDir::Files ); + TQStringList::Iterator it; for ( it = files.begin(); it != files.end(); ++it ) { d.remove( *it ); } - if ( d.exists( QFileInfo( filename ).dirPath() + "/images" ) ) { - d = QDir( QFileInfo( filename ).dirPath() + "/images" ); - files = d.entryList( QDir::Files ); + if ( d.exists( TQFileInfo( filename ).dirPath() + "/images" ) ) { + d = TQDir( TQFileInfo( filename ).dirPath() + "/images" ); + files = d.entryList( TQDir::Files ); for ( it = files.begin(); it != files.end(); ++it ) d.remove( *it ); - d = QDir( QFileInfo( filename ).dirPath() ); + d = TQDir( TQFileInfo( filename ).dirPath() ); d.remove( "images" ); } - d.remove( QFileInfo( filename ).dirPath() ); + d.remove( TQFileInfo( filename ).dirPath() ); #if defined(Q_OS_UNIX) // ##### implement for all platforms, ideally should be in Qt - ::rmdir( QFile::encodeName( d.absPath() ) ); + ::rmdir( TQFile::encodeName( d.absPath() ) ); #endif } -void Project::addAndEditFunction( const QString &function, const QString &functionBody, bool openDeveloper ) +void Project::addAndEditFunction( const TQString &function, const TQString &functionBody, bool openDeveloper ) { for ( SourceFile *f = sourcefiles.first(); f; f = sourcefiles.next() ) { - if ( QFileInfo( f->fileName() ).baseName() == "main" ) { - QValueList<LanguageInterface::Function> funcs; + if ( TQFileInfo( f->fileName() ).baseName() == "main" ) { + TQValueList<LanguageInterface::Function> funcs; LanguageInterface *iface = MetaDataBase::languageInterface( language() ); if ( !iface ) return; iface->functions( f->text(), &funcs ); - QString func = function; + TQString func = function; int i = func.find( '(' ); if ( i != -1 ) func = func.left( i ); bool found = FALSE; - for ( QValueList<LanguageInterface::Function>::Iterator it = funcs.begin(); + for ( TQValueList<LanguageInterface::Function>::Iterator it = funcs.begin(); it != funcs.end(); ++it ) { if ( (*it).name.left( (*it).name.find( '(' ) ) == func ) { found = TRUE; @@ -1425,7 +1425,7 @@ void Project::addAndEditFunction( const QString &function, const QString &functi } if ( !found ) { - QString code = f->text(); + TQString code = f->text(); if ( functionBody.isEmpty() ) code += "\n\n" + iface->createFunctionStart( "", func, "", "" ) + "()\n{\n\n}\n"; else @@ -1447,22 +1447,22 @@ void Project::addAndEditFunction( const QString &function, const QString &functi } } -bool Project::hasParentObject( QObject *o ) +bool Project::hasParentObject( TQObject *o ) { - for ( QObject *p = objs.first(); p; p = objs.next() ) { - QObject *c = p->child( o->name(), o->className() ); + for ( TQObject *p = objs.first(); p; p = objs.next() ) { + TQObject *c = p->child( o->name(), o->className() ); if ( c ) return TRUE; } return FALSE; } -QString Project::qualifiedName( QObject *o ) +TQString Project::qualifiedName( TQObject *o ) { - QString name = o->name(); - QObject *p = o->parent(); + TQString name = o->name(); + TQObject *p = o->parent(); while ( p ) { - name.prepend( QString( p->name() ) + "." ); + name.prepend( TQString( p->name() ) + "." ); if ( objs.findRef( p ) != -1 ) break; p = p->parent(); @@ -1475,7 +1475,7 @@ bool Project::singleProjectMode() const return !MainWindow::self || MainWindow::self->singleProjectMode(); } -QWidget *Project::messageBoxParent() const +TQWidget *Project::messageBoxParent() const { return MainWindow::self; } @@ -1487,13 +1487,13 @@ void Project::designerCreated() if ( !fw || fw->mainWindow() ) continue; fw->setMainWindow( MainWindow::self ); - connect( fw, SIGNAL( undoRedoChanged( bool, bool, const QString &, - const QString & ) ), - MainWindow::self, SLOT( updateUndoRedo( bool, bool, - const QString &, const QString & ) ) ); - fw->reparent( MainWindow::self->qWorkspace(), QPoint( 0, 0 ), FALSE ); - QApplication::sendPostedEvents( MainWindow::self->qWorkspace(), - QEvent::ChildInserted ); + connect( fw, TQT_SIGNAL( undoRedoChanged( bool, bool, const TQString &, + const TQString & ) ), + MainWindow::self, TQT_SLOT( updateUndoRedo( bool, bool, + const TQString &, const TQString & ) ) ); + fw->reparent( MainWindow::self->qWorkspace(), TQPoint( 0, 0 ), FALSE ); + TQApplication::sendPostedEvents( MainWindow::self->qWorkspace(), + TQEvent::ChildInserted ); fw->parentWidget()->setFixedSize( 1, 1 ); fw->show(); } @@ -1506,26 +1506,26 @@ void Project::formOpened( FormWindow *fw ) emit newFormOpened( fw ); } -QString Project::locationOfObject( QObject *o ) +TQString Project::locationOfObject( TQObject *o ) { if ( !o ) - return QString::null; + return TQString::null; if ( MainWindow::self ) { - QWidgetList windows = MainWindow::self->qWorkspace()->windowList(); - for ( QWidget *w = windows.first(); w; w = windows.next() ) { + TQWidgetList windows = MainWindow::self->qWorkspace()->windowList(); + for ( TQWidget *w = windows.first(); w; w = windows.next() ) { FormWindow *fw = ::qt_cast<FormWindow*>(w); SourceEditor *se = ::qt_cast<SourceEditor*>(w); if ( fw ) { if ( fw->isFake() ) - return objectForFakeForm( fw )->name() + QString( " [Source]" ); + return objectForFakeForm( fw )->name() + TQString( " [Source]" ); else - return fw->name() + QString( " [Source]" ); + return fw->name() + TQString( " [Source]" ); } else if ( se ) { if ( !se->object() ) continue; if ( se->formWindow() ) - return se->formWindow()->name() + QString( " [Source]" ); + return se->formWindow()->name() + TQString( " [Source]" ); else return makeRelative( se->sourceFile()->fileName() ); } @@ -1533,7 +1533,7 @@ QString Project::locationOfObject( QObject *o ) } if ( ::qt_cast<SourceFile*>(o) ) { - for ( QPtrListIterator<SourceFile> sources = sourceFiles(); + for ( TQPtrListIterator<SourceFile> sources = sourceFiles(); sources.current(); ++sources ) { SourceFile* f = sources.current(); if ( f == o ) @@ -1541,18 +1541,18 @@ QString Project::locationOfObject( QObject *o ) } } - extern QMap<QWidget*, QString> *qwf_forms; + extern TQMap<TQWidget*, TQString> *qwf_forms; if ( !qwf_forms ) { qWarning( "Project::locationOfObject: qwf_forms is NULL!" ); - return QString::null; + return TQString::null; } - QString s = makeRelative( *qwf_forms->find( (QWidget*)o ) ); + TQString s = makeRelative( *qwf_forms->find( (TQWidget*)o ) ); s += " [Source]"; return s; } bool Project::hasGUI() const { - return qApp->type() != QApplication::Tty; + return qApp->type() != TQApplication::Tty; } |