Changeset 84a3312 in github


Ignore:
Timestamp:
Mar 24, 2010 5:47:45 AM (3 years ago)
Author:
thomascube <thomas@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
b488c1d
Parents:
5799531
Message:

Only select childs when a message row is collapsed but also do it when deleting a thread

Location:
program/js
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • program/js/app.js

    r519aeda r84a3312  
    22042204  // delete selected messages from the current mailbox 
    22052205  this.delete_messages = function() 
    2206     { 
    2207     var selection = this.message_list ? this.message_list.get_selection() : new Array(); 
     2206  { 
     2207    var selection = this.message_list ? $.merge([], this.message_list.get_selection()) : new Array(); 
    22082208 
    22092209    // exit if no mailbox specified or if selection is empty 
    22102210    if (!this.env.uid && !selection.length) 
    22112211      return; 
    2212  
     2212       
     2213    // also select childs of collapsed rows 
     2214    for (var uid, i=0; i < selection.length; i++) { 
     2215      uid = selection[i]; 
     2216      if (this.message_list.rows[uid].has_children && !this.message_list.rows[uid].expanded) 
     2217        this.message_list.select_childs(uid); 
     2218    } 
     2219     
    22132220    // if config is set to flag for deletion 
    22142221    if (this.env.flag_for_deletion) { 
    22152222      this.mark_message('delete'); 
    22162223      return false; 
    2217       } 
     2224    } 
    22182225    // if there isn't a defined trash mailbox or we are in it 
    22192226    else if (!this.env.trash_mailbox || this.env.mailbox == this.env.trash_mailbox)  
     
    22222229    else { 
    22232230      // if shift was pressed delete it immediately 
    2224       if (this.message_list && this.message_list.shiftkey) 
    2225         { 
     2231      if (this.message_list && this.message_list.shiftkey) { 
    22262232        if (confirm(this.get_label('deletemessagesconfirm'))) 
    22272233          this.permanently_remove_messages(); 
    2228         } 
     2234      } 
    22292235      else 
    22302236        this.move_messages(this.env.trash_mailbox); 
    2231       } 
     2237    } 
    22322238 
    22332239    return true; 
     
    22612267        id = selection[n]; 
    22622268        a_uids[a_uids.length] = id; 
    2263         count += this.update_thread(id); 
     2269        count += this.update_thread(id); 
    22642270        this.message_list.remove_row(id, (this.env.display_next && n == selection.length-1)); 
    22652271      } 
  • program/js/list.js

    r258dbd0 r84a3312  
    659659}, 
    660660 
     661/** 
     662 * Add all childs of the given row to selection 
     663 */ 
     664select_childs: function(uid) 
     665{ 
     666  if (!this.rows[uid] || !this.rows[uid].has_children) 
     667    return; 
     668   
     669  var depth = this.rows[uid].depth; 
     670  var row = this.rows[uid].obj.nextSibling; 
     671  while (row) { 
     672    if (row.nodeType == 1) { 
     673      if ((r = this.rows[row.uid])) { 
     674        if (!r.depth || r.depth <= depth) 
     675          break; 
     676        if (!this.in_selection(r.uid)) 
     677          this.select_row(r.uid, CONTROL_KEY); 
     678      } 
     679    } 
     680    row = row.nextSibling; 
     681  } 
     682}, 
     683 
    661684 
    662685/** 
     
    10141037    for (var n=0; n < selection.length; n++) { 
    10151038      uid = selection[n]; 
    1016       if (this.rows[uid].has_children /*&& !this.rows[uid].expanded*/) { 
    1017         depth = this.rows[uid].depth; 
    1018         row = this.rows[uid].obj.nextSibling; 
    1019         while (row) { 
    1020           if (row.nodeType == 1) { 
    1021             if ((r = this.rows[row.uid])) { 
    1022               if (!r.depth || r.depth <= depth) 
    1023                 break; 
    1024               if (!this.in_selection(r.uid)) 
    1025                 this.select_row(r.uid, CONTROL_KEY); 
    1026             } 
    1027           } 
    1028           row = row.nextSibling; 
    1029         } 
    1030       } 
     1039      if (this.rows[uid].has_children && !this.rows[uid].expanded) 
     1040        this.select_childs(uid); 
    10311041    } 
    10321042 
Note: See TracChangeset for help on using the changeset viewer.