NeoMutt  2022-04-29-215-gc12b98
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 attach_tag (struct Menu *menu, int sel, int act)
 Tag an attachment - 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...
 

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 183 of file dlg_alias.c.

184{
185 const struct AliasMenuData *mdata = menu->mdata;
186 const struct AliasViewArray *ava = &mdata->ava;
187 struct AliasView *av = ARRAY_GET(ava, sel);
188
189 bool ot = av->is_tagged;
190
191 av->is_tagged = ((act >= 0) ? act : !av->is_tagged);
192
193 return av->is_tagged - ot;
194}
#define ARRAY_GET(head, idx)
Return the element at index.
Definition: array.h:108
AliasView array wrapper with Pattern information -.
Definition: gui.h:52
struct AliasViewArray ava
All Aliases/Queries.
Definition: gui.h:53
struct Menu * menu
Menu.
Definition: gui.h:56
GUI data wrapping an Alias.
Definition: gui.h:36
bool is_tagged
Is it tagged?
Definition: gui.h:41
void * mdata
Private data.
Definition: lib.h:137
+ 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 230 of file dlg_query.c.

231{
232 const struct AliasMenuData *mdata = menu->mdata;
233 const struct AliasViewArray *ava = &mdata->ava;
234 struct AliasView *av = ARRAY_GET(ava, sel);
235
236 bool ot = av->is_tagged;
237
238 av->is_tagged = ((act >= 0) ? act : !av->is_tagged);
239 return av->is_tagged - ot;
240}
+ Here is the caller graph for this function:

◆ attach_tag()

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

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

Definition at line 400 of file dlg_attach.c.

401{
402 struct AttachPrivateData *priv = menu->mdata;
403 struct AttachCtx *actx = priv->actx;
404
405 struct Body *cur = actx->idx[actx->v2r[sel]]->body;
406 bool ot = cur->tagged;
407
408 cur->tagged = ((act >= 0) ? act : !cur->tagged);
409 return cur->tagged - ot;
410}
A set of attachments.
Definition: attach.h:51
struct AttachPtr ** idx
Array of attachments.
Definition: attach.h:55
short * v2r
Mapping from virtual to real attachment.
Definition: attach.h:59
Private state data for Attachments.
Definition: private_data.h:34
struct Menu * menu
Current Menu.
Definition: private_data.h:35
struct AttachCtx * actx
List of all Attachments.
Definition: private_data.h:36
struct Body * body
Attachment.
Definition: attach.h:36
The body of an email.
Definition: body.h:36
bool tagged
This attachment is tagged.
Definition: body.h:89
+ 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 983 of file browser.c.

984{
985 struct BrowserStateEntry *entry = menu->mdata;
986 struct FolderFile *ff = ARRAY_GET(entry, sel);
987 if (S_ISDIR(ff->mode) ||
988 (S_ISLNK(ff->mode) && link_is_dir(mutt_buffer_string(&LastDir), ff->name)))
989 {
990 mutt_error(_("Can't attach a directory"));
991 return 0;
992 }
993
994 bool ot = ff->tagged;
995 ff->tagged = ((act >= 0) ? act : !ff->tagged);
996
997 return ff->tagged - ot;
998}
struct Buffer LastDir
Definition: browser.c:136
bool link_is_dir(const char *folder, const char *path)
Does this symlink point to a directory?
Definition: browser.c:171
static const char * mutt_buffer_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition: buffer.h:77
#define mutt_error(...)
Definition: logging.h:87
#define _(a)
Definition: message.h:28
Browser entry representing a folder/dir.
Definition: lib.h:73
char * name
Name of file/dir/mailbox.
Definition: lib.h:81
bool tagged
Folder is tagged.
Definition: lib.h:97
mode_t mode
File permissions.
Definition: lib.h:74
+ 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 202 of file attach.c.

203{
204 struct ComposeAttachData *adata = menu->mdata;
205 struct AttachCtx *actx = adata->actx;
206 struct Body *cur = actx->idx[actx->v2r[sel]]->body;
207 bool ot = cur->tagged;
208
209 cur->tagged = ((act >= 0) ? act : !cur->tagged);
210 return cur->tagged - ot;
211}
Data to fill the Compose Attach Window.
Definition: attach_data.h:33
struct Menu * menu
Menu displaying the attachments.
Definition: attach_data.h:35
struct AttachCtx * actx
Set of attachments.
Definition: attach_data.h:34
+ Here is the caller graph for this function: