Ignore:
Timestamp:
Aug 2, 2010, 9:27:30 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.3 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/tools/linguist/lupdate/main.cpp

    r651 r769  
    137137
    138138static void updateTsFiles(const Translator &fetchedTor, const QStringList &tsFileNames,
    139     const QByteArray &codecForTr, const QString &sourceLanguage, const QString &targetLanguage,
     139    bool setCodec, const QString &sourceLanguage, const QString &targetLanguage,
    140140    UpdateOptions options, bool *fail)
    141141{
     
    155155            tor.resolveDuplicates();
    156156            cd.clearErrors();
    157             if (!codecForTr.isEmpty() && codecForTr != tor.codecName())
     157            if (setCodec && fetchedTor.codec() != tor.codec())
    158158                qWarning("lupdate warning: Codec for tr() '%s' disagrees with "
    159159                         "existing file's codec '%s'. Expect trouble.",
    160                          codecForTr.constData(), tor.codecName().constData());
     160                         fetchedTor.codecName().constData(), tor.codecName().constData());
    161161            if (!targetLanguage.isEmpty() && targetLanguage != tor.languageCode())
    162162                qWarning("lupdate warning: Specified target language '%s' disagrees with "
     
    168168                         qPrintable(sourceLanguage), qPrintable(tor.sourceLanguageCode()));
    169169        } else {
    170             if (!codecForTr.isEmpty())
    171                 tor.setCodecName(codecForTr);
     170            if (setCodec)
     171                tor.setCodec(fetchedTor.codec());
    172172            if (!targetLanguage.isEmpty())
    173173                tor.setLanguageCode(targetLanguage);
     
    191191            theseOptions |= NoLocations;
    192192        Translator out = merge(tor, fetchedTor, theseOptions, err);
    193         if (!codecForTr.isEmpty())
    194             out.setCodecName(codecForTr);
     193        if (setCodec)
     194            out.setCodec(fetchedTor.codec());
    195195
    196196        if ((options & Verbose) && !err.isEmpty()) {
     
    375375            }
    376376            Translator tor;
    377             QByteArray codecForTr;
     377            bool setCodec = false;
    378378            QStringList tmp = visitor.values(QLatin1String("CODEC"))
    379379                              + visitor.values(QLatin1String("DEFAULTCODEC"))
    380380                              + visitor.values(QLatin1String("CODECFORTR"));
    381381            if (!tmp.isEmpty()) {
    382                 codecForTr = tmp.last().toLatin1();
    383                 tor.setCodecName(codecForTr);
     382                tor.setCodecName(tmp.last().toLatin1());
     383                setCodec = true;
    384384            }
    385385            processProject(false, pfi, visitor, options, codecForSource,
    386386                           targetLanguage, sourceLanguage, &tor, fail);
    387             updateTsFiles(tor, tsFiles, codecForTr, sourceLanguage, targetLanguage, options, fail);
     387            updateTsFiles(tor, tsFiles, setCodec, sourceLanguage, targetLanguage, options, fail);
    388388            continue;
    389389        }
     
    658658        fetchedTor.setCodecName(codecForTr);
    659659        processSources(fetchedTor, sourceFiles, cd);
    660         updateTsFiles(fetchedTor, tsFileNames, codecForTr,
     660        updateTsFiles(fetchedTor, tsFileNames, !codecForTr.isEmpty(),
    661661                      sourceLanguage, targetLanguage, options, &fail);
    662662    } else {
     
    670670            processProjects(true, true, proFiles, options, QByteArray(),
    671671                            targetLanguage, sourceLanguage, &fetchedTor, &fail);
    672             updateTsFiles(fetchedTor, tsFileNames, codecForTr,
     672            updateTsFiles(fetchedTor, tsFileNames, !codecForTr.isEmpty(),
    673673                          sourceLanguage, targetLanguage, options, &fail);
    674674        } else {
Note: See TracChangeset for help on using the changeset viewer.