Treat all objects equally, non-plugin_hack objects can now be opened in external

application if CMD line present in resources/mimetypes

svn path=/trunk/netsurf/; revision=13013
This commit is contained in:
Chris Young 2011-10-08 14:55:15 +00:00
parent d197eda87a
commit c6b174d08e
2 changed files with 16 additions and 26 deletions

View File

@ -159,7 +159,6 @@ void ami_context_menu_add_submenu(Object *ctxmenuobj, ULONG cmsub, void *userdat
* CMSUB_OBJECT - userdata = hlcache_object *
* CMSUB_SEL - userdata = browser_window *
* CMSUB_NAVIGATE - userdata = browser_window * (only for menu construction)
* CMID_PLUGINCMD - userdata = hlcache_object *
* CMID_SELECTFILE - userdata = box *
*/
@ -318,6 +317,7 @@ void ami_context_menu_add_submenu(Object *ctxmenuobj, ULONG cmsub, void *userdat
PMIA_Title, (ULONG)ctxmenulab[CMID_CLIPOBJ],
PMIA_ID, CMID_CLIPOBJ,
PMIA_UserData, userdata,
PMIA_Disabled, (content_get_type(userdata) != CONTENT_IMAGE),
TAG_DONE),
PMA_AddItem,NewObject(POPUPMENU_GetItemClass(), NULL,
PMIA_Title, ~0,
@ -331,6 +331,16 @@ void ami_context_menu_add_submenu(Object *ctxmenuobj, ULONG cmsub, void *userdat
PMIA_Title, (ULONG)ctxmenulab[CMID_SAVEIFFOBJ],
PMIA_ID, CMID_SAVEIFFOBJ,
PMIA_UserData, userdata,
PMIA_Disabled, (content_get_type(userdata) != CONTENT_IMAGE),
TAG_DONE),
PMA_AddItem,NewObject(POPUPMENU_GetItemClass(), NULL,
PMIA_Title, ~0,
TAG_DONE),
PMA_AddItem, NewObject(POPUPMENU_GetItemClass(), NULL,
PMIA_Title, (ULONG)ctxmenulab[CMID_PLUGINCMD],
PMIA_ID, CMID_PLUGINCMD,
PMIA_UserData, userdata,
PMIA_Disabled, !ami_mime_content_to_cmd(userdata),
TAG_DONE),
TAG_DONE),
TAG_DONE),
@ -383,16 +393,6 @@ void ami_context_menu_add_submenu(Object *ctxmenuobj, ULONG cmsub, void *userdat
~0);
break;
case CMID_PLUGINCMD:
IDoMethod(ctxmenuobj,PM_INSERT,
NewObject(POPUPMENU_GetItemClass(), NULL,
PMIA_Title, (ULONG)ctxmenulab[CMID_PLUGINCMD],
PMIA_ID, CMID_PLUGINCMD,
PMIA_UserData, userdata,
TAG_DONE),
~0);
break;
case CMID_SELECTFILE:
IDoMethod(ctxmenuobj,PM_INSERT,
NewObject(POPUPMENU_GetItemClass(), NULL,
@ -519,13 +519,6 @@ void ami_context_menu_show(struct gui_window_2 *gwin,int x,int y)
{
browser_window_get_contextual_content(gwin->bw, x, y, &ccdata);
if(ccdata.object && (content_get_type(ccdata.object) == CONTENT_PLUGIN))
{
ami_context_menu_add_submenu(ctxmenuobj, CMID_PLUGINCMD, ccdata.object);
menuhascontent = true;
add_nav_menu = false;
}
if(ccdata.main && (ccdata.main != cc))
{
ami_context_menu_add_submenu(ctxmenuobj, CMSUB_FRAME, ccdata.main);
@ -538,12 +531,15 @@ void ami_context_menu_show(struct gui_window_2 *gwin,int x,int y)
menuhascontent = true;
}
if(ccdata.object && (content_get_type(ccdata.object) == CONTENT_IMAGE))
if(ccdata.object)
{
ami_context_menu_add_submenu(ctxmenuobj, CMSUB_OBJECT, ccdata.object);
menuhascontent = true;
}
ami_context_menu_add_submenu(ctxmenuobj, CMSUB_NAVIGATE, gwin->bw);
menuhascontent = true;
if(content_get_type(cc) == CONTENT_TEXTPLAIN)
{
ami_context_menu_add_submenu(ctxmenuobj, CMSUB_SEL, gwin->bw);
@ -582,12 +578,6 @@ void ami_context_menu_show(struct gui_window_2 *gwin,int x,int y)
}
}
}
if(add_nav_menu == true)
{
ami_context_menu_add_submenu(ctxmenuobj, CMSUB_NAVIGATE, gwin->bw);
menuhascontent = true;
}
}
if(!menuhascontent) return;

View File

@ -95,7 +95,7 @@ audio/wave DT=WAVE TYPE=wav
audio/x-wav DT=WAVE TYPE=wav
; MP3
audio/mpeg DT="MPEG Audio" TYPE=mp3
audio/mpeg DT="MPEG Audio" TYPE=mp3 CMD=APPDIR:MPlayer
;