Fix 1516353 and implement 1352354

svn path=/trunk/netsurf/; revision=2711
This commit is contained in:
Richard Wilson 2006-07-04 19:56:37 +00:00
parent ac0d20fdea
commit 667c3b6730
4 changed files with 32 additions and 4 deletions

View File

@ -52,6 +52,9 @@
/** browser window which is being redrawn. Valid only during redraw. */
struct browser_window *current_redraw_browser;
/** fake content for <a> being saved as a link */
struct content browser_window_href_content;
static void browser_window_callback(content_msg msg, struct content *c,
intptr_t p1, intptr_t p2, union content_msg_data data);
@ -200,7 +203,8 @@ void browser_window_go_post(struct browser_window *bw, const char *url,
free(url2);
return;
}
gui_window_set_url(bw->window, url2);
if (!download)
gui_window_set_url(bw->window, url2);
/* find any fragment identifier on end of URL */
hash = strchr(url2, '#');
@ -1093,9 +1097,12 @@ void browser_window_mouse_action_html(struct browser_window *bw,
} else if (mouse & BROWSER_MOUSE_CLICK_2 &&
mouse & BROWSER_MOUSE_MOD_1) {
/* \todo saving of links as URL files */
//ro_gui_save_prepare(GUI_SAVE_LINK_URL, c);
free(browser_window_href_content.url);
browser_window_href_content.url = strdup(url);
if (!browser_window_href_content.url)
warn_user("NoMemory", 0);
else
gui_window_save_as_link(bw->window, &browser_window_href_content);
} else if (mouse & BROWSER_MOUSE_CLICK_2) {
/* open link in new window */
browser_window_create(url, bw, c->url, true);

View File

@ -80,6 +80,7 @@ void gui_window_new_content(struct gui_window *g);
bool gui_window_scroll_start(struct gui_window *g);
bool gui_window_box_scroll_start(struct gui_window *g,
int x0, int y0, int x1, int y1);
void gui_window_save_as_link(struct gui_window *g, struct content *c);
struct gui_download_window *gui_download_window_create(const char *url,
const char *mime_type, struct fetch *fetch,

View File

@ -251,6 +251,9 @@ void gui_create_form_select_menu(struct browser_window *bw,
{
}
void gui_window_save_as_link(struct gui_window *g, struct content *c)
{
}
void gui_launch_url(const char *url)
{

View File

@ -46,6 +46,7 @@
#include "netsurf/riscos/gui.h"
#include "netsurf/riscos/menus.h"
#include "netsurf/riscos/options.h"
#include "netsurf/riscos/save.h"
#include "netsurf/riscos/theme.h"
#include "netsurf/riscos/thumbnail.h"
#include "netsurf/riscos/ucstables.h"
@ -382,6 +383,22 @@ void gui_window_set_title(struct gui_window *g, const char *title)
}
/**
* Save the specified content as a link.
*
* \param g gui_window containing the content
* \param c the content to save
*/
void gui_window_save_as_link(struct gui_window *g, struct content *c)
{
if (!c)
return;
ro_gui_save_prepare(GUI_SAVE_LINK_URL, c);
ro_gui_dialog_open_persistent(g->window, dialog_saveas, true);
}
/**
* Force a redraw of part of the contents of a browser window.
*