changeset 29055:8f07c47242b8 stable

Show correct system encoding in drop-down list in editor settings. * libgui/src/resource-manager.cc (resource_manager::combo_encoding): For "system", show correct locale charset in parenthesis.
author Markus Mützel <markus.muetzel@gmx.de>
date Thu, 12 Nov 2020 18:22:45 +0100
parents 0678fdb81efc
children dbf8a7f16c4e c76d3afe3d23
files libgui/src/resource-manager.cc
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/resource-manager.cc	Thu Nov 12 01:21:29 2020 -0500
+++ b/libgui/src/resource-manager.cc	Thu Nov 12 18:22:45 2020 +0100
@@ -449,8 +449,10 @@
     // FIXME: The default is "SYSTEM" on all platforms.  So can this fallback
     // logic be removed completely?
     bool default_exists = false;
-    if (QTextCodec::codecForName (ed_default_enc.def.toString ().toLatin1 ())
-        || (ed_default_enc.def.toString ().startsWith ("SYSTEM")))
+    bool show_system = false;
+    if (ed_default_enc.def.toString ().startsWith ("SYSTEM"))
+      show_system = true;
+    else if (QTextCodec::codecForName (ed_default_enc.def.toString ().toLatin1 ()))
       default_exists = true;
 
     QString default_enc =
@@ -476,10 +478,10 @@
 
     // prepend the default item
     combo->insertSeparator (0);
-    if (default_exists)
+    if (show_system)
+      combo->insertItem (0, default_enc);
+    else
       combo->insertItem (0, ed_default_enc.def.toString ());
-    else
-      combo->insertItem (0, default_enc);
 
     // select the default or the current one
     int idx = combo->findText (enc, Qt::MatchExactly);