From 6ad69b3a13fa590796ec959e66cd6168c6a2e790 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 30 Aug 2006 19:07:51 +0000 Subject: [PATCH] Closes #201, new collection (formerly project) naming Dialog on new collection and cleaner dialog for rename --- chrome/chromeFiles/content/scholar/overlay.js | 33 ++++++++++++++++--- .../locale/en-US/scholar/scholar.dtd | 2 +- .../locale/en-US/scholar/scholar.properties | 5 +-- 3 files changed, 33 insertions(+), 7 deletions(-) diff --git a/chrome/chromeFiles/content/scholar/overlay.js b/chrome/chromeFiles/content/scholar/overlay.js index ba6cb3fbee..67af2ba3d4 100644 --- a/chrome/chromeFiles/content/scholar/overlay.js +++ b/chrome/chromeFiles/content/scholar/overlay.js @@ -153,7 +153,24 @@ var ScholarPane = new function() function newCollection() { - Scholar.Collections.add(Scholar.getString('pane.collections.untitled')); + var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] + .getService(Components.interfaces.nsIPromptService); + + var newName = { value: Scholar.getString('pane.collections.untitled') }; + var result = promptService.prompt(window, "", + Scholar.getString('pane.collections.name'), newName, "", {}); + + if (!result) + { + return false; + } + + if (!newName.value) + { + newName.value = Scholar.getString('pane.collections.untitled'); + } + + Scholar.Collections.add(newName.value); } function newSearch() @@ -276,9 +293,17 @@ var ScholarPane = new function() if(collection.isCollection()) { - var newName = prompt(Scholar.getString('pane.collections.rename'),collection.getName()); - if(newName) - collection.ref.rename(newName); + var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] + .getService(Components.interfaces.nsIPromptService); + + var newName = { value: collection.getName() }; + var result = promptService.prompt(window, "", + Scholar.getString('pane.collections.rename'), newName, "", {}); + + if (result && newName.value) + { + collection.ref.rename(newName.value); + } } else { diff --git a/chrome/chromeFiles/locale/en-US/scholar/scholar.dtd b/chrome/chromeFiles/locale/en-US/scholar/scholar.dtd index 6eafe549a0..4dd33491b4 100644 --- a/chrome/chromeFiles/locale/en-US/scholar/scholar.dtd +++ b/chrome/chromeFiles/locale/en-US/scholar/scholar.dtd @@ -20,7 +20,7 @@ - + diff --git a/chrome/chromeFiles/locale/en-US/scholar/scholar.properties b/chrome/chromeFiles/locale/en-US/scholar/scholar.properties index d36ce57472..2a4ce90b6b 100644 --- a/chrome/chromeFiles/locale/en-US/scholar/scholar.properties +++ b/chrome/chromeFiles/locale/en-US/scholar/scholar.properties @@ -1,8 +1,9 @@ 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.rename = Rename Collection: +pane.collections.name = Collection name: +pane.collections.rename = Rename collection: pane.collections.library = My Library -pane.collections.untitled = Untitled Collection +pane.collections.untitled = Untitled pane.items.delete = Are you sure you want to delete the selected item? pane.items.delete.multiple = Are you sure you want to delete the selected items?