[Pkg-mozext-commits] [compactheader] 17/441: Working Preferences Dialog: Switch between one and two line mode Turn buttons on and off

David Prévot taffit at moszumanska.debian.org
Wed Mar 18 12:28:39 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository compactheader.

commit a551fc10a4d78a6f3271af7d923838795089e93c
Author: joachim.herb <none at none>
Date:   Tue Aug 18 20:37:07 2009 +0000

    Working Preferences Dialog:
    Switch between one and two line mode
    Turn buttons on and off
---
 chrome/CompactHeader/content/buttons.js            |  48 ++++
 .../CompactHeader/content/compactHeaderOverlay.js  | 309 ++++++++++++++++++---
 .../CompactHeader/content/compactHeaderOverlay.xul |  55 ++--
 chrome/CompactHeader/content/preferences.js        |  25 +-
 chrome/CompactHeader/content/preferences.xul       |   1 +
 defaults/preferences/prefs.js                      |  22 +-
 6 files changed, 367 insertions(+), 93 deletions(-)

diff --git a/chrome/CompactHeader/content/buttons.js b/chrome/CompactHeader/content/buttons.js
new file mode 100644
index 0000000..422d79d
--- /dev/null
+++ b/chrome/CompactHeader/content/buttons.js
@@ -0,0 +1,48 @@
+/*# -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+# ***** 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):
+#   Markus Hossner <markushossner at gmx.de>
+#   Mark Banner <bugzilla at standard8.plus.com>
+#   David Ascher <dascher at mozillamessaging.com>
+#
+# 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 *****
+*/
+
+var buttonslist = new Array;
+buttonslist["Reply"]   = ["hdrReplyButton", "hdrReplyAllButton", "hdrReplyListButton"];
+buttonslist["Forward"] = ["hdrForwardButton"];
+buttonslist["Archive"] = ["archiveButton"];
+buttonslist["Junk"]    = ["hdrJunkButton"];
+buttonslist["Trash"]   = ["hdrTrashButton"];
diff --git a/chrome/CompactHeader/content/compactHeaderOverlay.js b/chrome/CompactHeader/content/compactHeaderOverlay.js
index 95824e0..5c5fb53 100644
--- a/chrome/CompactHeader/content/compactHeaderOverlay.js
+++ b/chrome/CompactHeader/content/compactHeaderOverlay.js
@@ -60,49 +60,224 @@ var gCoheBuiltCollapsedView = false;
  * The collapsed view: very lightweight. We only show a couple of fields.  See
  * msgHdrViewOverlay.js for details of the field definition semantics.
  */
