Commit Graph

1031 Commits

Author SHA1 Message Date
Tigran Aivazian
2fdecb7b40 Don't assert() around io.popen() and use generic FileExists(). 2012-09-25 12:19:34 +01:00
Tigran Aivazian
ac46f7237f Fix a typo "Q to E" -> "Q to P" in Active Keys helppage. 2012-09-25 12:11:11 +01:00
Tigran Aivazian
504425cd89 Fix for the issue #314 introduced by a commit in #310
When I rewrote the function CREReader:ZipContentExt() I lost
the code path leading to "Error unzipping file." message.
This was now restored, plus two required changes:
1. There is no need to surround io.popen() with assert() as it
never fails, not even if the command is non-existent. Besides,
even if it did, crashing the whole viewer just because for
some reason we can't unzip the file is not a good idea.
2. The "while tmp" after tmp=assert() assignment is meaningless.
Even after removing assert() it is still meaningless because io.popen()
can never return nil, oddly enough.
2012-09-25 11:55:16 +01:00
Tigran Aivazian
864be87fc2 Tidy up BatteryLevel() function.
1. Remove assert() around io.popen() as this function never fails, even
when opening a pipe to a non-existent program.
2. Remove the second assert() as well, because it is not wise to fail the whole
application just because we don't know or cannot ascertain the battery
level.
3. Guard against the failure of gasgauge-info (e.g. on emulator where it
does not exist, so, effectively "fails") by checking what we read from
the pipe and return "?" if need be.
2012-09-25 11:08:06 +01:00
Tigran Aivazian
06a0b27664 Allow clearing both internal and document caches via Menu
Bind the key "C" in Menu to clear internal tile cache and key "D" to
clear the document cache.
2012-09-25 10:55:31 +01:00
Tigran Aivazian
16623b5b08 Cleanup of djvu.c
1. Use the proper <string.h> header.
2. Typo fixes and whitespace changes.
3. Comment out debug printf() about cache size.
4. Remove obsolete comment(s).
2012-09-25 10:48:43 +01:00
Tigran Aivazian
4b5c33d4cd Optimize building djvulibre.
1. Don't build xmltools in the emulator
2. Remove duplicate --disable-desktopfiles
3. Don't build LFS support. The largest DjVu file I have ever published
was a highres facsimile edition of the London Walton Polyglot (1657)
which was a "mere" 1GB in size and I don't think anyone produced
anything bigger. Besides, storing DjVu files >2GB in size (even if
they existed, which I doubt) on a Kindle with only 3GB total storage
space is _exceedingly_ unlikely.
2012-09-25 10:32:39 +01:00
Dobrica Pavlinušić
cee63d6078 Merge pull request #313 from NuPogodi/master
removed two self:redrawCurrentPage() functions
2012-09-25 01:51:16 -07:00
NuPogodi
9403d1c120 remove self:redrawCurrentPage() in CREReader:gotoTocEntry(entry) 2012-09-25 02:21:19 +03:00
NuPogodi
d542982778 remove self:redrawCurrentPage() in UniReader:addJump(pageno) 2012-09-25 02:19:33 +03:00
{Qingping,Dave} Hou
d1a4399170 Merge pull request #310 from tigran123/master
Fix a crash in getDiskSizeInfo() (in emulator) and use util.df function.
2012-09-24 13:54:32 -07:00
Tigran Aivazian
1e2429b3be Fix for the issue #311.
Children nodes that have no [apparent] parent should be adopted
by the "_HEAD" i.e. the root of the whole tree.
2012-09-24 21:33:47 +01:00
Tigran Aivazian
47b056861b Slightly shorter and more Lua-idiomatic way of reading lines. 2012-09-24 20:38:18 +01:00
Tigran Aivazian
43cbcbf319 Rewrite CREReader:ZipContentExt() function.
Technically, the only serious problem in this function was the code:
 local tmp = assert(io.popen('unzip -l \"'..fname..'\"', "r"))
 while tmp do
         s = tmp:read("*line")
         if i > 3 then tmp:close(); break; end
         i = i + 1
 end
It is meaningless to evaluate the truth of the return value of assert()
and the above code gives the impression that it relies on the
(undocumented and unreliable) fact that after tmp:close() tmp will be
nil, even though in actual fact it does because it breaks out of the
loop.
However, having looked at the function I saw that the whole thing
can be rewritten in a much simpler way:

 local tmp = assert(io.popen('unzip -l \"'..fname..'\" | head -4 | tail -1', "r"))
 s = tmp:read("*line")
 tmp:close()
