mirror of
https://github.com/koreader/koreader.git
synced 2025-12-13 20:36:53 +01:00
EvernoteExporter plugin can be docless
This commit is contained in:
@@ -16,7 +16,6 @@ local MyClipping = require("clip")
|
|||||||
|
|
||||||
local EvernoteExporter = InputContainer:new{
|
local EvernoteExporter = InputContainer:new{
|
||||||
name = "evernote",
|
name = "evernote",
|
||||||
is_doc_only = true,
|
|
||||||
login_title = _("Login to Evernote"),
|
login_title = _("Login to Evernote"),
|
||||||
notebook_name = _("KOReader Notes"),
|
notebook_name = _("KOReader Notes"),
|
||||||
evernote_domain = nil,
|
evernote_domain = nil,
|
||||||
@@ -46,6 +45,14 @@ function EvernoteExporter:init()
|
|||||||
self.config = DocSettings:open(util.joinPath(self.clipping_dir, "evernote.sdr"))
|
self.config = DocSettings:open(util.joinPath(self.clipping_dir, "evernote.sdr"))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function EvernoteExporter:isDocless()
|
||||||
|
return self.ui == nil or self.ui.document == nil or self.view == nil
|
||||||
|
end
|
||||||
|
|
||||||
|
function EvernoteExporter:readyToExport()
|
||||||
|
return self.evernote_token ~= nil or self.html_export ~= false
|
||||||
|
end
|
||||||
|
|
||||||
function EvernoteExporter:migrateClippings()
|
function EvernoteExporter:migrateClippings()
|
||||||
local old_dir = util.joinPath(util.realpath(util.joinPath(self.path, "..")),
|
local old_dir = util.joinPath(util.realpath(util.joinPath(self.path, "..")),
|
||||||
"evernote.sdr")
|
"evernote.sdr")
|
||||||
@@ -98,7 +105,7 @@ function EvernoteExporter:addToMainMenu(tab_item_table)
|
|||||||
{
|
{
|
||||||
text = _("Export all notes in this book"),
|
text = _("Export all notes in this book"),
|
||||||
enabled_func = function()
|
enabled_func = function()
|
||||||
return self.evernote_token ~= nil or self.html_export ~= false
|
return not self:isDocless() and self:readyToExport()
|
||||||
end,
|
end,
|
||||||
callback = function()
|
callback = function()
|
||||||
UIManager:scheduleIn(0.5, function()
|
UIManager:scheduleIn(0.5, function()
|
||||||
@@ -114,7 +121,7 @@ function EvernoteExporter:addToMainMenu(tab_item_table)
|
|||||||
{
|
{
|
||||||
text = _("Export all notes in your library"),
|
text = _("Export all notes in your library"),
|
||||||
enabled_func = function()
|
enabled_func = function()
|
||||||
return self.evernote_token ~= nil or self.html_export ~= false
|
return self:readyToExport()
|
||||||
end,
|
end,
|
||||||
callback = function()
|
callback = function()
|
||||||
UIManager:scheduleIn(0.5, function()
|
UIManager:scheduleIn(0.5, function()
|
||||||
@@ -132,6 +139,7 @@ function EvernoteExporter:addToMainMenu(tab_item_table)
|
|||||||
checked_func = function() return self.html_export end,
|
checked_func = function() return self.html_export end,
|
||||||
callback = function()
|
callback = function()
|
||||||
self.html_export = not self.html_export
|
self.html_export = not self.html_export
|
||||||
|
self:onSaveSettings()
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user