Commit ff29a522 authored by Antonin Delpeuch's avatar Antonin Delpeuch
Browse files

disabled the buttons cleanly

parent 6f380103
......@@ -35,7 +35,7 @@ var ToolbarEvents = {
updateButtons: function() {
if(!gFolderDisplay)
return;
LOG("test passed");
var msg = gFolderDisplay.selectedMessage;
if(!msg)
return;
......@@ -49,23 +49,24 @@ var ToolbarEvents = {
ToolbarEvents.mylog(msg);
var re = /moderate ([0-9A-F]{8}) \(([a-z0-9]*)\)/g;
matches = re.exec(subject);
ToolbarEvents.mylog(msg);
if(!matches)
{
acceptButton.label='';
rejectButton.label='';
ToolbarEvents.currentCookie = '';
acceptButton.disabled = true;
rejectButton.disabled = true;
}
else
{
ToolbarEvents.currentCookie = matches[1];
acceptButton.label='Accepter';
rejectButton.label='Rejeter';
acceptButton.disabled = false;
rejectButton.disabled = false;
}
},
runCmd: function(action,cookie)
{
ToolbarEvents.mylog("running runCmd");
var process = Components.classes["@mozilla.org/process/util;1"]
.createInstance(Components.interfaces.nsIProcess);
......@@ -80,13 +81,17 @@ var ToolbarEvents = {
},
onAccept: function() {
ToolbarEvents.mylog("running onAccept");
ToolbarEvents.runCmd("transmettre", ToolbarEvents.currentCookie);
if(ToolbarEvents.currentCookie != '')
{
ToolbarEvents.runCmd("transmettre", ToolbarEvents.currentCookie);
}
},
onReject: function() {
LOG("onReject called");
window.open("chrome://moderation/content/hello.xul", "", "chrome");
if(ToolbarEvents.currentCookie != '')
{
ToolbarEvents.runCmd("refuser", ToolbarEvents.currentCookie);
}
},
LOG:function(msg) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment