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