2
0
mirror of https://github.com/koreader/koreader synced 2024-10-31 21:20:20 +00:00
Commit Graph

87 Commits

Author SHA1 Message Date
Tigran Aivazian
df65245e70 Bug in CREReader:ZipContentExt().
Even after restoring to the previous version, this function had a slight
bug that would cause a crash on valid .zip files (e.g.
mupdf-thirdparty.zip in kindlepdfviewer make tree). The reason is
because the value of s may be not nil, but the string.match() would
return nil and so string.lower() would get nil as an argument and crash.
So, we have to guard against this carefully.
2012-09-25 17:06:49 +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
NuPogodi
9403d1c120 remove self:redrawCurrentPage() in CREReader:gotoTocEntry(entry) 2012-09-25 02:21:19 +03: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
NuPogodi
7b7ba80f6e crereader: piping in function ZipContentExt(...)
Avoid writing/reading from/to temporary file
2012-09-24 18:07:41 +03: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
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
1c32a24450 1. Shorten the "No TOC" message to be displayable.
2. Get rid of the calls to self:fillToc() from the places in the code which cannot affect TOC.
I assume the reason for these calls is that they are needed in the original CoolReader application
(because there the TOC displays the virtual "page numbers") and were brought over to our crengine.lua
during the port.
2012-09-10 23:12:09 +01:00
Tigran Aivazian
253a0829ff No need to initialize oldname = self:FullFileName() twice when renaming a file --- one initialization is enough.
(and, while at it, replaced references to a non-existent word "extention" with the proper English "extension")
2012-09-10 18:17:50 +01:00
Qingping Hou
1eb7162796 set crengine cache size in lua code 2012-09-10 21:45:05 +08:00
Dobrica Pavlinusic
2332691bb0 replaced showInfoMsgWithDelay with InfoMessage:show in crereader 2012-09-09 21:41:35 +02:00
NuPogodi
fe2363b29f fix: to prevent crash opening wrong zips and zips with improper content
if the file with zip-extention is not valid zip or it contains the improper entry (not crengine-related files), function CREReader:open(filename) return false, "the error description"
2012-09-05 19:49:43 +03:00
NuPogodi
a2f7f62a3d crereader: remove not crengine-related 'M'-hotkey
Since I've added new unireader-hotkey that calls menu with zoom-modes, one has to remove it from crereader.lua. Done...
2012-09-01 13:01:17 +03:00
NuPogodi
4d6b03052a crereader: some corrections
1. Improved the method to restore position in document after rescaling font face, size, weight, interline spacing,  etc.
2. Fixed rotation functions inherited from unireader.lua
3. Removed hotkey for the function of manual cropping inherited from unireader.lua; reason: not crengine-related
4. Added fast navigation functions via Shift+fiveway: jump to previous / next TOC-entry; scroll 10 pages backwards / forward
2012-08-31 20:41:36 +03:00
Dobrica Pavlinusic
bc0a911e7e showInfoMsgWithDelay with number of results 2012-08-28 22:14:57 +02:00
Dobrica Pavlinusic
7d10a636e7 correctly return first search position and refresh screen 2012-08-28 21:56:46 +02:00
Dobrica Pavlinusic
adf0b42e5b coolreader search highlight
This is rough port of Android code, but seems to work
2012-08-28 20:56:05 +02:00
Qingping Hou
2dfbf3177f revert shift+page turn bindings
previously, they are overwritten by mistakes
2012-06-06 20:43:11 +08:00
Qingping Hou
dec86586e8 bug fix in CREReader:prevBookMarkedPage
handle two more corner situations
2012-06-06 20:16:40 +08:00
Qingping Hou
8ef6eb8b73 bug fix in CREReader:prevBookMarkedPage 2012-06-06 19:52:41 +08:00
Qingping Hou
d0e7f2240d add bookmark navigation function to crereader 2012-06-06 16:21:25 +08:00
HW
0d12ff70cd rename debug() to Debug() to stop clashing with the debug submodule from Lua 2012-06-04 00:49:23 +02:00
HW
ccd91b58e3 Merge branch 'luajit' 2012-06-03 23:04:38 +02:00
HW
942ab0d3d4 fixed issue that made CREngine default font working after restart only
in the earlier version, the static crereader.default_font wasn't
changed, so a new default font only got used after a restart
2012-06-03 02:20:19 +02:00
HW
e35339a398 fixed wrong escape sequences in strings
again, LuaJIT will choke on these, Lua-5.1.n did just ignore them
2012-06-03 01:52:16 +02:00
HW
22ce736e11 added jump-to-percent dialog for CREngine reader 2012-06-03 00:39:17 +02:00
HW
02c40b6078 configurable default font for CREngine
when in CREngine mode, the current font can be made the default
document font by pressing Shift-F

