Added InfoMessage:drawTopMsg() method
Displaying a pop-up window for operations like adding a bookmark seems a
bit of an overkill for simple messages like "Bookmark added" or
"Bookmark already exists". Therefore, based on the suggestion by
@dracodoc I have implemented an InfoMessage:drawTopMsg() for this
purpose which just renders the text in the top left corner on a gray
background of auto-calculated appropriate width.
Cleanup the forcing of portrait mode
1. Move the setting of G_width/G_height inside the function
Screen:setRotationMode()
2. Don't call self:clearCache() twice on closing the document (once is enough).
3. Get rid of UniReader:setRotationMode() method because
Screen:setRotationMode() is enough, as there is nothing reader- or
document-specific in this function.
Cleanup FileChooser:choose() method.
1. Remove the unnecessary parameters from FileChooser:choose() method.
2. Save frequently used expression G_width - 2*self.margin_H in a local
variable.
3. Replace the calls to fb.bb:getWidth() and fb.bb:getHeight() with the
locally saved copies of G_width and G_height respectively.
Make FileChooser:choose() work in landscape
Although we are forcing portrait mode upon closing a document and also
start up FileChooser in portrait mode, it is best to not rely on this
fact within the FileChooser itself.
Therefore, I have enhanced FileChooser:choose() method to handle both
landscape and portrait modes by removing the assumption that the global
variables G_width and G_height will maintain the value they had
upon the entry to this function.
This supercedes the fix in PR 616 which actually introduced a memory
corruption bug by using the stale values of G_height/G_width in some
contexts and refreshed value(s) in others.
Make bm_menu in UniReader:showBookMarks() local
We should not overwrite a global bm_menu (if it exists).
Add support for deleting bookmarks for crengine
The function CREReader:showBookMarks() can have the same logic present
also in its UniReader counterpart, except the goto has to deal with
"xpointers".
Also, I added the number of bookmarks shown in the title of bookmarks
list dialog, just like I did for UniReader:showBookMarks() previously.
Unify Home and Alt-Back commands for UniReader
The command handlers for Home and Alt-Back commands currently perform
exactly the same function (of closing the document) despite the help page
and even the Lua code suggesting otherwise, so it makes sense to merge
them into a single command handler.
Bugfix: prevent crash in openFile()
The code which determines file type in openFile() is actually unused, so
it can be safely removed. Moreover, if the filename passed to openFile()
happens to have no extension then this would crash openFile(). The
reason this was not noticed before is because no such filename was
passed to openFile() ever, but will be after the next few commits that
are coming...
Restore full filemanager functionality
Prior to introduction of the reader-chooser infrastructure we had a very
useful feature of browsing (and therefore
copying/moving/deleting/renaming/creating) filesystem tree accessing
arbitrary files if the user privilege mode is set to any value higher
than BEGINNER.
This patch restores this functionality by checking the privilege levels
in readerchooser and returning CREReader for any file type if there is
no other reader associated with it (including files with no extension).
Don't crash in fileinfo on files with no extension
Treat a file with no extension as crengine-supported txt file.
Don't crash on files with no extension
Use empty string as default extension
For treating document settings it is better to use empty string ""
rather than "txt" as a default extension type.
Merge pull request #617 from tigran123/bookmarks

Added InfoMessage:drawTopMsg() method
Merge pull request #618 from tigran123/rotation-mode

Cleanup the forcing of portrait mode and make FileChooser work in landscape mode
Merge pull request #620 from tigran123/delete-bookmarks-crengine

Support deleting bookmarks in crengine
Merge pull request #621 from tigran123/home

Unify Home and Alt-Back commands for UniReader
Merge pull request #622 from tigran123/ext-all

Restore full File Manager functionality to KPV
Remove unneeded redraw of the current page.
The function UniReader:showHighLight() internally handles all cases
where page redraw is necessary. Therefore, there is no need to redraw
the current page (much less to :goto() to it) on return from it.
Re-sort the history list on closing document
The "Last Documents" list is re-sorted on operations that modify it,
such as deleting an entry. But opening/closing a document is also one
such operation and, therefore, requires re-sorting.
Redraw current page on return from highlight mode
When returning from highlight mode there is no need to :goto() to the
current page (and force dummy pre-cache) --- all that is needed is the
redraw of the current page.