-
-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Desktop: Support export of multiple notes to pdf files. #2468
Desktop: Support export of multiple notes to pdf files. #2468
Conversation
Looks very good, thanks a lot @mic704b. I've just noticed two small issues and then we can merge. |
Find unique filenames when exporting multiple pdfs. Simplify delay.
Thanks for the review @laurent22. I've updated in response, with a question above. I also made a small mod to the fs shim -- please check it carefully. The loop appeared to try the same last-resort filename unnecessarily many times. There was no comment justifying why, so I assume it is a mistake and fixed it. The only reason I can think it was like that, is that some filesystem is unreliable and will provide a different response if you ask it enough? |
I think it was me being a bit too careful. If that function is called multiple times from several places within the same milliseconds I guess two files could end up having the same name. Maybe let it loop a few more times just to be sure? (I guess that code will almost never be executed anyway, so it's not like it will slow anything down) |
…o unique filename search.
You're right, it is code that may never get run! Anyway, it's there, so I did a test run on an instrumented version, and on my system the loop runs at least 10 times every millisecond. So with 10000 loops it was effectively only trying max 1000 different filenames. I hope you don't mind, I put it back to 100 extra loops, but inserted a 10ms sleep so the filename tried is changed in each loop. So it now tries 100 extra times and will take about 1 extra second before it gives up. |
Looks good, thanks @mic704b! |
As requested and discussed in forum here
Comments
The change affects
export to pdf
launched from all locations:If one note is selected:
If multiple notes are selected:
eg
My Note Title (2).pdf
Some of the modified code is also used by the
print
function, however print behaviour should be unchanged.Testing
Tested manually on desktop (Linux)
Check export of multiple notes to pdf:
Check export of single note to pdf:
Check print:
Edit: Updated after changes in response to review