Changeset 3c9c29


Ignore:
Timestamp:
Oct 31, 2014, 3:12:46 PM (7 years ago)
Author:
rene <rene@…>
Branches:
ng_0.9
Children:
509348
Parents:
45ce33
Message:

bugfix for unified folder view - increasing prefs.js

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • content/vI_upgrade.js

    r45ce33 r3c9c29  
    5757                upgrade.__removeObsoleteUserPrefs(currentVersion);
    5858                upgrade.__removeExtraAddedHeaders(currentVersion);
     59                upgrade.__cleanupSmartMailboxFolders(currentVersion);
    5960        }
    6061        upgrade.rdfDatasource.storeExtVersion();
    6162        Log.debug("extension-upgrade to " + upgrade.rdfDatasource.getCurrentExtFileVersion() + " done.");
    6263    },
     64   
     65    __cleanupSmartMailboxFolders : function(currentVersion) {
     66        if ((!currentVersion || upgrade.versionChecker.compare(currentVersion, "0.9.26") < 0)) {
     67            Log.debug("cleaning leftover 'smart mailboxes' == 'unified folder mailboxes'");
     68            // remove obsolete 'smart mailboxes'=='unified folder' server entries
     69            // this is only required because of a virtualIdentity bug introduced in 0.9.22 and fixed in 0.9.26
     70
     71            //  compare against all accounts, getAccountsArray() does not include 'smart mailboxes' == 'unified folders'
     72            var all_accounts = vI.prefroot.getCharPref("mail.accountmanager.accounts").split(",");
     73
     74            for each (let pref in vI.prefroot.getChildList("mail.server")) {
     75                if (pref.indexOf(".hostname") == pref.length - 9 && vI.prefroot.getCharPref(pref) == "smart mailboxes") {
     76                    // ok, smart mailbox server found, check if it still in use
     77                    let server = pref.replace(/^mail\.server\./,"").replace(/\.hostname$/,"");
     78                    let inUse = false;
     79                    for each (let account in all_accounts) {
     80                        if (vI.prefroot.getCharPref("mail.account." + account + ".server") == server)
     81                            inUse = true;
     82                    }
     83                    if (!inUse) {
     84                        Log.debug("cleaning leftover 'smart mailbox' for server " + server);
     85                        for each (let obsoletePref in vI.prefroot.getChildList("mail.server." + server)) {
     86                            if (obsoletePref.indexOf(".directory") == obsoletePref.length - 10) {
     87                                // remove obsolete 'smart mailbox' directory
     88                                try {
     89                                    let file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsIFile);
     90                                    file.initWithPath(vI.prefroot.getCharPref(obsoletePref));
     91                                    Log.debug("removing obsolete storage Folder " + vI.prefroot.getCharPref(obsoletePref));
     92                                    file.remove(true);
     93                                } catch (NS_ERROR_FILE_UNRECOGNIZED_PATH) { };
     94                            }
     95                            vI.prefroot.clearUserPref(obsoletePref);
     96                        }
     97                    }
     98                }
     99            }
     100        }
     101    },
    63102   
    64103    __removeExtraAddedHeaders : function(currentVersion) {
  • modules/vI_account.js

    r45ce33 r3c9c29  
    225225
    226226        //      account-prefs are not removed, grrrr --> https://bugzilla.mozilla.org/show_bug.cgi?id=875675
     227        //  compare against all accounts, getAccountsArray() does not include 'smart mailboxes' == 'unified folders'
     228        var all_accounts = prefroot.getCharPref("mail.accountmanager.accounts").split(",");
    227229        try {
    228230            var lastAccountKey = prefroot.getIntPref("mail.account.lastKey");
    229231            for (let key = 0; key <= lastAccountKey; key++) {
    230                 if (accounts.indexOf("account" + key) > -1) continue;
     232                if (all_accounts.indexOf("account" + key) > -1) continue;
    231233                account.__removeAccountPrefs("account" + key);
    232234            }
Note: See TracChangeset for help on using the changeset viewer.