From 13178d23b82ffde13fdbf8e36cfa0358f22e8dc3 Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Mon, 8 Mar 2021 21:59:04 -0500 Subject: [PATCH] Shortcuts Menu Update Change Browser shortcut to the plugin icon drop back into WPS on opx return allow same action to exit shortcut menu as entered -- might be problematic Change-Id: Id7013a514c8e8862ee1da44b033d10b7519e9127 --- apps/menu.c | 1 + apps/root_menu.c | 12 ++++++++++++ apps/shortcuts.c | 4 +++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/apps/menu.c b/apps/menu.c index 30a098f331..a7d52896a6 100644 --- a/apps/menu.c +++ b/apps/menu.c @@ -431,6 +431,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, { global_status.last_screen = GO_TO_SHORTCUTMENU; ret = quick_screen_quick(action); + done = true; } else quick_screen_quick(action); diff --git a/apps/root_menu.c b/apps/root_menu.c index fb7b5218e2..8df9f87d44 100644 --- a/apps/root_menu.c +++ b/apps/root_menu.c @@ -738,6 +738,7 @@ void root_menu(void) { int previous_browser = GO_TO_FILEBROWSER; int selected = 0; + int shortcut_origin = GO_TO_ROOT; push_current_activity(ACTIVITY_MAINMENU); @@ -824,10 +825,12 @@ void root_menu(void) char *key; if (global_status.last_screen == GO_TO_SHORTCUTMENU) { + shortcut_origin = last_screen; global_status.last_screen = last_screen; key = ID2P(LANG_SHORTCUTS); } else + { switch (last_screen) { case GO_TO_ROOT: @@ -843,6 +846,7 @@ void root_menu(void) key = ID2P(LANG_OPEN_PLUGIN); break; } + } open_plugin_get_entry(key, &open_plugin_entry); char *path = open_plugin_entry.path; @@ -852,6 +856,14 @@ void root_menu(void) next_screen = load_plugin_screen(path, param); + /* shortcuts may take several trips through the GO_TO_PLUGIN case + make sure we preserve and restore the origin */ + if (next_screen == GO_TO_PREVIOUS && shortcut_origin != GO_TO_ROOT) + { + next_screen = shortcut_origin; + shortcut_origin = GO_TO_ROOT; + } + previous_browser = (next_screen != GO_TO_WPS) ? GO_TO_FILEBROWSER : GO_TO_PLUGIN; break; } diff --git a/apps/shortcuts.c b/apps/shortcuts.c index 70f140d42e..5322447b46 100644 --- a/apps/shortcuts.c +++ b/apps/shortcuts.c @@ -425,6 +425,8 @@ static int shortcut_menu_get_action(int action, struct gui_synclist *lists) (void)lists; if (action == ACTION_STD_OK) return ACTION_STD_CANCEL; + else if (action == ACTION_STD_QUICKSCREEN && action != ACTION_STD_CONTEXT) + return ACTION_STD_CANCEL; else if (action == ACTION_STD_CONTEXT) { int selection = gui_synclist_get_sel_pos(lists); @@ -459,7 +461,7 @@ static enum themable_icons shortcut_menu_get_icon(int selected_item, void * data case SHORTCUT_FILE: return filetype_get_icon(filetype_get_attr(sc->u.path)); case SHORTCUT_BROWSER: - return Icon_Folder; + return Icon_Plugin; case SHORTCUT_SETTING: return Icon_Menu_setting; case SHORTCUT_DEBUGITEM: