From be23bfd77901134a5dcf3f05640556a418c522cc Mon Sep 17 00:00:00 2001 From: jmozmoz Date: Fri, 16 Aug 2019 11:32:55 +0200 Subject: [PATCH] In compact header and side toolbars show only icons in buttons --- .../content/compactHeaderOverlayPost69.xul | 1 + .../skin/global/headerButtons69.css | 61 +++++++++++ manifest.json | 2 +- .../test-compactheader-toolbar.js | 101 ++++++++++++------ 4 files changed, 129 insertions(+), 36 deletions(-) create mode 100644 chrome/CompactHeader/skin/global/headerButtons69.css diff --git a/chrome/CompactHeader/content/compactHeaderOverlayPost69.xul b/chrome/CompactHeader/content/compactHeaderOverlayPost69.xul index b9646c2..8df8526 100644 --- a/chrome/CompactHeader/content/compactHeaderOverlayPost69.xul +++ b/chrome/CompactHeader/content/compactHeaderOverlayPost69.xul @@ -18,6 +18,7 @@ ]> + diff --git a/chrome/CompactHeader/skin/global/headerButtons69.css b/chrome/CompactHeader/skin/global/headerButtons69.css new file mode 100644 index 0000000..4260c9a --- /dev/null +++ b/chrome/CompactHeader/skin/global/headerButtons69.css @@ -0,0 +1,61 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Mozilla Communicator client code, released + * March 31, 1998. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998-1999 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Joachim Herb + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* ===== messageHeader.css ============================================== + == Styles for the header toolbars of a mail message. + ======================================================================= */ + +@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); + +/* +toolbar[mode="icons"] .toolbarbutton-menubutton-button, +toolbar[mode="icons"] .toolbarbutton-1:not([type="menu-button"]) { + padding-inline-start: 6px !important; + padding-inline-end: 6px !important; +} +*/ + +#CompactHeader_collapsed2LHeaderViewFirstLine #header-view-toolbar .toolbarbutton-text, +#CompactHeader_collapsed2LHeaderViewFirstLine #header-view-toolbar .toolbarbutton-multiline-text, +#CompactHeader_leftSidebar #header-view-toolbar .toolbarbutton-text, +#CompactHeader_leftSidebar #header-view-toolbar .toolbarbutton-multiline-text, +#CompactHeader_rightSidebar #header-view-toolbar .toolbarbutton-text, +#CompactHeader_rightSidebar #header-view-toolbar .toolbarbutton-multiline-text { + display: none; + -moz-binding: none; +} \ No newline at end of file diff --git a/manifest.json b/manifest.json index 1eda4ed..17b105c 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "CompactHeader", "description": "Add ability to reduce header size to one or two lines. Linkify subjects in RSS feeds.", - "version": "3.0.0beta2", + "version": "3.0.0beta3", "author": "Joachim Herb", "homepage_url": "http://compactheader.mozdev.org/", "legacy": { diff --git a/test/compactheader/test-compactheader-toolbar.js b/test/compactheader/test-compactheader-toolbar.js index 3ce15c3..a3d46c7 100644 --- a/test/compactheader/test-compactheader-toolbar.js +++ b/test/compactheader/test-compactheader-toolbar.js @@ -143,6 +143,33 @@ function teardownModule() { Services.prefs.clearUserPref("toolkit.customization.unsafe_drag_events"); } + +/** + * Test at first that default button are sets with only icons + */ +function test_1_header_toolbar_check_default() { + let curMessage = select_message_in_folder(folder1, 0, mc); + let hdrToolbar = mc.eid("header-view-toolbar").node; + let hdrBarDefaultSet = hdrToolbar.getAttribute("defaultset"); + expand_and_assert_header(mc); + set_and_assert_toolbox_position(mc, 'top'); + + // only icons are shown + subsubtest_button_style("hdrTrashButton", "-moz-box", "none", mc); + + // Display message in new window and check that the default + // buttons are shown there. + let msgc = open_selected_message_in_new_window(); + assert_selected_and_displayed(msgc, curMessage); + expand_and_assert_header(msgc); + hdrToolbar = msgc.eid("header-view-toolbar").node; + // only icons are shown + subsubtest_button_style("hdrTrashButton", "-moz-box", "none", msgc); + + close_window(msgc); +} + + /** * Test header pane toolbar position */ @@ -687,7 +714,7 @@ function test_customize_header_toolbar_change_button_style(){ restore_and_check_default_buttons(mc); // The default mode is icon visible only. - subtest_buttons_style("-moz-box", "none"); + subtest_buttons_style("-moz-box", "none", mc); // Change the button style to text and icon mode let ctc = open_header_pane_toolbar_customization(mc); @@ -696,7 +723,7 @@ function test_customize_header_toolbar_change_button_style(){ ctc.click(new elib.Elem(iconMode)); close_header_pane_toolbar_customization(ctc); - subtest_buttons_style("-moz-box", "-moz-box"); + subtest_buttons_style("-moz-box", "-moz-box", mc); // Change the button style to icon mode only ctc = open_header_pane_toolbar_customization(mc); @@ -705,7 +732,7 @@ function test_customize_header_toolbar_change_button_style(){ ctc.click(new elib.Elem(iconMode)); close_header_pane_toolbar_customization(ctc); - subtest_buttons_style("-moz-box", "none"); + subtest_buttons_style("-moz-box", "none", mc); // Change the button style to text (only) mode ctc = open_header_pane_toolbar_customization(mc); @@ -714,11 +741,11 @@ function test_customize_header_toolbar_change_button_style(){ ctc.click(new elib.Elem(textMode)); close_header_pane_toolbar_customization(ctc); - subtest_buttons_style("none", "-moz-box"); + subtest_buttons_style("none", "-moz-box", mc); // The default mode is icon visible only. restore_and_check_default_buttons(mc); - subtest_buttons_style("-moz-box", "none"); + subtest_buttons_style("-moz-box", "none", mc); Services.prefs.clearUserPref("toolkit.customization.unsafe_drag_events"); } @@ -878,41 +905,45 @@ function test_set_toolbar_position() { * Check all buttons in the toolbar for the correct style * of text and icon. */ -function subtest_buttons_style(aIconVisibility, aLabelVisibility) -{ - let toolbar = mc.eid("header-view-toolbar").node; +function subtest_buttons_style(aIconVisibility, aLabelVisibility, aController) { + let toolbar = aController.eid("header-view-toolbar").node; let currentSet = filterInvisibleButtons(mc, toolbar.currentSet).split(","); for (let i=0; i