Thanks for this. I noticed a small bug: it fails to mark a file as ToC when another file is already marked but it is not on the spine (e.g.: when you upgrade the internals, the nav.xhtml file is not on the spine, but it is marked as NAV).
Works for me with nav.xhtml in the Miscellaneous section of the file
browser. Marking another xhtml file in the spine causes it to be marked
with the nav property in the OPF as expected.
Fixed in branch master. The fix will be in the next release. calibre is usually released every alternate Friday.
status fixreleased