sync bookmark descriptions

This commit is contained in:
Dan Mills 2008-05-12 10:11:07 -07:00
parent cb3252bd8d
commit 036c817866

View File

@ -361,6 +361,11 @@ BookmarksStore.prototype = {
this._ts.untagURI(URI, null); this._ts.untagURI(URI, null);
this._ts.tagURI(URI, command.data.tags); this._ts.tagURI(URI, command.data.tags);
this._bms.setKeywordForBookmark(newId, command.data.keyword); this._bms.setKeywordForBookmark(newId, command.data.keyword);
if (command.data.description) {
this._ans.setItemAnnotation(newId, "bookmarkProperties/description",
command.data.description, 0,
this._ans.EXPIRE_NEVER);
}
if (command.data.type == "microsummary") { if (command.data.type == "microsummary") {
this._log.debug(" \-> is a microsummary"); this._log.debug(" \-> is a microsummary");
@ -497,6 +502,13 @@ BookmarksStore.prototype = {
case "keyword": case "keyword":
this._bms.setKeywordForBookmark(itemId, command.data.keyword); this._bms.setKeywordForBookmark(itemId, command.data.keyword);
break; break;
case "description":
if (command.data.description) {
this._ans.setItemAnnotation(itemId, "bookmarkProperties/description",
command.data.description, 0,
this._ans.EXPIRE_NEVER);
}
break;
case "generatorURI": { case "generatorURI": {
let micsumURI = Utils.makeURI(this._bms.getBookmarkURI(itemId)); let micsumURI = Utils.makeURI(this._bms.getBookmarkURI(itemId));
let genURI = Utils.makeURI(command.data.generatorURI); let genURI = Utils.makeURI(command.data.generatorURI);
@ -573,6 +585,14 @@ BookmarksStore.prototype = {
item.type = "bookmark"; item.type = "bookmark";
item.title = node.title; item.title = node.title;
} }
try {
item.description =
this._ans.getItemAnnotation(node.itemId, "bookmarkProperties/description");
} catch (e) {
item.description = undefined;
}
item.URI = node.uri; item.URI = node.uri;
item.tags = this._ts.getTagsForURI(Utils.makeURI(node.uri), {}); item.tags = this._ts.getTagsForURI(Utils.makeURI(node.uri), {});
item.keyword = this._bms.getKeywordForBookmark(node.itemId); item.keyword = this._bms.getKeywordForBookmark(node.itemId);
@ -797,10 +817,10 @@ CookieStore.prototype = {
in order to sync with the server. in order to sync with the server.
command.data appears to be equivalent to what wrap() puts in command.data appears to be equivalent to what wrap() puts in
the JSON dictionary. */ the JSON dictionary. */
this._log.info("CookieStore got removeCommand: " + command ); this._log.info("CookieStore got removeCommand: " + command );
/* I think it goes like this, according to /* I think it goes like this, according to
http://developer.mozilla.org/en/docs/nsICookieManager http://developer.mozilla.org/en/docs/nsICookieManager
the last argument is "always block cookies from this domain?" the last argument is "always block cookies from this domain?"
and the answer is "no". */ and the answer is "no". */
@ -821,13 +841,13 @@ CookieStore.prototype = {
while (iter.hasMoreElements()){ while (iter.hasMoreElements()){
let cookie = iter.getNext(); let cookie = iter.getNext();
if (cookie instanceof Ci.nsICookie){ if (cookie instanceof Ci.nsICookie){
// see if host:path:name of cookie matches GUID given in command // see if host:path:name of cookie matches GUID given in command
let key = cookie.host + ":" + cookie.path + ":" + cookie.name; let key = cookie.host + ":" + cookie.path + ":" + cookie.name;
if (key == command.GUID) { if (key == command.GUID) {
matchingCookie = cookie; matchingCookie = cookie;
break; break;
} }
} }
} }
// Update values in the cookie: // Update values in the cookie:
for (var key in command.data) { for (var key in command.data) {
@ -848,7 +868,7 @@ CookieStore.prototype = {
matchingCookie.isHttpOnly, matchingCookie.isHttpOnly,
matchingCookie.isSession, matchingCookie.isSession,
matchingCookie.expiry ); matchingCookie.expiry );
// Also, there's an exception raised because // Also, there's an exception raised because
// this._data[comand.GUID] is undefined // this._data[comand.GUID] is undefined
}, },
@ -878,11 +898,11 @@ CookieStore.prototype = {
isSession: cookie.isSession, isSession: cookie.isSession,
expiry: cookie.expiry, expiry: cookie.expiry,
isHttpOnly: cookie.isHttpOnly } isHttpOnly: cookie.isHttpOnly }
/* See http://developer.mozilla.org/en/docs/nsICookie /* See http://developer.mozilla.org/en/docs/nsICookie
Note: not syncing "expires", "status", or "policy" Note: not syncing "expires", "status", or "policy"
since they're deprecated. */ since they're deprecated. */
} }
} }
return items; return items;