Commit 389c74bb authored by Richard Russon's avatar Richard Russon

Add neomutt version of sidebar patch. (closes #3829)

This is the patch from neomutt; branch 'devel/win-sidebar'; commit
c796fa85f9cacefb69b8f7d8545fc9ba71674180 with the following changes:

  - move the sample muttrc and vimrc to contrib.
  - remove the README.sidebar.
  - empty out the PATCHES file.
parent c64cf70d
......@@ -77,6 +77,12 @@ EXTRA_DIST = COPYRIGHT GPL OPS OPS.PGP OPS.CRYPT OPS.SMIME TODO UPDATING \
EXTRA_SCRIPTS = smime_keys
if BUILD_SIDEBAR
mutt_SOURCES += sidebar.c sidebar.h
endif
EXTRA_DIST += OPS.SIDEBAR
mutt_dotlock_SOURCES = mutt_dotlock.c
mutt_dotlock_LDADD = $(LIBOBJS)
mutt_dotlock_DEPENDENCIES = $(LIBOBJS)
......@@ -129,10 +135,10 @@ smime_keys: $(srcdir)/smime_keys.pl
keymap_defs.h: $(OPS) $(srcdir)/gen_defs
$(srcdir)/gen_defs $(OPS) > keymap_defs.h
keymap_alldefs.h: $(srcdir)/OPS $(srcdir)/OPS.PGP $(srcdir)/OPS.MIX $(srcdir)/OPS.CRYPT $(srcdir)/OPS.SMIME $(srcdir)/gen_defs
keymap_alldefs.h: $(srcdir)/OPS $(srcdir)/OPS.SIDEBAR $(srcdir)/OPS.PGP $(srcdir)/OPS.MIX $(srcdir)/OPS.CRYPT $(srcdir)/OPS.SMIME $(srcdir)/gen_defs
rm -f $@
$(srcdir)/gen_defs $(srcdir)/OPS $(srcdir)/OPS.PGP \
$(srcdir)/OPS.MIX $(srcdir)/OPS.CRYPT $(srcdir)/OPS.SMIME \
$(srcdir)/OPS.SIDEBAR $(srcdir)/OPS.MIX $(srcdir)/OPS.CRYPT $(srcdir)/OPS.SMIME \
> keymap_alldefs.h
reldate.h: $(srcdir)/ChangeLog
......
OP_SIDEBAR_NEXT "Move the highlight to next mailbox"
OP_SIDEBAR_NEXT_NEW "Move the highlight to next mailbox with new mail"
OP_SIDEBAR_OPEN "Open highlighted mailbox"
OP_SIDEBAR_PAGE_DOWN "Scroll the Sidebar down 1 page"
OP_SIDEBAR_PAGE_UP "Scroll the Sidebar up 1 page"
OP_SIDEBAR_PREV "Move the highlight to previous mailbox"
OP_SIDEBAR_PREV_NEW "Move the highlight to previous mailbox with new mail"
OP_SIDEBAR_TOGGLE_VISIBLE "Make the Sidebar (in)visible"
......@@ -27,6 +27,10 @@
#include "mutt_curses.h"
#ifdef USE_SIDEBAR
#include "sidebar.h"
#endif
#ifdef USE_IMAP
#include "imap.h"
#endif
......@@ -196,9 +200,17 @@ void mutt_update_mailbox (BUFFY * b)
static BUFFY *buffy_new (const char *path)
{
BUFFY* buffy;
#ifdef USE_SIDEBAR
char rp[PATH_MAX] = "";
char *r = NULL;
#endif
buffy = (BUFFY *) safe_calloc (1, sizeof (BUFFY));
strfcpy (buffy->path, path, sizeof (buffy->path));
#ifdef USE_SIDEBAR
r = realpath (path, rp);
strfcpy (buffy->realpath, r ? rp : path, sizeof (buffy->realpath));
#endif
buffy->next = NULL;
buffy->magic = 0;
......@@ -215,7 +227,10 @@ int mutt_parse_mailboxes (BUFFER *path, BUFFER *s, unsigned long data, BUFFER *e
BUFFY **tmp,*tmp1;
char buf[_POSIX_PATH_MAX];
struct stat sb;
char f1[PATH_MAX], f2[PATH_MAX];
char f1[PATH_MAX];
#ifndef USE_SIDEBAR
char f2[PATH_MAX];
#endif
char *p, *q;
while (MoreArgs (s))
......@@ -228,6 +243,9 @@ int mutt_parse_mailboxes (BUFFER *path, BUFFER *s, unsigned long data, BUFFER *e
for (tmp = &Incoming; *tmp;)
{
tmp1=(*tmp)->next;
#ifdef USE_SIDEBAR
sb_notify_mailbox (*tmp, 0);
#endif
buffy_free (tmp);
*tmp=tmp1;
}
......@@ -243,8 +261,13 @@ int mutt_parse_mailboxes (BUFFER *path, BUFFER *s, unsigned long data, BUFFER *e
p = realpath (buf, f1);
for (tmp = &Incoming; *tmp; tmp = &((*tmp)->next))
{
#ifdef USE_SIDEBAR
q = (*tmp)->realpath;
if (mutt_strcmp (p ? p : buf, q) == 0)
#else
q = realpath ((*tmp)->path, f2);
if (mutt_strcmp (p ? p : buf, q ? q : (*tmp)->path) == 0)
#endif
{
dprint(3,(debugfile,"mailbox '%s' already registered as '%s'\n", buf, (*tmp)->path));
break;
......@@ -256,14 +279,21 @@ int mutt_parse_mailboxes (BUFFER *path, BUFFER *s, unsigned long data, BUFFER *e
if(*tmp)
{
tmp1=(*tmp)->next;
#ifdef USE_SIDEBAR
sb_notify_mailbox (*tmp, 0);
#endif
buffy_free (tmp);
*tmp=tmp1;
}
continue;
}
if (!*tmp)
if (!*tmp) {
*tmp = buffy_new (buf);
#ifdef USE_SIDEBAR
sb_notify_mailbox (*tmp, 1);
#endif
}
(*tmp)->new = 0;
(*tmp)->notified = 1;
......@@ -306,6 +336,13 @@ static int buffy_maildir_dir_hasnew(BUFFY* mailbox, const char *dir_name)
return 0;
}
#ifdef USE_SIDEBAR
if (option (OPTSIDEBAR) && mailbox->msg_unread > 0) {
mailbox->new = 1;
return 1;
}
#endif
if ((dirp = opendir (path)) == NULL)
{
mailbox->magic = 0;
......@@ -357,6 +394,89 @@ static int buffy_maildir_hasnew (BUFFY* mailbox)
return 0;
}
#ifdef USE_SIDEBAR
/**
* buffy_maildir_update_dir - Update counts for one directory
* @mailbox: BUFFY representing a maildir mailbox
* @dir: Which directory to search
*
* Look through one directory of a maildir mailbox. The directory could
* be either "new" or "cur".
*
* Count how many new, or flagged, messages there are.
*/
static void
buffy_maildir_update_dir (BUFFY *mailbox, const char *dir)
{
char path[_POSIX_PATH_MAX] = "";
DIR *dirp = NULL;
struct dirent *de = NULL;
char *p = NULL;
int read;
snprintf (path, sizeof (path), "%s/%s", mailbox->path, dir);
dirp = opendir (path);
if (!dirp) {
mailbox->magic = 0;
return;
}
while ((de = readdir (dirp)) != NULL) {
if (*de->d_name == '.')
continue;
/* Matches maildir_parse_flags logic */
read = 0;
mailbox->msg_count++;
p = strstr (de->d_name, ":2,");
if (p) {
p += 3;
if (strchr (p, 'S'))
read = 1;
if (strchr (p, 'F'))
mailbox->msg_flagged++;
}
if (!read) {
mailbox->msg_unread++;
}
}
closedir (dirp);
}
/**
* buffy_maildir_update - Update messages counts for a maildir mailbox
* @mailbox: BUFFY representing a maildir mailbox
*
* Open a mailbox directories and update our record of how many new, or
* flagged, messages there are.
*/
void
buffy_maildir_update (BUFFY *mailbox)
{
if (!option (OPTSIDEBAR))
return;
mailbox->msg_count = 0;
mailbox->msg_unread = 0;
mailbox->msg_flagged = 0;
buffy_maildir_update_dir (mailbox, "new");
if (mailbox->msg_count) {
mailbox->new = 1;
}
buffy_maildir_update_dir (mailbox, "cur");
mailbox->sb_last_checked = time (NULL);
/* make sure the updates are actually put on screen */
sb_draw();
}
#endif
/* returns 1 if mailbox has new mail */
static int buffy_mbox_hasnew (BUFFY* mailbox, struct stat *sb)
{
......@@ -368,7 +488,11 @@ static int buffy_mbox_hasnew (BUFFY* mailbox, struct stat *sb)
else
statcheck = sb->st_mtime > sb->st_atime
|| (mailbox->newly_created && sb->st_ctime == sb->st_mtime && sb->st_ctime == sb->st_atime);
#ifdef USE_SIDEBAR
if ((!option (OPTSIDEBAR) && statcheck) || (option (OPTSIDEBAR) && mailbox->msg_unread > 0))
#else
if (statcheck)
#endif
{
if (!option(OPTMAILCHECKRECENT) || sb->st_mtime > mailbox->last_visited)
{
......@@ -388,6 +512,40 @@ static int buffy_mbox_hasnew (BUFFY* mailbox, struct stat *sb)
return rc;
}
#ifdef USE_SIDEBAR
/**
* buffy_mbox_update - Update messages counts for an mbox mailbox
* @mailbox: BUFFY representing an mbox mailbox
* @sb: stat(2) infomation about the mailbox file
*
* Open a mbox file and update our record of how many new, or flagged,
* messages there are. If the mailbox hasn't changed since the last call,
* the function does nothing.
*/
void
buffy_mbox_update (BUFFY *mailbox, struct stat *sb)
{
CONTEXT *ctx = NULL;
if (!option (OPTSIDEBAR))
return;
if ((mailbox->sb_last_checked > sb->st_mtime) && (mailbox->msg_count != 0))
return; /* no check necessary */
ctx = mx_open_mailbox (mailbox->path, MUTT_READONLY | MUTT_QUIET | MUTT_NOSORT | MUTT_PEEK, NULL);
if (ctx) {
mailbox->msg_count = ctx->msgcount;
mailbox->msg_unread = ctx->unread;
mailbox->msg_flagged = ctx->flagged;
mailbox->sb_last_checked = time (NULL);
mx_close_mailbox (ctx, 0);
}
/* make sure the updates are actually put on screen */
sb_draw();
}
#endif
int mutt_buffy_check (int force)
{
BUFFY *tmp;
......@@ -428,6 +586,9 @@ int mutt_buffy_check (int force)
contex_sb.st_ino=0;
}
#ifdef USE_SIDEBAR
int should_refresh = sb_should_refresh();
#endif
for (tmp = Incoming; tmp; tmp = tmp->next)
{
if (tmp->magic != MUTT_IMAP)
......@@ -461,16 +622,30 @@ int mutt_buffy_check (int force)
{
case MUTT_MBOX:
case MUTT_MMDF:
#ifdef USE_SIDEBAR
if (should_refresh)
buffy_mbox_update (tmp, &sb);
#endif
if (buffy_mbox_hasnew (tmp, &sb) > 0)
BuffyCount++;
break;
case MUTT_MAILDIR:
#ifdef USE_SIDEBAR
if (should_refresh)
buffy_maildir_update (tmp);
#endif
if (buffy_maildir_hasnew (tmp) > 0)
BuffyCount++;
break;
case MUTT_MH:
#ifdef USE_SIDEBAR
if (sb_should_refresh()) {
mh_buffy_update (tmp);
sb_set_update_time();
}
#endif
mh_buffy(tmp);
if (tmp->new)
BuffyCount++;
......@@ -485,6 +660,10 @@ int mutt_buffy_check (int force)
else if (!tmp->notified)
BuffyNotify++;
}
#ifdef USE_SIDEBAR
if (should_refresh)
sb_set_update_time();
#endif
BuffyDoneTime = BuffyTime;
return (BuffyCount);
......
......@@ -16,6 +16,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _BUFFY_H
#define _BUFFY_H
/*parameter to mutt_parse_mailboxes*/
#define MUTT_MAILBOXES 1
#define MUTT_UNMAILBOXES 2
......@@ -23,13 +26,28 @@
typedef struct buffy_t
{
char path[_POSIX_PATH_MAX];
#ifdef USE_SIDEBAR
char realpath[_POSIX_PATH_MAX];
#endif
off_t size;
struct buffy_t *next;
#ifdef USE_SIDEBAR
struct buffy_t *prev;
#endif
short new; /* mailbox has new mail */
#ifdef USE_SIDEBAR
int msg_count; /* total number of messages */
int msg_unread; /* number of unread messages */
int msg_flagged; /* number of flagged messages */
short is_hidden; /* is hidden from the sidebar */
#endif
short notified; /* user has been notified */
short magic; /* mailbox type */
short newly_created; /* mbox or mmdf just popped into existence */
time_t last_visited; /* time of last exit from this mailbox */
#ifdef USE_SIDEBAR
time_t sb_last_checked; /* time of last buffy check from sidebar */
#endif
}
BUFFY;
......@@ -49,3 +67,5 @@ void mutt_buffy_cleanup (const char *buf, struct stat *st);
void mutt_buffy_setnotified (const char *path);
void mh_buffy (BUFFY *);
#endif /* _BUFFY_H */
......@@ -94,6 +94,14 @@ static const struct mapping_t Fields[] =
{ "underline", MT_COLOR_UNDERLINE },
{ "index", MT_COLOR_INDEX },
{ "prompt", MT_COLOR_PROMPT },
#ifdef USE_SIDEBAR
{ "sidebar_divider", MT_COLOR_DIVIDER },
{ "sidebar_flagged", MT_COLOR_FLAGGED },
{ "sidebar_highlight",MT_COLOR_HIGHLIGHT },
{ "sidebar_indicator",MT_COLOR_SB_INDICATOR },
{ "sidebar_new", MT_COLOR_NEW },
{ "sidebar_spoolfile",MT_COLOR_SB_SPOOLFILE },
#endif
{ NULL, 0 }
};
......@@ -146,6 +154,9 @@ void ci_start_color (void)
ColorDefs[MT_COLOR_INDICATOR] = A_REVERSE;
ColorDefs[MT_COLOR_SEARCH] = A_REVERSE;
ColorDefs[MT_COLOR_MARKERS] = A_REVERSE;
#ifdef USE_SIDEBAR
ColorDefs[MT_COLOR_HIGHLIGHT] = A_UNDERLINE;
#endif
/* special meaning: toggle the relevant attribute */
ColorDefs[MT_COLOR_BOLD] = 0;
ColorDefs[MT_COLOR_UNDERLINE] = 0;
......
......@@ -175,6 +175,15 @@ if test x$have_smime != xno ; then
SMIMEAUX_TARGET="smime_keys"
fi
AC_ARG_ENABLE(sidebar, AC_HELP_STRING([--enable-sidebar], [Enable Sidebar support]),
[ if test x$enableval = xyes ; then
AC_DEFINE(USE_SIDEBAR,1,[ Define if you want support for the sidebar. ])
OPS="$OPS \$(srcdir)/OPS.SIDEBAR"
need_sidebar="yes"
fi
])
AM_CONDITIONAL(BUILD_SIDEBAR, test x$need_sidebar = xyes)
AC_ARG_WITH(mixmaster, AS_HELP_STRING([--with-mixmaster@<:@=PATH@:>@],[Include Mixmaster support]),
[if test "$withval" != no
then
......
# This is a complete list of sidebar-related configuration.
# --------------------------------------------------------------------------
# VARIABLES - shown with their default values
# --------------------------------------------------------------------------
# Should the Sidebar be shown?
set sidebar_visible = no
# How wide should the Sidebar be in screen columns?
# Note: Some characters, e.g. Chinese, take up two columns each.
set sidebar_width = 20
# Should the mailbox paths be abbreviated?
set sidebar_short_path = no
# When abbreviating mailbox path names, use any of these characters as path
# separators. Only the part after the last separators will be shown.
# For file folders '/' is good. For IMAP folders, often '.' is useful.
set sidebar_delim_chars = '/.'
# If the mailbox path is abbreviated, should it be indented?
set sidebar_folder_indent = no
# Indent mailbox paths with this string.
set sidebar_indent_string = ' '
# Make the Sidebar only display mailboxes that contain new, or flagged,
# mail.
set sidebar_new_mail_only = no
# Any mailboxes that are whitelisted will always be visible, even if the
# sidebar_new_mail_only option is enabled.
sidebar_whitelist '/home/user/mailbox1'
sidebar_whitelist '/home/user/mailbox2'
# When searching for mailboxes containing new mail, should the search wrap
# around when it reaches the end of the list?
set sidebar_next_new_wrap = no
# The character to use as the divider between the Sidebar and the other Mutt
# panels.
# Note: Only the first character of this string is used.
set sidebar_divider_char = '|'
# Display the Sidebar mailboxes using this format string.
set sidebar_format = '%B%?F? [%F]?%* %?N?%N/?%S'
# Sidebar will not refresh its list of mailboxes any more frequently than
# this number of seconds. This will help reduce disk/network traffic.
set sidebar_refresh_time = 60
# Sort the mailboxes in the Sidebar using this method:
# count - total number of messages
# flagged - number of flagged messages
# new - number of new messages
# path - mailbox path
# unsorted - do not sort the mailboxes
set sidebar_sort_method = 'unsorted'
# --------------------------------------------------------------------------
# FUNCTIONS - shown with an example mapping
# --------------------------------------------------------------------------
# Move the highlight to the previous mailbox
bind index,pager \Cp sidebar-prev
# Move the highlight to the next mailbox
bind index,pager \Cn sidebar-next
# Open the highlighted mailbox
bind index,pager \Co sidebar-open
# Move the highlight to the previous page
# This is useful if you have a LOT of mailboxes.
bind index,pager <F3> sidebar-page-up
# Move the highlight to the next page
# This is useful if you have a LOT of mailboxes.
bind index,pager <F4> sidebar-page-down
# Move the highlight to the previous mailbox containing new, or flagged,
# mail.
bind index,pager <F5> sidebar-prev-new
# Move the highlight to the next mailbox containing new, or flagged, mail.
bind index,pager <F6> sidebar-next-new
# Toggle the visibility of the Sidebar.
bind index,pager B sidebar-toggle-visible
# --------------------------------------------------------------------------
# COLORS - some unpleasant examples are given
# --------------------------------------------------------------------------
# Note: All color operations are of the form:
# color OBJECT FOREGROUND BACKGROUND
# Color of the current, open, mailbox
# Note: This is a general Mutt option which colors all selected items.
color indicator cyan black
# Color of the highlighted, but not open, mailbox.
color sidebar_highlight black color8
# Color of the divider separating the Sidebar from Mutt panels
color sidebar_divider color8 black
# Color to give mailboxes containing flagged mail
color sidebar_flagged red black
# Color to give mailboxes containing new mail
color sidebar_new green black
# --------------------------------------------------------------------------
# vim: syntax=muttrc
" Vim syntax file for the mutt sidebar patch
syntax keyword muttrcVarBool skipwhite contained sidebar_folder_indent nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
syntax keyword muttrcVarBool skipwhite contained sidebar_new_mail_only nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
syntax keyword muttrcVarBool skipwhite contained sidebar_next_new_wrap nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
syntax keyword muttrcVarBool skipwhite contained sidebar_short_path nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
syntax keyword muttrcVarBool skipwhite contained sidebar_visible nextgroup=muttrcSetBoolAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
syntax keyword muttrcVarNum skipwhite contained sidebar_refresh_time nextgroup=muttrcSetNumAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
syntax keyword muttrcVarNum skipwhite contained sidebar_width nextgroup=muttrcSetNumAssignment,muttrcVPrefix,muttrcVarBool,muttrcVarQuad,muttrcVarNum,muttrcVarStr
syntax keyword muttrcVarStr contained skipwhite sidebar_divider_char nextgroup=muttrcVarEqualsIdxFmt
syntax keyword muttrcVarStr contained skipwhite sidebar_delim_chars nextgroup=muttrcVarEqualsIdxFmt
syntax keyword muttrcVarStr contained skipwhite sidebar_format nextgroup=muttrcVarEqualsIdxFmt
syntax keyword muttrcVarStr contained skipwhite sidebar_indent_string nextgroup=muttrcVarEqualsIdxFmt
syntax keyword muttrcVarStr contained skipwhite sidebar_sort_method nextgroup=muttrcVarEqualsIdxFmt
syntax keyword muttrcCommand sidebar_whitelist
syntax match muttrcFunction contained "\<sidebar-next\>"
syntax match muttrcFunction contained "\<sidebar-next-new\>"
syntax match muttrcFunction contained "\<sidebar-open\>"
syntax match muttrcFunction contained "\<sidebar-page-down\>"
syntax match muttrcFunction contained "\<sidebar-page-up\>"
syntax match muttrcFunction contained "\<sidebar-prev\>"
syntax match muttrcFunction contained "\<sidebar-prev-new\>"
syntax match muttrcFunction contained "\<sidebar-toggle-visible\>"
syntax keyword muttrcColorField contained sidebar_divider
syntax keyword muttrcColorField contained sidebar_flagged
syntax keyword muttrcColorField contained sidebar_highlight
syntax keyword muttrcColorField contained sidebar_indicator
syntax keyword muttrcColorField contained sidebar_new
" vim: syntax=vim
......@@ -26,8 +26,13 @@
#include "mailbox.h"
#include "mapping.h"
#include "sort.h"
#include "buffy.h"
#include "mx.h"
#ifdef USE_SIDEBAR
#include "sidebar.h"
#endif
#ifdef USE_POP
#include "pop.h"
#endif
......@@ -593,21 +598,39 @@ int mutt_index_menu (void)
menu->redraw |= REDRAW_STATUS;
if (do_buffy_notify)
{
if (mutt_buffy_notify () && option (OPTBEEPNEW))
beep ();
if (mutt_buffy_notify())
{
menu->redraw |= REDRAW_STATUS;
if (option (OPTBEEPNEW))
beep();
}
}
else
do_buffy_notify = 1;
}
#ifdef USE_SIDEBAR
if (option (OPTSIDEBAR))
menu->redraw |= REDRAW_SIDEBAR;
#endif
if (op != -1)
mutt_curs_set (0);
if (menu->redraw & REDRAW_FULL)
{
menu_redraw_full (menu);
#ifdef USE_SIDEBAR
sb_draw();
#endif
mutt_show_error ();
}
#ifdef USE_SIDEBAR
else if (menu->redraw & REDRAW_SIDEBAR) {
sb_draw();
menu->redraw &= ~REDRAW_SIDEBAR;
}
#endif
if (menu->menu == MENU_MAIN)
{
......@@ -631,6 +654,9 @@ int mutt_index_menu (void)
menu_status_line (buf, sizeof (buf), menu, NONULL (Status));
mutt_window_move (MuttStatusWindow, 0, 0);
SETCOLOR (MT_COLOR_STATUS);
#ifdef USE_SIDEBAR
sb_set_buffystats (Context);
#endif
mutt_paddstr (MuttStatusWindow->cols, buf);
NORMAL_COLOR;
menu->redraw &= ~REDRAW_STATUS;
......@@ -1090,6 +1116,9 @@ int mutt_index_menu (void)
break;
CHECK_MSGCOUNT;
#ifdef USE_SIDEBAR
CHECK_VISIBLE;
#endif
CHECK_READONLY;
{
int oldvcount = Context->vcount;
......@@ -1149,6 +1178,9 @@ int mutt_index_menu (void)
menu->redraw = REDRAW_FULL;
break;
#ifdef USE_SIDEBAR
case OP_SIDEBAR_OPEN:
#endif
case OP_MAIN_CHANGE_FOLDER:
case OP_MAIN_NEXT_UNREAD_MAILBOX:
......@@ -1180,6 +1212,14 @@ int mutt_index_menu (void)
{
mutt_buffy (buf, sizeof (buf));
#ifdef USE_SIDEBAR
if (op == OP_SIDEBAR_OPEN) {
const char *path = sb_get_highlight();
if (!path)
break;
strncpy (buf, path, sizeof (buf));
} else
#endif
if (mutt_enter_fname (cp, buf, sizeof (buf), &menu->redraw, 1) == -1)
{
if (menu->menu == MENU_PAGER)
......@@ -1198,6 +1238,9 @@ int mutt_index_menu (void)
}
mutt_expand_path (buf, sizeof (buf));
#ifdef USE_SIDEBAR
sb_set_open_buffy (buf);
#endif
if (mx_get_magic (buf) <= 0)
{
mutt_error (_("%s is not a mailbox."), buf);
......@@ -2309,6 +2352,22 @@ int mutt_index_menu (void)
mutt_what_key();
break;
#ifdef USE_SIDEBAR
case OP_SIDEBAR_NEXT:
case OP_SIDEBAR_NEXT_NEW:
case OP_SIDEBAR_PAGE_DOWN:
case OP_SIDEBAR_PAGE_UP:
case OP_SIDEBAR_PREV:
case OP_SIDEBAR_PREV_NEW:
sb_change_mailbox (op);
break;
case OP_SIDEBAR_TOGGLE_VISIBLE:
toggle_option (OPTSIDEBAR);
mutt_reflow_windows();
menu->redraw = REDRAW_FULL;
break;
#endif
default:
if (menu->menu == MENU_MAIN)
km_error_key (MENU_MAIN);
......
This diff is collapsed.
......@@ -25,6 +25,10 @@
#include "sort.h"
#include "mx.h"
#ifdef USE_SIDEBAR
#include "sidebar.h"
#endif
void _mutt_set_flag (CONTEXT *ctx, HEADER *h, int flag, int bf, int upd_ctx)
{
int changed = h->changed;
......@@ -263,6 +267,9 @@ void _mutt_set_flag (CONTEXT *ctx, HEADER *h, int flag, int bf, int upd_ctx)
*/
if (h->searched && (changed != h->changed || deleted != ctx->deleted || tagged != ctx->tagged || flagged != ctx->flagged))
h->searched = 0;
#ifdef USE_SIDEBAR
sb_draw();
#endif
}
void mutt_tag_set_flag (int flag, int bf)
......
......@@ -168,6 +168,16 @@ const struct binding_t OpMain[] = { /* map: index */
{ "decrypt-copy", OP_DECRYPT_COPY, NULL },
{ "decrypt-save", OP_DECRYPT_SAVE, NULL },
#ifdef USE_SIDEBAR
{ "sidebar-next", OP_SIDEBAR_NEXT, NULL },
{ "sidebar-next-new", OP_SIDEBAR_NEXT_NEW, NULL },
{ "sidebar-open", OP_SIDEBAR_OPEN, NULL },
{ "sidebar-page-down", OP_SIDEBAR_PAGE_DOWN, NULL },
{ "sidebar-page-up", OP_SIDEBAR_PAGE_UP, NULL },
{ "sidebar-prev", OP_SIDEBAR_PREV, NULL },
{ "sidebar-prev-new", OP_SIDEBAR_PREV_NEW, NULL },
{ "sidebar-toggle-visible", OP_SIDEBAR_TOGGLE_VISIBLE, NULL },
#endif
{ NULL, 0, NULL }
};
......@@ -272,6 +282,17 @@ const struct binding_t OpPager[] = { /* map: pager */
{ "what-key", OP_WHAT_KEY, NULL },
#ifdef USE_SIDEBAR
{ "sidebar-next", OP_SIDEBAR_NEXT, NULL },
{ "sidebar-next-new", OP_SIDEBAR_NEXT_NEW, NULL },
{ "sidebar-open", OP_SIDEBAR_OPEN, NULL },
{ "sidebar-page-down", OP_SIDEBAR_PAGE_DOWN, NULL },
{ "sidebar-page-up", OP_SIDEBAR_PAGE_UP, NULL },
{ "sidebar-prev", OP_SIDEBAR_PREV, NULL },
{ "sidebar-prev-new", OP_SIDEBAR_PREV_NEW, NULL },
{ "sidebar-toggle-visible", OP_SIDEBAR_TOGGLE_VISIBLE, NULL },
#endif
{ NULL, 0, NULL }
};
......
......@@ -118,6 +118,12 @@ WHERE short SearchContext;
WHERE char *SendCharset;