diff options
Diffstat (limited to 'kbabel/filters/linguist')
-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 |
4 files changed, 67 insertions, 67 deletions
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 |