NeoMutt  2021-02-05-666-ge300cd
Teaching an old dog new tricks
DOXYGEN

Tag some menu items. More...

+ Collaboration diagram for tag():

Functions

static int alias_tag (struct Menu *menu, int sel, int act)
 Tag some aliases - Implements Menu::tag() -. More...
 
static int query_tag (struct Menu *menu, int sel, int act)
 Tag an entry in the Query Menu - Implements Menu::tag() -. More...
 
static int file_tag (struct Menu *menu, int sel, int act)
 Tag an entry in the menu - Implements Menu::tag() -. More...
 
static int compose_attach_tag (struct Menu *menu, int sel, int act)
 Tag an attachment - Implements Menu::tag() -. More...
 
int attach_tag (struct Menu *menu, int sel, int act)
 Tag an attachment - Implements Menu::tag() -. More...
 

Detailed Description

Tag some menu items.

Parameters
menuMenu to tag
selCurrent selection
actAction: 0 untag, 1 tag, -1 toggle
Return values
numNet change in number of tagged attachments

Function Documentation

◆ alias_tag()

static int alias_tag ( struct Menu menu,
int  sel,
int  act 
)
static

Tag some aliases - Implements Menu::tag() -.

Definition at line 180 of file dlgalias.c.

181 {
182  const struct AliasMenuData *mdata = menu->mdata;
183  const struct AliasViewArray *ava = &mdata->ava;
184  struct AliasView *av = ARRAY_GET(ava, sel);
185 
186  bool ot = av->is_tagged;
187 
188  av->is_tagged = ((act >= 0) ? act : !av->is_tagged);
189 
190  return av->is_tagged - ot;
191 }
AliasView array wrapper with Pattern information -.
Definition: gui.h:52
#define ARRAY_GET(head, idx)
Return the element at index.
Definition: array.h:105
GUI data wrapping an Alias.
Definition: gui.h:35
void * mdata
Private data.
Definition: lib.h:155
bool is_tagged
Is it tagged?
Definition: gui.h:41
struct AliasViewArray ava
Array of AliasView.
Definition: gui.h:55
+ Here is the caller graph for this function:

◆ query_tag()

static int query_tag ( struct Menu menu,
int  sel,
int  act 
)
static

Tag an entry in the Query Menu - Implements Menu::tag() -.

Definition at line 262 of file dlgquery.c.

263 {
264  const struct AliasMenuData *mdata = menu->mdata;
265  const struct AliasViewArray *ava = &mdata->ava;
266  struct AliasView *av = ARRAY_GET(ava, sel);
267 
268  bool ot = av->is_tagged;
269 
270  av->is_tagged = ((act >= 0) ? act : !av->is_tagged);
271  return av->is_tagged - ot;
272 }
AliasView array wrapper with Pattern information -.
Definition: gui.h:52
#define ARRAY_GET(head, idx)
Return the element at index.
Definition: array.h:105
GUI data wrapping an Alias.
Definition: gui.h:35
void * mdata
Private data.
Definition: lib.h:155
bool is_tagged
Is it tagged?
Definition: gui.h:41
struct AliasViewArray ava
Array of AliasView.
Definition: gui.h:55
+ Here is the caller graph for this function:

◆ file_tag()

static int file_tag ( struct Menu menu,
int  sel,
int  act 
)
static

Tag an entry in the menu - Implements Menu::tag() -.

Definition at line 1152 of file browser.c.

1153 {
1154  struct BrowserStateEntry *entry = menu->mdata;
1155  struct FolderFile *ff = ARRAY_GET(entry, sel);
1156  if (S_ISDIR(ff->mode) ||
1157  (S_ISLNK(ff->mode) && link_is_dir(mutt_buffer_string(&LastDir), ff->name)))
1158  {
1159  mutt_error(_("Can't attach a directory"));
1160  return 0;
1161  }
1162 
1163  bool ot = ff->tagged;
1164  ff->tagged = ((act >= 0) ? act : !ff->tagged);
1165 
1166  return ff->tagged - ot;
1167 }
mode_t mode
Definition: browser.h:55
static bool link_is_dir(const char *folder, const char *path)
Does this symlink point to a directory?
Definition: browser.c:369
#define mutt_error(...)
Definition: logging.h:88
#define ARRAY_GET(head, idx)
Return the element at index.
Definition: array.h:105
#define _(a)
Definition: message.h:28
static const char * mutt_buffer_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition: buffer.h:77
char * name
Definition: browser.h:62
Browser entry representing a folder/dir.
Definition: browser.h:53
void * mdata
Private data.
Definition: lib.h:155
static struct Buffer LastDir
Definition: browser.c:138
bool tagged
Definition: browser.h:78
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compose_attach_tag()

static int compose_attach_tag ( struct Menu menu,
int  sel,
int  act 
)
static

Tag an attachment - Implements Menu::tag() -.

Definition at line 247 of file attach.c.

248 {
249  struct ComposeAttachData *adata = menu->mdata;
250  struct AttachCtx *actx = adata->actx;
251  struct Body *cur = actx->idx[actx->v2r[sel]]->body;
252  bool ot = cur->tagged;
253 
254  cur->tagged = ((act >= 0) ? act : !cur->tagged);
255  return cur->tagged - ot;
256 }
Data to fill the Compose Attach Window.
Definition: attach_data.h:32
The body of an email.
Definition: body.h:34
bool tagged
This attachment is tagged.
Definition: body.h:70
void * mdata
Private data.
Definition: lib.h:155
struct AttachCtx * actx
Definition: attach_data.h:34
short * v2r
Mapping from virtual to real attachment.
Definition: attach.h:58
A set of attachments.
Definition: attach.h:49
struct AttachPtr ** idx
Array of attachments.
Definition: attach.h:54
struct Body * body
Attachment.
Definition: attach.h:36
+ Here is the caller graph for this function:

◆ attach_tag()

int attach_tag ( struct Menu menu,
int  sel,
int  act 
)

Tag an attachment - Implements Menu::tag() -.

Definition at line 519 of file recvattach.c.

520 {
521  struct AttachCtx *actx = menu->mdata;
522  struct Body *cur = actx->idx[actx->v2r[sel]]->body;
523  bool ot = cur->tagged;
524 
525  cur->tagged = ((act >= 0) ? act : !cur->tagged);
526  return cur->tagged - ot;
527 }
The body of an email.
Definition: body.h:34
bool tagged
This attachment is tagged.
Definition: body.h:70
void * mdata
Private data.
Definition: lib.h:155
short * v2r
Mapping from virtual to real attachment.
Definition: attach.h:58
A set of attachments.
Definition: attach.h:49
struct AttachPtr ** idx
Array of attachments.
Definition: attach.h:54
struct Body * body
Attachment.
Definition: attach.h:36
+ Here is the caller graph for this function: