1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-10-13 05:43:37 -04:00

Add a new entry Link Info under Link main menu.

It also adds a Link info entry in the link contextual menu.
No key is associated for now, action was named ACT_MAIN_LINK_INFO.
This commit is contained in:
Laurent MONIN 2007-10-10 10:47:24 +02:00
parent 962890e3c0
commit 6564aec93f
5 changed files with 30 additions and 0 deletions

View File

@ -46,6 +46,7 @@ ACTION_(MAIN, "link-download-resume", LINK_DOWNLOAD_RESUME, N__("Attempt to resu
ACTION_(MAIN, "link-external-command", LINK_EXTERNAL_COMMAND, N__("Pass URI of current link to external command"), ACTION_RESTRICT_ANONYMOUS | ACTION_REQUIRE_VIEW_STATE | ACTION_REQUIRE_LOCATION | ACTION_JUMP_TO_LINK | ACTION_REQUIRE_LINK),
ACTION_(MAIN, "link-follow", LINK_FOLLOW, N__("Follow the current link"), ACTION_REQUIRE_VIEW_STATE | ACTION_REQUIRE_LOCATION | ACTION_JUMP_TO_LINK | ACTION_REQUIRE_LINK),
ACTION_(MAIN, "link-follow-reload", LINK_FOLLOW_RELOAD, N__("Follow the current link, forcing reload of the target"), ACTION_REQUIRE_VIEW_STATE | ACTION_REQUIRE_LOCATION | ACTION_JUMP_TO_LINK | ACTION_REQUIRE_LINK),
ACTION_(MAIN, "link-info", LINK_INFO, N__("Show information about current link"), ACTION_REQUIRE_VIEW_STATE | ACTION_REQUIRE_LOCATION | ACTION_JUMP_TO_LINK | ACTION_REQUIRE_LINK),
ACTION_(MAIN, "link-menu", LINK_MENU, N__("Open the link context menu"), ACTION_REQUIRE_VIEW_STATE | ACTION_JUMP_TO_LINK | ACTION_REQUIRE_LINK),
ACTION_(MAIN, "link-form-menu", LINK_FORM_MENU, N__("Open the form fields menu"), ACTION_REQUIRE_VIEW_STATE | ACTION_JUMP_TO_LINK | ACTION_REQUIRE_LINK | ACTION_REQUIRE_FORM),
ACTION_(MAIN, "lua-console", LUA_CONSOLE, N__("Open a Lua console"), ACTION_RESTRICT_ANONYMOUS),

View File

@ -113,6 +113,28 @@ add_link_info_to_string(struct string *msg, struct session *ses)
}
}
/* Link info message box. */
void
link_info_dialog(struct session *ses)
{
struct terminal *term = ses->tab->term;
struct location *location = cur_loc(ses);
struct string msg;
if (!location) {
nowhere_box(term, NULL);
return;
}
if (!init_string(&msg)) return;
add_link_info_to_string(&msg, ses);
info_box(term, MSGBOX_FREE_TEXT | MSGBOX_SCROLLABLE,
N_("Info"), ALIGN_LEFT, msg.source);
}
/* Location info. message box. */
void
document_info_dialog(struct session *ses)

View File

@ -4,6 +4,7 @@
#include "session/session.h"
void nowhere_box(struct terminal *term, unsigned char *title);
void link_info_dialog(struct session *ses);
void document_info_dialog(struct session *);
void cached_header_dialog(struct session *ses, struct cache_entry *cached);
void protocol_header_dialog(struct session *);

View File

@ -305,6 +305,10 @@ do_action(struct session *ses, enum main_action action_id, int verbose)
status = enter(ses, doc_view, 1);
break;
case ACT_MAIN_LINK_INFO:
link_info_dialog(ses);
break;
case ACT_MAIN_LINK_MENU:
link_menu(term, NULL, ses);
break;

View File

@ -1284,6 +1284,8 @@ link_menu(struct terminal *term, void *xxx, void *ses_)
add_menu_action(&mi, N_("Follow link and r~eload"), ACT_MAIN_LINK_FOLLOW_RELOAD);
add_menu_action(&mi, N_("~Link info"), ACT_MAIN_LINK_INFO);
add_menu_separator(&mi);
add_new_win_to_menu(&mi, N_("Open in new ~window"), term);