Bug 362990: asynchronous message view list manipulation; r=neil, sr=mscott

This commit is contained in:
mnyromyr%tprac.de 2006-12-12 23:20:48 +00:00
Родитель ac8b462aaf
Коммит 872912d232
3 изменённых файлов: 14 добавлений и 36 удалений

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

@ -22,6 +22,10 @@
* *
* Contributor(s): * Contributor(s):
* Scott MacGregor <mscott@netscape.com> * Scott MacGregor <mscott@netscape.com>
* Seth Spitzer <sspitzer@netscape.com>
* Stefan Borggraefe <borggraefe@despammed.com>
* Gervase Markham <gerv@gerv.net>
* Karsten Düsterloh <mnyromyr@tprac.de>
* *
* Alternatively, the contents of this file may be used under the terms of * Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"), * either of the GNU General Public License Version 2 or later (the "GPL"),
@ -40,7 +44,6 @@
var gMailListView; var gMailListView;
var gListBox; var gListBox;
var gCloseCallback = null;
var gEditButton; var gEditButton;
var gDeleteButton; var gDeleteButton;
@ -49,13 +52,6 @@ function mailViewListOnLoad()
gMailListView = Components.classes["@mozilla.org/messenger/mailviewlist;1"].getService(Components.interfaces.nsIMsgMailViewList);; gMailListView = Components.classes["@mozilla.org/messenger/mailviewlist;1"].getService(Components.interfaces.nsIMsgMailViewList);;
gListBox = document.getElementById('mailViewList'); gListBox = document.getElementById('mailViewList');
if ("arguments" in window && window.arguments[0])
{
var args = window.arguments[0];
if ("onCloseCallback" in args)
gCloseCallback = window.arguments[0].onCloseCallback;
}
// Construct list view based on current mail view list data // Construct list view based on current mail view list data
refreshListView(null); refreshListView(null);
gEditButton = document.getElementById('editButton'); gEditButton = document.getElementById('editButton');
@ -64,19 +60,11 @@ function mailViewListOnLoad()
updateButtons(); updateButtons();
} }
function mailViewListOnUnload()
{
if (gCloseCallback)
gCloseCallback(gListBox.selectedIndex);
}
function refreshListView(aSelectedMailView) function refreshListView(aSelectedMailView)
{ {
// remove any existing items in the view... // remove any existing items in the view...
for (var index = gListBox.getRowCount(); index > 0; index--) for (var index = gListBox.getRowCount(); index > 0; index--)
{
gListBox.removeChild(gListBox.getItemAtIndex(index - 1)); gListBox.removeChild(gListBox.getItemAtIndex(index - 1));
}
var numItems = gMailListView.mailViewCount; var numItems = gMailListView.mailViewCount;
var mailView; var mailView;
@ -153,5 +141,3 @@ function updateButtons()
gEditButton.disabled = selectedIndex < 0; gEditButton.disabled = selectedIndex < 0;
gDeleteButton.disabled = selectedIndex < 0; gDeleteButton.disabled = selectedIndex < 0;
} }

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

@ -22,6 +22,14 @@
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
Scott MacGregor <mscott@netscape.com>
Seth Spitzer <sspitzer@netscape.com>
Neil Rashbrook <neil@parkwaycc.co.uk>
<riceman+bmo@mail.rit.edu>
Gervase Markham <gerv@gerv.net>
Stefan Borggraefe <Stefan.Borggraefe@gmx.de>
Paul Tomlin <paul@wavebreaks.com>
Karsten Düsterloh <mnyromyr@tprac.de>
Alternatively, the contents of this file may be used under the terms of Alternatively, the contents of this file may be used under the terms of
either of the GNU General Public License Version 2 or later (the "GPL"), either of the GNU General Public License Version 2 or later (the "GPL"),
@ -49,7 +57,6 @@
<dialog id="mailViewListDialog" <dialog id="mailViewListDialog"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="mailViewListOnLoad();" onload="mailViewListOnLoad();"
onunload="mailViewListOnUnload()"
windowtype="mailnews:mailviewlist" windowtype="mailnews:mailviewlist"
title="&mailViewListTitle.label;" title="&mailViewListTitle.label;"
width="400" height="340" width="400" height="340"
@ -64,7 +71,6 @@
<listcols> <listcols>
<listcol flex="1" width="0"/> <listcol flex="1" width="0"/>
</listcols> </listcols>
<listhead> <listhead>
<listheader label="&viewName.label;"/> <listheader label="&viewName.label;"/>
</listhead> </listhead>
@ -78,7 +84,3 @@
</hbox> </hbox>
</vbox> </vbox>
</dialog> </dialog>

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

@ -143,12 +143,6 @@ function ViewChangeByValue(aValue)
} }
function ViewChangeByCustomValue(aCustomValue)
{
ViewChangeByValue(aCustomValue + kViewItemFirstCustom);
}
function UpdateViewPicker(aValue, aLabel) function UpdateViewPicker(aValue, aLabel)
{ {
var viewPicker = document.getElementById("viewPicker"); var viewPicker = document.getElementById("viewPicker");
@ -200,7 +194,7 @@ function SetMailViewForFolder(aFolder, aValue)
if (folderInfo) if (folderInfo)
{ {
// we can't map tags back to labels in general, // we can't map tags back to labels in general,
// so set view to none for backwards compatibility in this case // so set view to all for backwards compatibility in this case
folderInfo.setUint32Property (kViewCurrent, isNaN(aValue) ? kViewItemAll : aValue); folderInfo.setUint32Property (kViewCurrent, isNaN(aValue) ? kViewItemAll : aValue);
folderInfo.setCharPtrProperty(kViewCurrentTag, aValue); folderInfo.setCharPtrProperty(kViewCurrentTag, aValue);
} }
@ -209,11 +203,7 @@ function SetMailViewForFolder(aFolder, aValue)
function LaunchCustomizeDialog() function LaunchCustomizeDialog()
{ {
// made it modal, see bug #191188 OpenOrFocusWindow({}, "mailnews:mailviewlist", "chrome://messenger/content/mailViewList.xul");
window.openDialog("chrome://messenger/content/mailViewList.xul",
"mailnews:mailviewlist",
"chrome,modal,titlebar,resizable,centerscreen",
{onCloseCallback: ViewChangeByCustomValue});
} }