diff options
-rw-r--r-- | riscos/about.c | 4 | ||||
-rw-r--r-- | riscos/save_complete.c | 54 | ||||
-rw-r--r-- | utils/config.h | 2 | ||||
-rw-r--r-- | utils/utils.c | 2 |
4 files changed, 35 insertions, 27 deletions
diff --git a/riscos/about.c b/riscos/about.c index db28a1c32..cfec2733a 100644 --- a/riscos/about.c +++ b/riscos/about.c @@ -2,7 +2,7 @@ * This file is part of NetSurf, http://netsurf.sourceforge.net/ * Licensed under the GNU General Public License, * http://www.opensource.org/licenses/gpl-license - * Copyright 2003 John M Bell <jmb202@ecs.soton.ac.uk> + * Copyright 2003,4 John M Bell <jmb202@ecs.soton.ac.uk> */ /** \file @@ -335,7 +335,9 @@ void cookie_create(void) { void about_quit(void) { xosfile_delete("<Wimp$ScrapDir>.WWW.NetSurf.About", 0, 0, 0, 0, 0); +#ifdef WITH_COOKIES xosfile_delete("<Wimp$ScrapDir>.WWW.NetSurf.Cookies", 0, 0, 0, 0, 0); +#endif } #endif diff --git a/riscos/save_complete.c b/riscos/save_complete.c index 3b6e3a988..a97465679 100644 --- a/riscos/save_complete.c +++ b/riscos/save_complete.c @@ -22,10 +22,14 @@ #include "netsurf/utils/log.h" #include "netsurf/utils/utils.h" -/** \todo Save out CSS. */ - #ifdef WITH_SAVE_COMPLETE +/** \todo URL rewriting + * Objects used by embedded html pages + * GUI + */ + +void save_imported_sheets(struct content *c, int parent, int level, char *p, char* fn); char* get_filename(char * url); /* this is temporary. */ @@ -35,8 +39,7 @@ const char * const OBJ_DIR = "_files"; /** \todo this will probably want to take a filename */ void save_complete(struct content *c) { - struct box *box; - char *fname = 0, *spath, *ofname; + char *fname = 0, *spath; unsigned int i; if (c->type != CONTENT_HTML) { @@ -56,21 +59,15 @@ void save_complete(struct content *c) { xosfile_create_dir(spath, 77); /* save stylesheets, ignoring the base sheet and <style> elements */ - LOG(("%d", c->data.html.stylesheet_count)); for (i=2; i!=c->data.html.stylesheet_count; i++) { if (c->data.html.stylesheet_content[i] == 0) { continue; } - LOG(("'%s'", c->data.html.stylesheet_content[i]->url)); - /* TODO - the rest of this ;) */ - -// ofname = get_filename(c->data.html.stylesheet_content[i]->url); -// sprintf(spath, "%s%s%s.%s", SAVE_PATH, fname, OBJ_DIR, ofname); - LOG(("'%s'", spath)); -// xosfile_save_stamped(spath, 0xf79, c->data.html.stylesheet_content[i]->data.css.data, c->data.html.stylesheet_content[i]->data.css.data + c->data.html.stylesheet_content[i]->data.css.length); + save_imported_sheets(c->data.html.stylesheet_content[i], (int)i, 0, spath, fname); -// xfree(ofname); + sprintf(spath, "%s%s%s.%d/css", SAVE_PATH, fname, OBJ_DIR, i); + xosfile_save_stamped(spath, 0xf79, c->data.html.stylesheet_content[i]->data.css.data, c->data.html.stylesheet_content[i]->data.css.data + c->data.html.stylesheet_content[i]->data.css.length); } /* save objects */ @@ -81,40 +78,36 @@ void save_complete(struct content *c) { continue; } - ofname = get_filename(c->data.html.object[i].url); - sprintf(spath, "%s%s%s.%s", SAVE_PATH, fname, OBJ_DIR, ofname); + sprintf(spath, "%s%s%s.%d", SAVE_PATH, fname, OBJ_DIR, i); switch(c->data.html.object[i].content->type) { case CONTENT_HTML: + strcat(spath, "/htm"); xosfile_save_stamped(spath, 0xfaf, c->data.html.object[i].content->data.html.source, c->data.html.object[i].content->data.html.source + c->data.html.object[i].content->data.html.length); break; -/* - case CONTENT_TEXTPLAIN: - break; - case CONTENT_CSS: - xosfile_save_stamped(spath, 0xf79, c->data.html.object[i].content->data.css.data, c->data.html.object[i].content->data.css.data + c->data.html.object[i].content->data.css.length); - break; -*/ case CONTENT_JPEG: + strcat(spath, "/jpg"); xosfile_save_stamped(spath, 0xc85, c->data.html.object[i].content->data.jpeg.data, (char*)c->data.html.object[i].content->data.jpeg.data + c->data.html.object[i].content->data.jpeg.length); break; case CONTENT_PNG: + strcat(spath, "/png"); xosfile_save_stamped(spath, 0xb60, c->data.html.object[i].content->data.png.data, c->data.html.object[i].content->data.png.data + c->data.html.object[i].content->data.png.length); break; case CONTENT_GIF: + strcat(spath, "/gif"); xosfile_save_stamped(spath, 0x695, c->data.html.object[i].content->data.gif.data, c->data.html.object[i].content->data.gif.data + c->data.html.object[i].content->data.gif.length); break; case CONTENT_SPRITE: + strcat(spath, "/spr"); xosfile_save_stamped(spath, 0xff9, c->data.html.object[i].content->data.sprite.data, (char*)c->data.html.object[i].content->data.sprite.data + c->data.html.object[i].content->data.sprite.length); break; case CONTENT_DRAW: + strcat(spath, "/drw"); xosfile_save_stamped(spath, 0xaff, c->data.html.object[i].content->data.draw.data, (char*)c->data.html.object[i].content->data.draw.data + c->data.html.object[i].content->data.draw.length); break; default: break; } - - xfree(ofname); } /** \todo URL rewriting */ @@ -129,6 +122,19 @@ void save_complete(struct content *c) { xfree(fname); } +void save_imported_sheets(struct content *c, int parent, int level, char *p, char *fn) { + unsigned int j; + + for (j=0; j!=c->data.css.import_count; j++) { + if (c->data.css.import_content[j] == 0) { + continue; + } + save_imported_sheets(c->data.css.import_content[j], parent, level+1, p, fn); + sprintf(p, "%s%s%s.%d%c%d/css", SAVE_PATH, fn, OBJ_DIR, parent, 'a'+level, j); + xosfile_save_stamped(p, 0xf79, c->data.css.import_content[j]->data.css.data, c->data.css.import_content[j]->data.css.data + c->data.css.import_content[j]->data.css.length); + } +} + char* get_filename(char * url) { char *ret = 0, *offs; diff --git a/utils/config.h b/utils/config.h index 87dc095dc..3520df52b 100644 --- a/utils/config.h +++ b/utils/config.h @@ -2,7 +2,7 @@ * This file is part of NetSurf, http://netsurf.sourceforge.net/ * Licensed under the GNU General Public License, * http://www.opensource.org/licenses/gpl-license - * Copyright 2003 John M Bell <jmb202@ecs.soton.ac.uk> + * Copyright 2003,4 John M Bell <jmb202@ecs.soton.ac.uk> */ #ifndef _NETSURF_UTILS_CONFIG_H_ diff --git a/utils/utils.c b/utils/utils.c index c887edc36..04cfa81fc 100644 --- a/utils/utils.c +++ b/utils/utils.c @@ -189,7 +189,7 @@ char *squash_tolat1(xmlChar *s) /** - * Calculate a URL from a relative and base URL. + * Calculate an URL from a relative and base URL. * * base may be 0 for a new URL, in which case the URL is canonicalized and * returned. Returns 0 in case of error. |