RealRaven2000 / QuickFolders

Thunderbird Add-on: QuickFolders
http://quickfolders.org/
Other
48 stars 9 forks source link

Drag to new subfolder command missing #420

Closed RealRaven2000 closed 11 months ago

RealRaven2000 commented 11 months ago

When dragging email to a QuickFolders tab, we are missing the command "new subfolder...". This menu should be there on dropping mail if the setting is activated in QuickFolders Advanced settings / Mail Commands:

image

This is expected to append "New Subfolder..." to the bottom of the dropdown menu when an email is dragged onto a Tab. This is now always missing.

RealRaven2000 commented 11 months ago

Apparently the source code of my function addDragToNewFolderItem() used to clone material from the Thunderbird folder pane context menu - but this is not available to QuickFolders any more:

// New Folder... submenu items
let folderPaneContext = document.getElementById("folderPaneContext");
if (folderPaneContext) {
let newMenuItem = document.getElementById("QF_folderPaneContext-new");
if (newMenuItem) {
    let createFolderMenuItem=newMenuItem.cloneNode(true);
    if (folder.hasSubFolders) {
        let sep = this.createIconicElement("menuseparator","*", popupMenu.ownerDocument);
        popupMenu.appendChild(sep);
    }
    createFolderMenuItem.id=""; // delete existing menu
    createFolderMenuItem.id="QF_folderPaneContext-new"; // for styling!
    createFolderMenuItem.folder=folder;

    createFolderMenuItem.setAttribute("class","menuitem-iconic");

    // use parent folder URI as each starting point
    this.setEventAttribute(createFolderMenuItem, "ondragenter","QuickFolders.popupDragObserver.dragEnter(event);");
    this.setEventAttribute(createFolderMenuItem, "ondrop","QuickFolders.popupDragObserver.drop(event);");  // only case where we use the dedicated observer of the popup!

    // [Bug 26425] option to put 'create new subfolder' on top
    if (prefs.getBoolPref("dragToCreateFolder.menutop"))
        popupMenu.insertBefore(createFolderMenuItem, popupMenu.firstChild);
    else
        popupMenu.appendChild(createFolderMenuItem);
    }
}

So we need to create this menu item from scratch rather than cloning it from Thunderbird...

RealRaven2000 commented 11 months ago

Fixed version below:

QuickFolders-mx-6.3pre149.zip

this will only copy the label and accelerator key from the folderpane popup, everything else is generated from scratch.


To test the new version above, download the zip file, drag the file into Thunderbird Add-ons Manager, do not extract contents or if won't install.

RealRaven2000 commented 11 months ago

Fixed in 6.3 - Published 30/10/2023