1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-07 15:44:12 +01:00

[muttator] new :set autoexternal option, make sure to set it in the config file, not in the command line

This commit is contained in:
Martin Stubenschrott
2008-08-03 13:24:05 +00:00
parent f762f9e35b
commit 5c8a28215d
2 changed files with 60 additions and 6 deletions

View File

@@ -993,9 +993,6 @@ liberator.Events = function () //{{{
{ {
dump("Compose editor got focus\n"); dump("Compose editor got focus\n");
liberator.modes.set(liberator.modes.INSERT, liberator.modes.TEXTAREA); liberator.modes.set(liberator.modes.INSERT, liberator.modes.TEXTAREA);
//setTimeout(function (){ liberator.editor.editWithExternalEditor(); }, 100);
win.blur();
//liberator.editor.editWithExternalEditor();
} }
else if (liberator.mode != liberator.modes.MESSAGE) else if (liberator.mode != liberator.modes.MESSAGE)
liberator.mode = liberator.modes.MESSAGE; liberator.mode = liberator.modes.MESSAGE;

View File

@@ -103,10 +103,19 @@ liberator.config = {
// GetThreadTree()._selectDelay = 300; // TODO: make configurable // GetThreadTree()._selectDelay = 300; // TODO: make configurable
this.isComposeWindow = window.wintype == "msgcompose"; this.isComposeWindow = window.wintype == "msgcompose";
// 0: never automatically edit externally
// 1: automatically edit externally when message window is shown the first time
// 2: automatically edit externally, once the message text gets focus (not working currently)
liberator.options.add(["autoexternal", "ae"],
"Edit message with external editor by default",
"boolean", false);
// load Muttator specific modules // load Muttator specific modules
if (this.isComposeWindow) if (this.isComposeWindow)
{ {
this.features = ["mail"]; this.features = ["addressbook"]; // the composer has no special features
//liberator.loadModule("addressbook", liberator.Addressbook);
// TODO: move mappings elsewhere, probably compose.js // TODO: move mappings elsewhere, probably compose.js
liberator.mappings.add([liberator.modes.COMPOSE], liberator.mappings.add([liberator.modes.COMPOSE],
@@ -135,8 +144,56 @@ liberator.config = {
function () { SetMsgBodyFrameFocus(); }); function () { SetMsgBodyFrameFocus(); });
liberator.mappings.add([liberator.modes.COMPOSE], liberator.mappings.add([liberator.modes.COMPOSE],
["q", "ZQ"], "Close composer", ["q"], "Close composer, ask when for unsaved changes",
function () { window.close(); }); function () { DoCommandClose(); });
liberator.mappings.add([liberator.modes.COMPOSE],
["Q", "ZQ"], "Force closing composer",
function () { MsgComposeCloseWindow(true); /* cache window for better performance*/ });
var stateListener =
{
QueryInterface: function (aIID)
{
if (aIID.equals(Components.interfaces.nsIDocumentStateListener))
return this;
throw Components.results.NS_NOINTERFACE;
},
// this is (also) fired once the new compose window loaded the message for the first time
NotifyDocumentStateChanged: function (nowDirty)
{
// only edit with external editor if this window was not cached!
if (liberator.options["autoexternal"] && !window.messageWasEditedExternally/* && !gMsgCompose.recycledWindow*/)
{
window.messageWasEditedExternally = true;
liberator.editor.editWithExternalEditor();
}
},
NotifyDocumentCreated: function () { },
NotifyDocumentWillBeDestroyed: function () { }
}
// XXX: Hack!
window.document.addEventListener("load", function()
{
if (typeof(window.messageWasEditedExternally) == "undefined")
{
window.messageWasEditedExternally = false;
GetCurrentEditor().addDocumentStateListener(stateListener);
}
}, true);
window.addEventListener("compose-window-close", function()
{
window.messageWasEditedExternally = false;
}, true);
/*window.document.addEventListener("unload", function() {
GetCurrentEditor().removeDocumentStateListener(liberator.config.stateListener);
}, true);*/
} }
else else
{ {