Diffstat (limited to 'development/translation/shared/metatranslator.cpp') (more/less context) (show 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 | |||
@@ -10,2 +10,6 @@ | |||
10 | ** | 10 | ** |
11 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | ||
12 | ** licenses may use this file in accordance with the Qt Commercial License | ||
13 | ** Agreement provided with the Software. | ||
14 | ** | ||
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 15 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
@@ -14,2 +18,4 @@ | |||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 18 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
19 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | ||
20 | ** information about Qt Commercial License Agreements. | ||
15 | ** | 21 | ** |
@@ -140,3 +146,4 @@ bool TsHandler::endElement( const QString& /* namespaceURI */, | |||
140 | if ( contextIsUtf8 ) | 146 | if ( contextIsUtf8 ) |
141 | tor->insert( MetaTranslatorMessage(context.utf8(), "", | 147 | tor->insert( MetaTranslatorMessage(context.utf8(), |
148 | ContextComment, | ||
142 | accum.utf8(), QString::null, TRUE, | 149 | accum.utf8(), QString::null, TRUE, |
@@ -144,3 +151,4 @@ bool TsHandler::endElement( const QString& /* namespaceURI */, | |||
144 | else | 151 | else |
145 | tor->insert( MetaTranslatorMessage(context.ascii(), "", | 152 | tor->insert( MetaTranslatorMessage(context.ascii(), |
153 | ContextComment, | ||
146 | accum.ascii(), QString::null, FALSE, | 154 | accum.ascii(), QString::null, FALSE, |
@@ -317,4 +325,4 @@ bool MetaTranslatorMessage::operator<( const MetaTranslatorMessage& m ) const | |||
317 | MetaTranslator::MetaTranslator() | 325 | MetaTranslator::MetaTranslator() |
318 | : codecName( "ISO-8859-1" ), codec( 0 ) | ||
319 | { | 326 | { |
327 | clear(); | ||
320 | } | 328 | } |
@@ -324,3 +332,2 @@ MetaTranslator::MetaTranslator( const MetaTranslator& tor ) | |||
324 | { | 332 | { |
325 | |||
326 | } | 333 | } |
@@ -335,6 +342,11 @@ MetaTranslator& MetaTranslator::operator=( const MetaTranslator& tor ) | |||
335 | 342 | ||
336 | bool MetaTranslator::load( const QString& filename ) | 343 | void MetaTranslator::clear() |
337 | { | 344 | { |
338 | mm.clear(); | 345 | mm.clear(); |
346 | codecName = "ISO-8859-1"; | ||
347 | codec = 0; | ||
348 | } | ||
339 | 349 | ||
350 | bool MetaTranslator::load( const QString& filename ) | ||
351 | { | ||
340 | QFile f( filename ); | 352 | QFile f( filename ); |
@@ -346,3 +358,2 @@ bool MetaTranslator::load( const QString& filename ) | |||
346 | QXmlSimpleReader reader; | 358 | QXmlSimpleReader reader; |
347 | // don't click on these! | ||
348 | reader.setFeature( "http://xml.org/sax/features/namespaces", FALSE ); | 359 | reader.setFeature( "http://xml.org/sax/features/namespaces", FALSE ); |
@@ -360,4 +371,2 @@ bool MetaTranslator::load( const QString& filename ) | |||
360 | f.close(); | 371 | f.close(); |
361 | if ( !ok ) | ||
362 | mm.clear(); | ||
363 | return ok; | 372 | return ok; |
@@ -386,3 +395,3 @@ bool MetaTranslator::save( const QString& filename ) const | |||
386 | do { | 395 | do { |
387 | if ( QCString(m.key().sourceText()).isEmpty() ) { | 396 | if ( QCString(m.key().sourceText()) == ContextComment ) { |
388 | if ( m.key().type() != MetaTranslatorMessage::Obsolete ) { | 397 | if ( m.key().type() != MetaTranslatorMessage::Obsolete ) { |
@@ -439,3 +448,4 @@ bool MetaTranslator::save( const QString& filename ) const | |||
439 | 448 | ||
440 | bool MetaTranslator::release( const QString& filename, bool verbose ) const | 449 | bool MetaTranslator::release( const QString& filename, bool verbose, |
450 | QTranslator::SaveMode mode ) const | ||
441 | { | 451 | { |
@@ -481,3 +491,3 @@ bool MetaTranslator::release( const QString& filename, bool verbose ) const | |||
481 | 491 | ||
482 | bool saved = tor.save( filename, QTranslator::Stripped ); | 492 | bool saved = tor.save( filename, mode ); |
483 | if ( saved && verbose ) | 493 | if ( saved && verbose ) |
@@ -525,3 +535,3 @@ void MetaTranslator::stripEmptyContexts() | |||
525 | while ( m != mm.end() ) { | 535 | while ( m != mm.end() ) { |
526 | if ( QCString(m.key().sourceText()).isEmpty() ) { | 536 | if ( QCString(m.key().sourceText()) == ContextComment ) { |
527 | TMM::Iterator n = m; | 537 | TMM::Iterator n = m; |