Hi Mohit,
In general I worry about the number of threads we have in CODA.
The more threads, the more bugs, and the less easy it is to reason
about the code.
Great to talk, thanks for wrestling with the printing issues.
What I'd really like you to do is it to move the code printing code out of this 'Bridge' thread, and into a new sub-class of the DocumentBroker: CODocumentBroker or somesuch (for Collabora Office). We should override the incoming message method there and check to look for allcaps CODA messages first I think.
Why ? several reasons - we don't want to add new threads - and we already have a thread that has the lifecycle of the document: the DocumentBroker. The DocumentBroker can handle local files, and is a great place for sharing code across platforms I think.
Against that of course - the print dialog bits, and LPR-invocations are unlikely to be useful across platforms, so perhaps it's not completely ideal, but still. I'd like to create a place where we can start to get rid of so many #if MOBILE type conditionals through the code.
Quite possibly we want to have multiple CODocumentBroker classes one per platform in qt/ and ios/ etc. that might work nicely.
It is possible that this would be even more elegant in the kit/ code though - which also handles and understands files - although in the medium term I'd really like us to get back to individual sandboxed processes for the kit/ backends if at all possible.
As we do the download/save-as in the DocumentBroker we should automatically get the download/progress bar pieces happening and showing in the UI for us, which I hope helps.
Then again - moving even further forward, ideally we would get the dialog shown, and the printer, and paper-size and so on selected before we punch these through LOK into the core print code, so that this works nicely again.
Anyhow - hope that helps; we don't need a new thread.
Thanks,
Michael.