author | zecke <zecke> | 2004-01-09 19:13:35 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-01-09 19:13:35 (UTC) |
commit | 56bb9961db1158250bbfe971f4556b56c0bd6581 (patch) (side-by-side diff) | |
tree | a4f40da98f695b5aadd845b68aaab41ac3d81826 /development/translation/shared/metatranslator.cpp | |
parent | 6875988077013544246ae0df7cc2e5d538a7f152 (diff) | |
download | opie-56bb9961db1158250bbfe971f4556b56c0bd6581.zip opie-56bb9961db1158250bbfe971f4556b56c0bd6581.tar.gz opie-56bb9961db1158250bbfe971f4556b56c0bd6581.tar.bz2 |
Update lupdate and shared to Qt3.3 qt-copy sources
Some special replacement for $$(OPIEDIR) to make ar_* happy
Diffstat (limited to 'development/translation/shared/metatranslator.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | development/translation/shared/metatranslator.cpp | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/development/translation/shared/metatranslator.cpp b/development/translation/shared/metatranslator.cpp index a01e1eb..51270c5 100644 --- a/development/translation/shared/metatranslator.cpp +++ b/development/translation/shared/metatranslator.cpp @@ -9,8 +9,14 @@ ** packaging of this file. ** +** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition +** licenses may use this file in accordance with the Qt Commercial License +** Agreement provided with the Software. +** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. +** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for +** information about Qt Commercial License Agreements. ** ** Contact info@trolltech.com if any conditions of this licensing are @@ -139,9 +145,11 @@ bool TsHandler::endElement( const QString& /* namespaceURI */, } else { if ( contextIsUtf8 ) - tor->insert( MetaTranslatorMessage(context.utf8(), "", + tor->insert( MetaTranslatorMessage(context.utf8(), + ContextComment, accum.utf8(), QString::null, TRUE, MetaTranslatorMessage::Unfinished) ); else - tor->insert( MetaTranslatorMessage(context.ascii(), "", + tor->insert( MetaTranslatorMessage(context.ascii(), + ContextComment, accum.ascii(), QString::null, FALSE, MetaTranslatorMessage::Unfinished) ); @@ -316,6 +324,6 @@ bool MetaTranslatorMessage::operator<( const MetaTranslatorMessage& m ) const MetaTranslator::MetaTranslator() - : codecName( "ISO-8859-1" ), codec( 0 ) { + clear(); } @@ -323,5 +331,4 @@ MetaTranslator::MetaTranslator( const MetaTranslator& tor ) : mm( tor.mm ), codecName( tor.codecName ), codec( tor.codec ) { - } @@ -334,8 +341,13 @@ MetaTranslator& MetaTranslator::operator=( const MetaTranslator& tor ) } -bool MetaTranslator::load( const QString& filename ) +void MetaTranslator::clear() { mm.clear(); + codecName = "ISO-8859-1"; + codec = 0; +} +bool MetaTranslator::load( const QString& filename ) +{ QFile f( filename ); if ( !f.open(IO_ReadOnly) ) @@ -345,5 +357,4 @@ bool MetaTranslator::load( const QString& filename ) QXmlInputSource in( t ); QXmlSimpleReader reader; - // don't click on these! reader.setFeature( "http://xml.org/sax/features/namespaces", FALSE ); reader.setFeature( "http://xml.org/sax/features/namespace-prefixes", TRUE ); @@ -359,6 +370,4 @@ bool MetaTranslator::load( const QString& filename ) delete hand; f.close(); - if ( !ok ) - mm.clear(); return ok; } @@ -385,5 +394,5 @@ bool MetaTranslator::save( const QString& filename ) const do { - if ( QCString(m.key().sourceText()).isEmpty() ) { + if ( QCString(m.key().sourceText()) == ContextComment ) { if ( m.key().type() != MetaTranslatorMessage::Obsolete ) { contextIsUtf8 = m.key().utf8(); @@ -438,5 +447,6 @@ bool MetaTranslator::save( const QString& filename ) const } -bool MetaTranslator::release( const QString& filename, bool verbose ) const +bool MetaTranslator::release( const QString& filename, bool verbose, + QTranslator::SaveMode mode ) const { QTranslator tor( 0 ); @@ -480,5 +490,5 @@ bool MetaTranslator::release( const QString& filename, bool verbose ) const } - bool saved = tor.save( filename, QTranslator::Stripped ); + bool saved = tor.save( filename, mode ); if ( saved && verbose ) fprintf( stderr, @@ -524,5 +534,5 @@ void MetaTranslator::stripEmptyContexts() TMM::Iterator m = mm.begin(); while ( m != mm.end() ) { - if ( QCString(m.key().sourceText()).isEmpty() ) { + if ( QCString(m.key().sourceText()) == ContextComment ) { TMM::Iterator n = m; ++n; |