1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-11-17 21:10:39 +02:00

Show a file selector in OPK links only if Exec requires a file

Previously, if a user installed a new version of an OPK with the same
name as one that had a link configuration file, GMenu2X could request
a file for an application whose new version required no files to
launch.

In practice, this transition would occur only once per OPK application,
when its developer decided to use a custom browser after having used
GMenu2X's file browser. This bug would then show GMenu2X's file browser
to request a file that would not even be passed to the application.

Thanks to Nebuleon for analyzing the problem and the above description.
This commit is contained in:
Maarten ter Huurne 2014-08-14 02:08:51 +02:00
parent 35724170f8
commit 60aaf5954a

View File

@ -103,6 +103,7 @@ LinkApp::LinkApp(GMenu2X *gmenu2x_, const char* linkfile)
editable = true; editable = true;
edited = false; edited = false;
bool appTakesFileArg = true;
#ifdef HAVE_LIBOPK #ifdef HAVE_LIBOPK
isOPK = !!opk; isOPK = !!opk;
@ -121,6 +122,8 @@ LinkApp::LinkApp(GMenu2X *gmenu2x_, const char* linkfile)
file = gmenu2x->getHome() + "/sections/"; file = gmenu2x->getHome() + "/sections/";
appTakesFileArg = false;
while ((ret = opk_read_pair(opk, &key, &lkey, &val, &lval))) { while ((ret = opk_read_pair(opk, &key, &lkey, &val, &lval))) {
if (ret < 0) { if (ret < 0) {
ERROR("Unable to read meta-data\n"); ERROR("Unable to read meta-data\n");
@ -169,6 +172,7 @@ LinkApp::LinkApp(GMenu2X *gmenu2x_, const char* linkfile)
for (auto token : tokens) { for (auto token : tokens) {
if (tmp.find(token) != tmp.npos) { if (tmp.find(token) != tmp.npos) {
selectordir = CARD_ROOT; selectordir = CARD_ROOT;
appTakesFileArg = true;
break; break;
} }
} }
@ -226,7 +230,7 @@ LinkApp::LinkApp(GMenu2X *gmenu2x_, const char* linkfile)
if (name == "clock") { if (name == "clock") {
setClock( atoi(value.c_str()) ); setClock( atoi(value.c_str()) );
} else if (name == "selectordir") { } else if (name == "selectordir") {
setSelectorDir( value ); if (appTakesFileArg) setSelectorDir(value);
} else if (name == "selectorbrowser") { } else if (name == "selectorbrowser") {
if (value=="false") selectorbrowser = false; if (value=="false") selectorbrowser = false;
} else if (!isOpk()) { } else if (!isOpk()) {