1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-12-24 20:14:35 +02:00

Add "editable" parameter: when "false", the link can't be modified.

If omitted, the default value is "true".
This commit is contained in:
Paul Cercueil 2012-10-17 00:51:55 +02:00
parent c1a95a2fa6
commit 170a7dc4c6
3 changed files with 7 additions and 2 deletions

View File

@ -1019,7 +1019,7 @@ void GMenu2X::contextMenu() {
}
}
if (menu->selLinkApp()!=NULL) {
if (menu->selLinkApp()!=NULL && menu->selLinkApp()->isEditable()) {
{
MenuOption opt = {tr.translate("Edit $1",menu->selLink()->getTitle().c_str(),NULL), MakeDelegate(this, &GMenu2X::editLink)};
voices.push_back(opt);

View File

@ -66,6 +66,7 @@ LinkApp::LinkApp(GMenu2X *gmenu2x_, Touchscreen &ts, InputManager &inputMgr_,
selectorfilter = "";
icon = iconPath = "";
selectorbrowser = false;
editable = true;
#ifdef PLATFORM_DINGUX
consoleApp = false;
#endif
@ -195,6 +196,9 @@ LinkApp::LinkApp(GMenu2X *gmenu2x_, Touchscreen &ts, InputManager &inputMgr_,
#endif
} else if (name == "selectorfilter") {
setSelectorFilter( value );
} else if (name == "editable") {
if (value == "false")
editable = false;
#ifdef HAVE_LIBOPK
} else
WARNING("Unrecognized option: '%s'\n", name.c_str());

View File

@ -40,7 +40,7 @@ private:
std::string sclock;
int iclock;
std::string exec, params, workdir, manual, selectordir, selectorfilter, selectorscreens;
bool selectorbrowser;
bool selectorbrowser, editable;
void drawRun();
std::string aliasfile;
@ -99,6 +99,7 @@ public:
void showManual();
void selector(int startSelection=0, const std::string &selectorDir="");
bool targetExists();
bool isEditable() { return editable; }
const std::string &getFile() { return file; }
void renameFile(const std::string &name);