diff options
author | William Wilgus <wilgus.william@gmail.com> | 2021-03-07 10:07:49 -0500 |
---|---|---|
committer | William Wilgus <wilgus.william@gmail.com> | 2021-03-07 10:07:49 -0500 |
commit | 9712d375ce31d8394cc30b9121577a7646c1af12 (patch) | |
tree | 15496f9654ae0fbeecb50017d48b34f2f6463216 | |
parent | 0dce97372987a0b25446c33c7bfd616780d9d7c0 (diff) | |
download | rockbox-9712d375ce31d8394cc30b9121577a7646c1af12.tar.gz rockbox-9712d375ce31d8394cc30b9121577a7646c1af12.zip |
Shortcuts.c -- Update
Fix returns from shortcuts -- should now run plugins
Fix formatting of file names to remove path from browser shortcuts
Change-Id: I46e337110d04b84bedcb0c2945d5dd29a1860847
-rw-r--r-- | apps/gui/quickscreen.c | 4 | ||||
-rw-r--r-- | apps/gui/quickscreen.h | 2 | ||||
-rw-r--r-- | apps/gui/wps.c | 7 | ||||
-rw-r--r-- | apps/menu.c | 8 | ||||
-rw-r--r-- | apps/root_menu.c | 32 | ||||
-rw-r--r-- | apps/shortcuts.c | 13 | ||||
-rw-r--r-- | apps/tree.c | 7 |
7 files changed, 51 insertions, 22 deletions
diff --git a/apps/gui/quickscreen.c b/apps/gui/quickscreen.c index b5113df8f6..f1c95ffef2 100644 --- a/apps/gui/quickscreen.c +++ b/apps/gui/quickscreen.c | |||
@@ -398,7 +398,7 @@ static const struct settings_list *get_setting(int gs_value, | |||
398 | return defaultval; | 398 | return defaultval; |
399 | } | 399 | } |
400 | 400 | ||
401 | bool quick_screen_quick(int button_enter) | 401 | int quick_screen_quick(int button_enter) |
402 | { | 402 | { |
403 | struct gui_quickscreen qs; | 403 | struct gui_quickscreen qs; |
404 | bool oldshuffle = global_settings.playlist_shuffle; | 404 | bool oldshuffle = global_settings.playlist_shuffle; |
@@ -439,7 +439,7 @@ bool quick_screen_quick(int button_enter) | |||
439 | playlist_sort(NULL, true); | 439 | playlist_sort(NULL, true); |
440 | } | 440 | } |
441 | } | 441 | } |
442 | return usb; | 442 | return (usb ? 1:0); |
443 | } | 443 | } |
444 | 444 | ||
445 | /* stuff to make the quickscreen configurable */ | 445 | /* stuff to make the quickscreen configurable */ |
diff --git a/apps/gui/quickscreen.h b/apps/gui/quickscreen.h index acce5cf9bf..015928ee8a 100644 --- a/apps/gui/quickscreen.h +++ b/apps/gui/quickscreen.h | |||
@@ -43,7 +43,7 @@ struct gui_quickscreen | |||
43 | item is changed */ | 43 | item is changed */ |
44 | }; | 44 | }; |
45 | 45 | ||
46 | extern bool quick_screen_quick(int button_enter); | 46 | extern int quick_screen_quick(int button_enter); |
47 | int quickscreen_set_option(void *data); | 47 | int quickscreen_set_option(void *data); |
48 | bool is_setting_quickscreenable(const struct settings_list *setting); | 48 | bool is_setting_quickscreenable(const struct settings_list *setting); |
49 | void set_as_qs_item(const struct settings_list *setting, | 49 | void set_as_qs_item(const struct settings_list *setting, |
diff --git a/apps/gui/wps.c b/apps/gui/wps.c index 846c952baf..78ab8dc8dd 100644 --- a/apps/gui/wps.c +++ b/apps/gui/wps.c | |||
@@ -836,7 +836,12 @@ long gui_wps_show(void) | |||
836 | case ACTION_WPS_QUICKSCREEN: | 836 | case ACTION_WPS_QUICKSCREEN: |
837 | { | 837 | { |
838 | gwps_leave_wps(); | 838 | gwps_leave_wps(); |
839 | if (quick_screen_quick(button)) | 839 | if (global_settings.shortcuts_replaces_qs) |
840 | { | ||
841 | global_status.last_screen = GO_TO_SHORTCUTMENU; | ||
842 | return quick_screen_quick(button); | ||
843 | } | ||
844 | else if (quick_screen_quick(button) > 0) | ||
840 | return GO_TO_ROOT; | 845 | return GO_TO_ROOT; |
841 | restore = true; | 846 | restore = true; |
842 | } | 847 | } |
diff --git a/apps/menu.c b/apps/menu.c index fefc8fca2b..30a098f331 100644 --- a/apps/menu.c +++ b/apps/menu.c | |||
@@ -427,7 +427,13 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, | |||
427 | #ifdef HAVE_QUICKSCREEN | 427 | #ifdef HAVE_QUICKSCREEN |
428 | else if (action == ACTION_STD_QUICKSCREEN) | 428 | else if (action == ACTION_STD_QUICKSCREEN) |
429 | { | 429 | { |
430 | quick_screen_quick(action); | 430 | if (global_settings.shortcuts_replaces_qs) |
431 | { | ||
432 | global_status.last_screen = GO_TO_SHORTCUTMENU; | ||
433 | ret = quick_screen_quick(action); | ||
434 | } | ||
435 | else | ||
436 | quick_screen_quick(action); | ||
431 | redraw_lists = true; | 437 | redraw_lists = true; |
432 | } | 438 | } |
433 | #endif | 439 | #endif |
diff --git a/apps/root_menu.c b/apps/root_menu.c index 77a092018a..fb7b5218e2 100644 --- a/apps/root_menu.c +++ b/apps/root_menu.c | |||
@@ -822,21 +822,27 @@ void root_menu(void) | |||
822 | case GO_TO_PLUGIN: | 822 | case GO_TO_PLUGIN: |
823 | { | 823 | { |
824 | char *key; | 824 | char *key; |
825 | switch (last_screen) | 825 | if (global_status.last_screen == GO_TO_SHORTCUTMENU) |
826 | { | 826 | { |
827 | case GO_TO_ROOT: | 827 | global_status.last_screen = last_screen; |
828 | key = ID2P(LANG_START_SCREEN); | 828 | key = ID2P(LANG_SHORTCUTS); |
829 | break; | ||
830 | case GO_TO_WPS: | ||
831 | key = ID2P(LANG_OPEN_PLUGIN_SET_WPS_CONTEXT_PLUGIN); | ||
832 | break; | ||
833 | case GO_TO_SHORTCUTMENU: | ||
834 | key = ID2P(LANG_SHORTCUTS); | ||
835 | break; | ||
836 | default: | ||
837 | key = ID2P(LANG_OPEN_PLUGIN); | ||
838 | break; | ||
839 | } | 829 | } |
830 | else | ||
831 | switch (last_screen) | ||
832 | { | ||
833 | case GO_TO_ROOT: | ||
834 | key = ID2P(LANG_START_SCREEN); | ||
835 | break; | ||
836 | case GO_TO_WPS: | ||
837 | key = ID2P(LANG_OPEN_PLUGIN_SET_WPS_CONTEXT_PLUGIN); | ||
838 | break; | ||
839 | case GO_TO_SHORTCUTMENU: | ||
840 | key = ID2P(LANG_SHORTCUTS); | ||
841 | break; | ||
842 | default: | ||
843 | key = ID2P(LANG_OPEN_PLUGIN); | ||
844 | break; | ||
845 | } | ||
840 | 846 | ||
841 | open_plugin_get_entry(key, &open_plugin_entry); | 847 | open_plugin_get_entry(key, &open_plugin_entry); |
842 | char *path = open_plugin_entry.path; | 848 | char *path = open_plugin_entry.path; |
diff --git a/apps/shortcuts.c b/apps/shortcuts.c index aa9a32bbb2..70f140d42e 100644 --- a/apps/shortcuts.c +++ b/apps/shortcuts.c | |||
@@ -395,8 +395,6 @@ static const char * shortcut_menu_get_name(int selected_item, void * data, | |||
395 | char * buffer, size_t buffer_len) | 395 | char * buffer, size_t buffer_len) |
396 | { | 396 | { |
397 | (void)data; | 397 | (void)data; |
398 | (void)buffer; | ||
399 | (void)buffer_len; | ||
400 | struct shortcut *sc = get_shortcut(selected_item); | 398 | struct shortcut *sc = get_shortcut(selected_item); |
401 | if (!sc) | 399 | if (!sc) |
402 | return ""; | 400 | return ""; |
@@ -409,6 +407,16 @@ static const char * shortcut_menu_get_name(int selected_item, void * data, | |||
409 | /* No translation support as only soft_shutdown has LANG_SHUTDOWN defined */ | 407 | /* No translation support as only soft_shutdown has LANG_SHUTDOWN defined */ |
410 | return type_strings[SHORTCUT_SHUTDOWN]; | 408 | return type_strings[SHORTCUT_SHUTDOWN]; |
411 | } | 409 | } |
410 | else if (sc->type == SHORTCUT_BROWSER && (sc->u.path)[0] != '\0') | ||
411 | { | ||
412 | char* pos; | ||
413 | if (path_basename(sc->u.path, (const char **)&pos) > 0) | ||
414 | { | ||
415 | if (snprintf(buffer, buffer_len, "%s (%s)", pos, sc->u.path) < (int)buffer_len) | ||
416 | return buffer; | ||
417 | } | ||
418 | } | ||
419 | |||
412 | return sc->name[0] ? sc->name : sc->u.path; | 420 | return sc->name[0] ? sc->name : sc->u.path; |
413 | } | 421 | } |
414 | 422 | ||
@@ -609,7 +617,6 @@ int do_shortcut_menu(void *ignored) | |||
609 | /* else fall through */ | 617 | /* else fall through */ |
610 | case SHORTCUT_BROWSER: | 618 | case SHORTCUT_BROWSER: |
611 | { | 619 | { |
612 | |||
613 | if(open_plugin_add_path(ID2P(LANG_SHORTCUTS), sc->u.path, NULL) != 0) | 620 | if(open_plugin_add_path(ID2P(LANG_SHORTCUTS), sc->u.path, NULL) != 0) |
614 | { | 621 | { |
615 | done = GO_TO_PLUGIN; | 622 | done = GO_TO_PLUGIN; |
diff --git a/apps/tree.c b/apps/tree.c index fc54b06f33..44af918804 100644 --- a/apps/tree.c +++ b/apps/tree.c | |||
@@ -738,7 +738,12 @@ static int dirbrowse(void) | |||
738 | /* don't enter f2 from plugin browser */ | 738 | /* don't enter f2 from plugin browser */ |
739 | if (*tc.dirfilter < NUM_FILTER_MODES) | 739 | if (*tc.dirfilter < NUM_FILTER_MODES) |
740 | { | 740 | { |
741 | if (quick_screen_quick(button)) | 741 | if (global_settings.shortcuts_replaces_qs) |
742 | { | ||
743 | global_status.last_screen = GO_TO_SHORTCUTMENU; | ||
744 | return quick_screen_quick(button); | ||
745 | } | ||
746 | else if (quick_screen_quick(button)) | ||
742 | reload_dir = true; | 747 | reload_dir = true; |
743 | restore = true; | 748 | restore = true; |
744 | } | 749 | } |