Bug 708485 - Create "mobile" special bookmarks folder on DB creation (r=blassey, a=mfinkle)

This commit is contained in:
Lucas Rocha 2011-12-13 19:47:40 +00:00
parent 97466ba4ae
commit 98655b3f10
2 changed files with 23 additions and 1 deletions

View File

@ -93,6 +93,13 @@ public class BrowserContract {
public static final class Bookmarks implements CommonColumns, URLColumns, ImageColumns, SyncColumns {
private Bookmarks() {}
public static final String MOBILE_FOLDER_GUID = "mobile";
public static final String PLACES_FOLDER_GUID = "places";
public static final String MENU_FOLDER_GUID = "menu";
public static final String TAGS_FOLDER_GUID = "tags";
public static final String TOOLBAR_FOLDER_GUID = "toolbar";
public static final String UNFILED_FOLDER_GUID = "unfiled";
public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "bookmarks");
public static final String CONTENT_TYPE = "vnd.android.cursor.dir/bookmark";
@ -133,4 +140,4 @@ public class BrowserContract {
public static final String VERSION = "version";
}
}
}

View File

@ -341,9 +341,24 @@ public class BrowserProvider extends ContentProvider {
", " + Images.FAVICON + ", " + Images.THUMBNAIL + " FROM " +
TABLE_HISTORY_JOIN_IMAGES);
createMobileBookmarksFolder(db);
// FIXME: Create default bookmarks here
}
private void createMobileBookmarksFolder(SQLiteDatabase db) {
ContentValues values = new ContentValues();
values.put(Bookmarks.GUID, Bookmarks.MOBILE_FOLDER_GUID);
values.put(Bookmarks.IS_FOLDER, 1);
values.put(Bookmarks.POSITION, 0);
long now = System.currentTimeMillis();
values.put(Bookmarks.DATE_CREATED, now);
values.put(Bookmarks.DATE_MODIFIED, now);
db.insertOrThrow(TABLE_BOOKMARKS, Bookmarks.GUID, values);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
Log.d(LOGTAG, "Upgrading browser.db: " + db.getPath() + " from " +