Extend QUICK_INPUT and QUICK_LABELED_INPUT macros for getting completion flags via parameters instead of using hardcoded value

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
Slava Zanko 2013-01-25 15:41:41 +03:00
parent 9935acea33
commit 2d58735deb
20 changed files with 147 additions and 107 deletions

View File

@ -349,7 +349,8 @@ vfs_die (const char *m)
char *
vfs_get_password (const char *msg)
{
return input_dialog (msg, _("Password:"), MC_HISTORY_VFS_PASSWORD, INPUT_PASSWORD);
return input_dialog (msg, _("Password:"), MC_HISTORY_VFS_PASSWORD, INPUT_PASSWORD,
INPUT_COMPLETE_DEFAULT);
}
/* --------------------------------------------------------------------------------------------- */

View File

@ -72,12 +72,10 @@ quick_create_input (int y, int x, const quick_widget_t * qw)
WInput *in;
in = input_new (y, x, input_get_default_colors (), 8, qw->u.input.text, qw->u.input.histname,
INPUT_COMPLETE_DEFAULT);
in->is_password = (qw->u.input.flags == 1);
if ((qw->u.input.flags & 2) != 0)
in->completion_flags |= INPUT_COMPLETE_CD;
if ((qw->u.input.flags & 4) != 0)
in->strip_password = TRUE;
qw->u.input.completion_flags);
in->is_password = qw->u.input.is_passwd;
in->strip_password = qw->u.input.strip_passwd;
return in;
}
@ -587,7 +585,7 @@ quick_dialog_skip (quick_dialog_t * quick_dlg, int nskip)
break;
case quick_input:
if ((quick_widget->u.input.flags & 2) != 0)
if ((quick_widget->u.input.completion_flags & INPUT_COMPLETE_CD) != 0)
*item->quick_widget->u.input.result =
tilde_expand (INPUT (item->widget)->buffer);
else

View File

