NeoMutt  2024-03-23-147-g885fbc
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
dlg_pager.c File Reference

Pager Dialog. More...

#include "config.h"
#include <assert.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 "lib.h"
#include "color/lib.h"
#include "index/lib.h"
#include "key/lib.h"
#include "menu/lib.h"
#include "pattern/lib.h"
#include "sidebar/lib.h"
#include "display.h"
#include "functions.h"
#include "mutt_logging.h"
#include "mutt_mailbox.h"
#include "mview.h"
#include "mx.h"
#include "private_data.h"
#include "protos.h"
#include "status.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

int BrailleRow = -1
 Braille display: row to leave the cursor.
 
int BrailleCol = -1
 Braille display: column to leave the cursor.
 
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 128 of file dlg_pager.c.

129{
130 priv->redraw |= redraw;
131 priv->pview->win_pager->actions |= WA_RECALC;
132}
#define WA_RECALC
Recalculate the contents of the Window.
Definition: mutt_window.h:110
WindowActionFlags actions
Actions to be performed, e.g. WA_RECALC.
Definition: mutt_window.h:132
PagerRedrawFlags redraw
When to redraw the screen.
Definition: private_data.h:69
struct PagerView * pview
Object to view in the pager.
Definition: private_data.h:42
struct MuttWindow * win_pager
Pager Window.
Definition: lib.h:180
+ 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 140 of file dlg_pager.c.

141{
142 const struct Mapping *result;
143 switch (mode)
144 {
145 case PAGER_MODE_EMAIL:
148 if (type == MUTT_NNTP)
149 result = PagerNewsHelp;
150 else
151 result = PagerNormalHelp;
152 break;
153
154 case PAGER_MODE_HELP:
155 result = PagerHelpHelp;
156 break;
157
158 case PAGER_MODE_OTHER:
159 result = PagerHelp;
160 break;
161
163 case PAGER_MODE_MAX:
164 default:
165 assert(false); // something went really wrong
166 }
167 assert(result);
168 return result;
169}
@ MUTT_NNTP
'NNTP' (Usenet) Mailbox type
Definition: mailbox.h:49
static const struct Mapping PagerHelpHelp[]
Help Bar for the Help Page itself.
Definition: dlg_pager.c:84
static const struct Mapping PagerNewsHelp[]
Help Bar for the Pager of an NNTP Mailbox.
Definition: dlg_pager.c:109
static const struct Mapping PagerNormalHelp[]
Help Bar for the Pager of a normal Mailbox.
Definition: dlg_pager.c:94
static const struct Mapping PagerHelp[]
Help Bar for the Pager's Help Page.
Definition: dlg_pager.c:73
@ PAGER_MODE_OTHER
Pager is invoked via 3rd path. Non-email content is likely to be shown.
Definition: lib.h:142
@ PAGER_MODE_HELP
Pager is invoked via 3rd path to show help.
Definition: lib.h:141
@ 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:139
@ PAGER_MODE_EMAIL
Pager is invoked via 1st path. The mime part is selected automatically.
Definition: lib.h:138
@ PAGER_MODE_ATTACH_E
A special case of PAGER_MODE_ATTACH - attachment is a full-blown email message.
Definition: lib.h:140
@ PAGER_MODE_UNKNOWN
A default and invalid mode, should never be used.
Definition: lib.h:136
@ PAGER_MODE_MAX
Another invalid mode, should never be used.
Definition: lib.h:144
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 177 of file dlg_pager.c.

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

Variable Documentation

◆ BrailleRow

int BrailleRow = -1

Braille display: row to leave the cursor.

Definition at line 68 of file dlg_pager.c.

◆ BrailleCol

int BrailleCol = -1

Braille display: column to leave the cursor.

Definition at line 70 of file dlg_pager.c.

◆ 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 73 of file dlg_pager.c.

◆ 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 84 of file dlg_pager.c.

◆ 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 94 of file dlg_pager.c.

◆ 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 109 of file dlg_pager.c.