Ticket #3913: implement safe file overwrite.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Этот коммит содержится в:
родитель
a66ee73305
Коммит
34712ec05b
@ -1962,7 +1962,19 @@ and not to the directory where the link was present.
|
||||
.I Safe delete.
|
||||
If this option is enabled, deleting files and directory hotlist entries
|
||||
unintentionally becomes more difficult. The default selection in the
|
||||
confirmation dialogs for deletion changes from "Yes" to "No".
|
||||
confirmation dialogs for deletion changes from
|
||||
.B Yes
|
||||
to
|
||||
.BR No .
|
||||
This option is disabled by default.
|
||||
.PP
|
||||
.I Safe overwrite.
|
||||
If this option is enabled, overwriting files unintentionally becomes
|
||||
more difficult. The default selection in the overwrite confirmation dialog
|
||||
changes from
|
||||
.B Yes
|
||||
to
|
||||
.BR No .
|
||||
This option is disabled by default.
|
||||
.PP
|
||||
.I Auto save setup.
|
||||
|
@ -2104,6 +2104,15 @@ like regular expressions). Для того, чтобы достичь таког
|
||||
.BR Нет .
|
||||
По умолчанию эта опция отключена.
|
||||
.PP
|
||||
.I Безопасная перезапись.
|
||||
Если эта опция включена, непреднамеренно перезаписать файл будет сложнее. В
|
||||
диалоговом окне подтверждения перезаписи предлагаемая по умолчанию кнопка
|
||||
изменяется с
|
||||
.B Да
|
||||
на
|
||||
.BR Нет .
|
||||
По умолчанию эта опция отключена.
|
||||
.PP
|
||||
.I Автосохранение настроек.
|
||||
Если эта опция включена, то при выходе из программы Midnight Commander
|
||||
значения всех настраиваемых параметров сохраняются в файле
|
||||
|
@ -546,10 +546,10 @@ configure_box (void)
|
||||
QUICK_CHECKBOX (N_("Rotating d&ash"), &nice_rotating_dash, NULL),
|
||||
QUICK_CHECKBOX (N_("Cd follows lin&ks"), &mc_global.vfs.cd_symlinks, NULL),
|
||||
QUICK_CHECKBOX (N_("Sa&fe delete"), &safe_delete, NULL),
|
||||
QUICK_CHECKBOX (N_("Safe overwrite"), &safe_overwrite, NULL), /* w/o hotkey */
|
||||
QUICK_CHECKBOX (N_("A&uto save setup"), &auto_save_setup, NULL),
|
||||
QUICK_SEPARATOR (FALSE),
|
||||
QUICK_SEPARATOR (FALSE),
|
||||
QUICK_SEPARATOR (FALSE),
|
||||
QUICK_STOP_GROUPBOX,
|
||||
QUICK_STOP_COLUMNS,
|
||||
QUICK_BUTTONS_OK_CANCEL,
|
||||
|
@ -157,7 +157,7 @@ statfs (char const *filename, struct fs_info *buf)
|
||||
#include "lib/util.h"
|
||||
#include "lib/widget.h"
|
||||
|
||||
#include "src/setup.h" /* verbose */
|
||||
#include "src/setup.h" /* verbose, safe_overwrite */
|
||||
|
||||
#include "midnight.h"
|
||||
#include "fileopctx.h" /* FILE_CONT */
|
||||
@ -409,7 +409,7 @@ overwrite_query_dialog (file_op_context_t * ctx, enum OperationMode mode)
|
||||
const int rd_ylen = 1;
|
||||
int rd_xlen = 60;
|
||||
int y = 2;
|
||||
unsigned long yes_id;
|
||||
unsigned long yes_id, no_id;
|
||||
|
||||
struct
|
||||
{
|
||||
@ -565,7 +565,7 @@ overwrite_query_dialog (file_op_context_t * ctx, enum OperationMode mode)
|
||||
|
||||
ADD_RD_LABEL (4, 0, 0, y); /* Overwrite this target? */
|
||||
yes_id = ADD_RD_BUTTON (5, y); /* Yes */
|
||||
ADD_RD_BUTTON (6, y); /* No */
|
||||
no_id = ADD_RD_BUTTON (6, y); /* No */
|
||||
|
||||
/* "this target..." widgets */
|
||||
if (!S_ISDIR (ui->d_stat->st_mode))
|
||||
@ -591,7 +591,7 @@ overwrite_query_dialog (file_op_context_t * ctx, enum OperationMode mode)
|
||||
|
||||
label_set_text (LABEL (label1), str_trunc (stripped_name, rd_xlen - 8));
|
||||
dlg_set_size (ui->replace_dlg, y + 3, rd_xlen);
|
||||
dlg_select_by_id (ui->replace_dlg, yes_id);
|
||||
dlg_select_by_id (ui->replace_dlg, safe_overwrite ? no_id : yes_id);
|
||||
result = dlg_run (ui->replace_dlg);
|
||||
dlg_destroy (ui->replace_dlg);
|
||||
|
||||
|
@ -87,6 +87,8 @@ gboolean boot_current_is_left = TRUE;
|
||||
|
||||
/* If on, default for "No" in delete operations */
|
||||
gboolean safe_delete = FALSE;
|
||||
/* If on, default for "No" in overwrite files */
|
||||
gboolean safe_overwrite = FALSE;
|
||||
|
||||
/* Controls screen clearing before an exec */
|
||||
gboolean clear_before_exec = TRUE;
|
||||
@ -293,6 +295,7 @@ static const struct
|
||||
{ "confirm_directory_hotlist_delete", &confirm_directory_hotlist_delete },
|
||||
{ "confirm_view_dir", &confirm_view_dir },
|
||||
{ "safe_delete", &safe_delete },
|
||||
{ "safe_overwrite", &safe_overwrite },
|
||||
#ifndef HAVE_CHARSET
|
||||
{ "eight_bit_clean", &mc_global.eight_bit_clean },
|
||||
{ "full_eight_bits", &mc_global.full_eight_bits },
|
||||
|
@ -82,6 +82,7 @@ extern gboolean confirm_exit;
|
||||
extern gboolean confirm_overwrite;
|
||||
extern gboolean confirm_view_dir;
|
||||
extern gboolean safe_delete;
|
||||
extern gboolean safe_overwrite;
|
||||
extern gboolean clear_before_exec;
|
||||
extern gboolean auto_menu;
|
||||
extern gboolean drop_menus;
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user