1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-03-31 12:03:31 +02:00

[muttator] new "x" and "h" mappings for HTML/header display

This commit is contained in:
Martin Stubenschrott
2008-06-07 23:11:06 +00:00
parent ff92690794
commit 9988e62ed9
2 changed files with 42 additions and 3 deletions

View File

@@ -1323,6 +1323,8 @@ liberator.Events = function () //{{{
if (!(liberator.modes.extended & liberator.modes.INPUT_MULTILINE)) if (!(liberator.modes.extended & liberator.modes.INPUT_MULTILINE))
liberator.commandline.onEvent(event); // reroute event in command line mode liberator.commandline.onEvent(event); // reroute event in command line mode
} }
else // NORMAL mode, no liberator mapping
liberator.beep();
} }
} }

View File

@@ -579,6 +579,34 @@ liberator.Mail = function () //{{{
}); });
}); });
liberator.mappings.add(modes, ["h"],
"Toggle displayed headers",
function ()
{
var value = gPrefBranch.getIntPref("mail.show_headers", 2);
gPrefBranch.setIntPref("mail.show_headers", value == 2 ? 1 : 2);
MsgReload();
});
liberator.mappings.add(modes, ["x"],
"Toggle HTML message display",
function ()
{
var want_html = (gPrefBranch.getIntPref("mailnews.display.html_as", 1) == 1);
gPrefBranch.setBoolPref("mailnews.display.prefer_plaintext", want_html ? false : true);
gPrefBranch.setIntPref("mailnews.display.html_as", want_html ? 0 : 1);
gPrefBranch.setIntPref("mailnews.display.disallow_mime_handlers", want_html ? 0 : gDisallow_classes_no_html);
/*MsgBodySanitized() {
gPrefBranch.setBoolPref("mailnews.display.prefer_plaintext",
false); gPrefBranch.setIntPref("mailnews.display.html_as", 3);
gPrefBranch.setIntPref("mailnews.display.disallow_mime_handlers",
gDisallow_classes_no_html); MsgReload(); return true; }*/
MsgReload();
});
/////////////////////////////////////////////////////////////////////////////}}} /////////////////////////////////////////////////////////////////////////////}}}
////////////////////// COMMANDS //////////////////////////////////////////////// ////////////////////// COMMANDS ////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{ /////////////////////////////////////////////////////////////////////////////{{{
@@ -843,14 +871,23 @@ liberator.Mail = function () //{{{
*/ */
selectMessage: function (validatorFunc, canWrap, openThreads, reverse, count) selectMessage: function (validatorFunc, canWrap, openThreads, reverse, count)
{ {
function currentIndex()
{
var index = gDBView.selection.currentIndex;
if (index < 0)
index = 0;
return index;
}
function closedThread(index) function closedThread(index)
{ {
if (!(gDBView.viewFlags & nsMsgViewFlagsType.kThreadedDisplay)) if (!(gDBView.viewFlags & nsMsgViewFlagsType.kThreadedDisplay))
return false; return false;
index = (typeof index == "number") ? index : gDBView.selection.currentIndex; index = (typeof index == "number") ? index : currentIndex();
return !gDBView.isContainerOpen(index) && !gDBView.isContainerEmpty(index); return !gDBView.isContainerOpen(index) && !gDBView.isContainerEmpty(index);
} }
if (typeof validatorFunc != "function") if (typeof validatorFunc != "function")
return; return;
@@ -860,7 +897,7 @@ liberator.Mail = function () //{{{
// first try to find in current folder // first try to find in current folder
if (gDBView) if (gDBView)
{ {
for (var i = gDBView.selection.currentIndex + (reverse ? -1 : (openThreads && closedThread() ? 0 : 1)); for (var i = currentIndex() + (reverse ? -1 : (openThreads && closedThread() ? 0 : 1));
reverse ? (i >= 0) : (i < gDBView.rowCount); reverse ? (i >= 0) : (i < gDBView.rowCount);
reverse ? i-- : i++) reverse ? i-- : i++)
{ {
@@ -873,7 +910,7 @@ liberator.Mail = function () //{{{
var thread = gDBView.db.GetThreadContainingMsgHdr(msg); var thread = gDBView.db.GetThreadContainingMsgHdr(msg);
var originalCount = count; var originalCount = count;
for (let j = (i == gDBView.selection.currentIndex && !reverse) ? 1 : (reverse ? thread.numChildren - 1 : 0); for (let j = (i == currentIndex() && !reverse) ? 1 : (reverse ? thread.numChildren - 1 : 0);
reverse ? (j >= 0) : (j < thread.numChildren); reverse ? (j >= 0) : (j < thread.numChildren);
reverse ? j-- : j++) reverse ? j-- : j++)
{ {