Changeset eacce6


Ignore:
Timestamp:
Nov 26, 2011, 10:30:19 PM (8 years ago)
Author:
rene <rene@…>
Branches:
ng_0.9
Children:
fe0698
Parents:
b467bf
Message:

removed big update-dialog, not required

Files:
15 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • content/vI_overlay.js

    rb467bf reacce6  
    4343function extensionInit() {
    4444  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     }
     45  vI.upgrade.quickUpgrade();
     46  vI.vIaccount_cleanupSystem(); // always clean leftover accounts and directories
     47 
     48  if (vI.vIprefs.get("error_console")) {
     49    document.getElementById("virtualIdentityExtension_vIErrorBoxSplitter").removeAttribute("hidden");
     50    document.getElementById("virtualIdentityExtension_vIErrorBox").removeAttribute("hidden");
     51    document.getElementById("virtualIdentityExtension_vIErrorBox").setAttribute("class", "console-box");
     52    vI.prefroot.setBoolPref("javascript.options.showInConsole", true);
     53    vI.prefroot.setBoolPref("browser.dom.window.dump.enabled", true);
     54    vI.prefroot.setBoolPref("javascript.options.strict", true);
     55  }
    6956}
    7057
    7158addEventListener('messagepane-loaded', extensionInit, true);
    72   // this is the entry place, nameSpaceWrapper is loaded and the show can start
    73   try {
    74     Components.utils.import("resource://v_identity/plugins/conversations.js", virtualIdentityExtension);
    75   } catch(e) {
    76     vI.dumpCallStack(e);
    77   }
     59// this is the entry place, nameSpaceWrapper is loaded and the show can start
     60try {
     61  Components.utils.import("resource://v_identity/plugins/conversations.js", virtualIdentityExtension);
     62} catch(e) {
     63  vI.dumpCallStack(e);
     64}
    7865
    7966
  • content/vI_upgrade.js

    rb467bf reacce6  
    3232
    3333var upgrade = {
    34     versionChecker : Components.classes["@mozilla.org/xpcom/version-comparator;1"]
    35             .getService(Components.interfaces.nsIVersionComparator),
    36    
     34    versionChecker : Components.classes["@mozilla.org/xpcom/version-comparator;1"]
     35      .getService(Components.interfaces.nsIVersionComparator),
     36                           
    3737    rdfDatasource : null,
    3838
    39     init : function() {
    40         upgrade.__initRequirements();
    41         document.documentElement.getButton("cancel").setAttribute("hidden", "true")
     39    quickUpgrade : function(currentVersion) {
     40      upgrade.rdfDatasource = new vI.rdfDatasource("virtualIdentity.rdf", true);
     41      if (upgrade.rdfDatasource.extUpgradeRequired())
     42        upgrade.extUpgrade();
     43      upgrade.rdfDatasource.refreshAccountInfo();
     44      upgrade.rdfDatasource.clean();
     45      return true;
    4246    },
    4347
    44     clean : function() {
    45         if (upgrade.rdfDatasource) upgrade.rdfDatasource.clean();
    46     },
    47 
    48     __initRequirements : function() {
    49         Log.debug("") // this initialises the debug-area
    50         upgrade.rdfDatasource = new vI.rdfDatasource("virtualIdentity.rdf", true);
    51     },
    52    
    53     // this function checks for the chance to ugrade without shoing the complete wizard
    54     // if so, perform the upgrade and return true
    55     // by default the wizard is not shown if it is a one-version-forward upgrade
    56     quick_upgrade : function(currentVersion) {
    57         // seamonkey doesn't have a extensionmanager, so read version of extension from hidden version-label
    58         if (!currentVersion) return false;
    59         currentVersion = currentVersion.split(/\./);
    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/))
    65             nextVersion += parseInt(currentVersion[2])
    66           else nextVersion += parseInt(currentVersion[2]) + 1
    67         }
    68         else
    69           nextVersion += "1"
    70            
    71         // don't show the dialog if we do a one-step upgrade
    72         if (upgrade.versionChecker.compare(vI.extensionVersion, nextVersion) <= 0) {
    73             Log.debug("starting quick_upgrade.\n")
    74             upgrade.__initRequirements();
    75             upgrade.__upgrade();
    76             return true;
    77         }
    78         return false;
    79     },
    80 
    81     prepare : function(elem) {
    82         document.documentElement.getButton('back').setAttribute('hidden','true');
    83         document.documentElement.getButton('next').focus();
    84         var pageid = elem.getAttribute("pageid");
    85         var browser = document.getElementById('virtualIdentityExtension_TextBox.' + pageid)
    86         if (browser)
    87             browser.outputString = Components.classes["@mozilla.org/intl/stringbundle;1"]
    88             .getService(Components.interfaces.nsIStringBundleService)
    89             .createBundle("chrome://v_identity/locale/vI_upgrade.properties")
    90             .GetStringFromName('vident.' + pageid);
    91     },
    92    
    93     __upgrade : function() {
    94         if (upgrade.rdfDatasource.extUpgradeRequired()) upgrade.extUpgrade();
    95        
    96         vI.vIaccount_cleanupSystem();
    97     },         
    98 
    99     upgrade : function() {
    100         Log.debug("starting upgrade.\n\n")
    101         document.getElementById("upgradeWizard").setAttribute("canAdvance", "false")
    102         document.documentElement.getButton('next').setAttribute('disabled','true');
    103        
    104         upgrade.__upgrade();
    105    
    106         Log.debug("\n\nupgrade finished.\n");
    107        
    108         document.documentElement.getButton('next').setAttribute('disabled','false');
    109         document.getElementById("upgradeWizard").setAttribute("canAdvance", "true")
    110     },
    111    
    112     extUpgrade : function() {
     48    extUpgrade : function() {
    11349        var currentVersion = upgrade.rdfDatasource.getCurrentExtFileVersion();
    11450        Log.debug("checking for previous version, found " +
     
    194130        }
    195131    },
    196 
    197     openURL : function(aURL) {
    198             var uri = Components.classes["@mozilla.org/network/standard-url;1"].createInstance(Components.interfaces.nsIURI);
    199             var protocolSvc = Components.classes["@mozilla.org/uriloader/external-protocol-service;1"].getService(Components.interfaces.nsIExternalProtocolService);
    200 
    201             uri.spec = aURL;
    202             protocolSvc.loadUrl(uri);
    203         }
    204132}
    205133vI.upgrade = upgrade;
    206 // start init only if wizard is shown, so it is done in vI_upgrade.xul
    207 // window.addEventListener('load', upgrade.init, true);
    208134}});
Note: See TracChangeset for help on using the changeset viewer.