mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-12-24 19:25:30 +02:00
Load the OPK in the section defined by their "Categories" parameter
This commit is contained in:
parent
c58c726954
commit
4a60aa000d
@ -88,9 +88,20 @@ LinkApp::LinkApp(GMenu2X *gmenu2x_, Touchscreen &ts, InputManager &inputMgr_,
|
||||
pos = opkMount.rfind('.');
|
||||
opkMount = opkMount.substr(0, pos);
|
||||
|
||||
file = gmenu2x->getHome() + "/sections/" + opkMount;
|
||||
file = gmenu2x->getHome() + "/sections/";
|
||||
opkMount = (string) "/mnt/" + opkMount + '/';
|
||||
|
||||
param = opk_read_param(pdata, "Categories");
|
||||
if (!param)
|
||||
ERROR("Missing \"Categories\" parameter\n");
|
||||
else {
|
||||
category = param;
|
||||
pos = category.find(';');
|
||||
if (pos != category.npos)
|
||||
category = category.substr(0, pos);
|
||||
file += category + '/' + opkMount;
|
||||
}
|
||||
|
||||
param = opk_read_param(pdata, "Name");
|
||||
if (!param)
|
||||
ERROR("Missing \"Name\" parameter\n");
|
||||
|
@ -49,7 +49,7 @@ private:
|
||||
bool dontleave;
|
||||
#ifdef HAVE_LIBOPK
|
||||
bool isOPK;
|
||||
std::string opkMount, opkFile;
|
||||
std::string opkMount, opkFile, category;
|
||||
#endif
|
||||
|
||||
void start();
|
||||
@ -59,6 +59,8 @@ private:
|
||||
|
||||
public:
|
||||
#ifdef HAVE_LIBOPK
|
||||
const std::string &getCategory() { return category; }
|
||||
|
||||
LinkApp(GMenu2X *gmenu2x, Touchscreen &ts, InputManager &inputMgr,
|
||||
const char* linkfile, bool opk = false);
|
||||
#else
|
||||
|
10
src/menu.cpp
10
src/menu.cpp
@ -448,6 +448,7 @@ void Menu::readPackages(std::string parentDir)
|
||||
char *c;
|
||||
LinkApp *link;
|
||||
std::string path;
|
||||
unsigned int i;
|
||||
|
||||
if (dptr->d_type != DT_REG)
|
||||
continue;
|
||||
@ -463,8 +464,13 @@ void Menu::readPackages(std::string parentDir)
|
||||
link = new LinkApp(gmenu2x, ts, gmenu2x->input, path.c_str(), true);
|
||||
link->setSize(gmenu2x->skinConfInt["linkWidth"], gmenu2x->skinConfInt["linkHeight"]);
|
||||
|
||||
/* TODO: Read the category from the OPK. */
|
||||
links[0].push_back(link);
|
||||
addSection(link->getCategory());
|
||||
for (i = 0; i < sections.size(); i++) {
|
||||
if (sections[i] == link->getCategory()) {
|
||||
links[i].push_back(link);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
closedir(dirp);
|
||||
|
Loading…
Reference in New Issue
Block a user