mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-23 04:26:50 +03:00
[project @ 2004-02-17 23:38:44 by jmb]
Improve save_complete. Add missing #ifdef to about.c. svn path=/import/netsurf/; revision=559
This commit is contained in:
parent
915209b0e0
commit
36bb869ae4
@ -2,7 +2,7 @@
|
|||||||
* This file is part of NetSurf, http://netsurf.sourceforge.net/
|
* This file is part of NetSurf, http://netsurf.sourceforge.net/
|
||||||
* Licensed under the GNU General Public License,
|
* Licensed under the GNU General Public License,
|
||||||
* http://www.opensource.org/licenses/gpl-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
|
/** \file
|
||||||
@ -335,7 +335,9 @@ void cookie_create(void) {
|
|||||||
void about_quit(void) {
|
void about_quit(void) {
|
||||||
|
|
||||||
xosfile_delete("<Wimp$ScrapDir>.WWW.NetSurf.About", 0, 0, 0, 0, 0);
|
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);
|
xosfile_delete("<Wimp$ScrapDir>.WWW.NetSurf.Cookies", 0, 0, 0, 0, 0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -22,10 +22,14 @@
|
|||||||
#include "netsurf/utils/log.h"
|
#include "netsurf/utils/log.h"
|
||||||
#include "netsurf/utils/utils.h"
|
#include "netsurf/utils/utils.h"
|
||||||
|
|
||||||
/** \todo Save out CSS. */
|
|
||||||
|
|
||||||
#ifdef WITH_SAVE_COMPLETE
|
#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);
|
char* get_filename(char * url);
|
||||||
|
|
||||||
/* this is temporary. */
|
/* this is temporary. */
|
||||||
@ -35,8 +39,7 @@ const char * const OBJ_DIR = "_files";
|
|||||||
/** \todo this will probably want to take a filename */
|
/** \todo this will probably want to take a filename */
|
||||||
void save_complete(struct content *c) {
|
void save_complete(struct content *c) {
|
||||||
|
|
||||||
struct box *box;
|
char *fname = 0, *spath;
|
||||||
char *fname = 0, *spath, *ofname;
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
if (c->type != CONTENT_HTML) {
|
if (c->type != CONTENT_HTML) {
|
||||||
@ -56,21 +59,15 @@ void save_complete(struct content *c) {
|
|||||||
xosfile_create_dir(spath, 77);
|
xosfile_create_dir(spath, 77);
|
||||||
|
|
||||||
/* save stylesheets, ignoring the base sheet and <style> elements */
|
/* 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++) {
|
for (i=2; i!=c->data.html.stylesheet_count; i++) {
|
||||||
if (c->data.html.stylesheet_content[i] == 0) {
|
if (c->data.html.stylesheet_content[i] == 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG(("'%s'", c->data.html.stylesheet_content[i]->url));
|
save_imported_sheets(c->data.html.stylesheet_content[i], (int)i, 0, spath, fname);
|
||||||
/* TODO - the rest of this ;) */
|
|
||||||
|
|
||||||
// ofname = get_filename(c->data.html.stylesheet_content[i]->url);
|
sprintf(spath, "%s%s%s.%d/css", SAVE_PATH, fname, OBJ_DIR, i);
|
||||||
// sprintf(spath, "%s%s%s.%s", SAVE_PATH, fname, OBJ_DIR, ofname);
|
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);
|
||||||
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);
|
|
||||||
|
|
||||||
// xfree(ofname);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* save objects */
|
/* save objects */
|
||||||
@ -81,40 +78,36 @@ void save_complete(struct content *c) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ofname = get_filename(c->data.html.object[i].url);
|
sprintf(spath, "%s%s%s.%d", SAVE_PATH, fname, OBJ_DIR, i);
|
||||||
sprintf(spath, "%s%s%s.%s", SAVE_PATH, fname, OBJ_DIR, ofname);
|
|
||||||
|
|
||||||
switch(c->data.html.object[i].content->type) {
|
switch(c->data.html.object[i].content->type) {
|
||||||
case CONTENT_HTML:
|
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);
|
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;
|
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:
|
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);
|
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;
|
break;
|
||||||
case CONTENT_PNG:
|
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);
|
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;
|
break;
|
||||||
case CONTENT_GIF:
|
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);
|
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;
|
break;
|
||||||
case CONTENT_SPRITE:
|
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);
|
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;
|
break;
|
||||||
case CONTENT_DRAW:
|
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);
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
xfree(ofname);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \todo URL rewriting */
|
/** \todo URL rewriting */
|
||||||
@ -129,6 +122,19 @@ void save_complete(struct content *c) {
|
|||||||
xfree(fname);
|
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* get_filename(char * url) {
|
||||||
|
|
||||||
char *ret = 0, *offs;
|
char *ret = 0, *offs;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* This file is part of NetSurf, http://netsurf.sourceforge.net/
|
* This file is part of NetSurf, http://netsurf.sourceforge.net/
|
||||||
* Licensed under the GNU General Public License,
|
* Licensed under the GNU General Public License,
|
||||||
* http://www.opensource.org/licenses/gpl-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_
|
#ifndef _NETSURF_UTILS_CONFIG_H_
|
||||||
|
@ -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
|
* base may be 0 for a new URL, in which case the URL is canonicalized and
|
||||||
* returned. Returns 0 in case of error.
|
* returned. Returns 0 in case of error.
|
||||||
|
Loading…
Reference in New Issue
Block a user