diff --git a/plugins/nextcloud/index.php b/plugins/nextcloud/index.php index d46028558c..ca0bf73507 100644 --- a/plugins/nextcloud/index.php +++ b/plugins/nextcloud/index.php @@ -23,9 +23,11 @@ public function Init() : void $this->addJs('js/message.js'); $this->addHook('json.attachments', 'DoAttachmentsActions'); $this->addJsonHook('NextcloudSaveMsg', 'NextcloudSaveMsg'); - $this->addJsonHook('NextcloudAttachFile', 'NextcloudAttachFile'); $this->addJs('js/composer.js'); + $this->addJsonHook('NextcloudAttachFile', 'NextcloudAttachFile'); + + $this->addJs('js/messagelist.js'); $this->addTemplate('templates/PopupsNextcloudFiles.html'); } diff --git a/plugins/nextcloud/js/messagelist.js b/plugins/nextcloud/js/messagelist.js new file mode 100644 index 0000000000..398b40c78a --- /dev/null +++ b/plugins/nextcloud/js/messagelist.js @@ -0,0 +1,40 @@ +(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() + && rl.ncFiles.selectFolder().then(folder => { + 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() + } + ); + }); + }); + }; + } + }); + + let template = document.getElementById('MailMessageList'); + + const msgMenu = template.content.querySelector('#more-list-dropdown-id + menu [data-bind*="forwardCommand"]'); + if (msgMenu) { + msgMenu.after(Element.fromHTML('
  • ' + + '' + + '
  • ')); + } + +})(window.rl);