Author Topic: plunging contextmenu : How to add an entry to contextmenu message list ?  (Read 3449 times)

Offline FDIGG

  • Newbie
  • *
  • Posts: 1
I've got roundcube 1.2.0  + pluging contextmenu 2.1.2.

I try to upgrade my old pluging adding an entry to the contextmenu in message list.
 Old command :
.. Js...
     if (window.rcm_contextmenu_register_command) {
            rcm_contextmenu_register_command('plugin.filters_sel', rcmail_createfilterfromlist, rcmail.gettext('doli_filters.filters'), 'conmentitle', 'after', true, null, null, ' filters_li');
        }
...

I succed to add an entry in folder list , but I failled with the key word "messagelist"

.. Js...

  rcmail.register_command('AA', function () {// Just for testing...
            alert('AA');
        }, true);

       rcmail.addEventListener('contextmenu_init', function (menu) {
            // identify the folder list context menu
            if (menu.menu_name == 'messagelist') {
                // add a shortcut to the folder management screen to the end of the menu
                menu.menu_source.push({label: 'Manage folders', command: 'AA', props: '', classes: ''});
                // make sure this new shortcut is always active
                menu.addEventListener('activate', function (p) {
                    if (p.command == 'AA') {
                        return true;
                    }
                });
            }
        });
...   
Did some one succeeded to do some thing similar ?
thanks.

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,856
The function rcm_contextmenu_register_command() was scrapped in version 2 of the contextmenu plugin. Now the menus are built directly from the Roundcube toolbars. Please have a look at the manual.md file distributed with the plugin, that has some information on how to customise the menu.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and moreā€¦