diff options
Diffstat (limited to 'kbabel/filters')
-rw-r--r-- | kbabel/filters/gettext/gettextexport.cpp | 58 | ||||
-rw-r--r-- | kbabel/filters/gettext/gettextexport.h | 10 | ||||
-rw-r--r-- | kbabel/filters/gettext/gettextimport.cpp | 208 | ||||
-rw-r--r-- | kbabel/filters/gettext/gettextimport.h | 22 | ||||
-rw-r--r-- | kbabel/filters/linguist/linguistexport.cpp | 62 | ||||
-rw-r--r-- | kbabel/filters/linguist/linguistexport.h | 18 | ||||
-rw-r--r-- | kbabel/filters/linguist/linguistimport.cpp | 40 | ||||
-rw-r--r-- | kbabel/filters/linguist/linguistimport.h | 14 | ||||
-rw-r--r-- | kbabel/filters/xliff/xliffexport.cpp | 64 | ||||
-rw-r--r-- | kbabel/filters/xliff/xliffexport.h | 16 | ||||
-rw-r--r-- | kbabel/filters/xliff/xliffimport.cpp | 42 | ||||
-rw-r--r-- | kbabel/filters/xliff/xliffimport.h | 14 |
12 files changed, 284 insertions, 284 deletions
diff --git a/kbabel/filters/gettext/gettextexport.cpp b/kbabel/filters/gettext/gettextexport.cpp index e951847b..c2fe9c67 100644 --- a/kbabel/filters/gettext/gettextexport.cpp +++ b/kbabel/filters/gettext/gettextexport.cpp @@ -40,8 +40,8 @@ #include "catalogsettings.h" #include "kbprojectsettings.h" -#include <qfile.h> -#include <qtextcodec.h> +#include <tqfile.h> +#include <tqtextcodec.h> #include <kapplication.h> #include <kdebug.h> @@ -51,12 +51,12 @@ K_EXPORT_COMPONENT_FACTORY( kbabel_gettextexport, KGenericFactory<GettextExportP using namespace KBabel; -GettextExportPlugin::GettextExportPlugin(QObject* parent, const char* name, const QStringList &) : +GettextExportPlugin::GettextExportPlugin(TQObject* parent, const char* name, const TQStringList &) : CatalogExportPlugin(parent,name), m_wrapWidth( -1 ) { } -ConversionStatus GettextExportPlugin::save(const QString& localFile , const QString& mimetype, const Catalog* catalog) +ConversionStatus GettextExportPlugin::save(const TQString& localFile , const TQString& mimetype, const Catalog* catalog) { // check, whether we know how to handle the extra data if( catalog->importPluginID() != "GNU gettext") @@ -66,14 +66,14 @@ ConversionStatus GettextExportPlugin::save(const QString& localFile , const QStr if( mimetype != "application/x-gettext") return UNSUPPORTED_TYPE; - QFile file(localFile); + TQFile file(localFile); if(file.open(IO_WriteOnly)) { int progressRatio = QMAX(100/ QMAX(catalog->numberOfEntries(),1), 1); emit signalResetProgressBar(i18n("saving file"),100); - QTextStream stream(&file); + TQTextStream stream(&file); SaveSettings _saveSettings = catalog->saveSettings(); @@ -86,26 +86,26 @@ ConversionStatus GettextExportPlugin::save(const QString& localFile , const QStr switch(_saveSettings.encoding) { case ProjectSettingsBase::UTF8: - stream.setCodec(QTextCodec::codecForName("utf-8")); + stream.setCodec(TQTextCodec::codecForName("utf-8")); break; case ProjectSettingsBase::UTF16: - stream.setCodec(QTextCodec::codecForName("utf-16")); + stream.setCodec(TQTextCodec::codecForName("utf-16")); break; default: - stream.setCodec(QTextCodec::codecForLocale()); + stream.setCodec(TQTextCodec::codecForLocale()); break; } } // only save header if it is not empty - const QString headerComment( catalog->header().comment() ); + const TQString headerComment( catalog->header().comment() ); // ### TODO: why is this useful to have a header with an empty msgstr? if( !headerComment.isEmpty() || !catalog->header().msgstr().isEmpty() ) { // write header writeComment( stream, headerComment ); - const QString headerMsgid = catalog->header().msgid().first(); + const TQString headerMsgid = catalog->header().msgid().first(); // Gettext PO files should have an empty msgid as header if ( !headerMsgid.isEmpty() ) @@ -122,7 +122,7 @@ ConversionStatus GettextExportPlugin::save(const QString& localFile , const QStr stream << "\n"; } - QStringList list; + TQStringList list; for( uint counter = 0; counter < catalog->numberOfEntries() ; counter++ ) { if(counter%10==0) { @@ -132,7 +132,7 @@ ConversionStatus GettextExportPlugin::save(const QString& localFile , const QStr // write entry writeComment( stream, catalog->comment(counter) ); - const QString msgctxt = catalog->msgctxt(counter); + const TQString msgctxt = catalog->msgctxt(counter); if (! msgctxt.isEmpty() ) { writeKeyword( stream, "msgctxt", msgctxt ); @@ -154,8 +154,8 @@ ConversionStatus GettextExportPlugin::save(const QString& localFile , const QStr const int forms = catalog->msgstr( counter ).count(); for ( int i = 0; i < forms; ++i ) { - QString keyword ( "msgstr[" ); - keyword += QString::number( i ); + TQString keyword ( "msgstr[" ); + keyword += TQString::number( i ); keyword += ']'; writeKeyword( stream, keyword, *( catalog->msgstr( counter ).at( i ) ) ); @@ -173,9 +173,9 @@ ConversionStatus GettextExportPlugin::save(const QString& localFile , const QStr if( _saveSettings.saveObsolete ) { - QValueList<QString>::ConstIterator oit; + TQValueList<TQString>::ConstIterator oit; - QStringList _obsolete = catalog->catalogExtraData(); + TQStringList _obsolete = catalog->catalogExtraData(); for( oit = _obsolete.begin(); oit != _obsolete.end(); ++oit ) { @@ -203,7 +203,7 @@ ConversionStatus GettextExportPlugin::save(const QString& localFile , const QStr return OK; } -void GettextExportPlugin::writeComment( QTextStream& stream, const QString& comment ) const +void GettextExportPlugin::writeComment( TQTextStream& stream, const TQString& comment ) const { if( !comment.isEmpty() ) { @@ -218,13 +218,13 @@ void GettextExportPlugin::writeComment( QTextStream& stream, const QString& comm stream << "\n"; continue; } - const QString span ( ( newpos == -1 ) ? comment.mid( pos ) : comment.mid( pos, newpos-pos ) ); + const TQString span ( ( newpos == -1 ) ? comment.mid( pos ) : comment.mid( pos, newpos-pos ) ); const int len = span.length(); - QString spaces; // Stored leading spaces + TQString spaces; // Stored leading spaces for ( int i = 0 ; i < len ; ++i ) { - const QChar& ch = span[ i ]; + const TQChar& ch = span[ i ]; if ( ch == '#' ) { stream << spaces << span.mid( i ); @@ -252,7 +252,7 @@ void GettextExportPlugin::writeComment( QTextStream& stream, const QString& comm } } -void GettextExportPlugin::writeKeyword( QTextStream& stream, const QString& keyword, const QString& text ) const +void GettextExportPlugin::writeKeyword( TQTextStream& stream, const TQString& keyword, const TQString& text ) const { if ( text.isEmpty() ) { @@ -263,20 +263,20 @@ void GettextExportPlugin::writeKeyword( QTextStream& stream, const QString& keyw else if ( m_wrapWidth == -1 ) { // Traditional KBabel wrapping - QStringList list = QStringList::split( '\n', text ); + TQStringList list = TQStringList::split( '\n', text ); if ( text.startsWith( "\n" ) ) - list.prepend( QString() ); + list.prepend( TQString() ); if(list.isEmpty()) - list.append( QString() ); + list.append( TQString() ); if( list.count() > 1 ) - list.prepend( QString() ); + list.prepend( TQString() ); stream << keyword << " "; - QStringList::const_iterator it; + TQStringList::const_iterator it; for( it = list.constBegin(); it != list.constEnd(); ++it ) { stream << "\"" << (*it) << "\"\n"; @@ -290,7 +290,7 @@ void GettextExportPlugin::writeKeyword( QTextStream& stream, const QString& keyw // No wrapping (like Gettext's --no.wrap or -w0 ) // we need to remove the \n characters, as they are extra characters - QString realText( text ); + TQString realText( text ); realText.remove( '\n' ); stream << keyword << " \"" << realText << "\"\n"; return; @@ -301,7 +301,7 @@ void GettextExportPlugin::writeKeyword( QTextStream& stream, const QString& keyw // From here on, we assume that we have an non-empty text and a positive non-null m_wrapWidth // we need to remove the \n characters, as they are extra characters - QString realText( text ); + TQString realText( text ); realText.remove( '\n' ); bool needFirstEmptyLine = false; diff --git a/kbabel/filters/gettext/gettextexport.h b/kbabel/filters/gettext/gettextexport.h index 81cbe9c4..3c694d1a 100644 --- a/kbabel/filters/gettext/gettextexport.h +++ b/kbabel/filters/gettext/gettextexport.h @@ -35,7 +35,7 @@ #include <catalogfileplugin.h> -#include <qstringlist.h> +#include <tqstringlist.h> namespace KBabel { class Catalog; @@ -53,20 +53,20 @@ class QTextCodec; class GettextExportPlugin: public KBabel::CatalogExportPlugin { public: - GettextExportPlugin(QObject* parent, const char* name, const QStringList &); - virtual KBabel::ConversionStatus save(const QString& file, const QString& mimetype, const KBabel::Catalog* catalog); + GettextExportPlugin(TQObject* parent, const char* name, const TQStringList &); + virtual KBabel::ConversionStatus save(const TQString& file, const TQString& mimetype, const KBabel::Catalog* catalog); private: /** * Write a PO comment to @p stream and take care that each comment lines start with a # character */ - void writeComment( QTextStream& stream, const QString& comment ) const; + void writeComment( TQTextStream& stream, const TQString& comment ) const; /** * Write a PO keyword (msgctxt, msgid, msgstr, msgstr_plural, msgstr[0]) and the corresponding text. * This includes wrapping the text. */ - void writeKeyword( QTextStream& stream, const QString& keyword, const QString& text ) const; + void writeKeyword( TQTextStream& stream, const TQString& keyword, const TQString& text ) const; public: /** diff --git a/kbabel/filters/gettext/gettextimport.cpp b/kbabel/filters/gettext/gettextimport.cpp index 3f54301d..9210c1a9 100644 --- a/kbabel/filters/gettext/gettextimport.cpp +++ b/kbabel/filters/gettext/gettextimport.cpp @@ -39,10 +39,10 @@ #include <catalogitem.h> #include <resources.h> -#include <qfile.h> -#include <qfileinfo.h> -#include <qregexp.h> -#include <qtextcodec.h> +#include <tqfile.h> +#include <tqfileinfo.h> +#include <tqregexp.h> +#include <tqtextcodec.h> #include <kapplication.h> #include <kdebug.h> @@ -53,11 +53,11 @@ K_EXPORT_COMPONENT_FACTORY( kbabel_gettextimport, KGenericFactory<GettextImportP using namespace KBabel; -GettextImportPlugin::GettextImportPlugin(QObject* parent, const char* name, const QStringList &) : CatalogImportPlugin(parent,name) +GettextImportPlugin::GettextImportPlugin(TQObject* parent, const char* name, const TQStringList &) : CatalogImportPlugin(parent,name) { } -ConversionStatus GettextImportPlugin::load(const QString& filename, const QString&) +ConversionStatus GettextImportPlugin::load(const TQString& filename, const TQString&) { kdDebug( KBABEL ) << k_funcinfo << endl; @@ -66,7 +66,7 @@ ConversionStatus GettextImportPlugin::load(const QString& filename, const QStrin return NO_FILE; } - QFileInfo info(filename); + TQFileInfo info(filename); if(!info.exists() || info.isDir()) return NO_FILE; @@ -74,7 +74,7 @@ ConversionStatus GettextImportPlugin::load(const QString& filename, const QStrin if(!info.isReadable()) return NO_PERMISSIONS; - QFile file(filename); + TQFile file(filename); if ( !file.open( IO_ReadOnly ) ) return NO_PERMISSIONS; @@ -82,23 +82,23 @@ ConversionStatus GettextImportPlugin::load(const QString& filename, const QStrin uint oldPercent = 0; emit signalResetProgressBar(i18n("loading file"),100); - QByteArray ba = file.readAll(); + TQByteArray ba = file.readAll(); file.close(); // find codec for file bool hadCodec; - QTextCodec* codec=codecForArray( ba, &hadCodec ); + TQTextCodec* codec=codecForArray( ba, &hadCodec ); bool recoveredErrorInHeader = false; - QTextStream stream(ba,IO_ReadOnly); + TQTextStream stream(ba,IO_ReadOnly); if(codec) stream.setCodec(codec); else { kdWarning() << "No encoding declared or found, using UTF-8" << endl; - stream.setEncoding( QTextStream::UnicodeUTF8 ); + stream.setEncoding( TQTextStream::UnicodeUTF8 ); #ifdef __GNUC__ # warning Default UTF-8 encoding needs to be improved #endif @@ -106,12 +106,12 @@ ConversionStatus GettextImportPlugin::load(const QString& filename, const QStrin //recoveredErrorInHeader = true; } - QIODevice *dev = stream.device(); + TQIODevice *dev = stream.device(); int fileSize = dev->size(); // if somethings goes wrong with the parsing, we don't have deleted the old contents CatalogItem tempHeader; - QStringList tempObsolete; + TQStringList tempObsolete; kdDebug(KBABEL) << "start parsing..." << endl; @@ -139,15 +139,15 @@ ConversionStatus GettextImportPlugin::load(const QString& filename, const QStrin { // The header must have an empty msgid kdWarning(KBABEL) << "Header entry has non-empty msgid. Creating a temporary header! " << _msgid << endl; - tempHeader.setMsgid( QStringList() ); - QStringList tmp; + tempHeader.setMsgid( TQStringList() ); + TQStringList tmp; tmp.append( "Content-Type: text/plain; charset=UTF-8\\n" // Unknown charset "Content-Transfer-Encoding: 8bit\\n" "Mime-Version: 1.0" ); tempHeader.setMsgstr( tmp ); // We keep the comment of the first entry, as it might really be a header comment (at least partially) - const QString comment( "# Header entry was created by KBabel!\n#\n" + _comment ); + const TQString comment( "# Header entry was created by KBabel!\n#\n" + _comment ); tempHeader.setComment( comment ); recoveredErrorInHeader = true; } @@ -167,7 +167,7 @@ ConversionStatus GettextImportPlugin::load(const QString& filename, const QStrin // now parse the rest of the file uint counter=0; - QValueList<uint> errorIndex; + TQValueList<uint> errorIndex; bool recoveredError=false; bool docbookFile=false; @@ -289,17 +289,17 @@ ConversionStatus GettextImportPlugin::load(const QString& filename, const QStrin } } -QTextCodec* GettextImportPlugin::codecForArray(QByteArray& array, bool* hadCodec) +TQTextCodec* GettextImportPlugin::codecForArray(TQByteArray& array, bool* hadCodec) { if(hadCodec) { *hadCodec=false; } - QTextStream stream( array, IO_ReadOnly ); - // ### TODO Qt4: see if it can be done with QByteArray alone, in an encoding-neutral way. + TQTextStream stream( array, IO_ReadOnly ); + // ### TODO Qt4: see if it can be done with TQByteArray alone, in an encoding-neutral way. // Set ISO-8859-1 as it is a relatively neutral encoding when reading (compared to UTF-8 or a random locale encoing) - stream.setEncoding( QTextStream::Latin1 ); + stream.setEncoding( TQTextStream::Latin1 ); // first read header ConversionStatus status = readHeader(stream); @@ -309,19 +309,19 @@ QTextCodec* GettextImportPlugin::codecForArray(QByteArray& array, bool* hadCodec return 0; } - const QString head = _msgstr.first(); + const TQString head = _msgstr.first(); - QRegExp regexp("Content-Type:\\s*\\w+/[-\\w]+;?\\s*charset\\s*=\\s*(\\S+)\\s*\\\\n"); + TQRegExp regexp("Content-Type:\\s*\\w+/[-\\w]+;?\\s*charset\\s*=\\s*(\\S+)\\s*\\\\n"); if( regexp.search( head ) == -1 ) { kdDebug(KBABEL) << "no charset entry found" << endl; return 0; } - const QString charset = regexp.cap(1); + const TQString charset = regexp.cap(1); kdDebug(KBABEL) << "charset: " << charset << endl; - QTextCodec* codec=0; + TQTextCodec* codec=0; if(!charset.isEmpty()) { @@ -333,14 +333,14 @@ QTextCodec* GettextImportPlugin::codecForArray(QByteArray& array, bool* hadCodec if(hadCodec) *hadCodec=false; - codec=QTextCodec::codecForName("utf8"); + codec=TQTextCodec::codecForName("utf8"); kdDebug(KBABEL) - << QString("file seems to be a template: using utf-8 encoding.") + << TQString("file seems to be a template: using utf-8 encoding.") << endl; } else { - codec=QTextCodec::codecForName(charset.latin1()); + codec=TQTextCodec::codecForName(charset.latin1()); if(hadCodec) *hadCodec=true; } @@ -360,7 +360,7 @@ QTextCodec* GettextImportPlugin::codecForArray(QByteArray& array, bool* hadCodec return codec; } -ConversionStatus GettextImportPlugin::readHeader(QTextStream& stream) +ConversionStatus GettextImportPlugin::readHeader(TQTextStream& stream) { CatalogItem temp; int filePos=stream.device()->at(); @@ -380,25 +380,25 @@ ConversionStatus GettextImportPlugin::readHeader(QTextStream& stream) return PARSE_ERROR; } -ConversionStatus GettextImportPlugin::readEntry(QTextStream& stream) +ConversionStatus GettextImportPlugin::readEntry(TQTextStream& stream) { //kdDebug( KBABEL ) << k_funcinfo << " START" << endl; enum {Begin,Comment,Msgctxt,Msgid,Msgstr} part=Begin; - QString line; + TQString line; bool error=false; bool recoverableError=false; bool seenMsgctxt=false; _msgstr.clear(); - _msgstr.append(QString()); + _msgstr.append(TQString()); _msgid.clear(); - _msgid.append(QString()); - _msgctxt=QString(); - _comment=QString(); + _msgid.append(TQString()); + _msgctxt=TQString(); + _comment=TQString(); _gettextPluralForm=false; _obsolete=false; - QStringList::Iterator msgstrIt=_msgstr.begin(); + TQStringList::Iterator msgstrIt=_msgstr.begin(); while( !stream.eof() ) { @@ -439,34 +439,34 @@ ConversionStatus GettextImportPlugin::readEntry(QTextStream& stream) part=Comment; _comment=line; } - else if(line.find(QRegExp("^msgctxt\\s*\".*\"$")) != -1) + else if(line.find(TQRegExp("^msgctxt\\s*\".*\"$")) != -1) { part=Msgctxt; // remove quotes at beginning and the end of the lines - line.remove(QRegExp("^msgctxt\\s*\"")); - line.remove(QRegExp("\"$")); + line.remove(TQRegExp("^msgctxt\\s*\"")); + line.remove(TQRegExp("\"$")); _msgctxt=line; seenMsgctxt=true; } - else if(line.find(QRegExp("^msgid\\s*\".*\"$")) != -1) + else if(line.find(TQRegExp("^msgid\\s*\".*\"$")) != -1) { part=Msgid; // remove quotes at beginning and the end of the lines - line.remove(QRegExp("^msgid\\s*\"")); - line.remove(QRegExp("\"$")); + line.remove(TQRegExp("^msgid\\s*\"")); + line.remove(TQRegExp("\"$")); (*(_msgid).begin())=line; } // one of the quotation marks is missing - else if(line.find(QRegExp("^msgid\\s*\"?.*\"?$")) != -1) + else if(line.find(TQRegExp("^msgid\\s*\"?.*\"?$")) != -1) { part=Msgid; // remove quotes at beginning and the end of the lines - line.remove(QRegExp("^msgid\\s*\"?")); - line.remove(QRegExp("\"$")); + line.remove(TQRegExp("^msgid\\s*\"?")); + line.remove(TQRegExp("\"$")); (*(_msgid).begin())=line; @@ -494,34 +494,34 @@ ConversionStatus GettextImportPlugin::readEntry(QTextStream& stream) { _comment+=("\n"+line); } - else if(line.find(QRegExp("^msgctxt\\s*\".*\"$")) != -1) + else if(line.find(TQRegExp("^msgctxt\\s*\".*\"$")) != -1) { part=Msgctxt; // remove quotes at beginning and the end of the lines - line.remove(QRegExp("^msgctxt\\s*\"")); - line.remove(QRegExp("\"$")); + line.remove(TQRegExp("^msgctxt\\s*\"")); + line.remove(TQRegExp("\"$")); _msgctxt=line; seenMsgctxt=true; } - else if(line.find(QRegExp("^msgid\\s*\".*\"$")) != -1) + else if(line.find(TQRegExp("^msgid\\s*\".*\"$")) != -1) { part=Msgid; // remove quotes at beginning and the end of the lines - line.remove(QRegExp("^msgid\\s*\"")); - line.remove(QRegExp("\"$")); + line.remove(TQRegExp("^msgid\\s*\"")); + line.remove(TQRegExp("\"$")); (*(_msgid).begin())=line; } // one of the quotation marks is missing - else if(line.find(QRegExp("^msgid\\s*\"?.*\"?$")) != -1) + else if(line.find(TQRegExp("^msgid\\s*\"?.*\"?$")) != -1) { part=Msgid; // remove quotes at beginning and the end of the lines - line.remove(QRegExp("^msgid\\s*\"?")); - line.remove(QRegExp("\"$")); + line.remove(TQRegExp("^msgid\\s*\"?")); + line.remove(TQRegExp("\"$")); (*(_msgid).begin())=line; @@ -539,11 +539,11 @@ ConversionStatus GettextImportPlugin::readEntry(QTextStream& stream) { if(line.isEmpty()) continue; - else if(line.find(QRegExp("^\".*\\n?\"$")) != -1) + else if(line.find(TQRegExp("^\".*\\n?\"$")) != -1) { // remove quotes at beginning and the end of the lines - line.remove(QRegExp("^\"")); - line.remove(QRegExp("\"$")); + line.remove(TQRegExp("^\"")); + line.remove(TQRegExp("\"$")); // add Msgctxt line to item if(_msgctxt.isEmpty()) @@ -551,24 +551,24 @@ ConversionStatus GettextImportPlugin::readEntry(QTextStream& stream) else _msgctxt+=("\n"+line); } - else if(line.find(QRegExp("^msgid\\s*\".*\"$")) != -1) + else if(line.find(TQRegExp("^msgid\\s*\".*\"$")) != -1) { part=Msgid; // remove quotes at beginning and the end of the lines - line.remove(QRegExp("^msgid\\s*\"")); - line.remove(QRegExp("\"$")); + line.remove(TQRegExp("^msgid\\s*\"")); + line.remove(TQRegExp("\"$")); (*(_msgid).begin())=line; } // one of the quotation marks is missing - else if(line.find(QRegExp("^msgid\\s*\"?.*\"?$")) != -1) + else if(line.find(TQRegExp("^msgid\\s*\"?.*\"?$")) != -1) { part=Msgid; // remove quotes at beginning and the end of the lines - line.remove(QRegExp("^msgid\\s*\"?")); - line.remove(QRegExp("\"$")); + line.remove(TQRegExp("^msgid\\s*\"?")); + line.remove(TQRegExp("\"$")); (*(_msgid).begin())=line; @@ -586,13 +586,13 @@ ConversionStatus GettextImportPlugin::readEntry(QTextStream& stream) { if(line.isEmpty()) continue; - else if(line.find(QRegExp("^\".*\\n?\"$")) != -1) + else if(line.find(TQRegExp("^\".*\\n?\"$")) != -1) { // remove quotes at beginning and the end of the lines - line.remove(QRegExp("^\"")); - line.remove(QRegExp("\"$")); + line.remove(TQRegExp("^\"")); + line.remove(TQRegExp("\"$")); - QStringList::Iterator it; + TQStringList::Iterator it; if(_gettextPluralForm) it = _msgid.fromLast(); else @@ -604,26 +604,26 @@ ConversionStatus GettextImportPlugin::readEntry(QTextStream& stream) else (*it)+=("\n"+line); } - else if(line.find(QRegExp("^msgid_plural\\s*\".*\"$")) != -1) + else if(line.find(TQRegExp("^msgid_plural\\s*\".*\"$")) != -1) { part=Msgid; _gettextPluralForm = true; // remove quotes at beginning and the end of the lines - line.remove(QRegExp("^msgid_plural\\s*\"")); - line.remove(QRegExp("\"$")); + line.remove(TQRegExp("^msgid_plural\\s*\"")); + line.remove(TQRegExp("\"$")); _msgid.append(line); } // one of the quotation marks is missing - else if(line.find(QRegExp("^msgid_plural\\s*\"?.*\"?$")) != -1) + else if(line.find(TQRegExp("^msgid_plural\\s*\"?.*\"?$")) != -1) { part=Msgid; _gettextPluralForm = true; // remove quotes at beginning and the end of the lines - line.remove(QRegExp("^msgid_plural\\s*\"?")); - line.remove(QRegExp("\"$")); + line.remove(TQRegExp("^msgid_plural\\s*\"?")); + line.remove(TQRegExp("\"$")); _msgid.append(line); @@ -631,24 +631,24 @@ ConversionStatus GettextImportPlugin::readEntry(QTextStream& stream) recoverableError=true; } else if(!_gettextPluralForm - && (line.find(QRegExp("^msgstr\\s*\".*\\n?\"$")) != -1)) + && (line.find(TQRegExp("^msgstr\\s*\".*\\n?\"$")) != -1)) { part=Msgstr; // remove quotes at beginning and the end of the lines - line.remove(QRegExp("^msgstr\\s*\"?")); - line.remove(QRegExp("\"$")); + line.remove(TQRegExp("^msgstr\\s*\"?")); + line.remove(TQRegExp("\"$")); (*msgstrIt)=line; } else if(!_gettextPluralForm - && line.find(QRegExp("^msgstr\\s*\"?.*\\n?\"?$")) != -1) + && line.find(TQRegExp("^msgstr\\s*\"?.*\\n?\"?$")) != -1) { part=Msgstr; // remove quotes at beginning and the end of the lines - line.remove(QRegExp("^msgstr\\s*\"?")); - line.remove(QRegExp("\"$")); + line.remove(TQRegExp("^msgstr\\s*\"?")); + line.remove(TQRegExp("\"$")); (*msgstrIt)=line; @@ -656,24 +656,24 @@ ConversionStatus GettextImportPlugin::readEntry(QTextStream& stream) recoverableError=true; } else if( _gettextPluralForm - && (line.find(QRegExp("^msgstr\\[0\\]\\s*\".*\\n?\"$")) != -1)) + && (line.find(TQRegExp("^msgstr\\[0\\]\\s*\".*\\n?\"$")) != -1)) { part=Msgstr; // remove quotes at beginning and the end of the lines - line.remove(QRegExp("^msgstr\\[0\\]\\s*\"?")); - line.remove(QRegExp("\"$")); + line.remove(TQRegExp("^msgstr\\[0\\]\\s*\"?")); + line.remove(TQRegExp("\"$")); (*msgstrIt)=line; } else if( _gettextPluralForm - && (line.find(QRegExp("^msgstr\\[0\\]\\s*\"?.*\\n?\"?$")) != -1)) + && (line.find(TQRegExp("^msgstr\\[0\\]\\s*\"?.*\\n?\"?$")) != -1)) { part=Msgstr; // remove quotes at beginning and the end of the lines - line.remove(QRegExp("^msgstr\\[0\\]\\s*\"?")); - line.remove(QRegExp("\"$")); + line.remove(TQRegExp("^msgstr\\[0\\]\\s*\"?")); + line.remove(TQRegExp("\"$")); (*msgstrIt)=line; @@ -694,15 +694,15 @@ ConversionStatus GettextImportPlugin::readEntry(QTextStream& stream) break; } // a line of the msgid with a missing quotation mark - else if(line.find(QRegExp("^\"?.+\\n?\"?$")) != -1) + else if(line.find(TQRegExp("^\"?.+\\n?\"?$")) != -1) { recoverableError=true; // remove quotes at beginning and the end of the lines - line.remove(QRegExp("^\"")); - line.remove(QRegExp("\"$")); + line.remove(TQRegExp("^\"")); + line.remove(TQRegExp("\"$")); - QStringList::Iterator it; + TQStringList::Iterator it; if( _gettextPluralForm ) it = _msgid.fromLast(); else @@ -726,11 +726,11 @@ ConversionStatus GettextImportPlugin::readEntry(QTextStream& stream) if(line.isEmpty()) continue; // another line of the msgstr - else if(line.find(QRegExp("^\".*\\n?\"$")) != -1) + else if(line.find(TQRegExp("^\".*\\n?\"$")) != -1) { // remove quotes at beginning and the end of the lines - line.remove(QRegExp("^\"")); - line.remove(QRegExp("\"$")); + line.remove(TQRegExp("^\"")); + line.remove(TQRegExp("\"$")); if((*msgstrIt).isEmpty()) (*msgstrIt)=line; @@ -738,27 +738,27 @@ ConversionStatus GettextImportPlugin::readEntry(QTextStream& stream) (*msgstrIt)+=("\n"+line); } else if( _gettextPluralForm - && (line.find(QRegExp("^msgstr\\[[0-9]+\\]\\s*\".*\\n?\"$")) != -1)) + && (line.find(TQRegExp("^msgstr\\[[0-9]+\\]\\s*\".*\\n?\"$")) != -1)) { // remove quotes at beginning and the end of the lines - line.remove(QRegExp("^msgstr\\[[0-9]+\\]\\s*\"?")); - line.remove(QRegExp("\"$")); + line.remove(TQRegExp("^msgstr\\[[0-9]+\\]\\s*\"?")); + line.remove(TQRegExp("\"$")); msgstrIt=_msgstr.append(line); } else if( _gettextPluralForm - && (line.find(QRegExp("^msgstr\\[[0-9]\\]\\s*\"?.*\\n?\"?$")) != -1)) + && (line.find(TQRegExp("^msgstr\\[[0-9]\\]\\s*\"?.*\\n?\"?$")) != -1)) { // remove quotes at beginning and the end of the lines - line.remove(QRegExp("^msgstr\\[[0-9]\\]\\s*\"?")); - line.remove(QRegExp("\"$")); + line.remove(TQRegExp("^msgstr\\[[0-9]\\]\\s*\"?")); + line.remove(TQRegExp("\"$")); msgstrIt=_msgstr.append(line); if(!line.isEmpty()) recoverableError=true; } - else if((line.find(QRegExp("^\\s*msgid")) != -1) || (line.find(QRegExp("^\\s*#")) != -1)) + else if((line.find(TQRegExp("^\\s*msgid")) != -1) || (line.find(TQRegExp("^\\s*#")) != -1)) { // We have read successfully one entry, so end loop. stream.device()->at(pos);// reset position in stream to beginning of this line @@ -771,13 +771,13 @@ ConversionStatus GettextImportPlugin::readEntry(QTextStream& stream) break; } // another line of the msgstr with a missing quotation mark - else if(line.find(QRegExp("^\"?.+\\n?\"?$")) != -1) + else if(line.find(TQRegExp("^\"?.+\\n?\"?$")) != -1) { recoverableError=true; // remove quotes at beginning and the end of the lines - line.remove(QRegExp("^\"")); - line.remove(QRegExp("\"$")); + line.remove(TQRegExp("^\"")); + line.remove(TQRegExp("\"$")); if((*msgstrIt).isEmpty()) (*msgstrIt)=line; @@ -800,7 +800,7 @@ ConversionStatus GettextImportPlugin::readEntry(QTextStream& stream) << "msgid:\n" << _msgid.first() << "\n" << "msgid_plural:\n" << _msgid.last() << "\n" << endl; int counter=0; - for(QStringList::Iterator it = _msgstr.begin(); it != _msgstr.end(); ++it) + for(TQStringList::Iterator it = _msgstr.begin(); it != _msgstr.end(); ++it) { kdDebug(KBABEL) << "msgstr[" << counter << "]:\n" << (*it) << endl; diff --git a/kbabel/filters/gettext/gettextimport.h b/kbabel/filters/gettext/gettextimport.h index e28ec790..dc84e404 100644 --- a/kbabel/filters/gettext/gettextimport.h +++ b/kbabel/filters/gettext/gettextimport.h @@ -35,7 +35,7 @@ #include <catalogfileplugin.h> -#include <qstringlist.h> +#include <tqstringlist.h> class KURL; class QFile; @@ -49,20 +49,20 @@ class QTextCodec; class GettextImportPlugin: public KBabel::CatalogImportPlugin { public: - GettextImportPlugin(QObject* parent, const char* name, const QStringList &); - virtual KBabel::ConversionStatus load(const QString& file, const QString& mimetype); - virtual const QString id() { return "GNU gettext"; } + GettextImportPlugin(TQObject* parent, const char* name, const TQStringList &); + virtual KBabel::ConversionStatus load(const TQString& file, const TQString& mimetype); + virtual const TQString id() { return "GNU gettext"; } private: - QTextCodec* codecForArray(QByteArray& arary, bool* hadCodec); - KBabel::ConversionStatus readHeader(QTextStream& stream); - KBabel::ConversionStatus readEntry(QTextStream& stream); + TQTextCodec* codecForArray(TQByteArray& arary, bool* hadCodec); + KBabel::ConversionStatus readHeader(TQTextStream& stream); + KBabel::ConversionStatus readEntry(TQTextStream& stream); // description of the last read entry - QString _msgctxt; - QStringList _msgid; - QStringList _msgstr; - QString _comment; + TQString _msgctxt; + TQStringList _msgid; + TQStringList _msgstr; + TQString _comment; bool _gettextPluralForm; bool _obsolete; }; diff --git a/kbabel/filters/linguist/linguistexport.cpp b/kbabel/filters/linguist/linguistexport.cpp index 3b69e20a..af0a3298 100644 --- a/kbabel/filters/linguist/linguistexport.cpp +++ b/kbabel/filters/linguist/linguistexport.cpp @@ -36,11 +36,11 @@ **************************************************************************** */ -#include <qfile.h> -#include "qregexp.h" -#include <qstring.h> -#include <qstringlist.h> -#include <qtextstream.h> +#include <tqfile.h> +#include "tqregexp.h" +#include <tqstring.h> +#include <tqstringlist.h> +#include <tqtextstream.h> #include <kgenericfactory.h> @@ -53,25 +53,25 @@ K_EXPORT_COMPONENT_FACTORY( kbabel_linguistexport, KGenericFactory<LinguistExpor using namespace KBabel; -LinguistExportPlugin::LinguistExportPlugin( QObject * parent, const char * name, const QStringList& ) +LinguistExportPlugin::LinguistExportPlugin( TQObject * parent, const char * name, const TQStringList& ) : CatalogExportPlugin( parent, name ) { } -ConversionStatus LinguistExportPlugin::save( const QString& filename, const QString&, const Catalog * catalog ) +ConversionStatus LinguistExportPlugin::save( const TQString& filename, const TQString&, const Catalog * catalog ) { // Check whether we know how to handle the extra data. if ( catalog->importPluginID( ) != "Qt translation source" ) return UNSUPPORTED_TYPE; - QFile file( filename ); + TQFile file( filename ); if ( !file.open( IO_WriteOnly ) ) return OS_ERROR; SaveSettings settings = catalog->saveSettings( ); // New DOM document. - QDomDocument doc( "TS" ); + TQDomDocument doc( "TS" ); // Create the root element. doc.appendChild( doc.createElement( "TS" ) ); @@ -82,36 +82,36 @@ ConversionStatus LinguistExportPlugin::save( const QString& filename, const QStr // Regular messages. for ( uint i = 0; i < catalog->numberOfEntries( ); i++ ) { - QString comment( extractComment( doc, catalog->comment( i ), fuzzy ) ); + TQString comment( extractComment( doc, catalog->comment( i ), fuzzy ) ); createMessage( doc, catalog->msgid( i ).join( "" ), catalog->msgstr( i ).join( "" ), comment, false, fuzzy ); } // Obsolete messages. if ( settings.saveObsolete ) { - QValueList<CatalogItem> obsMessages = catalog->obsoleteEntries( ); - QValueList<CatalogItem>::Iterator it; + TQValueList<CatalogItem> obsMessages = catalog->obsoleteEntries( ); + TQValueList<CatalogItem>::Iterator it; for ( it = obsMessages.begin( ); it != obsMessages.end( ); ++it ) { - QString comment( extractComment( doc, (*it).comment( ), fuzzy ) ); + TQString comment( extractComment( doc, (*it).comment( ), fuzzy ) ); createMessage( doc, (*it).msgid( true ).join( "" ), (*it).msgstr( true ).join( "" ), comment, true, fuzzy ); } } - QTextStream stream( &file ); + TQTextStream stream( &file ); doc.save( stream, 2 ); file.close( ); return OK; } -const QString LinguistExportPlugin::extractComment( QDomDocument& doc, const QString& s, bool& fuzzy ) +const TQString LinguistExportPlugin::extractComment( TQDomDocument& doc, const TQString& s, bool& fuzzy ) { fuzzy = false; - QString comment( s ); + TQString comment( s ); if ( !comment.isEmpty( ) ) { // Extract the context and the actual comment. - comment.remove( QRegExp( "^Context:[\\s]*" ) ); + comment.remove( TQRegExp( "^Context:[\\s]*" ) ); /* * HACK * @@ -129,28 +129,28 @@ const QString LinguistExportPlugin::extractComment( QDomDocument& doc, const QSt comment.remove("#, fuzzy"); } - QString newContext; + TQString newContext; pos = comment.find( '\n' ); if ( pos >= 0 ) { newContext = comment.left( pos ); - comment.replace( 0, pos + 1, "" ); // ### TODO: use QString::remove + comment.replace( 0, pos + 1, "" ); // ### TODO: use TQString::remove } else { newContext = comment; - comment = ""; // ### TODO: use QString() instead of "" + comment = ""; // ### TODO: use TQString() instead of "" } setContext( doc, newContext ); } return comment; } -void LinguistExportPlugin::createMessage( QDomDocument& doc, const QString& msgid, - const QString& msgstr, const QString& comment, +void LinguistExportPlugin::createMessage( TQDomDocument& doc, const TQString& msgid, + const TQString& msgstr, const TQString& comment, const bool obsolete, const bool fuzzy ) { - QDomElement elem; - QDomText text; + TQDomElement elem; + TQDomText text; - QDomElement messageElement = doc.createElement( "message" ); + TQDomElement messageElement = doc.createElement( "message" ); elem = doc.createElement( "source" ); text = doc.createTextNode( msgid ); @@ -179,17 +179,17 @@ void LinguistExportPlugin::createMessage( QDomDocument& doc, const QString& msgi contextElement.appendChild( messageElement ); } -void LinguistExportPlugin::setContext( QDomDocument& doc, QString newContext ) +void LinguistExportPlugin::setContext( TQDomDocument& doc, TQString newContext ) { // Nothing to do here. if ( newContext == context ) return; - // Find out whether there is already such a context in the QDomDocument. - QDomNode node = doc.documentElement( ).firstChild( ); + // Find out whether there is already such a context in the TQDomDocument. + TQDomNode node = doc.documentElement( ).firstChild( ); while ( !node.isNull( ) ) { if ( node.isElement( ) ) { - QDomElement elem = node.firstChild( ).toElement( ); + TQDomElement elem = node.firstChild( ).toElement( ); if ( elem.isElement( ) && elem.tagName( ) == "name" && elem.text( ) == newContext ) { // We found the context. context = newContext; @@ -205,8 +205,8 @@ void LinguistExportPlugin::setContext( QDomDocument& doc, QString newContext ) contextElement = doc.createElement( "context" ); doc.documentElement( ).appendChild( contextElement ); // Appropriate name element. - QDomElement nameElement = doc.createElement( "name" ); - QDomText text = doc.createTextNode( newContext ); + TQDomElement nameElement = doc.createElement( "name" ); + TQDomText text = doc.createTextNode( newContext ); nameElement.appendChild( text ); contextElement.appendChild( nameElement ); // Store new context. diff --git a/kbabel/filters/linguist/linguistexport.h b/kbabel/filters/linguist/linguistexport.h index 3201f95f..2ad80bd7 100644 --- a/kbabel/filters/linguist/linguistexport.h +++ b/kbabel/filters/linguist/linguistexport.h @@ -37,7 +37,7 @@ #ifndef LINGUISTEXPORT_H #define LINGUISTEXPORT_H -#include <qdom.h> +#include <tqdom.h> #include "catalogfileplugin.h" @@ -51,18 +51,18 @@ class Catalog; class LinguistExportPlugin : public KBabel::CatalogExportPlugin { public: - LinguistExportPlugin( QObject * parent, const char * name, const QStringList& ); - virtual KBabel::ConversionStatus save( const QString& filename, const QString& mimetype, const KBabel::Catalog * catalog ); + LinguistExportPlugin( TQObject * parent, const char * name, const TQStringList& ); + virtual KBabel::ConversionStatus save( const TQString& filename, const TQString& mimetype, const KBabel::Catalog * catalog ); private: - const QString extractComment( QDomDocument& doc, const QString& s, bool& fuzzy ); - void createMessage( QDomDocument& doc, const QString& msgid, const QString& msgstr, - const QString& comment, const bool obsolete, const bool fuzzy ); - void setContext( QDomDocument& doc, QString newContext ); + const TQString extractComment( TQDomDocument& doc, const TQString& s, bool& fuzzy ); + void createMessage( TQDomDocument& doc, const TQString& msgid, const TQString& msgstr, + const TQString& comment, const bool obsolete, const bool fuzzy ); + void setContext( TQDomDocument& doc, TQString newContext ); private: - QString context; - QDomElement contextElement; + TQString context; + TQDomElement contextElement; }; #endif // LINGUISTEXPORT_H diff --git a/kbabel/filters/linguist/linguistimport.cpp b/kbabel/filters/linguist/linguistimport.cpp index 220c0634..a1870bd7 100644 --- a/kbabel/filters/linguist/linguistimport.cpp +++ b/kbabel/filters/linguist/linguistimport.cpp @@ -38,12 +38,12 @@ **************************************************************************** */ // Qt include files -#include <qfile.h> -#include <qfileinfo.h> -#include <qobject.h> -#include <qregexp.h> -#include <qstring.h> -#include <qstringlist.h> +#include <tqfile.h> +#include <tqfileinfo.h> +#include <tqobject.h> +#include <tqregexp.h> +#include <tqstring.h> +#include <tqstringlist.h> // KDE include files #include <kdebug.h> #include <kgenericfactory.h> @@ -55,19 +55,19 @@ K_EXPORT_COMPONENT_FACTORY( kbabel_linguistimport, KGenericFactory<LinguistImpor using namespace KBabel; -LinguistImportPlugin::LinguistImportPlugin( QObject * parent, const char * name, const QStringList& ) +LinguistImportPlugin::LinguistImportPlugin( TQObject * parent, const char * name, const TQStringList& ) : CatalogImportPlugin( parent, name ) { } -ConversionStatus LinguistImportPlugin::load( const QString& filename, const QString& ) +ConversionStatus LinguistImportPlugin::load( const TQString& filename, const TQString& ) { if ( filename.isEmpty( ) ) { kdDebug( ) << "fatal error: empty filename to open" << endl; return NO_FILE; } - QFileInfo info( filename ); + TQFileInfo info( filename ); if ( !info.exists( ) || info.isDir( ) ) return NO_FILE; @@ -75,14 +75,14 @@ ConversionStatus LinguistImportPlugin::load( const QString& filename, const QStr if ( !info.isReadable( ) ) return NO_PERMISSIONS; - QFile file( filename ); + TQFile file( filename ); if ( !file.open( IO_ReadOnly ) ) return NO_PERMISSIONS; - QString errorMsg; + TQString errorMsg; int errorLine, errorColumn; - QDomDocument doc; + TQDomDocument doc; if ( !doc.setContent( &file, &errorMsg, &errorLine, &errorColumn ) ) { file.close( ); kdError() << "Parsing error at line " << errorLine << ", column " << errorColumn << ", error " << errorMsg << endl; @@ -90,7 +90,7 @@ ConversionStatus LinguistImportPlugin::load( const QString& filename, const QStr } file.close( ); - const QDomElement documentElement( doc.documentElement() ); + const TQDomElement documentElement( doc.documentElement() ); // Count the number of messages in this file. This is needed for updating // the progress bar correctly. msgcnt = documentElement.elementsByTagName( "message" ).count(); @@ -113,13 +113,13 @@ ConversionStatus LinguistImportPlugin::load( const QString& filename, const QStr return OK; } -void LinguistImportPlugin::parse( const QDomElement& parentElement ) +void LinguistImportPlugin::parse( const TQDomElement& parentElement ) { - QDomNode node = parentElement.firstChild( ); + TQDomNode node = parentElement.firstChild( ); while ( !node.isNull( ) ) { if ( node.isElement( ) ) { - QDomElement elem = node.toElement( ); + TQDomElement elem = node.toElement( ); if ( elem.tagName( ) == "context" ) { // nothing to do here @@ -127,14 +127,14 @@ void LinguistImportPlugin::parse( const QDomElement& parentElement ) context = elem.text( ); } else if ( elem.tagName( ) == "message" ) { CatalogItem item; - QString comment; + TQString comment; bool isObsolete = false; bool isFuzzy = false; - QDomNode childNode = node.firstChild(); + TQDomNode childNode = node.firstChild(); for ( ; ! childNode.isNull() ; childNode = childNode.nextSibling() ) { - const QDomElement elem = childNode.toElement(); + const TQDomElement elem = childNode.toElement(); if ( elem.isNull() ) continue; @@ -155,7 +155,7 @@ void LinguistImportPlugin::parse( const QDomElement& parentElement ) } } - QString fullComment = "Context: " + context; + TQString fullComment = "Context: " + context; if ( isFuzzy ) { /* diff --git a/kbabel/filters/linguist/linguistimport.h b/kbabel/filters/linguist/linguistimport.h index 3cdbd7e3..8c6fdbc0 100644 --- a/kbabel/filters/linguist/linguistimport.h +++ b/kbabel/filters/linguist/linguistimport.h @@ -37,7 +37,7 @@ #ifndef LINGUISTIMPORT_H #define LINGUISTIMPORT_H -#include <qdom.h> +#include <tqdom.h> #include "catalogfileplugin.h" @@ -50,19 +50,19 @@ class QStringList; class LinguistImportPlugin : public KBabel::CatalogImportPlugin { public: - LinguistImportPlugin( QObject * parent, const char * name, const QStringList& ); + LinguistImportPlugin( TQObject * parent, const char * name, const TQStringList& ); - virtual KBabel::ConversionStatus load( const QString& filename, const QString& mimetype ); - virtual const QString id( ) { return "Qt translation source"; } + virtual KBabel::ConversionStatus load( const TQString& filename, const TQString& mimetype ); + virtual const TQString id( ) { return "Qt translation source"; } private: - void parse( const QDomElement& parentElement ); + void parse( const TQDomElement& parentElement ); private: uint msgcnt; uint cnt; - QString context; - //QStringList obsMessages; + TQString context; + //TQStringList obsMessages; }; #endif // LINGUISTIMPORT_H diff --git a/kbabel/filters/xliff/xliffexport.cpp b/kbabel/filters/xliff/xliffexport.cpp index 53527f2c..9400b9c6 100644 --- a/kbabel/filters/xliff/xliffexport.cpp +++ b/kbabel/filters/xliff/xliffexport.cpp @@ -36,11 +36,11 @@ **************************************************************************** */ -#include <qfile.h> -#include "qregexp.h" -#include <qstring.h> -#include <qstringlist.h> -#include <qtextstream.h> +#include <tqfile.h> +#include "tqregexp.h" +#include <tqstring.h> +#include <tqstringlist.h> +#include <tqtextstream.h> #include <kgenericfactory.h> @@ -53,25 +53,25 @@ K_EXPORT_COMPONENT_FACTORY( kbabel_xliffexport, KGenericFactory<XLIFFExportPlugi using namespace KBabel; -XLIFFExportPlugin::XLIFFExportPlugin( QObject * parent, const char * name, const QStringList& ) +XLIFFExportPlugin::XLIFFExportPlugin( TQObject * parent, const char * name, const TQStringList& ) : CatalogExportPlugin( parent, name ) { } -ConversionStatus XLIFFExportPlugin::save( const QString& filename, const QString&, const Catalog * catalog ) +ConversionStatus XLIFFExportPlugin::save( const TQString& filename, const TQString&, const Catalog * catalog ) { // Check whether we know how to handle the extra data. if ( catalog->importPluginID( ) != "XLIFF 1.1" ) return UNSUPPORTED_TYPE; - QFile file( filename ); + TQFile file( filename ); if ( !file.open( IO_WriteOnly ) ) return OS_ERROR; SaveSettings settings = catalog->saveSettings( ); // New DOM document. - QDomDocument doc( "" ); + TQDomDocument doc( "" ); extraData = catalog->catalogExtraData(); kdDebug () << "Setting the document data: " << extraData.first () << endl; @@ -79,20 +79,20 @@ ConversionStatus XLIFFExportPlugin::save( const QString& filename, const QString // Regular messages. for ( uint i = 0; i < catalog->numberOfEntries( ); i++ ) { - QDomElement element = extractComment( doc, *(extraData.at( i+1 )) ); + TQDomElement element = extractComment( doc, *(extraData.at( i+1 )) ); createMessage( doc, element, catalog->msgid( i ).join( "" ), catalog->msgstr( i ).join( "" ) ); } - QTextStream stream( &file ); + TQTextStream stream( &file ); doc.save( stream, 2 ); file.close( ); return OK; } -QDomElement XLIFFExportPlugin::extractComment( QDomDocument& doc, const QString& s ) +TQDomElement XLIFFExportPlugin::extractComment( TQDomDocument& doc, const TQString& s ) { - QString comment( s ); + TQString comment( s ); if ( comment.isEmpty () ) { @@ -100,27 +100,27 @@ QDomElement XLIFFExportPlugin::extractComment( QDomDocument& doc, const QString& } // Extract the context and the actual comment. - comment.remove( QRegExp( "^Context:[\\s]*" ) ); - QString newContext; - QStringList commentlines = QStringList::split ( '\n', comment); + comment.remove( TQRegExp( "^Context:[\\s]*" ) ); + TQString newContext; + TQStringList commentlines = TQStringList::split ( '\n', comment); - QString file = *(commentlines.at(0)); - QString id = *(commentlines.at(1)); + TQString file = *(commentlines.at(0)); + TQString id = *(commentlines.at(1)); kdDebug () << "Looking for file " << file << endl; return getContext( doc, file, id ); } -void XLIFFExportPlugin::createMessage( QDomDocument& doc, QDomElement& translationElement, const QString& msgid, - const QString& msgstr ) +void XLIFFExportPlugin::createMessage( TQDomDocument& doc, TQDomElement& translationElement, const TQString& msgid, + const TQString& msgstr ) { // for empty messages, don't store anything if (msgstr.isEmpty ()) return; // find the trans element - QDomNode node = translationElement.firstChild( ); + TQDomNode node = translationElement.firstChild( ); while ( !node.isNull( ) ) { kdDebug () << node.nodeName () << endl; if ( node.isElement() && node.toElement().tagName( ) == "target") { @@ -139,16 +139,16 @@ void XLIFFExportPlugin::createMessage( QDomDocument& doc, QDomElement& translati node = doc.createElement ("target"); translationElement.appendChild (node); - QDomText data = doc.createTextNode(msgstr ); + TQDomText data = doc.createTextNode(msgstr ); node.appendChild( data ); } } -QDomElement XLIFFExportPlugin::getContext( QDomDocument& doc, const QString& file, const QString& id ) +TQDomElement XLIFFExportPlugin::getContext( TQDomDocument& doc, const TQString& file, const TQString& id ) { - // Find out whether there is already such a context in the QDomDocument. - QDomNode parentelem = doc.documentElement(); - QDomNode elem = doc.documentElement( ).firstChild( ); + // Find out whether there is already such a context in the TQDomDocument. + TQDomNode parentelem = doc.documentElement(); + TQDomNode elem = doc.documentElement( ).firstChild( ); while ( !elem.isNull( ) ) { if ( elem.isElement( ) && elem.toElement().tagName( ) == "file" && elem.toElement().attribute ("original") == file ) { kdDebug () << "We have found the file" << endl; @@ -160,7 +160,7 @@ QDomElement XLIFFExportPlugin::getContext( QDomDocument& doc, const QString& fil if (elem.isNull ()) { kdError () << "File not found at all, creating" << endl; - QDomElement newelem = doc.createElement ("file"); + TQDomElement newelem = doc.createElement ("file"); newelem.setAttribute ("original", file); parentelem.appendChild (newelem); elem = newelem; @@ -180,7 +180,7 @@ QDomElement XLIFFExportPlugin::getContext( QDomDocument& doc, const QString& fil if (elem.isNull ()) { kdError () << "File body not found at all, creating" << endl; - QDomElement newelem = doc.createElement ("body"); + TQDomElement newelem = doc.createElement ("body"); parentelem.appendChild (newelem); elem = newelem; } @@ -190,7 +190,7 @@ QDomElement XLIFFExportPlugin::getContext( QDomDocument& doc, const QString& fil if (elem.isNull ()) { kdError () << "Trans-unit not found at all, creating" << endl; - QDomElement newelem = doc.createElement ("trans-unit"); + TQDomElement newelem = doc.createElement ("trans-unit"); newelem.setAttribute ("id", id); parentelem.appendChild (newelem); elem = newelem; @@ -199,16 +199,16 @@ QDomElement XLIFFExportPlugin::getContext( QDomDocument& doc, const QString& fil return elem.toElement (); } -QDomElement XLIFFExportPlugin::findTransUnit( QDomNode& group, const QString& id ) +TQDomElement XLIFFExportPlugin::findTransUnit( TQDomNode& group, const TQString& id ) { - QDomNode elem = group.firstChild( ); + TQDomNode elem = group.firstChild( ); // lookup correct trans-unit tag while ( !elem.isNull( ) ) { if ( elem.isElement( ) && elem.toElement().tagName() == "group" ) { // search recursively - QDomElement res = findTransUnit( elem, id ); + TQDomElement res = findTransUnit( elem, id ); if (! res.isNull () ) return res.toElement(); } diff --git a/kbabel/filters/xliff/xliffexport.h b/kbabel/filters/xliff/xliffexport.h index 5bf64b25..2e720b82 100644 --- a/kbabel/filters/xliff/xliffexport.h +++ b/kbabel/filters/xliff/xliffexport.h @@ -37,7 +37,7 @@ #ifndef XLIFFEXPORT_H #define XLIFFEXPORT_H -#include <qdom.h> +#include <tqdom.h> #include "catalogfileplugin.h" @@ -51,16 +51,16 @@ class Catalog; class XLIFFExportPlugin : public KBabel::CatalogExportPlugin { public: - XLIFFExportPlugin( QObject * parent, const char * name, const QStringList& ); - virtual KBabel::ConversionStatus save( const QString& filename, const QString& mimetype, const KBabel::Catalog * catalog ); + XLIFFExportPlugin( TQObject * parent, const char * name, const TQStringList& ); + virtual KBabel::ConversionStatus save( const TQString& filename, const TQString& mimetype, const KBabel::Catalog * catalog ); private: - QDomElement extractComment( QDomDocument& doc, const QString& s ); - void createMessage( QDomDocument& doc, QDomElement& context, const QString& msgid, const QString& msgstr ); - QDomElement getContext( QDomDocument& doc, const QString& file, const QString& id); - QDomElement findTransUnit( QDomNode& doc, const QString& id); + TQDomElement extractComment( TQDomDocument& doc, const TQString& s ); + void createMessage( TQDomDocument& doc, TQDomElement& context, const TQString& msgid, const TQString& msgstr ); + TQDomElement getContext( TQDomDocument& doc, const TQString& file, const TQString& id); + TQDomElement findTransUnit( TQDomNode& doc, const TQString& id); - QStringList extraData; + TQStringList extraData; }; #endif // XLIFFEXPORT_H diff --git a/kbabel/filters/xliff/xliffimport.cpp b/kbabel/filters/xliff/xliffimport.cpp index f7de63ce..25f34ec3 100644 --- a/kbabel/filters/xliff/xliffimport.cpp +++ b/kbabel/filters/xliff/xliffimport.cpp @@ -48,12 +48,12 @@ */ // Qt include files -#include <qfile.h> -#include <qfileinfo.h> -#include <qobject.h> -#include <qregexp.h> -#include <qstring.h> -#include <qstringlist.h> +#include <tqfile.h> +#include <tqfileinfo.h> +#include <tqobject.h> +#include <tqregexp.h> +#include <tqstring.h> +#include <tqstringlist.h> // KDE include files #include <kdebug.h> #include <kgenericfactory.h> @@ -68,19 +68,19 @@ K_EXPORT_COMPONENT_FACTORY( kbabel_xliffimport, KGenericFactory<XLIFFImportPlugi using namespace KBabel; -XLIFFImportPlugin::XLIFFImportPlugin( QObject * parent, const char * name, const QStringList& ) +XLIFFImportPlugin::XLIFFImportPlugin( TQObject * parent, const char * name, const TQStringList& ) : CatalogImportPlugin( parent, name ) { } -ConversionStatus XLIFFImportPlugin::load( const QString& filename, const QString& ) +ConversionStatus XLIFFImportPlugin::load( const TQString& filename, const TQString& ) { if ( filename.isEmpty( ) ) { kdDebug( KDEBUG_AREA ) << "fatal error: empty filename to open" << endl; return NO_FILE; } - QFileInfo info( filename ); + TQFileInfo info( filename ); if ( !info.exists( ) || info.isDir( ) ) return NO_FILE; @@ -88,14 +88,14 @@ ConversionStatus XLIFFImportPlugin::load( const QString& filename, const QString if ( !info.isReadable( ) ) return NO_PERMISSIONS; - QFile file( filename ); + TQFile file( filename ); if ( !file.open( IO_ReadOnly ) ) return NO_PERMISSIONS; - QString errorMsg; + TQString errorMsg; int errorLine, errorColumn; - QDomDocument doc; + TQDomDocument doc; if ( !doc.setContent( &file, &errorMsg, &errorLine, &errorColumn ) ) { file.close( ); kdError ( KDEBUG_AREA ) << "Parsing error at line " << errorLine << ", column " << errorColumn << ", error " << errorMsg << endl; @@ -105,7 +105,7 @@ ConversionStatus XLIFFImportPlugin::load( const QString& filename, const QString extraData.clear(); - const QDomElement documentElement( doc.documentElement() ); + const TQDomElement documentElement( doc.documentElement() ); msgcnt = documentElement.elementsByTagName( "trans-unit" ).count(); extraData.append( doc.toString() ); @@ -128,32 +128,32 @@ ConversionStatus XLIFFImportPlugin::load( const QString& filename, const QString return OK; } -void XLIFFImportPlugin::parse( const QDomElement& parentElement ) +void XLIFFImportPlugin::parse( const TQDomElement& parentElement ) { - QDomNode node = parentElement.firstChild( ); + TQDomNode node = parentElement.firstChild( ); while ( !node.isNull( ) ) { if ( node.isElement( ) ) { - QDomElement elem = node.toElement( ); + TQDomElement elem = node.toElement( ); if ( elem.tagName( ) == "body" ) { // nothing to do here } else if ( elem.tagName( ) == "file" ) { - context = elem.attribute( "original", QString() ); + context = elem.attribute( "original", TQString() ); kdDebug ( KDEBUG_AREA ) << "Found file: " << context << endl; } else if ( elem.tagName( ) == "trans-unit" ) { CatalogItem item; - QString comment; + TQString comment; bool isObsolete = false; - const QString id = elem.attribute ("id"); + const TQString id = elem.attribute ("id"); - QDomNode childNode = node.firstChild(); + TQDomNode childNode = node.firstChild(); for ( ; ! childNode.isNull() ; childNode = childNode.nextSibling() ) { if ( childNode.isElement() ) { - const QDomElement elem = childNode.toElement( ); + const TQDomElement elem = childNode.toElement( ); if ( elem.tagName( ) == "source" ) { item.setMsgid( elem.text( ) ); } else if ( elem.tagName( ) == "target" ) { diff --git a/kbabel/filters/xliff/xliffimport.h b/kbabel/filters/xliff/xliffimport.h index 9cf44835..45dd612e 100644 --- a/kbabel/filters/xliff/xliffimport.h +++ b/kbabel/filters/xliff/xliffimport.h @@ -37,7 +37,7 @@ #ifndef XLIFFIMPORT_H #define XLIFFIMPORT_H -#include <qdom.h> +#include <tqdom.h> #include "catalogfileplugin.h" @@ -50,19 +50,19 @@ class QStringList; class XLIFFImportPlugin : public KBabel::CatalogImportPlugin { public: - XLIFFImportPlugin( QObject * parent, const char * name, const QStringList& ); + XLIFFImportPlugin( TQObject * parent, const char * name, const TQStringList& ); - virtual KBabel::ConversionStatus load( const QString& filename, const QString& mimetype ); - virtual const QString id( ) { return "XLIFF 1.1"; } + virtual KBabel::ConversionStatus load( const TQString& filename, const TQString& mimetype ); + virtual const TQString id( ) { return "XLIFF 1.1"; } private: - void parse( const QDomElement& parentElement ); + void parse( const TQDomElement& parentElement ); private: uint msgcnt; uint cnt; - QString context; - QStringList extraData; + TQString context; + TQStringList extraData; }; #endif // XLIFFIMPORT_H |