Skip to content
Snippets Groups Projects
Commit b3c1e967 authored by Merov Linden's avatar Merov Linden
Browse files

EXP-1354 : FIX. Force loading the default toolbars if the user toolbar loading fails somewhat.

parent ab9d1982
No related branches found
No related tags found
No related merge requests found
...@@ -151,6 +151,7 @@ bool LLToolBarView::addCommand(const LLCommandId& command, LLToolBar* toolbar) ...@@ -151,6 +151,7 @@ bool LLToolBarView::addCommand(const LLCommandId& command, LLToolBar* toolbar)
bool LLToolBarView::loadToolbars(bool force_default) bool LLToolBarView::loadToolbars(bool force_default)
{ {
LLToolBarView::ToolbarSet toolbar_set; LLToolBarView::ToolbarSet toolbar_set;
bool err = false;
// Load the toolbars.xml file // Load the toolbars.xml file
std::string toolbar_file = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "toolbars.xml"); std::string toolbar_file = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "toolbars.xml");
...@@ -165,24 +166,39 @@ bool LLToolBarView::loadToolbars(bool force_default) ...@@ -165,24 +166,39 @@ bool LLToolBarView::loadToolbars(bool force_default)
} }
LLXMLNodePtr root; LLXMLNodePtr root;
if(!LLXMLNode::parseFile(toolbar_file, root, NULL)) if (!LLXMLNode::parseFile(toolbar_file, root, NULL))
{ {
llwarns << "Unable to load toolbars from file: " << toolbar_file << llendl; llwarns << "Unable to load toolbars from file: " << toolbar_file << llendl;
return false; err = true;
} }
if(!root->hasName("toolbars"))
if (!err && !root->hasName("toolbars"))
{ {
llwarns << toolbar_file << " is not a valid toolbars definition file" << llendl; llwarns << toolbar_file << " is not a valid toolbars definition file" << llendl;
return false; err = true;
} }
// Parse the toolbar settings // Parse the toolbar settings
LLXUIParser parser; LLXUIParser parser;
parser.readXUI(root, toolbar_set, toolbar_file); if (!err)
if (!toolbar_set.validateBlock())
{ {
llerrs << "Unable to validate toolbars from file: " << toolbar_file << llendl; parser.readXUI(root, toolbar_set, toolbar_file);
return false; }
if (!err && !toolbar_set.validateBlock())
{
llwarns << "Unable to validate toolbars from file: " << toolbar_file << llendl;
err = true;
}
if (err)
{
if (force_default)
{
llerrs << "Unable to load toolbars from default file : " << toolbar_file << llendl;
return false;
}
// Try to load the default toolbars
return loadToolbars(true);
} }
// Clear the toolbars now before adding the loaded commands and settings // Clear the toolbars now before adding the loaded commands and settings
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment