summaryrefslogtreecommitdiffstats
path: root/kode/kodemain.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:53:50 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:53:50 +0000
commit7be55ffa061c026e35e2d6a0effe1161ddb0d41f (patch)
tree8474f9b444b2756228600050f07a7ff25de532b2 /kode/kodemain.cpp
parentf587f20a6d09f1729dd0a8c1cd8ee0110aec7451 (diff)
downloadtdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.tar.gz
tdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1157655 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kode/kodemain.cpp')
-rw-r--r--kode/kodemain.cpp118
1 files changed, 59 insertions, 59 deletions
diff --git a/kode/kodemain.cpp b/kode/kodemain.cpp
index a567f20a..e248a93a 100644
--- a/kode/kodemain.cpp
+++ b/kode/kodemain.cpp
@@ -39,10 +39,10 @@
#include <ksavefile.h>
#include <kprocess.h>
-#include <qfile.h>
-#include <qtextstream.h>
-#include <qfileinfo.h>
-#include <qregexp.h>
+#include <tqfile.h>
+#include <tqtextstream.h>
+#include <tqfileinfo.h>
+#include <tqregexp.h>
#include <iostream>
@@ -73,15 +73,15 @@ static const KCmdLineOptions options[] =
KCmdLineLastOption
};
-void addPropertyFunctions( QString &out, const QString &type,
- const QString &name )
+void addPropertyFunctions( TQString &out, const TQString &type,
+ const TQString &name )
{
// FIXME: Use KODE::Function
bool isReference = type.endsWith( "*" ) || type.endsWith( "&" );
- QString argument;
- QString upper = KODE::Style::upperFirst( name );
+ TQString argument;
+ TQString upper = KODE::Style::upperFirst( name );
if ( !isReference ) {
argument = "const " + type + " &";
} else argument = type;
@@ -107,10 +107,10 @@ void addPropertyFunctions( QString &out, const QString &type,
out += code.text();
}
-void addPropertyVariable( QString &out, const QString &type,
- const QString &name )
+void addPropertyVariable( TQString &out, const TQString &type,
+ const TQString &name )
{
- QString upper = KODE::Style::upperFirst( name );
+ TQString upper = KODE::Style::upperFirst( name );
bool isReference = type.endsWith( "*" ) || type.endsWith( "&" );
KODE::Code code;
@@ -129,68 +129,68 @@ int addProperty( KCmdLineArgs *args )
return 1;
}
- QString className = args->arg( 0 );
- QString type = args->arg( 1 );
- QString name = args->arg( 2 );
+ TQString className = args->arg( 0 );
+ TQString type = args->arg( 1 );
+ TQString name = args->arg( 2 );
kdDebug() << "Add property: class " << className << ": " << type << " " <<
name << endl;
- QString headerFileName = className.lower() + ".h";
+ TQString headerFileName = className.lower() + ".h";
- QFile headerFile( headerFileName );
+ TQFile headerFile( headerFileName );
if ( !headerFile.open( IO_ReadOnly ) ) {
std::cerr << "Unable to open file '" << headerFileName.utf8() << "'" <<
std::endl;
return 1;
}
- QTextStream in( &headerFile );
+ TQTextStream in( &headerFile );
enum State { FindClass, FindConstructor, FindProperties, FindPrivate,
FindVariables, Finish };
State state = FindClass;
- QString accessor;
- QString mutator;
+ TQString accessor;
+ TQString mutator;
- QString out;
+ TQString out;
- QString readAhead;
+ TQString readAhead;
- QString line;
+ TQString line;
while ( !( line = in.readLine() ).isNull() ) {
// std::cout << line.utf8() << std::endl;
kdDebug() << state << " LINE: " << line << endl;
- QString readAheadPrevious = readAhead;
+ TQString readAheadPrevious = readAhead;
readAhead += line + "\n";
// out += line + "\n";
switch( state ) {
case FindClass:
-// if ( line.find( QRegExp( className ) ) >= 0 ) {
- if ( line.find( QRegExp( "^\\s*class\\s+" + className ) ) >= 0 ) {
+// if ( line.find( TQRegExp( className ) ) >= 0 ) {
+ if ( line.find( TQRegExp( "^\\s*class\\s+" + className ) ) >= 0 ) {
kdDebug() << " FOUND CLASS" << endl;
state = FindConstructor;
}
break;
case FindConstructor:
- if ( line.find( QRegExp( "^\\s*" + className + "\\s*\\(" ) ) >= 0 ) {
+ if ( line.find( TQRegExp( "^\\s*" + className + "\\s*\\(" ) ) >= 0 ) {
kdDebug() << " FOUND CONSTRUCTOR" << endl;
out += readAhead;
- readAhead = QString::null;
+ readAhead = TQString::null;
state = FindProperties;
}
break;
case FindProperties:
{
- QRegExp re( "(\\w+)\\s*\\(" );
+ TQRegExp re( "(\\w+)\\s*\\(" );
if ( re.search( line ) >= 0 ) {
- QString function = re.cap( 1 ).lower();
+ TQString function = re.cap( 1 ).lower();
if ( !function.isEmpty() ) {
kdDebug() << "Function: " << function << endl;
if ( function == className || function == "~" + className ) {
out += readAhead;
- readAhead = QString::null;
+ readAhead = TQString::null;
} else {
if ( function.startsWith( "set" ) ) {
mutator = function.mid( 3 );
@@ -200,7 +200,7 @@ int addProperty( KCmdLineArgs *args )
accessor = function;
kdDebug() << "ACCESSOR: " << accessor << endl;
out += readAhead;
- readAhead = QString::null;
+ readAhead = TQString::null;
} else {
kdDebug() << "CREATE PROPERTY" << endl;
out += readAheadPrevious;
@@ -212,13 +212,13 @@ int addProperty( KCmdLineArgs *args )
}
}
}
- } else if ( line.find( QRegExp( "\\s*protected" ) ) >= 0 ) {
+ } else if ( line.find( TQRegExp( "\\s*protected" ) ) >= 0 ) {
state = FindPrivate;
- } else if ( line.find( QRegExp( "\\s*private" ) ) >= 0 ) {
+ } else if ( line.find( TQRegExp( "\\s*private" ) ) >= 0 ) {
if ( accessor.isEmpty() ) {
addPropertyFunctions( out, type, name );
out += readAhead;
- readAhead = QString::null;
+ readAhead = TQString::null;
addPropertyVariable( out, type, name );
state = Finish;
} else {
@@ -227,7 +227,7 @@ int addProperty( KCmdLineArgs *args )
addPropertyFunctions( out, type, name );
out += "\n";
out += line + "\n";
- readAhead = QString::null;
+ readAhead = TQString::null;
}
state = FindVariables;
}
@@ -235,10 +235,10 @@ int addProperty( KCmdLineArgs *args )
}
break;
case FindPrivate:
- if ( line.find( QRegExp( "\\s*private" ) ) >= 0 ) {
+ if ( line.find( TQRegExp( "\\s*private" ) ) >= 0 ) {
if ( accessor.isEmpty() ) {
out += readAhead;
- readAhead = QString::null;
+ readAhead = TQString::null;
addPropertyVariable( out, type, name );
state = Finish;
} else {
@@ -250,7 +250,7 @@ int addProperty( KCmdLineArgs *args )
{
if ( line.find( "m" + accessor.lower(), 0, false ) >= 0 ) {
out += readAhead;
- readAhead = QString::null;
+ readAhead = TQString::null;
addPropertyVariable( out, type, name );
state = Finish;
}
@@ -266,11 +266,11 @@ int addProperty( KCmdLineArgs *args )
out += readAhead;
if ( args->isSet( "inplace" ) ) {
- QString headerFileNameOut = headerFileName + ".kodeorig" ;
+ TQString headerFileNameOut = headerFileName + ".kodeorig" ;
KProcess proc;
- proc << "cp" << QFile::encodeName( headerFileName ) <<
- QFile::encodeName( headerFileNameOut );
+ proc << "cp" << TQFile::encodeName( headerFileName ) <<
+ TQFile::encodeName( headerFileNameOut );
if ( !proc.start( KProcess::Block ) ) {
kdError() << "Copy failed" << endl;
@@ -281,7 +281,7 @@ int addProperty( KCmdLineArgs *args )
"' for writing." << endl;
return 1;
}
- QTextStream o( &headerFile );
+ TQTextStream o( &headerFile );
o << out << endl;
}
} else {
@@ -298,16 +298,16 @@ int codify( KCmdLineArgs *args )
return 1;
}
- QString filename = args->arg( 0 );
+ TQString filename = args->arg( 0 );
- QFile f( filename );
+ TQFile f( filename );
if ( !f.open( IO_ReadOnly ) ) {
kdError() << "Unable to open file '" << filename << "'." << endl;
return 1;
} else {
std::cout << "KODE::Code code;" << std::endl;
- QTextStream ts( &f );
- QString line;
+ TQTextStream ts( &f );
+ TQString line;
while( !( line = ts.readLine() ).isNull() ) {
line.replace( "\\", "\\\\" );
line.replace( "\"", "\\\"" );
@@ -328,7 +328,7 @@ int create( KCmdLineArgs *args )
bool createKioslave = args->isSet( "create-kioslave" );
bool createMain = args->isSet( "create-main" );
- QString filename = args->getOption( "filename" );
+ TQString filename = args->getOption( "filename" );
if ( createMain ) {
if ( filename.isEmpty() ) {
@@ -346,9 +346,9 @@ int create( KCmdLineArgs *args )
}
}
- QString className = args->getOption( "classname" );
+ TQString className = args->getOption( "classname" );
- QString protocol;
+ TQString protocol;
if ( createKioslave ) {
if ( !args->isSet( "protocol" ) ) {
@@ -364,8 +364,8 @@ int create( KCmdLineArgs *args )
file.setProject( args->getOption( "project" ) );
- QString authorEmail = args->getOption( "author-email" );
- QString authorName;
+ TQString authorEmail = args->getOption( "author-email" );
+ TQString authorName;
KABC::Addressee a;
if ( authorEmail.isEmpty() ) {
a = KABC::StdAddressBook::self()->whoAmI();
@@ -384,7 +384,7 @@ int create( KCmdLineArgs *args )
authorName = a.realName();
}
if ( !authorEmail.isEmpty() ) {
- file.addCopyright( QDate::currentDate().year(), authorName, authorEmail );
+ file.addCopyright( TQDate::currentDate().year(), authorName, authorEmail );
}
KODE::License l;
@@ -464,7 +464,7 @@ int create( KCmdLineArgs *args )
code += "mimeType( \"text/plain\" );";
code.newLine();
- code += "QCString str( \"Hello!\" );";
+ code += "TQCString str( \"Hello!\" );";
code += "data( str );";
code.newLine();
@@ -544,8 +544,8 @@ int create( KCmdLineArgs *args )
}
if ( createKioslave ) {
- constructor.addArgument( "const QCString &pool" );
- constructor.addArgument( "const QCString &app" );
+ constructor.addArgument( "const TQCString &pool" );
+ constructor.addArgument( "const TQCString &app" );
constructor.addInitializer( "SlaveBase( \"" + protocol + "\", pool, app )" );
}
@@ -582,14 +582,14 @@ int create( KCmdLineArgs *args )
// Write protocol file
- QString protocolFilename = protocol + ".protocol";
+ TQString protocolFilename = protocol + ".protocol";
- QFileInfo fi( protocolFilename );
+ TQFileInfo fi( protocolFilename );
protocolFilename = fi.absFilePath();
- KSaveFile::backupFile( protocolFilename, QString::null, ".backup" );
+ KSaveFile::backupFile( protocolFilename, TQString::null, ".backup" );
- QFile::remove( protocolFilename );
+ TQFile::remove( protocolFilename );
KSimpleConfig protocolFile( protocolFilename );