Prevent accidental modification of vital stock grid
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
<array>
|
<array>
|
||||||
|
|
||||||
<map>
|
<map>
|
||||||
<key>default_grids_version</key><string>21</string>
|
<key>default_grids_version</key><string>22</string>
|
||||||
</map>
|
</map>
|
||||||
|
|
||||||
<!-- Second Life -->
|
<!-- Second Life -->
|
||||||
@@ -20,6 +20,7 @@
|
|||||||
<key>render_compat</key><boolean>1</boolean>
|
<key>render_compat</key><boolean>1</boolean>
|
||||||
<key>inventory_links</key><boolean>1</boolean>
|
<key>inventory_links</key><boolean>1</boolean>
|
||||||
<key>auto_update</key><boolean>0</boolean>
|
<key>auto_update</key><boolean>0</boolean>
|
||||||
|
<key>locked</key><boolean>1</boolean>
|
||||||
</map>
|
</map>
|
||||||
|
|
||||||
<map>
|
<map>
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ HippoGridInfo::HippoGridInfo(const std::string& gridName) :
|
|||||||
mRenderCompat(true),
|
mRenderCompat(true),
|
||||||
mInvLinks(false),
|
mInvLinks(false),
|
||||||
mAutoUpdate(false),
|
mAutoUpdate(false),
|
||||||
|
mLocked(false),
|
||||||
mMaxAgentGroups(-1),
|
mMaxAgentGroups(-1),
|
||||||
mCurrencySymbol("OS$"),
|
mCurrencySymbol("OS$"),
|
||||||
mCurrencyText("OS Dollars"),
|
mCurrencyText("OS Dollars"),
|
||||||
@@ -174,10 +175,12 @@ void HippoGridInfo::setLoginUri(const std::string& loginUri)
|
|||||||
{
|
{
|
||||||
mIsInProductionGrid = true;
|
mIsInProductionGrid = true;
|
||||||
useHttps();
|
useHttps();
|
||||||
|
setPlatform(PLATFORM_SECONDLIFE);
|
||||||
}
|
}
|
||||||
if (utf8str_tolower(LLURI(mLoginUri).hostName()) == "login.aditi.lindenlab.com")
|
if (utf8str_tolower(LLURI(mLoginUri).hostName()) == "login.aditi.lindenlab.com")
|
||||||
{
|
{
|
||||||
useHttps();
|
useHttps();
|
||||||
|
setPlatform(PLATFORM_SECONDLIFE);
|
||||||
}
|
}
|
||||||
if (utf8str_tolower(LLURI(mLoginUri).hostName()) == "login.avination.com" ||
|
if (utf8str_tolower(LLURI(mLoginUri).hostName()) == "login.avination.com" ||
|
||||||
utf8str_tolower(LLURI(mLoginUri).hostName()) == "login.avination.net")
|
utf8str_tolower(LLURI(mLoginUri).hostName()) == "login.avination.net")
|
||||||
@@ -654,11 +657,6 @@ bool HippoGridInfo::getAutoUpdate()
|
|||||||
return mAutoUpdate;
|
return mAutoUpdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HippoGridInfo::setAutoUpdate(bool b)
|
|
||||||
{
|
|
||||||
mAutoUpdate = b;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool HippoGridInfo::getUPCSupported()
|
bool HippoGridInfo::getUPCSupported()
|
||||||
{
|
{
|
||||||
if(isSecondLife())
|
if(isSecondLife())
|
||||||
@@ -1014,7 +1012,8 @@ void HippoGridManager::parseData(LLSD &gridInfo, bool mergeIfNewer)
|
|||||||
if (gridMap.has("search")) grid->setSearchUrl(gridMap["search"]);
|
if (gridMap.has("search")) grid->setSearchUrl(gridMap["search"]);
|
||||||
if (gridMap.has("render_compat")) grid->setRenderCompat(gridMap["render_compat"]);
|
if (gridMap.has("render_compat")) grid->setRenderCompat(gridMap["render_compat"]);
|
||||||
if (gridMap.has("inventory_links")) grid->setSupportsInvLinks(gridMap["inventory_links"]);
|
if (gridMap.has("inventory_links")) grid->setSupportsInvLinks(gridMap["inventory_links"]);
|
||||||
if (gridMap.has("auto_update")) grid->setAutoUpdate(gridMap["auto_update"]);
|
if (gridMap.has("auto_update")) grid->mAutoUpdate = gridMap["auto_update"];
|
||||||
|
if (gridMap.has("locked")) grid->mLocked = gridMap["locked"];
|
||||||
if (newGrid) addGrid(grid);
|
if (newGrid) addGrid(grid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1051,6 +1050,7 @@ void HippoGridManager::saveFile()
|
|||||||
gridInfo[i]["render_compat"] = grid->isRenderCompat();
|
gridInfo[i]["render_compat"] = grid->isRenderCompat();
|
||||||
gridInfo[i]["inventory_links"] = grid->supportsInvLinks();
|
gridInfo[i]["inventory_links"] = grid->supportsInvLinks();
|
||||||
gridInfo[i]["auto_update"] = grid->getAutoUpdate();
|
gridInfo[i]["auto_update"] = grid->getAutoUpdate();
|
||||||
|
gridInfo[i]["locked"] = grid->getLocked();
|
||||||
}
|
}
|
||||||
|
|
||||||
// write client grid info file
|
// write client grid info file
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ class LLSD;
|
|||||||
|
|
||||||
class HippoGridInfo
|
class HippoGridInfo
|
||||||
{
|
{
|
||||||
|
friend class HippoGridManager;
|
||||||
public:
|
public:
|
||||||
enum Platform {
|
enum Platform {
|
||||||
PLATFORM_OTHER = 0,
|
PLATFORM_OTHER = 0,
|
||||||
@@ -96,7 +97,7 @@ public:
|
|||||||
bool supportsInvLinks();
|
bool supportsInvLinks();
|
||||||
void setSupportsInvLinks(bool b);
|
void setSupportsInvLinks(bool b);
|
||||||
bool getAutoUpdate();
|
bool getAutoUpdate();
|
||||||
void setAutoUpdate(bool b);
|
bool getLocked() { return mLocked; }
|
||||||
|
|
||||||
void getGridInfo();
|
void getGridInfo();
|
||||||
|
|
||||||
@@ -124,6 +125,7 @@ private:
|
|||||||
bool mRenderCompat;
|
bool mRenderCompat;
|
||||||
bool mInvLinks;
|
bool mInvLinks;
|
||||||
bool mAutoUpdate;
|
bool mAutoUpdate;
|
||||||
|
bool mLocked;
|
||||||
bool mUPCSupported;
|
bool mUPCSupported;
|
||||||
int mMaxAgentGroups;
|
int mMaxAgentGroups;
|
||||||
|
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ class HippoPanelGridsImpl : public HippoPanelGrids
|
|||||||
enum State { NORMAL, ADD_NEW, ADD_COPY };
|
enum State { NORMAL, ADD_NEW, ADD_COPY };
|
||||||
State mState;
|
State mState;
|
||||||
std::string mCurGrid;
|
std::string mCurGrid;
|
||||||
|
bool mIsEditable;
|
||||||
|
|
||||||
void loadCurGrid();
|
void loadCurGrid();
|
||||||
bool saveCurGrid();
|
bool saveCurGrid();
|
||||||
@@ -78,6 +79,8 @@ class HippoPanelGridsImpl : public HippoPanelGrids
|
|||||||
static void onClickGridInfo(void *data);
|
static void onClickGridInfo(void *data);
|
||||||
static void onClickHelpRenderCompat(void *data);
|
static void onClickHelpRenderCompat(void *data);
|
||||||
static void onClickAdvanced(void *data);
|
static void onClickAdvanced(void *data);
|
||||||
|
|
||||||
|
void enableEditing(bool);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -103,7 +106,7 @@ HippoPanelGrids *HippoPanelGrids::create()
|
|||||||
|
|
||||||
|
|
||||||
HippoPanelGridsImpl::HippoPanelGridsImpl() :
|
HippoPanelGridsImpl::HippoPanelGridsImpl() :
|
||||||
mState(NORMAL)
|
mState(NORMAL), mIsEditable(true)
|
||||||
{
|
{
|
||||||
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_preferences_grids.xml");
|
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_preferences_grids.xml");
|
||||||
}
|
}
|
||||||
@@ -194,27 +197,10 @@ void HippoPanelGridsImpl::refresh()
|
|||||||
|
|
||||||
childSetTextArg("default_grid", "[DEFAULT]", (defaultGrid != "")? defaultGrid: " ");
|
childSetTextArg("default_grid", "[DEFAULT]", (defaultGrid != "")? defaultGrid: " ");
|
||||||
|
|
||||||
childSetEnabled("btn_delete", (selectIndex >= 0));
|
childSetEnabled("btn_delete", (selectIndex >= 0) && mIsEditable );
|
||||||
childSetEnabled("btn_copy", (mState == NORMAL) && (selectIndex >= 0));
|
childSetEnabled("btn_copy", (mState == NORMAL) && (selectIndex >= 0));
|
||||||
childSetEnabled("btn_default", (mState == NORMAL) && (selectIndex > 0));
|
childSetEnabled("btn_default", (mState == NORMAL) && (selectIndex > 0));
|
||||||
childSetEnabled("gridname", (mState == ADD_NEW) || (mState == ADD_COPY));
|
childSetEnabled("gridname", (mState == ADD_NEW) || (mState == ADD_COPY));
|
||||||
|
|
||||||
if (childGetValue("platform").asString() == "SecondLife") {
|
|
||||||
// disable platform selector, if logged into the grid edited and it is SL
|
|
||||||
// so object export restrictions cannot be circumvented by changing the platform
|
|
||||||
bool enablePlatform = (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP) ||
|
|
||||||
(mCurGrid != gHippoGridManager->getConnectedGrid()->getGridName());
|
|
||||||
childSetEnabled("platform", enablePlatform);
|
|
||||||
childSetEnabled("search", false);
|
|
||||||
childSetText("search", LLStringExplicit(""));
|
|
||||||
childSetEnabled("render_compat", false);
|
|
||||||
childSetValue("render_compat", false);
|
|
||||||
} else {
|
|
||||||
childSetEnabled("platform", true);
|
|
||||||
childSetEnabled("search", true);
|
|
||||||
childSetText("search", gHippoGridManager->getConnectedGrid()->getSearchUrl());
|
|
||||||
childSetEnabled("render_compat", true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -256,9 +242,11 @@ void HippoPanelGridsImpl::loadCurGrid()
|
|||||||
childSetText("helperuri", gridInfo->getHelperUri());
|
childSetText("helperuri", gridInfo->getHelperUri());
|
||||||
childSetText("website", gridInfo->getWebSite());
|
childSetText("website", gridInfo->getWebSite());
|
||||||
childSetText("support", gridInfo->getSupportUrl());
|
childSetText("support", gridInfo->getSupportUrl());
|
||||||
|
childSetText("search", gridInfo->getSearchUrl());
|
||||||
childSetText("register", gridInfo->getRegisterUrl());
|
childSetText("register", gridInfo->getRegisterUrl());
|
||||||
childSetText("password", gridInfo->getPasswordUrl());
|
childSetText("password", gridInfo->getPasswordUrl());
|
||||||
childSetValue("render_compat", gridInfo->isRenderCompat());
|
childSetValue("render_compat", gridInfo->isRenderCompat());
|
||||||
|
enableEditing(!gridInfo->getLocked());
|
||||||
} else {
|
} else {
|
||||||
std::string empty = "";
|
std::string empty = "";
|
||||||
LLComboBox *platform = getChild<LLComboBox>("platform");
|
LLComboBox *platform = getChild<LLComboBox>("platform");
|
||||||
@@ -269,10 +257,11 @@ void HippoPanelGridsImpl::loadCurGrid()
|
|||||||
childSetText("helperuri", empty);
|
childSetText("helperuri", empty);
|
||||||
childSetText("website", empty);
|
childSetText("website", empty);
|
||||||
childSetText("support", empty);
|
childSetText("support", empty);
|
||||||
|
childSetText("search", empty);
|
||||||
childSetText("register", empty);
|
childSetText("register", empty);
|
||||||
childSetText("password", empty);
|
childSetText("password", empty);
|
||||||
childSetEnabled("render_compat", true);
|
|
||||||
childSetValue("render_compat", true);
|
childSetValue("render_compat", true);
|
||||||
|
enableEditing(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mState == ADD_NEW) {
|
if (mState == ADD_NEW) {
|
||||||
@@ -281,6 +270,7 @@ void HippoPanelGridsImpl::loadCurGrid()
|
|||||||
childSetText("loginuri", required);
|
childSetText("loginuri", required);
|
||||||
} else if (mState == ADD_COPY) {
|
} else if (mState == ADD_COPY) {
|
||||||
childSetText("gridname", std::string("<required>"));
|
childSetText("gridname", std::string("<required>"));
|
||||||
|
enableEditing(true);
|
||||||
} else if (mState != NORMAL) {
|
} else if (mState != NORMAL) {
|
||||||
llwarns << "Illegal state " << mState << '.' << llendl;
|
llwarns << "Illegal state " << mState << '.' << llendl;
|
||||||
}
|
}
|
||||||
@@ -574,3 +564,31 @@ void HippoPanelGridsImpl::onClickHelpRenderCompat(void *data)
|
|||||||
{
|
{
|
||||||
LLNotificationsUtil::add("HelpRenderCompat");
|
LLNotificationsUtil::add("HelpRenderCompat");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void HippoPanelGridsImpl::enableEditing(bool b)
|
||||||
|
{
|
||||||
|
static const char * elements [] = {
|
||||||
|
"platform",
|
||||||
|
"gridname",
|
||||||
|
"loginuri",
|
||||||
|
"loginpage",
|
||||||
|
"helperuri",
|
||||||
|
"website",
|
||||||
|
"support",
|
||||||
|
"register",
|
||||||
|
"password",
|
||||||
|
"search",
|
||||||
|
"btn_delete",
|
||||||
|
"btn_gridinfo",
|
||||||
|
"render_compat",
|
||||||
|
"gridmessage",
|
||||||
|
0
|
||||||
|
};
|
||||||
|
|
||||||
|
for(int i = 0; elements[i]; ++i ) {
|
||||||
|
this->childSetEnabled(elements[i], b);
|
||||||
|
}
|
||||||
|
|
||||||
|
mIsEditable = b;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user