From 223ae9d14860254eb83318c1500a368a31156093 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Sun, 26 Feb 2012 12:02:16 -0500
Subject: [PATCH] - Fixed identity delete button state, removed delete button in identity-edit form (for consistency)

---
 skins/default/templates/identityedit.html |    1 -
 program/js/app.js                         |   18 ++++++++----------
 skins/larry/templates/identityedit.html   |    1 -
 3 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/program/js/app.js b/program/js/app.js
index 949502e..f00263c 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -372,15 +372,11 @@
         this.enable_command('preferences', 'identities', 'save', 'folders', true);
 
         if (this.env.action == 'identities') {
-          this.enable_command('add', 'delete', this.env.identities_level < 2);
+          this.enable_command('add', this.env.identities_level < 2);
         }
         else if (this.env.action == 'edit-identity' || this.env.action == 'add-identity') {
-          this.enable_command('add', this.env.identities_level < 2);
           this.enable_command('save', 'edit', 'toggle-editor', true);
-          if (this.is_framed() && this.env.identities_level < 2)
-            this.set_button('delete', 'act');  // activate button but delegate command to parent
-          else
-            this.enable_command('delete', this.env.identities_level < 2);
+          this.enable_command('delete', this.env.identities_level < 2);
 
           if (this.env.action == 'add-identity')
             $("input[type='text']").first().select();
@@ -4807,14 +4803,16 @@
   this.identity_select = function(list)
   {
     var id;
-    if (id = list.get_single_selection())
+    if (id = list.get_single_selection()) {
+      this.enable_command('delete', list.rowcount > 1 && this.env.identities_level < 2);
       this.load_identity(id, 'edit-identity');
+    }
   };
 
   // load identity record
   this.load_identity = function(id, action)
   {
-    if (action=='edit-identity' && (!id || id==this.env.iid))
+    if (action == 'edit-identity' && (!id || id == this.env.iid))
       return false;
 
     var add_url = '', target = window;
@@ -4825,7 +4823,7 @@
       document.getElementById(this.env.contentframe).style.visibility = 'inherit';
     }
 
-    if (action && (id || action=='add-identity')) {
+    if (action && (id || action == 'add-identity')) {
       this.set_busy(true);
       this.location_href(this.env.comm_path+'&_action='+action+'&_iid='+id+add_url, target);
     }
@@ -4835,7 +4833,7 @@
 
   this.delete_identity = function(id)
   {
-    // exit if no mailbox specified or if selection is empty
+    // exit if no identity is specified or if selection is empty
     var selection = this.identity_list.get_selection();
     if (!(selection.length || this.env.iid))
       return;
diff --git a/skins/default/templates/identityedit.html b/skins/default/templates/identityedit.html
index 563b136..3aaa7bc 100644
--- a/skins/default/templates/identityedit.html
+++ b/skins/default/templates/identityedit.html
@@ -23,7 +23,6 @@
 
 <div id="formfooter">
 <div class="footerleft">
-  <roundcube:button command="delete" type="input" class="button" label="delete" condition="env:action=='edit-identity'" style="margin-right:0.5em" />
   <roundcube:button command="save" type="input" class="button mainaction" label="save" />
 </div>
 </div>
diff --git a/skins/larry/templates/identityedit.html b/skins/larry/templates/identityedit.html
index 2657c2d..3ef4131 100644
--- a/skins/larry/templates/identityedit.html
+++ b/skins/larry/templates/identityedit.html
@@ -15,7 +15,6 @@
 <div id="formfooter">
 <div class="footerleft formbuttons">
 	<roundcube:button command="save" type="input" class="button mainaction" label="save" />
-	<roundcube:button command="delete" type="input" class="button" label="delete" condition="env:action=='edit-identity' && config:identities_level:0<2" />
 </div>
 </div>
 

--
Gitblit v1.9.1