Changeset c28279


Ignore:
Timestamp:
Apr 8, 2008, 9:44:48 PM (14 years ago)
Author:
rene <rene@…>
Branches:
master
Children:
189e89
Parents:
2c362b
Message:

changed upgrade-dialog, more flexible for different upgrade-steps

Location:
chrome/content/v_identity
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • chrome/content/v_identity/vI_upgrade.js

    r2c362b rc28279  
    3131        document.documentElement.getButton("cancel").setAttribute("hidden", "true")
    3232        vI_notificationBar.dump("") // this initialises the debug-area
     33        vI_rdfDatasource.init(); // just to be sure that Datasource is initialised
     34        vI_upgrade.skipUpgradePages(); // skip obsolete upgrade Pages
     35    },
     36       
     37    skipUpgradePages : function() {
     38        var preUpdateWizardPage = document.getElementById("license")       
     39        var versionChecker = Components.classes["@mozilla.org/xpcom/version-comparator;1"]
     40            .getService(Components.interfaces.nsIVersionComparator);
     41        // if former version of extension was at least 0.5.0, start with WizardPage 0.5.2
     42        if (versionChecker.compare(vI_rdfDatasource.getCurrentExtFileVersion(), "0.5.0") >= 0)
     43            preUpdateWizardPage.setAttribute("next", "upgrade")
    3344    },
    3445   
     
    3849    },
    3950   
    40     step1 : function() {
     51    upgrade : function() {
    4152        vI_notificationBar.dump("starting upgrade.\n\n")
    4253        document.getElementById("upgradeWizard").setAttribute("canAdvance", "false")
    4354        document.documentElement.getButton('next').setAttribute('disabled','true');
    44         vI_rdfDatasource.init(); // just to be sure that Datasource is initialised
     55       
    4556        if (vI_rdfDatasource.extUpgrade()) vI_upgrade.extUpgrade();
    4657        if (vI_rdfDatasource.rdfUpgradeRequired()) vI_upgrade.rdfUpgrade();
     58       
    4759        vI_account.cleanupSystem();
     60       
    4861        vI_notificationBar.dump("\n\nupgrade finished.\n");
     62       
    4963        document.documentElement.getButton('next').setAttribute('disabled','false');
    5064        document.getElementById("upgradeWizard").setAttribute("canAdvance", "true")
     
    6074        vI_notificationBar.dump("rdf-upgrade to " + vI_rdfDatasource.getCurrentRDFFileVersion() + " done.\n\n");
    6175    },
    62 
    63     removeObsoleteUserPrefs : function() {
     76   
     77    extUpgrade : function() {
     78        vI_notificationBar.dump("checking for previous version, found " +
     79            vI_rdfDatasource.getCurrentExtFileVersion() + "\nextension-upgrade required.\n")
     80        switch (vI_rdfDatasource.getCurrentExtFileVersion()) {
     81            case null:
     82                vI_upgrade.__transferAllVIdentityABookToRDF();
     83                vI_upgrade.__removeObsoleteUserPrefs();
     84        }
     85        vI_rdfDatasource.storeExtVersion();
     86        vI_notificationBar.dump("extension-upgrade to " + vI_rdfDatasource.getCurrentExtFileVersion() + " done.\n\n");
     87    },
     88       
     89    __removeObsoleteUserPrefs : function() {
    6490        // remove obsolete preference-tree virtualIdentity
    6591       
     
    75101        vI_notificationBar.dump("done.\n")
    76102    },
    77    
    78     extUpgrade : function() {
    79         vI_notificationBar.dump("checking for previous version, found " +
    80             vI_rdfDatasource.getCurrentExtFileVersion() + "\nextension-upgrade required.\n")
    81         switch (vI_rdfDatasource.getCurrentExtFileVersion()) {
    82             case null:
    83                 vI_upgrade.transferVIdentityABookToRDF();
    84                 vI_upgrade.removeObsoleteUserPrefs();
    85         }
    86         vI_rdfDatasource.storeExtVersion();
    87         vI_notificationBar.dump("extension-upgrade to " + vI_rdfDatasource.getCurrentExtFileVersion() + " done.\n\n");
    88     },
    89        
     103
    90104    CardFields : Array("Custom1", "Custom2", "Custom3", "Custom4", "Notes"),
    91105    // --------------------------------------------------------------------
    92106    // remove all VirtualIdentity-related Information from the AddressBook
    93107    // and transfer it to the RDF File.
    94     transferVIdentityABookToRDF : function() {
     108    __transferAllVIdentityABookToRDF : function() {
    95109        var returnVar = { prop : null, counter : 0, warning : true }
    96110        for each (returnVar.prop in vI_upgrade.CardFields) {
     
    120134        if ( info && info[1] ) smtp = info[1];
    121135       
    122         var splitted = vI_upgrade.parseAddress(newFullEmail);
     136        var splitted = vI_upgrade.__parseAddress(newFullEmail);
    123137        //~ alert(splitted.email + "++" + splitted.name + "++" + splitted.combinedName)
    124138       
    125         vI_rdfDatasource.updateRDF(vI_storage.__combineNames(Card.displayName, Card.primaryEmail),
     139        vI_rdfDatasource.updateRDF(vI_helper.combineNames(Card.displayName, Card.primaryEmail),
    126140                        "email", splitted.email, splitted.name, id, smtp)
    127141        if (Card.secondEmail.replace(/^\s+|\s+$/g,""))
    128             vI_rdfDatasource.updateRDF(vI_storage.__combineNames(Card.displayName, Card.secondEmail),
     142            vI_rdfDatasource.updateRDF(vI_helper.combineNames(Card.displayName, Card.secondEmail),
    129143                    "email", splitted.email, splitted.name, id, smtp)
    130144       
     
    135149    },
    136150   
    137     // by now in vI, not accessible from here. Best change all references to vI.helper.
    138     parseAddress : function(address) {
     151    // by now in vI, not accessible from here. Best change all references to vI_helper.
     152    __parseAddress : function(address) {
    139153        //~ vI_notificationBar.dump("## v_identity: getAddress: parsing '" + address + "'\n")
    140154        var name = ""; email = "";
  • chrome/content/v_identity/vI_upgrade.xul

    r2c362b rc28279  
    5050   
    5151    <wizardpage onpageshow="vI_upgrade.adaptButtons();vI_htmlTextBox.init('vITextBox.intro', 'vident.intro');"
    52         label="&vident.upgrade.intro.label;" description="&vident.upgrade.intro.description;" >
     52        label="&vident.upgrade.intro.label;" description="&vident.upgrade.intro.description;"
     53        pageid="intro" next="features" >
    5354        <groupbox>
    5455            <caption label="&vident.upgrade.intro.caption;"/>
     
    5657        </groupbox>
    5758    </wizardpage>
     59    <!-- features -->
    5860    <wizardpage onpageshow="vI_upgrade.adaptButtons();vI_htmlTextBox.init('vITextBox.features', 'vident.features');"
    59         label="&vident.upgrade.features.label;" description="&vident.upgrade.features.description;" >
     61        label="&vident.upgrade.features.label;" description="&vident.upgrade.features.description;"
     62        pageid="features" next="license" >
    6063        <groupbox>
    6164            <caption label="&vident.upgrade.features.caption;"/>
     
    6366        </groupbox>
    6467    </wizardpage>
     68    <!-- GPL license -->
    6569    <wizardpage onpageshow="vI_upgrade.adaptButtons();vI_htmlTextBox.init('vITextBox.license', 'vident.license');"
    66         label="&vident.upgrade.license.label;" description="&vident.upgrade.license.description;" >
     70        label="&vident.upgrade.license.label;" description="&vident.upgrade.license.description;"
     71        id="license" pageid="license" next="0.5.0" >
    6772        <groupbox>
    6873            <caption label="&vident.upgrade.license.caption;"/>
     
    7075        </groupbox>
    7176    </wizardpage>
    72     <wizardpage onpageshow="vI_upgrade.adaptButtons();vI_htmlTextBox.init('vITextBox.upgrade1', 'vident.upgrade1');"
    73         label="&vident.upgrade.upgrade1.label;" description="&vident.upgrade.upgrade1.description;" >
     77    <!-- upgrade information -->
     78    <!-- 0.5.0 -->
     79    <wizardpage onpageshow="vI_upgrade.adaptButtons();vI_htmlTextBox.init('vITextBox.0.5.0', 'vident.0.5.0');"
     80        label="&vident.upgrade.0.5.0.label;" description="&vident.upgrade.0.5.0.description;"
     81        pageid="0.5.0" next="upgrade" >
    7482        <groupbox>
    75             <caption label="&vident.upgrade.upgrade1.caption;"/>
    76             <browser id="vITextBox.upgrade1" disablehistory="true" />
     83            <caption label="&vident.upgrade.0.5.0.caption;"/>
     84            <browser id="vITextBox.0.5.0" disablehistory="true" />
    7785        </groupbox>
    7886    </wizardpage>
    79     <wizardpage onpageshow="vI_upgrade.adaptButtons();vI_upgrade.init();vI_upgrade.step1();"
    80         label="&vident.upgrade.upgrade2.label;" description="&vident.upgrade.upgrade2.description;" >
     87    <!-- 0.5.3 -->
     88<!--    <wizardpage onpageshow="vI_upgrade.adaptButtons();vI_htmlTextBox.init('vITextBox.0.5.3', 'vident.0.5.3');"
     89        label="&vident.upgrade.0.5.3.label;" description="&vident.upgrade.0.5.3.description;"
     90        pageid="0.5.3" next="upgrade" >
    8191        <groupbox>
    82             <caption label="&vident.upgrade.upgrade2.caption;"/>
     92            <caption label="&vident.upgrade.0.5.3.caption;"/>
     93            <browser id="vITextBox.0.5.3" disablehistory="true" />
     94        </groupbox>
     95    </wizardpage>   
     96-->
     97    <!-- upgrade procedure -->
     98    <wizardpage onpageshow="vI_upgrade.adaptButtons();vI_upgrade.upgrade();"
     99        label="&vident.upgrade.upgrade.label;" description="&vident.upgrade.upgrade.description;"
     100        pageid="upgrade" next="finish" >
     101        <groupbox>
     102            <caption label="&vident.upgrade.upgrade.caption;"/>
    83103            <textbox id="vIDebugBox" upgrade="true" multiline="true" readonly="true" />
    84104        </groupbox>
    85     </wizardpage>
    86     <wizardpage onpageshow="vI_upgrade.adaptButtons();vI_htmlTextBox.init('vITextBox.upgrade3', 'vident.upgrade3');"
    87         label="&vident.upgrade.upgrade3.label;" description="&vident.upgrade.upgrade3.description;" >
     105    </wizardpage>   
     106    <!-- finish -->
     107    <wizardpage onpageshow="vI_upgrade.adaptButtons();vI_htmlTextBox.init('vITextBox.finish', 'vident.finish');"
     108        label="&vident.upgrade.finish.label;" description="&vident.upgrade.finish.description;"
     109        pageid="finish" >
    88110        <groupbox>
    89             <caption label="&vident.upgrade.upgrade3.caption;"/>
    90             <browser id="vITextBox.upgrade3" disablehistory="true" />
     111            <caption label="&vident.upgrade.finish.caption;"/>
     112            <browser id="vITextBox.finish" disablehistory="true" />
    91113        </groupbox>
    92114    </wizardpage>   
  • chrome/content/v_identity/vI_upgradeOverlay.js

    r2c362b rc28279  
    3030                "chrome, dialog, modal, alwaysRaised, resizable=yes").focus();
    3131        else vI_account.cleanupSystem(); // always clean leftover accounts and directories
    32 
    3332    }
    3433}
Note: See TracChangeset for help on using the changeset viewer.