mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 748898 - Use "mobile" as title for Mobile Bookmarks folder on upload. a=blocking-fennec
This commit is contained in:
parent
d18af6cc2d
commit
49c9fd24e1
@ -197,11 +197,20 @@ public class AndroidBrowserBookmarksRepositorySession extends AndroidBrowserRepo
|
|||||||
|
|
||||||
if (SPECIAL_GUIDS_MAP == null) {
|
if (SPECIAL_GUIDS_MAP == null) {
|
||||||
HashMap<String, String> m = new HashMap<String, String>();
|
HashMap<String, String> m = new HashMap<String, String>();
|
||||||
|
|
||||||
|
// Note that we always use the literal name "mobile" for the Mobile Bookmarks
|
||||||
|
// folder, regardless of its actual name in the database or the Fennec UI.
|
||||||
|
// This is to match desktop (working around Bug 747699) and to avoid a similar
|
||||||
|
// issue locally. See Bug 748898.
|
||||||
|
m.put("mobile", "mobile");
|
||||||
|
|
||||||
|
// Other folders use their contextualized names, and we simply rely on
|
||||||
|
// these not changing, matching desktop, and such to avoid issues.
|
||||||
m.put("menu", context.getString(R.string.bookmarks_folder_menu));
|
m.put("menu", context.getString(R.string.bookmarks_folder_menu));
|
||||||
m.put("places", context.getString(R.string.bookmarks_folder_places));
|
m.put("places", context.getString(R.string.bookmarks_folder_places));
|
||||||
m.put("toolbar", context.getString(R.string.bookmarks_folder_toolbar));
|
m.put("toolbar", context.getString(R.string.bookmarks_folder_toolbar));
|
||||||
m.put("unfiled", context.getString(R.string.bookmarks_folder_unfiled));
|
m.put("unfiled", context.getString(R.string.bookmarks_folder_unfiled));
|
||||||
m.put("mobile", context.getString(R.string.bookmarks_folder_mobile));
|
|
||||||
SPECIAL_GUIDS_MAP = Collections.unmodifiableMap(m);
|
SPECIAL_GUIDS_MAP = Collections.unmodifiableMap(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -594,6 +603,27 @@ public class AndroidBrowserBookmarksRepositorySession extends AndroidBrowserRepo
|
|||||||
return reconciled;
|
return reconciled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rename mobile folders to "mobile", both in and out. The other half of
|
||||||
|
* this logic lives in {@link #computeParentFields(BookmarkRecord, String, String)}, where
|
||||||
|
* the parent name of a record is set from {@link #SPECIAL_GUIDS_MAP} rather than
|
||||||
|
* from source data.
|
||||||
|
*
|
||||||
|
* Apply this approach generally for symmetry.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void fixupRecord(Record record) {
|
||||||
|
final BookmarkRecord r = (BookmarkRecord) record;
|
||||||
|
final String parentName = SPECIAL_GUIDS_MAP.get(r.parentID);
|
||||||
|
if (parentName == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (Logger.logVerbose(LOG_TAG)) {
|
||||||
|
Logger.trace(LOG_TAG, "Replacing parent name \"" + r.parentName + "\" with \"" + parentName + "\".");
|
||||||
|
}
|
||||||
|
r.parentName = parentName;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Record prepareRecord(Record record) {
|
protected Record prepareRecord(Record record) {
|
||||||
if (record.deleted) {
|
if (record.deleted) {
|
||||||
|
@ -93,8 +93,24 @@ public abstract class AndroidBrowserRepositorySession extends StoreTrackingRepos
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Perform any necessary transformation of a record prior to searching by
|
||||||
|
* any field other than GUID.
|
||||||
|
*
|
||||||
|
* Example: translating remote folder names into local names.
|
||||||
|
*/
|
||||||
|
protected void fixupRecord(Record record) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Override in subclass to implement record extension.
|
* Override in subclass to implement record extension.
|
||||||
|
*
|
||||||
|
* Populate any fields of the record that are expensive to calculate,
|
||||||
|
* prior to reconciling.
|
||||||
|
*
|
||||||
|
* Example: computing children arrays.
|
||||||
|
*
|
||||||
* Return null if this record should not be processed.
|
* Return null if this record should not be processed.
|
||||||
*
|
*
|
||||||
* @param record
|
* @param record
|
||||||
@ -429,6 +445,9 @@ public abstract class AndroidBrowserRepositorySession extends StoreTrackingRepos
|
|||||||
// End deletion logic.
|
// End deletion logic.
|
||||||
|
|
||||||
// Now we're processing a non-deleted incoming record.
|
// Now we're processing a non-deleted incoming record.
|
||||||
|
// Apply any changes we need in order to correctly find existing records.
|
||||||
|
fixupRecord(record);
|
||||||
|
|
||||||
if (existingRecord == null) {
|
if (existingRecord == null) {
|
||||||
trace("Looking up match for record " + record.guid);
|
trace("Looking up match for record " + record.guid);
|
||||||
existingRecord = findExistingRecord(record);
|
existingRecord = findExistingRecord(record);
|
||||||
@ -649,6 +668,7 @@ public abstract class AndroidBrowserRepositorySession extends StoreTrackingRepos
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected abstract Record prepareRecord(Record record);
|
protected abstract Record prepareRecord(Record record);
|
||||||
|
|
||||||
protected void updateBookkeeping(Record record) throws NoGuidForIdException,
|
protected void updateBookkeeping(Record record) throws NoGuidForIdException,
|
||||||
NullCursorException,
|
NullCursorException,
|
||||||
ParentNotFoundException {
|
ParentNotFoundException {
|
||||||
|
Loading…
Reference in New Issue
Block a user