Notes:
- The `getAction()` helper function was introduced in order to keep the
line length within the 80 chars limit and was applied to other usages
of `KiwixApp::getAction()` too.
- The tooltip includes the keyboard shortcut which closes only the
current tab but the tooltip is the same for all the tabs.
Obtaining the value of the ALT+[0-9] shortcut from the action objects
would be justified if they were connected to the same (shared) handler.
But since handlers are distinct lambda objects the sought value can be
obtained via a captured variable.
Before this change, after a tab was closed its adjacent tab (the next
one or, in the absence of such, the previous one) became active, no
matter which tab was active before that. Now that logic applies only
if the currently active tab is closed.
The function responsible for that logic was removed because its name
was not a good one and its existence was not justified given that it
could be replaced by a oneliner and that it was used only once.
Before this change, an attempt to close the library tab via a
middle-click - although prevented by a dedicated check - had a
side-effect of switching to the tab next to the library tab.
The only justified check for the availability of download functionality
is in the initiation of the download action
(`ContentManager::downloadBook()`) - if no download is started then
(assuming otherwise correct code) it should be impossible to pause,
resume or cancel one.
One small difference of getFaviconUrl() from the piece of code it was
created from is that, in case the book doesn't contain an illustration,
an empty string is returned directly rather than via a confusing
default-constructed Illustration object.
The commit "Moved download deregistration to ContentManager" introduced
a bug - completed downloads were not properly deregistered.
Note that a simpler fix by adding a single `m_downloads.remove(bookId);`
line in `ContentManager::downloadCompleted()` didn't work (which means
that that function is not always called upon download completion). I am
not going to investigate that issue now, hoping that it will be
automatically resolved once the redesign of download management is
finished.
Now there is a single timer in ContentManager shared by all pending downloads.
Temporarily, all active downloads are updated on every firing of the
timer and this happens in the main thread. This will be changed later.
The main objective of this change is to get rid of the timer in
DownloadState so that it can be converted to a dumb struct set by
ContentManager.
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.