mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
bug 153, 1066: Document that bookmarks should be UTF-8.
Comment changes only.
This commit is contained in:
parent
9088f11c64
commit
37de386051
@ -134,6 +134,8 @@ write_bookmarks_default(struct secure_save_info *ssi,
|
||||
struct bookmark *bm;
|
||||
|
||||
foreach (bm, *bookmarks_list) {
|
||||
/** @todo Bug 153: bm->title should be UTF-8.
|
||||
* @todo Bug 1066: bm->url should be UTF-8. */
|
||||
secure_fprintf(ssi, "%s\t%s\t%d\t", bm->title, bm->url, bm->box_item->depth);
|
||||
if (bm->box_item->type == BI_FOLDER) {
|
||||
secure_fputc(ssi, 'F');
|
||||
|
@ -226,6 +226,7 @@ write_bookmarks_list(struct secure_save_info *ssi,
|
||||
|
||||
indentation(ssi, n + 2);
|
||||
secure_fputs(ssi, "<title>");
|
||||
/** @todo Bug 153: bm->title should be UTF-8 */
|
||||
print_xml_entities(ssi, bm->title);
|
||||
secure_fputs(ssi, "</title>\n");
|
||||
|
||||
@ -238,11 +239,13 @@ write_bookmarks_list(struct secure_save_info *ssi,
|
||||
} else if (bm->box_item->type == BI_LEAF) {
|
||||
|
||||
secure_fputs(ssi, "<bookmark href=\"");
|
||||
/** @todo Bug 1066: bm->url should be UTF-8 */
|
||||
print_xml_entities(ssi, bm->url);
|
||||
secure_fputs(ssi, "\">\n");
|
||||
|
||||
indentation(ssi, n + 2);
|
||||
secure_fputs(ssi, "<title>");
|
||||
/** @todo Bug 153: bm->title should be UTF-8 */
|
||||
print_xml_entities(ssi, bm->title);
|
||||
secure_fputs(ssi, "</title>\n");
|
||||
|
||||
|
@ -276,6 +276,7 @@ delete_folder_by_name(unsigned char *foldername)
|
||||
struct bookmark *bookmark, *next;
|
||||
|
||||
foreachsafe (bookmark, next, bookmarks) {
|
||||
/** @todo Bug 153: bookmark->title should be UTF-8 */
|
||||
if ((bookmark->url && *bookmark->url)
|
||||
|| strcmp(bookmark->title, foldername))
|
||||
continue;
|
||||
@ -292,6 +293,7 @@ init_bookmark(struct bookmark *root, unsigned char *title, unsigned char *url)
|
||||
bm = mem_calloc(1, sizeof(*bm));
|
||||
if (!bm) return NULL;
|
||||
|
||||
/** @todo Bug 153: bm->title should be UTF-8 */
|
||||
bm->title = stracpy(title);
|
||||
if (!bm->title) {
|
||||
mem_free(bm);
|
||||
@ -299,6 +301,7 @@ init_bookmark(struct bookmark *root, unsigned char *title, unsigned char *url)
|
||||
}
|
||||
sanitize_title(bm->title);
|
||||
|
||||
/** @todo Bug 1066: bm->url should be UTF-8 */
|
||||
bm->url = stracpy(empty_string_or_(url));
|
||||
if (!bm->url) {
|
||||
mem_free(bm->title);
|
||||
@ -411,6 +414,7 @@ update_bookmark(struct bookmark *bm, unsigned char *title,
|
||||
trigger_event(update_bookmark_event_id, bm, title2, url2);
|
||||
|
||||
if (title2) {
|
||||
/** @todo Bug 153: bm->title should be UTF-8 */
|
||||
mem_free_set(&bm->title, title2);
|
||||
}
|
||||
|
||||
@ -423,6 +427,7 @@ update_bookmark(struct bookmark *bm, unsigned char *title,
|
||||
if (item) del_hash_item(bookmark_cache, item);
|
||||
}
|
||||
|
||||
/** @todo Bug 1066: bm->url should be UTF-8 */
|
||||
if (check_bookmark_cache(url2)) {
|
||||
add_hash_item(bookmark_cache, url2, strlen(url2), bm);
|
||||
}
|
||||
@ -445,6 +450,7 @@ get_bookmark_by_name(struct bookmark *folder, unsigned char *title)
|
||||
|
||||
lh = folder ? &folder->child : &bookmarks;
|
||||
|
||||
/** @todo Bug 153: bookmark->title should be UTF-8 */
|
||||
foreach (bookmark, *lh)
|
||||
if (!strcmp(bookmark->title, title)) return bookmark;
|
||||
|
||||
@ -457,6 +463,7 @@ get_bookmark(unsigned char *url)
|
||||
{
|
||||
struct hash_item *item;
|
||||
|
||||
/** @todo Bug 1066: URLs in bookmark_cache should be UTF-8 */
|
||||
if (!check_bookmark_cache(url))
|
||||
return NULL;
|
||||
|
||||
@ -586,6 +593,7 @@ open_bookmark_folder(struct session *ses, unsigned char *foldername)
|
||||
foreach (bookmark, bookmarks) {
|
||||
if (bookmark->box_item->type != BI_FOLDER)
|
||||
continue;
|
||||
/** @todo Bug 153: bookmark->title should be UTF-8 */
|
||||
if (strcmp(bookmark->title, foldername))
|
||||
continue;
|
||||
folder = bookmark;
|
||||
@ -602,6 +610,8 @@ open_bookmark_folder(struct session *ses, unsigned char *foldername)
|
||||
|| !*bookmark->url)
|
||||
continue;
|
||||
|
||||
/** @todo Bug 1066: Tell the URI layer that
|
||||
* bookmark->url is UTF-8. */
|
||||
uri = get_translated_uri(bookmark->url, NULL);
|
||||
if (!uri) continue;
|
||||
|
||||
|
@ -17,6 +17,8 @@ struct bookmark {
|
||||
|
||||
struct listbox_item *box_item;
|
||||
|
||||
/** @todo Bugs 153, 1066: The #title and #url strings should
|
||||
* be in UTF-8, but this has not yet been fully implemented. */
|
||||
unsigned char *title; /* title of bookmark */
|
||||
unsigned char *url; /* Location of bookmarked item */
|
||||
|
||||
|
@ -57,6 +57,7 @@ get_bookmark_text(struct listbox_item *item, struct terminal *term)
|
||||
{
|
||||
struct bookmark *bookmark = item->udata;
|
||||
|
||||
/** @todo Bug 153: bookmark->title should be UTF-8 */
|
||||
return stracpy(bookmark->title);
|
||||
}
|
||||
|
||||
@ -69,6 +70,8 @@ get_bookmark_info(struct listbox_item *item, struct terminal *term)
|
||||
if (item->type == BI_FOLDER) return NULL;
|
||||
if (!init_string(&info)) return NULL;
|
||||
|
||||
/** @todo Bug 153: bookmark->title should be UTF-8.
|
||||
* @todo Bug 1066: bookmark->url should be UTF-8. */
|
||||
add_format_to_string(&info, "%s: %s", _("Title", term), bookmark->title);
|
||||
add_format_to_string(&info, "\n%s: %s", _("URL", term), bookmark->url);
|
||||
|
||||
@ -80,6 +83,7 @@ get_bookmark_uri(struct listbox_item *item)
|
||||
{
|
||||
struct bookmark *bookmark = item->udata;
|
||||
|
||||
/** @todo Bug 1066: Tell the URI layer that bookmark->url is UTF-8. */
|
||||
return bookmark->url && *bookmark->url
|
||||
? get_translated_uri(bookmark->url, NULL) : NULL;
|
||||
}
|
||||
@ -303,6 +307,8 @@ push_edit_button(struct dialog_data *dlg_data, struct widget_data *edit_btn)
|
||||
/* Follow the bookmark */
|
||||
if (box->sel) {
|
||||
struct bookmark *bm = (struct bookmark *) box->sel->udata;
|
||||
/** @todo Bug 153: bm->title should be UTF-8.
|
||||
* @todo Bug 1066: bm->url should be UTF-8. */
|
||||
const unsigned char *title = bm->title;
|
||||
const unsigned char *url = bm->url;
|
||||
|
||||
@ -555,6 +561,8 @@ test_search(struct listbox_item *item, void *data_, int *offset)
|
||||
|
||||
assert(ctx->title && ctx->url);
|
||||
|
||||
/** @todo Bug 153: bm->title should be UTF-8.
|
||||
* @todo Bug 1066: bm->url should be UTF-8. */
|
||||
ctx->found = (*ctx->title && strcasestr(bm->title, ctx->title))
|
||||
|| (*ctx->url && c_strcasestr(bm->url, ctx->url));
|
||||
|
||||
|
@ -102,11 +102,13 @@ bookmark_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
|
||||
switch (JSVAL_TO_INT(id)) {
|
||||
case BOOKMARK_TITLE:
|
||||
/** @todo Bug 153: bookmark->title should be UTF-8 */
|
||||
*vp = STRING_TO_JSVAL(JS_NewStringCopyZ(smjs_ctx,
|
||||
bookmark->title));
|
||||
|
||||
return JS_TRUE;
|
||||
case BOOKMARK_URL:
|
||||
/** @todo Bug 1066: bookmark->url should be UTF-8 */
|
||||
*vp = STRING_TO_JSVAL(JS_NewStringCopyZ(smjs_ctx,
|
||||
bookmark->url));
|
||||
|
||||
@ -151,6 +153,7 @@ bookmark_set_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
JSString *jsstr = JS_ValueToString(smjs_ctx, *vp);
|
||||
unsigned char *str = JS_GetStringBytes(jsstr);
|
||||
|
||||
/** @todo Bug 153: bookmark->title should be UTF-8 */
|
||||
mem_free_set(&bookmark->title, stracpy(str));
|
||||
|
||||
return JS_TRUE;
|
||||
@ -159,6 +162,7 @@ bookmark_set_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
JSString *jsstr = JS_ValueToString(smjs_ctx, *vp);
|
||||
unsigned char *str = JS_GetStringBytes(jsstr);
|
||||
|
||||
/** @todo Bug 1066: bookmark->url should be UTF-8 */
|
||||
mem_free_set(&bookmark->url, stracpy(str));
|
||||
|
||||
return JS_TRUE;
|
||||
|
Loading…
Reference in New Issue
Block a user