2012-09-24 20:07:23 +01:00
Tigran Aivazian
6e0f0aef26 Fix a crash in getDiskSizeInfo() and use util.df function
1. When executed in the emulator the viewer will crash if you press
Right on any zip file in the filechooser. This is because the assertion
on "df /mnt/us | tail -1" will fail as "/mnt/us" is normally
non-existent.
2. The proper (faster, reliable, portable) way of obtaining the number
of total and free bytes on a filesystem is by using the statvfs(2)
system call via util.df Lua interface, see util.c.
3. Removed the "used" field in the function's return as unused and
unneeded.
2012-09-24 19:48:12 +01:00
{Qingping,Dave} Hou
73719e7b2e Merge pull request #307 from NuPogodi/master
Added: Folder Info; fixed: crash in getUnpackedZipSize(); etc.
2012-09-24 08:40:51 -07:00
{Qingping,Dave} Hou
43b0dce322 Merge pull request #308 from dpavlin/git-rev
include git-rev in distribution zip
2012-09-24 08:38:13 -07:00
NuPogodi
6a2b0d044d filechooser: added support for calling folder info 2012-09-24 18:15:30 +03:00
NuPogodi
59c212971f fixed crash in function getUnpackedZipSize()...
applied to zips which filenames contain spaces; added support for showing information about folders (size, subfolders, files, books)
2012-09-24 18:12:07 +03:00
NuPogodi
7b7ba80f6e crereader: piping in function ZipContentExt(...)
Avoid writing/reading from/to temporary file
2012-09-24 18:07:41 +03:00
Dobrica Pavlinušić
6f0ea100ce Merge pull request #306 from tigran123/master
Don't write to temporary file on the flash device.
2012-09-24 04:49:59 -07:00
Tigran Aivazian
d338eff00d Don't write to temporary file on the flash device.
Instead of writing to (and reading from) the temporary file
"history/.history.txt" create a pipe to the appropriate process
and read from it.
2012-09-24 09:04:57 +01:00
{Qingping,Dave} Hou
52d4b09d6b Merge pull request #304 from tigran123/master
TOC and crash when pressing C in Menu in crereader + Active Hotkeys in SelectMenu
2012-09-22 10:49:29 -07:00
Tigran Aivazian
2c021d9d4e Corrected the showMenu() function to belong to the right object!
UniReader -> CREReader in crereader.lua.
2012-09-22 18:33:09 +01:00
Tigran Aivazian
8b2143561e Avoid printing long messages in the SelectMenu footer.
Bind Alt-H to show the help page with all the active hotkeys.
Thanks to NuPogodi for the suggestion.
2012-09-22 12:41:19 +01:00
Tigran Aivazian
de5cf52255 Merge remote-tracking branch 'upstream/master' 2012-09-22 11:46:04 +01:00
NuPogodi
f7779d7c2a Merge pull request #305 from NuPogodi/master
avoid rendering infomessages with monospaced font
2012-09-22 03:31:33 -07:00
NuPogodi
e621e006b9 Avoid rendering infomessages with the 'infont' used in user-inputbox (i.e. monospaced font hardly suitable for messages)
BTW, I've fixed it already the 3rd time and, let me hope, the last one.
2012-09-22 13:28:01 +03:00
Tigran Aivazian
a9f4dd3b1f The second part of the TOC/crereader fix.
Redraw the current page when selecting a TOC entry.
Otherwise the correct page is shown only after the next Menu press
or anything else that does current page redraw, e.g. Shift-R.
2012-09-22 10:51:00 +01:00
Tigran Aivazian
de96f30eff Prove CREReader:showMenu() method because the generic
UniReader:showMenu() method invokes :cleanCache() method which is
non-existent for CREReader object and causes a crash if you press C
after pressing Menu while viewing any of crereader-handled files (fb2,
epub, etc.)
2012-09-22 09:40:13 +01:00
Tigran Aivazian
3056bf440c Fix for TOC breakage for crengine-related files.
In UniReader:showToc() function we cannot use goto() by page number
but have to use self:gotoTocEntry() because crereader defines its own
CREReader:gotoTocEntry() method which uses "xpointer" field of the TOC
entry for this purpose.
With this fix the TOC navigation in crengine-related files works
correctly, BUT after each jump you have to press Menu to refresh the
page for some reason (adding explicit self:redrawCurrentPage() in the
code before gotoTocEntry() doesn't help). This seems to be an unrelated
problem to do with cr3 caching or something else. I will try to
investigate it as well, but for now I am committing the fix for the TOC side
of the problem.
2012-09-21 23:05:19 +01:00
Dobrica Pavlinusic
238e25e743 include git rev in distribution zip 2012-09-21 20:28:31 +02:00
Dobrica Pavlinušić
940408fc51 Merge pull request #300 from tigran123/master
Bugfix for deleting an empty directory.
2012-09-21 02:37:18 -07:00
Tigran Aivazian
6cd66a3e79 No need to set self.items after deleting a directory as it is
recalculated in self:setPath() anyway.
2012-09-21 08:26:13 +01:00
Tigran Aivazian
b2f4d358ae Bugfix for deleting a directory:
After a directory is deleted it is still shown in the filemanager
list, so you can accidentally delete another directory as all the
pointers after the previously deleted entry are wrong (shifted by one).
2012-09-21 08:17:53 +01:00
{Qingping,Dave} Hou
d77801d9a0 Merge pull request #299 from tigran123/master
Fix for the crash mentioned in issue #295
2012-09-20 05:42:14 -07:00
Tigran Aivazian
b3f8ddf67d Be consistent with the case: "Last Read" -> "Last read". 2012-09-20 00:08:59 +01:00
Tigran Aivazian
b8e29b77bc File Info tidy up:
1. Fix the "Created" field in file info to say "Status changed" as the ctime has nothing to do with creation of a file but with the time of the last modification to its inode (e.g. owner, group, link count, mode, etc.)
2. Added the field "Accessed" which shows the atime.
2012-09-20 00:06:08 +01:00
Tigran Aivazian
e5c859059d Fix for the crash when deleting highlights, see issue #295. 2012-09-19 23:34:16 +01:00
{Qingping,Dave} Hou
f7c0166fb2 Merge pull request #298 from tigran123/master
Report the amount of free disk space in file info.
2012-09-19 13:39:05 -07:00
Tigran Aivazian
8496ccb073 Disk free space reporting:
1. Enhance FileInfo:FileSize() to handle gigabytes and rename it to FileInfo:FormatSize() as it is not just for file sizes.
2. Add "Free space" field to file info because it is useful to see it when deciding whether to remove this file or not.
2012-09-19 21:46:31 +01:00
Tigran Aivazian
69ac04500a Indicate in the help page that "Home" is the key to be used for exiting the application. 2012-09-19 21:45:39 +01:00
{Qingping,Dave} Hou
720687648e Merge pull request #296 from tigran123/master
Simple cleanups...
2012-09-19 10:13:40 -07:00
Tigran Aivazian
f11a006775 1. Fix deleting highlights when there is more than one (previously it would delete not only the current highlight but some or all of the later ones)
2. Support deleting highlights from within "show all highlights" function (Shift-N). It is much easier to delete multiple highlights than having to position the cursor on them and press Del.
3. Fix the bug whereby the first press of Menu would overlay the info on top of the book's text.
4. Show the number of bookmarks and highlights in their respective lists.
5. Fix the incorrect section title shown in Menu when the file contains TOC with external links.
6. Rename "start highlight mode" -> "enter highlight mode".
7. Rename "display all highlights" -> "show all highlights".
2012-09-19 18:25:26 +01:00
Tigran Aivazian
eb002540a2 Don't crash on user pressing ENTER in empty history --- just display an appropriate message. 2012-09-19 17:49:20 +01:00
Tigran Aivazian
f5f5040f20 Change "Updating HighLight data..." message to Debug() as this operation
cannot possibly hang and it conveys no useful info to the end user.
2012-09-19 12:29:45 +01:00
Tigran Aivazian
d2b2d8b18f Make the info messages about highlight short enough to be visible.
Also, shorten the delay from 2s to 1s.
2012-09-19 12:26:32 +01:00
Tigran Aivazian
c57c319656 When user presses BACK in the filemanager it should NOT exit the program, only HOME should do so.
Otherwise too many times one accidentally exits from KPV.
2012-09-19 12:25:15 +01:00
{Qingping,Dave} Hou
35695e2fe0 Merge pull request #293 from tigran123/master
Cleanup: use util.isEmulated() == 1 instead of looking at KEY_FW_DOWN value.
2012-09-18 20:02:52 -07:00
Tigran Aivazian
4b9cf4eaf5 Use os.remove() instead of os.execute("rm...") because it is less expensive
as it uses remove(3) C library function rather than fork/exec-ing a new process.
2012-09-18 23:52:11 +01:00