- var gCoheCollapsedHeaderList = [
+var gCoheCollapsedHeaderList = [
   {name:"subject", outputFunction:coheUpdateHeaderValueInTextNode},
   {name:"from", useToggle:true, useShortView:true, outputFunction: OutputEmailAddresses},
-//  {name:"toCcBcc", useToggle:true, useShortView:true, outputFunction: OutputEmailAddresses},
+  {name:"toCcBcc", useToggle:true, useShortView:true, outputFunction: OutputEmailAddresses},
   {name:"date", outputFunction:OutputDate}];
 
 	var prefBranch = Components.classes["@mozilla.org/preferences-service;1"]
     .getService(Components.interfaces.nsIPrefService)
     .getBranch("extensions.CompactHeader.");
 
-	var buttonslist = ["Reply", "Forward", "Archive", "Junk", "Trash"];
-	var buttonsanonid = [["hdrReplyButton", "hdrReplyAllButton", "hdrReplyListButton"], 
-//												"hdrReplyDropdown", "hdrReplySubButton", "hdrReplyAllSubButtonSep",
-//												"hdrReplyAllSubButton", "hdrReplyAllDropdown", "hdrReplyAllSubButton",
-//												"hdrReplySubButton", "hdrReplyListDropdown", "hdrReplyListSubButton",
-//												"hdrReplyAllSubButton", "hdrReplySubButton"],
-											 ["hdrForwardButton"],
-											 ["archiveButton"],
-											 ["hdrJunkButton"],
-											 ["hdrTrashButton"]
-			];
-  
+
+function cleanupHeaderXUL(){
+	var xularray = ["collapsedfromBox", "collapsedtoCcBccBox", 
+									"collapsedButtonBox", "collapsedsubjectBox", 
+									"collapseddateBox", "coheBaselineBox"];
+	for (var i=0; i<xularray.length; i++) {
+		var x = document.getElementById(xularray[i]);
+		if (x != null) {
+			x.parentNode.removeChild(x);
+		}
+	}
+}
+    
+function create2LHeaderXUL() {
+	cleanupHeaderXUL();
+	
+	var myElement = document.getElementById("collapsedHeaderViewFirstLine");
+
+	var xul1   = document.createElement("hbox");
+	xul1.id    = "collapsedfromBox";
+	xul1.align = "start";
+	xul1.flex  = "0";
+
+	var xultmp   = document.createElement("mail-multi-emailHeaderField");
+	xultmp.id    = "collapsedfromValue";
+	xultmp.setAttribute("class","collapsedHeaderDisplayName");
+	xultmp.label = "&fromField2.label;";
+	xul1.appendChild(xultmp,xul1);
+	
+	myElement.appendChild(xul1, myElement);
+
+	var xul2   = document.createElement("hbox");
+	xul2.id    = "collapsedtoCcBccBox";
+	xul2.align = "end";
+	xul2.pack  = "end";
+	xul2.flex  = "1";
+
+	var xultmp   = document.createElement("hbox");
+	xultmp.flex  = "100";
+	xultmp.align = "start";
+	xul2.appendChild(xultmp, xul2);
+	
+	var xultmp   = document.createElement("mail-multi-emailHeaderField");
+	xultmp.id    = "collapsedtoCcBccValue";
+	xultmp.flex  = "1";
+	xultmp.align = "end";
+	xultmp.pack  = "end";
+	xultmp.setAttribute("class","collapsedHeaderDisplayName");
+	xul2.appendChild(xultmp, xul2);
+
+	myElement.appendChild(xul2, myElement);
+
+	var xul3   = document.createElement("header-view-button-box");
+	xul3.id    = "collapsedButtonBox";
+
+	myElement.appendChild(xul3, myElement);
+	
+	//				<hbox id="collapsedsubjectBox" align="start" flex="1" style="padding-left: 10px; padding-top: 1.6px">
+	//				<textbox id="collapsedsubjectValue" flex="1" readonly="true" class="collapsedHeaderValue plain"/>
+	//			</hbox>
+
+	var myElement = document.getElementById("collapsedHeaderViewSecondLine");
+				
+	var xul4   = document.createElement("hbox");
+	xul4.id    = "collapsedsubjectBox";
+	xul4.align = "start";
+	xul4.flex  = "1";
+
+	var xultmp   = document.createElement("textbox");
+	xultmp.id    = "collapsedsubjectValue";
+	xultmp.flex  = "1";
+	xultmp.setAttribute("class", "collapsedHeaderValue plain");
+	xultmp.setAttribute("readonly", "true");
+
+	xul4.appendChild(xultmp, xul4);
+
+	myElement.appendChild(xul4, myElement);
+
+//				<hbox id="collapseddateBox" align="end" flex="0" style="padding-bottom: 2px">
+//					<textbox id="collapseddateValue" class="plain collapsedHeaderValue" flex="0" readonly="true"/>
+//				</hbox>
+	var xul5   = document.createElement("hbox");
+	xul5.id    = "collapseddateBox";
+	xul5.align = "end";
+	xul5.pack  = "end";
+	xul5.flex  = "0";
+
+	var xultmp   = document.createElement("textbox");
+	xultmp.id    = "collapseddateValue";
+	xultmp.flex  = "0";
+	xultmp.pack  = "end";
+	xultmp.setAttribute("class", "collapsedHeaderValue plain");
+	xultmp.setAttribute("readonly", "true");
+	xul5.appendChild(xultmp, xul5);
+
+	myElement.appendChild(xul5, myElement);
+
+}
+
+function create1LHeaderXUL() {
+	cleanupHeaderXUL();
+	
+	var myElement = document.getElementById("collapsedHeaderViewFirstLine");
+
+	var xul0   = document.createElement("hbox");
+	xul0.id    = "coheBaselineBox";
+	xul0.align = "baseline";
+	xul0.flex  = "2";
+
+	myElement.appendChild(xul0, myElement);
+
+	var xul4   = document.createElement("hbox");
+	xul4.id    = "collapsedsubjectBox";
+	xul4.align = "start";
+	xul4.flex  = "1";
+	xul0.appendChild(xul4, xul0);
+
+	var xultmp   = document.createElement("textbox");
+	xultmp.id    = "collapsedsubjectValue";
+	xultmp.flex  = "1";
+	xultmp.setAttribute("class", "collapsedHeaderValue plain");
+	xultmp.setAttribute("readonly", "true");
+	xul4.appendChild(xultmp, xul4);
+
+	
+	var xul2   = document.createElement("hbox");
+	xul2.id    = "collapsedtoCcBccBox";
+	xul2.align = "end";
+	xul2.pack  = "end";
+	xul2.flex  = "1";
+	xul0.appendChild(xul2, xul0);
+
+	var xultmp   = document.createElement("mail-multi-emailHeaderField");
+	xultmp.id    = "collapsedtoCcBccValue";
+	xultmp.flex  = "1";
+	xultmp.align = "end";
+	xultmp.pack  = "end";
+	xultmp.setAttribute("class", "collapsedHeaderDisplayName");
+	xultmp.hidden = "true";
+	xul2.appendChild(xultmp, xul2);
+
+	
+	var xul1   = document.createElement("hbox");
+	xul1.id    = "collapsedfromBox";
+	xul1.align = "end";
+	xul0.appendChild(xul1, xul0);
+
+	var xultmp   = document.createElement("mail-multi-emailHeaderField");
+	xultmp.id    = "collapsedfromValue";
+	xultmp.setAttribute("class", "collapsedHeaderDisplayName");
+	xultmp.label = "&fromField2.label;";
+	xul1.appendChild(xultmp,xul1);
+
+	var xul5   = document.createElement("hbox");
+	xul5.id    = "collapseddateBox";
+	xul5.align = "end";
+	xul0.appendChild(xul5, xul0);
+
+	var xultmp   = document.createElement("textbox");
+	xultmp.id    = "collapseddateValue";
+	xultmp.setAttribute("readonly", "true");
+
+	xultmp.setAttribute("class", "collapsedHeaderValue plain");
+	xul5.appendChild(xultmp, xul5);
+
+
+	var xul3   = document.createElement("header-view-button-box");
+	xul3.id    = "collapsedButtonBox";
+	xul3.hidden = "true";
+
+	myElement.appendChild(xul3, myElement);
+	
+}
+
 // Now, for each view the message pane can generate, we need a global table
 // of headerEntries. These header entry objects are generated dynamically
 // based on the static data in the header lists (see above) and elements
 // we find in the DOM based on properties in the header lists.
 var gCoheCollapsedHeaderView = {};
 
-function coheInitializeHeaderViewTables()
+function coheReInitializeHeaderViewTables()
 {
   // iterate over each header in our header list array, create a header entry
 	// for it, and store it in our header table
+	if (prefBranch.getBoolPref("headersize.twolineview")) {
+  	create2LHeaderXUL();
+	} else {
+  	create1LHeaderXUL();
+	}
+	
+	var tb = document.getElementById("collapsedsubjectValue");
+  gCoheCollapsedHeaderView = {};
   var index;
-  for (index = 0; index < gCoheCollapsedHeaderList.length; index++)
-    {
-      gCoheCollapsedHeaderView[gCoheCollapsedHeaderList[index].name] =
-        new createHeaderEntry('collapsed', gCoheCollapsedHeaderList[index]);
-    }
+  for (index = 0; index < gCoheCollapsedHeaderList.length; index++) {
+    gCoheCollapsedHeaderView[gCoheCollapsedHeaderList[index].name] =
+      new createHeaderEntry('collapsed', gCoheCollapsedHeaderList[index]);
+  }
+}
+
+function coheInitializeHeaderViewTables()
+{
+  coheReInitializeHeaderViewTables();
+  updateHdrButtons();
 }
 
 function coheOnLoadMsgHeaderPane()
 { 
-  coheInitializeHeaderViewTables();
+	coheInitializeHeaderViewTables();
 
   // Add an address book listener so we can update the header view when things
   // change.
@@ -112,7 +287,7 @@ function coheOnLoadMsgHeaderPane()
                                     Components.interfaces.nsIAbListener.all);
 
   var deckHeaderView = document.getElementById("msgHeaderViewDeck");
-  
+
   gCoheCollapsedHeaderViewMode = 
 	  deckHeaderView.selectedPanel == document.getElementById('collapsedHeaderView');	  
 	  
@@ -137,7 +312,7 @@ var coheMessageListener =
   onEndHeaders: 
 	function cML_onEndHeaders() {
 		ClearHeaderView(gCoheCollapsedHeaderView);	
-    	coheUpdateMessageHeaders();
+   	coheUpdateMessageHeaders();
 	},
 	
 	onEndAttachments: function cML_onEndAttachments(){}
@@ -196,6 +371,7 @@ function coheUpdateHeaderView()
   		showHeaderView(gCoheCollapsedHeaderView);
  	
   	UpdateJunkButton();
+ 		UpdateReplyButtons();
   	updateHdrButtons();
 }
 
@@ -217,6 +393,7 @@ function coheToggleHeaderView ()
     UpdateExpandedMessageHeaders();
   }
 
+ 	UpdateReplyButtons();
   updateHdrButtons();
   
   // Work around a xul deck bug where the height of the deck is determined
@@ -272,27 +449,37 @@ addEventListener('messagepane-loaded', coheOnLoadMsgHeaderPane, true);
 addEventListener('messagepane-unloaded', coheOnUnloadMsgHeaderPane, true);
 
 function updateHdrButtons() {
-	UpdateReplyButtons();
-  for(var i = 0; i<buttonslist.length; i++) {
-	  var buttonBox = document.getElementById('msgHeaderViewDeck').selectedPanel
+	
+  for(var buttonname in buttonslist) {
+  	var buttonBox = document.getElementById('msgHeaderViewDeck').selectedPanel
 										.getElementsByTagName("header-view-button-box").item(0);
-	  for (var j=0; j<buttonsanonid[i].length; j++){
-	  	var myElement = buttonBox.getButton(buttonsanonid[i][j]);
+
+		var strViewMode;
+		if (gCoheCollapsedHeaderViewMode)
+			strViewMode = "view.compact";
+		else
+		  strViewMode = "view.expanded";
+		for (var j=0; j<buttonslist[buttonname].length; j++){
+	  	var myElement = buttonBox.getButton(buttonslist[buttonname][j]);
 	  	if (myElement != null) {
-	  		if (prefBranch.getBoolPref("expandedview.display" + buttonslist[i])) {
-		  		if (buttonslist[i] != "Reply") {
-			  		myElement.hidden =  ! prefBranch.getBoolPref("expandedview.display" + buttonslist[i]);
+	  		if (prefBranch.getBoolPref(strViewMode + ".display" + buttonname)) {
+		  		if (buttonname != "Reply") {
+			  		myElement.hidden =  false; //! prefBranch.getBoolPref("expandedview.display" + buttonname);
 		  		}
 		  	}
 		  	else {
-		  		myElement.hidden =  ! prefBranch.getBoolPref("expandedview.display" + buttonslist[i]);
+		  		myElement.hidden =  true ; //! prefBranch.getBoolPref(strViewMode + "display" + buttonname);
 		  	}
 	  	}
+	  	else {
+	  		alert("myElement null");
+	  	}
 	  }
   }
 }
 
-var myPrefObserver =
+
+var myPrefObserverView =
 {
   register: function()
   {
@@ -301,7 +488,7 @@ var myPrefObserver =
                                 .getService(Components.interfaces.nsIPrefService);
 
     // For this._branch we ask that the preferences for extensions.myextension. and children
-    this._branch = prefService.getBranch("extensions.CompactHeader.");
+    this._branch = prefService.getBranch("extensions.CompactHeader.view.");
 
     // Now we queue the interface called nsIPrefBranch2. This interface is described as:  
     // "nsIPrefBranch2 allows clients to observe changes to pref values."
@@ -323,18 +510,50 @@ var myPrefObserver =
     // aSubject is the nsIPrefBranch we're observing (after appropriate QI)
     // aData is the name of the pref that's been changed (relative to aSubject)
 
+ 		UpdateReplyButtons();
     updateHdrButtons();
     
-    /*
-    switch (aData) {
-      case "pref1":
-        // extensions.myextension.pref1 was changed
-        break;
-      case "pref2":
-        // extensions.myextension.pref2 was changed
-        break;
-    }
-    */
   }
 }
-myPrefObserver.register();
+
+var myPrefObserverHeaderSize =
+{
+  register: function()
+  {
+    // First we'll need the preference services to look for preferences.
+    var prefService = Components.classes["@mozilla.org/preferences-service;1"]
+                                .getService(Components.interfaces.nsIPrefService);
+
+    // For this._branch we ask that the preferences for extensions.myextension. and children
+    this._branch = prefService.getBranch("extensions.CompactHeader.headersize.");
+
+    // Now we queue the interface called nsIPrefBranch2. This interface is described as:  
+    // "nsIPrefBranch2 allows clients to observe changes to pref values."
+    this._branch.QueryInterface(Components.interfaces.nsIPrefBranch2);
+
+    // Finally add the observer.
+    this._branch.addObserver("", this, false);
+  },
+
+  unregister: function()
+  {
+    if(!this._branch) return;
+    this._branch.removeObserver("", this);
+  },
+
+  observe: function(aSubject, aTopic, aData)
+  {
+    if(aTopic != "nsPref:changed") return;
+    // aSubject is the nsIPrefBranch we're observing (after appropriate QI)
+    // aData is the name of the pref that's been changed (relative to aSubject)
+
+		coheReInitializeHeaderViewTables();
+		UpdateReplyButtons();
+    updateHdrButtons();
+	  gDBView.reloadMessage();
+  
+  }
+}
+
+myPrefObserverView.register();
+myPrefObserverHeaderSize.register();
diff --git a/chrome/CompactHeader/content/compactHeaderOverlay.xul b/chrome/CompactHeader/content/compactHeaderOverlay.xul
index 62f166f..13a5603 100644
--- a/chrome/CompactHeader/content/compactHeaderOverlay.xul
+++ b/chrome/CompactHeader/content/compactHeaderOverlay.xul
@@ -14,8 +14,8 @@
 <overlay id="compactHeaderOverlay"
          xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
-  <script type="application/javascript"
-          src="chrome://CompactHeader/content/compactHeaderOverlay.js"/>
+  <script type="application/javascript" src="chrome://CompactHeader/content/buttons.js"/>
+  <script type="application/javascript" src="chrome://CompactHeader/content/compactHeaderOverlay.js"/>
 
   <deck id="msgHeaderViewDeck">
 
@@ -43,32 +43,41 @@
 		</vbox>
 	</hbox>
 
-  <vbox id="collapsedHeaderView" class="header-part1 headerContainer" flex="2" pack="start">
-
-    <hbox align="start">
-      <hbox id="showDetailsButtonBox" align="start">
+	<vbox id="collapsedHeaderView" flex="2" pack="start" class="header-part1 headerContainer">
+		<hbox align="start" flex="0" id="collapsedHeaderViewFirstLine">
+      <hbox id="showDetailsButtonBox" align="start" flex="0">
 		    <button id="showDetailsButton"
 			          tooltiptext="&showDetailsButton.label;"
 			          onclick="coheToggleHeaderView();"
 			          class="msgHeaderView-button msgHeaderView-flat-button"/>
 	    </hbox>
-	    <hbox align="baseline" flex="2">
-			  <hbox id="collapsedsubjectBox" align="start" flex="1">
-			    <textbox id="collapsedsubjectValue" flex="1" readonly="true" class="collapsedHeaderValue plain"/>
-			  </hbox>
-			  <hbox id="collapsedfromBox" align="end">
-			    <mail-multi-emailHeaderField id="collapsedfromValue"
-			                                 class="collapsedHeaderDisplayName"
-			                                 label="&fromField2.label;"/>
-			  </hbox>
-			  <hbox id="collapseddateBox" align="end">
-			    <textbox id="collapseddateValue" class="collapsedHeaderValue plain" readonly="true"/>
-			  </hbox>
-			  <header-view-button-box id="collapsedButtonBox" style="display:none"/>
-	    </hbox>
-    </hbox>
-  
-  </vbox>			
+			<hbox id="collapsedfromBox" align="start" flex="1">
+				<mail-multi-emailHeaderField id="collapsedfromValue"
+																		 flex="0"
+																		 align="end"
+																		 pack="end"
+																		 class="collapsedHeaderDisplayName"
+																		 label="&fromField2.label;"/>
+			</hbox>
+			<hbox id="collapsedtoCcBccBox" align="end" pack="end" flex="3">
+				<hbox align="start" flex="100">
+				</hbox>
+				<mail-multi-emailHeaderField id="collapsedtoCcBccValue"
+																		 flex="1"
+																		 pack="end"
+																		 class="collapsedHeaderDisplayName"/>
+			</hbox>
+			<header-view-button-box id="collapsedButtonBox"/>
+		</hbox>	
+		<hbox align="start" flex="1" id="collapsedHeaderViewSecondLine">
+			<hbox id="collapsedsubjectBox" align="start" flex="1" style="padding-left: 10px; padding-top: 1.6px">
+				<textbox id="collapsedsubjectValue" flex="1" readonly="true" class="collapsedHeaderValue plain"/>
+			</hbox>
+			<hbox id="collapseddateBox" align="end" flex="0" style="padding-bottom: 2px">
+				<textbox id="collapseddateValue" class="plain collapsedHeaderValue" flex="0" readonly="true"/>
+			</hbox>
+		</hbox>
+	</vbox>
 
 	</deck>
 
diff --git a/chrome/CompactHeader/content/preferences.js b/chrome/CompactHeader/content/preferences.js
index f85d65e..dde35df 100644
--- a/chrome/CompactHeader/content/preferences.js
+++ b/chrome/CompactHeader/content/preferences.js
@@ -16,8 +16,6 @@
 
 var prefBranch;
 
-	var buttonslist = ["Reply", "Forward", "Archive", "Junk", "Trash"];
-
 ///////////////////////////////////////////////////////////////////////////////
 //
 //  onLoad
@@ -32,19 +30,18 @@ function onLoad()
     .getService(Components.interfaces.nsIPrefService)
     .getBranch("extensions.CompactHeader.");
 
-  loadPrefCheckbox("compactview.twolineview", "checkbox.Compact.TwolineView");
-	
-  updateTwolineView(prefBranch.getBoolPref("compactview.twolineview")); 
+  loadPrefCheckbox("headersize.twolineview", "checkbox.Compact.TwolineView");
+  updateTwolineView(prefBranch.getBoolPref("headersize.twolineview")); 
   
-  for(var i = 0; i<buttonslist.length; i++) {
-	  loadPrefCheckbox("compactview.display" + buttonslist[i],  "checkbox.Compact." + buttonslist[i]);
-	  loadPrefCheckbox("expandedview.display" + buttonslist[i], "checkbox.Expanded." + buttonslist[i]);
+  for(var buttonname in buttonslist) {
+	  loadPrefCheckbox("view.compact.display" + buttonname,  "checkbox.Compact." + buttonname);
+	  loadPrefCheckbox("view.expanded.display" + buttonname, "checkbox.Expanded." + buttonname);
   }
 }
 
 function updateTwolineView(boolTwolineview) {
-  for(var i = 0; i<buttonslist.length; i++) {
-		document.getElementById("checkbox.Compact." + buttonslist[i]).disabled = ! boolTwolineview;
+  for(var buttonname in buttonslist) {
+		document.getElementById("checkbox.Compact." + buttonname).disabled = ! boolTwolineview;
   }
 }
 
@@ -58,11 +55,11 @@ function updateTwolineView(boolTwolineview) {
 
 function onDialogAccept()
 {
-  savePrefCheckbox("compactview.twolineview", "checkbox.Compact.TwolineView");
+  savePrefCheckbox("headersize.twolineview", "checkbox.Compact.TwolineView");
 	
-	for(var i = 0; i<buttonslist.length; i++) {
-	  savePrefCheckbox("compactview.display" + buttonslist[i],  "checkbox.Compact." + buttonslist[i]);
-	  savePrefCheckbox("expandedview.display" + buttonslist[i], "checkbox.Expanded." + buttonslist[i]);
+  for(var buttonname in buttonslist) {
+	  savePrefCheckbox("view.compact.display" + buttonname,  "checkbox.Compact." + buttonname);
+	  savePrefCheckbox("view.expanded.display" + buttonname, "checkbox.Expanded." + buttonname);
   }
 
   return true;
diff --git a/chrome/CompactHeader/content/preferences.xul b/chrome/CompactHeader/content/preferences.xul
index 61aae0e..8d146e0 100644
--- a/chrome/CompactHeader/content/preferences.xul
+++ b/chrome/CompactHeader/content/preferences.xul
@@ -14,6 +14,7 @@
   onload="onLoad()" ondialogaccept="return onDialogAccept()">
 
   <script type="application/x-javascript" src="chrome://CompactHeader/content/preferences.js"/>
+  <script type="application/x-javascript" src="chrome://CompactHeader/content/buttons.js"/>
 
   <groupbox>
     <caption label="&groupbox.Buttons.caption;"/>
diff --git a/defaults/preferences/prefs.js b/defaults/preferences/prefs.js
index 82d213b..4628d30 100644
--- a/defaults/preferences/prefs.js
+++ b/defaults/preferences/prefs.js
@@ -1,13 +1,13 @@
-pref("extensions.CompactHeader.compactview.twolineview", false);
+pref("extensions.CompactHeader.headersize.twolineview", false);
 
-pref("extensions.CompactHeader.compactview.displayReply", false);
-pref("extensions.CompactHeader.compactview.displayForward",  false);
-pref("extensions.CompactHeader.compactview.displayArchive", false);
-pref("extensions.CompactHeader.compactview.displayJunk", false);
-pref("extensions.CompactHeader.compactview.displayTrash", false);
+pref("extensions.CompactHeader.view.compact.displayReply", false);
+pref("extensions.CompactHeader.view.compact.displayForward",  false);
+pref("extensions.CompactHeader.view.compact.displayArchive", false);
+pref("extensions.CompactHeader.view.compact.displayJunk", false);
+pref("extensions.CompactHeader.view.compact.displayTrash", false);
 
-pref("extensions.CompactHeader.expandedview.displayReply", true);
-pref("extensions.CompactHeader.expandedview.displayForward",  true);
-pref("extensions.CompactHeader.expandedview.displayArchive", true);
-pref("extensions.CompactHeader.expandedview.displayJunk", true);
-pref("extensions.CompactHeader.expandedview.displayTrash", true);
+pref("extensions.CompactHeader.view.expanded.displayReply", true);
+pref("extensions.CompactHeader.view.expanded.displayForward",  true);
+pref("extensions.CompactHeader.view.expanded.displayArchive", true);
+pref("extensions.CompactHeader.view.expanded.displayJunk", true);
+pref("extensions.CompactHeader.view.expanded.displayTrash", true);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/compactheader.git



More information about the Pkg-mozext-commits mailing list