diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:51:49 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:51:49 +0000 |
commit | 4ae0c208b66e0f7954e194384464fe2d0a2c56dd (patch) | |
tree | b0a7cd1c184f0003c0292eb416ed27f674f9cc43 /kbabel/filters/gettext | |
parent | 1964ea0fb4ab57493ca2ebb709c8d3b5395fd653 (diff) | |
download | tdesdk-4ae0c208b66e0f7954e194384464fe2d0a2c56dd.tar.gz tdesdk-4ae0c208b66e0f7954e194384464fe2d0a2c56dd.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdesdk@1157652 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kbabel/filters/gettext')
-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 |
4 files changed, 149 insertions, 149 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; }; |