1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-11-22 13:05:20 +02:00

Load previews from the previews/ subdir of the current dir in selectors.

This does away with per-link selector directories in link files. It is assumed
that, if a user has access to write files to be launched by an application at
some location, he or she also has access to write files in the previews/
subdirectory under it.
This commit is contained in:
Nebuleon Fumika 2014-07-13 21:01:20 +00:00 committed by Maarten ter Huurne
parent aca6025533
commit 349e758b3b
4 changed files with 3 additions and 20 deletions

View File

@ -901,7 +901,6 @@ void GMenu2X::editLink() {
string linkSelFilter = linkApp->getSelectorFilter();
string linkSelDir = linkApp->getSelectorDir();
bool linkSelBrowser = linkApp->getSelectorBrowser();
string linkSelScreens = linkApp->getSelectorScreens();
int linkClock = linkApp->clock();
string diagTitle = tr.translate("Edit $1",linkTitle.c_str(),NULL);
@ -928,7 +927,6 @@ void GMenu2X::editLink() {
#endif
if (!linkApp->isOpk()) {
sd.addSetting(new MenuSettingString(this, ts, tr["Selector Filter"], tr["Selector filter (Separate values with a comma)"], &linkSelFilter, diagTitle, diagIcon));
sd.addSetting(new MenuSettingDir(this, ts, tr["Selector Screenshots"], tr["Directory of the screenshots for the selector"], &linkSelScreens));
#if defined(PLATFORM_A320) || defined(PLATFORM_GCW0)
sd.addSetting(new MenuSettingBool(this, ts, tr["Display Console"], tr["Must be enabled for console-based applications"], &linkApp->consoleApp));
#endif
@ -941,8 +939,6 @@ void GMenu2X::editLink() {
linkApp->setManual(linkManual);
linkApp->setSelectorFilter(linkSelFilter);
linkApp->setSelectorDir(linkSelDir);
linkApp->setSelectorBrowser(linkSelBrowser);
linkApp->setSelectorScreens(linkSelScreens);
linkApp->setClock(linkClock);
INFO("New Section: '%s'\n", newSection.c_str());

View File

@ -208,8 +208,6 @@ LinkApp::LinkApp(GMenu2X *gmenu2x_, const char* linkfile)
setSelectorDir( value );
} else if (name == "selectorbrowser") {
if (value=="false") selectorbrowser = false;
} else if (name == "selectorscreens") {
setSelectorScreens( value );
} else if (!isOpk()) {
if (name == "title") {
title = value;
@ -325,7 +323,6 @@ bool LinkApp::save() {
if (iclock != 0 ) f << "clock=" << iclock << endl;
if (!selectordir.empty() ) f << "selectordir=" << selectordir << endl;
if (!selectorbrowser ) f << "selectorbrowser=false" << endl;
if (!selectorscreens.empty() ) f << "selectorscreens=" << selectorscreens << endl;
f.close();
sync();
return true;
@ -697,15 +694,6 @@ void LinkApp::setSelectorFilter(const string &selectorfilter) {
edited = true;
}
const string &LinkApp::getSelectorScreens() {
return selectorscreens;
}
void LinkApp::setSelectorScreens(const string &selectorscreens) {
this->selectorscreens = selectorscreens;
edited = true;
}
void LinkApp::renameFile(const string &name) {
file = name;
}

View File

@ -36,7 +36,7 @@ class LinkApp : public Link {
private:
std::string sclock;
int iclock;
std::string exec, params, workdir, manual, selectordir, selectorfilter, selectorscreens;
std::string exec, params, workdir, manual, selectordir, selectorfilter;
bool selectorbrowser, editable;
std::string file;
@ -81,8 +81,6 @@ public:
void setSelectorDir(const std::string &selectordir);
bool getSelectorBrowser();
void setSelectorBrowser(bool value);
const std::string &getSelectorScreens();
void setSelectorScreens(const std::string &selectorscreens);
const std::string &getSelectorFilter();
void setSelectorFilter(const std::string &selectorfilter);

View File

@ -223,10 +223,11 @@ void Selector::prepare(FileLister *fl, vector<string> *screens, vector<string> *
screens->resize(fl->getFiles().size());
titles->resize(fl->getFiles().size());
string screendir = link->getSelectorScreens();
string screendir = dir;
if (!screendir.empty() && screendir[screendir.length() - 1] != '/') {
screendir += "/";
}
screendir += "previews/";
string noext;
string::size_type pos;