In theory, a book recorded in a local library may have only its url defined
(and no path to a ZIM file). Such a book qualifies as downloadable too.
That's why the call to `ContentManager::getRemoteOrLocalBook()` (which
may return a "local" book) perfectly makes sense in
`ContentManager::downloadBook()`.
However, it doesn't then make sense to raise an error if the returned
book turns out to be a "local" one. It would be more logical to request
only for a remote book and report an error if that operation fails.
ContentManagerModel depends on the current view settings (filters) much
more than ContentManager does. Since the download state (the set of
active and/or paused downloads and their progress info) is independent
of the view settings it is more natural for ContentManager to own it.
Since the content manager model may be updated (e.g. by applying a
filter) while the thumbnails/favicons are still being loaded it is
better to use a model invariant id for the thumbnails.
When using a debug server (enabled by the environment variables
KIWIX_CATALOG_HOST and KIWIX_CATALOG_PORT) the URLs of the favicons
must be composed correspondingly.
This fix is rather a temporary and ugly hack, since the current mess
with how download states are being maintained (in the presence of
multiple sources of their updates) asks for a major clean-up.
This fixes the bugs related to pending download statuses being discarded
by filtering and similar operations that result in full update of the
ContentManagerModel.
Instead this commit leads to a new bug - completion of a download
is not always properly detected for very small (and thus instantaneous)
downloads. This is caused by library update events triggered by ZIM
directory monitoring (which notifies about a new ZIM file appearing
in the download directory) interfering with the download status update
signal.
Now DownloadState is an optional element of the state of RowNode
and is set in it only in case of an active (even if paused) download
associated with the that entry.