summaryrefslogtreecommitdiffstats
path: root/kdevdesigner/designer/formfile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kdevdesigner/designer/formfile.cpp')
-rw-r--r--kdevdesigner/designer/formfile.cpp180
1 files changed, 90 insertions, 90 deletions
diff --git a/kdevdesigner/designer/formfile.cpp b/kdevdesigner/designer/formfile.cpp
index cde7eb8b..e65ed706 100644
--- a/kdevdesigner/designer/formfile.cpp
+++ b/kdevdesigner/designer/formfile.cpp
@@ -34,22 +34,22 @@
#include "../interfaces/languageinterface.h"
#include "resource.h"
#include "workspace.h"
-#include <qmessagebox.h>
-#include <qfile.h>
-#include <qstatusbar.h>
+#include <tqmessagebox.h>
+#include <tqfile.h>
+#include <tqstatusbar.h>
#include "propertyeditor.h"
-#include <qworkspace.h>
+#include <tqworkspace.h>
#include <stdlib.h>
#include "designerappiface.h"
-#include <qapplication.h>
+#include <tqapplication.h>
#include <kfiledialog.h>
#include <klocale.h>
#include "kdevdesigner_part.h"
-static QString make_func_pretty( const QString &s )
+static TQString make_func_pretty( const TQString &s )
{
- QString res = s;
+ TQString res = s;
if ( res.find( ")" ) - res.find( "(" ) == 1 )
return res;
res.replace( "(", "( " );
@@ -64,7 +64,7 @@ static QString make_func_pretty( const QString &s )
return res;
}
-FormFile::FormFile( const QString &fn, bool temp, Project *p, const char *name )
+FormFile::FormFile( const TQString &fn, bool temp, Project *p, const char *name )
: filename( fn ), fileNameTemp( temp ), pro( p ), fw( 0 ), ed( 0 ),
timeStamp( 0, fn + codeExtension() ), codeEdited( FALSE ), pkg( FALSE ),
cm( FALSE ), codeFileStat( None )
@@ -77,7 +77,7 @@ FormFile::FormFile( const QString &fn, bool temp, Project *p, const char *name )
if ( !temp )
checkFileName( FALSE );
- connect(this, SIGNAL(somethingChanged(FormFile* )), this, SLOT(emitNewStatus(FormFile* )));
+ connect(this, TQT_SIGNAL(somethingChanged(FormFile* )), this, TQT_SLOT(emitNewStatus(FormFile* )));
}
FormFile::~FormFile()
@@ -97,7 +97,7 @@ void FormFile::setFormWindow( FormWindow *f )
if ( fw )
fw->setFormFile( this );
parseCode( cod, FALSE );
- QTimer::singleShot( 0, this, SLOT( notifyFormWindowChange() ) );
+ TQTimer::singleShot( 0, this, TQT_SLOT( notifyFormWindowChange() ) );
}
void FormFile::setEditor( SourceEditor *e )
@@ -105,7 +105,7 @@ void FormFile::setEditor( SourceEditor *e )
ed = e;
}
-void FormFile::setFileName( const QString &fn )
+void FormFile::setFileName( const TQString &fn )
{
if ( fn == filename )
return;
@@ -123,7 +123,7 @@ void FormFile::setFileName( const QString &fn )
loadCode();
}
-void FormFile::setCode( const QString &c )
+void FormFile::setCode( const TQString &c )
{
cod = c;
}
@@ -138,25 +138,25 @@ SourceEditor *FormFile::editor() const
return ed;
}
-QString FormFile::fileName() const
+TQString FormFile::fileName() const
{
return filename;
}
-QString FormFile::absFileName() const
+TQString FormFile::absFileName() const
{
return pro->makeAbsolute( filename );
}
-QString FormFile::codeFile() const
+TQString FormFile::codeFile() const
{
- QString codeExt = codeExtension();
+ TQString codeExt = codeExtension();
if ( codeExt.isEmpty() )
return "";
return filename + codeExt;
}
-QString FormFile::code()
+TQString FormFile::code()
{
return cod;
}
@@ -176,22 +176,22 @@ bool FormFile::save( bool withMsgBox, bool ignoreModified )
return FALSE;
}
- if ( QFile::exists( pro->makeAbsolute( filename ) ) ) {
- QString fn( pro->makeAbsolute( filename ) );
+ if ( TQFile::exists( pro->makeAbsolute( filename ) ) ) {
+ TQString fn( pro->makeAbsolute( filename ) );
#if defined(Q_OS_WIN32)
fn += ".bak";
#else
fn += "~";
#endif
- QFile f( pro->makeAbsolute( filename ) );
+ TQFile f( pro->makeAbsolute( filename ) );
if ( f.open( IO_ReadOnly ) ) {
- QFile f2( fn );
+ TQFile f2( fn );
if ( f2.open( IO_WriteOnly | IO_Translate ) ) {
- QCString data( f.size() );
+ TQCString data( f.size() );
f.readBlock( data.data(), f.size() );
f2.writeBlock( data );
} else {
- QMessageBox::warning( MainWindow::self, i18n( "Save" ),
+ TQMessageBox::warning( MainWindow::self, i18n( "Save" ),
i18n( "The file %1 could not be saved" ).arg( codeFile() ) );
}
}
@@ -199,22 +199,22 @@ bool FormFile::save( bool withMsgBox, bool ignoreModified )
}
if ( isModified( WFormCode ) ) {
- if ( QFile::exists( pro->makeAbsolute( codeFile() ) ) ) {
- QString fn( pro->makeAbsolute( codeFile() ) );
+ if ( TQFile::exists( pro->makeAbsolute( codeFile() ) ) ) {
+ TQString fn( pro->makeAbsolute( codeFile() ) );
#if defined(Q_OS_WIN32)
fn += ".bak";
#else
fn += "~";
#endif
- QFile f( pro->makeAbsolute( codeFile() ) );
+ TQFile f( pro->makeAbsolute( codeFile() ) );
if ( f.open( IO_ReadOnly ) ) {
- QFile f2( fn );
+ TQFile f2( fn );
if ( f2.open( IO_WriteOnly | IO_Translate) ) {
- QCString data( f.size() );
+ TQCString data( f.size() );
f.readBlock( data.data(), f.size() );
f2.writeBlock( data );
- } else if ( qApp->type() != QApplication::Tty ) {
- QMessageBox::warning( MainWindow::self, i18n( "Save" ),
+ } else if ( qApp->type() != TQApplication::Tty ) {
+ TQMessageBox::warning( MainWindow::self, i18n( "Save" ),
i18n( "The file %1 could not be saved" ).arg( codeFile() ) );
}
}
@@ -246,19 +246,19 @@ bool FormFile::save( bool withMsgBox, bool ignoreModified )
bool FormFile::saveAs( bool ignoreModified )
{
- QString f = pro->makeAbsolute( fileName() );
+ TQString f = pro->makeAbsolute( fileName() );
if ( fileNameTemp && formWindow() ) {
- f = QString( formWindow()->name() ).lower();
+ f = TQString( formWindow()->name() ).lower();
f.replace( "::", "_" );
f = pro->makeAbsolute( f + ".ui" );
}
bool saved = FALSE;
if ( ignoreModified ) {
- QString dir = QStringList::split( ':', pro->iFace()->customSetting( "QTSCRIPT_PACKAGES" ) ).first();
- f = QFileInfo( f ).fileName();
+ TQString dir = TQStringList::split( ':', pro->iFace()->customSetting( "QTSCRIPT_PACKAGES" ) ).first();
+ f = TQFileInfo( f ).fileName();
f.prepend( dir + "/" );
}
- QString fn;
+ TQString fn;
while ( !saved ) {
fn = KFileDialog::getSaveFileName( f,
i18n( "*.ui|Qt User-Interface Files" ) + "\n" +
@@ -267,17 +267,17 @@ bool FormFile::saveAs( bool ignoreModified )
MainWindow::self ? &MainWindow::self->lastSaveFilter : 0*/ );
if ( fn.isEmpty() )
return FALSE;
- QFileInfo fi( fn );
+ TQFileInfo fi( fn );
if ( fi.extension() != "ui" )
fn += ".ui";
fileNameTemp = FALSE;
filename = pro->makeRelative( fn );
- QFileInfo relfi( filename );
+ TQFileInfo relfi( filename );
if ( relfi.exists() ) {
- if ( QMessageBox::warning( MainWindow::self, i18n( "File Already Exists" ),
+ if ( TQMessageBox::warning( MainWindow::self, i18n( "File Already Exists" ),
i18n( "The file already exists. Do you wish to overwrite it?" ),
- QMessageBox::Yes,
- QMessageBox::No ) == QMessageBox::Yes ) {
+ TQMessageBox::Yes,
+ TQMessageBox::No ) == TQMessageBox::Yes ) {
saved = TRUE;
} else {
filename = f;
@@ -325,7 +325,7 @@ bool FormFile::closeEvent()
if ( editor() )
editor()->save();
- switch ( QMessageBox::warning( MainWindow::self, i18n( "Save Form" ),
+ switch ( TQMessageBox::warning( MainWindow::self, i18n( "Save Form" ),
i18n( "Save changes to form '%1'?" ).arg( filename ),
i18n( "&Yes" ), i18n( "&No" ), i18n( "&Cancel" ), 0, 2 ) ) {
case 0: // save
@@ -437,7 +437,7 @@ bool FormFile::setupUihFile( bool askForUih )
}
if ( codeFileStat != FormFile::Ok && !ed ) {
if ( hasFormCode() ) {
- int i = QMessageBox::information( MainWindow::self, i18n( "Using ui.h File" ),
+ int i = TQMessageBox::information( MainWindow::self, i18n( "Using ui.h File" ),
i18n( "An \"ui.h\" file for this form already exists.\n"
"Do you want to use it or create a new one?" ),
i18n( "Use Existing" ), i18n( "Create New" ),
@@ -447,9 +447,9 @@ bool FormFile::setupUihFile( bool askForUih )
if ( i == 1 )
createFormCode();
} else {
- if ( QMessageBox::Yes != QMessageBox::information( MainWindow::self, i18n( "Creating ui.h file" ),
+ if ( TQMessageBox::Yes != TQMessageBox::information( MainWindow::self, i18n( "Creating ui.h file" ),
i18n( "Do you want to create an new \"ui.h\" file?" ),
- QMessageBox::Yes, QMessageBox::No ) )
+ TQMessageBox::Yes, TQMessageBox::No ) )
return FALSE;
createFormCode();
}
@@ -474,12 +474,12 @@ SourceEditor *FormFile::showEditor( bool askForUih )
}
static int ui_counter = 0;
-QString FormFile::createUnnamedFileName()
+TQString FormFile::createUnnamedFileName()
{
- return QString( "unnamed" ) + QString::number( ++ui_counter ) + QString( ".ui" );
+ return TQString( "unnamed" ) + TQString::number( ++ui_counter ) + TQString( ".ui" );
}
-QString FormFile::codeExtension() const
+TQString FormFile::codeExtension() const
{
LanguageInterface *iface = MetaDataBase::languageInterface( pro->language() );
if ( iface )
@@ -487,9 +487,9 @@ QString FormFile::codeExtension() const
return "";
}
-QString FormFile::codeComment() const
+TQString FormFile::codeComment() const
{
- return QString( "/****************************************************************************\n"
+ return TQString( "/****************************************************************************\n"
"** ui.h extension file, included from the uic-generated form implementation.\n"
"**\n"
"** If you want to add, delete, or rename functions or slots, use\n"
@@ -504,7 +504,7 @@ QString FormFile::codeComment() const
bool FormFile::hasFormCode() const
{
- return !cod.isEmpty() && cod != QString( codeComment() );
+ return !cod.isEmpty() && cod != TQString( codeComment() );
}
int FormFile::codeFileState() const
@@ -526,12 +526,12 @@ void FormFile::createFormCode()
return;
if ( pro->isCpp() )
cod = codeComment();
- QValueList<MetaDataBase::Function> functionList = MetaDataBase::functionList( formWindow() );
- for ( QValueList<MetaDataBase::Function>::Iterator it = functionList.begin(); it != functionList.end(); ++it ) {
+ TQValueList<MetaDataBase::Function> functionList = MetaDataBase::functionList( formWindow() );
+ for ( TQValueList<MetaDataBase::Function>::Iterator it = functionList.begin(); it != functionList.end(); ++it ) {
cod += (!cod.isEmpty() ? "\n\n" : "") +
iface->createFunctionStart( formWindow()->name(), make_func_pretty((*it).function),
(*it).returnType.isEmpty() ?
- QString( "void" ) :
+ TQString( "void" ) :
(*it).returnType, (*it).access ) +
"\n" + iface->createEmptyFunction();
}
@@ -546,13 +546,13 @@ void FormFile::load()
bool FormFile::loadCode()
{
- QFile f( pro->makeAbsolute( codeFile() ) );
+ TQFile f( pro->makeAbsolute( codeFile() ) );
if ( !f.open( IO_ReadOnly ) ) {
cod = "";
setCodeFileState( FormFile::None );
return FALSE;
}
- QTextStream ts( &f );
+ TQTextStream ts( &f );
cod = ts.read();
parseCode( cod, FALSE );
if ( hasFormCode() && codeFileStat != FormFile::Ok )
@@ -571,24 +571,24 @@ void FormFile::setCodeEdited( bool b )
codeEdited = b;
}
-void FormFile::parseCode( const QString &txt, bool allowModify )
+void FormFile::parseCode( const TQString &txt, bool allowModify )
{
if ( !formWindow() )
return;
LanguageInterface *iface = MetaDataBase::languageInterface( pro->language() );
if ( !iface )
return;
- QValueList<LanguageInterface::Function> functions;
- QValueList<MetaDataBase::Function> newFunctions, oldFunctions;
+ TQValueList<LanguageInterface::Function> functions;
+ TQValueList<MetaDataBase::Function> newFunctions, oldFunctions;
oldFunctions = MetaDataBase::functionList( formWindow() );
iface->functions( txt, &functions );
- QMap<QString, QString> funcs;
- for ( QValueList<LanguageInterface::Function>::Iterator it = functions.begin();
+ TQMap<TQString, TQString> funcs;
+ for ( TQValueList<LanguageInterface::Function>::Iterator it = functions.begin();
it != functions.end(); ++it ) {
bool found = FALSE;
- for ( QValueList<MetaDataBase::Function>::Iterator fit = oldFunctions.begin();
+ for ( TQValueList<MetaDataBase::Function>::Iterator fit = oldFunctions.begin();
fit != oldFunctions.end(); ++fit ) {
- QString f( (*fit).function );
+ TQString f( (*fit).function );
if ( MetaDataBase::normalizeFunction( f ) ==
MetaDataBase::normalizeFunction( (*it).name ) ) {
found = TRUE;
@@ -651,13 +651,13 @@ void FormFile::checkTimeStamp()
return;
timeStamp.update();
if ( codeEdited ) {
- if ( QMessageBox::information( MainWindow::self, i18n( "Qt Designer" ),
+ if ( TQMessageBox::information( MainWindow::self, i18n( "Qt Designer" ),
i18n( "File '%1' has been changed outside Qt Designer.\n"
"Do you want to reload it?" ).arg( timeStamp.fileName() ),
i18n( "&Yes" ), i18n( "&No" ) ) == 0 ) {
- QFile f( timeStamp.fileName() );
+ TQFile f( timeStamp.fileName() );
if ( f.open( IO_ReadOnly ) ) {
- QTextStream ts( &f );
+ TQTextStream ts( &f );
editor()->editorInterface()->setText( ts.read() );
editor()->save();
if ( MainWindow::self )
@@ -690,10 +690,10 @@ void FormFile::addFunctionCode( MetaDataBase::Function function )
if ( !iface )
return;
- QValueList<LanguageInterface::Function> funcs;
+ TQValueList<LanguageInterface::Function> funcs;
iface->functions( cod, &funcs );
bool hasFunc = FALSE;
- for ( QValueList<LanguageInterface::Function>::Iterator it = funcs.begin();
+ for ( TQValueList<LanguageInterface::Function>::Iterator it = funcs.begin();
it != funcs.end(); ++it ) {
if ( MetaDataBase::normalizeFunction( (*it).name ) == MetaDataBase::normalizeFunction( function.function ) ) {
hasFunc = TRUE;
@@ -705,15 +705,15 @@ void FormFile::addFunctionCode( MetaDataBase::Function function )
if ( !codeEdited && !timeStamp.isUpToDate() )
loadCode();
MetaDataBase::MetaInfo mi = MetaDataBase::metaInfo( formWindow() );
- QString cn;
+ TQString cn;
if ( mi.classNameChanged )
cn = mi.className;
if ( cn.isEmpty() )
cn = formWindow()->name();
- QString body = "\n\n" + iface->createFunctionStart( cn,
+ TQString body = "\n\n" + iface->createFunctionStart( cn,
make_func_pretty( function.function ),
function.returnType.isEmpty() ?
- QString( "void" ) :
+ TQString( "void" ) :
function.returnType, function.access ) +
"\n" + iface->createEmptyFunction();
cod += body;
@@ -734,13 +734,13 @@ void FormFile::removeFunctionCode( MetaDataBase::Function function )
return;
checkTimeStamp();
- QString sourceCode = code();
+ TQString sourceCode = code();
if ( sourceCode.isEmpty() )
return;
- QValueList<LanguageInterface::Function> functions;
+ TQValueList<LanguageInterface::Function> functions;
iface->functions( sourceCode, &functions );
- QString fu = MetaDataBase::normalizeFunction( function.function );
- for ( QValueList<LanguageInterface::Function>::Iterator fit = functions.begin(); fit != functions.end(); ++fit ) {
+ TQString fu = MetaDataBase::normalizeFunction( function.function );
+ for ( TQValueList<LanguageInterface::Function>::Iterator fit = functions.begin(); fit != functions.end(); ++fit ) {
if ( MetaDataBase::normalizeFunction( (*fit).name ) == fu ) {
int line = 0;
int start = 0;
@@ -773,10 +773,10 @@ void FormFile::removeFunctionCode( MetaDataBase::Function function )
}
}
-void FormFile::functionNameChanged( const QString &oldName, const QString &newName )
+void FormFile::functionNameChanged( const TQString &oldName, const TQString &newName )
{
if ( !cod.isEmpty() ) {
- QString funcStart = QString( formWindow()->name() ) + QString( "::" );
+ TQString funcStart = TQString( formWindow()->name() ) + TQString( "::" );
int i = cod.find( funcStart + oldName );
if ( i != -1 ) {
cod.remove( i + funcStart.length(), oldName.length() );
@@ -785,11 +785,11 @@ void FormFile::functionNameChanged( const QString &oldName, const QString &newNa
}
}
-void FormFile::functionRetTypeChanged( const QString &fuName, const QString &oldType, const QString &newType )
+void FormFile::functionRetTypeChanged( const TQString &fuName, const TQString &oldType, const TQString &newType )
{
if ( !cod.isEmpty() ) {
- QString oldFunct = oldType + " " + QString( formWindow()->name() ) + "::" + fuName;
- QString newFunct = newType + " " + QString( formWindow()->name() ) + "::" + fuName;
+ TQString oldFunct = oldType + " " + TQString( formWindow()->name() ) + "::" + fuName;
+ TQString newFunct = newType + " " + TQString( formWindow()->name() ) + "::" + fuName;
int i = cod.find( oldFunct );
if ( i != -1 ) {
@@ -799,7 +799,7 @@ void FormFile::functionRetTypeChanged( const QString &fuName, const QString &old
}
}
-QString FormFile::formName() const
+TQString FormFile::formName() const
{
FormFile* that = (FormFile*) this;
if ( formWindow() ) {
@@ -808,11 +808,11 @@ QString FormFile::formName() const
}
if ( !cachedFormName.isNull() )
return cachedFormName;
- QFile f( pro->makeAbsolute( filename ) );
+ TQFile f( pro->makeAbsolute( filename ) );
if ( f.open( IO_ReadOnly ) ) {
- QTextStream ts( &f );
- QString line;
- QString className;
+ TQTextStream ts( &f );
+ TQString line;
+ TQString className;
while ( !ts.eof() ) {
line = ts.readLine();
if ( !className.isEmpty() ) {
@@ -852,11 +852,11 @@ bool FormFile::checkFileName( bool allowBreak )
{
FormFile *ff = pro->findFormFile( filename, this );
if ( ff )
- QMessageBox::warning( MainWindow::self, i18n( "Invalid Filename" ),
+ TQMessageBox::warning( MainWindow::self, i18n( "Invalid Filename" ),
i18n( "The project already contains a form with a\n"
"filename of '%1'. Please choose a new filename." ).arg( filename ) );
while ( ff ) {
- QString fn;
+ TQString fn;
while ( fn.isEmpty() ) {
fn = KFileDialog::getSaveFileName( pro->makeAbsolute( fileName() ),
i18n( "*.ui|Qt User-Interface Files" ) + "\n" +
@@ -873,8 +873,8 @@ bool FormFile::checkFileName( bool allowBreak )
return TRUE;
}
-void FormFile::addConnection( const QString &sender, const QString &signal,
- const QString &receiver, const QString &slot )
+void FormFile::addConnection( const TQString &sender, const TQString &signal,
+ const TQString &receiver, const TQString &slot )
{
LanguageInterface *iface = MetaDataBase::languageInterface( pro->language() );
if ( iface )
@@ -883,8 +883,8 @@ void FormFile::addConnection( const QString &sender, const QString &signal,
ed->editorInterface()->setText( cod );
}
-void FormFile::removeConnection( const QString &sender, const QString &signal,
- const QString &receiver, const QString &slot )
+void FormFile::removeConnection( const TQString &sender, const TQString &signal,
+ const TQString &receiver, const TQString &slot )
{
LanguageInterface *iface = MetaDataBase::languageInterface( pro->language() );
if ( iface )