1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-07-04 20:52:56 +03: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)}; MenuOption opt = {tr.translate("Edit $1",menu->selLink()->getTitle().c_str(),NULL), MakeDelegate(this, &GMenu2X::editLink)};
voices.push_back(opt); voices.push_back(opt);

View File

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

View File

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