diff --git a/src/chrome/content/options.js b/src/chrome/content/options.js index 008be0a..8e06ee3 100644 --- a/src/chrome/content/options.js +++ b/src/chrome/content/options.js @@ -1,5 +1,13 @@ /* -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* FIXME: instantApply pref defaults to false on Windows. But the Firetray pref +window was originaly crafted for instantApply platforms: some UI changes do +also change prefs programmaticaly. For a consistant behaviour across all +instantApply cases, we should probably not set prefs dynamically, that is leave +it all to the UI. See: +http://forums.mozillazine.org/viewtopic.php?f=19&t=2743643 +https://groups.google.com/forum/#!topic/mozilla.dev.extensions/SBGIogdIiwE */ + const Cc = Components.classes; const Ci = Components.interfaces; const Cu = Components.utils; @@ -15,7 +23,6 @@ const TREELEVEL_EXCLUDED_ACCOUNTS = 1; const PREF_DEFAULT_PANE = "pref-pane-windows"; - let log = firetray.Logging.getLogger("firetray.UIOptions"); var firetrayUIOptions = { @@ -23,6 +30,7 @@ var firetrayUIOptions = { prefwindow: null, onLoad: function(e) { + log.debug("FULL FEATURED="+firetray.Handler.support['full_feat']); this.strings = document.getElementById("firetray-options-strings"); this.prefwindow = document.getElementById("firetray-preferences"); if (!this.prefwindow) @@ -40,15 +48,20 @@ var firetrayUIOptions = { FIRETRAY_CHAT_SUPPORTED_OS.indexOf(firetray.Handler.runtimeOS) > -1) { Cu.import("resource://firetray/"+firetray.Handler.runtimeOS+"/FiretrayChat.jsm"); this.initChatControls(); - } else - this.hidePrefPane("pref-pane-chat"); + } else { + this.hidePrefPane("pref-pane-chat"); + }; this.updateWindowAndIconOptions(); this.updateScrollOptions(); this.initAppIconType(); - this.initAppIconNames(); - if (firetray.Handler.inMailApp) - this.initNewMailIconNames(); + if (firetray.Handler.support['full_feat']) { + this.initAppIconNames(); + if (firetray.Handler.inMailApp) + this.initNewMailIconNames(); + } else { + this.hideUnsupportedOptions(); + }; window.sizeToContent(); }, @@ -74,6 +87,28 @@ var firetrayUIOptions = { } }, + hideUnsupportedOptions: function() { // full_feat + // windows prefs + ['ui_hides_last_only', 'ui_start_hidden', 'ui_show_activates', + 'ui_remember_desktop'].forEach(function(id){ + document.getElementById(id).hidden = true; + }); + + // icon prefs + ['app_icon_default', 'ui_show_icon_on_hide', 'ui_scroll_hides', + 'ui_radiogroup_scroll'].forEach(function(id){ + document.getElementById(id).hidden = true; + }); + document.getElementById("ui_scroll_hides").setAttribute("oncommand", void(0)); + + // mail prefs + document.getElementById("newmail_icon_names").hidden = true; + for (let i=1; i<4; ++i) { + document.getElementById("radio_mail_notification_newmail_icon_name"+i). + setAttribute("observes", void(0)); + } + }, + hidePrefPane: function(name){ let radio = document.getAnonymousElementByAttribute(this.prefwindow, "pane", name); if (radio.selected) @@ -81,8 +116,10 @@ var firetrayUIOptions = { radio.hidden = true; }, - hideElement: function(targetNode, hiddenval) { - targetNode.hidden = hiddenval; + hideChildren: function(group, hiddenval) { + let children = group.childNodes; + for (let i=0, len=children.length; i -1; + this.support['full_feat'] = FIRETRAY_FULL_FEAT_SUPPORTED_OS + .indexOf(firetray.Handler.runtimeOS) > -1; + if (this.appId === FIRETRAY_APP_DB['thunderbird']['id'] || this.appId === FIRETRAY_APP_DB['seamonkey']['id']) this.inMailApp = true; @@ -113,7 +119,7 @@ firetray.Handler = { let chatIsProvided = this.isChatProvided(); log.info('isChatProvided='+chatIsProvided); if (chatIsProvided) { - if (this.isChatSupported()) { + if (this.support['chat']) { Cu.import("resource://firetray/FiretrayMessaging.jsm"); // needed for existsChatAccount Cu.import("resource://firetray/"+this.runtimeOS+"/FiretrayChat.jsm"); firetray.Utils.addObservers(firetray.Handler, [ @@ -163,7 +169,7 @@ firetray.Handler = { shutdown: function() { log.debug("Disabling Handler"); - if (firetray.Handler.isChatProvided() && firetray.Handler.isChatSupported() + if (firetray.Handler.isChatProvided() && firetray.Handler.support['chat'] && firetray.Chat.initialized) firetray.Chat.shutdown(); @@ -192,10 +198,6 @@ firetray.Handler = { return this.appHasChat && Services.prefs.getBoolPref("mail.chat.enabled"); }, - isChatSupported: function() { - return FIRETRAY_CHAT_SUPPORTED_OS.indexOf(this.runtimeOS) > -1; - }, - tryCloseLibs: function() { try { for (let libName in this.ctypesLibs) { @@ -575,7 +577,7 @@ firetray.MailChatPrefListener = new PrefListener( let enableChatCond = (firetray.Handler.appHasChat && firetray.Utils.prefService.getBoolPref("chat_icon_enable") && - firetray.Handler.isChatSupported()); + firetray.Handler.support['chat']); if (!enableChatCond) return; if (Services.prefs.getBoolPref("mail.chat.enabled")) { diff --git a/src/modules/commons.js b/src/modules/commons.js index cd49ad8..c0f3f1f 100644 --- a/src/modules/commons.js +++ b/src/modules/commons.js @@ -4,8 +4,9 @@ automatically provided by this module */ var EXPORTED_SYMBOLS = [ "firetray", "FIRETRAY_VERSION", "FIRETRAY_SUPPORTED_OS", - "FIRETRAY_CHAT_SUPPORTED_OS", "FIRETRAY_ID", "FIRETRAY_PREF_BRANCH", - "FIRETRAY_SPLASH_PAGE", "FIRETRAY_APPLICATION_ICON_TYPE_THEMED", + "FIRETRAY_CHAT_SUPPORTED_OS", "FIRETRAY_FULL_FEAT_SUPPORTED_OS", + "FIRETRAY_ID", "FIRETRAY_PREF_BRANCH", "FIRETRAY_SPLASH_PAGE", + "FIRETRAY_APPLICATION_ICON_TYPE_THEMED", "FIRETRAY_APPLICATION_ICON_TYPE_CUSTOM", "FIRETRAY_NOTIFICATION_MESSAGE_COUNT", "FIRETRAY_NOTIFICATION_NEWMAIL_ICON", "FIRETRAY_NOTIFICATION_CUSTOM_ICON", @@ -26,6 +27,7 @@ Cu.import("resource://firetray/logging.jsm"); const FIRETRAY_VERSION = "0.4.99"; // needed for sync call of onVersionChange() :( const FIRETRAY_SUPPORTED_OS = ['linux', 'winnt']; // install.rdf sync :( const FIRETRAY_CHAT_SUPPORTED_OS = ['linux']; +const FIRETRAY_FULL_FEAT_SUPPORTED_OS = FIRETRAY_CHAT_SUPPORTED_OS; const FIRETRAY_ID = "{9533f794-00b4-4354-aa15-c2bbda6989f8}"; const FIRETRAY_PREF_BRANCH = "extensions.firetray."; const FIRETRAY_SPLASH_PAGE = "http://foudfou.github.com/FireTray/"; diff --git a/src/modules/ctypes/winnt/win32.jsm b/src/modules/ctypes/winnt/win32.jsm index dc71e30..4a0610e 100644 --- a/src/modules/ctypes/winnt/win32.jsm +++ b/src/modules/ctypes/winnt/win32.jsm @@ -15,6 +15,8 @@ var win32 = new function() { 'XP': 51, // 2001 '2K': 50, // 2000 }; + // could also parse Cc["@mozilla.org/network/protocol;1?name=http"]. + // getService(Ci.nsIHttpProtocolHandler).oscpu this.WINVER = null; // initialized in kernel32.jsm this.BOOL = ctypes.bool;