diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index be0ee11c..ca664ea1 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -40,7 +40,6 @@ check_include_files(unistd.h HAVE_UNISTD_H) # various check_include_files(stdint.h HAVE_STDINT_H) # various check_include_files(sys/time.h HAVE_SYS_TIME_H) # various -check_include_files(langinfo.h HAVE_LANGINFO_H) # kdecore # TODO: separate to config-x11.h macro_bool_to_01(X11_XTest_FOUND HAVE_XTEST) # kdecore diff --git a/kdecore/CMakeLists.txt b/kdecore/CMakeLists.txt index a61597a5..961192aa 100644 --- a/kdecore/CMakeLists.txt +++ b/kdecore/CMakeLists.txt @@ -40,12 +40,6 @@ configure_file( ${CMAKE_CURRENT_BINARY_DIR}/BackendsConfig.h ) -# Configure checks for localization -configure_file( - localization/config-localization.h.cmake - ${CMAKE_CURRENT_BINARY_DIR}/config-localization.h -) - include_directories( ${KDE4_KDECORE_INCLUDES} ${KDE4_KDEUI_INCLUDES} diff --git a/kdecore/localization/config-localization.h.cmake b/kdecore/localization/config-localization.h.cmake deleted file mode 100644 index 189cabd3..00000000 --- a/kdecore/localization/config-localization.h.cmake +++ /dev/null @@ -1 +0,0 @@ -#cmakedefine01 HAVE_LANGINFO_H diff --git a/kdecore/localization/klocale_kde.cpp b/kdecore/localization/klocale_kde.cpp index b091f013..7565116d 100644 --- a/kdecore/localization/klocale_kde.cpp +++ b/kdecore/localization/klocale_kde.cpp @@ -24,8 +24,6 @@ #include "klocale_p.h" -#include "config-localization.h" - #include #include @@ -35,9 +33,6 @@ #ifdef HAVE_TIME_H #include #endif -#if HAVE_LANGINFO_H -#include -#endif #include #include @@ -2604,17 +2599,7 @@ void KLocalePrivate::initEncoding() m_codecForEncoding = 0; // This all made more sense when we still had the EncodingEnum config key. - - QByteArray codeset = systemCodeset(); - - if (!codeset.isEmpty()) { - QTextCodec* codec = QTextCodec::codecForName(codeset); - if (codec) { - setEncoding(codec->mibEnum()); - } - } else { - setEncoding(QTextCodec::codecForLocale()->mibEnum()); - } + setEncoding(QTextCodec::codecForLocale()->mibEnum()); if (!m_codecForEncoding) { kWarning() << "Cannot resolve system encoding, defaulting to ISO 8859-1."; @@ -2625,25 +2610,6 @@ void KLocalePrivate::initEncoding() Q_ASSERT(m_codecForEncoding); } -QByteArray KLocalePrivate::systemCodeset() const -{ - QByteArray codeset; -#if HAVE_LANGINFO_H - // Qt since 4.2 always returns 'System' as codecForLocale and KDE (for example - // KEncodingFileDialog) expects real encoding name. So on systems that have langinfo.h use - // nl_langinfo instead, just like Qt compiled without iconv does. Windows already has its own - // workaround - - codeset = nl_langinfo(CODESET); - - if ((codeset == "ANSI_X3.4-1968") || (codeset == "US-ASCII")) { - // means ascii, "C"; QTextCodec doesn't know, so avoid warning - codeset = "ISO-8859-1"; - } -#endif - return codeset; -} - void KLocalePrivate::initFileNameEncoding() { // If the following environment variable is set, assume all filenames @@ -2656,10 +2622,10 @@ void KLocalePrivate::initFileNameEncoding() return; } QByteArray lang = qgetenv("LC_ALL"); - if (lang.isEmpty() || lang == "C") { + if (lang.isEmpty()) { lang = qgetenv("LC_CTYPE"); } - if (lang.isEmpty() || lang == "C") { + if (lang.isEmpty()) { lang = qgetenv("LANG"); } if (lang.endsWith("UTF-8")) { diff --git a/kdecore/localization/klocale_p.h b/kdecore/localization/klocale_p.h index 13699b7f..4ef68c34 100644 --- a/kdecore/localization/klocale_p.h +++ b/kdecore/localization/klocale_p.h @@ -1056,11 +1056,6 @@ protected: */ virtual void initFileNameEncoding(); - /** - * @internal Returns the system codeset. - */ - virtual QByteArray systemCodeset() const; - public: /**