diff options
author | Richard Wilson <rjw@netsurf-browser.org> | 2006-07-04 19:56:37 +0000 |
---|---|---|
committer | Richard Wilson <rjw@netsurf-browser.org> | 2006-07-04 19:56:37 +0000 |
commit | 667c3b67304906e281faa7dbde36d454bddce576 (patch) | |
tree | 576427deb822d0276dfcdf1a83ed4476264b9a70 | |
parent | ac0d20fdea64742ae13885e862e611095104aa11 (diff) | |
download | netsurf-667c3b67304906e281faa7dbde36d454bddce576.tar.gz netsurf-667c3b67304906e281faa7dbde36d454bddce576.tar.bz2 |
Fix 1516353 and implement 1352354
svn path=/trunk/netsurf/; revision=2711
-rw-r--r-- | desktop/browser.c | 15 | ||||
-rw-r--r-- | desktop/gui.h | 1 | ||||
-rw-r--r-- | gtk/gtk_gui.c | 3 | ||||
-rw-r--r-- | riscos/window.c | 17 |
4 files changed, 32 insertions, 4 deletions
diff --git a/desktop/browser.c b/desktop/browser.c index f0cb0559e..2f4860aec 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -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); diff --git a/desktop/gui.h b/desktop/gui.h index bdc103c7c..1e27d851f 100644 --- a/desktop/gui.h +++ b/desktop/gui.h @@ -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, diff --git a/gtk/gtk_gui.c b/gtk/gtk_gui.c index b0ab1ddd6..f12df435c 100644 --- a/gtk/gtk_gui.c +++ b/gtk/gtk_gui.c @@ -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) { diff --git a/riscos/window.c b/riscos/window.c index f92159115..34ba908a5 100644 --- a/riscos/window.c +++ b/riscos/window.c @@ -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" @@ -383,6 +384,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. * * \param g gui_window to redraw |