Changeset 99ced4


Ignore:
Timestamp:
Nov 23, 2011, 11:40:21 AM (8 years ago)
Author:
rene <rene@…>
Branches:
ng_0.9
Children:
f29419
Parents:
c9f1d7
Message:

moved upgrade-code to general overlay

Files:
2 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • chrome.manifest

    rc9f1d7 r99ced4  
    1313overlay chrome://messenger/content/messenger.xul                chrome://v_identity/content/vI_overlay.xul
    1414overlay chrome://messenger/content/messenger.xul                chrome://v_identity/content/vI_context.xul
    15 overlay chrome://messenger/content/messenger.xul                chrome://v_identity/content/vI_upgradeOverlay.xul
    1615
    1716overlay chrome://messenger/content/messengercompose/messengercompose.xul    chrome://v_identity/content/v_identity.xul
  • content/vI_overlay.js

    rc9f1d7 r99ced4  
     1  /* ***** BEGIN LICENSE BLOCK *****
     2    This program is free software; you can redistribute it and/or modify
     3    it under the terms of the GNU General Public License as published by
     4    the Free Software Foundation; either version 2 of the License, or
     5    (at your option) any later version.
     6
     7    This program is distributed in the hope that it will be useful,
     8    but WITHOUT ANY WARRANTY; without even the implied warranty of
     9    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     10    GNU General Public License for more details.
     11
     12    You should have received a copy of the GNU General Public License
     13    along with this program; if not, write to the Free Software
     14    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
     15
     16    The Original Code is the Virtual Identity Extension.
     17
     18    The Initial Developer of the Original Code is Rene Ejury.
     19    Portions created by the Initial Developer are Copyright (C) 2011
     20    the Initial Developer. All Rights Reserved.
     21
     22    Contributor(s):
     23 * ***** END LICENSE BLOCK ***** */
    124
    225Components.utils.import("resource://v_identity/vI_nameSpaceWrapper.js");
    326virtualIdentityExtension.ns(function() { with (virtualIdentityExtension.LIB) {
     27 
     28let Log = vI.setupLogging("virtualIdentity.overlay");
     29
     30Components.utils.import("resource://v_identity/vI_rdfDatasource.js", virtualIdentityExtension);
     31Components.utils.import("resource://v_identity/vI_account.js", virtualIdentityExtension);
     32Components.utils.import("resource://v_identity/vI_prefs.js", virtualIdentityExtension);
     33
     34Components.utils.import("resource://gre/modules/AddonManager.jsm"); 
     35
     36const virtualIdentity_ID="{dddd428e-5ac8-4a81-9f78-276c734f75b8}"
     37AddonManager.getAddonByID(virtualIdentity_ID, function(addon) {
     38  if (addon)
     39    vI.extensionVersion = addon.version;
     40});
     41
     42
     43function extensionInit() {
     44  Log.debug("init")
     45    var rdfDatasource = new vI.rdfDatasource("virtualIdentity.rdf", true);
     46    if (rdfDatasource.extUpgradeRequired()) {
     47        Log.debug("extension upgrade required")
     48        if (!vI.upgrade.quick_upgrade(rdfDatasource.getCurrentExtFileVersion())) {
     49            Log.debug("opening extension upgrade window")
     50            window.open("chrome://v_identity/content/vI_upgrade.xul",0,
     51                "chrome, dialog, modal, alwaysRaised, resizable=yes").focus();
     52        }
     53    }
     54    else {
     55        vI.vIaccount_cleanupSystem(); // always clean leftover accounts and directories
     56        rdfDatasource.storeExtVersion();
     57    }
     58    rdfDatasource.refreshAccountInfo();
     59    rdfDatasource.clean();
     60   
     61    if (vI.vIprefs.get("error_console")) {
     62        document.getElementById("virtualIdentityExtension_vIErrorBoxSplitter").removeAttribute("hidden");
     63        document.getElementById("virtualIdentityExtension_vIErrorBox").removeAttribute("hidden");
     64        document.getElementById("virtualIdentityExtension_vIErrorBox").setAttribute("class", "console-box");
     65        vI.prefroot.setBoolPref("javascript.options.showInConsole", true);
     66        vI.prefroot.setBoolPref("browser.dom.window.dump.enabled", true);
     67        vI.prefroot.setBoolPref("javascript.options.strict", true);
     68    }
     69}
     70
     71addEventListener('messagepane-loaded', extensionInit, true);
    472  // this is the entry place, nameSpaceWrapper is loaded and the show can start
    573  try {
  • content/vI_overlay.xul

    rc9f1d7 r99ced4  
    2525
    2626<overlay id="messengerWindow" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    27   <script type="application/x-javascript" src="chrome://v_identity/content/vI_overlay.js" />
     27    <script type="application/x-javascript" src="chrome://v_identity/content/vI_overlay.js" />
     28    <script type="application/x-javascript" src="chrome://v_identity/content/vI_upgrade.js" />
     29    <script type="application/x-javascript" src="chrome://v_identity/content/vI_storage.js" />
     30
     31    <vbox id="messagepanebox" >
     32        <splitter id="virtualIdentityExtension_vIErrorBoxSplitter" hidden="true" />
     33        <vbox id="virtualIdentityExtension_vIErrorBox" context="ConsoleContext" sortOrder="reverse" hidden="true" />
     34    </vbox>
    2835</overlay>
  • content/vI_upgrade.js

    rc9f1d7 r99ced4  
    5858        if (!currentVersion) return false;
    5959        currentVersion = currentVersion.split(/\./);
    60         var nextVersion = currentVersion[0] + "." + currentVersion[1] + "."
    61         if (currentVersion[2].match(/pre/))
     60        var nextVersion = currentVersion[0];
     61        if (currentVersion.length > 1)
     62          nextVersion += "." + currentVersion[1] + "."
     63        if (currentVersion.length > 2) {
     64          if (currentVersion[2].match(/pre/))
    6265            nextVersion += parseInt(currentVersion[2])
    63         else nextVersion += parseInt(currentVersion[2]) + 1
     66          else nextVersion += parseInt(currentVersion[2]) + 1
     67        }
     68        else
     69          nextVersion += "1"
    6470           
    65         let window = Cc['@mozilla.org/appshell/window-mediator;1']
    66             .getService(Ci.nsIWindowMediator)
    67             .getMostRecentWindow("mail:3pane");
    68         var extVersion = window.virtualIdentityExtension.extensionVersion;
    69        
    7071        // don't show the dialog if we do a one-step upgrade
    71         if (upgrade.versionChecker.compare(extVersion, nextVersion) <= 0) {
     72        if (upgrade.versionChecker.compare(vI.extensionVersion, nextVersion) <= 0) {
    7273            Log.debug("starting quick_upgrade.\n")
    7374            upgrade.__initRequirements();
Note: See TracChangeset for help on using the changeset viewer.