ELinks 0.18.0
|
The user is being asked what to do when the local file for the download already exists. More...
Data Fields | |
struct terminal * | term |
The terminal in which ELinks is asking the question. | |
char * | ofile |
The name of the local file into which the data was originally going to be downloaded, but which already exists. | |
char * | file |
An alternative file name that the user may choose instead of ofile. | |
lun_callback_T * | callback |
This function will be called when the user answers. | |
void * | data |
A pointer to be passed to callback. | |
download_flags_T | flags |
Saved flags to be passed to callback. |
Related Symbols | |
(Note that these are not member symbols.) | |
typedef void | lun_callback_T(struct terminal *term, char *file, void *data, download_flags_T flags) |
Type of the callback function that will be called when the user answers the question posed by lookup_unique_name(). | |
static void | lun_alternate (void *lun_hop_) |
The use chose "Save under the alternative name" when asked where to download a file. | |
static void | lun_cancel (void *lun_hop_) |
The use chose "Cancel" when asked where to download a file. | |
static void | lun_overwrite (void *lun_hop_) |
The use chose "Overwrite the original file" when asked where to download a file. | |
static void | lun_resume (void *lun_hop_) |
The user chose "Resume download of the original file" when asked where to download a file. | |
static void | lookup_unique_name (struct terminal *term, char *ofile, download_flags_T flags, lun_callback_T *callback, void *data) |
If attempting to download to an existing file, perhaps ask the user whether to resume, overwrite, or save elsewhere. |
The user is being asked what to do when the local file for the download already exists.
This structure is allocated by lookup_unique_name() and freed by each lun_* function: lun_alternate(), lun_cancel(), lun_overwrite(), and lun_resume().
|
If attempting to download to an existing file, perhaps ask the user whether to resume, overwrite, or save elsewhere.
This function constructs a struct lun_hop, which will be freed when the user answers the question.
term | The terminal in which this function should show its UI. | |
[in] | ofile | A proposed name for the local file to which the data would be downloaded. "~" here refers to the home directory. lookup_unique_name() treats this original string as read-only. |
[in] | flags | Flags controlling how to download the file. DOWNLOAD_RESUME_ALLOWED adds a "Resume" button to the dialog. DOWNLOAD_RESUME_SELECTED means the user already chose to resume downloading (with ACT_MAIN_LINK_DOWNLOAD_RESUME), before ELinks even asked for the file name; thus don't ask whether to overwrite. Other flags, such as DOWNLOAD_EXTERNAL, have no effect at this level but they get passed to callback. |
callback | Will be called when the user answers, or right away if the question need not or cannot be asked. | |
data | A pointer to be passed to callback. |
|
The use chose "Save under the alternative name" when asked where to download a file.
lookup_unique_name() passes this function as a done_handler_T to msg_box().
Type of the callback function that will be called when the user answers the question posed by lookup_unique_name().
term | The terminal on which the callback should display any windows. Comes directly from the term argument of lookup_unique_name(). |
file | The name of the local file to which the data should be downloaded, or NULL if the download should not begin. The callback is responsible of doing mem_free(file). |
data | A pointer to any data that the callback cares about. Comes directly from the data argument of lookup_unique_name(). |
flags | The same as the flags argument of create_download_file(), except the DOWNLOAD_RESUME_SELECTED bit will be changed to match what the user chose. |
|
The use chose "Cancel" when asked where to download a file.
lookup_unique_name() passes this function as a done_handler_T to msg_box().
|
The use chose "Overwrite the original file" when asked where to download a file.
lookup_unique_name() passes this function as a done_handler_T to msg_box().
|
The user chose "Resume download of the original file" when asked where to download a file.
lookup_unique_name() passes this function as a done_handler_T to msg_box().
lun_callback_T* lun_hop::callback |
This function will be called when the user answers.
void* lun_hop::data |
A pointer to be passed to callback.
char* lun_hop::file |
An alternative file name that the user may choose instead of ofile.
The string must be freed with mem_free().
download_flags_T lun_hop::flags |
Saved flags to be passed to callback.
If the user chooses to resume, then lun_resume() sets DOWNLOAD_RESUME_SELECTED when it calls callback.
char* lun_hop::ofile |
The name of the local file into which the data was originally going to be downloaded, but which already exists.
In this string, "~" has already been expanded to the home directory. The string must be freed with mem_free().
struct terminal* lun_hop::term |
The terminal in which ELinks is asking the question.
This gets passed to callback.