apply patcch to fix encoding for Qt-4.5.0

This commit is contained in:
Than Ngo 2009-03-12 12:38:41 +00:00
parent b218f00ee7
commit b3980800c2
2 changed files with 63 additions and 1 deletions

View File

@ -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 <locale.h>
#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 );

View File

@ -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 <than@redhat.com> - 4.2.1-6
- apply patch to fix encoding for Qt-4.5.0
* Mon Mar 09 2009 Than Ngo <than@redhat.com> - 4.2.1-5
- apply patch to fix issue in CSS style that causes konqueror shows a blank page