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
This commit is contained in:
parent
0dce973729
commit
9712d375ce
7 changed files with 51 additions and 22 deletions
|
@ -398,7 +398,7 @@ static const struct settings_list *get_setting(int gs_value,
|
|||
return defaultval;
|
||||
}
|
||||
|
||||
bool quick_screen_quick(int button_enter)
|
||||
int quick_screen_quick(int button_enter)
|
||||
{
|
||||
struct gui_quickscreen qs;
|
||||
bool oldshuffle = global_settings.playlist_shuffle;
|
||||
|
@ -439,7 +439,7 @@ bool quick_screen_quick(int button_enter)
|
|||
playlist_sort(NULL, true);
|
||||
}
|
||||
}
|
||||
return usb;
|
||||
return (usb ? 1:0);
|
||||
}
|
||||
|
||||
/* stuff to make the quickscreen configurable */
|
||||
|
|
|
@ -43,7 +43,7 @@ struct gui_quickscreen
|
|||
item is changed */
|
||||
};
|
||||
|
||||
extern bool quick_screen_quick(int button_enter);
|
||||
extern int quick_screen_quick(int button_enter);
|
||||
int quickscreen_set_option(void *data);
|
||||
bool is_setting_quickscreenable(const struct settings_list *setting);
|
||||
void set_as_qs_item(const struct settings_list *setting,
|
||||
|
|
|
@ -836,7 +836,12 @@ long gui_wps_show(void)
|
|||
case ACTION_WPS_QUICKSCREEN:
|
||||
{
|
||||
gwps_leave_wps();
|
||||
if (quick_screen_quick(button))
|
||||
if (global_settings.shortcuts_replaces_qs)
|
||||
{
|
||||
global_status.last_screen = GO_TO_SHORTCUTMENU;
|
||||
return quick_screen_quick(button);
|
||||
}
|
||||
else if (quick_screen_quick(button) > 0)
|
||||
return GO_TO_ROOT;
|
||||
restore = true;
|
||||
}
|
||||
|
|
|
@ -427,7 +427,13 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
|
|||
#ifdef HAVE_QUICKSCREEN
|
||||
else if (action == ACTION_STD_QUICKSCREEN)
|
||||
{
|
||||
quick_screen_quick(action);
|
||||
if (global_settings.shortcuts_replaces_qs)
|
||||
{
|
||||
global_status.last_screen = GO_TO_SHORTCUTMENU;
|
||||
ret = quick_screen_quick(action);
|
||||
}
|
||||
else
|
||||
quick_screen_quick(action);
|
||||
redraw_lists = true;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -822,21 +822,27 @@ void root_menu(void)
|
|||
case GO_TO_PLUGIN:
|
||||
{
|
||||
char *key;
|
||||
switch (last_screen)
|
||||
if (global_status.last_screen == GO_TO_SHORTCUTMENU)
|
||||
{
|
||||
case GO_TO_ROOT:
|
||||
key = ID2P(LANG_START_SCREEN);
|
||||
break;
|
||||
case GO_TO_WPS:
|
||||
key = ID2P(LANG_OPEN_PLUGIN_SET_WPS_CONTEXT_PLUGIN);
|
||||
break;
|
||||
case GO_TO_SHORTCUTMENU:
|
||||
key = ID2P(LANG_SHORTCUTS);
|
||||
break;
|
||||
default:
|
||||
key = ID2P(LANG_OPEN_PLUGIN);
|
||||
break;
|
||||
global_status.last_screen = last_screen;
|
||||
key = ID2P(LANG_SHORTCUTS);
|
||||
}
|
||||
else
|
||||
switch (last_screen)
|
||||
{
|
||||
case GO_TO_ROOT:
|
||||
key = ID2P(LANG_START_SCREEN);
|
||||
break;
|
||||
case GO_TO_WPS:
|
||||
key = ID2P(LANG_OPEN_PLUGIN_SET_WPS_CONTEXT_PLUGIN);
|
||||
break;
|
||||
case GO_TO_SHORTCUTMENU:
|
||||
key = ID2P(LANG_SHORTCUTS);
|
||||
break;
|
||||
default:
|
||||
key = ID2P(LANG_OPEN_PLUGIN);
|
||||
break;
|
||||
}
|
||||
|
||||
open_plugin_get_entry(key, &open_plugin_entry);
|
||||
char *path = open_plugin_entry.path;
|
||||
|
|
|
@ -395,8 +395,6 @@ static const char * shortcut_menu_get_name(int selected_item, void * data,
|
|||
char * buffer, size_t buffer_len)
|
||||
{
|
||||
(void)data;
|
||||
(void)buffer;
|
||||
(void)buffer_len;
|
||||
struct shortcut *sc = get_shortcut(selected_item);
|
||||
if (!sc)
|
||||
return "";
|
||||
|
@ -409,6 +407,16 @@ static const char * shortcut_menu_get_name(int selected_item, void * data,
|
|||
/* No translation support as only soft_shutdown has LANG_SHUTDOWN defined */
|
||||
return type_strings[SHORTCUT_SHUTDOWN];
|
||||
}
|
||||
else if (sc->type == SHORTCUT_BROWSER && (sc->u.path)[0] != '\0')
|
||||
{
|
||||
char* pos;
|
||||
if (path_basename(sc->u.path, (const char **)&pos) > 0)
|
||||
{
|
||||
if (snprintf(buffer, buffer_len, "%s (%s)", pos, sc->u.path) < (int)buffer_len)
|
||||
return buffer;
|
||||
}
|
||||
}
|
||||
|
||||
return sc->name[0] ? sc->name : sc->u.path;
|
||||
}
|
||||
|
||||
|
@ -609,7 +617,6 @@ int do_shortcut_menu(void *ignored)
|
|||
/* else fall through */
|
||||
case SHORTCUT_BROWSER:
|
||||
{
|
||||
|
||||
if(open_plugin_add_path(ID2P(LANG_SHORTCUTS), sc->u.path, NULL) != 0)
|
||||
{
|
||||
done = GO_TO_PLUGIN;
|
||||
|
|
|
@ -738,7 +738,12 @@ static int dirbrowse(void)
|
|||
/* don't enter f2 from plugin browser */
|
||||
if (*tc.dirfilter < NUM_FILTER_MODES)
|
||||
{
|
||||
if (quick_screen_quick(button))
|
||||
if (global_settings.shortcuts_replaces_qs)
|
||||
{
|
||||
global_status.last_screen = GO_TO_SHORTCUTMENU;
|
||||
return quick_screen_quick(button);
|
||||
}
|
||||
else if (quick_screen_quick(button))
|
||||
reload_dir = true;
|
||||
restore = true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue