mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-01-11 05:19:18 +03:00
Start to consolidate user file operation into one file
svn path=/trunk/netsurf/; revision=13062
This commit is contained in:
parent
62248c06d3
commit
ad8a965548
@ -68,7 +68,7 @@ endif
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# S_AMIGA are sources purely for the Amiga build
|
||||
S_AMIGA := gui.c tree.c history.c hotlist.c schedule.c \
|
||||
S_AMIGA := gui.c tree.c history.c hotlist.c schedule.c file.c \
|
||||
thumbnail.c misc.c bitmap.c font.c filetype.c utf8.c login.c \
|
||||
plotters.c object.c menu.c save_pdf.c arexx.c version.c \
|
||||
cookies.c context_menu.c clipboard.c save_complete.c \
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "amiga/context_menu.h"
|
||||
#include "amiga/clipboard.h"
|
||||
#include "amiga/bitmap.h"
|
||||
#include "amiga/file.h"
|
||||
#include "amiga/filetype.h"
|
||||
#include "amiga/gui.h"
|
||||
#include "amiga/history_local.h"
|
||||
@ -190,11 +191,13 @@ void ami_context_menu_add_submenu(Object *ctxmenuobj, ULONG cmsub, void *userdat
|
||||
PMIA_Title, (ULONG)ctxmenulab[CMID_PAGEOPEN],
|
||||
PMIA_ID, CMID_PAGEOPEN,
|
||||
PMIA_UserData, userdata,
|
||||
PMIA_CommKey, "O",
|
||||
TAG_DONE),
|
||||
PMA_AddItem, NewObject(POPUPMENU_GetItemClass(), NULL,
|
||||
PMIA_Title, (ULONG)ctxmenulab[CMID_PAGESAVE],
|
||||
PMIA_ID, CMID_PAGESAVE,
|
||||
PMIA_UserData, userdata,
|
||||
PMIA_CommKey, "S",
|
||||
TAG_DONE),
|
||||
PMA_AddItem, NewObject(POPUPMENU_GetItemClass(), NULL,
|
||||
PMIA_Title, (ULONG)ctxmenulab[CMID_PAGESAVECOMPLETE],
|
||||
@ -208,6 +211,7 @@ void ami_context_menu_add_submenu(Object *ctxmenuobj, ULONG cmsub, void *userdat
|
||||
PMIA_Title, (ULONG)ctxmenulab[CMID_PAGECLOSE],
|
||||
PMIA_ID, CMID_PAGECLOSE,
|
||||
PMIA_UserData, userdata,
|
||||
PMIA_CommKey, "K",
|
||||
TAG_DONE),
|
||||
PMA_AddItem,NewObject(POPUPMENU_GetItemClass(), NULL,
|
||||
PMIA_Title, ~0,
|
||||
@ -216,6 +220,7 @@ void ami_context_menu_add_submenu(Object *ctxmenuobj, ULONG cmsub, void *userdat
|
||||
PMIA_Title, (ULONG)ctxmenulab[CMID_PAGEHOTLIST],
|
||||
PMIA_ID, CMID_PAGEHOTLIST,
|
||||
PMIA_UserData, nsurl_access(content_get_url(userdata)),
|
||||
PMIA_CommKey, "B",
|
||||
TAG_DONE),
|
||||
TAG_DONE),
|
||||
TAG_DONE),
|
||||
@ -707,6 +712,10 @@ static uint32 ami_context_menu_hook(struct Hook *hook,Object *item,APTR reserved
|
||||
}
|
||||
break;
|
||||
|
||||
case CMID_PAGEOPEN:
|
||||
ami_file_open(gwin);
|
||||
break;
|
||||
|
||||
case CMID_FRAMECOPYURL:
|
||||
case CMID_COPYURL:
|
||||
case CMID_COPYOBJ:
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include "amiga/iff_dr2d.h"
|
||||
#include "amiga/theme.h"
|
||||
#include "amiga/utf8.h"
|
||||
#include "amiga/file.h"
|
||||
|
||||
#include "desktop/download.h"
|
||||
#include "desktop/selection.h"
|
||||
|
15
amiga/gui.c
15
amiga/gui.c
@ -46,6 +46,7 @@
|
||||
#include "amiga/datatypes.h"
|
||||
#include "amiga/download.h"
|
||||
#include "amiga/drag.h"
|
||||
#include "amiga/file.h"
|
||||
#include "amiga/filetype.h"
|
||||
#include "amiga/font.h"
|
||||
#include "amiga/gui.h"
|
||||
@ -305,12 +306,7 @@ void ami_open_resources(void)
|
||||
ASO_NoTrack,FALSE,
|
||||
TAG_DONE))) die(messages_get("NoMemory"));
|
||||
|
||||
filereq = (struct FileRequester *)AllocAslRequest(ASL_FileRequest,NULL);
|
||||
savereq = (struct FileRequester *)AllocAslRequestTags(ASL_FileRequest,
|
||||
ASLFR_DoSaveMode,TRUE,
|
||||
ASLFR_RejectIcons,TRUE,
|
||||
ASLFR_InitialDrawer,option_download_dir,
|
||||
TAG_DONE);
|
||||
ami_file_req_init();
|
||||
}
|
||||
|
||||
void ami_set_options(void)
|
||||
@ -1425,6 +1421,10 @@ void ami_handle_msg(void)
|
||||
browser_window_destroy(gwin->bw);
|
||||
break;
|
||||
|
||||
case 'o':
|
||||
ami_file_open(gwin);
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
ami_print_ui(gwin->bw->current_content);
|
||||
break;
|
||||
@ -2174,8 +2174,7 @@ void gui_quit(void)
|
||||
FreeSysObject(ASOT_PORT,appport);
|
||||
FreeSysObject(ASOT_PORT,sport);
|
||||
|
||||
FreeAslRequest(filereq);
|
||||
FreeAslRequest(savereq);
|
||||
ami_file_req_free();
|
||||
|
||||
ami_openurl_close();
|
||||
FreeStringClass(urlStringClass);
|
||||
|
@ -148,8 +148,6 @@ struct TextFont *origrpfont;
|
||||
struct MinList *window_list;
|
||||
struct Screen *scrn;
|
||||
STRPTR nsscreentitle;
|
||||
struct FileRequester *filereq;
|
||||
struct FileRequester *savereq;
|
||||
struct MsgPort *sport;
|
||||
bool win_destroyed;
|
||||
struct browser_window *curbw;
|
||||
|
63
amiga/menu.c
63
amiga/menu.c
@ -43,6 +43,7 @@
|
||||
#include "amiga/clipboard.h"
|
||||
#include "amiga/cookies.h"
|
||||
#include "amiga/download.h"
|
||||
#include "amiga/file.h"
|
||||
#include "amiga/filetype.h"
|
||||
#include "amiga/gui.h"
|
||||
#include "amiga/gui_options.h"
|
||||
@ -86,7 +87,6 @@ BOOL menualreadyinit;
|
||||
const char * const netsurf_version;
|
||||
const char * const versvn;
|
||||
const char * const verdate;
|
||||
static struct Hook aslhookfunc;
|
||||
|
||||
ULONG ami_menu_scan(struct tree *tree, bool count, struct gui_window_2 *gwin);
|
||||
void ami_menu_scan_2(struct tree *tree, struct node *root, WORD *gen,
|
||||
@ -309,15 +309,6 @@ struct NewMenu *ami_create_menu(struct gui_window_2 *gwin)
|
||||
ami_menu_scan(ami_tree_get_tree(hotlist_window), false, gwin);
|
||||
ami_menu_arexx_scan(gwin);
|
||||
|
||||
if(!menualreadyinit)
|
||||
{
|
||||
aslhookfunc.h_Entry = (void *)&ami_asl_mime_hook;
|
||||
aslhookfunc.h_SubEntry = NULL;
|
||||
aslhookfunc.h_Data = NULL;
|
||||
|
||||
menualreadyinit = TRUE;
|
||||
}
|
||||
|
||||
/* Set up scheduler to refresh the hotlist menu
|
||||
Disabled as it causes everything to slow down to a halt after
|
||||
several iterations
|
||||
@ -489,27 +480,7 @@ void ami_menupick(ULONG code,struct gui_window_2 *gwin,struct MenuItem *item)
|
||||
break;
|
||||
|
||||
case 3: // open local file
|
||||
if(AslRequestTags(filereq,
|
||||
ASLFR_TitleText,messages_get("NetSurf"),
|
||||
ASLFR_Screen,scrn,
|
||||
ASLFR_DoSaveMode,FALSE,
|
||||
ASLFR_RejectIcons,TRUE,
|
||||
ASLFR_FilterFunc,&aslhookfunc,
|
||||
// ASLFR_DoPatterns,TRUE,
|
||||
// ASLFR_InitialPattern,"~(#?.info)",
|
||||
TAG_DONE))
|
||||
{
|
||||
if(temp = AllocVec(1024,MEMF_PRIVATE | MEMF_CLEAR))
|
||||
{
|
||||
char *temp2;
|
||||
strlcpy(temp,filereq->fr_Drawer,1024);
|
||||
AddPart(temp,filereq->fr_File,1024);
|
||||
temp2 = path_to_url(temp);
|
||||
browser_window_go(gwin->bw,temp2,NULL, true);
|
||||
free(temp2);
|
||||
FreeVec(temp);
|
||||
}
|
||||
}
|
||||
ami_file_open(gwin);
|
||||
break;
|
||||
|
||||
case 4: // save
|
||||
@ -874,36 +845,6 @@ void ami_menupick(ULONG code,struct gui_window_2 *gwin,struct MenuItem *item)
|
||||
}
|
||||
}
|
||||
|
||||
static const ULONG ami_asl_mime_hook(struct Hook *mh,struct FileRequester *fr,struct AnchorPathOld *ap)
|
||||
{
|
||||
BPTR file = 0;
|
||||
char buffer[10];
|
||||
char fname[1024];
|
||||
BOOL ret = FALSE;
|
||||
char *mt = NULL;
|
||||
lwc_string *lwc_mt = NULL;
|
||||
lwc_error lerror;
|
||||
content_type ct;
|
||||
|
||||
if(ap->ap_Info.fib_DirEntryType > 0) return(TRUE);
|
||||
|
||||
strcpy(fname,fr->fr_Drawer);
|
||||
AddPart(fname,ap->ap_Info.fib_FileName,1024);
|
||||
|
||||
mt = fetch_mimetype(fname);
|
||||
lerror = lwc_intern_string(mt, strlen(mt), &lwc_mt);
|
||||
if (lerror != lwc_error_ok)
|
||||
return FALSE;
|
||||
|
||||
ct = content_factory_type_from_mime_type(lwc_mt);
|
||||
lwc_string_unref(lwc_mt);
|
||||
|
||||
if(ct != CONTENT_NONE) ret = TRUE;
|
||||
|
||||
free(mt);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ami_menu_update_disabled(struct gui_window *g, hlcache_handle *c)
|
||||
{
|
||||
struct Window *win = g->shared->win;
|
||||
|
46
amiga/tree.c
46
amiga/tree.c
@ -23,41 +23,45 @@
|
||||
#include <proto/space.h>
|
||||
#include <proto/label.h>
|
||||
#include <proto/scroller.h>
|
||||
#include <proto/exec.h>
|
||||
#include <proto/intuition.h>
|
||||
#include <proto/button.h>
|
||||
#include <proto/bitmap.h>
|
||||
#include <proto/graphics.h>
|
||||
#include <proto/asl.h>
|
||||
#include <proto/utility.h>
|
||||
#include <proto/dos.h>
|
||||
|
||||
#include <libraries/gadtools.h>
|
||||
#include <gadgets/button.h>
|
||||
#include <classes/window.h>
|
||||
#include <gadgets/space.h>
|
||||
#include <images/label.h>
|
||||
#include <images/bitmap.h>
|
||||
#include <gadgets/layout.h>
|
||||
#include <gadgets/scroller.h>
|
||||
#include <reaction/reaction_macros.h>
|
||||
#include "amiga/gui.h"
|
||||
#include "content/urldb.h"
|
||||
#include <proto/exec.h>
|
||||
#include <assert.h>
|
||||
#include <proto/intuition.h>
|
||||
#include "amiga/tree.h"
|
||||
#include <proto/button.h>
|
||||
#include <gadgets/button.h>
|
||||
#include <string.h>
|
||||
#include "utils/messages.h"
|
||||
#include <proto/bitmap.h>
|
||||
#include <images/bitmap.h>
|
||||
#include <proto/graphics.h>
|
||||
#include <intuition/icclass.h>
|
||||
#include <proto/asl.h>
|
||||
#include <proto/utility.h>
|
||||
#include <libraries/gadtools.h>
|
||||
#include <proto/dos.h>
|
||||
|
||||
#include "amiga/file.h"
|
||||
#include "amiga/gui.h"
|
||||
#include "amiga/tree.h"
|
||||
#include "amiga/utf8.h"
|
||||
#include "desktop/cookies.h"
|
||||
#include "desktop/history_global_core.h"
|
||||
#include "desktop/hotlist.h"
|
||||
#include "desktop/tree_url_node.h"
|
||||
#include "amiga/sslcert.h"
|
||||
#include "amiga/drag.h" /* drag icon stuff */
|
||||
#include "amiga/theme.h" /* pointers */
|
||||
#include "amiga/filetype.h"
|
||||
#include "amiga/options.h"
|
||||
#include "content/urldb.h"
|
||||
#include "desktop/cookies.h"
|
||||
#include "desktop/history_global_core.h"
|
||||
#include "desktop/hotlist.h"
|
||||
#include "desktop/tree_url_node.h"
|
||||
#include "utils/utils.h"
|
||||
#include "utils/messages.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
#define AMI_TREE_MENU_ITEMS 21
|
||||
#define AMI_TREE_MENU_DELETE FULLMENUNUM(1,0,0)
|
||||
|
Loading…
Reference in New Issue
Block a user