From 3ebac0167bf20104fb7a2a55934765117760264c Mon Sep 17 00:00:00 2001 From: Thomas Bruederli <thomas@roundcube.net> Date: Mon, 18 Aug 2014 03:53:18 -0400 Subject: [PATCH] Only add zen-mode text labels in compose step --- program/js/app.js | 65 ++++++++++++++++++++++++++++++-- 1 files changed, 61 insertions(+), 4 deletions(-) diff --git a/program/js/app.js b/program/js/app.js index 8ac5ca2..a8e66e2 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -4739,6 +4739,7 @@ this.list_contacts = function(src, group, page) { var win, folder, url = {}, + refresh = src === undefined && group === undefined && page === undefined, target = window; if (!src) @@ -4751,7 +4752,7 @@ page = this.env.current_page = 1; this.reset_qsearch(); } - else if (group != this.env.group) + else if (!refresh && group != this.env.group) page = this.env.current_page = 1; if (this.env.search_id) @@ -4889,6 +4890,9 @@ if (action && (cid || action == 'add') && !this.drag_active) { if (this.env.group) url._gid = this.env.group; + + if (this.env.search_request) + url._search = this.env.search_request; url._action = action; url._source = this.env.source; @@ -5741,15 +5745,18 @@ this.subscription_list = new rcube_treelist_widget(this.gui_objects.subscriptionlist, { selectable: true, + tabexit: false, id_prefix: 'rcmli', id_encode: this.html_identifier_encode, - id_decode: this.html_identifier_decode + id_decode: this.html_identifier_decode, + searchbox: '#foldersearch' }); this.subscription_list .addEventListener('select', function(node) { ref.subscription_select(node.id); }) .addEventListener('collapse', function(node) { ref.folder_collapsed(node) }) .addEventListener('expand', function(node) { ref.folder_collapsed(node) }) + .addEventListener('search', function(p) { if (p.query) ref.subscription_select(); }) .draggable({cancel: 'li.mailbox.root'}) .droppable({ // @todo: find better way, accept callback is executed for every folder @@ -5832,6 +5839,12 @@ if (!this.gui_objects.subscriptionlist) return false; + // reset searching + if (this.subscription_list.is_search()) { + this.subscription_select(); + this.subscription_list.reset_search(); + } + // disable drag-n-drop temporarily this.subscription_list.draggable('destroy').droppable('destroy'); @@ -5850,8 +5863,9 @@ row.attr({id: 'rcmli' + this.html_identifier_encode(id), 'class': class_name}); if (!refrow || !refrow.length) { - // remove old subfolders and toggle + // remove old data, subfolders and toggle $('ul,div.treetoggle', row).remove(); + row.removeData('filtered'); } // set folder name @@ -5978,7 +5992,7 @@ this.subscription_list.expand(this.folder_id2name(parent.id)); } - row = row.get(0); + row = row.show().get(0); if (row.scrollIntoView) row.scrollIntoView(); @@ -5995,6 +6009,12 @@ } return false; + } + + // reset searching + if (this.subscription_list.is_search()) { + this.subscription_select(); + this.subscription_list.reset_search(); } var subfolders = {}, @@ -6042,6 +6062,12 @@ // remove the table row of a specific mailbox from the table this.remove_folder_row = function(folder) { + // reset searching + if (this.subscription_list.is_search()) { + this.subscription_select(); + this.subscription_list.reset_search(); + } + var list = [], row = this.subscription_list.get_item(folder, true); // get subfolders if any @@ -6110,6 +6136,37 @@ $('#folder-size').replaceWith(size); }; + // filter folders by namespace + this.folder_filter = function(prefix) + { + this.subscription_list.reset_search(); + + this.subscription_list.container.children('li').each(function() { + var i, folder = ref.folder_id2name(this.id); + // show all folders + if (prefix == '---') { + } + // got namespace prefix + else if (prefix) { + if (folder !== prefix) { + $(this).data('filtered', true).hide(); + return + } + } + // no namespace prefix, filter out all other namespaces + else { + // first get all namespace roots + for (i in ref.env.ns_roots) { + if (folder === ref.env.ns_roots[i]) { + $(this).data('filtered', true).hide(); + return; + } + } + } + + $(this).removeData('filtered').show(); + }); + }; /*********************************************************/ /********* GUI functionality *********/ -- Gitblit v1.9.1