mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 731267 - Ignore "All Bookmarks" folder and its badly rooted parent. r=lucasr
This commit is contained in:
parent
0d9d3bda35
commit
9e65c93ef7
@ -310,15 +310,33 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface {
|
||||
// This method filters out the root folder and the tags folder, since we
|
||||
// don't want to see those in the UI
|
||||
public Cursor getBookmarksInFolder(ContentResolver cr, long folderId) {
|
||||
Cursor c = cr.query(mBookmarksUriWithProfile,
|
||||
DEFAULT_BOOKMARK_COLUMNS,
|
||||
Bookmarks.PARENT + " = ? AND " +
|
||||
Bookmarks._ID + " <> ? AND " +
|
||||
Bookmarks._ID + " <> ?",
|
||||
new String[] { String.valueOf(folderId),
|
||||
String.valueOf(Bookmarks.FIXED_ROOT_ID),
|
||||
String.valueOf(getTagsBookmarksFolderId(cr))},
|
||||
null);
|
||||
Cursor c = null;
|
||||
|
||||
if (folderId == Bookmarks.FIXED_ROOT_ID) {
|
||||
// Because of sync, we can end up with some additional records under
|
||||
// the root node that we don't want to see. Since sync doesn't
|
||||
// want to run into problems deleting these, we can just ignore them
|
||||
// by querying specifically for only the folders we care about.
|
||||
c = cr.query(mBookmarksUriWithProfile,
|
||||
DEFAULT_BOOKMARK_COLUMNS,
|
||||
Bookmarks.PARENT + " = ? AND (" +
|
||||
Bookmarks.GUID + " = ? OR " +
|
||||
Bookmarks.GUID + " = ? OR " +
|
||||
Bookmarks.GUID + " = ? OR " +
|
||||
Bookmarks.GUID + " = ?)",
|
||||
new String[] { String.valueOf(folderId),
|
||||
Bookmarks.MOBILE_FOLDER_GUID,
|
||||
Bookmarks.TOOLBAR_FOLDER_GUID,
|
||||
Bookmarks.MENU_FOLDER_GUID,
|
||||
Bookmarks.UNFILED_FOLDER_GUID },
|
||||
null);
|
||||
} else {
|
||||
c = cr.query(mBookmarksUriWithProfile,
|
||||
DEFAULT_BOOKMARK_COLUMNS,
|
||||
Bookmarks.PARENT + " = ? ",
|
||||
new String[] { String.valueOf(folderId) },
|
||||
null);
|
||||
}
|
||||
|
||||
return new LocalDBCursor(c);
|
||||
}
|
||||
@ -362,14 +380,6 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface {
|
||||
return mMobileFolderId;
|
||||
}
|
||||
|
||||
private long getTagsBookmarksFolderId(ContentResolver cr) {
|
||||
if (mTagsFolderId >= 0)
|
||||
return mTagsFolderId;
|
||||
|
||||
mTagsFolderId = getFolderIdFromGuid(cr, Bookmarks.TAGS_FOLDER_GUID);
|
||||
return mTagsFolderId;
|
||||
}
|
||||
|
||||
private long getFolderIdFromGuid(ContentResolver cr, String guid) {
|
||||
long folderId = -1;
|
||||
Cursor c = null;
|
||||
|
Loading…
Reference in New Issue
Block a user