@ -38,7 +38,7 @@
} \
}
#define QUICK_INPUT(txt, flags_, hname, res, id_) \
#define QUICK_INPUT(txt, hname, res, id_, is_passwd_, strip_passwd_, completion_flags_) \
{ \
.widget_type = quick_input, \
.options = 0, \
@ -50,14 +50,16 @@
.label_location = input_label_none, \
.label = NULL, \
.text = txt, \
.flags = flags_, \
.completion_flags = completion_flags_, \
.is_passwd = is_passwd_, \
.strip_passwd = strip_passwd_, \
.histname = hname, \
.result = res \
} \
} \
}
#define QUICK_LABELED_INPUT(label_, label_loc, txt, flags_, hname, res, id_) \
#define QUICK_LABELED_INPUT(label_, label_loc, txt, hname, res, id_, is_passwd_, strip_passwd_, completion_flags_) \
{ \
.widget_type = quick_input, \
.options = 0, \
@ -69,7 +71,9 @@
.label_location = label_loc, \
.label = NULL, \
.text = txt, \
.flags = flags_, \
.completion_flags = completion_flags_, \
.is_passwd = is_passwd_, \
.strip_passwd = strip_passwd_, \
.histname = hname, \
.result = res \
} \
@ -127,7 +131,6 @@
.u = { \
.input = { \
.text = NULL, \
.flags = 0, \
.histname = NULL, \
.result = NULL \
} \
@ -157,7 +160,6 @@
.u = { \
.input = { \
.text = NULL, \
.flags = 0, \
.histname = NULL, \
.result = NULL \
} \
@ -173,7 +175,6 @@
.u = { \
.input = { \
.text = NULL, \
.flags = 0, \
.histname = NULL, \
.result = NULL \
} \
@ -189,7 +190,6 @@
.u = { \
.input = { \
.text = NULL, \
.flags = 0, \
.histname = NULL, \
.result = NULL \
} \
@ -224,7 +224,6 @@
.u = { \
.input = { \
.text = NULL, \
.flags = 0, \
.histname = NULL, \
.result = NULL \
} \
@ -295,10 +294,11 @@ struct quick_widget_t
quick_input_label_location_t label_location;
quick_widget_t *label;
const char *text;
int flags; /* 1 -- is_password, 2 -- INPUT_COMPLETE_CD */
input_complete_t completion_flags;
gboolean is_passwd; /* TRUE -- is password */
gboolean strip_passwd;
const char *histname;
char **result;
gboolean strip_password;
} input;
struct

View File

@ -182,11 +182,12 @@ bg_message (int dummy, int *flags, char *title, const char *text)
*/
static char *
fg_input_dialog_help (const char *header, const char *text, const char *help,
const char *history_name, const char *def_text, gboolean strip_password)
const char *history_name, const char *def_text, gboolean strip_password,
input_complete_t completion_flags)
{
char *p_text;
char histname[64] = "inp|";
int flags = strip_password ? 4 : 0;
gboolean is_passwd = FALSE;
char *my_str;
int ret;
@ -201,7 +202,7 @@ fg_input_dialog_help (const char *header, const char *text, const char *help,
and hide characters with "*". Don't save passwords in history! */
if (def_text == INPUT_PASSWORD)
{
flags = 1;
is_passwd = TRUE;
histname[3] = '\0';
def_text = "";
}
@ -209,8 +210,8 @@ fg_input_dialog_help (const char *header, const char *text, const char *help,
{
quick_widget_t quick_widgets[] = {
/* *INDENT-OFF* */
QUICK_LABELED_INPUT (p_text, input_label_above, def_text, flags, histname, &my_str,
NULL),
QUICK_LABELED_INPUT (p_text, input_label_above, def_text, histname, &my_str,
NULL, is_passwd, strip_password, completion_flags),
QUICK_BUTTONS_OK_CANCEL,
QUICK_END
/* *INDENT-ON* */
@ -440,7 +441,8 @@ message (int flags, const char *title, const char *text, ...)
char *
input_dialog_help (const char *header, const char *text, const char *help,
const char *history_name, const char *def_text, gboolean strip_password)
const char *history_name, const char *def_text, gboolean strip_password,
input_complete_t completion_flags)
{
#ifdef ENABLE_BACKGROUND
if (mc_global.we_are_background)
@ -449,40 +451,45 @@ input_dialog_help (const char *header, const char *text, const char *help,
{
void *p;
char *(*f) (const char *, const char *, const char *, const char *, const char *,
gboolean);
gboolean, input_complete_t);
} func;
func.f = fg_input_dialog_help;
return wtools_parent_call_string (func.p, 6,
return wtools_parent_call_string (func.p, 7,
strlen (header), header, strlen (text),
text, strlen (help), help,
strlen (history_name), history_name,
strlen (def_text), def_text,
sizeof (gboolean), strip_password);
sizeof (gboolean), strip_password,
sizeof (input_complete_t), completion_flags);
}
else
#endif /* ENABLE_BACKGROUND */
return fg_input_dialog_help (header, text, help, history_name, def_text, strip_password);
return fg_input_dialog_help (header, text, help, history_name, def_text, strip_password,
completion_flags);
}
/* --------------------------------------------------------------------------------------------- */
/** Show input dialog with default help, background safe */
char *
input_dialog (const char *header, const char *text, const char *history_name, const char *def_text)
input_dialog (const char *header, const char *text, const char *history_name, const char *def_text,
input_complete_t completion_flags)
{
return input_dialog_help (header, text, "[Input Line Keys]", history_name, def_text, FALSE);
return input_dialog_help (header, text, "[Input Line Keys]", history_name, def_text, FALSE,
completion_flags);
}
/* --------------------------------------------------------------------------------------------- */
char *
input_expand_dialog (const char *header, const char *text,
const char *history_name, const char *def_text)
const char *history_name, const char *def_text,
input_complete_t completion_flags)
{
char *result;
char *expanded;
result = input_dialog (header, text, history_name, def_text);
result = input_dialog (header, text, history_name, def_text, completion_flags);
if (result)
{
expanded = tilde_expand (result);

View File

@ -31,11 +31,13 @@ enum
/* The input dialogs */
char *input_dialog (const char *header, const char *text,
const char *history_name, const char *def_text);
const char *history_name, const char *def_text,
input_complete_t completion_flags);
char *input_dialog_help (const char *header, const char *text, const char *help,
const char *history_name, const char *def_text, gboolean strip_password);
char *input_expand_dialog (const char *header, const char *text,
const char *history_name, const char *def_text);
const char *history_name, const char *def_text, gboolean strip_password,
input_complete_t completion_flags);
char *input_expand_dialog (const char *header, const char *text, const char *history_name,
const char *def_text, input_complete_t completion_flags);
int query_dialog (const char *header, const char *text, int flags, int count, ...);
void query_set_sel (int new_sel);

View File

@ -82,8 +82,8 @@ mcdiffview_dialog_search (WDiff * dview)
{
quick_widget_t quick_widgets[] = {
/* *INDENT-OFF* */
QUICK_LABELED_INPUT (N_("Enter search string:"), input_label_above,
INPUT_LAST_TEXT, 0, MC_HISTORY_SHARED_SEARCH, &exp, NULL),
QUICK_LABELED_INPUT (N_("Enter search string:"), input_label_above, INPUT_LAST_TEXT,
MC_HISTORY_SHARED_SEARCH, &exp, NULL, FALSE, FALSE, INPUT_COMPLETE_DEFAULT),
QUICK_SEPARATOR (TRUE),
QUICK_START_COLUMNS,
QUICK_RADIO (num_of_types, (const char **) list_of_types,

View File

@ -2908,7 +2908,9 @@ dview_goto_cmd (WDiff * dview, diff_place_t ord)
int newline;
char *input;
input = input_dialog (_(title[ord]), _("Enter line:"), MC_HISTORY_YDIFF_GOTO_LINE, prev);
input =
input_dialog (_(title[ord]), _("Enter line:"), MC_HISTORY_YDIFF_GOTO_LINE, prev,
INPUT_COMPLETE_DEFAULT);
if (input != NULL)
{
const char *s = input;

View File

@ -462,8 +462,8 @@ edit_get_save_file_as (WEdit * edit)
{
quick_widget_t quick_widgets[] = {
/* *INDENT-OFF* */
QUICK_LABELED_INPUT (N_("Enter file name:"), input_label_above, filename, 0, "save-as",
&filename_res, NULL),
QUICK_LABELED_INPUT (N_("Enter file name:"), input_label_above, filename, "save-as",
&filename_res, NULL, FALSE, FALSE, INPUT_COMPLETE_DEFAULT),
QUICK_SEPARATOR (TRUE),
QUICK_LABEL (N_("Change line breaks to:"), NULL),
QUICK_RADIO (LB_NAMES, lb_names, (int *) &cur_lb, NULL),
@ -1602,8 +1602,8 @@ edit_save_mode_cmd (void)
quick_widget_t quick_widgets[] = {
/* *INDENT-OFF* */
QUICK_RADIO (3, str, &option_save_mode, &edit_save_mode_radio_id),
QUICK_INPUT (option_backup_ext, 0, "edit-backup-ext", &str_result,
&edit_save_mode_input_id),
QUICK_INPUT (option_backup_ext, "edit-backup-ext", &str_result,
&edit_save_mode_input_id, FALSE, FALSE, INPUT_COMPLETE_DEFAULT),
QUICK_SEPARATOR (TRUE),
QUICK_CHECKBOX (N_("Check &POSIX new line"), &option_check_nl_at_eof, NULL),
QUICK_BUTTONS_OK_CANCEL,
@ -1897,7 +1897,8 @@ edit_repeat_macro_cmd (WEdit * edit)
long count_repeat;
char *error = NULL;
f = input_dialog (_("Repeat last commands"), _("Repeat times:"), MC_HISTORY_EDIT_REPEAT, NULL);
f = input_dialog (_("Repeat last commands"), _("Repeat times:"), MC_HISTORY_EDIT_REPEAT, NULL,
INPUT_COMPLETE_DEFAULT);
if (f == NULL || *f == '\0')
{
g_free (f);
@ -2063,7 +2064,7 @@ edit_load_cmd (WDialog * h)
gboolean ret = TRUE; /* possible cancel */
exp = input_expand_dialog (_("Load"), _("Enter file name:"),
MC_HISTORY_EDIT_LOAD, INPUT_LAST_TEXT);
MC_HISTORY_EDIT_LOAD, INPUT_LAST_TEXT, INPUT_COMPLETE_DEFAULT);
if (exp != NULL && *exp != '\0')
{
@ -3058,7 +3059,8 @@ edit_goto_cmd (WEdit * edit)
char s[32];
g_snprintf (s, sizeof (s), "%ld", line);
f = input_dialog (_("Goto line"), _("Enter line:"), MC_HISTORY_EDIT_GOTO_LINE, line ? s : "");
f = input_dialog (_("Goto line"), _("Enter line:"), MC_HISTORY_EDIT_GOTO_LINE, line ? s : "",
INPUT_COMPLETE_DEFAULT);
if (!f)
return;
@ -3101,7 +3103,7 @@ edit_save_block_cmd (WEdit * edit)
tmp = mc_config_get_full_path (EDIT_CLIP_FILE);
exp =
input_expand_dialog (_("Save block"), _("Enter file name:"),
MC_HISTORY_EDIT_SAVE_BLOCK, tmp);
MC_HISTORY_EDIT_SAVE_BLOCK, tmp, INPUT_COMPLETE_DEFAULT);
g_free (tmp);
edit_push_undo_action (edit, KEY_PRESS + edit->start_display);
@ -3133,7 +3135,7 @@ edit_insert_file_cmd (WEdit * edit)
tmp = mc_config_get_full_path (EDIT_CLIP_FILE);
exp = input_expand_dialog (_("Insert file"), _("Enter file name:"),
MC_HISTORY_EDIT_INSERT_FILE, tmp);
MC_HISTORY_EDIT_INSERT_FILE, tmp, INPUT_COMPLETE_DEFAULT);
g_free (tmp);
edit_push_undo_action (edit, KEY_PRESS + edit->start_display);
@ -3179,7 +3181,7 @@ edit_sort_cmd (WEdit * edit)
exp = input_dialog (_("Run sort"),
_("Enter sort options (see manpage) separated by whitespace:"),
MC_HISTORY_EDIT_SORT, (old != NULL) ? old : "");
MC_HISTORY_EDIT_SORT, (old != NULL) ? old : "", INPUT_COMPLETE_DEFAULT);
if (!exp)
return 1;
@ -3241,7 +3243,8 @@ edit_ext_cmd (WEdit * edit)
exp =
input_dialog (_("Paste output of external command"),
_("Enter shell command(s):"), MC_HISTORY_EDIT_PASTE_EXTCMD, NULL);
_("Enter shell command(s):"), MC_HISTORY_EDIT_PASTE_EXTCMD, NULL,
INPUT_COMPLETE_DEFAULT);
if (!exp)
return 1;
@ -3308,14 +3311,14 @@ edit_mail_dialog (WEdit * edit)
/* *INDENT-OFF* */
QUICK_LABEL (N_("mail -s <subject> -c <cc> <to>"), NULL),
QUICK_LABELED_INPUT (N_("To"), input_label_above,
mail_to_last != NULL ? mail_to_last : "", 0,
"mail-dlg-input-3", &tmail_to, NULL),
mail_to_last != NULL ? mail_to_last : "", "mail-dlg-input-3",
&tmail_to, NULL, FALSE, FALSE, INPUT_COMPLETE_DEFAULT),
QUICK_LABELED_INPUT (N_("Subject"), input_label_above,
mail_subject_last != NULL ? mail_subject_last : "", 0,
"mail-dlg-input-2", &tmail_subject, NULL),
mail_subject_last != NULL ? mail_subject_last : "", "mail-dlg-input-2",
&tmail_subject, NULL, FALSE, FALSE, INPUT_COMPLETE_DEFAULT),
QUICK_LABELED_INPUT (N_("Copies to"), input_label_above,
mail_cc_last != NULL ? mail_cc_last : "", 0,
"mail-dlg-input", &tmail_cc, NULL),
mail_cc_last != NULL ? mail_cc_last : "", "mail-dlg-input",
&tmail_cc, NULL, FALSE, FALSE, INPUT_COMPLETE_DEFAULT),
QUICK_BUTTONS_OK_CANCEL,
QUICK_END
/* *INDENT-ON* */

View File

@ -101,8 +101,9 @@ editcmd_dialog_search_show (WEdit * edit)
{
quick_widget_t quick_widgets[] = {
/* *INDENT-OFF* */
QUICK_LABELED_INPUT (N_("Enter search string:"), input_label_above,
INPUT_LAST_TEXT, 0, MC_HISTORY_SHARED_SEARCH, &search_text, NULL),
QUICK_LABELED_INPUT (N_("Enter search string:"), input_label_above, INPUT_LAST_TEXT,
MC_HISTORY_SHARED_SEARCH, &search_text, NULL, FALSE, FALSE,
INPUT_COMPLETE_DEFAULT),
QUICK_SEPARATOR (TRUE),
QUICK_START_COLUMNS,
QUICK_RADIO (num_of_types, (const char **) list_of_types,
@ -191,10 +192,11 @@ editcmd_dialog_replace_show (WEdit * edit, const char *search_default, const cha
{
quick_widget_t quick_widgets[] = {
/* *INDENT-OFF* */
QUICK_LABELED_INPUT (N_("Enter search string:"), input_label_above,
search_default, 0, MC_HISTORY_SHARED_SEARCH, search_text, NULL),
QUICK_LABELED_INPUT (N_("Enter replacement string:"), input_label_above,
replace_default, 0, "replace", replace_text, NULL),
QUICK_LABELED_INPUT (N_("Enter search string:"), input_label_above, search_default,
MC_HISTORY_SHARED_SEARCH, search_text, NULL, FALSE, FALSE,
INPUT_COMPLETE_DEFAULT),
QUICK_LABELED_INPUT (N_("Enter replacement string:"), input_label_above, replace_default,
"replace", replace_text, NULL, FALSE, FALSE, INPUT_COMPLETE_DEFAULT),
QUICK_SEPARATOR (TRUE),
QUICK_START_COLUMNS,
QUICK_RADIO (num_of_types, (const char **) list_of_types,

View File

@ -156,8 +156,8 @@ edit_options_dialog (WDialog * h)
NULL),
QUICK_CHECKBOX (N_("Fill tabs with &spaces"), &option_fill_tabs_with_spaces,
NULL),
QUICK_LABELED_INPUT (N_("Tab spacing:"), input_label_left, tab_spacing, 0,
"edit-tab-spacing", &q, NULL),
QUICK_LABELED_INPUT (N_("Tab spacing:"), input_label_left, tab_spacing,
"edit-tab-spacing", &q, NULL, FALSE, FALSE, INPUT_COMPLETE_DEFAULT),
QUICK_STOP_GROUPBOX,
QUICK_NEXT_COLUMN,
QUICK_START_GROUPBOX (N_("Other options")),
@ -174,8 +174,8 @@ edit_options_dialog (WDialog * h)
QUICK_CHECKBOX (N_("Cursor be&yond end of line"), &option_cursor_beyond_eol,
NULL),
QUICK_CHECKBOX (N_("&Group undo"), &option_group_undo, NULL),
QUICK_LABELED_INPUT (N_("Word wrap line length:"), input_label_left,
wrap_length, 0, "edit-word-wrap", &p, NULL),
QUICK_LABELED_INPUT (N_("Word wrap line length:"), input_label_left, wrap_length,
"edit-word-wrap", &p, NULL, FALSE, FALSE, INPUT_COMPLETE_DEFAULT),
QUICK_STOP_GROUPBOX,
QUICK_STOP_COLUMNS,
QUICK_BUTTONS_OK_CANCEL,

View File

@ -464,8 +464,9 @@ configure_box (void)
QUICK_START_GROUPBOX (N_("Esc key mode")),
QUICK_CHECKBOX (N_("S&ingle press"), &old_esc_mode, &configure_old_esc_mode_id),
QUICK_LABELED_INPUT (N_("Timeout:"), input_label_left,
(const char *) time_out, 0, MC_HISTORY_ESC_TIMEOUT,
&time_out_new, &configure_time_out_id),
(const char *) time_out, MC_HISTORY_ESC_TIMEOUT,
&time_out_new, &configure_time_out_id, FALSE, FALSE,
INPUT_COMPLETE_DEFAULT),
QUICK_STOP_GROUPBOX,
QUICK_START_GROUPBOX (N_("Pause after run")),
QUICK_RADIO (pause_options_num, pause_options, &pause_after_run, NULL),
@ -653,12 +654,12 @@ panel_listing_box (WPanel * panel, char **userp, char **minip, int *use_msformat
quick_widget_t quick_widgets[] = {
/* *INDENT-OFF* */
QUICK_RADIO (LIST_TYPES, list_types, &result, &panel_listing_types_id),
QUICK_INPUT (panel->user_format, INPUT_COMPLETE_DEFAULT, "user-fmt-input",
&panel_user_format, &panel_user_format_id),
QUICK_INPUT (panel->user_format, "user-fmt-input", &panel_user_format,
&panel_user_format_id, FALSE, FALSE, INPUT_COMPLETE_DEFAULT),
QUICK_SEPARATOR (TRUE),
QUICK_CHECKBOX (N_("User &mini status"), &mini_user_status, &mini_user_status_id),
QUICK_INPUT (panel->user_status_format[panel->list_type], INPUT_COMPLETE_DEFAULT,
"mini_input", &mini_user_format, &mini_user_format_id),
QUICK_INPUT (panel->user_status_format[panel->list_type], "mini_input",
&mini_user_format, &mini_user_format_id, FALSE, FALSE, INPUT_COMPLETE_DEFAULT),
QUICK_BUTTONS_OK_CANCEL,
QUICK_END
/* *INDENT-ON* */
@ -974,17 +975,20 @@ configure_vfs (void)
quick_widget_t quick_widgets[] = {
/* *INDENT-OFF* */
QUICK_LABELED_INPUT (N_("Timeout for freeing VFSs (sec):"), input_label_left,
buffer2, 0, "input-timo-vfs", &ret_timeout, NULL),
buffer2, "input-timo-vfs", &ret_timeout, NULL, FALSE, FALSE,
INPUT_COMPLETE_DEFAULT),
#ifdef ENABLE_VFS_FTP
QUICK_SEPARATOR (TRUE),
QUICK_LABELED_INPUT (N_("FTP anonymous password:"), input_label_left,
ftpfs_anonymous_passwd, 0, "input-passwd", &ret_passwd, NULL),
ftpfs_anonymous_passwd, "input-passwd", &ret_passwd, NULL,
FALSE, FALSE, INPUT_COMPLETE_DEFAULT),
QUICK_LABELED_INPUT (N_("FTP directory cache timeout (sec):"), input_label_left,
buffer3, 0, "input-timeout", &ret_directory_timeout, NULL),
buffer3, "input-timeout", &ret_directory_timeout, NULL,
FALSE, FALSE, INPUT_COMPLETE_DEFAULT),
QUICK_CHECKBOX (N_("&Always use ftp proxy:"), &ftpfs_always_use_proxy,
&ftpfs_always_use_proxy_id),
QUICK_INPUT (ftpfs_proxy_host, 0, "input-ftp-proxy", &ret_ftp_proxy,
&ftpfs_proxy_host_id),
QUICK_INPUT (ftpfs_proxy_host, "input-ftp-proxy", &ret_ftp_proxy,
&ftpfs_proxy_host_id, FALSE, FALSE, INPUT_COMPLETE_DEFAULT),
QUICK_CHECKBOX (N_("&Use ~/.netrc"), &ftpfs_use_netrc, NULL),
QUICK_CHECKBOX (N_("Use &passive mode"), &ftpfs_use_passive_connections, NULL),
QUICK_CHECKBOX (N_("Use passive mode over pro&xy"),
@ -1042,7 +1046,8 @@ cd_dialog (void)
char *my_str;
quick_widget_t quick_widgets[] = {
QUICK_LABELED_INPUT (N_("cd"), input_label_left, "", 2, "input", &my_str, NULL),
QUICK_LABELED_INPUT (N_("cd"), input_label_left, "", "input", &my_str, NULL, FALSE, TRUE,
INPUT_COMPLETE_DEFAULT),
QUICK_END
};
@ -1072,10 +1077,10 @@ symlink_dialog (const vfs_path_t * existing_vpath, const vfs_path_t * new_vpath,
/* *INDENT-OFF* */
QUICK_LABELED_INPUT (N_("Existing filename (filename symlink will point to):"),
input_label_above,
existing, 0, "input-2", ret_existing, NULL),
existing, "input-2", ret_existing, NULL, FALSE, FALSE, INPUT_COMPLETE_DEFAULT),
QUICK_SEPARATOR (FALSE),
QUICK_LABELED_INPUT (N_("Symbolic link filename:"), input_label_above,
new, 0, "input-1", ret_new, NULL),
new, "input-1", ret_new, NULL, FALSE, FALSE, INPUT_COMPLETE_DEFAULT),
QUICK_BUTTONS_OK_CANCEL,
QUICK_END
/* *INDENT-ON* */
@ -1198,11 +1203,11 @@ vfs_smb_get_authinfo (const char *host, const char *share, const char *domain, c
QUICK_SEPARATOR (FALSE),
QUICK_LABEL (N_("Password:"), NULL),
QUICK_NEXT_COLUMN,
QUICK_INPUT (domain, 0, "auth_domain", &ret_domain, NULL),
QUICK_INPUT (domain, "auth_domain", &ret_domain, NULL, FALSE, FALSE, INPUT_COMPLETE_DEFAULT),
QUICK_SEPARATOR (FALSE),
QUICK_INPUT (user, 0, "auth_name", &ret_user, NULL),
QUICK_INPUT (user, "auth_name", &ret_user, NULL, FALSE, FALSE, INPUT_COMPLETE_DEFAULT),
QUICK_SEPARATOR (FALSE),
QUICK_INPUT ("", 1, "auth_password", &ret_password, NULL),
QUICK_INPUT ("", "auth_password", &ret_password, NULL, TRUE, FALSE, INPUT_COMPLETE_DEFAULT),
QUICK_STOP_COLUMNS,
QUICK_BUTTONS_OK_CANCEL,
QUICK_END

View File

@ -197,7 +197,8 @@ set_panel_filter (WPanel * p)
reg_exp = input_dialog_help (_("Filter"),
_("Set expression for filtering filenames"),
"[Filter...]", MC_HISTORY_FM_PANEL_FILTER, x, FALSE);
"[Filter...]", MC_HISTORY_FM_PANEL_FILTER, x, FALSE,
INPUT_COMPLETE_DEFAULT);
if (!reg_exp)
return;
set_panel_filter_to (p, reg_exp);
@ -218,7 +219,7 @@ select_unselect_cmd (const char *title, const char *history_name, gboolean do_se
quick_widget_t quick_widgets[] = {
/* *INDENT-OFF* */
QUICK_INPUT (INPUT_LAST_TEXT, 0, history_name, &reg_exp, NULL),
QUICK_INPUT (INPUT_LAST_TEXT, history_name, &reg_exp, NULL, FALSE, FALSE, INPUT_COMPLETE_DEFAULT),
QUICK_START_COLUMNS,
QUICK_CHECKBOX (N_("&Files only"), &files_only, NULL),
QUICK_CHECKBOX (N_("&Using shell patterns"), &shell_patterns, NULL),
@ -424,7 +425,7 @@ do_link (link_type_t link_type, const char *fname)
if (link_type == LINK_HARDLINK)
{
src = g_strdup_printf (_("Link %s to:"), str_trunc (fname, 46));
dest = input_expand_dialog (_("Link"), src, MC_HISTORY_FM_LINK, "");
dest = input_expand_dialog (_("Link"), src, MC_HISTORY_FM_LINK, "", INPUT_COMPLETE_DEFAULT);
if (!dest || !*dest)
goto cleanup;
save_cwds_stat ();
@ -494,7 +495,9 @@ nice_cd (const char *text, const char *xtext, const char *help,
if (!SELECTED_IS_PANEL)
return;
machine = input_dialog_help (text, xtext, help, history_name, "", strip_password);
machine =
input_dialog_help (text, xtext, help, history_name, "", strip_password,
INPUT_COMPLETE_DEFAULT);
if (machine == NULL)
return;
@ -706,7 +709,8 @@ view_file_cmd (void)
filename =
input_expand_dialog (_("View file"), _("Filename:"),
MC_HISTORY_FM_VIEW_FILE, selection (current_panel)->fname);
MC_HISTORY_FM_VIEW_FILE, selection (current_panel)->fname,
INPUT_COMPLETE_DEFAULT);
if (!filename)
return;
@ -740,7 +744,7 @@ view_filtered_cmd (void)
command =
input_dialog (_("Filtered view"),
_("Filter command and arguments:"),
MC_HISTORY_FM_FILTERED_VIEW, initial_command);
MC_HISTORY_FM_FILTERED_VIEW, initial_command, INPUT_COMPLETE_DEFAULT);
if (command != NULL)
{
@ -913,7 +917,8 @@ mkdir_cmd (void)
dir =
input_expand_dialog (_("Create a new Directory"),
_("Enter directory name:"), MC_HISTORY_FM_MKDIR, name);
_("Enter directory name:"), MC_HISTORY_FM_MKDIR, name,
INPUT_COMPLETE_DEFAULT);
if (dir != NULL && dir != '\0')
{
@ -1349,7 +1354,9 @@ edit_symlink_cmd (void)
if (i > 0)
{
buffer[i] = 0;
dest = input_expand_dialog (_("Edit symlink"), q, MC_HISTORY_FM_EDIT_LINK, buffer);
dest =
input_expand_dialog (_("Edit symlink"), q, MC_HISTORY_FM_EDIT_LINK, buffer,
INPUT_COMPLETE_DEFAULT);
if (dest)
{
if (*dest && strcmp (buffer, dest))

View File

@ -227,7 +227,9 @@ exec_make_shell_string (const char *lc_data, const vfs_path_t * filename_vpath)
char *parameter;
parameter_found = FALSE;
parameter = input_dialog (_("Parameter"), lc_prompt, MC_HISTORY_EXT_PARAMETER, "");
parameter =
input_dialog (_("Parameter"), lc_prompt, MC_HISTORY_EXT_PARAMETER, "",
INPUT_COMPLETE_DEFAULT);
if (parameter == NULL)
{
/* User canceled */

View File

@ -1180,15 +1180,15 @@ file_mask_dialog (FileOpContext * ctx, FileOperation operation,
quick_widget_t quick_widgets[] = {
/* *INDENT-OFF* */
QUICK_LABELED_INPUT (fmd_buf, input_label_above,
easy_patterns ? "*" : "^(.*)$", 0, "input-def", &source_mask,
NULL),
easy_patterns ? "*" : "^(.*)$", "input-def", &source_mask,
NULL, FALSE, FALSE, INPUT_COMPLETE_DEFAULT),
QUICK_START_COLUMNS,
QUICK_SEPARATOR (FALSE),
QUICK_NEXT_COLUMN,
QUICK_CHECKBOX (N_("&Using shell patterns"), &source_easy_patterns, NULL),
QUICK_STOP_COLUMNS,
QUICK_LABELED_INPUT (N_("to:"), input_label_above,
def_text_secure, 0, "input2", &dest_dir, NULL),
def_text_secure, "input2", &dest_dir, NULL, FALSE, FALSE, INPUT_COMPLETE_DEFAULT),
QUICK_SEPARATOR (TRUE),
QUICK_START_COLUMNS,
QUICK_CHECKBOX (N_("Follow &links"), &ctx->follow_links, NULL),

View File

@ -960,9 +960,11 @@ add_new_entry_input (const char *header, const char *text1, const char *text2,
{
quick_widget_t quick_widgets[] = {
/* *INDENT-OFF* */
QUICK_LABELED_INPUT (text1, input_label_above, *r1, 0, "input-lbl", r1, NULL),
QUICK_LABELED_INPUT (text1, input_label_above, *r1, "input-lbl", r1, NULL,
FALSE, FALSE, INPUT_COMPLETE_DEFAULT),
QUICK_SEPARATOR (FALSE),
QUICK_LABELED_INPUT (text2, input_label_above, *r2, 0, "input-lbl", r2, NULL),
QUICK_LABELED_INPUT (text2, input_label_above, *r2, "input-lbl", r2, NULL,
FALSE, FALSE, INPUT_COMPLETE_DEFAULT),
QUICK_START_BUTTONS (TRUE, TRUE),
QUICK_BUTTON (N_("&Append"), B_APPEND, NULL, NULL),
QUICK_BUTTON (N_("&Insert"), B_INSERT, NULL, NULL),
@ -1023,7 +1025,8 @@ add_new_group_input (const char *header, const char *label, char **result)
{
quick_widget_t quick_widgets[] = {
/* *INDENT-OFF* */
QUICK_LABELED_INPUT (label, input_label_above, "", 0, "input", result, NULL),
QUICK_LABELED_INPUT (label, input_label_above, "", "input", result, NULL,
FALSE, FALSE, INPUT_COMPLETE_DEFAULT),
QUICK_START_BUTTONS (TRUE, TRUE),
QUICK_BUTTON (N_("&Append"), B_APPEND, NULL, NULL),
QUICK_BUTTON (N_("&Insert"), B_INSERT, NULL, NULL),
@ -1565,7 +1568,9 @@ add2hotlist_cmd (void)
l = str_term_width1 (cp);
label_string = vfs_path_to_str_flags (current_panel->cwd_vpath, 0, VPF_STRIP_PASSWORD);
lc_prompt = g_strdup_printf (cp, str_trunc (label_string, COLS - 2 * UX - (l + 8)));
label = input_dialog (_("Add to hotlist"), lc_prompt, MC_HISTORY_HOTLIST_ADD, label_string);
label =
input_dialog (_("Add to hotlist"), lc_prompt, MC_HISTORY_HOTLIST_ADD, label_string,
INPUT_COMPLETE_DEFAULT);
g_free (lc_prompt);
if (label == NULL || *label == '\0')

View File

@ -258,7 +258,8 @@ add2panelize_cmd (void)
if (pname->buffer && (*pname->buffer))
{
label = input_dialog (_("Add to external panelize"),
_("Enter command label:"), MC_HISTORY_FM_PANELIZE_ADD, "");
_("Enter command label:"), MC_HISTORY_FM_PANELIZE_ADD, "",
INPUT_COMPLETE_DEFAULT);
if (!label)
return;
if (!*label)

View File

@ -785,7 +785,7 @@ tree_copy (WTree * tree, const char *default_dest)
g_snprintf (msg, sizeof (msg), _("Copy \"%s\" directory to:"),
str_trunc (selected_ptr_name, 50));
dest = input_expand_dialog (Q_ ("DialogTitle|Copy"),
msg, MC_HISTORY_FM_TREE_COPY, default_dest);
msg, MC_HISTORY_FM_TREE_COPY, default_dest, INPUT_COMPLETE_DEFAULT);
if (dest != NULL && *dest != '\0')
{
@ -824,7 +824,8 @@ tree_move (WTree * tree, const char *default_dest)
g_snprintf (msg, sizeof (msg), _("Move \"%s\" directory to:"),
str_trunc (selected_ptr_name, 50));
dest =
input_expand_dialog (Q_ ("DialogTitle|Move"), msg, MC_HISTORY_FM_TREE_MOVE, default_dest);
input_expand_dialog (Q_ ("DialogTitle|Move"), msg, MC_HISTORY_FM_TREE_MOVE, default_dest,
INPUT_COMPLETE_DEFAULT);
if (dest == NULL || *dest == '\0')
goto ret;

View File

@ -474,7 +474,8 @@ execute_menu_command (WEdit * edit_widget, const char *commands, gboolean show_p
char *tmp;
*parameter = 0;
parameter =
input_dialog (_("Parameter"), lc_prompt, MC_HISTORY_FM_MENU_EXEC_PARAM, "");
input_dialog (_("Parameter"), lc_prompt, MC_HISTORY_FM_MENU_EXEC_PARAM, "",
INPUT_COMPLETE_DEFAULT);
if (!parameter || !*parameter)
{
/* User canceled */

View File

@ -654,7 +654,8 @@ ftpfs_login_server (struct vfs_class *me, struct vfs_s_super *super, const char
p = g_strdup_printf (_("FTP: Account required for user %s"),
super->path_element->user);
op = input_dialog (p, _("Account:"), MC_HISTORY_FTPFS_ACCOUNT, "");
op = input_dialog (p, _("Account:"), MC_HISTORY_FTPFS_ACCOUNT, "",
INPUT_COMPLETE_DEFAULT);
g_free (p);
if (op == NULL)
ERRNOR (EPERM, 0);

View File

@ -88,7 +88,8 @@ mcview_dialog_search (mcview_t * view)
quick_widget_t quick_widgets[] = {
/* *INDENT-OFF* */
QUICK_LABELED_INPUT (N_("Enter search string:"), input_label_above,
INPUT_LAST_TEXT, 0, MC_HISTORY_SHARED_SEARCH, &exp, NULL),
INPUT_LAST_TEXT, MC_HISTORY_SHARED_SEARCH, &exp,
NULL, FALSE, FALSE, INPUT_COMPLETE_DEFAULT),
QUICK_SEPARATOR (TRUE),
QUICK_START_COLUMNS,
QUICK_RADIO (num_of_types, (const char **) list_of_types,
@ -197,7 +198,8 @@ mcview_dialog_goto (mcview_t * view, off_t * offset)
{
quick_widget_t quick_widgets[] = {
/* *INDENT-OFF* */
QUICK_INPUT (INPUT_LAST_TEXT, 0, MC_HISTORY_VIEW_GOTO, &exp, NULL),
QUICK_INPUT (INPUT_LAST_TEXT, MC_HISTORY_VIEW_GOTO, &exp, NULL,
FALSE, FALSE, INPUT_COMPLETE_DEFAULT),
QUICK_RADIO (num_of_types, (const char **) mc_view_goto_str, (int *) &current_goto_type,
NULL),
QUICK_BUTTONS_OK_CANCEL,