Skip to content

Recent Folders list not updated when moving email using drag and drop #80

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
lguillau opened this issue Nov 26, 2020 · 5 comments
Closed

Comments

@lguillau
Copy link

lguillau commented Nov 26, 2020

When I drag and drop an email from my inbox to a destination folder (in the folder tree) that is not already in the "recent folders" list, I would expect the destination folder to be added at the top of the "recent folders" list, which is not apparently the case. The destination folder is not added to the "recent folders" list.
(This is with TB 78.5.0 (64-bit) and QuickFolders Pro 5)
Thanks
BR
Laurent

@RealRaven2000
Copy link
Owner

RealRaven2000 commented Nov 26, 2020

When I drag and drop an email from my inbox to a destination folder (in the folder tree) that is not already in the "recent folders" list, I would expect the destination folder to be added at the top of the "recent folders" list, which is not apparently the case. The destination folder is not added to the "recent folders" list.
(This is with TB 78.5.0 (64-bit) and QuickFolders Pro 5)

There is a Utility function that I am using to update the folder timestamp, which can be easily monitored via JavaScript error console by switching on QuickFolders "debug mode" on the bottom of the QF Settings advanced panel:

image

It seems to be currently triggered when dragging a mail to the quickfolders toolbar (a tab or subfolder) like this
image

output:

QuickFolders 17:47:15.755  [6604 ms]	 
util.touch(test)
1606412835
26/11 17:47:15
QuickFolders 17:47:15.755  [0 ms]	 
buttonDragObserver.drop DropTarget = toolbarbutton0  Target Folder:test

Personally I do not really drag mail to the folder tree anymore because it is harder to use a long scrolling list, but there should be a folder listener for this particular panel too. In fact I completely ignore the tree for all mail organisation and navigation to avoid rsi; this is why the issue hasn't affected me personally to that extent.

In the original code (master branch, supports Thunderbird up to version 68.*) we have this in the original overlay [overlay.xul]:
QuickFolders_mailSession.AddFolderListener(QuickFolders.FolderListener, Components.interfaces.nsIFolderListener.all);

In the TB78 code this was migrated to the background script running for the main window [qf-messenger.js] line 512:
window.QuickFolders_mailSession.AddFolderListener(window.QuickFolders.FolderListener, Components.interfaces.nsIFolderListener.all);

the timestamp should be updated within the function fldListen_OnItemAdded() if everything goes according to plan.
But I need to check whether that only handles adding folders and not emails to the folder listener.

@RealRaven2000
Copy link
Owner

I think the more promising approach will be to extend the folder listener function fldListen_OnItemIntPropertyChanged( ), which can be used to monitor a change of the number of total messages. normally I would expect Thunderbird to do that work for me and update the timestamp but let's put in some code to "touch" the folder, in this case.

Here is a test version:
QuickFolders-wx-5.1pre5.zip

it's not quite all smiles and roses - the touch function is actually triggered multiple times, not just for the folder that mail was dropped into, but also the originating folder, which may very well happen later - which means the target folder will be listed in second place on the recent folders list.

@RealRaven2000
Copy link
Owner

RealRaven2000 commented Nov 26, 2020

So I decided to modify the listener and only update if mails (but also unread messages) have been added; so only if newValue > oldValue - to properly test, please restart thundebird after installation. I have added code to remove the folderlistener in the last version but it still seemed to run the old code (this could also be an artifact of having debugged it).

QuickFolders-wx-5.1pre6.zip

So this basically will update the timestamp for the folder you have moved mails to, but not the folder that you removed it from; this makes sure that the folder that got new mails will be put on the top of the recent folder list (provided Thunderbird doesn't also do something in the meantime that updates another folder timestamp, e.g. downloads new mails from the server or sync the folder).

The other thing my guard against "smaller values" does is that it won't constantly update the timestamp while reading a folder (and thus decreasing the unread count) - however if you go to a folder and set a mail as "unread" manually, it will be popped to the top of the recent folders list - is this desired behavior @Iguillau ?

@RealRaven2000
Copy link
Owner

I did a bit more work on this feature - turns out folders like (Drafts, Trash, Archive, Sent, and Junk) will constantly show up on top. So I am guarding against that in the "touch( ) " function in this new version:

QuickFolders-wx-5.1pre33.zip

hope you can test drive this for a bit

@RealRaven2000
Copy link
Owner

fixed in 5.1 released on 10/Dec/2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants