diff options
author | Andrei Popescu <andreip@google.com> | 2009-09-23 15:52:16 +0100 |
---|---|---|
committer | Andrei Popescu <andreip@google.com> | 2009-09-23 15:52:26 +0100 |
commit | c95261955cf08f30b484b6a229c4bcff42c645ce (patch) | |
tree | be50574245f8f186e3049e95c0b82bff576e9afc | |
parent | 5e335a381a0cd66e94117b202c1f34f5cb29c9b8 (diff) | |
download | packages_apps_browser-c95261955cf08f30b484b6a229c4bcff42c645ce.zip packages_apps_browser-c95261955cf08f30b484b6a229c4bcff42c645ce.tar.gz packages_apps_browser-c95261955cf08f30b484b6a229c4bcff42c645ce.tar.bz2 |
Make the deletion of bookmarks depend on both title and URL
Fixes http://b/issue?id=2134421
-rw-r--r-- | src/com/android/browser/Bookmarks.java | 8 | ||||
-rw-r--r-- | src/com/android/browser/BrowserBookmarksAdapter.java | 3 | ||||
-rw-r--r-- | src/com/android/browser/BrowserBookmarksPage.java | 2 | ||||
-rw-r--r-- | src/com/android/browser/BrowserHistoryPage.java | 2 | ||||
-rw-r--r-- | src/com/android/browser/HistoryItem.java | 2 |
5 files changed, 9 insertions, 8 deletions
diff --git a/src/com/android/browser/Bookmarks.java b/src/com/android/browser/Bookmarks.java index a3dc919..40aaa63 100644 --- a/src/com/android/browser/Bookmarks.java +++ b/src/com/android/browser/Bookmarks.java @@ -162,17 +162,17 @@ import java.util.Date; * @param url URL of the website to be removed. */ /* package */ static void removeFromBookmarks(Context context, - ContentResolver cr, String url) { + ContentResolver cr, String url, String title) { Cursor cursor = cr.query( Browser.BOOKMARKS_URI, Browser.HISTORY_PROJECTION, - "url = ?", - new String[] { url }, + "url = ? AND title = ?", + new String[] { url, title }, null); boolean first = cursor.moveToFirst(); // Should be in the database no matter what if (!first) { - throw new AssertionError("URL is not in the database!"); + throw new AssertionError("URL is not in the database! " + url + " " + title); } // Remove from bookmarks WebIconDatabase.getInstance().releaseIconForPageUrl(url); diff --git a/src/com/android/browser/BrowserBookmarksAdapter.java b/src/com/android/browser/BrowserBookmarksAdapter.java index 36af1fc..6b464cc 100644 --- a/src/com/android/browser/BrowserBookmarksAdapter.java +++ b/src/com/android/browser/BrowserBookmarksAdapter.java @@ -188,7 +188,8 @@ class BrowserBookmarksAdapter extends BaseAdapter { } mCursor.moveToPosition(position- mExtraOffset); String url = mCursor.getString(Browser.HISTORY_PROJECTION_URL_INDEX); - Bookmarks.removeFromBookmarks(null, mContentResolver, url); + String title = mCursor.getString(Browser.HISTORY_PROJECTION_TITLE_INDEX); + Bookmarks.removeFromBookmarks(null, mContentResolver, url, title); refreshList(); } diff --git a/src/com/android/browser/BrowserBookmarksPage.java b/src/com/android/browser/BrowserBookmarksPage.java index 23fcc5a..019806c 100644 --- a/src/com/android/browser/BrowserBookmarksPage.java +++ b/src/com/android/browser/BrowserBookmarksPage.java @@ -154,7 +154,7 @@ public class BrowserBookmarksPage extends Activity implements // If the site is bookmarked, the item becomes remove from // bookmarks. if (isBookmark) { - Bookmarks.removeFromBookmarks(this, getContentResolver(), url); + Bookmarks.removeFromBookmarks(this, getContentResolver(), url, name); } else { Browser.saveBookmark(this, name, url); } diff --git a/src/com/android/browser/BrowserHistoryPage.java b/src/com/android/browser/BrowserHistoryPage.java index d364c9c..9c9dc60 100644 --- a/src/com/android/browser/BrowserHistoryPage.java +++ b/src/com/android/browser/BrowserHistoryPage.java @@ -238,7 +238,7 @@ public class BrowserHistoryPage extends ExpandableListActivity { case R.id.save_to_bookmarks_menu_id: if (historyItem.isBookmark()) { Bookmarks.removeFromBookmarks(this, getContentResolver(), - url); + url, title); } else { Browser.saveBookmark(this, title, url); } diff --git a/src/com/android/browser/HistoryItem.java b/src/com/android/browser/HistoryItem.java index e8f15b1..9d6dec7 100644 --- a/src/com/android/browser/HistoryItem.java +++ b/src/com/android/browser/HistoryItem.java @@ -49,7 +49,7 @@ import android.widget.TextView; mContext.getContentResolver(), mUrl, getName(), true); } else { Bookmarks.removeFromBookmarks(mContext, - mContext.getContentResolver(), mUrl); + mContext.getContentResolver(), mUrl, getName()); } } }; |