shortcuts: fix 'File' shortcuts may fail when dir filter set

Only apply dir filter to 'Browse' shortcuts, so that,
when trying to run a file from Shortcuts that is hidden
due to current dir filter settings, you don't get a 'Failed
reading Unknown' message (LANG_READ_FAILED/LANG_UNKNOWN)
because the tree entry can't be found in ft_enter.

Change-Id: I4eaad2ec415c9bac352a409922848e4407dac993
This commit is contained in:
Christian Soffke 2026-06-04 21:27:15 +02:00
parent ad05e23b72
commit 0836ebbd45

View file

@ -765,17 +765,12 @@ int do_shortcut_menu(void *ignored)
{ {
case SHORTCUT_PLAYLISTMENU: case SHORTCUT_PLAYLISTMENU:
if (!file_exists(sc->u.path)) if (!file_exists(sc->u.path))
{
splash(HZ, ID2P(LANG_NO_FILES)); splash(HZ, ID2P(LANG_NO_FILES));
break;
}
else else
{
onplay_show_playlist_menu(sc->u.path, onplay_show_playlist_menu(sc->u.path,
dir_exists(sc->u.path) ? ATTR_DIRECTORY : dir_exists(sc->u.path) ? ATTR_DIRECTORY :
filetype_get_attr(sc->u.path), filetype_get_attr(sc->u.path),
NULL); NULL);
}
break; break;
case SHORTCUT_FILE: case SHORTCUT_FILE:
if (!file_exists(sc->u.path)) if (!file_exists(sc->u.path))
@ -785,38 +780,33 @@ int do_shortcut_menu(void *ignored)
} }
/* else fall through */ /* else fall through */
case SHORTCUT_BROWSER: case SHORTCUT_BROWSER:
{ if (open_plugin_add_path(ID2P(LANG_SHORTCUTS),
if(open_plugin_add_path(ID2P(LANG_SHORTCUTS), sc->u.path, NULL) != 0) sc->u.path, NULL) != 0)
{ {
done = GO_TO_PLUGIN; done = GO_TO_PLUGIN;
break; break;
} }
struct browse_context browse = { struct browse_context browse = {
.dirfilter = global_settings.dirfilter, .dirfilter = SHOW_ALL, /* ignored for SHORTCUT_BROWSER */
.icon = Icon_NOICON, .icon = Icon_NOICON,
.root = sc->u.path, .root = sc->u.path,
}; };
if (sc->type == SHORTCUT_FILE) if (sc->type == SHORTCUT_FILE)
browse.flags |= BROWSE_RUNFILE; browse.flags = BROWSE_RUNFILE | BROWSE_DIRFILTER;
done = rockbox_browse(&browse); done = rockbox_browse(&browse);
break;
} case SHORTCUT_SETTING_APPLY:;
break;
case SHORTCUT_SETTING_APPLY:
{
bool theme_changed; bool theme_changed;
string_to_cfg(sc->setting->cfg_name, sc->u.path, &theme_changed); string_to_cfg(sc->setting->cfg_name, sc->u.path, &theme_changed);
settings_save(); settings_save();
apply_new_setting(sc->setting); apply_new_setting(sc->setting);
break; break;
}
case SHORTCUT_SETTING: case SHORTCUT_SETTING:
{ do_setting_screen(sc->setting, sc->name[0] ?
do_setting_screen(sc->setting, sc->name : P2STR(ID2P(sc->setting->lang_id)),
sc->name[0] ? sc->name : P2STR(ID2P(sc->setting->lang_id)),NULL); NULL);
apply_new_setting(sc->setting); apply_new_setting(sc->setting);
break; break;
}
case SHORTCUT_DEBUGITEM: case SHORTCUT_DEBUGITEM:
run_debug_screen(sc->u.path); run_debug_screen(sc->u.path);
break; break;
@ -838,7 +828,7 @@ int do_shortcut_menu(void *ignored)
break; break;
case SHORTCUT_TIME: case SHORTCUT_TIME:
#if CONFIG_RTC #if CONFIG_RTC
if (!sc->u.timedata.talktime) if (!sc->u.timedata.talktime)
#endif #endif
{ {
char timer_buf[10]; char timer_buf[10];