summaryrefslogtreecommitdiff
path: root/development/translation/shared/metatranslator.cpp
Side-by-side diff
Diffstat (limited to 'development/translation/shared/metatranslator.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--development/translation/shared/metatranslator.cpp34
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 @@
**
+** 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
@@ -14,2 +18,4 @@
** 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.
**
@@ -140,3 +146,4 @@ bool TsHandler::endElement( const QString& /* namespaceURI */,
if ( contextIsUtf8 )
- tor->insert( MetaTranslatorMessage(context.utf8(), "",
+ tor->insert( MetaTranslatorMessage(context.utf8(),
+ ContextComment,
accum.utf8(), QString::null, TRUE,
@@ -144,3 +151,4 @@ bool TsHandler::endElement( const QString& /* namespaceURI */,
else
- tor->insert( MetaTranslatorMessage(context.ascii(), "",
+ tor->insert( MetaTranslatorMessage(context.ascii(),
+ ContextComment,
accum.ascii(), QString::null, FALSE,
@@ -317,4 +325,4 @@ bool MetaTranslatorMessage::operator<( const MetaTranslatorMessage& m ) const
MetaTranslator::MetaTranslator()
- : codecName( "ISO-8859-1" ), codec( 0 )
{
+ clear();
}
@@ -324,3 +332,2 @@ MetaTranslator::MetaTranslator( const MetaTranslator& tor )
{
-
}
@@ -335,6 +342,11 @@ 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 );
@@ -346,3 +358,2 @@ bool MetaTranslator::load( const QString& filename )
QXmlSimpleReader reader;
- // don't click on these!
reader.setFeature( "http://xml.org/sax/features/namespaces", FALSE );
@@ -360,4 +371,2 @@ bool MetaTranslator::load( const QString& filename )
f.close();
- if ( !ok )
- mm.clear();
return ok;
@@ -386,3 +395,3 @@ 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 ) {
@@ -439,3 +448,4 @@ 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
{
@@ -481,3 +491,3 @@ 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 )
@@ -525,3 +535,3 @@ void MetaTranslator::stripEmptyContexts()
while ( m != mm.end() ) {
- if ( QCString(m.key().sourceText()).isEmpty() ) {
+ if ( QCString(m.key().sourceText()) == ContextComment ) {
TMM::Iterator n = m;