Closed Bug 635061 Opened 13 years ago Closed 13 years ago

Export shortcuts and descriptions for folders/tab groups when exporting HTML bookmarks

Categories

(Camino Graveyard :: Bookmarks, defect)

All
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: alqahira, Assigned: alqahira)

References

Details

Attachments

(1 file)

Bug 307620:

Comment 14 philippe 2011-01-23 22:48:49 PST

It would be noce if keywords (shorcuts) for tabgroups was also exported.
Firefox won't be able to use them, but it is handy if one uses the Export
bookmark… as a way to create a backup.
For individual bookmarks, this was added in bug 307743.

Comment 15 Smokey Ardisson (way behind; no bugmail - do not email) 2011-02-10 14:02:05 PST

(In reply to comment #14)
> It would be noce if keywords (shorcuts) for tabgroups was also exported.
> Firefox won't be able to use them, but it is handy if one uses the Export
> bookmark… as a way to create a backup.
> For individual bookmarks, this was added in bug 307743.

This ought to be pretty easy to fix, I think.

|writeBookmarkFolder:toFileHandle:withIndentation:| currently does

324   if ([bookmarkFolder isToolbar])
325     attributes = @" PERSONAL_TOOLBAR_FOLDER=\"true\"";
326   else if ([bookmarkFolder isGroup])
327     attributes = @" FOLDER_GROUP=\"true\"";
328   [... write stuff]

And we should just need to do the equivalent of
|writeBookmark:toFileHandle:withIndentation:|'s

375     if ([[bookmark shortcut] length] > 0)
376       [bookmarkLine appendFormat:@" SHORTCUTURL=\"%@\"", [bookmark
shortcut]];

to append that to a folder's attributes before writing stuff.

----

I noticed while writing this patch that, while the importer supports folder descriptions (as well as folder shortcuts), the exporter didn't write them, either.

This patch thus fixes both shortcuts and descriptions.  I've done some rudimentary tests (round-trip the default bookmarks with these two attributes added, import into Firefox 3.6), but nothing substantial. philippe, can you give this a more extensive workout?
Attachment #513279 - Flags: feedback?(phiw)
Comment on attachment 513279 [details] [diff] [review]
Export folder descriptions and shortcuts in HTML

For testing, I used my own BM file, with a bunch of BM shortcuts on BMs and tabgroups, and with description in multiple languages (En, Fr, Jpn,…).

1. Round tripping - Camino --> Camino: OK
   all shortcuts and descriptions come through fine
   tested with both a patched Camino and an official nightly.
2. Safari imported both the .html and the .plist file nicely
3. Both Fx 3.6.x and a recent Minefield nightly imported the file correctly
   all descriptions came through correctly
   shortcuts on tabgroups are lost - feature is not supported.
4. Chrome imported the .html file correctly.
5. exporting my mini-Fx BM file with 'tags', keywords and descriptions
   importing in Camino works fine (tags are lost, nothing new here)
Attachment #513279 - Flags: feedback?(phiw) → feedback+
Attachment #513279 - Flags: superreview?(stuart.morgan+bugzilla)
Comment on attachment 513279 [details] [diff] [review]
Export folder descriptions and shortcuts in HTML

>+  if ([folderShortcut length] > 0)
>+       [attributes appendFormat:@" SHORTCUTURL=\"%@\"", folderShortcut];

Indent 2, not 4.

>+  if ([folderDescription length] > 0) {
>+    descriptionString = [NSString stringWithFormat:@"%@<DD>%@\n", padString,
>+      [folderDescription stringByAddingAmpEscapes]];

Indent this last line two more.

Also, shouldn't the format string be @"\n%@<DD>%@\n"?

>+  [bookmarkLine appendFormat:@"<DT><H3%@>%@</H3>\n%@%@<DL><p>\n",
>+    attributes ? attributes : @"", [[bookmarkFolder title] stringByAddingAmpEscapes],
>+    descriptionString ? descriptionString : @"", padString];

attributes is now always set, so |attributes ? attributes : @""| -> |attributes|

sr=smorgan with those changes.
Attachment #513279 - Flags: superreview?(stuart.morgan+bugzilla) → superreview+
(In reply to comment #2)
> >+  if ([folderDescription length] > 0) {
> >+    descriptionString = [NSString stringWithFormat:@"%@<DD>%@\n", padString,
> >+      [folderDescription stringByAddingAmpEscapes]];
> 
> Indent this last line two more.
> 
> Also, shouldn't the format string be @"\n%@<DD>%@\n"?

No, if we do that, then we get a blank line between the <H3>Folder Name</H3> and <DD>Folder Description</DD>, rather than just forcing the latter to a new line.

http://hg.mozilla.org/camino/rev/1eccadbe0247 with the other changes made.
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: