Ticket #343 (automatically detect user's charset)
add show warnind dialog if system and display or source codeset are diferent add global option skip_check_codeset if set then warnind window not show set display_codepage, source_codepage = system locale
Этот коммит содержится в:
родитель
d9a72ea8c9
Коммит
d737b9151f
72
src/main.c
72
src/main.c
@ -238,6 +238,11 @@ int confirm_view_dir = 0;
|
|||||||
/* This flag indicates if the pull down menus by default drop down */
|
/* This flag indicates if the pull down menus by default drop down */
|
||||||
int drop_menus = 0;
|
int drop_menus = 0;
|
||||||
|
|
||||||
|
/* if skip_check_codeset = 1 do not show warning about
|
||||||
|
* system and display codeset is different
|
||||||
|
*/
|
||||||
|
int skip_check_codeset = 0;
|
||||||
|
|
||||||
/* The dialog handle for the main program */
|
/* The dialog handle for the main program */
|
||||||
Dlg_head *midnight_dlg;
|
Dlg_head *midnight_dlg;
|
||||||
|
|
||||||
@ -1449,6 +1454,71 @@ setup_dummy_mc ()
|
|||||||
mc_chdir (d);
|
mc_chdir (d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void check_codeset()
|
||||||
|
{
|
||||||
|
const char *_system_codepage = NULL;
|
||||||
|
const char *_source_codepage = NULL;
|
||||||
|
const char *_display_codepage = NULL;
|
||||||
|
int profile_changed = 0;
|
||||||
|
|
||||||
|
#define CONFY 16
|
||||||
|
#define CONFX 54
|
||||||
|
|
||||||
|
if ( !skip_check_codeset ) {
|
||||||
|
|
||||||
|
QuickWidget ecs_widgets [] = {
|
||||||
|
{ quick_button, 4, 6, 13, CONFY, N_("&Skip"),
|
||||||
|
0, B_EXIT, 0, 0, NULL , NULL, NULL},
|
||||||
|
{ quick_button, 1, 11, 13, CONFY, N_("&Fix it"),
|
||||||
|
0, B_ENTER, 0, 0, NULL , NULL, NULL},
|
||||||
|
{ quick_checkbox, 1, 13, 11, CONFY, N_("don't ask again"),
|
||||||
|
11, 0, &skip_check_codeset, NULL, NULL , NULL, NULL},
|
||||||
|
{ quick_label, 2, 30, 3, CONFY, N_("Chosen display charset (Settings->Display bits)\n"
|
||||||
|
"or source codeset (in mcedit ctrl-t) \n"
|
||||||
|
"does not match one set via locale. \n"
|
||||||
|
"Set correct codeset manually or press <<Fix it>> \n"
|
||||||
|
"to set locale default.\n\n"
|
||||||
|
"Or set \'don't ask again\' and press <<Skip>>"),
|
||||||
|
0, 0, 0, 0, NULL , NULL, NULL},
|
||||||
|
|
||||||
|
NULL_QuickWidget
|
||||||
|
};
|
||||||
|
|
||||||
|
QuickDialog ecs =
|
||||||
|
{ CONFX, CONFY, -1, -1, N_(" Confirmation "), "[Confirmation]",
|
||||||
|
ecs_widgets, 0
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
_system_codepage = str_detect_termencoding();
|
||||||
|
_source_codepage = get_codepage_id (source_codepage);
|
||||||
|
_display_codepage = get_codepage_id (display_codepage);
|
||||||
|
|
||||||
|
if ( (strcmp (_system_codepage, _display_codepage)) ||
|
||||||
|
(strcmp (_system_codepage, _source_codepage)) ) {
|
||||||
|
if (quick_dialog (&ecs) == B_ENTER){
|
||||||
|
display_codepage = get_codepage_index (_system_codepage);
|
||||||
|
cp_display = get_codepage_id (display_codepage);
|
||||||
|
if ( !strcmp (cp_display, _system_codepage)) {
|
||||||
|
mc_config_set_string(mc_main_config, "Misc", "display_codepage", cp_display);
|
||||||
|
mc_config_set_string(mc_main_config, "Misc", "source_codepage", cp_display);
|
||||||
|
display_codepage = get_codepage_index ( cp_display );
|
||||||
|
utf8_display = str_isutf8 (_system_codepage);
|
||||||
|
source_codepage = display_codepage;
|
||||||
|
profile_changed = 1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ( skip_check_codeset ) {
|
||||||
|
mc_config_set_int(mc_main_config, "Midnight-Commander", "skip_check_codeset", 1);
|
||||||
|
profile_changed = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( profile_changed )
|
||||||
|
save_configure ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
done_mc (void)
|
done_mc (void)
|
||||||
{
|
{
|
||||||
@ -1770,6 +1840,8 @@ do_nc (void)
|
|||||||
|
|
||||||
setup_mc ();
|
setup_mc ();
|
||||||
|
|
||||||
|
check_codeset();
|
||||||
|
|
||||||
setup_panels_and_run_mc ();
|
setup_panels_and_run_mc ();
|
||||||
|
|
||||||
/* Program end */
|
/* Program end */
|
||||||
|
@ -78,7 +78,7 @@ extern int midnight_shutdown;
|
|||||||
extern char cmd_buf [512];
|
extern char cmd_buf [512];
|
||||||
extern const char *shell;
|
extern const char *shell;
|
||||||
extern int auto_fill_mkdir_name;
|
extern int auto_fill_mkdir_name;
|
||||||
|
extern int skip_check_codeset;
|
||||||
/* Ugly hack in order to distinguish between left and right panel in menubar */
|
/* Ugly hack in order to distinguish between left and right panel in menubar */
|
||||||
extern int is_right; /* If the selected menu was the right */
|
extern int is_right; /* If the selected menu was the right */
|
||||||
#define MENU_PANEL (is_right ? right_panel : left_panel)
|
#define MENU_PANEL (is_right ? right_panel : left_panel)
|
||||||
|
@ -194,6 +194,7 @@ static const struct {
|
|||||||
{ "xtree_mode", &xtree_mode },
|
{ "xtree_mode", &xtree_mode },
|
||||||
{ "num_history_items_recorded", &num_history_items_recorded },
|
{ "num_history_items_recorded", &num_history_items_recorded },
|
||||||
{ "file_op_compute_totals", &file_op_compute_totals },
|
{ "file_op_compute_totals", &file_op_compute_totals },
|
||||||
|
{ "skip_check_codeset", &skip_check_codeset },
|
||||||
#ifdef USE_VFS
|
#ifdef USE_VFS
|
||||||
{ "vfs_timeout", &vfs_timeout },
|
{ "vfs_timeout", &vfs_timeout },
|
||||||
#ifdef USE_NETCODE
|
#ifdef USE_NETCODE
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user