summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorRichard Wilson <rjw@netsurf-browser.org>2006-07-04 19:56:37 +0000
committerRichard Wilson <rjw@netsurf-browser.org>2006-07-04 19:56:37 +0000
commit667c3b67304906e281faa7dbde36d454bddce576 (patch)
tree576427deb822d0276dfcdf1a83ed4476264b9a70 /desktop
parentac0d20fdea64742ae13885e862e611095104aa11 (diff)
downloadnetsurf-667c3b67304906e281faa7dbde36d454bddce576.tar.gz
netsurf-667c3b67304906e281faa7dbde36d454bddce576.tar.bz2
Fix 1516353 and implement 1352354
svn path=/trunk/netsurf/; revision=2711
Diffstat (limited to 'desktop')
-rw-r--r--desktop/browser.c15
-rw-r--r--desktop/gui.h1
2 files changed, 12 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,