From 91b35f87d758653d0685805d122a0a0468f88f6d Mon Sep 17 00:00:00 2001 From: Myk Melez Date: Mon, 4 Aug 2008 15:55:18 -0700 Subject: [PATCH] localize prefwindow, remove obsolete OPML import code from prefwindow, and display message about not yet having any preferences --- content/preferences.js | 61 ------------------------------------ content/preferences.xul | 9 +++--- locale/en-US/preferences.dtd | 2 ++ 3 files changed, 7 insertions(+), 65 deletions(-) create mode 100644 locale/en-US/preferences.dtd diff --git a/content/preferences.js b/content/preferences.js index c722832..00bf46b 100644 --- a/content/preferences.js +++ b/content/preferences.js @@ -38,64 +38,3 @@ const Cc = Components.classes; const Ci = Components.interfaces; const Cr = Components.results; const Cu = Components.utils; - -Cu.import("resource://snowl/modules/service.js"); -Cu.import("resource://snowl/modules/datastore.js"); -Cu.import("resource://snowl/modules/feed.js"); -Cu.import("resource://snowl/modules/URI.js"); - -let SnowlPreferences = { - onImportOPML: function() { - let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker); - fp.init(window, "Import", Ci.nsIFilePicker.modeOpen); - fp.appendFilter("OPML Files", "*.opml"); - fp.appendFilters(Ci.nsIFilePicker.filterXML); - fp.appendFilters(Ci.nsIFilePicker.filterAll); - - let rv = fp.show(); - if (rv != Ci.nsIFilePicker.returnOK) - return; - - let request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"]. - createInstance(Ci.nsIXMLHttpRequest); - request.open("GET", fp.fileURL.spec, false); - // Since the file probably ends in .opml, we have to force XHR to treat it - // as XML by overriding the MIME type it would otherwise select. - request.overrideMimeType("text/xml"); - request.send(null); - let xmlDocument = request.responseXML; - - let outline = xmlDocument.getElementsByTagName("body")[0]; - - this._importOutline(outline); - }, - - _importOutline: function(aOutline) { - // If this outline represents a feed, subscribe the user to the feed. - let uri = URI.get(aOutline.getAttribute("xmlUrl")); - if (uri) { - // FIXME: make sure the user isn't already subscribed to the feed - // before subscribing them. - let name = aOutline.getAttribute("title") || aOutline.getAttribute("text") || "untitled"; - this._importItem(uri, name); - } - - if (aOutline.hasChildNodes()) { - let children = aOutline.childNodes; - for (let i = 0; i < children.length; i++) { - let child = children[i]; - - // Only deal with "outline" elements; ignore text, etc. nodes. - if (child.nodeName != "outline") - continue; - - this._importOutline(child); - } - } - }, - - _importItem: function(aURL, aName) { - let subscriber = new SnowlFeedSubscriber(aURL, aName); - subscriber.subscribe(); - } -}; diff --git a/content/preferences.xul b/content/preferences.xul index e9ffcd8..e671352 100644 --- a/content/preferences.xul +++ b/content/preferences.xul @@ -38,14 +38,15 @@ + + + title="&prefwindow.title;">