[Pkg-mozext-commits] [itsalltext] 64/459: If the editor is launched, it'll pop up the preferences.
David Prévot
taffit at moszumanska.debian.org
Tue Feb 24 23:26:06 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository itsalltext.
commit 4a4cd3b430d0e9651eea68403f416c05305e8840
Author: Christian Höltje <docwhat at gerf.org>
Date: Tue Jan 9 18:48:28 2007 -0500
If the editor is launched, it'll pop up the preferences.
---
chrome/content/itsalltext.js | 6 +++--
chrome/content/preferences.js | 22 +++++++++++++++++
chrome/content/preferences.xul | 56 +++++++++++++++++++++++-------------------
3 files changed, 57 insertions(+), 27 deletions(-)
diff --git a/chrome/content/itsalltext.js b/chrome/content/itsalltext.js
index 267252a..7c2d6ea 100644
--- a/chrome/content/itsalltext.js
+++ b/chrome/content/itsalltext.js
@@ -345,7 +345,6 @@ function ItsAllTextOverlay() {
};
// @todo [idea] pass in the line number to the editor
- // @todo [high] If the editor fails, we should open preferences.
// @todo [high] On edit, let user pick extension.
self.edit = function() {
if (self.node.nodeName != "TEXTAREA") { return; }
@@ -369,7 +368,10 @@ function ItsAllTextOverlay() {
var result = {};
process.run(false, args, args.length, result);
} catch(e) {
- that.debug('edit',filename,e);
+ window.openDialog('chrome://itsalltext/chrome/preferences.xul',
+ "Preferences",
+ "chrome,titlebar,toolbar,centerscreen,modal",
+ "badeditor");
}
};
diff --git a/chrome/content/preferences.js b/chrome/content/preferences.js
index 070b42b..48479ec 100644
--- a/chrome/content/preferences.js
+++ b/chrome/content/preferences.js
@@ -27,5 +27,27 @@ function pref_editor_select() {
var file = fp.file;
var pref_editor = document.getElementById('pref_editor');
pref_editor.value = file.path;
+ var editor = document.getElementById('editor');
+ editor.style.color = 'inherit';
+ editor.style.backgroundColor = 'inherit';
+ }
+}
+
+function setHelp(text) {
+ var help = document.getElementById('help');
+ while (help.firstChild) {
+ help.removeChild(help.firstChild);
+ }
+ var textnode = document.createTextNode(text);
+ help.appendChild(textnode);
+}
+
+function pref_onload() {
+ document.getElementById('browse').focus();
+ if (window.arguments && window.arguments[0] && window.arguments[0] == 'badeditor') {
+ var editor = document.getElementById('editor');
+ editor.style.color = 'black';
+ editor.style.backgroundColor = '#fb4';
+ setHelp("I was unable to run your editor, '"+editor.value+"'. You the browse button to choose another editor and try again.");
}
}
diff --git a/chrome/content/preferences.xul b/chrome/content/preferences.xul
index 90dc5a2..2492426 100644
--- a/chrome/content/preferences.xul
+++ b/chrome/content/preferences.xul
@@ -4,7 +4,7 @@
<prefwindow id="itsalltext-prefs"
title="It's All Text Preferences"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- onload="document.getElementById('browse').focus();">
+ onload="pref_onload();">
<script type="application/x-javascript" src="preferences.js"/>
@@ -20,30 +20,36 @@
name="extensions.itsalltext.debug" type="bool"/>
</preferences>
- <vbox>
- <hbox align="right">
- <label control="editor" value="Editor: "/>
- <textbox preference="pref_editor" id="editor" size="20" readonly="false"
- style="-moz-appearance: none !important; background: inherit !important;" />
- <button oncommand="pref_editor_select();" label="Browse" id="browse"
- accesskey="b" tabindex="1"/>
- </hbox>
- <hbox align="right">
- <label control="seconds" value="Seconds between refreshing: "/>
- <textbox preference="pref_seconds" id="seconds" size="2"
- maxlength="2" tabindex="2"/>
- </hbox>
- <hbox align="right">
- <label control="charset"
- value="Character Set (default: UTF-8): "/>
- <textbox preference="pref_charset" id="charset" size="8" tabindex="3"/>
- </hbox>
- <hbox align="right">
- <label control="debug"
- value="Enable Debugging: "/>
- <checkbox preference="pref_debug" id="debug" tabindex="4"/>
- </hbox>
- </vbox>
+ <hbox>
+ <vbox>
+ <hbox align="right">
+ <label control="editor" value="Editor: "/>
+ <textbox preference="pref_editor" id="editor" size="20" readonly="false"
+ style="-moz-appearance: none !important; background: inherit;" />
+ <button oncommand="pref_editor_select();" label="Browse" id="browse"
+ accesskey="b" tabindex="1"/>
+ </hbox>
+ <hbox align="right">
+ <label control="seconds" value="Seconds between refreshing: "/>
+ <textbox preference="pref_seconds" id="seconds" size="2"
+ maxlength="2" tabindex="2"/>
+ </hbox>
+ <hbox align="right">
+ <label control="charset"
+ value="Character Set (default: UTF-8): "/>
+ <textbox preference="pref_charset" id="charset" size="8" tabindex="3"/>
+ </hbox>
+ <hbox align="right">
+ <label control="debug"
+ value="Enable Debugging: "/>
+ <checkbox preference="pref_debug" id="debug" tabindex="4"/>
+ </hbox>
+ </vbox>
+ <vbox>
+ <description id="help" style="max-width: 15em;">
+ </description>
+ </vbox>
+ </hbox>
</prefpane>
</prefwindow>
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/itsalltext.git
More information about the Pkg-mozext-commits
mailing list