NeoMutt  2024-04-16-36-g75b6fb
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches

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() -.
 
static int query_tag (struct Menu *menu, int sel, int act)
 Tag an entry in the Query Menu - Implements Menu::tag() -.
 
static int attach_tag (struct Menu *menu, int sel, int act)
 Tag an attachment - Implements Menu::tag() -.
 
static int file_tag (struct Menu *menu, int sel, int act)
 Tag an entry in the menu - Implements Menu::tag() -.
 
static int compose_attach_tag (struct Menu *menu, int sel, int act)
 Tag an attachment - Implements Menu::tag() -.
 

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

243{
244 const struct AliasMenuData *mdata = menu->mdata;
245 const struct AliasViewArray *ava = &mdata->ava;
246 struct AliasView *av = ARRAY_GET(ava, sel);
247
248 bool ot = av->is_tagged;
249
250 av->is_tagged = ((act >= 0) ? act : !av->is_tagged);
251
252 return av->is_tagged - ot;
253}
#define ARRAY_GET(head, idx)
Return the element at index.
Definition: array.h:109
AliasView array wrapper with Pattern information -.
Definition: gui.h:54
struct AliasViewArray ava
All Aliases/Queries.
Definition: gui.h:55
struct Menu * menu
Menu.
Definition: gui.h:58
GUI data wrapping an Alias.
Definition: gui.h:38
bool is_tagged
Is it tagged?
Definition: gui.h:43
void * mdata
Private data.
Definition: lib.h:147
+ 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 252 of file dlg_query.c.

253{
254 const struct AliasMenuData *mdata = menu->mdata;
255 const struct AliasViewArray *ava = &mdata->ava;
256 struct AliasView *av = ARRAY_GET(ava, sel);
257
258 bool ot = av->is_tagged;
259
260 av->is_tagged = ((act >= 0) ? act : !av->is_tagged);
261 return av->is_tagged - ot;
262}
+ 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 485 of file dlg_attach.c.

486{
487 struct AttachPrivateData *priv = menu->mdata;
488 struct AttachCtx *actx = priv->actx;
489
490 struct Body *cur = actx->idx[actx->v2r[sel]]->body;
491 bool ot = cur->tagged;
492
493 cur->tagged = ((act >= 0) ? act : !cur->tagged);
494 return cur->tagged - ot;
495}
A set of attachments.
Definition: attach.h:65
struct AttachPtr ** idx
Array of attachments.
Definition: attach.h:69
short * v2r
Mapping from virtual to real attachment.
Definition: attach.h:73
Private state data for Attachments.
Definition: private_data.h:36
struct Menu * menu
Current Menu.
Definition: private_data.h:37
struct AttachCtx * actx
List of all Attachments.
Definition: private_data.h:38
struct Body * body
Attachment.
Definition: attach.h:38
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 1134 of file dlg_browser.c.

1135{
1136 struct BrowserEntryArray *entry = menu->mdata;
1137 struct FolderFile *ff = ARRAY_GET(entry, sel);
1138 if (S_ISDIR(ff->mode) ||
1139 (S_ISLNK(ff->mode) && link_is_dir(buf_string(&LastDir), ff->name)))
1140 {
1141 mutt_error(_("Can't attach a directory"));
1142 return 0;
1143 }
1144
1145 bool ot = ff->tagged;
1146 ff->tagged = ((act >= 0) ? act : !ff->tagged);
1147
1148 return ff->tagged - ot;
1149}
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition: buffer.h:96
struct Buffer LastDir
Browser: previous selected directory.
Definition: dlg_browser.c:140
bool link_is_dir(const char *folder, const char *path)
Does this symlink point to a directory?
Definition: dlg_browser.c:176
#define mutt_error(...)
Definition: logging2.h:92
#define _(a)
Definition: message.h:28
Browser entry representing a folder/dir.
Definition: lib.h:78
char * name
Name of file/dir/mailbox.
Definition: lib.h:86
bool tagged
Folder is tagged.
Definition: lib.h:102
mode_t mode
File permissions.
Definition: lib.h:79
+ 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 201 of file attach.c.

202{
203 struct ComposeAttachData *adata = menu->mdata;
204 struct AttachCtx *actx = adata->actx;
205 struct Body *cur = actx->idx[actx->v2r[sel]]->body;
206 bool ot = cur->tagged;
207
208 cur->tagged = ((act >= 0) ? act : !cur->tagged);
209 return cur->tagged - ot;
210}
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: