From b3980800c2af700d5c5ba3cc3a5f4437d8bcc0d1 Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Thu, 12 Mar 2009 12:38:41 +0000 Subject: [PATCH] apply patcch to fix encoding for Qt-4.5.0 --- kdelibs-4.2.1-encoding-qt45.patch | 57 +++++++++++++++++++++++++++++++ kdelibs.spec | 7 +++- 2 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 kdelibs-4.2.1-encoding-qt45.patch diff --git a/kdelibs-4.2.1-encoding-qt45.patch b/kdelibs-4.2.1-encoding-qt45.patch new file mode 100644 index 0000000..bc00e1b --- /dev/null +++ b/kdelibs-4.2.1-encoding-qt45.patch @@ -0,0 +1,57 @@ +--- kdelibs-4.2.1/kdecore/localization/kcatalog.cpp (Revision 938369) ++++ kdelibs-4.2.1/kdecore/localization/kcatalog.cpp (Revision 938370) +@@ -30,6 +30,24 @@ + #include + #include "gettext.h" + ++ ++static bool s_localeSet = false; ++ ++// Initialize the locale very early during application startup ++// This is necessary for e.g. toLocal8Bit() to work, even before ++// a Q[Core]Application exists (David) ++int kInitializeLocale() ++{ ++ setlocale(LC_ALL, ""); ++#if QT_VERSION >= 0x040500 ++ extern Q_CORE_EXPORT bool qt_locale_initialized; // in Qt since 4.5.0 ++ qt_locale_initialized = true; // as recommended by Thiago ++#endif ++ s_localeSet = true; ++ return 1; ++} ++Q_CONSTRUCTOR_FUNCTION(kInitializeLocale) ++ + // not defined on win32 :( + #ifdef _WIN32 + # ifndef LC_MESSAGES +@@ -50,7 +68,6 @@ + + QByteArray systemLanguage; + +- static int localeSet; + static QByteArray currentLanguage; + + void setupGettextEnv (); +@@ -62,17 +79,15 @@ + return debug << c.d->language << " " << c.d->name << " " << c.d->localeDir; + } + +-int KCatalogPrivate::localeSet = 0; + QByteArray KCatalogPrivate::currentLanguage; + + KCatalog::KCatalog(const QString & name, const QString & language ) + : d( new KCatalogPrivate ) + { +- // Set locales only once. +- if (! KCatalogPrivate::localeSet) { +- setlocale(LC_ALL, ""); +- KCatalogPrivate::localeSet = 1; +- } ++ // Set locales if the static initializer didn't work ++ if (!s_localeSet) { ++ kInitializeLocale(); ++ } + + // Find locale directory for this catalog. + QString localeDir = catalogLocaleDir( name, language ); diff --git a/kdelibs.spec b/kdelibs.spec index 81d35a7..42ced0b 100644 --- a/kdelibs.spec +++ b/kdelibs.spec @@ -1,6 +1,6 @@ Summary: K Desktop Environment 4 - Libraries Version: 4.2.1 -Release: 5%{?dist} +Release: 6%{?dist} %if 0%{?fedora} > 8 Name: kdelibs @@ -86,6 +86,7 @@ Patch25: kdelibs-4.2.0-gcc44-misc.patch # upstream # 4.2 branch Patch100: kdelibs-4.2.1-css.patch +Patch101: kdelibs-4.2.1-encoding-qt45.patch # 4.3 branch Patch200: kdelibs-4.1.96-AllowExternalPaths.patch @@ -223,6 +224,7 @@ sed -i -e "s|@@VERSION_RELEASE@@|%{version}-%{release}|" kio/kio/kprotocolmanage # upstream patches # 4.2 %patch100 -p1 -b .css-style +%patch101 -p1 -b .encoding-qt45 # 4.3 %patch200 -p1 -b .AllowExternalPaths @@ -399,6 +401,9 @@ rm -rf %{buildroot} %changelog +* Thu Mar 12 2009 Than Ngo - 4.2.1-6 +- apply patch to fix encoding for Qt-4.5.0 + * Mon Mar 09 2009 Than Ngo - 4.2.1-5 - apply patch to fix issue in CSS style that causes konqueror shows a blank page