summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOle Loots <ole@monochrom.net>2012-06-04 21:53:06 +0000
committerOle Loots <ole@monochrom.net>2012-06-04 21:53:06 +0000
commit8ea00bafc4bec6ca0344a201f83c1faed17474fe (patch)
tree5eebc25b5fea895b80bd884d55072e72448f06fb
parentcc9457bdd78597c9449483e880ecde5f98316320 (diff)
downloadnetsurf-8ea00bafc4bec6ca0344a201f83c1faed17474fe.tar.gz
netsurf-8ea00bafc4bec6ca0344a201f83c1faed17474fe.tar.bz2
Added "Save link as..." context menu item.
svn path=/trunk/netsurf/; revision=13958
-rw-r--r--atari/ctxmenu.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/atari/ctxmenu.c b/atari/ctxmenu.c
index 3e481e048..8f7e9b9ff 100644
--- a/atari/ctxmenu.c
+++ b/atari/ctxmenu.c
@@ -140,7 +140,7 @@ void context_popup( struct gui_window * gw, short x, short y )
{
#define POP_FIRST_ITEM POP_CTX_CUT_SEL
-#define POP_LAST_ITEM POP_CTX_VIEW_SOURCE
+#define POP_LAST_ITEM POP_CTX_SAVE_LINK_AS
OBJECT * pop;
int choice;
@@ -175,10 +175,10 @@ void context_popup( struct gui_window * gw, short x, short y )
}
if( ctx->flags & CNT_HREF ){
- SET_BIT(pop[ POP_CTX_SAVE_AS ].ob_state, DISABLED, 0);
- SET_BIT(pop[ POP_CTX_COPY_LINK ].ob_state, DISABLED, 0);
- SET_BIT(pop[ POP_CTX_OPEN_NEW ].ob_state, DISABLED, 0);
- }
+ SET_BIT(pop[ POP_CTX_COPY_LINK ].ob_state, DISABLED, 0);
+ SET_BIT(pop[ POP_CTX_OPEN_NEW ].ob_state, DISABLED, 0);
+ SET_BIT(pop[ POP_CTX_SAVE_LINK_AS ].ob_state, DISABLED, 0);
+ }
if( ctx->flags & CNT_IMG ){
SET_BIT(pop[ POP_CTX_SAVE_AS ].ob_state, DISABLED, 0);
@@ -209,14 +209,26 @@ void context_popup( struct gui_window * gw, short x, short y )
browser_window_key_press( gw->browser->bw, KEY_SELECT_ALL );
break;
- case POP_CTX_SAVE_AS:
- if( hlcache_handle_get_url(ctx->ccdata.object) != NULL ){
+ case POP_CTX_SAVE_AS:
+ if( ctx->ccdata.object != NULL ) {
+ if( hlcache_handle_get_url(ctx->ccdata.object) != NULL ) {
+ browser_window_download(
+ gw->browser->bw,
+ nsurl_access(hlcache_handle_get_url(ctx->ccdata.object)),
+ nsurl_access(hlcache_handle_get_url(gw->browser->bw->current_content))
+ );
+ }
+ }
+
+ case POP_CTX_SAVE_LINK_AS:
+ if( ctx->ccdata.link_url != NULL ) {
browser_window_download(
gw->browser->bw,
- nsurl_access(hlcache_handle_get_url(ctx->ccdata.object)),
+ nsurl_access(ctx->ccdata.link_url),
nsurl_access(hlcache_handle_get_url(gw->browser->bw->current_content))
- );
+ );
}
+
break;
case POP_CTX_COPY_URL: