From 7c28d45c8e9a448002595d26ca5cf88726b47123 Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <thomas@roundcube.net>
Date: Tue, 14 Jan 2014 12:19:16 -0500
Subject: [PATCH] Update class name in subscriptions folder list after saving folder properties

---
 program/js/app.js |   39 +++++++++++++++++++++++++++++----------
 1 files changed, 29 insertions(+), 10 deletions(-)

diff --git a/program/js/app.js b/program/js/app.js
index 2438ff9..3c54756 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -3607,16 +3607,18 @@
   {
     var rc;
 
-    if (!this.env.draft_id && id && (rc = this.opener())) {
-      // refresh the drafts folder in opener window
-      if (rc.env.task == 'mail' && rc.env.action == '' && rc.env.mailbox == this.env.drafts_mailbox)
-        rc.command('checkmail');
+    if (id && id != this.env.draft_id) {
+      if (rc = this.opener()) {
+        // refresh the drafts folder in opener window
+        if (rc.env.task == 'mail' && rc.env.action == '' && rc.env.mailbox == this.env.drafts_mailbox)
+          rc.command('checkmail');
+      }
+
+      this.env.draft_id = id;
+      $("input[name='_draft_saveid']").val(id);
+
+      this.remove_compose_data(this.env.compose_id);
     }
-
-    this.env.draft_id = id;
-    $("input[name='_draft_saveid']").val(id);
-
-    this.remove_compose_data(this.env.compose_id);
   };
 
   this.auto_save_start = function()
@@ -5046,6 +5048,7 @@
   {
     var key = 'G'+prop.source+prop.id;
     if (this.treelist.remove(key)) {
+      this.triggerEvent('group_delete', { source:prop.source, id:prop.id });
       delete this.env.contactfolders[key];
       delete this.env.contactgroups[key];
     }
@@ -5831,8 +5834,11 @@
   // replace an existing table row with a new folder line (with subfolders)
   this.replace_folder_row = function(oldfolder, newfolder, display_name, is_protected, class_name)
   {
-    if (!this.gui_objects.subscriptionlist)
+    if (!this.gui_objects.subscriptionlist) {
+      if (this.is_framed)
+        return parent.rcmail.replace_folder_row(oldfolder, newfolder, display_name, is_protected, class_name);
       return false;
+    }
 
     var i, n, len, name, dispname, oldrow, tmprow, row, level,
       tbody = this.gui_objects.subscriptionlist.tBodies[0],
@@ -5842,6 +5848,13 @@
       subscribed = $('input[name="_subscribed[]"]', $('#'+id)).prop('checked'),
       // find subfolders of renamed folder
       list = this.get_subfolders(oldfolder);
+
+    // no renaming, only update class_name
+    if (oldfolder == newfolder) {
+      $('#'+id).attr('class', class_name || '');
+      this.subscription_list.focus();
+      return;
+    }
 
     // replace an existing table row
     this._remove_folder_row(id);
@@ -6459,6 +6472,12 @@
     this.env.quota_content = content;
   };
 
+  // update trash folder state
+  this.set_trash_count = function(count)
+  {
+    this[(count ? 'un' : '') + 'mark_folder'](this.env.trash_mailbox, 'empty', '', true);
+  };
+
   // update the mailboxlist
   this.set_unread_count = function(mbox, count, set_title, mark)
   {

--
Gitblit v1.9.1