2010-12-08 102 views
0

我正在构建一个Mozilla Thunderbird的扩展,它可以对消息进行一些翻译。我想添加翻译附件功能,尽管我在查看每个附件的内容时遇到了一些问题。目前,我正在接入attachmentListContext弹出窗口,并且我有一些代码收集相关的附件URI和URL。如何访问每个相关附件的二进制数据?如何获取Mozilla Thunderbird扩展中的附件内容?

当前代码获取所选的附件:

handleAttachmentTranslate : function() { 
    // see code in msgHeaderViewOverlay.js in Thunderbird source 
    var attachmentList = document.getElementById('attachmentList'); 
    var selectedAttachments = new Array(); 
    for (var i in attachmentList.selectedItems) { 
    var attachment = attachmentList.selectedItems[i].attachment; 
    // we can now access attachment.url or attachment.uri, etc 
    selectedAttachments.push(attachment.url); 
    // or (ideally) 
    // alert(this.translate(getData(attachment.url))) 
    // but what is getData()? 
    } 
}, 

回答

2

FiltaQuilla插件确实有保存附件等,它可能包含一些代码,是相关的能力。

更新2011年4月25日:page posted by speedball2001已在3月25日和3月31日之间进行了修改。现在它有一个完整的示例。检查出。它还指向完成附件操作的a real extension。这看起来是一个有希望的答案。

现在的想法是在必要时将此新演示代码连接到FiltaQuilla。

+0

好的。我看着FiltaQuilla代码,它不提取附件,因此它不相关。 – minghua 2011-03-25 06:18:11