Bug 1599010 - Clean up displayed folder if the last account is removed; r=mkmelin DONTBUILD
authorGeoff Lankow <geoff@darktrojan.net>
Mon, 25 Nov 2019 21:20:14 +1300
changeset 37600 f6af99c9ff9d90f6086e77addd21ba425ce6ac9b
parent 37599 39ed67f1df1f558ef4e5f2382b24ad6859db7171
child 37601 8ec25287b8814365572429a76daba6000b1dc855
push id396
push userclokep@gmail.com
push dateMon, 06 Jan 2020 23:11:57 +0000
reviewersmkmelin
bugs1599010
Bug 1599010 - Clean up displayed folder if the last account is removed; r=mkmelin DONTBUILD
mail/base/content/folderPane.js
--- a/mail/base/content/folderPane.js
+++ b/mail/base/content/folderPane.js
@@ -2501,43 +2501,47 @@ var gFolderTreeView = {
       if (newChild._folder.getFlag(Ci.nsMsgFolderFlags.SpecialUse)) {
         this._toggleRow(parentIndex, false);
         return;
       }
     }
     this._addChildToView(parent, parentIndex, newChild);
   },
 
-  OnItemRemoved(aRDFParentItem, aItem) {
+  OnItemRemoved(aParentItem, aItem) {
     if (!(aItem instanceof Ci.nsIMsgFolder)) {
       return;
     }
 
     this._persistItemClosed(aItem.URI);
 
     let index = this.getIndexOfFolder(aItem);
     if (index == null) {
       return;
     }
     // forget our parent's children; they'll get rebuilt
-    if (aRDFParentItem && this._rowMap[index]._parent) {
+    if (aParentItem && this._rowMap[index]._parent) {
       this._rowMap[index]._parent._children = null;
     }
     let kidCount = 1;
     let walker = Number(index) + 1;
     while (
       walker < this.rowCount &&
       this._rowMap[walker].level > this._rowMap[index].level
     ) {
       walker++;
       kidCount++;
     }
     this._rowMap.splice(index, kidCount);
     this._tree.rowCountChanged(index, -1 * kidCount);
     this._tree.invalidateRow(index);
+
+    if (aParentItem === null && MailServices.accounts.accounts.length === 0) {
+      gFolderDisplay.show();
+    }
   },
 
   OnItemPropertyChanged(aItem, aProperty, aOld, aNew) {},
   OnItemIntPropertyChanged(aItem, aProperty, aOld, aNew) {
     // First try mode specific handling of the changed property.
     if (
       this._modes[this.mode].handleChangedIntProperty(
         aItem,