forked from len0rd/rockbox
[Feature] Add parameters when viewer is selected for open plugin
ask th user if they want to add a parameter when a viewer is set to an open plugin entry (wps hotkey, start screen, etc) Change-Id: I403ac79af15162aeecabb3607923113e27496e4f
This commit is contained in:
parent
1a17b5cb8e
commit
a5663ab3c0
2 changed files with 33 additions and 6 deletions
|
@ -411,7 +411,21 @@ void open_plugin_browse(const char *key)
|
|||
};
|
||||
|
||||
if (rockbox_browse(&browse) == GO_TO_PREVIOUS)
|
||||
{
|
||||
open_plugin_add_path(key, tmp_buf, NULL);
|
||||
/* if this is a viewer ask the user if they want to set a parameter */
|
||||
if (op_entry->lang_id > 0
|
||||
&& strncmp(tmp_buf, VIEWERS_DIR, sizeof(VIEWERS_DIR) -1) == 0)
|
||||
{
|
||||
if (yesno_pop(ID2P(LANG_PARAMETER)))
|
||||
{
|
||||
strcpy(op_entry->param, str(op_entry->lang_id));
|
||||
op_update_dat(op_entry, true); /* flush to disk so plugin can find it */
|
||||
plugin_load(VIEWERS_DIR "/open_plugins.rock",
|
||||
P2STR((unsigned char *)key));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* open_plugin_load_entry()
|
||||
|
|
|
@ -337,8 +337,6 @@ static uint32_t op_entry_add_path(const char *key, const char *plugin, const cha
|
|||
else
|
||||
hash = op_entry.hash;
|
||||
|
||||
|
||||
|
||||
if (plugin)
|
||||
{
|
||||
int fattr = rb->filetype_get_attr(plugin);
|
||||
|
@ -380,9 +378,14 @@ static uint32_t op_entry_add_path(const char *key, const char *plugin, const cha
|
|||
|
||||
if(parameter)
|
||||
{
|
||||
if (parameter[0] == '\0' &&
|
||||
_yesno_pop(ID2P(LANG_PARAMETER)))
|
||||
/* param matches lang_id so we want to set parameter */
|
||||
bool needs_param = op_entry.lang_id >= 0
|
||||
&& (rb->strcmp(parameter, rb->str(op_entry.lang_id)) == 0);
|
||||
if (needs_param
|
||||
|| (parameter[0] == '\0' && _yesno_pop(ID2P(LANG_PARAMETER))))
|
||||
{
|
||||
if (needs_param)
|
||||
op_entry.param[0] = '\0';
|
||||
op_entry_set_param();
|
||||
}
|
||||
else if (parameter != op_entry.param)
|
||||
|
@ -840,12 +843,22 @@ reopen_datfile:
|
|||
if (selection >= 0)
|
||||
{
|
||||
if (op_entry_read(fd_dat, selection, op_entry_sz))
|
||||
{
|
||||
/* param matches lang_id so we want to set the parameter */
|
||||
if (op_entry.lang_id >= 0
|
||||
&& rb->strcmp(op_entry.param, rb->str(op_entry.lang_id)) == 0)
|
||||
{
|
||||
op_entry_add_path(NULL, op_entry.path, op_entry.param, false);
|
||||
exit = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = op_entry_run();
|
||||
if (ret == PLUGIN_GOTO_PLUGIN)
|
||||
exit = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
op_entry_read(fd_dat, selection, op_entry_sz);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue