Bug #312940 --> more work on the new mail alert prototype

sr=bienvenu
This commit is contained in:
scott%scott-macgregor.org 2005-11-22 01:55:14 +00:00
Родитель e1020cb827
Коммит 8f6d5824c5
2 изменённых файлов: 13 добавлений и 35 удалений

Просмотреть файл

@ -77,17 +77,6 @@ function prefillAlertInfo()
}
function onAlertLoad()
{
// this delay is required because the folder summary element
// ends up dynamically creating an arbitrary number of folderSummaryMessage xbl widgets
// and we have to fire a timeout to wait for the various properties and methods on the folderSummaryMessage widget
// before we can actually initialize it. Because of that timeout, we don't know the total width of the alert
// dialog when onAlertLoad is called, so we have to delay again. This work around in turn causes the alert to flash up in the middle
// of your window for a second until onDelayAlertLoad gets called and moves the window to the right position.
setTimeout(onDelayAlertLoad, 0);
}
function onDelayAlertLoad()
{
// read out our initial settings from prefs.
try

Просмотреть файл

@ -2059,13 +2059,22 @@
}
var index = 0;
var hdrParser = Components.classes["@mozilla.org/messenger/headerparser;1"].getService(Components.interfaces.nsIMsgHeaderParser);
while (document.getAnonymousNodes(this)[0].childNodes.length < this.mMaxMsgHdrsInPopup && index < numMsgKeys.value)
{
var msgPopup = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "folderSummaryMessage");
// hack to work around the fact that the xbl binding from createElementNS is asynch.
setTimeout(function(aMsgPopup, aMsgHdr) {
aMsgPopup.init(aMsgHdr); }, 0,
msgPopup, msgDatabase.GetMsgHdrForKey(msgKeys.value[index++]));
var msgHdr = msgDatabase.GetMsgHdrForKey(msgKeys.value[index++]);
msgPopup.setAttribute('subject', msgHdr.mime2DecodedSubject);
// TO DO: worry about character set conversions
var previewText = msgHdr.getStringProperty('preview'); // replace tabs, line returns, etc. with a space
if (previewText)
msgPopup.setAttribute('previewText', previewText);
var names = {};
var emails = {};
var numAddresses = hdrParser.parseHeadersWithArray(msgHdr.mime2DecodedAuthor, emails, names, {});
msgPopup.setAttribute('sender', ' - ' + (names.value[0] ? names.value[0] : emails.value[0]));
document.getAnonymousNodes(this)[0].appendChild(msgPopup);
}
return true;
@ -2095,25 +2104,5 @@
<xul:description class="folderSummary-previewText" xbl:inherits="value=previewText" crop="right"></xul:description>
</xul:vbox>
</content>
<implementation>
<method name="init">
<parameter name="aMsgHdr"/>
<body>
<![CDATA[
this.setAttribute('subject', aMsgHdr.mime2DecodedSubject);
// TO DO: worry about character set conversions
var previewText = aMsgHdr.getStringProperty('preview'); // replace tabs, line returns, etc. with a space
if (previewText)
this.setAttribute('previewText', previewText);
var hdrParser = Components.classes["@mozilla.org/messenger/headerparser;1"].getService(Components.interfaces.nsIMsgHeaderParser);
var names = {};
var emails = {};
var numAddresses = hdrParser.parseHeadersWithArray(aMsgHdr.mime2DecodedAuthor, emails, names, {});
this.setAttribute('sender', ' - ' + (names.value[0] ? names.value[0] : emails.value[0]));
]]>
</body>
</method>
</implementation>
</binding>
</bindings>