add support for sorting by label r=bhuvan, sr=sspitzer 106717

This commit is contained in:
bienvenu%netscape.com 2001-10-28 20:26:59 +00:00
parent b8621ca475
commit 507a096fa9
6 changed files with 45 additions and 30 deletions

View File

@ -447,6 +447,9 @@ function ConvertColumnIDToSortType(columnID)
case "threadCol":
sortKey = nsMsgViewSortType.byThread;
break;
case "labelCol":
sortKey = nsMsgViewSortType.byLabel;
break;
default:
dump("unsupported sort column: " + columnID + "\n");
sortKey = 0;
@ -483,6 +486,9 @@ function ConvertSortTypeToColumnID(sortKey)
case nsMsgViewSortType.byStatus:
columnID = "statusCol";
break;
case nsMsgViewSortType.byLabel:
columnID = "labelCol";
break;
case nsMsgViewSortType.bySize:
columnID = "sizeCol";
break;

View File

@ -9,45 +9,45 @@
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript">
<![CDATA[
function getCurrentIdentityKey()
{
try
{
var cwindowManager = Components.classes['@mozilla.org/rdf/datasource;1?name=window-mediator'].getService();
var iwindowManager = Components.interfaces.nsIWindowMediator;
var windowManager = cwindowManager.QueryInterface(iwindowManager);
var mailWindow = windowManager.getMostRecentWindow('mail:3pane');
var folder = mailWindow.GetFirstSelectedMsgFolder();
var server = folder.server;
var identity = mailWindow.getIdentityForServer(server);
return identity.key;
}
catch(ex) {
return null;
}
}
<![CDATA[
function getCurrentIdentityKey()
{
try
{
var cwindowManager = Components.classes['@mozilla.org/rdf/datasource;1?name=window-mediator'].getService();
var iwindowManager = Components.interfaces.nsIWindowMediator;
var windowManager = cwindowManager.QueryInterface(iwindowManager);
var mailWindow = windowManager.getMostRecentWindow('mail:3pane');
var folder = mailWindow.GetFirstSelectedMsgFolder();
var server = folder.server;
var identity = mailWindow.getIdentityForServer(server);
return identity.key;
}
catch(ex) {
return null;
}
}
function sendLink(pageUrl, pageTitle)
{
var currentIdentity = getCurrentIdentityKey();
var args = "body='" + pageUrl + "',subject='" + pageTitle +"',bodyislink=true";
if (currentIdentity)
args += ",preselectid='" + currentIdentity+ "'";
{
var currentIdentity = getCurrentIdentityKey();
var args = "body='" + pageUrl + "',subject='" + pageTitle +"',bodyislink=true";
if (currentIdentity)
args += ",preselectid='" + currentIdentity+ "'";
window.openDialog( "chrome://messenger/content/messengercompose/messengercompose.xul", "_blank",
"chrome,all,dialog=no", args);
}
function sendPage()
{
{
var currentIdentity = getCurrentIdentityKey();
var pageUrl = window._content.location.href;
var pageTitle = window._content.document.title;
var args = "attachment='" + pageUrl.replace(/\,/g, "%2C") + "',body='" + pageUrl +"',subject='" + pageTitle + "',bodyislink=true";
if (currentIdentity)
args += ",preselectid='" + currentIdentity+ "'";
var pageTitle = window._content.document.title;
var args = "attachment='" + pageUrl.replace(/\,/g, "%2C") + "',body='" + pageUrl +"',subject='" + pageTitle + "',bodyislink=true";
if (currentIdentity)
args += ",preselectid='" + currentIdentity+ "'";
window.openDialog( "chrome://messenger/content/messengercompose/messengercompose.xul", "_blank",
"chrome,all,dialog=no", args);

View File

@ -151,6 +151,7 @@ function InitViewSortByMenu()
setSortByMenuItemCheckState("sortBySubjectMenuitem", (sortType == nsMsgViewSortType.bySubject));
setSortByMenuItemCheckState("sortByThreadMenuitem", (sortType == nsMsgViewSortType.byThread));
setSortByMenuItemCheckState("sortByUnreadMenuitem", (sortType == nsMsgViewSortType.byUnread));
setSortByMenuItemCheckState("sortByLabelMenuitem", (sortType == nsMsgViewSortType.byLabel));
// the Sender / Recipient menu is dynamic
setSortByMenuItemCheckState("sortBySenderOrRecipientMenuitem", (sortType == nsMsgViewSortType.byAuthor) || (sortType == nsMsgViewSortType.byRecipient));

View File

@ -960,6 +960,7 @@ Rights Reserved.
<menuitem id="sortBySubjectMenuitem" type="radio" name="sortby" label="&sortBySubjectCmd.label;" accesskey="&sortBySubjectCmd.accesskey;" oncommand="MsgSortBySubject()"/>
<menuitem id="sortByThreadMenuitem" type="radio" name="sortby" label="&sortByThreadCmd.label;" accesskey="&sortByThreadCmd.accesskey;" oncommand="MsgSortByThread()"/>
<menuitem id="sortByUnreadMenuitem" type="radio" name="sortby" label="&sortByUnreadCmd.label;" accesskey="&sortByUnreadCmd.accesskey;" oncommand="MsgSortByUnread()"/>
<menuitem id="sortByLabelMenuitem" type="radio" name="sortby" label="&sortByLabelCmd.label;" accesskey="&sortByLabelCmd.accesskey;" oncommand="MsgSortByLabel()"/>
<menuseparator/>
<menuitem id="sortAscending" type="radio" name="sortdirection" label="&sortAscending.label;" accesskey="&sortAscending.accesskey;" oncommand="MsgSortAscending()"/>
<menuitem id="sortDescending" type="radio" name="sortdirection" label="&sortDescending.label;" accesskey="&sortDescending.accesskey;" oncommand="MsgSortDescending()"/>

View File

@ -163,6 +163,11 @@ function MsgSortByStatus()
MsgSortThreadPane(nsMsgViewSortType.byStatus);
}
function MsgSortByLabel()
{
MsgSortThreadPane(nsMsgViewSortType.byLabel);
}
function MsgSortBySubject()
{
MsgSortThreadPane(nsMsgViewSortType.bySubject);

View File

@ -143,6 +143,8 @@ Rights Reserved.
<!ENTITY sortBySizeCmd.accesskey "z">
<!ENTITY sortByStatusCmd.label "Status">
<!ENTITY sortByStatusCmd.accesskey "u">
<!ENTITY sortByLabelCmd.label "Label">
<!ENTITY sortByLabelCmd.accesskey "l">
<!ENTITY sortBySubjectCmd.label "Subject">
<!ENTITY sortBySubjectCmd.accesskey "S">
<!-- Sender / Recipient lives in messenger.properties, since that item is dynamic -->