NeoMutt  2025-12-11-911-gd8d604
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
dlg_pager.c File Reference

Pager Dialog. More...

#include "config.h"
#include <inttypes.h>
#include <stdbool.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
#include "mutt/lib.h"
#include "config/lib.h"
#include "email/lib.h"
#include "core/lib.h"
#include "gui/lib.h"
#include "mutt.h"
#include "debug/lib.h"
#include "lib.h"
#include "color/lib.h"
#include "expando/lib.h"
#include "index/lib.h"
#include "key/lib.h"
#include "pattern/lib.h"
#include "sidebar/lib.h"
#include "display.h"
#include "functions.h"
#include "module_data.h"
#include "mutt_logging.h"
#include "mutt_mailbox.h"
#include "mx.h"
#include "private_data.h"
+ Include dependency graph for dlg_pager.c:

Go to the source code of this file.

Functions

void pager_queue_redraw (struct PagerPrivateData *priv, PagerRedrawFlags redraw)
 Queue a request for a redraw.
 
static const struct Mappingpager_resolve_help_mapping (enum PagerMode mode, enum MailboxType type)
 Determine help mapping based on pager mode and mailbox type.
 
static bool check_read_delay (uint64_t *timestamp)
 Is it time to mark the message read?
 
int dlg_pager (struct PagerView *pview)
 Display an email, attachment, or help, in a window -.
 

Variables

static const struct Mapping PagerHelp []
 Help Bar for the Pager's Help Page.
 
static const struct Mapping PagerHelpHelp []
 Help Bar for the Help Page itself.
 
static const struct Mapping PagerNormalHelp []
 Help Bar for the Pager of a normal Mailbox.
 
static const struct Mapping PagerNewsHelp []
 Help Bar for the Pager of an NNTP Mailbox.
 

Detailed Description

Pager Dialog.

Authors
  • Richard Russon
  • R Primus
  • Pietro Cerutti
  • Eric Blake
  • Ihor Antonov

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file dlg_pager.c.

Function Documentation

◆ pager_queue_redraw()

void pager_queue_redraw ( struct PagerPrivateData * priv,
PagerRedrawFlags redraw )

Queue a request for a redraw.

Parameters
privPrivate Pager data
redrawItem to redraw, e.g. PAGER_REDRAW_PAGER

Definition at line 121 of file dlg_pager.c.

122{
123 priv->redraw |= redraw;
124
125 if (priv->pview && priv->pview->win_pager)
126 priv->pview->win_pager->actions |= WA_RECALC;
127}
@ WA_RECALC
Recalculate the contents of the Window.
WindowActionFlags actions
Actions to be performed, e.g. WA_RECALC.
PagerRedrawFlags redraw
When to redraw the screen.
struct PagerView * pview
Object to view in the pager.
struct MuttWindow * win_pager
Pager Window.
Definition lib.h:181
+ Here is the caller graph for this function:

◆ pager_resolve_help_mapping()

static const struct Mapping * pager_resolve_help_mapping ( enum PagerMode mode,
enum MailboxType type )
static

Determine help mapping based on pager mode and mailbox type.

Parameters
modepager mode
typemailbox type
Return values
ptrHelp Mapping

Definition at line 135 of file dlg_pager.c.

136{
137 const struct Mapping *result = NULL;
138 switch (mode)
139 {
140 case PAGER_MODE_EMAIL:
143 if (type == MUTT_NNTP)
144 result = PagerNewsHelp;
145 else
146 result = PagerNormalHelp;
147 break;
148
149 case PAGER_MODE_HELP:
150 result = PagerHelpHelp;
151 break;
152
153 case PAGER_MODE_OTHER:
154 result = PagerHelp;
155 break;
156
158 case PAGER_MODE_MAX:
159 default:
160 ASSERT(false); // something went really wrong
161 }
162 ASSERT(result);
163 return result;
164}
@ MUTT_NNTP
'NNTP' (Usenet) Mailbox type
Definition mailbox.h:48
static const struct Mapping PagerHelpHelp[]
Help Bar for the Help Page itself.
Definition dlg_pager.c:77
static const struct Mapping PagerNewsHelp[]
Help Bar for the Pager of an NNTP Mailbox.
Definition dlg_pager.c:102
static const struct Mapping PagerNormalHelp[]
Help Bar for the Pager of a normal Mailbox.
Definition dlg_pager.c:87
static const struct Mapping PagerHelp[]
Help Bar for the Pager's Help Page.
Definition dlg_pager.c:66
@ PAGER_MODE_OTHER
Pager is invoked via 3rd path. Non-email content is likely to be shown.
Definition lib.h:143
@ PAGER_MODE_HELP
Pager is invoked via 3rd path to show help.
Definition lib.h:142
@ PAGER_MODE_ATTACH
Pager is invoked via 2nd path. A user-selected attachment (mime part or a nested email) will be shown...
Definition lib.h:140
@ PAGER_MODE_EMAIL
Pager is invoked via 1st path. The mime part is selected automatically.
Definition lib.h:139
@ PAGER_MODE_ATTACH_E
A special case of PAGER_MODE_ATTACH - attachment is a full-blown email message.
Definition lib.h:141
@ PAGER_MODE_UNKNOWN
A default and invalid mode, should never be used.
Definition lib.h:137
@ PAGER_MODE_MAX
Another invalid mode, should never be used.
Definition lib.h:145
#define ASSERT(COND)
Definition signal2.h:59
Mapping between user-readable string and a constant.
Definition mapping.h:33
+ Here is the caller graph for this function:

