-
Notifications
You must be signed in to change notification settings - Fork 5
/
custom-button.tb2taskwarrior
28 lines (23 loc) · 1.06 KB
/
custom-button.tb2taskwarrior
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*CODE*/
// tb2taskwarrior v0.1
// Pedram Hayati (Pi3cH)
// https://github.com/pi3ch/tb2taskwarrior
//Path to xterm
var taskPath = "/usr/bin/xterm";
var messageUri = gFolderDisplay.selectedMessageUris[0];
var msgHdr = messenger.messageServiceFromURI(messageUri).messageURIToMsgHdr(messageUri);
var box = custombuttons.promptBox("Add task", "Modify the title or add more attributes \n(e.g. due:tomorrow, pro:Party)", '"' + msgHdr.mime2DecodedSubject + '"');
if(box[0])
{
// change arguments to task
var topicName = "add +inbox +email Email: " + box[1];
var args = [ "-e", "task "+topicName+"" ];
var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
file.initWithPath(taskPath);
var process = Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);
process.init(file);
process.run(true, args, args.length);
custombuttons.alertSlide("Add task", "Task "+box[1]+" added successfully.");
} else {
//custombuttons.alertSlide("Add task", "Task "+box[1]+" has NOT added.");
}