diff options
author | David Farning <dfarning@gmail.com> | 2009-03-21 05:54:57 (GMT) |
---|---|---|
committer | David Farning <dfarning@gmail.com> | 2009-03-21 05:54:57 (GMT) |
commit | b6607b36b4fe5be82297abaea88e120de7c1ce44 (patch) | |
tree | a44f7ca03ac5524024c98343c7ef517038d4f870 /bandwagon/content/ui/settingsController.js | |
parent | 1fb3c4ae563e9ede7cdc6cdb6b4292773703c14d (diff) | |
parent | 32c281e71ab055ed2ad44b44e5863cf9779a621d (diff) |
merge with snvdevel
Diffstat (limited to 'bandwagon/content/ui/settingsController.js')
-rw-r--r-- | bandwagon/content/ui/settingsController.js | 439 |
1 files changed, 308 insertions, 131 deletions
diff --git a/bandwagon/content/ui/settingsController.js b/bandwagon/content/ui/settingsController.js index 34ccb8f..d521d15 100644 --- a/bandwagon/content/ui/settingsController.js +++ b/bandwagon/content/ui/settingsController.js @@ -19,7 +19,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): David McNamara - * Brian King + * Brian King <brian (at) briks (dot) si> * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or @@ -37,49 +37,56 @@ Bandwagon.Controller.Settings = new function() { - this.feeds = {}; + this.collections = {}; - this.elemBandwagonFeeds = null; - this.elemFeedName = null; + this.elemBandwagonCollections = null; + this.elemCollectionName = null; this.stringBundle = null; } Bandwagon.Controller.Settings.init = function() { - //alert("Initializing Bandwagon.Controller.Settings"); Bandwagon.Logger.debug("Initializing Bandwagon.Controller.Settings"); Bandwagon.Controller.Settings.stringBundle = document.getElementById("bandwagon-strings"); - Bandwagon.Controller.Settings.elemBandwagonFeeds = document.getElementById("feeds-list"); - Bandwagon.Controller.Settings.elemBandwagonFeeds.addEventListener("select", Bandwagon.Controller.Settings.doShowFeed, true); + Bandwagon.Controller.Settings.elemBandwagonCollections = document.getElementById("collections-list"); + Bandwagon.Controller.Settings.elemBandwagonCollections.addEventListener("select", Bandwagon.Controller.Settings.doShowCollection, true); - Bandwagon.Controller.Settings.elemFeedName = document.getElementById("feed-name"); + Bandwagon.Controller.Settings.elemCollectionName = document.getElementById("collection-name"); if (document.getElementById("extensions.bandwagon.updateall.enabled").value) { - document.getElementById("checkbox-updateinterval-global").checked = true; - document.getElementById("checkbox-updateinterval-perfeed").checked = true; + document.getElementById("updates-group").selectedIndex = 0; } + else + document.getElementById("updates-group").selectedIndex = 1; - document.getElementById("checkbox-updateinterval-global").addEventListener("command", Bandwagon.Controller.Settings.doUpdateIntervalScopeChange, true); - document.getElementById("textbox-updateinterval-quantity").addEventListener("input", Bandwagon.Controller.Settings.doSaveFeed, true); - document.getElementById("textbox-updateinterval-quantity").addEventListener("command", Bandwagon.Controller.Settings.doSaveFeed, false); - document.getElementById("menulist-updateinterval-units").addEventListener("command", Bandwagon.Controller.Settings.doSaveFeed, true); + document.getElementById("updates-group").addEventListener("command", Bandwagon.Controller.Settings.doUpdateIntervalScopeChange, true); + document.getElementById("textbox-updateinterval-quantity").addEventListener("input", Bandwagon.Controller.Settings.doSaveCollection, true); + document.getElementById("textbox-updateinterval-quantity").addEventListener("command", Bandwagon.Controller.Settings.doSaveCollection, false); + document.getElementById("textbox-updateinterval-quantity-percollection").addEventListener("input", Bandwagon.Controller.Settings.doSaveCollection, true); + document.getElementById("textbox-updateinterval-quantity-percollection").addEventListener("command", Bandwagon.Controller.Settings.doSaveCollection, false); + document.getElementById("menulist-updateinterval-units-percollection").addEventListener("command", Bandwagon.Controller.Settings.doSaveCollection, true); if (document.getElementById("extensions.bandwagon.notifyall.enabled").value) { - document.getElementById("checkbox-shownotifications-global").checked = true; - document.getElementById("checkbox-shownotifications-perfeed").checked = true; + document.getElementById("notifications-group").selectedIndex = 0; } + else + document.getElementById("notifications-group").selectedIndex = 1; + + document.getElementById("notifications-group").addEventListener("command", Bandwagon.Controller.Settings.doShowNotificationsScopeChange, true); + document.getElementById("notifications-group").addEventListener("command", Bandwagon.Controller.Settings.doSaveCollection, true); - document.getElementById("checkbox-shownotifications-global").addEventListener("command", Bandwagon.Controller.Settings.doShowNotificationsScopeChange, true); - document.getElementById("checkbox-shownotifications-perfeed").addEventListener("command", Bandwagon.Controller.Settings.doSaveFeed, true); + //document.getElementById("checkbox-autopublish-percollection").addEventListener("command", Bandwagon.Controller.Settings.doSaveCollection, true); - document.getElementById("checkbox-autopublish-perfeed").addEventListener("command", Bandwagon.Controller.Settings.doSaveFeed, true); + bandwagonService.registerCollectionListChangeObserver(Bandwagon.Controller.Settings.collectionListChangeObserver); - bandwagonService.registerFeedListChangeObserver(Bandwagon.Controller.Settings.feedListChangeObserver); + Bandwagon.Controller.Settings.EmailsCheck(); + Bandwagon.Controller.Settings.LoginCheck(); + Bandwagon.Controller.Settings.AutoCheck(); setTimeout(function() { @@ -90,33 +97,33 @@ Bandwagon.Controller.Settings.init = function() Bandwagon.Controller.Settings._delayedInit = function() { - Bandwagon.Controller.Settings._repopulateFeedsList(); + Bandwagon.Controller.Settings._repopulateCollectionsList(); Bandwagon.Controller.Settings.invalidate(); } Bandwagon.Controller.Settings.uninit = function() { - bandwagonService.unregisterFeedListChangeObserver(Bandwagon.Controller.Settings.feedListChangeObserver); + bandwagonService.unregisterCollectionListChangeObserver(Bandwagon.Controller.Settings.collectionListChangeObserver); - // now is a good time to save feeds to storage + // now is a good time to save collections to storage if (Bandwagon.COMMIT_NOW) bandwagonService.commitAll(); } -Bandwagon.Controller.Settings.feedListChangeObserver = function() +Bandwagon.Controller.Settings.collectionsListChangeObserver = function() { - Bandwagon.Controller.Settings._repopulateFeedsList(); + Bandwagon.Controller.Settings._repopulateCollectionsList(); - var elemBandwagonFeed = Bandwagon.Controller.Settings.elemBandwagonFeeds.getElementsByTagName("bandwagonFeed")[0]; + var elemBandwagonCollection = Bandwagon.Controller.Settings.elemBandwagonCollections.getElementsByTagName("bandwagonCollection")[0]; - if (elemBandwagonFeed) + if (elemBandwagonCollection) { - Bandwagon.Controller.Settings.elemBandwagonFeeds.selectItem(elemBandwagonFeed); - Bandwagon.Controller.Settings.elemBandwagonFeeds.focus(); + Bandwagon.Controller.Settings.elemBandwagonCollections.selectItem(elemBandwagonCollection); + Bandwagon.Controller.Settings.elemBandwagonCollections.focus(); } else { - Bandwagon.Controller.Settings.doShowFeed(); + Bandwagon.Controller.Settings.doShowCollection(); } Bandwagon.Controller.Settings.invalidate(); @@ -124,92 +131,95 @@ Bandwagon.Controller.Settings.feedListChangeObserver = function() Bandwagon.Controller.Settings.invalidate = function() { - var feedCount = Bandwagon.Controller.Settings.elemBandwagonFeeds.getElementsByTagName("bandwagonFeed").length; - var feedSelection = Bandwagon.Controller.Settings.elemBandwagonFeeds.selectedItem; - - var disabled = (!feedSelection || feedCount == 0); - - document.getElementById("remove-feed-button").disabled = disabled; - document.getElementById("checkbox-updateinterval-perfeed").disabled = disabled; - document.getElementById("textbox-updateinterval-quantity").disabled = disabled; - document.getElementById("menulist-updateinterval-units").disabled = disabled; - document.getElementById("checkbox-updateinterval-global").disabled = disabled; - document.getElementById("checkbox-shownotifications-perfeed").disabled = disabled; - document.getElementById("checkbox-shownotifications-global").disabled = disabled; - document.getElementById("textbox-feeditemsperpage-global").disabled = disabled; - document.getElementById("checkbox-autopublish-perfeed").disabled = disabled; - document.getElementById("label-feeditemsperpage").disabled = disabled; + var collectionCount = Bandwagon.Controller.Settings.elemBandwagonCollections.getElementsByTagName("bandwagonCollection").length; + var collectionSelection = Bandwagon.Controller.Settings.elemBandwagonCollections.selectedItem; + + var disabled = (!collectionSelection || collectionCount == 0); + + // XXTODO Disable more controls + //document.getElementById("remove-collection-button").disabled = disabled; + document.getElementById("updates-group").disabled = disabled; + document.getElementById("textbox-updateinterval-quantity-percollection").disabled = disabled; + document.getElementById("menulist-updateinterval-units-percollection").disabled = disabled; + document.getElementById("notifications-group").disabled = disabled; + document.getElementById("label-addonsshow-percollection").disabled = disabled; + document.getElementById("label-addonsperpage-percollection").disabled = disabled; + document.getElementById("textbox-addonsperpage-percollection").disabled = disabled; + //document.getElementById("checkbox-autopublish-percollection").disabled = disabled; } -Bandwagon.Controller.Settings.doShowFeed = function() +Bandwagon.Controller.Settings.doShowCollection = function() { - var feed = null; - var selectedItem = Bandwagon.Controller.Settings.elemBandwagonFeeds.selectedItem; + var collection = null; + var selectedItem = Bandwagon.Controller.Settings.elemBandwagonCollections.selectedItem; - if (selectedItem && Bandwagon.Controller.Settings.elemBandwagonFeeds.selectedItem.feed) - feed = Bandwagon.Controller.Settings.feeds[Bandwagon.Controller.Settings.elemBandwagonFeeds.selectedItem.feed.url]; + if (selectedItem && Bandwagon.Controller.Settings.elemBandwagonCollections.selectedItem.collection) + collection = Bandwagon.Controller.Settings.collections[Bandwagon.Controller.Settings.elemBandwagonCollections.selectedItem.collection.resourceURL]; - Bandwagon.Logger.debug("showing feed: " + (feed?feed.url:"<none>")); + Bandwagon.Logger.debug("showing collection: " + (collection?collection.resourceURL:"<none>")); - if (!feed) + if (!collection) { - Bandwagon.Controller.Settings.elemFeedName.value = ""; + Bandwagon.Controller.Settings.elemCollectionName.value = ""; Bandwagon.Controller.Settings.invalidate(); return; } - Bandwagon.Controller.Settings.elemFeedName.value = (feed.name&&feed.name!=""?feed.name:feed.url); + if ( Bandwagon.Controller.Settings.elemCollectionName) + { + Bandwagon.Controller.Settings.elemCollectionName.value = (collection.name&&collection.name!=""?collection.name:collection.resourceURL); + } - if (document.getElementById("checkbox-updateinterval-global").checked) + if (document.getElementById("updates-group").selectedIndex == 0) // Hrm, this is not right, is it? { - // updateinterval: if "apply to all feeds" is checked - set updateinterval quantity and interval to global + // updateinterval: if "default" is selected - set updateinterval quantity and interval in default document.getElementById("textbox-updateinterval-quantity").valueNumber = parseInt(document.getElementById("extensions.bandwagon.updateall.interval").value); document.getElementById("menulist-updateinterval-units").selectedIndex = document.getElementById("extensions.bandwagon.updateall.units").value - 1; } else { - // updateinterval: if "apply to all feeds" is unchecked - set updateinterval quantity and interval to this feed + // updateinterval: if "Custom: " is selected - set updateinterval quantity and interval to this collection - var interval = Bandwagon.Util.intervalMillisecondsToUnits(feed.updateInterval*1000); + var interval = Bandwagon.Util.intervalMillisecondsToUnits(collection.updateInterval*1000); + document.getElementById("textbox-updateinterval-quantity-percollection").valueNumber = interval.interval; + document.getElementById("menulist-updateinterval-units-percollection").selectedIndex = interval.units-1; - document.getElementById("textbox-updateinterval-quantity").valueNumber = interval.interval; - document.getElementById("menulist-updateinterval-units").selectedIndex = interval.units-1; - - document.getElementById("checkbox-updateinterval-perfeed").checked = true; + document.getElementById("updates-group").selectedIndex = 1; } - if (document.getElementById("checkbox-shownotifications-global").checked) + // Turning off for now, not sure how to handle notifications when a collection is loaded + if (true) { - // shownotifications: if "apply to all feeds" is checked - set shownotifications to global - document.getElementById("checkbox-shownotifications-perfeed").checked = document.getElementById("extensions.bandwagon.notifyall.enabled").value; + // shownotifications: if "default" is selected - set shownotifications to global + } else { - // shownotifications: if "apply to all feeds" not checked - set shownotifications to this feed - document.getElementById("checkbox-shownotifications-perfeed").checked = feed.showNotifications; + // shownotifications: if "Custom" not selected - set shownotifications to this collection + } // autopublish - document.getElementById("checkbox-autopublish-perfeed").checked = feed.autoPublish; + //document.getElementById("checkbox-autopublish-percollection").checked = collection.autoPublish; Bandwagon.Controller.Settings.invalidate(); } -Bandwagon.Controller.Settings.doSaveFeed = function() +Bandwagon.Controller.Settings.doSaveCollection = function() { - Bandwagon.Logger.debug("in doSaveFeed()"); + Bandwagon.Logger.debug("in doSaveCollection()"); - // save settings to local copy of the feed objects + // save settings to local copy of the collection objects - var feed = Bandwagon.Controller.Settings.feeds[Bandwagon.Controller.Settings.elemBandwagonFeeds.selectedItem.feed.url]; + var collection = Bandwagon.Controller.Settings.collections[Bandwagon.Controller.Settings.elemBandwagonCollections.selectedItem.collection.resourceURL]; - if (!feed) + if (!collection) return; - feed.updateInterval = Bandwagon.Util.intervalUnitsToMilliseconds(document.getElementById("textbox-updateinterval-quantity").valueNumber, document.getElementById("menulist-updateinterval-units").selectedIndex+1) / 1000; - feed.showNotifications = document.getElementById("checkbox-shownotifications-perfeed").checked; - feed.autoPublish = document.getElementById("checkbox-autopublish-perfeed").checked; + collection.updateInterval = Bandwagon.Util.intervalUnitsToMilliseconds(document.getElementById("textbox-updateinterval-quantity").valueNumber, document.getElementById("menulist-updateinterval-units").selectedIndex+1) / 1000; + collection.showNotifications = (document.getElementById("notifications-group").selectedIndex == 1); + //collection.autoPublish = document.getElementById("checkbox-autopublish-percollection").checked; if (document.getElementById("bandwagon-settings").instantApply) { @@ -217,63 +227,211 @@ Bandwagon.Controller.Settings.doSaveFeed = function() } } -Bandwagon.Controller.Settings._repopulateFeedsList = function() +Bandwagon.Controller.Settings._repopulateCollectionsList = function() { // first clear the list - while (Bandwagon.Controller.Settings.elemBandwagonFeeds.hasChildNodes()) + while (Bandwagon.Controller.Settings.elemBandwagonCollections.hasChildNodes()) { - Bandwagon.Controller.Settings.elemBandwagonFeeds.removeChild(Bandwagon.Controller.Settings.elemBandwagonFeeds.firstChild); + Bandwagon.Controller.Settings.elemBandwagonCollections.removeChild(Bandwagon.Controller.Settings.elemBandwagonCollections.firstChild); } - // repopulate with feeds + // repopulate with collections - for (var id in bandwagonService.feeds) + for (var id in bandwagonService.collections) { - var feed = bandwagonService.feeds[id]; + var collection = bandwagonService.collections[id]; - if (feed == null) + if (collection == null) return; const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; - var elemBandwagonFeed = document.createElementNS(XULNS, "bandwagonFeed"); - elemBandwagonFeed.setAttribute("view", "settings"); + var elemBandwagonCollection = document.createElementNS(XULNS, "bandwagonCollection"); + elemBandwagonCollection.setAttribute("view", "settings"); - elemBandwagonFeed.feed = feed; - elemBandwagonFeed.controller = Bandwagon.Controller.Settings; + elemBandwagonCollection.collection = collection; + elemBandwagonCollection.controller = Bandwagon.Controller.Settings; - Bandwagon.Controller.Settings.elemBandwagonFeeds.appendChild(elemBandwagonFeed); + Bandwagon.Controller.Settings.elemBandwagonCollections.appendChild(elemBandwagonCollection); } - // create the local copy of the feeds hash with the properties we need + // create the local copy of the collections hash with the properties we need - Bandwagon.Controller.Settings.feeds = {}; + Bandwagon.Controller.Settings.collections = {}; - for (var id in bandwagonService.feeds) + for (var id in bandwagonService.collections) { - var feed = bandwagonService.feeds[id]; + var collection = bandwagonService.collections[id]; - Bandwagon.Controller.Settings.feeds[id] = + Bandwagon.Controller.Settings.collections[id] = { - name: feed.name, - url: feed.url, - updateInterval: feed.updateInterval, - showNotifications: feed.showNotifications, - feedItemsPerPage: feed.feedItemsPerPage, - autoPublish: feed.autoPublish + name: collection.name, + url: collection.resourceURL, + updateInterval: collection.updateInterval, + showNotifications: collection.showNotifications, + addonsPerPage: collection.addonsPerPage, + autoPublish: collection.autoPublish }; } } Bandwagon.Controller.Settings.bindingsReady = function() { - var elemBandwagonFeed = Bandwagon.Controller.Settings.elemBandwagonFeeds.getElementsByTagName("bandwagonFeed")[0]; + var elemBandwagonCollection = Bandwagon.Controller.Settings.elemBandwagonCollections.getElementsByTagName("bandwagonCollection")[0]; + + if (elemBandwagonCollection) + { + Bandwagon.Controller.Settings.elemBandwagonCollections.selectItem(elemBandwagonCollection); + Bandwagon.Controller.Settings.elemBandwagonCollections.focus(); + } +} + +/* Startup check */ +Bandwagon.Controller.Settings.LoginCheck = function() +{ + var isLoggedIn = false; // XX TODO + var loginEmail = "me@example.com"; // XX TODO + var textNode = document.getElementById("login-status-text"); + if (isLoggedIn) + { + document.getElementById("login-button").collapsed = true; + document.getElementById("logout-button").removeAttribute("collapsed"); + textNode.value = Bandwagon.Controller.Settings.stringBundle.getFormattedString("login.status", [loginEmail]); + } + else + { + textNode.value = Bandwagon.Controller.Settings.stringBundle.getString("logout.status");; + } +} + +Bandwagon.Controller.Settings.doLogin = function() +{ + // XX TODO +} + +Bandwagon.Controller.Settings.doLogout = function() +{ + // XX TODO +} + +/* Startup check */ +Bandwagon.Controller.Settings.AutoCheck = function() +{ + var hasAuto = false; // XX TODO + if (hasAuto) + { + document.getElementById("auto-create-button").collapsed = true; + document.getElementById("auto-delete-button").removeAttribute("collapsed"); + } + else + { + } +} + +Bandwagon.Controller.Settings.doAutoCreate = function() +{ + // check form + document.getElementById("auto-error").value = ""; + document.getElementById("auto-error").collapsed = true; + + var collectionName = document.getElementById("auto-name").value; - if (elemBandwagonFeed) + if (!collectionName || collectionName == "") { - Bandwagon.Controller.Settings.elemBandwagonFeeds.selectItem(elemBandwagonFeed); - Bandwagon.Controller.Settings.elemBandwagonFeeds.focus(); + document.getElementById("auto-error").value = Bandwagon.Controller.Settings.stringBundle.getFormattedString("auto.invalid.name", [collectionName]); + document.getElementById("auto-error").collapsed = false; + return; + } + + var autoPublishExtensions = document.getElementById("auto-type-extensions").checked; + var autoPublishThemes = document.getElementById("auto-type-themes").checked; + var autoPublishDicts = document.getElementById("auto-type-dicts").checked; + var autoPublishLangPacks = document.getElementById("auto-type-langpacks").checked; + + if (!autoPublishExtensions && !autoPublishThemes && !autoPublishDicts && !autoPublishLangPacks) + { + document.getElementById("auto-error").value = Bandwagon.Controller.Settings.stringBundle.getString("auto.please.select.type"); + document.getElementById("auto-error").collapsed = false; + return; + } + + // disable ui settings, show throbber + + var toggleUIEnabledState = function(on) + { + document.getElementById("auto-create-button").disabled = on; + document.getElementById("auto-name").disabled = on; + document.getElementById("auto-list").disabled = on; + document.getElementById("auto-type-extensions").disabled = on; + document.getElementById("auto-type-themes").disabled = on; + document.getElementById("auto-type-dicts").disabled = on; + document.getElementById("auto-type-langpacks").disabled = on; + document.getElementById("auto-spinner").collapsed = !on; + } + + toggleUIEnabledState(true); + + // create the collection object + + var collection = new Bandwagon.Model.Collection(); + + collection.name = collectionName; + collection.description = collectionName; // nothing better to put here - api demands it + collection.listed = document.getElementById("auto-list").checked; + collection.writable = true; + collection.autoPublish = true; + collection.showNotifications = false; + collection.updateInterval = 60 * 60 * 24; + collection.addonsPerPage = Bandwagon.DEFAULT_ADDONS_PER_PAGE; + collection.status = collection.STATUS_NEW; + + collection.autoPublishExtensions = autoPublishExtensions; + collection.autoPublishThemes = autoPublishThemes; + collection.autoPublishDicts = autoPublishDicts; + collection.autoPublishLangPacks = autoPublishLangPacks; + + // send the api call + + var newCollectionCallback = function(event) + { + if (event.isError()) + { + document.getElementById("auto-error").value = Bandwagon.Controller.Settings.stringBundle.getString("auto.internal.error"); + document.getElementById("auto-error").collapsed = false; + toggleUIEnabledState(false); + } + else + { + // on callback of above, refresh collection list + //bandwagonService.forceCheckAllForUpdatesAndUpdateCollectionsList(); + + // on callback of above, tell user we're done + document.getElementById("auto-error").style.color = 'green'; + document.getElementById("auto-error").value = Bandwagon.Controller.Settings.stringBundle.getString("auto.done"); + document.getElementById("auto-error").collapsed = false; + + // clean-up + document.getElementById("auto-create-button").collapsed = true; + document.getElementById("auto-delete-button").collapsed = false; + document.getElementById("auto-spinner").collapsed = true; + } } + + bandwagonService.newCollection(collection, newCollectionCallback); +} + +Bandwagon.Controller.Settings.doAutoDelete = function() +{ + // XX TODO +} + +/* Startup check */ +Bandwagon.Controller.Settings.EmailsCheck = function() +{ + var numEmails = 0; // XX TODO + var textNode = document.getElementById("clear-emails-text"); + textNode.value = Bandwagon.Controller.Settings.stringBundle.getFormattedString("saved.emails.text", [numEmails]); + document.getElementById("clear-emails-button").disabled = (numEmails <= 0); } Bandwagon.Controller.Settings.doAccept = function() @@ -282,27 +440,27 @@ Bandwagon.Controller.Settings.doAccept = function() // called: // - when user clicks 'Ok' (on systems that show the ok button) - // - when user changes feed properties (on systems that don't show buttons) + // - when user changes collection properties (on systems that don't show buttons) - // copy the locally update settings over the global feed settings + // copy the locally update settings over the global collection settings - for (var id in Bandwagon.Controller.Settings.feeds) + for (var id in Bandwagon.Controller.Settings.collections) { - var localFeed = Bandwagon.Controller.Settings.feeds[id]; - var bwFeed = bandwagonService.feeds[id]; + var localCollection = Bandwagon.Controller.Settings.collections[id]; + var bwCollection = bandwagonService.collections[id]; - if (!localFeed || !bwFeed) + if (!localCollection || !bwCollection) continue; - if (bwFeed.feedItemsPerPage != localFeed.feedItemsPerPage) + if (bwCollection.addonsPerPage != localCollection.addonsPerPage) { - bwFeed.feedItemsPerPage = localFeed.feedItemsPerPage; - Bandwagon.Preferences.notifyObservers("feeditemsperpage:" + bwFeed.url); + bwCollection.addonsPerPage = localCollection.addonsPerPage; + Bandwagon.Preferences.notifyObservers("addonsperpage:" + bwCollection.resourceURL); } - bwFeed.updateInterval = localFeed.updateInterval; - bwFeed.showNotifications = localFeed.showNotifications; - bwFeed.autoPublish = localFeed.autoPublish; + bwCollection.updateInterval = localCollection.updateInterval; + bwCollection.showNotifications = localCollection.showNotifications; + bwCollection.autoPublish = localCollection.autoPublish; } } @@ -314,30 +472,35 @@ Bandwagon.Controller.Settings.doCancel = function() Bandwagon.Controller.Settings.doChangePassword = function() { // TODO + + alert('TBD'); } +/** OBSOLETE Bandwagon.Controller.Settings.doAdd = function() { var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] .getService(Components.interfaces.nsIPromptService); - var promptTitle = Bandwagon.Controller.Settings.stringBundle.getString("add.feed"); - var promptMsg = Bandwagon.Controller.Settings.stringBundle.getString("enter.url.to.add.feed"); + var promptTitle = Bandwagon.Controller.Settings.stringBundle.getString("add.collection"); + var promptMsg = Bandwagon.Controller.Settings.stringBundle.getString("enter.url.to.add.collection"); var input = {value: "http://"}; var check = {value: false}; var proceed = prompts.prompt(window, promptTitle, promptMsg, input, null, check); if (proceed) { - bandwagonService.addPreviewFeed(input.value); + bandwagonService.addPreviewCollection(input.value); } } +*/ +/** OBSOLETE XX Brian, er, I think not, see Remove Subscription button Bandwagon.Controller.Settings.doRemove = function() { - var feed = Bandwagon.Controller.Settings.elemBandwagonFeeds.selectedItem.feed; + var collection = Bandwagon.Controller.Settings.elemBandwagonCollections.selectedItem.collection; - if (feed == null) + if (collection == null) return; var promptService; @@ -348,8 +511,8 @@ Bandwagon.Controller.Settings.doRemove = function() promptService = promptService.QueryInterface(Components.interfaces.nsIPromptService); } catch (e) { return; } - var promptTitle = Bandwagon.Controller.Settings.stringBundle.getString("remove.feed"); - var promptMsg = Bandwagon.Controller.Settings.stringBundle.getFormattedString("are.you.sure.you.want.to.remove", [(feed.name?feed.name:feed.url)]); + var promptTitle = Bandwagon.Controller.Settings.stringBundle.getString("remove.collection"); + var promptMsg = Bandwagon.Controller.Settings.stringBundle.getFormattedString("are.you.sure.you.want.to.remove", [(collection.name?collection.name:collection.resourceURL)]); var proceed = promptService.confirm( window, promptTitle, @@ -360,27 +523,41 @@ Bandwagon.Controller.Settings.doRemove = function() { // TODO for non-instant-apply dialogs, should we wait until 'Ok' is clicked before removal? - bandwagonService.deleteFeed(feed); + bandwagonService.deleteCollection(collection); - if (!feed.preview) - bandwagonService.unsubscribe(feed); + if (!collection.preview) + bandwagonService.unsubscribe(collection); } } +*/ + +/* See above */ +Bandwagon.Controller.Settings.doRemove = function() +{ + alert("TBD!"); +} Bandwagon.Controller.Settings.doUpdateIntervalScopeChange = function(event) { - document.getElementById("extensions.bandwagon.updateall.interval").value = document.getElementById("textbox-updateinterval-quantity").valueNumber; - document.getElementById("extensions.bandwagon.updateall.units").value = document.getElementById("menulist-updateinterval-units").selectedIndex + 1; - document.getElementById("extensions.bandwagon.updateall.enabled").value = (document.getElementById("checkbox-updateinterval-perfeed").checked && document.getElementById("checkbox-updateinterval-global").checked); + if (document.getElementById("updates-group").selectedIndex == 0) // Use default + { + document.getElementById("extensions.bandwagon.updateall.interval").value = document.getElementById("textbox-updateinterval-quantity").valueNumber; + document.getElementById("extensions.bandwagon.updateall.units").value = document.getElementById("menulist-updateinterval-units").selectedIndex + 1; + } + else + { + // Not sure if anything needs to be done here + } + document.getElementById("extensions.bandwagon.updateall.enabled").value = (document.getElementById("updates-group").selectedIndex == 0); - Bandwagon.Controller.Settings.doShowFeed(); + Bandwagon.Controller.Settings.doShowCollection(); } Bandwagon.Controller.Settings.doShowNotificationsScopeChange = function(event) { - document.getElementById("extensions.bandwagon.notifyall.enabled").value = (document.getElementById("checkbox-shownotifications-perfeed").checked && document.getElementById("checkbox-shownotifications-global").checked); + document.getElementById("extensions.bandwagon.notifyall.enabled").value = (document.getElementById("notifications-group").selectedIndex == 0); - Bandwagon.Controller.Settings.doShowFeed(); + Bandwagon.Controller.Settings.doShowCollection(); } |