add source_codepage to ini file, change mechanism (ctrl-t) of selection codepage

if codepage selected then this is source codepage and must be convert to utf-8
This commit is contained in:
Ilia Maslakov 2009-04-09 07:57:40 +00:00
parent f845e4b569
commit d004658a1d
2 changed files with 15 additions and 15 deletions

View File

@ -93,21 +93,16 @@ int
do_select_codepage (void)
{
const char *errmsg;
int r;
if (display_codepage > 0) {
source_codepage = select_charset (source_codepage, 0);
errmsg =
init_translation_table (source_codepage, display_codepage);
if (errmsg) {
message (D_ERROR, MSG_ERROR, "%s", errmsg);
return -1;
}
} else {
message (D_ERROR, _("Warning"),
_("To use this feature select your codepage in\n"
"Setup / Display Bits dialog!\n"
"Do not forget to save options."));
return -1;
r = select_charset (source_codepage, 0);
if ( r > 0 )
source_codepage = r;
errmsg = init_translation_table (source_codepage, display_codepage);
if (errmsg) {
message (D_ERROR, MSG_ERROR, "%s", errmsg);
return -1;
}
return 0;
}

View File

@ -378,6 +378,8 @@ save_setup (void)
#ifdef HAVE_CHARSET
save_string( "Misc", "display_codepage",
get_codepage_id( display_codepage ), profile_name );
save_string( "Misc", "source_codepage",
get_codepage_id( source_codepage ), profile_name );
#endif /* HAVE_CHARSET */
g_free (profile);
@ -581,8 +583,11 @@ load_setup (void)
cpname, sizeof(cpname) );
if ( cpname[0] != '\0' )
display_codepage = get_codepage_index( cpname );
load_string( "Misc", "source_codepage", "",
cpname, sizeof(cpname) );
if ( cpname[0] != '\0' )
source_codepage = get_codepage_index( cpname );
}
init_translation_table( source_codepage, display_codepage );
#endif /* HAVE_CHARSET */
}