Commit f318cb48 authored by Kevin J. McCarthy's avatar Kevin J. McCarthy

Minor fixes to the x-label patch from David.

Add L10N comment to sort menu.  Mark a couple strings for localization.

Use ascii_strncasecmp() for the X-Label header comparison.

Simplify label_message() using mutt library routines.

Bind label editing to "Y" instead of "y".  "y" is already used in the
default sample muttrc to display mailboxes.
parent 8583edba
......@@ -533,6 +533,10 @@ int mutt_select_sort (int reverse)
int method = Sort; /* save the current method in case of abort */
switch (mutt_multi_choice (reverse ?
/* L10N: The following three are the sort/reverse sort prompts.
* Capital letters must match the order of the characters in the third
* string.
*/
_("Rev-Sort Date/Frm/Recv/Subj/tO/Thread/Unsort/siZe/sCore/sPam/Label?: ") :
_("Sort Date/Frm/Recv/Subj/tO/Thread/Unsort/siZe/sCore/sPam/Label?: "),
_("dfrsotuzcpl")))
......
......@@ -112,7 +112,7 @@ mutt_copy_hdr (FILE *in, FILE *out, LOFF_T off_start, LOFF_T off_end, int flags,
}
if (flags & CH_UPDATE_LABEL &&
mutt_strncasecmp ("X-Label:", buf, 8) == 0)
ascii_strncasecmp ("X-Label:", buf, 8) == 0)
continue;
if (!ignore && fputs (buf, out) == EOF)
......@@ -418,7 +418,7 @@ mutt_copy_header (FILE *in, HEADER *h, FILE *out, int flags, const char *prefix)
fprintf (out, "Lines: %d\n", h->lines);
}
if (flags & CH_UPDATE_LABEL && h->xlabel_changed)
if (flags & CH_UPDATE_LABEL)
{
h->xlabel_changed = 0;
if (h->env->x_label != NULL)
......
......@@ -2101,9 +2101,14 @@ int mutt_index_menu (void)
if (rc > 0) {
Context->changed = 1;
menu->redraw = REDRAW_FULL;
mutt_message ("%d label%s changed.", rc, rc == 1 ? "" : "s");
/* L10N: This is displayed when the x-label on one or more
* messages is edited. */
mutt_message (_("%d labels changed."), rc);
}
else {
/* L10N: This is displayed when editing an x-label, but no messages
* were updated. Possibly due to canceling at the prompt or if the new
* label is the same as the old label. */
mutt_message _("No labels changed.");
}
break;
......
......@@ -99,7 +99,7 @@ const struct binding_t OpMain[] = { /* map: index */
{ "delete-thread", OP_DELETE_THREAD, "\004" },
{ "delete-subthread", OP_DELETE_SUBTHREAD, "\033d" },
{ "edit", OP_EDIT_MESSAGE, "e" },
{ "edit-label", OP_EDIT_LABEL, "y" },
{ "edit-label", OP_EDIT_LABEL, "Y" },
{ "edit-type", OP_EDIT_TYPE, "\005" },
{ "forward-message", OP_FORWARD_MESSAGE, "f" },
{ "flag-message", OP_FLAG_MESSAGE, "F" },
......@@ -201,7 +201,7 @@ const struct binding_t OpPager[] = { /* map: pager */
{ "set-flag", OP_MAIN_SET_FLAG, "w" },
{ "clear-flag", OP_MAIN_CLEAR_FLAG, "W" },
{ "edit", OP_EDIT_MESSAGE, "e" },
{ "edit-label", OP_EDIT_LABEL, "y" },
{ "edit-label", OP_EDIT_LABEL, "Y" },
{ "edit-type", OP_EDIT_TYPE, "\005" },
{ "forward-message", OP_FORWARD_MESSAGE, "f" },
{ "flag-message", OP_FLAG_MESSAGE, "F" },
......
......@@ -219,17 +219,9 @@ static int label_message(HEADER *hdr, char *new)
{
if (hdr == NULL)
return 0;
if (hdr->env->x_label == NULL && new == NULL)
if (mutt_strcmp (hdr->env->x_label, new) == 0)
return 0;
if (hdr->env->x_label != NULL && new != NULL &&
strcmp(hdr->env->x_label, new) == 0)
return 0;
if (hdr->env->x_label != NULL)
FREE(&hdr->env->x_label);
if (new == NULL)
hdr->env->x_label = NULL;
else
hdr->env->x_label = safe_strdup(new);
mutt_str_replace (&hdr->env->x_label, new);
return hdr->changed = hdr->xlabel_changed = 1;
}
......
......@@ -2820,7 +2820,7 @@ search_next:
if (rc > 0) {
Context->changed = 1;
redraw = REDRAW_FULL;
mutt_message ("%d label%s changed.", rc, rc == 1 ? "" : "s");
mutt_message (_("%d labels changed."), rc);
}
else {
mutt_message _("No labels changed.");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment