From 8ea00bafc4bec6ca0344a201f83c1faed17474fe Mon Sep 17 00:00:00 2001 From: Ole Loots Date: Mon, 4 Jun 2012 21:53:06 +0000 Subject: Added "Save link as..." context menu item. svn path=/trunk/netsurf/; revision=13958 --- atari/ctxmenu.c | 30 +++++++++++++++++++++--------- 1 file 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: -- cgit v1.2.3