From 146b92585dce1823babb500453dc960b6497c194 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 31 Aug 2006 06:27:02 +0000 Subject: [PATCH] Fixes #249, User should not be able to try to delete "My Library" --- chrome/chromeFiles/content/scholar/overlay.js | 22 +++++++++++++++++-- .../locale/en-US/scholar/scholar.properties | 2 +- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/chrome/chromeFiles/content/scholar/overlay.js b/chrome/chromeFiles/content/scholar/overlay.js index 796560177..f514af851 100644 --- a/chrome/chromeFiles/content/scholar/overlay.js +++ b/chrome/chromeFiles/content/scholar/overlay.js @@ -291,8 +291,26 @@ var ScholarPane = new function() function deleteSelectedCollection() { - if(collectionsView.selection.count > 0 && confirm(Scholar.getString('pane.collections.delete'))) - collectionsView.deleteSelection(); + if (collectionsView.selection.count == 1) + { + var row = + collectionsView._getItemAtRow(collectionsView.selection.currentIndex); + + if (row.isCollection()) + { + if (confirm(Scholar.getString('pane.collections.delete'))) + { + collectionsView.deleteSelection(); + } + } + else if (row.isSearch()) + { + if (confirm(Scholar.getString('pane.collections.deleteSearch'))) + { + collectionsView.deleteSelection(); + } + } + } } function editSelectedCollection() diff --git a/chrome/chromeFiles/locale/en-US/scholar/scholar.properties b/chrome/chromeFiles/locale/en-US/scholar/scholar.properties index 08634b59a..8dd6390a4 100644 --- a/chrome/chromeFiles/locale/en-US/scholar/scholar.properties +++ b/chrome/chromeFiles/locale/en-US/scholar/scholar.properties @@ -1,5 +1,5 @@ pane.collections.delete = Are you sure you want to delete the selected collection? -pane.collections.delete.multiple = Are you sure you want to delete the selected collections? +pane.collections.deleteSearch = Are you sure you want to delete the selected search? pane.collections.name = Collection name: pane.collections.rename = Rename collection: pane.collections.library = My Library