# # Fix the passing the 'locale' mount option: # - read the real locale from the environment (including the charset), the language is of no use to FS drivers, # - do not attempt to store the locale in the config file, it has to be the current one, # - only pass the locale if the filesystem type is ntfs-3g, HAL is broken and lists 'locale' as available with the Linux # in-kernel ntfs driver (http://bugs.freedesktop.org/show_bug.cgi?id=17753) # --- kdebase-3.5.10/kioslave/media/mediamanager/halbackend.cpp~ 2008-09-29 11:14:16.000000000 +0200 +++ kdebase-3.5.10/kioslave/media/mediamanager/halbackend.cpp 2008-09-29 11:17:08.000000000 +0200 @@ -858,13 +858,6 @@ result << tmp; } - if ( valids.contains("locale") ) - { - value = config.readBoolEntry( "locale", true ); - tmp = QString( "locale=%1" ).arg( value ? "true" : "false" ); - result << tmp; - } - if (valids.contains("utf8")) { value = config.readBoolEntry("utf8", true); @@ -885,6 +878,17 @@ result << "shortname=lower"; } + // pass our locale to the ntfs-3g driver so it can translate local characters + if (valids.contains("locale") && fstype == "ntfs-3g") + { + // have to obtain LC_CTYPE as returned by the `locale` command + // check in the same order as `locale` does + char *cType; + if ( (cType = getenv("LC_ALL")) || (cType = getenv("LC_CTYPE")) || (cType = getenv("LANG")) ) { + result << QString("locale=%1").arg(cType); + } + } + if (valids.contains("sync")) { value = config.readBoolEntry("sync", ( valids.contains("flush") && !fstype.endsWith("fat") ) && removable); @@ -938,7 +942,8 @@ QMap<QString,QString> valids = MediaManagerUtils::splitOptions(options); - const char *names[] = { "ro", "quiet", "atime", "uid", "utf8", "flush", "sync", "locale", 0 }; + const char *names[] = { "ro", "quiet", "atime", "uid", "utf8", "flush", "sync", 0 }; + for (int index = 0; names[index]; ++index) if (valids.contains(names[index])) config.writeEntry(names[index], valids[names[index]] == "true"); @@ -958,10 +963,6 @@ config.writeEntry("automount", valids["automount"]); } - if (valids.contains("locale") ) { - config.writeEntry("locale", valids["locale"]); - } - return true; } @@ -1160,11 +1161,6 @@ soptions << QString("uid=%1").arg(getuid()); } - if (valids["locale"] == "true") - { - soptions << QString("locale=%1").arg( KGlobal::locale()->language() ); - } - if (valids["ro"] == "true") soptions << "ro"; @@ -1189,6 +1185,11 @@ soptions << QString("shortname=%1").arg(valids["shortname"]); } + if (valids.contains("locale")) + { + soptions << QString("locale=%1").arg(valids["locale"]); + } + if (valids.contains("journaling")) { QString option = valids["journaling"];