NeoMutt  2024-04-25-100-gcb3684
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 "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 127 of file dlg_pager.c.

128{
129 priv->redraw |= redraw;
130 priv->pview->win_pager->actions |= WA_RECALC;
131}
#define WA_RECALC
Recalculate the contents of the Window.
Definition: mutt_window.h:109
WindowActionFlags actions
Actions to be performed, e.g. WA_RECALC.
Definition: mutt_window.h:131
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 139 of file dlg_pager.c.

140{
141 const struct Mapping *result = NULL;
142 switch (mode)
143 {
144 case PAGER_MODE_EMAIL:
147 if (type == MUTT_NNTP)
148 result = PagerNewsHelp;
149 else
150 result = PagerNormalHelp;
151 break;
152
153 case PAGER_MODE_HELP:
154 result = PagerHelpHelp;
155 break;
156
157 case PAGER_MODE_OTHER:
158 result = PagerHelp;
159 break;
160
162 case PAGER_MODE_MAX:
163 default:
164 ASSERT(false); // something went really wrong
165 }
166 ASSERT(result);
167 return result;
168}
@ 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:83
static const struct Mapping PagerNewsHelp[]
Help Bar for the Pager of an NNTP Mailbox.
Definition: dlg_pager.c:108
static const struct Mapping PagerNormalHelp[]
Help Bar for the Pager of a normal Mailbox.
Definition: dlg_pager.c:93
static const struct Mapping PagerHelp[]
Help Bar for the Pager's Help Page.
Definition: dlg_pager.c:72
@ 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
#define ASSERT(COND)
Definition: signal2.h:58
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 176 of file dlg_pager.c.

177{
178 if ((*timestamp != 0) && (mutt_date_now_ms() > *timestamp))
179 {
180 *timestamp = 0;
181 return true;
182 }
183 return false;
184}
uint64_t mutt_date_now_ms(void)
Return the number of milliseconds since the Unix epoch.
Definition: date.c:465
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 67 of file dlg_pager.c.

◆ BrailleCol

int BrailleCol = -1

Braille display: column to leave the cursor.

Definition at line 69 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 72 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 83 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 93 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 108 of file dlg_pager.c.