ELinks 0.16.1.1
type_query Struct Reference

The user has navigated to a resource that ELinks does not display automatically because of its MIME type, and ELinks is asking what to do. More...

#include <download.h>

Collaboration diagram for type_query:

Data Fields

void * magic1
struct type_querynext
struct type_queryprev
void * magic2
struct download download
 After ELinks has downloaded enough of the resource to see that a type query is needed, it moves the download here and continues it while the user decides what to do.
struct cache_entrycached
 Cache entry loaded from uri.
struct sessionses
 The session in which the user navigated to uri.
struct uriuri
 The URI of the resource about which ELinks is asking.
char * target_frame
 The name of the frame in which the user navigated to uri.
char * inpext
 input filename extension
char * outext
 output filename extension
char * external_handler
 Command line for an external handler, to be run when the download finishes.
int block
 Whether the external handler is going to use the terminal.
unsigned int cgi:1
 Whether the resource was generated by ELinks running a local CGI program.
unsigned int dgi:1
unsigned int copiousoutput:1
 mailcap entry with copiousoutput

(Note that these are not member symbols.)

static struct type_queryfind_type_query (struct session *ses)
static struct type_queryinit_type_query (struct session *ses, struct download *download, struct cache_entry *cached)
 Prepare to ask the user what to do with a file, but don't display the window yet.
void done_type_query (struct type_query *type_query)
 Cancel any download started for type_query, remove the structure from the session.type_queries list, and free it.
void tp_cancel (void *data)
 The user chose "Cancel" when asked what to do with a file, or the type query was cancelled for some other reason.
void tp_save (struct type_query *type_query)
 The user chose "Save" when asked what to do with a file.
static widget_handler_status_T tp_show_header (struct dialog_data *dlg_data, struct widget_data *widget_data)
 The user chose "Show header" when asked what to do with a file.
void tp_display (struct type_query *type_query)
 The user chose "Display" when asked what to do with a file, or she chose "Open" and there is no external handler.
static void tp_open (struct type_query *type_query)
 The user chose "Open" when asked what to do with a file.
static void do_type_query (struct type_query *type_query, char *ct, struct mime_handler *handler)
int setup_download_handler (struct session *ses, struct download *loading, struct cache_entry *cached, int frame)

Detailed Description

The user has navigated to a resource that ELinks does not display automatically because of its MIME type, and ELinks is asking what to do.

These structures are kept in the session.type_queries list, and destroy_session() calls done_type_query() to destroy them too.

◆ do_type_query()

void do_type_query ( struct type_query * type_query,
char * ct,
struct mime_handler * handler )
related

Ask the user what to do with a file.

This function does not support BitTorrent downloads. For those, query_bittorrent_dialog() must be called instead. setup_download_handler() takes care of this.

◆ done_type_query()

void done_type_query ( struct type_query * type_query)
related

Cancel any download started for type_query, remove the structure from the session.type_queries list, and free it.

◆ find_type_query()

struct type_query * find_type_query ( struct session * ses)
related

◆ init_type_query()

struct type_query * init_type_query ( struct session * ses,
struct download * download,
struct cache_entry * cached )
related

Prepare to ask the user what to do with a file, but don't display the window yet.

To display it, do_type_query() must be called separately. setup_download_handler() takes care of that.

◆ setup_download_handler()

int setup_download_handler ( struct session * ses,
struct download * loading,
struct cache_entry * cached,
int frame )
related

◆ tp_cancel()

void tp_cancel ( void * data)
related

The user chose "Cancel" when asked what to do with a file, or the type query was cancelled for some other reason.

do_type_query() and bittorrent_query_callback() pass this function as a done_handler_T to add_dlg_ok_button(), and tp_save() passes this function as a cancel callback to query_file().

◆ tp_display()

void tp_display ( struct type_query * type_query)
related

The user chose "Display" when asked what to do with a file, or she chose "Open" and there is no external handler.

do_type_query() and bittorrent_query_callback() pass this function as a done_handler_T to add_dlg_ok_button().

Bug
FIXME: We need to modify this function to take frame data instead, as we want to use this function for frames as well (now, when frame has content type text/plain, it is ignored and displayed as HTML).

◆ tp_open()

void tp_open ( struct type_query * type_query)
related

The user chose "Open" when asked what to do with a file.

Or an external handler was found and it has been configured to run without asking.

do_type_query() passes this function as a done_handler_T to add_dlg_ok_button().

◆ tp_save()

void tp_save ( struct type_query * type_query)
related

The user chose "Save" when asked what to do with a file.

Now ask her where to save the file.

do_type_query() and bittorrent_query_callback() pass this function as a done_handler_T to add_dlg_ok_button().

◆ tp_show_header()

widget_handler_status_T tp_show_header ( struct dialog_data * dlg_data,
struct widget_data * widget_data )
related

The user chose "Show header" when asked what to do with a file.

do_type_query() passes this function as a widget_handler_T to add_dlg_button(). Unlike with add_dlg_ok_button(), pressing this button does not close the dialog box. This way, the user can first examine the header and then choose what to do.

Field Documentation

◆ block

int type_query::block

Whether the external handler is going to use the terminal.

When ELinks displays the type query, it copies this from mime_handler.block of the default handler of the type. The user can then change the flag with a checkbox.

◆ cached

struct cache_entry* type_query::cached

Cache entry loaded from uri.

Apparently used only for displaying the header.

◆ cgi

unsigned int type_query::cgi

Whether the resource was generated by ELinks running a local CGI program.

If the user chooses to open the resource with an external handler, ELinks normally saves the resource to a temporary file and passes the name of that to the external handler. However, if the resource is from a "file" URI that does not refer to a local CGI, then Elinks need not copy the file.

◆ copiousoutput

unsigned int type_query::copiousoutput

mailcap entry with copiousoutput

◆ dgi

unsigned int type_query::dgi

◆ download

struct download type_query::download

After ELinks has downloaded enough of the resource to see that a type query is needed, it moves the download here and continues it while the user decides what to do.

◆ external_handler

char* type_query::external_handler

Command line for an external handler, to be run when the download finishes.

When ELinks displays the type query, it copies this from mime_handler.program of the default handler of the type. The user can then edit the string. This string must be freed with mem_free().

◆ inpext

char* type_query::inpext

input filename extension

◆ magic1

void* type_query::magic1

◆ magic2

void* type_query::magic2

◆ next

struct type_query* type_query::next

◆ outext

char* type_query::outext

output filename extension

◆ prev

struct type_query* type_query::prev

◆ ses

struct session* type_query::ses

The session in which the user navigated to uri.

The type_query is in the session.type_queries list of this session.

◆ target_frame

char* type_query::target_frame

The name of the frame in which the user navigated to uri.

If the user chooses to display the resource, it goes into this frame. This string must be freed with mem_free().

◆ uri

struct uri* type_query::uri

The URI of the resource about which ELinks is asking.

This reference must be released with done_uri().


The documentation for this struct was generated from the following files: