2022-10-24 22:12:35 +08:00
|
|
|
(rl => {
|
|
|
|
// if (rl.settings.get('Nextcloud'))
|
|
|
|
|
|
|
|
addEventListener('rl-view-model.create', e => {
|
|
|
|
if ('MailMessageList' === e.detail.viewModelTemplateID) {
|
|
|
|
let view = e.detail;
|
|
|
|
view.nextcloudSaveMsgs = () => {
|
|
|
|
view.messageList.hasChecked()
|
2022-11-24 23:44:55 +08:00
|
|
|
&& rl.nextcloud.selectFolder().then(folder => {
|
2022-10-24 22:12:35 +08:00
|
|
|
folder && view.messageList.forEach(msg => {
|
|
|
|
msg.checked() && rl.pluginRemoteRequest(
|
|
|
|
(iError, data) => {
|
|
|
|
console.dir({
|
|
|
|
iError:iError,
|
|
|
|
data:data
|
|
|
|
});
|
|
|
|
},
|
|
|
|
'NextcloudSaveMsg',
|
|
|
|
{
|
|
|
|
'msgHash': msg.requestHash,
|
|
|
|
'folder': folder,
|
|
|
|
'filename': msg.subject()
|
|
|
|
}
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2023-01-26 17:41:55 +08:00
|
|
|
const msgMenu = document.getElementById('MailMessageList')
|
|
|
|
.content.querySelector('#more-list-dropdown-id + menu [data-bind*="forwardCommand"]');
|
2022-10-24 22:12:35 +08:00
|
|
|
if (msgMenu) {
|
2022-10-28 15:58:04 +08:00
|
|
|
msgMenu.after(Element.fromHTML(`<li role="presentation" data-bind="css:{disabled:!messageList.hasChecked()}">
|
|
|
|
<a href="#" tabindex="-1" data-icon="📥" data-bind="click: nextcloudSaveMsgs" data-i18n="NEXTCLOUD/SAVE_EML"></a>
|
|
|
|
</li>`));
|
2022-10-24 22:12:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
})(window.rl);
|