in order to store this setting, the reader_settings variable was
promoted to the declared global G_reader_settings

close #184
2012-06-02 23:51:55 +02:00
NuPogodi
944a3b5b05 NuPogodi code drop from 2012-05-27
- zip files don't require double extensions any more
- filechooser has 'H' shortcut to display keys
- new function for files and folders (^ == shift)
	^N - new folder
	Del - delete document/folder
	^C - copy file into clipboard
	^X - cut (move) file to clipboard
	^V - paste files from clipboard
	^R - rename file
- configurable keyboard for input box
2012-05-28 19:19:21 +02:00
NuPogodi
1831004da5 Add the new function ZipContentExt(zipfilename) which reads the content of zipfile and returns the extention of the first entry. 2012-05-23 11:50:40 +02:00
Dobrica Pavlinusic
a08c35a52c added Screen:screenshot() 2012-05-19 23:04:40 +02:00
NuPogodi
3a76ec91fd integrate rest of @NuPogodi changes #166
- long lines (filenames in 'Document Info') are now splitted in more
  human-readable way (by spaces, dots, slashes or some other characters
- see screenshot)
- the selection of fonts in filemanager (key 'F' or 'Aa') looks now more
  user-friendly
- fixed too long strings in most menues (TOC, Bookmarks, Fonts...) and
  in the popup with the reading progress (called by key 'Menu')
- the position inside the cr-documents (epub, mobi...) now remain nearly
  the same after rescaling the document (i.e. changing the font face,
  size, boldface and interline distance)
- when you open TOC-menu or Fonts Menu, it highlights the current item
  (i.e. current chapter and current fontface).
- i've a bit changed the way to read the battery level values, it might
  now work even without Amazon Kindle framework.
2012-05-19 13:04:49 +02:00
NuPogodi
93b5da0d8d Update crereader.lua 2012-05-17 12:31:48 +03:00
NuPogodi
773a4d69b6 + added: saving & restoring the font size (new parameter > font_zoom)
+ fixed: too long strings in _drawReadingInfo() (called by key 'Menu')
+ fixed: floating the text when the font (face, size or boldface) and/or interline spacing modify the document height
2012-05-17 12:25:20 +03:00
Qingping Hou
c818d7e90e screenshot shorcut patch by NuPogodi@mobileread 2012-04-30 17:03:45 +08:00
Qingping Hou
381b34cc04 detect file type in zip file, patched by NuPogodi@mobileread 2012-04-30 16:58:05 +08:00
Qingping Hou
eb1fbebc5b change default font face for crereader, reported by NuPogodi@mobileread.
changed to Droid Sans Fallback
2012-04-30 16:44:41 +08:00
Qingping Hou
6dcd849515 remove x shortcut in crereader 2012-04-27 11:18:59 +08:00
Dobrica Pavlinusic
8c01306154 invoke Screen:restoreFromSavedBB only if font changed 2012-04-26 15:38:35 +02:00
Dobrica Pavlinusic
17a590cf5a show increase/decrease font size InfoMessage 2012-04-26 14:09:09 +02:00
Dobrica Pavlinusic
ac09213319 show Redrawing with InfoMessage on font change 2012-04-26 14:05:51 +02:00
Qingping Hou
f4c6c6ab1c fix helppage in crereader for font size & line space setting 2012-04-25 14:08:33 +08:00
Qingping Hou
5e6d4cfdb3 fix message for gamma settings in crereader's help page 2012-04-21 16:08:25 +08:00
Qingping Hou
8d74649642 adjust wording 2012-04-20 18:29:08 +08:00
Qingping Hou
8660ea7d68 fix KEY_LPG{BCK,FWD} listening for crereade 2012-04-20 10:00:20 +08:00
Qingping Hou
d34a3e8a0b fix bug in crereader's font setting
only show message when there is a font change
2012-04-19 22:19:06 +08:00
HW
30766f8dce bugfix: spelling of settings function changed 2012-04-19 14:37:25 +02:00
Qingping Hou
bc299784ca fix bug in partial screen refresh count in crereader 2012-04-19 14:14:08 +08:00
Qingping Hou
c46266fee8 fix comment in crereader 2012-04-19 10:31:38 +08:00
Qingping Hou
69cea4f2af fix in CREReader:getTocTitleOfCurrentPage
pass xpointer instead of percent
2012-04-19 10:24:14 +08:00