Conversation
| "zsync", | ||
| "news_downloader", | ||
| "send2ebook", | ||
| "moveToArchive", |
There was a problem hiding this comment.
This pushes more plugins to the next page, not necessarily the best move.
There was a problem hiding this comment.
ok will be last here.
|
Thanks. Maybe you can send me some code
…On Wed, Apr 29, 2020, 3:33 AM Frans de Jonge ***@***.***> wrote:
***@***.**** commented on this pull request.
Interesting concept!
------------------------------
In frontend/ui/elements/reader_menu_order.lua
<#6101 (comment)>:
> @@ -120,6 +120,7 @@ local order = {
"zsync",
"news_downloader",
"send2ebook",
+ "moveToArchive",
This pushes more plugins to the next page, not necessarily the best move.
------------------------------
In plugins/moveToArchive.koplugin/main.lua
<#6101 (comment)>:
> + text = _("Move to Archive"),
+ sub_item_table = {
+ {
+ text = _("Move current book to archive"),
+ callback = self.moveToArchive,
+ },
+ {
+ text = _("Copy current book to archive"),
+ callback = self.copyToArchive,
+ },
+ {
+ text = _("Go to archive folder"),
+ callback = function()
+ if not archive_dir_path then
+ UIManager:show(InfoMessage:new{
+ text = _("No archive directory. Please set it first")
You could make it a simple ConfirmBox.
Please set an archive folder first.
Cancel/Set archive folder
------------------------------
In plugins/moveToArchive.koplugin/main.lua
<#6101 (comment)>:
> + })
+ return
+ end
+ if FileManager.instance then
+ FileManager.instance:reinit(archive_dir_path)
+ else
+ FileManager:showFiles(archive_dir_path)
+ end
+ end,
+ },
+ {
+ text = _("Go to last copied/moved from folder"),
+ callback = function()
+ if not last_copied_from_dir then
+ UIManager:show(InfoMessage:new{
+ text = _("No previous dir found")
⬇️ Suggested change
- text = _("No previous dir found")
+ text = _("No previous folder found.")
------------------------------
In plugins/moveToArchive.koplugin/main.lua
<#6101 (comment)>:
> + end
+ end,
+ },
+ {
+ text = _("Set archive directory"),
+ keep_menu_open = true,
+ callback = self.setArchiveDirectory,
+ }
+ },
+ }
+end
+
+function MoveToArchive:moveToArchive()
+ if not archive_dir_path then
+ UIManager:show(InfoMessage:new{
+ text = _("No archive directory. Please set it first")
Same as above
------------------------------
In plugins/moveToArchive.koplugin/main.lua
<#6101 (comment)>:
> + text = _("No archive directory. Please set it first")
+ })
+ return
+ end
+ local document_full_path = G_reader_settings:readSetting("lastfile")
+ last_copied_from_dir = util.splitFilePathName(document_full_path)
+ logger.dbg("MoveToArchive: last_copied_from_dir :", last_copied_from_dir)
+
+ FileManager:moveFile(document_full_path, archive_dir_path)
+
+ move_to_archive_settings:saveSetting(last_copied_from_config_key, ("%s/"):format(last_copied_from_dir))
+
+ ReadHistory:removeItemByPath(document_full_path)
+
+ UIManager:show(InfoMessage:new{
+ text = _("Book moved. Please reopen it from archive location.")
I'd be inclined to leave off the second sentence or to make it a
ConfirmBox.
------------------------------
In plugins/moveToArchive.koplugin/main.lua
<#6101 (comment)>:
> +
+ FileManager:moveFile(document_full_path, archive_dir_path)
+
+ move_to_archive_settings:saveSetting(last_copied_from_config_key, ("%s/"):format(last_copied_from_dir))
+
+ ReadHistory:removeItemByPath(document_full_path)
+
+ UIManager:show(InfoMessage:new{
+ text = _("Book moved. Please reopen it from archive location.")
+ })
+end
+
+function MoveToArchive:copyToArchive()
+ if not archive_dir_path then
+ UIManager:show(InfoMessage:new{
+ text = _("No archive directory. Please set it first")
Same as above
------------------------------
In plugins/moveToArchive.koplugin/main.lua
<#6101 (comment)>:
> + if not archive_dir_path then
+ UIManager:show(InfoMessage:new{
+ text = _("No archive directory. Please set it first")
+ })
+ return
+ end
+ local document_full_path = G_reader_settings:readSetting("lastfile")
+ last_copied_from_dir = util.splitFilePathName(document_full_path)
+
+ logger.dbg("MoveToArchive: last_copied_from_dir :", last_copied_from_dir)
+ move_to_archive_settings:saveSetting(last_copied_from_config_key, ("%s/"):format(last_copied_from_dir))
+
+ FileManager:cpFile(document_full_path, archive_dir_path)
+
+ UIManager:show(InfoMessage:new{
+ text = _("Book copied. Please reopen it from archive location if needed.")
Same as above
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#6101 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/APIOXUJAVLJMTYLRMTZXIBTRO77AHANCNFSM4MTCVEDA>
.
|
|
@Robertmccalister747 I don't understand what you mean. Code is in this repo/PR. |
Thanks:) |
|
Changes done. |
|
Changes done. |
| end | ||
|
|
||
| function MoveToArchive:copyToArchive() | ||
| local copy_done_text =_("Book copied. \nDo you want to open it from archive folder?") |
There was a problem hiding this comment.
| local copy_done_text =_("Book copied. \nDo you want to open it from archive folder?") | |
| local copy_done_text =_("Book copied.\nDo you want to open it from the archive folder?") |
|
|
||
| function MoveToArchive:addToMainMenu(menu_items) | ||
| menu_items.move_to_archive = { | ||
| text = _("Move to Archive"), |
There was a problem hiding this comment.
| text = _("Move to Archive"), | |
| text = _("Move to archive"), |
| "news_downloader", | ||
| "send2ebook", | ||
| "text_editor", | ||
| "move_to_archive", |
There was a problem hiding this comment.
I guess the more_plugins menu isn't really needed anymore, now that the user can disable the plugins he doesn't need.
If you put some in more_plugins, no matter the user cleaning, he would have to tap once more to reach that unfortunate plugin we put into more_plugins.
If we'd want to keep more_plugins, only non-user-action plugins (those with only settings or some permanent behaviour) should go in there.
So, I wouldn't mind an initial Plugins menu with 20 items :) as I can clean it up to the 5 that matters to me.
There was a problem hiding this comment.
Yes, I have only a few plugins activated, and definitely do not need More plugins menu.
There was a problem hiding this comment.
I agree that the more plugins menu in not necessary, and just annoying for the plugins that i use that are there. (I only use ~5 plugins)
Resolved |
Frenzie
left a comment
There was a problem hiding this comment.
lgtm, letting it sit for another day or maybe two in case anybody else has any comments
|
Btw off topic : do we still need "more plugins" as there's something like "next page" in menu if there're too many entries? Imho it's misleading. |
|
Like @poire-z said we should organize it differently. |
|
Just unsure what's happening when moving:
If that is what's really happening, you have:
In FileManager, when we move/rename a file (and we do that the book closed), there are a bit more stuff taken care of: koreader/frontend/apps/filemanager/filemanager.lua Lines 782 to 806 in be72203 |
|
Ok, cool off topic extracted to : #6105 |
|
@poire-z right sdr is currently not moved. This was designed mainly for wallabag /nd/S2E so it shouldn't be a big issue. But anyway I wanted to add this next PR. |
Files lying around is an issue for me :) People might test it tomorrow if merged, and that's rather not cool leaving mess on their device. But I reckon it's not easy fixing... Even if you move the docsettings, it will be saved at the old place when the book is closed. So, ideally, when moving, you would ask/tell the user that the file will be moved and re-opened, and if he says OK: close the book, move file + docsettings, re-open the book from the archived file (and if you propose and option to not re-open the book, what to do from there?). Anyway, I let @Frenzie decide how critical that is :) |
|
I didn't realize it didn't deal with SDRs properly; I'd definitely prefer to see that fixed first too. |
|
Ok will try. |
But it mostly depends on what you want to do after (open another document, go to file browser, exit koreader). It's a bit unclear to me what's your workflow with this plugin (and what it will be for other people):
|
Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>
Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>
Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>
Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>
Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>
Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>
|
|
||
| local MoveToArchive = WidgetContainer:new{ | ||
| name = "move2archive", | ||
| move_to_archive_settings = nil, |
There was a problem hiding this comment.
I can't tell what you're referring to in EverNote, but PerceptionExpander surely does not:
koreader/plugins/perceptionexpander.koplugin/main.lua
Lines 16 to 28 in be72203
Note how it says settings, not perception_expander_settings.
NB Other plugins do it too is not a good argument.
Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>
Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>
|
done |
|
Looks fine, no more comment. |
|
Thanks @mwoz123 ! |
|
Can't be disabled. I guess it needs the names to be coherent with the plugin directory name: --- a/plugins/movetoarchive.koplugin/_meta.lua
+++ b/plugins/movetoarchive.koplugin/_meta.lua
@@ -1,6 +1,6 @@
local _ = require("gettext")
return {
- name = "move_to_archive",
+ name = "movetoarchive",
fullname = _("Move to archive"),
description = _([[Moves/copies current book to archive folder]]),
}
diff --git a/plugins/movetoarchive.koplugin/main.lua b/plugins/movetoarchive.koplugin/main.lua
index f575a849..08cba643 100644
--- a/plugins/movetoarchive.koplugin/main.lua
+++ b/plugins/movetoarchive.koplugin/main.lua
@@ -14,7 +14,7 @@ local BaseUtil = require("ffi/util")
local _ = require("gettext")
local MoveToArchive = WidgetContainer:new{
- name = "move2archive",
+ name = "movetoarchive",
}
function MoveToArchive:init() |
Mismatches in these names prevent this plugin from being disabled'able. #6101 (comment)
|
Thank you for giving me the time of day lol
…On Wed, Apr 29, 2020, 8:11 AM mwoz123 ***@***.***> wrote:
Changes done.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#6101 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/APIOXUK43GM3XDARNVIC3R3RPA7SDANCNFSM4MTCVEDA>
.
|
Plugin to move/copy current reading book to archive folder
This change is