Changeset 340 for trunk/src


Ignore:
Timestamp:
Nov 23, 2009, 1:22:05 AM (16 years ago)
Author:
Dmitry A. Kuminov
Message:

corelib: Fixed two text codec plugin related issues [vendor bug]:

  • codec plugins were never searched in the application's directroy;
  • even with the above fix applied, the codec requested in LANG would have never been set if it were in the application's directory.
Location:
trunk/src/corelib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/corelib/codecs/qtextcodec.cpp

    r135 r340  
    743743}
    744744
     745static bool codecForLocaleSet = false;
     746void qt_resetCodecForLocale()
     747{
     748    // if QTextCodec::codecForLocale() was called, we assume that the user has
     749    // explicitly set the codec he wants for the locale and don't attempt to
     750    // autodetect it again
     751    if (!codecForLocaleSet)
     752        setupLocaleMapper();
     753}
     754
    745755/*!
    746756    \class QTextCodec
     
    10641074        return;
    10651075#endif
     1076    codecForLocaleSet = true;
    10661077    localeMapper = c;
    10671078    if (!localeMapper)
  • trunk/src/corelib/kernel/qcoreapplication.cpp

    r68 r340  
    497497        d->appendApplicationPathToLibraryPaths();
    498498    }
     499    // QCoreApplication is most likely constructed after static QFactroyLoader
     500    // instances (such as the one for QTextCodecFactoryInterface_iid). Hence, we
     501    // need to inform these instances that we have added new paths.
     502    QFactoryLoader::refreshAll();
     503#ifndef QT_NO_TEXTCODECPLUGIN
     504    // libaryPaths() calls QTextCodec::codecForLocale() before it adds the
     505    // appiication path to the library path. As a result, if this path contains
     506    // a plugin for the codec requested in LANG, this request will be ignored
     507    // because the locale would have been already set by codecForLocale()
     508    // Request codec auto-detection again.
     509    extern void qt_resetCodecForLocale(); // qtextcodec.cpp
     510    qt_resetCodecForLocale();
     511#endif
    499512#endif
    500513
Note: See TracChangeset for help on using the changeset viewer.