◆ check_read_delay()

static bool check_read_delay ( uint64_t * timestamp)
static

Is it time to mark the message read?

Parameters
timestampTime when message should be marked read, or 0
Return values
trueMessage should be marked read
falseNo action necessary

Definition at line 172 of file dlg_pager.c.

173{
174 if ((*timestamp != 0) && (mutt_date_now_ms() > *timestamp))
175 {
176 *timestamp = 0;
177 return true;
178 }
179 return false;
180}
uint64_t mutt_date_now_ms(void)
Return the number of milliseconds since the Unix epoch.
Definition date.c:466
static const char * timestamp(time_t stamp)
Create a YYYY-MM-DD HH:MM:SS timestamp.
Definition logging.c:79
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ PagerHelp

const struct Mapping PagerHelp[]
static
Initial value:
= {
{ N_("Exit"), OP_EXIT },
{ N_("PrevPg"), OP_PREV_PAGE },
{ N_("NextPg"), OP_NEXT_PAGE },
{ N_("Help"), OP_HELP },
{ NULL, 0 },
}
#define N_(a)
Definition message.h:32

Help Bar for the Pager's Help Page.

Definition at line 66 of file dlg_pager.c.

66 {
67 // clang-format off
68 { N_("Exit"), OP_EXIT },
69 { N_("PrevPg"), OP_PREV_PAGE },
70 { N_("NextPg"), OP_NEXT_PAGE },
71 { N_("Help"), OP_HELP },
72 { NULL, 0 },
73 // clang-format on
74};

◆ PagerHelpHelp

const struct Mapping PagerHelpHelp[]
static
Initial value:
= {
{ N_("Exit"), OP_EXIT },
{ N_("PrevPg"), OP_PREV_PAGE },
{ N_("NextPg"), OP_NEXT_PAGE },
{ NULL, 0 },
}

Help Bar for the Help Page itself.

Definition at line 77 of file dlg_pager.c.

77 {
78 // clang-format off
79 { N_("Exit"), OP_EXIT },
80 { N_("PrevPg"), OP_PREV_PAGE },
81 { N_("NextPg"), OP_NEXT_PAGE },
82 { NULL, 0 },
83 // clang-format on
84};

◆ PagerNormalHelp

const struct Mapping PagerNormalHelp[]
static
Initial value:
= {
{ N_("Exit"), OP_EXIT },
{ N_("PrevPg"), OP_PREV_PAGE },
{ N_("NextPg"), OP_NEXT_PAGE },
{ N_("View Attachm."), OP_VIEW_ATTACHMENTS },
{ N_("Del"), OP_DELETE },
{ N_("Reply"), OP_REPLY },
{ N_("Next"), OP_MAIN_NEXT_UNDELETED },
{ N_("Help"), OP_HELP },
{ NULL, 0 },
}

Help Bar for the Pager of a normal Mailbox.

Definition at line 87 of file dlg_pager.c.

87 {
88 // clang-format off
89 { N_("Exit"), OP_EXIT },
90 { N_("PrevPg"), OP_PREV_PAGE },
91 { N_("NextPg"), OP_NEXT_PAGE },
92 { N_("View Attachm."), OP_VIEW_ATTACHMENTS },
93 { N_("Del"), OP_DELETE },
94 { N_("Reply"), OP_REPLY },
95 { N_("Next"), OP_MAIN_NEXT_UNDELETED },
96 { N_("Help"), OP_HELP },
97 { NULL, 0 },
98 // clang-format on
99};

◆ PagerNewsHelp

const struct Mapping PagerNewsHelp[]
static
Initial value:
= {
{ N_("Exit"), OP_EXIT },
{ N_("PrevPg"), OP_PREV_PAGE },
{ N_("NextPg"), OP_NEXT_PAGE },
{ N_("Post"), OP_POST },
{ N_("Followup"), OP_FOLLOWUP },
{ N_("Del"), OP_DELETE },
{ N_("Next"), OP_MAIN_NEXT_UNDELETED },
{ N_("Help"), OP_HELP },
{ NULL, 0 },
}

Help Bar for the Pager of an NNTP Mailbox.

Definition at line 102 of file dlg_pager.c.

102 {
103 // clang-format off
104 { N_("Exit"), OP_EXIT },
105 { N_("PrevPg"), OP_PREV_PAGE },
106 { N_("NextPg"), OP_NEXT_PAGE },
107 { N_("Post"), OP_POST },
108 { N_("Followup"), OP_FOLLOWUP },
109 { N_("Del"), OP_DELETE },
110 { N_("Next"), OP_MAIN_NEXT_UNDELETED },
111 { N_("Help"), OP_HELP },
112 { NULL, 0 },
113 // clang-format on
114};