diff --git a/frontend/apps/reader/modules/readerfooter.lua b/frontend/apps/reader/modules/readerfooter.lua index 0a263b453..b2e110aac 100644 --- a/frontend/apps/reader/modules/readerfooter.lua +++ b/frontend/apps/reader/modules/readerfooter.lua @@ -24,6 +24,7 @@ local ReaderFooter = InputContainer:new{ progress_text = nil, text_font_face = "ffont", text_font_size = 14, + bar_height = Screen:scaleByDPI(7), height = Screen:scaleByDPI(19), padding = Screen:scaleByDPI(10), } @@ -59,7 +60,7 @@ function ReaderFooter:init() local text_width = self.progress_text:getSize().w self.progress_bar = ProgressWidget:new{ width = math.floor(Screen:getWidth() - text_width - self.padding), - height = Screen:scaleByDPI(7), + height = self.bar_height, percentage = self.progress_percentage, } local horizontal_group = HorizontalGroup:new{} @@ -143,17 +144,17 @@ function ReaderFooter:updateFooterPage() end self.progress_text.text = string.sub(self.progress_text.text,4) else - if self.mode == 1 then + if self.mode == 1 then self.progress_text.text = string.format("%d / %d", self.pageno, self.pages) - elseif self.mode == 2 then + elseif self.mode == 2 then self.progress_text.text = os.date("%H:%M") - elseif self.mode == 3 then + elseif self.mode == 3 then self.progress_text.text = "=> " .. self.ui.toc:_getChapterPagesLeft(self.pageno,self.pages) - elseif self.mode == 4 then + elseif self.mode == 4 then powerd = Device:getPowerDevice() state = powerd:isCharging() and -1 or powerd:getCapacity() self.progress_text.text = "B:" .. powerd:getCapacity() .. "%" - end + end end end diff --git a/frontend/apps/reader/modules/readermenu.lua b/frontend/apps/reader/modules/readermenu.lua index bd06f5d10..66c868b47 100644 --- a/frontend/apps/reader/modules/readermenu.lua +++ b/frontend/apps/reader/modules/readermenu.lua @@ -81,6 +81,14 @@ function ReaderMenu:setUpdateItemTable() G_reader_settings:saveSetting("night_mode", not night_mode) end }) + table.insert(self.tab_item_table.main, { + text = _("Show advanced options"), + checked_func = function() return G_reader_settings:readSetting("show_advanced") end, + callback = function() + local show_advanced = G_reader_settings:readSetting("show_advanced") or false + G_reader_settings:saveSetting("show_advanced", not show_advanced) + end + }) table.insert(self.tab_item_table.main, Language:getLangMenuTable()) table.insert(self.tab_item_table.main, { text = _("Version"), diff --git a/frontend/apps/reader/modules/readerpaging.lua b/frontend/apps/reader/modules/readerpaging.lua index e9734ef18..291c25028 100644 --- a/frontend/apps/reader/modules/readerpaging.lua +++ b/frontend/apps/reader/modules/readerpaging.lua @@ -603,15 +603,21 @@ function ReaderPaging:onScrollPanRel(diff) UIManager:setDirty(self.view.dialog, "fast") end +function ReaderPaging:calculateOverlap() + local footer_height = (self.view.footer_visible and 1 or 0) * self.view.footer.bar_height + return self.overlap + footer_height +end + function ReaderPaging:onScrollPageRel(diff) DEBUG("scroll relative page:", diff) local blank_area = Geom:new{} blank_area:setSizeTo(self.view.dimen) + local overlap = self:calculateOverlap() if diff > 0 then local last_page_state = table.remove(self.view.page_states) local offset = Geom:new{ x = 0, - y = last_page_state.visible_area.h - self.overlap + y = last_page_state.visible_area.h - overlap } self.view.page_states = self:genPageStatesFromTop(last_page_state, blank_area, offset) end @@ -619,7 +625,7 @@ function ReaderPaging:onScrollPageRel(diff) local first_page_state = table.remove(self.view.page_states, 1) local offset = Geom:new{ x = 0, - y = -first_page_state.visible_area.h + self.overlap + y = -first_page_state.visible_area.h + overlap } self.view.page_states = self:genPageStatesFromBottom(first_page_state, blank_area, offset) end @@ -672,16 +678,17 @@ function ReaderPaging:onGotoPageRel(diff) else -- not end of page yet, goto next view -- adjust panning step according to overlap - if x_pan_off > self.overlap then + local overlap = self:calculateOverlap() + if x_pan_off > overlap then -- moving to next view, move view - x_pan_off = x_pan_off - self.overlap - elseif x_pan_off < -self.overlap then - x_pan_off = x_pan_off + self.overlap + x_pan_off = x_pan_off - overlap + elseif x_pan_off < -overlap then + x_pan_off = x_pan_off + overlap end - if y_pan_off > self.overlap then - y_pan_off = y_pan_off - self.overlap - elseif y_pan_off < -self.overlap then - y_pan_off = y_pan_off + self.overlap + if y_pan_off > overlap then + y_pan_off = y_pan_off - overlap + elseif y_pan_off < -overlap then + y_pan_off = y_pan_off + overlap end -- we have to calculate again to count into overlap new_va.x = Math.roundAwayFromZero(self.visible_area.x+x_pan_off) diff --git a/frontend/document/koptinterface.lua b/frontend/document/koptinterface.lua index 67ef58f5b..7c4eeb12d 100644 --- a/frontend/document/koptinterface.lua +++ b/frontend/document/koptinterface.lua @@ -402,7 +402,7 @@ returned boxes are in native page coordinates zoomed at 1.0 --]] function KoptInterface:getTextBoxes(doc, pageno) local text = doc:getPageTextBoxes(pageno) - if text and #text > 1 then + if text and #text > 1 and doc.configurable.forced_ocr == 0 then return text -- if we have no text in original page then we will reuse native word boxes -- in reflow mode and find text boxes from scratch in non-reflow mode diff --git a/frontend/ui/data/koptoptions.lua b/frontend/ui/data/koptoptions.lua index b9a6ad68c..a9686ed98 100644 --- a/frontend/ui/data/koptoptions.lua +++ b/frontend/ui/data/koptoptions.lua @@ -201,6 +201,14 @@ local KoptOptions = { values={0.5, 1.0, 1.5}, default_value = DKOPTREADER_CONFIG_RENDER_QUALITY, }, + { + name = "forced_ocr", + name_text = S.FORCED_OCR, + toggle = {S.ON, S.OFF}, + values = {1, 0}, + default_value = 0, + advanced = true, + }, { name = "defect_size", name_text = S.DEFECT_SIZE, diff --git a/frontend/ui/data/strings.lua b/frontend/ui/data/strings.lua index 51ed3a2bf..c6f1570b9 100644 --- a/frontend/ui/data/strings.lua +++ b/frontend/ui/data/strings.lua @@ -27,6 +27,7 @@ S.VIEW_MODE = _("View Mode") S.EMBEDDED_STYLE = _("Embedded Style") S.WRITING_DIR = _("Writing Direction") S.PROGRESS_BAR = _("Progress Bar") +S.FORCED_OCR = _("Forced OCR") S.ON = _("on") S.OFF = _("off") diff --git a/frontend/ui/networkmgr.lua b/frontend/ui/networkmgr.lua new file mode 100644 index 000000000..7fa9115d3 --- /dev/null +++ b/frontend/ui/networkmgr.lua @@ -0,0 +1,55 @@ +local ConfirmBox = require("ui/widget/confirmbox") +local UIManager = require("ui/uimanager") +local Device = require("ui/device") +local DEBUG = require("dbg") +local _ = require("gettext") + +local NetworkMgr = {} + +local function kindleEnableWifi(toggle) + local lipc = require("liblipclua") + local lipc_handle = nil + if lipc then + lipc_handle = lipc.init("com.github.koreader.networkmgr") + end + if lipc_handle then + lipc_handle:set_int_property("com.lab126.cmd", "wirelessEnable", toggle) + lipc_handle:close() + end +end + +function NetworkMgr:turnOnWifi() + if Device:isKindle() then + kindleEnableWifi(1) + elseif Device:isKobo() then + -- TODO: turn on wifi on kobo? + end +end + +function NetworkMgr:turnOffWifi() + if Device:isKindle() then + kindleEnableWifi(0) + elseif Device:isKobo() then + -- TODO: turn off wifi on kobo? + end +end + +function NetworkMgr:promptWifiOn() + UIManager:show(ConfirmBox:new{ + text = _("Do you want to Turn on Wifi?"), + ok_callback = function() + self:turnOnWifi() + end, + }) +end + +function NetworkMgr:promptWifiOff() + UIManager:show(ConfirmBox:new{ + text = _("Do you want to Turn off Wifi?"), + ok_callback = function() + self:turnOffWifi() + end, + }) +end + +return NetworkMgr diff --git a/frontend/ui/widget/configdialog.lua b/frontend/ui/widget/configdialog.lua index 5309b68dd..35d0f8394 100644 --- a/frontend/ui/widget/configdialog.lua +++ b/frontend/ui/widget/configdialog.lua @@ -176,8 +176,10 @@ function ConfigOption:init() table.insert(vertical_group, VerticalSpan:new{ width = Screen:scaleByDPI(default_option_padding), }) + local show_advanced = G_reader_settings:readSetting("show_advanced") or false for c = 1, #self.options do - if self.options[c].show ~= false then + local show_default = not self.options[c].advanced or show_advanced + if self.options[c].show ~= false and show_default then local name_align = self.options[c].name_align_right and self.options[c].name_align_right or 0.33 local item_align = self.options[c].item_align_center and self.options[c].item_align_center or 0.66 local name_font_face = self.options[c].name_font_face and self.options[c].name_font_face or "cfont" diff --git a/koreader-base b/koreader-base index 66b1bcf4f..43defcb8e 160000 --- a/koreader-base +++ b/koreader-base @@ -1 +1 @@ -Subproject commit 66b1bcf4f87f16598806445e6b437310411ffefc +Subproject commit 43defcb8e00db8f78fed747a697e77983ba33819 diff --git a/l10n/templates/koreader.pot b/l10n/templates/koreader.pot index 19afae1da..9b532c359 100644 --- a/l10n/templates/koreader.pot +++ b/l10n/templates/koreader.pot @@ -6,28 +6,33 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: https://github.com/koreader/koreader-base/issues\n" -"POT-Creation-Date: 2014-07-03 10:56+0000\n" +"POT-Creation-Date: 2014-07-17 14:32+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: plugins/evernote.koplugin/main.lua:323 +#: plugins/evernote.koplugin/main.lua:334 msgid "" " others." msgstr "" -#: frontend/ui/data/strings.lua:48 +#: frontend/ui/widget/configdialog.lua:582 +msgid "" +" to " +msgstr "" + +#: frontend/ui/data/strings.lua:49 msgid "" "0 deg" msgstr "" -#: frontend/ui/data/strings.lua:50 +#: frontend/ui/data/strings.lua:51 msgid "" "10 deg" msgstr "" -#: frontend/ui/data/strings.lua:49 +#: frontend/ui/data/strings.lua:50 msgid "" "5 deg" msgstr "" @@ -70,8 +75,8 @@ msgstr "" #: frontend/apps/reader/modules/readergoto.lua:36 #: frontend/ui/widget/confirmbox.lua:29 -#: plugins/evernote.koplugin/main.lua:123 -#: plugins/zsync.koplugin/main.lua:254 +#: plugins/evernote.koplugin/main.lua:124 +#: plugins/zsync.koplugin/main.lua:279 msgid "" "Cancel" msgstr "" @@ -86,8 +91,8 @@ msgid "" "Change font" msgstr "" -#: plugins/zsync.koplugin/main.lua:201 -#: plugins/zsync.koplugin/main.lua:211 +#: plugins/zsync.koplugin/main.lua:226 +#: plugins/zsync.koplugin/main.lua:236 msgid "" "Choose inbox" msgstr "" @@ -97,7 +102,7 @@ msgid "" "Columns" msgstr "" -#: plugins/zsync.koplugin/main.lua:246 +#: plugins/zsync.koplugin/main.lua:271 msgid "" "Confirm" msgstr "" @@ -144,12 +149,22 @@ msgid "" "Dewatermark" msgstr "" +#: frontend/ui/networkmgr.lua:48 +msgid "" +"Do you want to Turn off Wifi?" +msgstr "" + +#: frontend/ui/networkmgr.lua:39 +msgid "" +"Do you want to Turn on Wifi?" +msgstr "" + #: frontend/ui/data/strings.lua:17 msgid "" "Document Language" msgstr "" -#: frontend/apps/reader/modules/readermenu.lua:128 +#: frontend/apps/reader/modules/readermenu.lua:136 msgid "" "Document menu" msgstr "" @@ -164,46 +179,45 @@ msgid "" "Embedded Style" msgstr "" -#: plugins/evernote.koplugin/main.lua:327 +#: plugins/evernote.koplugin/main.lua:338 msgid "" "Error occurs when exporting book:" msgstr "" -#: plugins/evernote.koplugin/main.lua:177 -#: plugins/evernote.koplugin/main.lua:189 +#: plugins/evernote.koplugin/main.lua:182 +#: plugins/evernote.koplugin/main.lua:197 msgid "" "Error occurs when login:" msgstr "" -#: plugins/evernote.koplugin/main.lua:329 +#: plugins/evernote.koplugin/main.lua:340 msgid "" "Errors occur when exporting book:" msgstr "" -#: plugins/evernote.koplugin/main.lua:42 -#: plugins/evernote.koplugin/main.lua:52 -#: plugins/evernote.koplugin/main.lua:64 +#: plugins/evernote.koplugin/main.lua:43 +#: plugins/evernote.koplugin/main.lua:53 msgid "" "Evernote" msgstr "" -#: plugins/evernote.koplugin/main.lua:81 +#: plugins/evernote.koplugin/main.lua:82 msgid "" "Export all notes in this book" msgstr "" -#: plugins/evernote.koplugin/main.lua:97 +#: plugins/evernote.koplugin/main.lua:98 msgid "" "Export all notes in your library" msgstr "" -#: plugins/evernote.koplugin/main.lua:320 -#: plugins/evernote.koplugin/main.lua:322 +#: plugins/evernote.koplugin/main.lua:331 +#: plugins/evernote.koplugin/main.lua:333 msgid "" "Exported notes in book:" msgstr "" -#: reader.lua:71 +#: reader.lua:80 msgid "" "File does not exist" msgstr "" @@ -228,6 +242,11 @@ msgid "" "Font Weight" msgstr "" +#: frontend/ui/data/strings.lua:30 +msgid "" +"Forced OCR" +msgstr "" + #: frontend/apps/reader/modules/readerfrontlight.lua:95 msgid "" "Frontlight Level" @@ -264,7 +283,7 @@ msgid "" msgstr "" #: frontend/apps/filemanager/filemanagermenu.lua:103 -#: frontend/apps/reader/modules/readermenu.lua:94 +#: frontend/apps/reader/modules/readermenu.lua:102 msgid "" "Help" msgstr "" @@ -305,12 +324,12 @@ msgid "" "Invert" msgstr "" -#: plugins/evernote.koplugin/main.lua:16 +#: plugins/evernote.koplugin/main.lua:17 msgid "" "Koreader Notes" msgstr "" -#: frontend/ui/data/strings.lua:57 +#: frontend/ui/data/strings.lua:58 msgid "" "LTR" msgstr "" @@ -335,28 +354,28 @@ msgid "" "Location" msgstr "" -#: plugins/evernote.koplugin/main.lua:140 +#: plugins/evernote.koplugin/main.lua:141 msgid "" "Logging in please wait..." msgstr "" -#: plugins/evernote.koplugin/main.lua:55 -#: plugins/evernote.koplugin/main.lua:130 +#: plugins/evernote.koplugin/main.lua:56 +#: plugins/evernote.koplugin/main.lua:131 msgid "" "Login" msgstr "" -#: plugins/evernote.koplugin/main.lua:15 +#: plugins/evernote.koplugin/main.lua:16 msgid "" "Login to Evernote" msgstr "" -#: plugins/evernote.koplugin/main.lua:195 +#: plugins/evernote.koplugin/main.lua:203 msgid "" "Login to Evernote successfully" msgstr "" -#: plugins/evernote.koplugin/main.lua:54 +#: plugins/evernote.koplugin/main.lua:55 msgid "" "Logout" msgstr "" @@ -372,12 +391,12 @@ msgid "" "Night mode" msgstr "" -#: reader.lua:86 +#: reader.lua:95 msgid "" "No reader engine for this file" msgstr "" -#: plugins/evernote.koplugin/main.lua:339 +#: plugins/evernote.koplugin/main.lua:350 msgid "" "Note: " msgstr "" @@ -388,7 +407,7 @@ msgid "" "OK" msgstr "" -#: reader.lua:76 +#: reader.lua:85 msgid "" "Opening file" msgstr "" @@ -398,7 +417,7 @@ msgid "" "Page" msgstr "" -#: frontend/ui/widget/touchmenu.lua:426 +#: frontend/ui/widget/touchmenu.lua:427 msgid "" "Page " msgstr "" @@ -419,7 +438,7 @@ msgid "" msgstr "" #: frontend/apps/filemanager/filemanagermenu.lua:106 -#: frontend/apps/reader/modules/readermenu.lua:97 +#: frontend/apps/reader/modules/readermenu.lua:105 msgid "" "Please report bugs to \n" "https://github.com/koreader/koreader/issues" @@ -435,17 +454,17 @@ msgid "" "Progress Bar" msgstr "" -#: plugins/zsync.koplugin/main.lua:46 +#: plugins/zsync.koplugin/main.lua:47 msgid "" "Publish this document" msgstr "" -#: frontend/ui/data/strings.lua:58 +#: frontend/ui/data/strings.lua:59 msgid "" "RTL" msgstr "" -#: plugins/zsync.koplugin/main.lua:337 +#: plugins/zsync.koplugin/main.lua:362 msgid "" "Received file:" msgstr "" @@ -465,7 +484,7 @@ msgid "" "Render Quality" msgstr "" -#: plugins/evernote.koplugin/main.lua:48 +#: plugins/evernote.koplugin/main.lua:49 msgid "" "Sandbox" msgstr "" @@ -480,19 +499,19 @@ msgid "" "Scroll Mode" msgstr "" -#: frontend/ui/widget/configdialog.lua:580 +#: frontend/ui/widget/configdialog.lua:582 msgid "" "Set default " msgstr "" #: frontend/apps/reader/modules/readerfont.lua:223 msgid "" -"Set default font \"" +"Set default font to " msgstr "" #: frontend/apps/reader/modules/readerzooming.lua:338 msgid "" -"Set default zoom mode to \"" +"Set default zoom mode to " msgstr "" #: frontend/apps/reader/modules/readerfont.lua:139 @@ -515,6 +534,11 @@ msgid "" "Share" msgstr "" +#: frontend/apps/reader/modules/readermenu.lua:85 +msgid "" +"Show advanced options" +msgstr "" + #: frontend/apps/filemanager/filemanagermenu.lua:63 msgid "" "Show hidden files" @@ -530,22 +554,22 @@ msgid "" "Start with last opened file" msgstr "" -#: plugins/zsync.koplugin/main.lua:47 +#: plugins/zsync.koplugin/main.lua:48 msgid "" "Stop publisher" msgstr "" -#: plugins/zsync.koplugin/main.lua:64 +#: plugins/zsync.koplugin/main.lua:65 msgid "" "Stop subscriber" msgstr "" -#: plugins/zsync.koplugin/main.lua:63 +#: plugins/zsync.koplugin/main.lua:64 msgid "" "Subscribe documents" msgstr "" -#: frontend/ui/uimanager.lua:93 +#: frontend/ui/uimanager.lua:81 msgid "" "Suspended" msgstr "" @@ -555,17 +579,17 @@ msgid "" "Switch zoom mode" msgstr "" -#: frontend/ui/data/strings.lua:60 +#: frontend/ui/data/strings.lua:61 msgid "" "TBLTR" msgstr "" -#: frontend/ui/data/strings.lua:59 +#: frontend/ui/data/strings.lua:60 msgid "" "TBRTL" msgstr "" -#: frontend/apps/reader/modules/readertoc.lua:153 +#: frontend/apps/reader/modules/readertoc.lua:249 msgid "" "Table of Contents" msgstr "" @@ -580,12 +604,12 @@ msgid "" "Text Align" msgstr "" -#: plugins/evernote.koplugin/main.lua:107 +#: plugins/evernote.koplugin/main.lua:108 msgid "" "This may take several minutes..." msgstr "" -#: plugins/evernote.koplugin/main.lua:91 +#: plugins/evernote.koplugin/main.lua:92 msgid "" "This may take several seconds..." msgstr "" @@ -606,7 +630,7 @@ msgid "" msgstr "" #: frontend/apps/filemanager/filemanagermenu.lua:95 -#: frontend/apps/reader/modules/readermenu.lua:86 +#: frontend/apps/reader/modules/readermenu.lua:94 msgid "" "Version" msgstr "" @@ -636,13 +660,12 @@ msgid "" "Writing screen to " msgstr "" -#: plugins/evernote.koplugin/main.lua:50 -#: plugins/evernote.koplugin/main.lua:71 +#: plugins/evernote.koplugin/main.lua:51 msgid "" "Yinxiang" msgstr "" -#: plugins/zsync.koplugin/main.lua:41 +#: plugins/zsync.koplugin/main.lua:42 msgid "" "ZSync" msgstr "" @@ -677,18 +700,18 @@ msgid "" "Zoom to fit page width" msgstr "" -#: plugins/evernote.koplugin/main.lua:323 -#: plugins/evernote.koplugin/main.lua:330 +#: plugins/evernote.koplugin/main.lua:334 +#: plugins/evernote.koplugin/main.lua:341 msgid "" "and " msgstr "" -#: frontend/ui/data/strings.lua:33 +#: frontend/ui/data/strings.lua:34 msgid "" "auto" msgstr "" -#: frontend/ui/data/strings.lua:54 +#: frontend/ui/data/strings.lua:55 msgid "" "bold" msgstr "" @@ -698,77 +721,77 @@ msgid "" "clear all external styles" msgstr "" -#: frontend/ui/data/strings.lua:44 +#: frontend/ui/data/strings.lua:45 msgid "" "darker" msgstr "" -#: frontend/ui/data/strings.lua:45 +#: frontend/ui/data/strings.lua:46 msgid "" "darkest" msgstr "" -#: frontend/ui/data/strings.lua:39 +#: frontend/ui/data/strings.lua:40 msgid "" "decrease" msgstr "" -#: frontend/ui/data/strings.lua:43 +#: frontend/ui/data/strings.lua:44 msgid "" "default" msgstr "" -#: frontend/ui/data/strings.lua:61 +#: frontend/ui/data/strings.lua:62 msgid "" "full" msgstr "" -#: frontend/ui/data/strings.lua:47 +#: frontend/ui/data/strings.lua:48 msgid "" "high" msgstr "" -#: frontend/ui/data/strings.lua:40 +#: frontend/ui/data/strings.lua:41 msgid "" "increase" msgstr "" -#: frontend/ui/data/strings.lua:52 +#: frontend/ui/data/strings.lua:53 msgid "" "landscape" msgstr "" -#: frontend/ui/data/strings.lua:38 +#: frontend/ui/data/strings.lua:39 msgid "" "large" msgstr "" -#: frontend/ui/data/strings.lua:42 +#: frontend/ui/data/strings.lua:43 msgid "" "lighter" msgstr "" -#: frontend/ui/data/strings.lua:41 +#: frontend/ui/data/strings.lua:42 msgid "" "lightest" msgstr "" -#: frontend/ui/data/strings.lua:46 +#: frontend/ui/data/strings.lua:47 msgid "" "low" msgstr "" -#: frontend/ui/data/strings.lua:34 +#: frontend/ui/data/strings.lua:35 msgid "" "manual" msgstr "" -#: frontend/ui/data/strings.lua:37 +#: frontend/ui/data/strings.lua:38 msgid "" "medium" msgstr "" -#: frontend/ui/data/strings.lua:62 +#: frontend/ui/data/strings.lua:63 msgid "" "mini" msgstr "" @@ -783,17 +806,17 @@ msgid "" "no text" msgstr "" -#: frontend/ui/data/strings.lua:32 +#: frontend/ui/data/strings.lua:33 msgid "" "off" msgstr "" -#: frontend/ui/data/strings.lua:31 +#: frontend/ui/data/strings.lua:32 msgid "" "on" msgstr "" -#: frontend/ui/data/strings.lua:56 +#: frontend/ui/data/strings.lua:57 msgid "" "page" msgstr "" @@ -803,27 +826,27 @@ msgid "" "page " msgstr "" -#: frontend/ui/data/strings.lua:51 +#: frontend/ui/data/strings.lua:52 msgid "" "portrait" msgstr "" -#: frontend/ui/data/strings.lua:53 +#: frontend/ui/data/strings.lua:54 msgid "" "regular" msgstr "" -#: frontend/ui/data/strings.lua:55 +#: frontend/ui/data/strings.lua:56 msgid "" "scroll" msgstr "" -#: frontend/ui/data/strings.lua:35 +#: frontend/ui/data/strings.lua:36 msgid "" "semi-auto" msgstr "" -#: frontend/ui/data/strings.lua:36 +#: frontend/ui/data/strings.lua:37 msgid "" "small" msgstr "" diff --git a/plugins/evernote.koplugin/main.lua b/plugins/evernote.koplugin/main.lua index aa95d49ff..629cd96dc 100644 --- a/plugins/evernote.koplugin/main.lua +++ b/plugins/evernote.koplugin/main.lua @@ -2,6 +2,7 @@ local InputContainer = require("ui/widget/container/inputcontainer") local LoginDialog = require("ui/widget/logindialog") local InfoMessage = require("ui/widget/infomessage") local DocSettings = require("docsettings") +local NetworkMgr = require("ui/networkmgr") local UIManager = require("ui/uimanager") local Screen = require("ui/screen") local Event = require("ui/event") @@ -61,14 +62,14 @@ function EvernoteExporter:addToMainMenu(tab_item_table) sub_item_table_func = function() return not self.evernote_token and { { - text = _("Evernote"), + text = "Evernote", callback = function() self.evernote_domain = nil self:login() end }, { - text = _("Yinxiang"), + text = "印象笔记", callback = function() self.evernote_domain = "yinxiang" self:login() @@ -172,7 +173,11 @@ function EvernoteExporter:doLogin(username, password) } self.evernote_username = username local ok, token = pcall(oauth.getToken, oauth) - if not ok or not token then + -- prompt users to turn on Wifi if network is unreachable + if not ok and token and token:find("Network is unreachable") then + NetworkMgr:promptWifiOn() + return + elseif not ok and token then UIManager:show(InfoMessage:new{ text = _("Error occurs when login:") .. "\n" .. token, }) @@ -184,11 +189,14 @@ function EvernoteExporter:doLogin(username, password) authToken = token, } local ok, guid = pcall(self.getExportNotebook, self, client) - if not ok or not guid then + if not ok and guid and guid:find("Transport not open") then + NetworkMgr:promptWifiOn() + return + elseif not ok and guid then UIManager:show(InfoMessage:new{ text = _("Error occurs when login:") .. "\n" .. guid, }) - elseif guid then + elseif ok and guid then self.evernote_token = token self.notebook_guid = guid UIManager:show(InfoMessage:new{ @@ -300,11 +308,14 @@ function EvernoteExporter:exportClippings(client, clippings) local ok, err = pcall(self.exportBooknotes, self, client, title, booknotes) -- error reporting - if not ok then + if not ok and err and err:find("Transport not open") then + NetworkMgr:promptWifiOn() + return + elseif not ok and err then DEBUG("Error occurs when exporting book:", title, err) error_count = error_count + 1 error_title = title - else + elseif ok then DEBUG("Exported notes in book:", title) export_count = export_count + 1 export_title = title